-
Notifications
You must be signed in to change notification settings - Fork 862
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
Retrieve all transaction receipts for a block in one request #6646
Conversation
d89f198
to
ae09fcb
Compare
My node on snap sync shows static block reward as 0 even at genesis block of ETH mainnet. |
89ea57c
to
4341667
Compare
8d61d3e
to
ef71f57
Compare
6c1a93d
to
027d056
Compare
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 the changes make sense. Would like a test for the new method on BlockchainQueries, think other changes are covered already.
ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueries.java
Show resolved
Hide resolved
is this comment related to this change or a separate issue? |
Separate issue. Incidentally discovered when testing the RPC method. |
ok - can you open an issue with more info if we need to look into it? thanks! |
@Wetitpig this PR needs updating with latest main - I don't have permission to update your branch |
2844cfa
to
0a67874
Compare
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.
@Wetitpig can you add a test for BlockchainQueries. transactionReceiptsByBlockHash
@ahamlat Would you mind having a look at this changes and see if they make sense? |
Yes, these changes make sens here. I suggested this modification in this discord thread : https://discord.com/channels/905194001349627914/905205502940696607/1156154204981821500 |
Thanks. |
private BlockReceiptsResult getBlockReceiptsResult(final Hash blockHash) { | ||
final List<TransactionReceiptResult> receiptList = | ||
blockchainQueries | ||
.get() | ||
.blockByHash(blockHash) | ||
.transactionReceiptsByBlockHash(blockHash, protocolSchedule) |
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.
Is there any reason why you didn't use DefaultBlockchain.getTxReceipts here ?
...a/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetMinerDataByBlockHash.java
Show resolved
Hide resolved
With DefaultBlockchain.getTxReceipts, the block receipts are retrieved in one go. Also, keep in mind that DefaultBlockchain.getTxReceipts uses the cache to retrieved the receipts if --cache-last-blocks=n is enabled. With this flag, Besu caches blockchain data while importing blocks. |
@Wetitpig are you still engaged on this PR? it's marked as stale and will be closed in 2 weeks if no activity |
dfa9af0
to
5e8e86a
Compare
Tests have been written for The |
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.
Nice work @Wetitpig
I confirmed that :
eth_getBlockReceipts
is much faster especially when using --cache-last-blocks=512 (from ~500ms to ~50 ms)eth_getMinerDataByBlockHash
is much faster as well with -cache-last-blocks=512 (from ~500ms to ~50 ms)eth_getMinerDataByBlockHash
netBlockReward returns the block reward without the burned fees (see example below)
eth_getMinerDataByBlockHash for block 21363910
Before this PR
netBlockReward = 0.198194985313316095
{"jsonrpc":"2.0","id":1,"result":{"netBlockReward":"0x00000000000000000000000000000000000000000000000002c02149ffdd2cff","staticBlockReward":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionFee":"0x00000000000000000000000000000000000000000000000002c02149ffdd2cff","uncleInclusionReward":"0x0000000000000000000000000000000000000000000000000000000000000000","uncleRewards":[],"coinbase":"0x4838b106fce9647bdf1e7877bf73ce8b0bad5f97","extraData":"0x546974616e2028746974616e6275696c6465722e78797a29","difficulty":"0x0000000000000000000000000000000000000000000000000000000000000000","totalDifficulty":"0x000000000000000000000000000000000000000000000c70d815d562d3cfa955"}}
After this PR
netBlockReward = 0.026228768668364131
{"jsonrpc":"2.0","id":1,"result":{"netBlockReward":"0x000000000000000000000000000000000000000000000000005d2eed175fad63","staticBlockReward":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionFee":"0x000000000000000000000000000000000000000000000000005d2eed175fad63","uncleInclusionReward":"0x0000000000000000000000000000000000000000000000000000000000000000","uncleRewards":[],"coinbase":"0x4838b106fce9647bdf1e7877bf73ce8b0bad5f97","extraData":"0x546974616e2028746974616e6275696c6465722e78797a29","difficulty":"0x0000000000000000000000000000000000000000000000000000000000000000","totalDifficulty":"0x000000000000000000000000000000000000000000000c70d815d562d3cfa955"}}
Signed-off-by: Wetitpig <[email protected]>
Exclude burnt fees Signed-off-by: Wetitpig <[email protected]>
Signed-off-by: Wetitpig <[email protected]>
Signed-off-by: Wetitpig <[email protected]>
Signed-off-by: Wetitpig <[email protected]>
47ad5a5
to
535de72
Compare
@Wetitpig there are some unit and other tests failing - compile errors. you should be able to run these tests locally |
Signed-off-by: Wetitpig <[email protected]>
Signed-off-by: Wetitpig <[email protected]>
535de72
to
a07b1d7
Compare
CHANGELOG.md
Outdated
@@ -67,6 +67,7 @@ | |||
- Add histogram to Prometheus metrics system [#7944](https://github.com/hyperledger/besu/pull/7944) | |||
- Improve newPayload and FCU logs [#7961](https://github.com/hyperledger/besu/pull/7961) | |||
- Proper support for `pending` block tag when calling `eth_estimateGas` and `eth_createAccessList` [#7951](https://github.com/hyperledger/besu/pull/7951) | |||
- Retrieve all transaction receipts for a block in one request [#6646](https://github.com/hyperledger/besu/pull/6646) |
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.
this should move up to the "Unreleased" section
a07b1d7
to
02b56ec
Compare
Signed-off-by: Wetitpig <[email protected]>
02b56ec
to
d00a9e4
Compare
…dger#6646) Signed-off-by: Sally MacFarlane <[email protected]> Signed-off-by: Daniel Lehrner <[email protected]>
Thanks for sending a pull request! Have you done the following?
doc-change-required
label to this PR if updates are required.Most advanced CI tests are deferred until PR approval, but you could:
./gradlew build
./gradlew acceptanceTest
./gradlew integrationTest
./gradlew ethereum:referenceTests:referenceTests
PR description
effectivePriorityFeePerGas
instead ofeffectiveGasPrice
becausebaseFee
would be burnt.