-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
internal/ethapi: allow eth_call with custom code #19836
Comments
An extended version of this would provide an address->code map to swap out the code of multiple contracts which can be useful for debugging proxy contracts, but only swapping out the code of the called contract would already be of much help! |
@chriseth @fjl Any ideas on what API would look better? I can see two options: a) add a new field to the transaction parameter in eth.call, or b) add a new parameter for the entire method. Given that Yet a third way could be to convert the currently optional block number into a possible optional struct that can accept both a block number and an override map. Maybe this last is the best. What's your take? a) |
I think I like option |
Yeah, it was just a quick first guess, open to suggestions :) |
Since the format of the API parameter is changed. An EIP is necessary for this feature :) |
Not really. For example |
Hey @chriseth, we've merged onto master an implementation for this. Could you take a peek? In the end we went with a 4th API, because the block number was mandatory according to the spec. The format is:
Essentially, you have an optional 3rd parameter being a map of overrides. Each element is an The difference between We've tried to make it as flexible as possible to cover present and future use cases. Could you please check if this meets your requirements? |
Oh that's wonderful, thanks a lot! I think it's very useful like that! Now we only need to publicize that so that people can use it! Do you know if something like that will automatically be available on web services once they update? |
I assume yes. I don't think Infura or Cloudflare are doing any filtering or caching or processing on eth_calls. |
But I would appreciate if you could take it for a run before we announce it to everyone :) Just to make sure it actually works the way it's supposed to. |
Somehow I cannot get it to work properly. I used
which results in:
The assembly of the code is:
The code should return 7, but it returns the empty string. Note that web3.js will automatically prune the new positional argument, so be aware if you test it through that. The geth version is the following:
|
@chriseth
|
@chriseth and I tried out this feature together and it was really hard to debug why it didn't work. I think it would be better to add the new parameter into the call object (first parameter), simply because it will be easier to integrate with libraries and tracing. In go-ethereum, that would mean modifying
|
This was shipped in 1.9.2. We can discuss, propose and implement changes to the APIs, but in the mean time I'll close this issue to get rid of it. |
@karalabe can you get a pointer to the tests for this feature? The 0x000...001 was just a simplification I added later on, it also did not work with the actual contract's address, nor with |
Hey, does geth require any special flag to support this? |
Ahh never mind it is just that the example here has the wrong syntax,
|
Hey 👋 Am I correct that this functionality is not available via GraphQL? If it is, could someone provide an example here? |
@chriseth wants this: It would be nice to have a version of eth_call where the caller supplies the EVM code to be executed.
The text was updated successfully, but these errors were encountered: