Skip to content

Commit ee0bede

Browse files
authored
Merge PR #715: Properly clear transient storage after transaction execution
The transient storage [EIP-1153](https://eips.ethereum.org/EIPS/eip-1153) must not persist between transactions. Clear the transient storage attached to every account at the end of transaction execution.
2 parents f01df56 + 3fc6fef commit ee0bede

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

circle.yml

+7
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,13 @@ jobs:
507507
bin/evmone-blockchaintest
508508
--gtest_filter='*:-bcMultiChainTest.*:bcTotalDifficultyTest.*:bcForkStressTest.ForkStressTest:bcGasPricerTest.RPC_API_Test:bcValidBlockTest.SimpleTx3LowS'
509509
~/tests/BlockchainTests/ValidBlocks
510+
- run:
511+
name: "Blockchain tests (EIPs)"
512+
working_directory: ~/build
513+
command: >
514+
EVMONE_PRECOMPILES_STUB=~/project/test/state/precompiles_stub.json
515+
bin/evmone-blockchaintest
516+
~/tests/EIPTests/BlockchainTests/bcEIP1153-transientStorage
510517
- download_execution_tests:
511518
repo: ipsilon/tests
512519
rev: eof-update-20230828

test/state/state.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,11 @@ std::variant<TransactionReceipt, std::error_code> transition(State& state, const
255255
delete_empty_accounts(state);
256256

257257
// Set accounts and their storage access status to cold in the end of transition process
258-
for (auto& acc : state.get_accounts())
258+
for (auto& [addr, acc] : state.get_accounts())
259259
{
260-
acc.second.access_status = EVMC_ACCESS_COLD;
261-
for (auto& [_, val] : acc.second.storage)
260+
acc.transient_storage.clear();
261+
acc.access_status = EVMC_ACCESS_COLD;
262+
for (auto& [key, val] : acc.storage)
262263
{
263264
val.access_status = EVMC_ACCESS_COLD;
264265
val.original = val.current;

0 commit comments

Comments
 (0)