-
Notifications
You must be signed in to change notification settings - Fork 442
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
Add eth_simulate , support array of eth_call for simulation across multiple blocks #5530
Conversation
src/Nethermind/Nethermind.Facade/Proxy/Models/MultiCall/Error.cs
Outdated
Show resolved
Hide resolved
Removed Chain Fork related code
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.
Wanted to merge this so i can use the new processingEnv, but the spec is not finalized yet. :(
src/Nethermind/Nethermind.Facade/Proxy/Models/CallTransactionModel.cs
Outdated
Show resolved
Hide resolved
...mind/Nethermind.JsonRpc.Test/Modules/Eth/Multicall/EthMulticallTestsBlocksAndTransactions.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Facade/Proxy/Models/MultiCall/BlockOverride.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Facade/Proxy/Models/MultiCall/Error.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Facade/Proxy/Models/MultiCall/MultiCallCallResult.cs
Outdated
Show resolved
Hide resolved
…allCallResult.cs Fixes for Success/Failure at MultiCallCallResult Co-authored-by: Ahmad Bitar <33181301+smartprogrammer93@users.noreply.github.com>
…ure/eth_multicall
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.
Hm... I see potential need for ReportEvent
due to injecting artificial events in tracer. But would love to avoid it, maybe we can inject those events directly in MultiCallVirtualMachine
to original collection? Need to think about it.
Apart of that low code hygene, lot of unused stuff, potential exceptions, nulls handled wrong, some bugs.
src/Nethermind/Nethermind.Facade/Proxy/Models/MultiCall/MultiCallBlockStateCallsModel.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Facade/Proxy/Models/MultiCall/BlockOverride.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Facade/Proxy/Models/MultiCall/BlockOverride.cs
Outdated
Show resolved
Hide resolved
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.
Hm... I see potential need for ReportEvent
due to injecting artificial events in tracer. But would love to avoid it, maybe we can inject those events directly in MultiCallVirtualMachine
to original collection? Need to think about it.
Apart of that low code hygene, lot of unused stuff, potential exceptions, nulls handled wrong, some bugs.
src/Nethermind/Nethermind.Consensus/Processing/MultiCallReadOnlyBlocksProcessingEnv.cs
Outdated
Show resolved
Hide resolved
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.
I think we don't have multiple block gas constraints enforced either
Can I simulate invalid chain? |
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.
Very nice work!
src/Nethermind/Nethermind.Facade/Simulate/SimulateReadOnlyBlocksProcessingEnvFactory.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Facade/Simulate/SimulateReadOnlyBlocksProcessingEnv.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Facade/Simulate/SimulateDictionaryBlockStore.cs
Show resolved
Hide resolved
src/Nethermind/Nethermind.Facade/Proxy/Models/Simulate/SimulatePayload.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Facade/Simulate/SimulateBlockTracer.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Facade/Simulate/SimulateTxMutatorTracer.cs
Outdated
Show resolved
Hide resolved
|| results.Error.Contains("InsufficientBalanceException") | ||
)) | ||
results.ErrorCode = ErrorCodes.InvalidTransaction; | ||
|
||
if (results.Error is not null && results.Error.Contains("InvalidBlockException")) | ||
results.ErrorCode = ErrorCodes.InvalidParams; | ||
|
||
|
||
if (results.Error is not null && results.Error.Contains("below intrinsic gas")) | ||
results.ErrorCode = ErrorCodes.InsufficientIntrinsicGas; |
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.
Can we pass the ErrorCode explicitly rather than parsing string?
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.
Sadly "InvalidBlockException" happens for multiple cases here and differs only by its text currently...
Merging for ease of core development. |
This is a PR in progress; changes to it will happen.
In this PR we are implementing eth_simulate proposal.
Changes to be made:
eth_call
like behavior (no validation)Types of changes
What types of changes does your code introduce?
Testing
Requires testing
Also requires comparison with Geth implementation
If yes, did you write tests?
Remarks
Work in progress.
Docker image from commit 2684fba created at
nethermindeth/nethermind:eth_multicall
(08.06.2023)Important configuration options:
JsonRpcConfig
GasCap
(default: 100000000)GasCapMultiplier
, new (default: 2) applied asGasCap *GasCapMultiplier
to limit totall max gas consumption over all blocks on a singleeth_multicall
Important protocol expansions:
AccountOverride
MoveToAddress
field for original code/precompiles redirectionExample call: