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

C++: Do not cache tx context in HostContext #631

Merged
merged 1 commit into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ and this project adheres to [Semantic Versioning].
- The `evmc_message::destination` field has been renamed to `evmc_message::recipient`
to clarify its purpose and match the naming from the Yellow Paper.
[#616](https://github.com/ethereum/evmc/pull/616)
- C++: The `HostContext` does not cache transaction context (`evmc_tx_context`) anymore.
[#631](https://github.com/ethereum/evmc/pull/631)
- Go: The `create2Salt` parameter has been removed from the `VM.Execute()`.
[#612](https://github.com/ethereum/evmc/pull/612)
- Code quality improvements.
Expand Down
13 changes: 1 addition & 12 deletions include/evmc/evmc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@ class HostContext : public HostInterface
{
const evmc_host_interface* host = nullptr;
evmc_host_context* context = nullptr;
mutable evmc_tx_context tx_context = {};

public:
/// Default constructor for null Host context.
Expand Down Expand Up @@ -563,17 +562,7 @@ class HostContext : public HostInterface
}

/// @copydoc HostInterface::get_tx_context()
///
/// The implementation caches the received transaction context
/// by assuming that the block timestamp should never be zero.
///
/// @return The cached transaction context.
evmc_tx_context get_tx_context() const noexcept final
{
if (tx_context.block_timestamp == 0)
tx_context = host->get_tx_context(context);
return tx_context;
}
evmc_tx_context get_tx_context() const noexcept final { return host->get_tx_context(context); }

bytes32 get_block_hash(int64_t number) const noexcept final
{
Expand Down