-
Notifications
You must be signed in to change notification settings - Fork 860
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
eth_simulateV1 - Add BlockSimulator feature #7941
eth_simulateV1 - Add BlockSimulator feature #7941
Conversation
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
besu/src/main/java/org/hyperledger/besu/services/BlockSimulatorServiceImpl.java
Outdated
Show resolved
Hide resolved
datatypes/src/main/java/org/hyperledger/besu/datatypes/BlockOverrides.java
Outdated
Show resolved
Hide resolved
datatypes/src/main/java/org/hyperledger/besu/datatypes/BlockOverrides.java
Outdated
Show resolved
Hide resolved
datatypes/src/main/java/org/hyperledger/besu/datatypes/BlockOverrides.java
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.
Added a few questions
besu/src/main/java/org/hyperledger/besu/services/BlockSimulatorServiceImpl.java
Outdated
Show resolved
Hide resolved
besu/src/main/java/org/hyperledger/besu/services/BlockSimulatorServiceImpl.java
Outdated
Show resolved
Hide resolved
datatypes/src/main/java/org/hyperledger/besu/datatypes/BlockOverrides.java
Outdated
Show resolved
Hide resolved
datatypes/src/main/java/org/hyperledger/besu/datatypes/BlockOverrides.java
Outdated
Show resolved
Hide resolved
...pi/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/BlockResult.java
Show resolved
Hide resolved
...reum/core/src/main/java/org/hyperledger/besu/ethereum/transaction/BlockSimulationResult.java
Outdated
Show resolved
Hide resolved
...reum/core/src/main/java/org/hyperledger/besu/ethereum/transaction/BlockSimulationResult.java
Outdated
Show resolved
Hide resolved
...reum/core/src/main/java/org/hyperledger/besu/ethereum/transaction/BlockSimulationResult.java
Outdated
Show resolved
Hide resolved
|
||
private final boolean validation; | ||
|
||
public BlockStateCall( |
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.
should that be BlockStateCalls?
final List<? extends BlockStateCall> blockStateCalls, | ||
final MutableWorldState worldState) { | ||
List<BlockSimulationResult> simulationResults = new ArrayList<>(); | ||
for (BlockStateCall blockStateCall : blockStateCalls) { |
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 you are simulating multiple blocks, does it make sense that each of the blockStateCalls has it's own blockOverrides?
…rServiceImpl.java Co-authored-by: Stefan Pingel <[email protected]> Signed-off-by: Gabriel-Trintinalia <[email protected]>
…saction/BlockSimulationResult.java Co-authored-by: Stefan Pingel <[email protected]> Signed-off-by: Gabriel-Trintinalia <[email protected]>
…saction/BlockSimulationResult.java Co-authored-by: Stefan Pingel <[email protected]> Signed-off-by: Gabriel-Trintinalia <[email protected]>
…saction/BlockSimulationResult.java Co-authored-by: Stefan Pingel <[email protected]> Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
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't comment too much the changes themselves, but added a few about generic stuff
ethereum/core/src/test/java/org/hyperledger/besu/ethereum/transaction/BlockSimulatorTest.java
Outdated
Show resolved
Hide resolved
blockSimulator.process(blockHeader, Collections.emptyList()); | ||
|
||
assertNotNull(results); | ||
verify(worldStateArchive).getMutable(any(BlockHeader.class), eq(false)); |
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.
Nit: It's usually best to verify mock calls before asserting the results, since incorrect or unexpected calls can produce incorrect results and verifying before asserting can help catch this with less investigation
ethereum/core/src/test/java/org/hyperledger/besu/ethereum/transaction/BlockSimulatorTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
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.
LGTM, but I'll leave unapproved for the others to approved
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.
LGTM 🚢
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.
prob worth a changelog? or wait for the RPC
import java.util.List; | ||
|
||
/** This class represents the result of simulating the processing of a block. */ | ||
public class PluginBlockSimulationResult { |
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.
why PluginBlockSimulationResult - how does this relate to BlockSimulationResult
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Pull Request Description
This pull request introduces a new Block Simulation feature that allows users to simulate multiple transaction calls sequentially, overriding the state and block values for the execution context.
Key Features:
eth_call
in PR #7892.eth_simulateV1
: This PR serves as the base implementation for theeth_simulateV1
method.BlockSimulationService
is introduced, providing plugins with the flexibility to simulate blocks like Besu'sTransactionSimulator
.Spec: ethereum/execution-apis#484
TODO:
eth_simulateV1
JSON-RPC method to handle block simulation requests as outlined in issue #6203. The implementation was initially included in this PR but was split for easier review.