-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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
core/vm, internal/ethapi: implemented eth_injectCall #3612
Conversation
@obscuren, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Arachnid, @fjl and @Gustav-Simonsson to be potential reviewers. |
4af96c8
to
2cb9af3
Compare
2cb9af3
to
63df6ca
Compare
The EVM gained a new method called which allows one to call using the caller as context and runs with the given code as if it were a delegate call. The only difference is that does not take an address to get the code *from*. This functions as code injection tool.
63df6ca
to
ea36399
Compare
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.
When this is standardised it should be added to web3/ethclient.
@@ -570,6 +570,63 @@ func (s *PublicBlockChainAPI) doCall(ctx context.Context, args CallArgs, blockNr | |||
return res, gas, err | |||
} | |||
|
|||
type InjectCodeArgs struct { |
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.
Add a unittest that tests json parsing for the code field. The reason is that it embeds CallArgs. If someone adds CallArgs#UnmarshalJSON
that function will be called to parse the json. The result is that fields in InjectCodeArgs
will be ignored and set to their default values without an error.
Code hexutil.Bytes `json:"code"` | ||
} | ||
|
||
func (s *PublicBlockChainAPI) InjectCall(ctx context.Context, args InjectCodeArgs, blockNr rpc.BlockNumber) (hexutil.Bytes, 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.
Add docs.
to = evm.StateDB.GetAccount(caller.Address()) | ||
) | ||
|
||
// Iinitialise a new contract and make initialise the delegate values |
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.
typo
Not sure where to put this. Would be nice to have a proposal instead of adding a custom endpoint into eth. Lets think about it for 1.6.1 |
timed out |
The EVM gained a new method called which allows one to call using the
caller as context and runs with the given code as if it were a delegate
call. The only difference is that does not take an address to get the
code from. This functions as code injection tool.