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

Support rpc pending block tag when estimating gas #7951

Merged
merged 20 commits into from
Dec 6, 2024

Conversation

fab-10
Copy link
Contributor

@fab-10 fab-10 commented Nov 27, 2024

PR description

Implement proper support for pending block tag in estimate gas related RPC methods: eth_estimateGas and eth_createAccessList, since until now pending tag was just an alias for latest, while it should simulate what would be the next block, and simulate the tx on that pending block.

Fixed Issue(s)

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests

fab-10 added 14 commits October 21, 2024 12:09
Signed-off-by: Fabio Di Fabio <[email protected]>
# Conflicts:
#	besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
#	besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java
#	besu/src/main/java/org/hyperledger/besu/controller/ConsensusScheduleBesuControllerBuilder.java
#	besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java
#	consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/CliqueProtocolSchedule.java
#	consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java
#	consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreatorTest.java
#	consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutorTest.java
#	consensus/common/src/main/java/org/hyperledger/besu/consensus/common/MigratingProtocolContext.java
#	consensus/common/src/test/java/org/hyperledger/besu/consensus/common/MigratingProtocolContextTest.java
#	consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleTest.java
#	ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcTestMethodsFactory.java
#	ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/EthGetBlockByNumberLatestDesyncIntegrationTest.java
#	ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/JsonRpcMethodsFactory.java
#	ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/TraceJsonRpcMethods.java
#	ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/graphql/AbstractEthGraphQLHttpServiceTest.java
#	ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreator.java
#	ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/BlockMinerTest.java
#	ethereum/core/src/main/java/org/hyperledger/besu/ethereum/ConsensusContextFactory.java
#	ethereum/core/src/main/java/org/hyperledger/besu/ethereum/MainnetBlockValidator.java
#	ethereum/core/src/main/java/org/hyperledger/besu/ethereum/ProtocolContext.java
#	ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockchainSetupUtil.java
#	ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ExecutionContextTestFixture.java
#	ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/AbstractIsolationTests.java
#	ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServer.java
#	ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fullsync/FullSyncTargetManagerTest.java
#	ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/tasks/DetermineCommonAncestorTaskParameterizedTest.java
#	ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/tasks/DetermineCommonAncestorTaskTest.java
#	ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNode.java
#	ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/BlockchainReferenceTestCaseSpec.java
#	ethereum/retesteth/build.gradle
#	ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/RetestethContext.java
# Conflicts:
#	ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/TraceCallMany.java
#	ethereum/core/src/main/java/org/hyperledger/besu/ethereum/transaction/TransactionSimulator.java
# Conflicts:
#	besu/src/main/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilder.java
#	consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/CliqueDifficultyCalculator.java
#	consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/CliqueProtocolSchedule.java
#	consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/headervalidationrules/CliqueDifficultyValidationRule.java
#	consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueDifficultyCalculatorTest.java
#	ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreator.java
Signed-off-by: Fabio Di Fabio <[email protected]>
# Conflicts:
#	ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthEstimateGas.java
#	plugin-api/build.gradle
# Conflicts:
#	metrics/core/src/main/java/org/hyperledger/besu/metrics/noop/NoOpMetricsSystem.java
#	plugin-api/build.gradle
# Conflicts:
#	plugin-api/build.gradle
…ding-block-tag

# Conflicts:
#	besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
#	besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
#	besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java
#	besu/src/test/java/org/hyperledger/besu/controller/MergeBesuControllerBuilderTest.java
#	ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcTestMethodsFactory.java
#	ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/graphql/GraphQLContextType.java
#	ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpServiceTest.java
@fab-10 fab-10 force-pushed the support-rpc-pending-block-tag branch 2 times, most recently from 0f144e8 to 665f9b6 Compare November 28, 2024 14:31
Signed-off-by: Fabio Di Fabio <[email protected]>
@fab-10 fab-10 force-pushed the support-rpc-pending-block-tag branch from 665f9b6 to 2850b15 Compare November 28, 2024 15:15
@fab-10 fab-10 changed the title Support rpc pending block tag Support rpc pending block tag when estimating gas Nov 28, 2024
# Conflicts:
#	besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java
#	besu/src/test/java/org/hyperledger/besu/controller/MergeBesuControllerBuilderTest.java
#	ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcTestMethodsFactory.java
#	ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/graphql/AbstractEthGraphQLHttpServiceTest.java
#	ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpServiceTest.java
#	plugin-api/build.gradle
Signed-off-by: Fabio Di Fabio <[email protected]>
@fab-10 fab-10 force-pushed the support-rpc-pending-block-tag branch from e489386 to 5082d99 Compare December 2, 2024 14:36
Signed-off-by: Fabio Di Fabio <[email protected]>
@fab-10 fab-10 force-pushed the support-rpc-pending-block-tag branch from 5082d99 to 8794721 Compare December 2, 2024 15:47
@fab-10 fab-10 marked this pull request as ready for review December 2, 2024 15:54
@fab-10 fab-10 self-assigned this Dec 2, 2024
Signed-off-by: Fabio Di Fabio <[email protected]>
Copy link
Contributor

@macfarla macfarla left a comment

Choose a reason for hiding this comment

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

looks pretty good to me - does this not affect eth_call as well?

}
}

public ProcessableBlockHeader simulatePendingBlockHeader() {
Copy link
Contributor

Choose a reason for hiding this comment

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

would it be useful to have a debug or trace log for when this is called

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@fab-10 fab-10 enabled auto-merge (squash) December 6, 2024 10:15
# Conflicts:
#	CHANGELOG.md
#	ethereum/core/src/main/java/org/hyperledger/besu/ethereum/transaction/TransactionSimulator.java
#	plugin-api/build.gradle
@fab-10 fab-10 force-pushed the support-rpc-pending-block-tag branch from 4ab5abb to bb9c754 Compare December 6, 2024 10:40
@fab-10 fab-10 merged commit f8e93bf into hyperledger:main Dec 6, 2024
44 checks passed
@fab-10 fab-10 deleted the support-rpc-pending-block-tag branch December 6, 2024 12:50
@fab-10 fab-10 mentioned this pull request Dec 13, 2024
8 tasks
daniellehrner pushed a commit to daniellehrner/besu that referenced this pull request Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants