-
Notifications
You must be signed in to change notification settings - Fork 20.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ethclient, mobile: add TransactionSender #15127
Conversation
d3846ea
to
68de1c3
Compare
There are two reasons to do this now: The upcoming ethclient signer doesn't know the public key, just the address. EIP 208 will introduce a new signer which derives the 'entry point' address for transactions with zero signature. The entry point has no public key. Other changes to the interface ease the path make to moving signature crypto out of core/types later.
984140b
to
3e6bf9c
Compare
The new method can get the right signer without any crypto, and without knowledge of the signature scheme that was used when the transaction was included.
3e6bf9c
to
e4ae593
Compare
ethclient/signer.go
Outdated
|
||
var errNotCached = errors.New("sender not cached") | ||
|
||
func setSenderFromServer(tx *types.Transaction, addr common.Address) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can call this method also from getBlock
since the response always contains full transaction details. That saves a round up trip to the node when the client calls TransactionSender
on the transactions in the block.
ethclient/ethclient.go
Outdated
// TODO It'd better to use GetTransactionByBlockHashAndIndex because it works with the | ||
// light client. This will be even more important with EIP 208 because there can be | ||
// multiple inclusions of the same tx. The downside is that users would need to supply | ||
// the inclusion block. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bas-vk I need your feedback on this comment because it would change the method signature. I don't want to change the signature later.
@bas-vk PTAL |
mobile/ethclient.go
Outdated
addr, err := ec.client.TransactionSender(ctx.context, tx.tx) | ||
// GetTransactionSender returns the sender address of a transaction. The transaction must | ||
// be included in the blockchain. | ||
func (ec *EthereumClient) GetTransactionSender(ctx *Context, tx *Transaction, hash *Hash, index int) (sender *Address, _ error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document that hash and index points to a block hash and tx index. That is not obvious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bas-vk PTAL |
👍 |
* core/types: make Signer derive address instead of public key There are two reasons to do this now: The upcoming ethclient signer doesn't know the public key, just the address. EIP 208 will introduce a new signer which derives the 'entry point' address for transactions with zero signature. The entry point has no public key. Other changes to the interface ease the path make to moving signature crypto out of core/types later. * ethclient, mobile: add TransactionSender The new method can get the right signer without any crypto, and without knowledge of the signature scheme that was used when the transaction was included.
The new method can get the right signer without any crypto, and without
knowledge of the signature scheme that was used when the transaction was
included.