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

dev: use U64 for transaction_index #4261

Merged

Conversation

ftupas
Copy link
Contributor

@ftupas ftupas commented Aug 18, 2023

Hello, this smol pr does the following

@ftupas ftupas force-pushed the dev/skip-serialize-transactionreceipt branch from 1d41342 to 43b5664 Compare August 18, 2023 11:00
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

index should always be set in receipt and I believe it is always set by reth.

apparently, some clients include to: null, some skip it, I'd like to keep null

/// Address of the receiver. None when it's a contract creation transaction.
#[serde(skip_serializing_if = "Option::is_none")]
pub to: Option<Address>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be null for creations, but it could be that some clients differ

Comment on lines 12 to 13
#[serde(skip_serializing_if = "Option::is_none")]
pub transaction_index: Option<U256>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should actually not be an Option at all.

so we should change this to U64 probably

@mattsse mattsse added the A-rpc Related to the RPC implementation label Aug 18, 2023
@ftupas
Copy link
Contributor Author

ftupas commented Aug 18, 2023

index should always be set in receipt and I believe it is always set by reth.

apparently, some clients include to: null, some skip it, I'd like to keep null

Gotcha, thanks for the review! I've updated the pr to use u64 and remove the skip

@ftupas ftupas changed the title dev: skip serialization for tx receipt index and to if None dev: use u64 for transaction_index Aug 18, 2023
@@ -9,7 +9,7 @@ pub struct TransactionReceipt {
/// Transaction Hash.
pub transaction_hash: Option<H256>,
/// Index within the block.
pub transaction_index: Option<U256>,
pub transaction_index: u64,
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be U64 because should be hex

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha makes sense, thanks! Just changed it to U64 🙂

@ftupas ftupas force-pushed the dev/skip-serialize-transactionreceipt branch from 2697737 to 011dd8d Compare August 18, 2023 20:18
@ftupas ftupas changed the title dev: use u64 for transaction_index dev: use U64 for transaction_index Aug 18, 2023
crates/rpc/rpc/src/eth/api/transactions.rs Outdated Show resolved Hide resolved
crates/rpc/rpc/src/eth/api/transactions.rs Outdated Show resolved Hide resolved
@mattsse mattsse enabled auto-merge August 18, 2023 21:28
@codecov
Copy link

codecov bot commented Aug 18, 2023

Codecov Report

Merging #4261 (5f8f500) into main (82a42c9) will decrease coverage by 0.01%.
Report is 1 commits behind head on main.
The diff coverage is 0.00%.

Impacted file tree graph

Files Changed Coverage Δ
...rates/rpc/rpc-types/src/eth/transaction/receipt.rs 0.00% <ø> (ø)
crates/rpc/rpc/src/eth/api/transactions.rs 31.40% <0.00%> (ø)

... and 12 files with indirect coverage changes

Flag Coverage Δ
integration-tests 16.86% <0.00%> (-0.02%) ⬇️
unit-tests 63.77% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 26.12% <ø> (-0.01%) ⬇️
blockchain tree 82.56% <ø> (ø)
pipeline 90.07% <ø> (ø)
storage (db) 74.77% <ø> (ø)
trie 94.81% <ø> (-0.04%) ⬇️
txpool 49.10% <ø> (-0.13%) ⬇️
networking 77.48% <ø> (+0.01%) ⬆️
rpc 58.70% <0.00%> (-0.01%) ⬇️
consensus 63.53% <ø> (ø)
revm 32.03% <ø> (ø)
payload builder 6.82% <ø> (ø)
primitives 85.93% <ø> (+<0.01%) ⬆️

@mattsse mattsse added this pull request to the merge queue Aug 18, 2023
Merged via the queue into paradigmxyz:main with commit 2abfe23 Aug 18, 2023
23 checks passed
PlamenHristov pushed a commit to PlamenHristov/reth that referenced this pull request Aug 19, 2023
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
alessandromazza98 pushed a commit to alessandromazza98/reth that referenced this pull request Aug 19, 2023
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Related to the RPC implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: Forge scripts fail when TransactionReceipt field transaction_index is set to None
2 participants