Skip to content

Commit

Permalink
C++: Do not cache tx context in HostContext
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Mar 7, 2022
1 parent 9766b77 commit 112687d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
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

0 comments on commit 112687d

Please sign in to comment.