Skip to content

Commit

Permalink
Add state.reward processing (#558)
Browse files Browse the repository at this point in the history
* Add state.reward processing
  • Loading branch information
rodiazet authored Feb 10, 2023
1 parent 886174b commit 9a5d8f3
Showing 1 changed file with 7 additions and 0 deletions.
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;

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

0 comments on commit 9a5d8f3

Please sign in to comment.