From 112687d9df9b0a2b8b34ab76d9520395dd6e0ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 7 Mar 2022 13:48:03 +0100 Subject: [PATCH] C++: Do not cache tx context in HostContext --- CHANGELOG.md | 2 ++ include/evmc/evmc.hpp | 13 +------------ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index afd9c598b..fa7a75f19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/include/evmc/evmc.hpp b/include/evmc/evmc.hpp index 6328faba3..fdf82d4f4 100644 --- a/include/evmc/evmc.hpp +++ b/include/evmc/evmc.hpp @@ -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. @@ -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 {