From 3fd3b755ff8f6763e8e9395aec9675a5ec6c2fd5 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Mon, 17 Jun 2024 17:19:19 -0600 Subject: [PATCH] Add GetCodeFromHash method to StateDB --- core/state/statedb_arbitrum.go | 5 +++++ core/vm/interface.go | 1 + 2 files changed, 6 insertions(+) diff --git a/core/state/statedb_arbitrum.go b/core/state/statedb_arbitrum.go index e459ad4570..bb2ca9c2ec 100644 --- a/core/state/statedb_arbitrum.go +++ b/core/state/statedb_arbitrum.go @@ -297,3 +297,8 @@ func (p RecentWasms) Copy() RecentWasms { } return RecentWasms{cache: &cache} } + +func (s *StateDB) GetCodeFromHash(codeHash common.Hash) ([]byte, error) { + // Not passing in an address is supported pre-Verkle, as in Blockchain's ContractCodeWithPrefix method. + return s.db.ContractCode(common.Address{}, codeHash) +} diff --git a/core/vm/interface.go b/core/vm/interface.go index 43393b54f7..09192c9017 100644 --- a/core/vm/interface.go +++ b/core/vm/interface.go @@ -42,6 +42,7 @@ type StateDB interface { SetStylusPagesOpen(open uint16) AddStylusPages(new uint16) (uint16, uint16) AddStylusPagesEver(new uint16) + GetCodeFromHash(common.Hash) ([]byte, error) Deterministic() bool Database() state.Database