From edf002f2ca3752ff892d0d928ef2e8df14eb35f8 Mon Sep 17 00:00:00 2001 From: tony Date: Mon, 18 Dec 2023 16:07:43 +0800 Subject: [PATCH] switch keccak hash's upstream to golang.org/x/crypto/sha3 --- builtin/executor_test.go | 3 +-- go.mod | 6 +++--- go.sum | 10 +++++++--- state/cached_object_test.go | 3 +-- state/stage_test.go | 3 +-- state/state.go | 5 ++--- state/state_test.go | 5 ++--- thor/address.go | 3 +-- thor/hash.go | 36 ++++++++++++++++++++++++++++++++++++ tracers/js/goja.go | 3 +-- tracers/native/prestate.go | 3 +-- trie/trie_test.go | 3 +-- vm/analysis_test.go | 4 ++-- vm/contracts.go | 5 +++-- vm/evm.go | 8 ++++---- vm/instructions_test.go | 4 ++-- vm/patch.go | 4 ++-- 17 files changed, 70 insertions(+), 38 deletions(-) diff --git a/builtin/executor_test.go b/builtin/executor_test.go index 9e2ecf3dd..89bbc4dcb 100644 --- a/builtin/executor_test.go +++ b/builtin/executor_test.go @@ -12,7 +12,6 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/assert" "github.com/vechain/thor/builtin" "github.com/vechain/thor/chain" @@ -195,7 +194,7 @@ func TestExecutorProposal(t *testing.T) { proposalID := func() thor.Bytes32 { var b8 [8]byte binary.BigEndian.PutUint64(b8[:], test.rt.Context().Time) - return thor.Bytes32(crypto.Keccak256Hash(b8[:], approver[:])) + return thor.Keccak256Hash(b8[:], approver[:]) }() test.Case("propose", target, data). Caller(approver). diff --git a/go.mod b/go.mod index aca423b91..ea3e4235d 100644 --- a/go.mod +++ b/go.mod @@ -25,8 +25,8 @@ require ( github.com/stretchr/testify v1.7.2 github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a github.com/vechain/go-ecvrf v0.0.0-20220525125849-96fa0442e765 - golang.org/x/crypto v0.14.0 - golang.org/x/sys v0.13.0 + golang.org/x/crypto v0.16.0 + golang.org/x/sys v0.15.0 gopkg.in/cheggaaa/pb.v1 v1.0.28 gopkg.in/urfave/cli.v1 v1.20.0 gopkg.in/yaml.v2 v2.4.0 @@ -52,7 +52,7 @@ require ( github.com/mattn/go-runewidth v0.0.4 // indirect github.com/rjeczalik/notify v0.9.3 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/text v0.14.0 // indirect gopkg.in/karalabe/cookiejar.v2 v2.0.0-20150724131613-8dcd6a7f4951 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 4de2f0b98..2d1d261c2 100644 --- a/go.sum +++ b/go.sum @@ -146,8 +146,9 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= @@ -191,13 +192,15 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -205,8 +208,9 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= diff --git a/state/cached_object_test.go b/state/cached_object_test.go index f400d4cba..cd4d4904c 100644 --- a/state/cached_object_test.go +++ b/state/cached_object_test.go @@ -10,7 +10,6 @@ import ( "math/rand" "testing" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/rlp" "github.com/stretchr/testify/assert" "github.com/vechain/thor/muxdb" @@ -44,7 +43,7 @@ func TestCachedObject(t *testing.T) { code := make([]byte, 100) rand.Read(code) - codeHash := crypto.Keccak256(code) + codeHash := thor.Keccak256(code) db.NewStore(codeStoreName).Put(codeHash, code) account := Account{ diff --git a/state/stage_test.go b/state/stage_test.go index 3aa242950..416ba0db9 100644 --- a/state/stage_test.go +++ b/state/stage_test.go @@ -9,7 +9,6 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/assert" "github.com/vechain/thor/muxdb" "github.com/vechain/thor/thor" @@ -50,7 +49,7 @@ func TestStage(t *testing.T) { assert.Equal(t, M(balance, nil), M(state.GetBalance(addr))) assert.Equal(t, M(code, nil), M(state.GetCode(addr))) - assert.Equal(t, M(thor.Bytes32(crypto.Keccak256Hash(code)), nil), M(state.GetCodeHash(addr))) + assert.Equal(t, M(thor.Keccak256Hash(code), nil), M(state.GetCodeHash(addr))) for k, v := range storage { assert.Equal(t, M(v, nil), M(state.GetStorage(addr, k))) diff --git a/state/state.go b/state/state.go index 8bbf69fb5..00284c2fc 100644 --- a/state/state.go +++ b/state/state.go @@ -10,7 +10,6 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/rlp" "github.com/vechain/thor/lowrlp" "github.com/vechain/thor/muxdb" @@ -315,7 +314,7 @@ func (s *State) SetCode(addr thor.Address, code []byte) error { var codeHash []byte if len(code) > 0 { s.sm.Put(codeKey(addr), code) - codeHash = crypto.Keccak256(code) + codeHash = thor.Keccak256(code) codeCache.Add(string(codeHash), code) } else { s.sm.Put(codeKey(addr), []byte(nil)) @@ -450,7 +449,7 @@ func (s *State) Stage(newBlockNum, newBlockConflicts uint32) (*Stage, error) { case codeKey: code := v.([]byte) if len(code) > 0 { - codes[thor.Bytes32(crypto.Keccak256Hash(code))] = code + codes[thor.Keccak256Hash(code)] = code } case storageKey: if c, jerr = getChanged(key.addr); jerr != nil { diff --git a/state/state_test.go b/state/state_test.go index 87ea73841..0f6bd7b22 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -9,7 +9,6 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/rlp" "github.com/stretchr/testify/assert" "github.com/vechain/thor/muxdb" @@ -39,7 +38,7 @@ func TestStateReadWrite(t *testing.T) { state.SetCode(addr, []byte("code")) assert.Equal(t, M([]byte("code"), nil), M(state.GetCode(addr))) - assert.Equal(t, M(thor.Bytes32(crypto.Keccak256Hash([]byte("code"))), nil), M(state.GetCodeHash(addr))) + assert.Equal(t, M(thor.Keccak256Hash([]byte("code")), nil), M(state.GetCodeHash(addr))) assert.Equal(t, M(thor.Bytes32{}, nil), M(state.GetStorage(addr, storageKey))) state.SetStorage(addr, storageKey, thor.BytesToBytes32([]byte("storageValue"))) @@ -85,7 +84,7 @@ func TestStateRevert(t *testing.T) { v := values[len(values)-i-1] assert.Equal(t, M(v.balance, nil), M(state.GetBalance(addr))) assert.Equal(t, M(v.code, nil), M(state.GetCode(addr))) - assert.Equal(t, M(thor.Bytes32(crypto.Keccak256Hash(v.code)), nil), M(state.GetCodeHash(addr))) + assert.Equal(t, M(thor.Keccak256Hash(v.code), nil), M(state.GetCodeHash(addr))) assert.Equal(t, M(v.storage, nil), M(state.GetStorage(addr, storageKey))) state.RevertTo(chk) chk-- diff --git a/thor/address.go b/thor/address.go index 5dc965020..b6979c92e 100644 --- a/thor/address.go +++ b/thor/address.go @@ -13,7 +13,6 @@ import ( "strings" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" ) const ( @@ -108,5 +107,5 @@ func CreateContractAddress(txID Bytes32, clauseIndex uint32, creationCount uint3 var b4_1, b4_2 [4]byte binary.BigEndian.PutUint32(b4_1[:], clauseIndex) binary.BigEndian.PutUint32(b4_2[:], creationCount) - return BytesToAddress(crypto.Keccak256(txID[:], b4_1[:], b4_2[:])) + return BytesToAddress(Keccak256(txID[:], b4_1[:], b4_2[:])) } diff --git a/thor/hash.go b/thor/hash.go index b5f781ff1..30e971751 100644 --- a/thor/hash.go +++ b/thor/hash.go @@ -11,6 +11,7 @@ import ( "sync" "github.com/vechain/thor/blake2b" + "golang.org/x/crypto/sha3" ) // NewBlake2b return blake2b-256 hash. @@ -56,3 +57,38 @@ var hstatePool = sync.Pool{ } }, } + +// KeccakState wraps sha3.state. In addition to the usual hash methods, it also supports +// Read to get a variable amount of data from the hash state. Read is faster than Sum +// because it doesn't copy the internal state, but also modifies the internal state. +type KeccakState interface { + hash.Hash + Read([]byte) (int, error) +} + +// NewKeccakState creates a new KeccakState +func NewKeccakState() KeccakState { + return sha3.NewLegacyKeccak256().(KeccakState) +} + +// Keccak256 calculates and returns the Keccak256 hash of the input data. +func Keccak256(data ...[]byte) []byte { + b := make([]byte, 32) + d := NewKeccakState() + for _, b := range data { + d.Write(b) + } + d.Read(b) + return b +} + +// Keccak256Hash calculates and returns the Keccak256 hash of the input data, +// converting it to an internal Hash data structure. +func Keccak256Hash(data ...[]byte) (h Bytes32) { + d := NewKeccakState() + for _, b := range data { + d.Write(b) + } + d.Read(h[:]) + return h +} diff --git a/tracers/js/goja.go b/tracers/js/goja.go index a381b83a8..15aba9e83 100644 --- a/tracers/js/goja.go +++ b/tracers/js/goja.go @@ -26,7 +26,6 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto" "github.com/vechain/thor/thor" "github.com/vechain/thor/tracers" @@ -431,7 +430,7 @@ func (t *jsTracer) setBuiltinFunctions() { return nil } code = common.CopyBytes(code) - b := vm.CreateAddress2(addr, common.HexToHash(salt), crypto.Keccak256Hash(code).Bytes()).Bytes() + b := vm.CreateAddress2(addr, common.HexToHash(salt), thor.Keccak256(code)).Bytes() res, err := t.toBuf(jsvm, b) if err != nil { jsvm.Interrupt(err) diff --git a/tracers/native/prestate.go b/tracers/native/prestate.go index 48f1135ab..d9bc5e78b 100644 --- a/tracers/native/prestate.go +++ b/tracers/native/prestate.go @@ -24,7 +24,6 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto" "github.com/vechain/thor/thor" "github.com/vechain/thor/tracers" "github.com/vechain/thor/vm" @@ -234,7 +233,7 @@ func (t *prestateTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, if err != nil { return } - inithash := crypto.Keccak256(init) + inithash := thor.Keccak256(init) salt := stackData[stackLen-4] addr := vm.CreateAddress2(contract.Address(), salt.Bytes32(), inithash) t.lookupAccount(addr) diff --git a/trie/trie_test.go b/trie/trie_test.go index dfc3af56c..a04d6934b 100644 --- a/trie/trie_test.go +++ b/trie/trie_test.go @@ -30,7 +30,6 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/rlp" "github.com/stretchr/testify/assert" @@ -573,7 +572,7 @@ func BenchmarkHash(b *testing.B) { nonce = uint64(random.Int63()) balance = new(big.Int).Rand(random, new(big.Int).Exp(common.Big2, common.Big256, nil)) root = emptyRoot - code = crypto.Keccak256(nil) + code = thor.Keccak256(nil) ) accounts[i], _ = rlp.EncodeToBytes([]interface{}{nonce, balance, root, code}) } diff --git a/vm/analysis_test.go b/vm/analysis_test.go index 398861f8a..098364919 100644 --- a/vm/analysis_test.go +++ b/vm/analysis_test.go @@ -20,7 +20,7 @@ import ( "math/bits" "testing" - "github.com/ethereum/go-ethereum/crypto" + "github.com/vechain/thor/thor" ) func TestJumpDestAnalysis(t *testing.T) { @@ -77,7 +77,7 @@ func BenchmarkJumpdestHashing_1200k(bench *testing.B) { bench.SetBytes(analysisCodeSize) bench.ResetTimer() for i := 0; i < bench.N; i++ { - crypto.Keccak256Hash(code) + thor.Keccak256Hash(code) } bench.StopTimer() } diff --git a/vm/contracts.go b/vm/contracts.go index 9b249253b..ca2a81ae2 100644 --- a/vm/contracts.go +++ b/vm/contracts.go @@ -29,6 +29,7 @@ import ( "golang.org/x/crypto/ripemd160" "github.com/vechain/thor/blake2b" + "github.com/vechain/thor/thor" "github.com/vechain/thor/vm/bn256" ) @@ -139,7 +140,7 @@ func (c *ecrecover) Run(input []byte) ([]byte, error) { } // the first byte of pubkey is bitcoin heritage - return common.LeftPadBytes(crypto.Keccak256(pubKey[1:])[12:], 32), nil + return common.LeftPadBytes(thor.Keccak256(pubKey[1:])[12:], 32), nil } // safe_ecrecover prevent touching the input buffer. @@ -177,7 +178,7 @@ func (c *safe_ecrecover) Run(input []byte) ([]byte, error) { } // the first byte of pubkey is bitcoin heritage - return common.LeftPadBytes(crypto.Keccak256(pubKey[1:])[12:], 32), nil + return common.LeftPadBytes(thor.Keccak256(pubKey[1:])[12:], 32), nil } // SHA256 implemented as a native contract. diff --git a/vm/evm.go b/vm/evm.go index 444f2e6b9..7f2af34f8 100644 --- a/vm/evm.go +++ b/vm/evm.go @@ -21,14 +21,14 @@ import ( "sync/atomic" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/params" "github.com/holiman/uint256" + "github.com/vechain/thor/thor" ) // emptyCodeHash is used by create to ensure deployment is disallowed to already // deployed contract addresses (relevant after the account abstraction). -var emptyCodeHash = crypto.Keccak256Hash(nil) +var emptyCodeHash = common.Hash(thor.Keccak256Hash(nil)) type ( CanTransferFunc func(StateDB, common.Address, *big.Int) bool @@ -407,7 +407,7 @@ func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.I func (evm *EVM) Create2(caller ContractRef, code []byte, gas uint64, endowment *big.Int, salt *uint256.Int) (ret []byte, contractAddr common.Address, leftOverGas uint64, err error) { // Cannot use crypto.CreateAddress2 function. // v1.8.14 -> v1.8.27 dependency issue. See patch.go file. - contractAddr = CreateAddress2(caller.Address(), salt.Bytes32(), crypto.Keccak256Hash(code).Bytes()) + contractAddr = CreateAddress2(caller.Address(), salt.Bytes32(), thor.Keccak256(code)) // Capture the tracer start/end events in debug mode if evm.vmConfig.Tracer != nil { @@ -461,7 +461,7 @@ func (evm *EVM) create(caller ContractRef, code []byte, gas uint64, value *big.I // EVM. The contract is a scoped environment for this execution context // only. contract := NewContract(caller, AccountRef(contractAddr), value, gas) - contract.SetCallCode(&contractAddr, crypto.Keccak256Hash(code), code) + contract.SetCallCode(&contractAddr, common.Hash(thor.Keccak256Hash(code)), code) if evm.vmConfig.NoRecursion && evm.depth > 0 { return nil, contractAddr, gas, nil diff --git a/vm/instructions_test.go b/vm/instructions_test.go index 10ea100f3..c2856b3f0 100644 --- a/vm/instructions_test.go +++ b/vm/instructions_test.go @@ -21,9 +21,9 @@ import ( "testing" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/params" "github.com/holiman/uint256" + "github.com/vechain/thor/thor" ) type twoOperandTest struct { @@ -468,7 +468,7 @@ func TestCreate2Addreses(t *testing.T) { origin := common.BytesToAddress(common.FromHex(tt.origin)) salt := common.BytesToHash(common.FromHex(tt.salt)) code := common.FromHex(tt.code) - codeHash := crypto.Keccak256(code) + codeHash := thor.Keccak256(code) // THOR: Cannot use crypto.CreateAddress2 function. // v1.8.14 -> v1.8.27 depedency issue. See patch.go file. address := CreateAddress2(origin, salt, codeHash) diff --git a/vm/patch.go b/vm/patch.go index 82e690b4c..1fe3a0052 100644 --- a/vm/patch.go +++ b/vm/patch.go @@ -10,12 +10,12 @@ package vm import ( "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/vechain/thor/thor" ) // CreateAddress2 creates an ethereum address given the address bytes, initial // contract code hash and a salt. // v1.8.27 func CreateAddress2(b common.Address, salt [32]byte, inithash []byte) common.Address { - return common.BytesToAddress(crypto.Keccak256([]byte{0xff}, b.Bytes(), salt[:], inithash)[12:]) + return common.BytesToAddress(thor.Keccak256([]byte{0xff}, b.Bytes(), salt[:], inithash)[12:]) }