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

Add state.reward processing #558

Merged
merged 4 commits into from
Feb 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions test/t8n/t8n.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace fs = std::filesystem;
namespace json = nlohmann;
using namespace evmone;
using namespace evmone::test;
using namespace std::literals;

static const auto NULL_HEXSTRING_256 = "0x" + std::string(512, '0');
static const auto NULL_HEXSTRING_32 = "0x" + std::string(64, '0');
Expand All @@ -30,6 +31,7 @@ int main(int argc, const char* argv[])
fs::path output_dir;
fs::path output_result_file;
fs::path output_alloc_file;
std::optional<intx::uint256> block_reward;

for (int i = 0; i < argc; ++i)
{
Expand All @@ -54,6 +56,8 @@ int main(int argc, const char* argv[])
output_result_file = argv[i];
else if (arg == "--output.alloc" && ++i < argc)
output_alloc_file = argv[i];
else if (arg == "--state.reward" && ++i < argc && argv[i] != "-1"sv)
block_reward = intx::from_string<intx::uint256>(argv[i]);
}

state::BlockInfo block;
Expand Down Expand Up @@ -128,6 +132,9 @@ int main(int argc, const char* argv[])
}
}

if (block_reward.has_value())
state.touch(block.coinbase).balance += *block_reward;
chfast marked this conversation as resolved.
Show resolved Hide resolved

j_result["logsHash"] = hex0x(logs_hash(txs_logs));
j_result["stateRoot"] = hex0x(state::mpt_hash(state.get_accounts()));
}
Expand Down