Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

obscuren
Copy link
Contributor

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.

@mention-bot
Copy link

@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.

@obscuren obscuren changed the title core/vm, internal/ethapi: implemented eth_injectCode_ core/vm, internal/ethapi: implemented eth_injectCode Jan 27, 2017
@obscuren obscuren added this to the 1.5.9 milestone Jan 27, 2017
@fjl fjl changed the title core/vm, internal/ethapi: implemented eth_injectCode core/vm, internal/ethapi: implemented eth_injectCall Jan 28, 2017
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.
Copy link
Member

@bas-vk bas-vk left a 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 {
Copy link
Member

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) {
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

@obscuren obscuren modified the milestones: 1.6.0, 1.5.9 Feb 18, 2017
@karalabe
Copy link
Member

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

@karalabe karalabe modified the milestones: 1.6.1, 1.6.0 Apr 13, 2017
@fjl fjl modified the milestones: 1.6.1, 1.6.3 May 31, 2017
@karalabe karalabe modified the milestones: 1.6.4, 1.6.3 Jun 1, 2017
@fjl
Copy link
Contributor

fjl commented Jun 23, 2017

timed out

@fjl fjl closed this Jun 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants