Skip to content

Commit

Permalink
Add GetCodeFromHash method to StateDB
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower committed Jun 17, 2024
1 parent a0ac9d5 commit 3fd3b75
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/state/statedb_arbitrum.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
1 change: 1 addition & 0 deletions core/vm/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3fd3b75

Please sign in to comment.