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 3 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
13 changes: 13 additions & 0 deletions test/t8n/t8n.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,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 +55,13 @@ 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)
{
if (std::string_view(argv[i]) == "-1")
block_reward = {};
axic marked this conversation as resolved.
Show resolved Hide resolved
else
block_reward = intx::from_string<intx::uint256>(argv[i]);
}
}

state::BlockInfo block;
Expand Down Expand Up @@ -128,6 +136,11 @@ 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
else if (rev <= EVMC_TANGERINE_WHISTLE) // This behaviour is required by retesteth
state.get_accounts().erase(block.coinbase);
Copy link
Member

Choose a reason for hiding this comment

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

Hm, this will remove it even when other transactions touched this account. Is that desired?

Copy link
Collaborator Author

@rodiazet rodiazet Feb 9, 2023

Choose a reason for hiding this comment

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

Sorry. For some reason I removed also checking if it's empty. Fixed now

Copy link
Member

Choose a reason for hiding this comment

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

I'm still not convinced by this quirk. It looks it replicates a bug in some client implementation. Can you provide a list of failing tests?


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