-
Notifications
You must be signed in to change notification settings - Fork 10
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
Index
field on receipt logs does not return correct value for blocks with multiple transactions & logs
#462
Conversation
WalkthroughThe updates enhance the handling of log indices in the blockchain by ensuring that the Changes
Sequence Diagram(s)sequenceDiagram
participant B as Blockchain
participant T as Transaction Handler
participant R as Receipt Handler
participant L as Log Processor
T->>B: Submit Batch Transactions
B-->>T: Confirm Transactions
T->>R: Retrieve Receipts
R-->>T: Return Receipts
T->>L: Process Logs
L-->>T: Return Logs with Correct Indices
T->>B: Validate Transaction Execution
Assessment against linked issues
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? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- models/events.go (1 hunks)
- storage/index_testsuite.go (1 hunks)
- storage/pebble/receipts.go (1 hunks)
- tests/e2e_web3js_test.go (2 hunks)
- tests/go.mod (2 hunks)
- tests/web3js/eth_batch_tx_logs_test.js (1 hunks)
- tests/web3js/eth_logs_filtering_test.js (1 hunks)
Files skipped from review due to trivial changes (2)
- models/events.go
- tests/web3js/eth_logs_filtering_test.js
Additional comments not posted (5)
tests/web3js/eth_batch_tx_logs_test.js (1)
5-39
: Comprehensive test coverage for batch transactions and logs.The test logic and assertions provide thorough validation of batch transaction handling and log retrieval.
storage/pebble/receipts.go (1)
146-157
: Changes align with PR objectives.The introduction of
logIndex
ensures accurate log indexing within a block. SettingRemoved
tofalse
is a good practice for consistency.tests/e2e_web3js_test.go (1)
125-187
: Comprehensive and well-structured tests for batch transactions with logs.The tests enhance coverage for batch transactions and log emission, using embedded resources effectively.
tests/go.mod (1)
84-84
: Dependencies added successfully.The additions of
github.com/google/go-cmp v0.6.0
andgotest.tools v2.2.0+incompatible
as indirect dependencies enhance comparison operations and testing capabilities.Also applies to: 236-236
storage/index_testsuite.go (1)
188-195
: Log indexing logic implemented correctly.The new logic for indexing logs within a block is implemented correctly and aligns with the PR objectives.
However, ensure that related functions correctly handle the updated log indexing.
Run the following script to verify the usage of log indexing in related functions:
9f4d25b
to
e9c90fa
Compare
e9c90fa
to
339bd37
Compare
l.Index = uint(i) | ||
l.Index = logIndex | ||
l.Removed = false | ||
logIndex++ |
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.
damn, nice find
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.
Amazing!
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- models/events.go (1 hunks)
- storage/index_testsuite.go (1 hunks)
- storage/pebble/receipts.go (1 hunks)
- tests/e2e_web3js_test.go (2 hunks)
- tests/go.mod (2 hunks)
- tests/web3js/eth_batch_tx_logs_test.js (1 hunks)
- tests/web3js/eth_logs_filtering_test.js (1 hunks)
Files skipped from review due to trivial changes (2)
- models/events.go
- tests/web3js/eth_logs_filtering_test.js
Files skipped from review as they are similar to previous changes (4)
- storage/index_testsuite.go
- storage/pebble/receipts.go
- tests/go.mod
- tests/web3js/eth_batch_tx_logs_test.js
Additional comments not posted (3)
tests/e2e_web3js_test.go (3)
4-4
: LGTM!The
embed
package is correctly imported.The code changes are approved.
17-23
: LGTM!The
storageByteCode
andstorageABI
variables are correctly declared and embedded.The code changes are approved.
125-188
: LGTM!The
batch run transactions with logs
test case is comprehensive and correctly implemented. It covers the deployment of a contract and subsequent contract calls that emit logs. The test case ensures that each transaction executes successfully.The code changes are approved.
Closes: #461
Description
The
Index
field should be relative to the entire block, and not scoped to the receipt that emitted the log.For contributor use:
master
branchFiles changed
in the Github PR explorerSummary by CodeRabbit
New Features
Bug Fixes
Chores
Tests