-
Notifications
You must be signed in to change notification settings - Fork 293
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
Blockchain tests support: Fix tx receipt rlp encoding #680
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #680 +/- ##
==========================================
- Coverage 97.54% 97.53% -0.01%
==========================================
Files 86 86
Lines 8215 8236 +21
==========================================
+ Hits 8013 8033 +20
- Misses 202 203 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
1e4836f
to
6483ab1
Compare
// Block taken from Ethereum mainnet | ||
// https://etherscan.io/txs?block=4276370 | ||
|
||
TransactionReceipt receipt0{}; |
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 you can use designated initializers: receipt0{.type=...}
.
3f843bb
to
837061d
Compare
test/state/state.cpp
Outdated
@@ -212,7 +213,9 @@ std::variant<TransactionReceipt, std::error_code> transition(State& state, const | |||
std::erase_if(state.get_accounts(), | |||
[](const std::pair<const address, Account>& p) noexcept { return p.second.destructed; }); | |||
|
|||
auto receipt = TransactionReceipt{tx.type, result.status_code, gas_used, host.take_logs(), {}}; | |||
// Cumulative gas used is unknown in this scope. | |||
auto receipt = |
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.
Use simpler syntax.
auto receipt = | |
TransactionReceipt receipt{...}; |
test/state/state.hpp
Outdated
std::vector<Log> logs; | ||
BloomFilter logs_bloom_filter; | ||
/// Root hash of the state after this transaction. It's used in old pre-Byzantium transaction |
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.
/// Root hash of the state after this transaction. It's used in old pre-Byzantium transaction | |
/// Root hash of the state after this transaction. Used only in old pre-Byzantium transactions. |
@@ -138,9 +138,15 @@ struct TransactionReceipt | |||
{ |
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.
Add documentation of TransactionReceipt
.
/// Transaction Receipt
///
/// This struct is used in two contexts:
/// 1. As the formally specified, RLP-encode transaction receipt included in the Ethereum blocks.
/// 2. As the internal representation of the transaction execution result.
/// These both roles share most, but not all the information. There are some fields that cannot be assigned in the single transaction execution context. There are also fields that are not a part of the RLP-encoded transaction receipts.
/// TODO: Consider splitting the struct into two based on the duality explained above.
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.
done
cbc36c8
to
619afad
Compare
619afad
to
70f083f
Compare
cumulative_gas_used
instead ofgas_used