From 8c236d4bf3b8587330e1b89d2ef9c2ad37422b10 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 27 Jun 2023 16:42:42 -0400 Subject: [PATCH 1/7] reuse recompiled wasm changes --- core/state/statedb_arbitrum.go | 28 ++++++++++++++++++++-------- core/vm/interface.go | 2 +- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/core/state/statedb_arbitrum.go b/core/state/statedb_arbitrum.go index 6dcd88504f94..1e6910e9c00f 100644 --- a/core/state/statedb_arbitrum.go +++ b/core/state/statedb_arbitrum.go @@ -119,25 +119,36 @@ type UserWasm struct { NoncanonicalHash common.Hash CompressedWasm []byte Wasm []byte + CodeHash common.Hash } type WasmCall struct { - Version uint32 - Address common.Address + Version uint32 + CodeHash common.Hash } func (s *StateDB) StartRecording() { s.userWasms = make(UserWasms) } -func (s *StateDB) RecordProgram(program common.Address, version uint32) { +func (s *StateDB) RecordProgram(program common.Address, codeHash common.Hash, version uint32) { if s.userWasms != nil { call := WasmCall{ - Version: version, - Address: program, + Version: version, + CodeHash: codeHash, } if _, ok := s.userWasms[call]; ok { return } + storedCodeHash := s.GetCodeHash(program) + if storedCodeHash != codeHash { + log.Error( + "Wrong recorded codehash for program at addr %#x, got codehash %#x in DB, specified codehash %#x to record", + program, + storedCodeHash, + codeHash, + ) + return + } rawCode := s.GetCode(program) compressedWasm, err := StripStylusPrefix(rawCode) if err != nil { @@ -145,16 +156,17 @@ func (s *StateDB) RecordProgram(program common.Address, version uint32) { return } s.userWasms[call] = &UserWasm{ - NoncanonicalHash: s.NoncanonicalProgramHash(program, version), + NoncanonicalHash: s.NoncanonicalProgramHash(codeHash, version), CompressedWasm: compressedWasm, + CodeHash: codeHash, } } } -func (s *StateDB) NoncanonicalProgramHash(program common.Address, version uint32) common.Hash { +func (s *StateDB) NoncanonicalProgramHash(codeHash common.Hash, version uint32) common.Hash { prefix := make([]byte, 4) binary.BigEndian.PutUint32(prefix, version) - return crypto.Keccak256Hash(prefix, s.GetCodeHash(program).Bytes()) + return crypto.Keccak256Hash(prefix, codeHash.Bytes()) } func (s *StateDB) UserWasms() UserWasms { diff --git a/core/vm/interface.go b/core/vm/interface.go index ef871ca970b7..6f6789f97090 100644 --- a/core/vm/interface.go +++ b/core/vm/interface.go @@ -31,7 +31,7 @@ type StateDB interface { GetCompiledWasmCode(addr common.Address, version uint32) []byte SetCompiledWasmCode(addr common.Address, code []byte, version uint32) - NoncanonicalProgramHash(common.Address, uint32) common.Hash + NoncanonicalProgramHash(codeHash common.Hash, version uint32) common.Hash Deterministic() bool Database() state.Database From 348ab50e83c018165b0f5d4e0790de6a1dbdf92c Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Fri, 30 Jun 2023 23:38:14 -0400 Subject: [PATCH 2/7] include latest --- core/state/database.go | 2 ++ core/state/database_arbitrum.go | 9 +++++++++ core/state/state_object_arbitrum.go | 6 +++++- core/state/statedb_arbitrum.go | 2 +- light/trie_arbitrum.go | 4 ++++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/core/state/database.go b/core/state/database.go index 639f6fb12de9..ab590e05137a 100644 --- a/core/state/database.go +++ b/core/state/database.go @@ -43,6 +43,8 @@ const ( type Database interface { // Arbitrum: CompiledWasmContractCode retrieves a particular contract's user wasm code. CompiledWasmContractCode(version uint32, codeHash common.Hash) ([]byte, error) + // Arbitrum: SetCompiledWasmContractCode sets a user wasm code. + SetCompiledWasmContractCode(version uint32, codeHash common.Hash, code []byte) error // OpenTrie opens the main account trie. OpenTrie(root common.Hash) (Trie, error) diff --git a/core/state/database_arbitrum.go b/core/state/database_arbitrum.go index d4bd97a157d1..3062356054ae 100644 --- a/core/state/database_arbitrum.go +++ b/core/state/database_arbitrum.go @@ -23,3 +23,12 @@ func (db *cachingDB) CompiledWasmContractCode(version uint32, codeHash common.Ha } return nil, errors.New("not found") } + +func (db *cachingDB) SetCompiledWasmContractCode(version uint32, codeHash common.Hash, code []byte) error { + wasmKey := rawdb.CompiledWasmCodeKey(version, codeHash) + if code, _ := db.compiledWasmCache.Get(wasmKey); len(code) > 0 { + return nil + } + db.compiledWasmCache.Add(wasmKey, code) + return db.disk.Put(wasmKey[:], code) +} diff --git a/core/state/state_object_arbitrum.go b/core/state/state_object_arbitrum.go index d851d9d20976..740b0c2d5f1c 100644 --- a/core/state/state_object_arbitrum.go +++ b/core/state/state_object_arbitrum.go @@ -48,6 +48,7 @@ func (s *stateObject) CompiledWasmCode(db Database, version uint32) []byte { compiledWasmCode, err := db.CompiledWasmContractCode(version, common.BytesToHash(s.CodeHash())) if err != nil { s.setError(fmt.Errorf("can't load code hash %x: %v", s.CodeHash(), err)) + return nil } s.compiledWasmCode[version] = CompiledWasmCache{ code: compiledWasmCode, @@ -56,13 +57,16 @@ func (s *stateObject) CompiledWasmCode(db Database, version uint32) []byte { return compiledWasmCode } -func (s *stateObject) SetCompiledWasmCode(code []byte, version uint32) { +func (s *stateObject) SetCompiledWasmCode(db Database, code []byte, version uint32) { // Can only be compiled once, so if it's being compiled, it was previous empty s.db.journal.append(wasmCodeChange{ account: &s.address, version: version, }) s.setWASMCode(code, version) + if err := db.SetCompiledWasmContractCode(version, common.BytesToHash(s.CodeHash()), code); err != nil { + s.setError(fmt.Errorf("cannot set compiled wasm contract code %x: %v", s.CodeHash(), err)) + } } func (s *stateObject) setWASMCode(code []byte, version uint32) { diff --git a/core/state/statedb_arbitrum.go b/core/state/statedb_arbitrum.go index 1e6910e9c00f..7e93482a83b8 100644 --- a/core/state/statedb_arbitrum.go +++ b/core/state/statedb_arbitrum.go @@ -74,7 +74,7 @@ func (s *StateDB) GetCompiledWasmCode(addr common.Address, version uint32) []byt func (s *StateDB) SetCompiledWasmCode(addr common.Address, code []byte, version uint32) { stateObject := s.GetOrNewStateObject(addr) if stateObject != nil { - stateObject.SetCompiledWasmCode(code, version) + stateObject.SetCompiledWasmCode(s.db, code, version) } } diff --git a/light/trie_arbitrum.go b/light/trie_arbitrum.go index 5ef1d2c5390f..8b260f5442bf 100644 --- a/light/trie_arbitrum.go +++ b/light/trie_arbitrum.go @@ -25,3 +25,7 @@ import ( func (db *odrDatabase) CompiledWasmContractCode(version uint32, codeHash common.Hash) ([]byte, error) { return nil, errors.New("retreiving compiled wasm not supported in light client") } + +func (db *odrDatabase) SetCompiledWasmContractCode(version uint32, codeHash common.Hash, code []byte) error { + return errors.New("setting compiled wasm not supported in light client") +} From 9f0e26d3a28da53b0778b3e98a00e2fd7f46d50c Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 5 Jul 2023 15:43:39 -0400 Subject: [PATCH 3/7] add in changes --- core/state/database_arbitrum.go | 2 +- core/state/state_object_arbitrum.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/state/database_arbitrum.go b/core/state/database_arbitrum.go index 3062356054ae..1522e5fdca81 100644 --- a/core/state/database_arbitrum.go +++ b/core/state/database_arbitrum.go @@ -30,5 +30,5 @@ func (db *cachingDB) SetCompiledWasmContractCode(version uint32, codeHash common return nil } db.compiledWasmCache.Add(wasmKey, code) - return db.disk.Put(wasmKey[:], code) + return nil } diff --git a/core/state/state_object_arbitrum.go b/core/state/state_object_arbitrum.go index 740b0c2d5f1c..b4edd139f326 100644 --- a/core/state/state_object_arbitrum.go +++ b/core/state/state_object_arbitrum.go @@ -39,6 +39,7 @@ func (c CompiledWasms) Copy() CompiledWasms { // CompiledWasmCode returns the user wasm contract code associated with this object, if any. func (s *stateObject) CompiledWasmCode(db Database, version uint32) []byte { + fmt.Printf("Getting compiled code for %#x\n", s.address) if wasm, ok := s.compiledWasmCode[version]; ok { return wasm.code } From 9e23c3fce2d82ebc72d950ed4c3539224315f912 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 5 Jul 2023 15:45:46 -0400 Subject: [PATCH 4/7] rem print --- core/state/state_object_arbitrum.go | 1 - 1 file changed, 1 deletion(-) diff --git a/core/state/state_object_arbitrum.go b/core/state/state_object_arbitrum.go index b4edd139f326..740b0c2d5f1c 100644 --- a/core/state/state_object_arbitrum.go +++ b/core/state/state_object_arbitrum.go @@ -39,7 +39,6 @@ func (c CompiledWasms) Copy() CompiledWasms { // CompiledWasmCode returns the user wasm contract code associated with this object, if any. func (s *stateObject) CompiledWasmCode(db Database, version uint32) []byte { - fmt.Printf("Getting compiled code for %#x\n", s.address) if wasm, ok := s.compiledWasmCode[version]; ok { return wasm.code } From 3bef3417ff89511f2074890f41b526162855dbcc Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 11 Jul 2023 14:51:34 -0400 Subject: [PATCH 5/7] fix broken --- core/state/state_object_arbitrum.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/state/state_object_arbitrum.go b/core/state/state_object_arbitrum.go index 4d5c50aca9d9..f839725447b1 100644 --- a/core/state/state_object_arbitrum.go +++ b/core/state/state_object_arbitrum.go @@ -64,7 +64,7 @@ func (s *stateObject) SetCompiledWasmCode(db Database, code []byte, version uint }) s.setWASMCode(code, version) if err := db.SetCompiledWasmContractCode(version, common.BytesToHash(s.CodeHash()), code); err != nil { - s.setError(fmt.Errorf("cannot set compiled wasm contract code %x: %v", s.CodeHash(), err)) + s.db.setError(fmt.Errorf("cannot set compiled wasm contract code %x: %v", s.CodeHash(), err)) } } From 576989dc0d8ea0f4f5442b80f89658e302aec746 Mon Sep 17 00:00:00 2001 From: Tsahi Zidenberg Date: Fri, 18 Aug 2023 13:19:18 -0600 Subject: [PATCH 6/7] compiled wasm version is uint16 --- core/rawdb/accessors_state_arbitrum.go | 2 +- core/rawdb/schema_arbitrum.go | 12 ++++++------ core/state/database.go | 4 ++-- core/state/database_arbitrum.go | 4 ++-- core/state/journal_arbitrum.go | 2 +- core/state/state_object_arbitrum.go | 8 ++++---- core/state/statedb_arbitrum.go | 20 ++++++++++---------- core/vm/interface.go | 6 +++--- light/trie_arbitrum.go | 4 ++-- 9 files changed, 31 insertions(+), 31 deletions(-) diff --git a/core/rawdb/accessors_state_arbitrum.go b/core/rawdb/accessors_state_arbitrum.go index 3ccbfc369818..21dfe43a064b 100644 --- a/core/rawdb/accessors_state_arbitrum.go +++ b/core/rawdb/accessors_state_arbitrum.go @@ -23,7 +23,7 @@ import ( ) // WriteCompiledWasmCode writes the provided contract compiled wasm code database. -func WriteCompiledWasmCode(db ethdb.KeyValueWriter, version uint32, hash common.Hash, code []byte) { +func WriteCompiledWasmCode(db ethdb.KeyValueWriter, version uint16, hash common.Hash, code []byte) { key := CompiledWasmCodeKey(version, hash) if err := db.Put(key[:], code); err != nil { log.Crit("Failed to store compiled wasm contract code", "err", err) diff --git a/core/rawdb/schema_arbitrum.go b/core/rawdb/schema_arbitrum.go index 968fc836575f..5296a71fe585 100644 --- a/core/rawdb/schema_arbitrum.go +++ b/core/rawdb/schema_arbitrum.go @@ -35,23 +35,23 @@ const WasmKeyLen = 2 + 4 + 32 type WasmKey = [WasmKeyLen]byte // CompiledWasmCodeKey = CompiledWasmCodePrefix + version + hash -func CompiledWasmCodeKey(version uint32, hash common.Hash) WasmKey { +func CompiledWasmCodeKey(version uint16, hash common.Hash) WasmKey { var key WasmKey copy(key[:2], CompiledWasmCodePrefix) - binary.BigEndian.PutUint32(key[2:6], version) - copy(key[6:], hash[:]) + binary.BigEndian.PutUint16(key[2:4], version) + copy(key[4:], hash[:]) return key } // IsCompiledWasmCodeKey reports whether the given byte slice is the key of compiled wasm contract code, // if so return the raw code hash and version as well. -func IsCompiledWasmCodeKey(key []byte) (bool, common.Hash, uint32) { +func IsCompiledWasmCodeKey(key []byte) (bool, common.Hash, uint16) { start := len(CompiledWasmCodePrefix) if bytes.HasPrefix(key, CompiledWasmCodePrefix) && len(key) == WasmKeyLen { - version := binary.BigEndian.Uint32(key[start : start+4]) - codeHash := common.BytesToHash(key[start+4:]) + version := binary.BigEndian.Uint16(key[start : start+2]) + codeHash := common.BytesToHash(key[start+2:]) return true, codeHash, version } return false, common.Hash{}, 0 diff --git a/core/state/database.go b/core/state/database.go index ab590e05137a..50f4f68d77b4 100644 --- a/core/state/database.go +++ b/core/state/database.go @@ -42,9 +42,9 @@ const ( // Database wraps access to tries and contract code. type Database interface { // Arbitrum: CompiledWasmContractCode retrieves a particular contract's user wasm code. - CompiledWasmContractCode(version uint32, codeHash common.Hash) ([]byte, error) + CompiledWasmContractCode(version uint16, codeHash common.Hash) ([]byte, error) // Arbitrum: SetCompiledWasmContractCode sets a user wasm code. - SetCompiledWasmContractCode(version uint32, codeHash common.Hash, code []byte) error + SetCompiledWasmContractCode(version uint16, codeHash common.Hash, code []byte) error // OpenTrie opens the main account trie. OpenTrie(root common.Hash) (Trie, error) diff --git a/core/state/database_arbitrum.go b/core/state/database_arbitrum.go index 1522e5fdca81..35743290aa45 100644 --- a/core/state/database_arbitrum.go +++ b/core/state/database_arbitrum.go @@ -8,7 +8,7 @@ import ( ) // CompiledWasmContractCode retrieves a particular contract's compiled wasm code. -func (db *cachingDB) CompiledWasmContractCode(version uint32, codeHash common.Hash) ([]byte, error) { +func (db *cachingDB) CompiledWasmContractCode(version uint16, codeHash common.Hash) ([]byte, error) { wasmKey := rawdb.CompiledWasmCodeKey(version, codeHash) if code, _ := db.compiledWasmCache.Get(wasmKey); len(code) > 0 { return code, nil @@ -24,7 +24,7 @@ func (db *cachingDB) CompiledWasmContractCode(version uint32, codeHash common.Ha return nil, errors.New("not found") } -func (db *cachingDB) SetCompiledWasmContractCode(version uint32, codeHash common.Hash, code []byte) error { +func (db *cachingDB) SetCompiledWasmContractCode(version uint16, codeHash common.Hash, code []byte) error { wasmKey := rawdb.CompiledWasmCodeKey(version, codeHash) if code, _ := db.compiledWasmCache.Get(wasmKey); len(code) > 0 { return nil diff --git a/core/state/journal_arbitrum.go b/core/state/journal_arbitrum.go index 85b11c821ec1..cf97b713b854 100644 --- a/core/state/journal_arbitrum.go +++ b/core/state/journal_arbitrum.go @@ -4,7 +4,7 @@ import "github.com/ethereum/go-ethereum/common" type wasmCodeChange struct { account *common.Address - version uint32 + version uint16 } func (ch wasmCodeChange) revert(s *StateDB) { diff --git a/core/state/state_object_arbitrum.go b/core/state/state_object_arbitrum.go index f839725447b1..228e26c3c5f8 100644 --- a/core/state/state_object_arbitrum.go +++ b/core/state/state_object_arbitrum.go @@ -26,7 +26,7 @@ type CompiledWasmCache struct { code Code dirty bool } -type CompiledWasms map[uint32]CompiledWasmCache +type CompiledWasms map[uint16]CompiledWasmCache func (c CompiledWasms) Copy() CompiledWasms { cpy := make(CompiledWasms, len(c)) @@ -38,7 +38,7 @@ func (c CompiledWasms) Copy() CompiledWasms { } // CompiledWasmCode returns the user wasm contract code associated with this object, if any. -func (s *stateObject) CompiledWasmCode(db Database, version uint32) []byte { +func (s *stateObject) CompiledWasmCode(db Database, version uint16) []byte { if wasm, ok := s.compiledWasmCode[version]; ok { return wasm.code } @@ -56,7 +56,7 @@ func (s *stateObject) CompiledWasmCode(db Database, version uint32) []byte { return compiledWasmCode } -func (s *stateObject) SetCompiledWasmCode(db Database, code []byte, version uint32) { +func (s *stateObject) SetCompiledWasmCode(db Database, code []byte, version uint16) { // Can only be compiled once, so if it's being compiled, it was previous empty s.db.journal.append(wasmCodeChange{ account: &s.address, @@ -68,7 +68,7 @@ func (s *stateObject) SetCompiledWasmCode(db Database, code []byte, version uint } } -func (s *stateObject) setWASMCode(code []byte, version uint32) { +func (s *stateObject) setWASMCode(code []byte, version uint16) { s.compiledWasmCode[version] = CompiledWasmCache{ code: code, dirty: true, diff --git a/core/state/statedb_arbitrum.go b/core/state/statedb_arbitrum.go index 45fb17b4f206..8791b994d260 100644 --- a/core/state/statedb_arbitrum.go +++ b/core/state/statedb_arbitrum.go @@ -37,9 +37,9 @@ var ( // This allows us to store WASM programs as code in the stateDB side-by-side // with EVM contracts, but match against these prefix bytes when loading code // to execute the WASMs through Stylus rather than the EVM. - stylusEOFMagic = byte(0xEF) - stylusEOFMagicSuffix = byte(0xF0) - stylusEOFVersion = byte(0x00) + stylusEOFMagic = byte(0xEF) + stylusEOFMagicSuffix = byte(0xF0) + stylusEOFVersion = byte(0x00) StylusPrefix = []byte{stylusEOFMagic, stylusEOFMagicSuffix, stylusEOFVersion} ) @@ -62,7 +62,7 @@ func StripStylusPrefix(b []byte) ([]byte, error) { return b[3:], nil } -func (s *StateDB) GetCompiledWasmCode(addr common.Address, version uint32) []byte { +func (s *StateDB) GetCompiledWasmCode(addr common.Address, version uint16) []byte { stateObject := s.getStateObject(addr) if stateObject != nil { return stateObject.CompiledWasmCode(s.db, version) @@ -70,7 +70,7 @@ func (s *StateDB) GetCompiledWasmCode(addr common.Address, version uint32) []byt return nil } -func (s *StateDB) SetCompiledWasmCode(addr common.Address, code []byte, version uint32) { +func (s *StateDB) SetCompiledWasmCode(addr common.Address, code []byte, version uint16) { stateObject := s.GetOrNewStateObject(addr) if stateObject != nil { stateObject.SetCompiledWasmCode(s.db, code, version) @@ -145,7 +145,7 @@ type UserWasm struct { CodeHash common.Hash } type WasmCall struct { - Version uint32 + Version uint16 CodeHash common.Hash } @@ -153,7 +153,7 @@ func (s *StateDB) StartRecording() { s.userWasms = make(UserWasms) } -func (s *StateDB) RecordProgram(program common.Address, codeHash common.Hash, version uint32) { +func (s *StateDB) RecordProgram(program common.Address, codeHash common.Hash, version uint16) { if s.userWasms != nil { call := WasmCall{ Version: version, @@ -186,9 +186,9 @@ func (s *StateDB) RecordProgram(program common.Address, codeHash common.Hash, ve } } -func (s *StateDB) NoncanonicalProgramHash(codeHash common.Hash, version uint32) common.Hash { - prefix := make([]byte, 4) - binary.BigEndian.PutUint32(prefix, version) +func (s *StateDB) NoncanonicalProgramHash(codeHash common.Hash, version uint16) common.Hash { + prefix := make([]byte, 2) + binary.BigEndian.PutUint16(prefix, version) return crypto.Keccak256Hash(prefix, codeHash.Bytes()) } diff --git a/core/vm/interface.go b/core/vm/interface.go index ad238e91a615..4118cd589df7 100644 --- a/core/vm/interface.go +++ b/core/vm/interface.go @@ -28,8 +28,8 @@ import ( // StateDB is an EVM database for full state querying. type StateDB interface { // Arbitrum: manage compiled wasms - GetCompiledWasmCode(addr common.Address, version uint32) []byte - SetCompiledWasmCode(addr common.Address, code []byte, version uint32) + GetCompiledWasmCode(addr common.Address, version uint16) []byte + SetCompiledWasmCode(addr common.Address, code []byte, version uint16) // Arbitrum: track stylus's memory footprint GetStylusPages() (uint16, uint16) @@ -38,7 +38,7 @@ type StateDB interface { AddStylusPages(new uint16) (uint16, uint16) AddStylusPagesEver(new uint16) - NoncanonicalProgramHash(codeHash common.Hash, version uint32) common.Hash + NoncanonicalProgramHash(codeHash common.Hash, version uint16) common.Hash Deterministic() bool Database() state.Database diff --git a/light/trie_arbitrum.go b/light/trie_arbitrum.go index 8b260f5442bf..c27f994d9f15 100644 --- a/light/trie_arbitrum.go +++ b/light/trie_arbitrum.go @@ -22,10 +22,10 @@ import ( "github.com/ethereum/go-ethereum/common" ) -func (db *odrDatabase) CompiledWasmContractCode(version uint32, codeHash common.Hash) ([]byte, error) { +func (db *odrDatabase) CompiledWasmContractCode(version uint16, codeHash common.Hash) ([]byte, error) { return nil, errors.New("retreiving compiled wasm not supported in light client") } -func (db *odrDatabase) SetCompiledWasmContractCode(version uint32, codeHash common.Hash, code []byte) error { +func (db *odrDatabase) SetCompiledWasmContractCode(version uint16, codeHash common.Hash, code []byte) error { return errors.New("setting compiled wasm not supported in light client") } From 315fc9d176d533c10faa7282a470966093ab0390 Mon Sep 17 00:00:00 2001 From: Rachel Bousfield Date: Thu, 24 Aug 2023 18:42:12 -0600 Subject: [PATCH 7/7] address review comments --- core/rawdb/schema_arbitrum.go | 2 +- core/state/database_arbitrum.go | 1 - core/state/statedb_arbitrum.go | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/core/rawdb/schema_arbitrum.go b/core/rawdb/schema_arbitrum.go index 5296a71fe585..817740858107 100644 --- a/core/rawdb/schema_arbitrum.go +++ b/core/rawdb/schema_arbitrum.go @@ -30,7 +30,7 @@ var ( ) // CompiledWasmCodeKey = CompiledWasmCodePrefix + version + hash -const WasmKeyLen = 2 + 4 + 32 +const WasmKeyLen = 2 + 2 + 32 type WasmKey = [WasmKeyLen]byte diff --git a/core/state/database_arbitrum.go b/core/state/database_arbitrum.go index 35743290aa45..a188b31719d5 100644 --- a/core/state/database_arbitrum.go +++ b/core/state/database_arbitrum.go @@ -7,7 +7,6 @@ import ( "github.com/ethereum/go-ethereum/core/rawdb" ) -// CompiledWasmContractCode retrieves a particular contract's compiled wasm code. func (db *cachingDB) CompiledWasmContractCode(version uint16, codeHash common.Hash) ([]byte, error) { wasmKey := rawdb.CompiledWasmCodeKey(version, codeHash) if code, _ := db.compiledWasmCache.Get(wasmKey); len(code) > 0 { diff --git a/core/state/statedb_arbitrum.go b/core/state/statedb_arbitrum.go index 8791b994d260..6eea8fb336f7 100644 --- a/core/state/statedb_arbitrum.go +++ b/core/state/statedb_arbitrum.go @@ -142,7 +142,7 @@ type UserWasm struct { NoncanonicalHash common.Hash CompressedWasm []byte Wasm []byte - CodeHash common.Hash + CodeHash common.Hash // TODO: remove this field } type WasmCall struct { Version uint16