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

Fix state sync hash #1207

Merged
merged 2 commits into from
May 6, 2024
Merged

Conversation

anshalshukla
Copy link
Contributor

Description

Fixes hashing of state sync transactions in RPC calls.

Changes

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)
  • Changes only for a subset of nodes

Checklist

  • I have added at least 2 reviewer or the whole pos-v1 team
  • I have added sufficient documentation in code
  • I will be resolving comments - if any - by pushing each fix in a separate commit and linking the commit hash in the comment reply
  • Created a task in Jira and informed the team for implementation in Erigon client (if applicable)
  • Includes RPC methods changes, and the Notion documentation has been updated

Cross repository changes

  • This PR requires changes to heimdall
    • In case link the PR here:
  • This PR requires changes to matic-cli
    • In case link the PR here:

Testing

  • I have added unit tests
  • I have added tests to CI
  • I have tested this code manually on local environment
  • I have tested this code manually on remote devnet using express-cli
  • I have tested this code manually on mumbai
  • I have created new e2e tests into express-cli

Manual tests

Please complete this section with the steps you performed if you ran manual tests for this functionality, otherwise delete it

Additional comments

Please post additional comments in this section if you have them, otherwise delete it

@anshalshukla anshalshukla changed the base branch from master to v1.3.0-beta-candidate April 3, 2024 09:25
@@ -1092,7 +1092,7 @@ func (s *BlockChainAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.

result := make([]map[string]interface{}, len(receipts))
for i, receipt := range receipts {
result[i] = marshalReceipt(receipt, block.Hash(), block.NumberU64(), signer, txs[i], i)
result[i] = marshalReceipt(receipt, block.Hash(), block.NumberU64(), signer, txs[i], i, false)
Copy link
Member

Choose a reason for hiding this comment

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

Can't remember but why aren't we filling state sync receipts here ?

Copy link

codecov bot commented Apr 3, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 51.41%. Comparing base (fd4b9c2) to head (53db521).
Report is 3 commits behind head on v1.3.0-beta-candidate.

❗ Current head 53db521 differs from pull request most recent head c2ad6a6. Consider uploading reports for the commit c2ad6a6 to get more accurate results

Files Patch % Lines
internal/ethapi/api.go 60.00% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@                    Coverage Diff                    @@
##           v1.3.0-beta-candidate    #1207      +/-   ##
=========================================================
- Coverage                  51.44%   51.41%   -0.04%     
=========================================================
  Files                        794      794              
  Lines                     131304   131310       +6     
=========================================================
- Hits                       67549    67512      -37     
- Misses                     59576    59619      +43     
  Partials                    4179     4179              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cffls
Copy link
Contributor

cffls commented Apr 3, 2024

Is it possible to add a unit test for this fix?

Copy link

This PR is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Apr 25, 2024
Comment on lines 1093 to 1096
result := make([]map[string]interface{}, len(receipts))
for i, receipt := range receipts {
result[i] = marshalReceipt(receipt, block.Hash(), block.NumberU64(), signer, txs[i], i)
result[i] = marshalReceipt(receipt, block.Hash(), block.NumberU64(), signer, txs[i], i, false)
}
Copy link

@CaraWang CaraWang Apr 25, 2024

Choose a reason for hiding this comment

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

Hi! Should we append state sync receipt after the expected receipts?

Suggested change
result := make([]map[string]interface{}, len(receipts))
for i, receipt := range receipts {
result[i] = marshalReceipt(receipt, block.Hash(), block.NumberU64(), signer, txs[i], i)
result[i] = marshalReceipt(receipt, block.Hash(), block.NumberU64(), signer, txs[i], i, false)
}
result := make([]map[string]interface{}, len(receipts+1))
for i, receipt := range receipts {
result[i] = marshalReceipt(receipt, block.Hash(), block.NumberU64(), signer, txs[i], i, false)
}
receipt := rawdb.ReadBorReceipt(s.b.ChainDb(), block.Hash(), block.NumberU64(), s.b.ChainConfig())
if receipt != nil {
tx, _, _, _ := rawdb.ReadBorTransaction(s.b,ChainDb(), receipt.TxHash)
fields := ethapi.MarshalReceipt(receipt, block.Hash(), block.NumberU64(), signer, tx, int(receipt.TransactionIndex), true)
txReceipts = append(txReceipts, fields)
}

@tobidae-cb
Copy link

Hi, what's the status of this PR?

@github-actions github-actions bot removed the Stale label Apr 26, 2024
@pratikspatil024 pratikspatil024 linked an issue May 2, 2024 that may be closed by this pull request
@pratikspatil024 pratikspatil024 requested a review from a team May 2, 2024 11:11
… state sync txn in GetTransactonReceiptsByBlock
@anshalshukla anshalshukla changed the base branch from v1.3.0-beta-candidate to v1.3.2-beta-candidate May 6, 2024 14:30
@anshalshukla anshalshukla merged commit 7c729f5 into v1.3.2-beta-candidate May 6, 2024
9 of 10 checks passed
@pratikspatil024 pratikspatil024 deleted the fix-state-sync-hash branch May 10, 2024 04:20
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.

eth_getTransactionReceipt is broken
8 participants