-
Notifications
You must be signed in to change notification settings - Fork 331
Add features required to properly calculate transaction hash #608
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| // Copyright 2022 The evmone Authors. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #include "../utils/stdx/utility.hpp" | ||
| #include "statetest.hpp" | ||
| #include <evmone/eof.hpp> | ||
| #include <nlohmann/json.hpp> | ||
|
|
@@ -249,7 +250,7 @@ static void from_json_tx_common(const json::json& j, state::Transaction& o) | |
| if (j.contains("maxFeePerGas") || j.contains("maxPriorityFeePerGas")) | ||
| { | ||
| throw std::invalid_argument( | ||
| "Misformatted transaction -- contains both legacy and 1559 fees"); | ||
| "invalid transaction: contains both legacy and EIP-1559 fees"); | ||
| } | ||
| } | ||
| else | ||
|
|
@@ -265,12 +266,24 @@ state::Transaction from_json<state::Transaction>(const json::json& j) | |
| { | ||
| state::Transaction o; | ||
| from_json_tx_common(j, o); | ||
| if (const auto chain_id_it = j.find("chainId"); chain_id_it != j.end()) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this optional?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In generated state tests it's not present but it looks that state test loader does not use this function. I make is mandatory and run test generation and state tests once again.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When generating state tests using
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with whatever. I was just curious. |
||
| o.chain_id = from_json<uint8_t>(*chain_id_it); | ||
| o.data = from_json<bytes>(j.at("input")); | ||
| o.gas_limit = from_json<int64_t>(j.at("gas")); | ||
| o.value = from_json<intx::uint256>(j.at("value")); | ||
|
|
||
| if (const auto ac_it = j.find("accessList"); ac_it != j.end()) | ||
| { | ||
| o.access_list = from_json<state::AccessList>(*ac_it); | ||
| if (o.kind == state::Transaction::Kind::legacy) // Upgrade tx type if tx has "accessList" | ||
| o.kind = state::Transaction::Kind::eip2930; | ||
| } | ||
|
|
||
| if (const auto type_it = j.find("type"); type_it != j.end()) | ||
| { | ||
| if (stdx::to_underlying(o.kind) != from_json<uint8_t>(*type_it)) | ||
| throw std::invalid_argument("wrong transaction type"); | ||
| } | ||
|
|
||
| o.nonce = from_json<uint64_t>(j.at("nonce")); | ||
| o.r = from_json<intx::uint256>(j.at("r")); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.