evm: fix non-determinism (#352)

* evm: fix non-determinism

* fixes

* typo

* fix tests

* use Storage slice

* more fixes

* lint

* merge development

* additional tests
This commit is contained in:
Federico Kunze
2020-07-13 16:01:45 -04:00
committed by GitHub
parent 42fc796595
commit 90f39390bc
16 changed files with 503 additions and 255 deletions
+3 -31
View File
@@ -1,40 +1,12 @@
package types
import (
"fmt"
ethcmn "github.com/ethereum/go-ethereum/common"
)
// ----------------------------------------------------------------------------
// Code & Storage
// Code
// ----------------------------------------------------------------------------
type (
// Code is account Code type alias
Code []byte
// Storage is account storage type alias
Storage map[ethcmn.Hash]ethcmn.Hash
)
// Code is account Code type alias
type Code []byte
func (c Code) String() string {
return string(c)
}
func (c Storage) String() (str string) {
for key, value := range c {
str += fmt.Sprintf("%X : %X\n", key, value)
}
return
}
// Copy returns a copy of storage.
func (c Storage) Copy() Storage {
cpy := make(Storage)
for key, value := range c {
cpy[key] = value
}
return cpy
}