-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
263 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) 2023 IoTeX Foundation | ||
// This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability | ||
// or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. | ||
// This source code is governed by Apache License 2.0 that can be found in the LICENSE file. | ||
|
||
package evm | ||
|
||
import ( | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/core/state" | ||
) | ||
|
||
// transientStorage is a representation of EIP-1153 "Transient Storage". | ||
type transientStorage map[common.Address]state.Storage | ||
|
||
// newTransientStorage creates a new instance of a transientStorage. | ||
func newTransientStorage() transientStorage { | ||
return make(transientStorage) | ||
} | ||
|
||
// Set sets the transient-storage `value` for `key` at the given `addr`. | ||
func (t transientStorage) Set(addr common.Address, key, value common.Hash) { | ||
if _, ok := t[addr]; !ok { | ||
t[addr] = make(state.Storage) | ||
} | ||
t[addr][key] = value | ||
} | ||
|
||
// Get gets the transient storage for `key` at the given `addr`. | ||
func (t transientStorage) Get(addr common.Address, key common.Hash) common.Hash { | ||
val, ok := t[addr] | ||
if !ok { | ||
return common.Hash{} | ||
} | ||
return val[key] | ||
} | ||
|
||
// Copy does a deep copy of the transientStorage | ||
func (t transientStorage) Copy() transientStorage { | ||
storage := make(transientStorage) | ||
for key, value := range t { | ||
storage[key] = value.Copy() | ||
} | ||
return storage | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
to run the test
you will see the panic failure
and if you comment out L407, the test will pass
so setting
chainConfig.ShanghaiTime
caused some diff behavior inside the go-ethereum