-
Notifications
You must be signed in to change notification settings - Fork 20.9k
Override of block number in eth_call and tracing #24025
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
Comments
Definitely not, it would break way too many thing and be too dangerous to keep around.
What would be the purpose of that? Do you have an example?
There's no current functionality for it, but it did occur to me a few times that users might want trace a call on top of a intermediate state and it might be a good idea to allow it. Perhaps we could extend traceCall with an initial set of "prep" calls that mutates the state before the actual tracing? |
Hey Karalabe, The current purpose is to debugTrace my code which has protection (lock) mechanism based on block.number. Other purpose that I'm thinking about is for example detecting if a public live contract is malicious. The prep calls would be very useful for my use case. And I think it would be the most flexible method. The special opcode I was referring to would just be for my own usage but just wondered if there were better approaches. Thanks |
I think the request here is to have a way of overriding the block number seen by the EVM during eth_call and in tracing. This is a reasonable idea since we already allow other state overrides. Question is mostly how we could encode it into the override parameter. At the moment, the override parameter is an object with account addresses as keys. There is no way to fit the block number in there. We would have to add another parameter with EVM overrides. It might also be useful to allow overriding the block timestamp and hash, for example. |
Hey, I'm not familiar with geth's code, but I would suggest using state override set used in eth_call. |
Hey karalabe, I think the prep calls or ability to join multiple calls together will be quite useful here. I tried to examine a bit of geth's code: would prep calls or ability to execute multiple eth_calls with remembered state be realized for example by keeping statedb the same, but applying core.ApplyMessage(vmenv, message, ...) multiple times on the same vmenv instance? (api.go, line 898) Thanks |
I have created a new issue for your second request. Let's keep this issue about the first request, overriding the block number. |
"overriding the block timestamp" can be useful. for orders with startTime & expirationTime constraints, if an order has a startTime > curBlock.timestamp, overriding the current block's timestamp will be helpful to test the match result at current block, instead of waiting for the order become valid. |
Hey,
Are there any methods to modify protected global variables such as block.number on debug calls? Or can this be done with EVM tool? For example I'd like to increment block.number during my solidity function call (debug call, not sending).
Or alternatively can I do joined debug_traceCalls, so that the EVM/geth remembers the state of my last call? Or perhaps if I could implement a special opcode to increment global variables on the contract call?
Thanks
The text was updated successfully, but these errors were encountered: