forked from cerc-io/laconicd-deprecated
acf15474e7
* release: v0.17.0 changelog (#1153) * release: v0.17.0 changelog * rm newline * update link * imp(evm): EVM interface * fixes * fix lint * fix lint pt 2 * initial wiring for stateful contracts * Apply suggestions from code review Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com> * changelog * comments from review * lint Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com>
34 lines
1.3 KiB
Go
34 lines
1.3 KiB
Go
package statedb
|
|
|
|
import (
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/ethereum/go-ethereum/core/vm"
|
|
)
|
|
|
|
// ExtStateDB defines an extension to the interface provided by the go-ethereum
|
|
// codebase to support additional state transition functionalities. In particular
|
|
// it supports appending a new entry to the state journal through
|
|
// AppendJournalEntry so that the state can be reverted after running
|
|
// stateful precompiled contracts.
|
|
type ExtStateDB interface {
|
|
vm.StateDB
|
|
AppendJournalEntry(JournalEntry)
|
|
}
|
|
|
|
// Keeper provide underlying storage of StateDB
|
|
type Keeper interface {
|
|
// Read methods
|
|
GetAccount(ctx sdk.Context, addr common.Address) *Account
|
|
GetState(ctx sdk.Context, addr common.Address, key common.Hash) common.Hash
|
|
GetCode(ctx sdk.Context, codeHash common.Hash) []byte
|
|
// the callback returns false to break early
|
|
ForEachStorage(ctx sdk.Context, addr common.Address, cb func(key, value common.Hash) bool)
|
|
|
|
// Write methods, only called by `StateDB.Commit()`
|
|
SetAccount(ctx sdk.Context, addr common.Address, account Account) error
|
|
SetState(ctx sdk.Context, addr common.Address, key common.Hash, value []byte)
|
|
SetCode(ctx sdk.Context, codeHash []byte, code []byte)
|
|
DeleteAccount(ctx sdk.Context, addr common.Address) error
|
|
}
|