Closed m-Peter closed 2 months ago
[!NOTE] Currently processing new changes in this PR. This may take a few minutes, please wait...
Commits
Files that changed from the base of the PR and between d6628b3f0354c6ec051a2a6aa0fb188f54459f59 and eaa4956a28b59fae92b9a9f46b38a1c64ba5c3f9.Files selected for processing (1)
* tests/web3js/eth_non_interactive_test.js (2 hunks)_______________________________________________________________________________ < Why do we never have time to do it right, but always have time to do it over? > ------------------------------------------------------------------------------- \ \ (\__/) (•ㅅ•) / づ
The changes enhance the CadenceEvents
class by implementing logic to accurately compute cumulativeGasUsed
for transaction receipts within the Transactions
method. Additionally, the test suite was updated to verify this calculation, ensuring precise tracking of gas usage across batch transactions.
File | Change Summary |
---|---|
models/events.go | Enhanced the Transactions method to calculate cumulativeGasUsed for transaction receipts. |
models/transaction.go | Removed CumulativeGasUsed from gethReceipt struct for simplification. |
tests/web3js/eth_batch_retrieval_test.js | Updated test function for clarity and added logic to validate cumulativeGasUsed for each transaction. |
tests/web3js/eth_deploy_contract_and_interact_test.js | Added assertions to verify gasUsed and cumulativeGasUsed during contract deployment. |
tests/web3js/eth_non_interactive_test.js | Modified assertions to ensure gas usage consistency based on transaction receipt details. |
sequenceDiagram
participant User
participant CadenceEvents
participant Web3Provider
User->>CadenceEvents: Call Transactions method
CadenceEvents->>Web3Provider: Fetch batch transactions
Web3Provider-->>CadenceEvents: Return transactions and receipts
loop Calculate cumulativeGasUsed
CadenceEvents->>CadenceEvents: Calculate cumulativeGasUsed for each receipt
end
CadenceEvents-->>User: Return transactions with cumulativeGasUsed
Objective | Addressed | Explanation |
---|---|---|
Calculate properly the CumulativeGasUsed field for transaction receipts (#357) |
✅ |
In the world of code, where gas is tall,
Transactions gather, big and small.
With gas calculated, cumulative and wise,
Our tests now see through clearer eyes.
Batch by batch, receipts align,
In CadenceEvents, all is fine. 🚀
[!TIP]
CodeRabbit can use your project's `golangci-lint` configuration to improve the quality of Go code reviews.
Add a [configuration file](https://golangci-lint.run/usage/configuration/) to your project to customize how CodeRabbit runs `golangci-lint`.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Nice work, but we don't need this anymore since it was added to the receipt in flow-go latest PRs.
Will convert to draft until we update flow-go with those PRs
Nice work, but we don't need this anymore since it was added to the receipt in flow-go latest PRs.
Thanks for the flag @sideninja . I didn't know this was being worked on the flow-go
side :innocent:
I did found the addition of CumulativeGasUsed
field in the Receipt
(https://github.com/onflow/flow-go/blob/08e28b9bd69e2fdcb0e21fa2cb58b441bc075e9d/fvm/evm/types/result.go#L138), but we can't make use of that in the Gateway.
It has to be included in the EVM.TransactionExecuted
event as well: https://github.com/onflow/flow-go/blob/master/fvm/evm/stdlib/contract.cdc#L39-L75. Or am I missing something? :thinking:
Nice work, but we don't need this anymore since it was added to the receipt in flow-go latest PRs.
Thanks for the flag @sideninja . I didn't know this was being worked on the
flow-go
side 😇 I did found the addition ofCumulativeGasUsed
field in theReceipt
(https://github.com/onflow/flow-go/blob/08e28b9bd69e2fdcb0e21fa2cb58b441bc075e9d/fvm/evm/types/result.go#L138), but we can't make use of that in the Gateway. It has to be included in theEVM.TransactionExecuted
event as well: https://github.com/onflow/flow-go/blob/master/fvm/evm/stdlib/contract.cdc#L39-L75. Or am I missing something? 🤔
Yeah it was just added so hard for you to know it. If it's not in the execution result it should be I guess. Maybe we can add it there.
Can I merge @m-Peter ?
@sideninja Yeah, it's good to go. I will follow-up with a PR, for the leftover comments :pray:
Closes: https://github.com/onflow/flow-evm-gateway/issues/357
Description
We calculate this field when consuming the Cadence events, as it is not included in the
EVM.TransactionExecuted
event. I am not sure if it is easy to add it there.For contributor use:
master
branchFiles changed
in the Github PR explorerSummary by CodeRabbit
New Features
Tests