Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/consensus-e…
Browse files Browse the repository at this point in the history
…ngine
  • Loading branch information
philip-morlier committed Jun 12, 2023
2 parents 6667e62 + cee6a9b commit 13375d3
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions core/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ type Backend interface {
SubscribePendingLogsEvent(ch chan<- [][]byte) Subscription // RLP Encoded logs
SubscribeRemovedLogsEvent(ch chan<- []byte) Subscription // RLP encoded logs

GetTrie(hash Hash) (Trie, error)
GetAccountTrie(stateRoot Hash, account Address) (Trie, error)

// ChainConfig() *params.ChainConfig
// Engine() consensus.Engine
}
Expand Down Expand Up @@ -225,8 +228,42 @@ type BlockContext struct {

type Context interface {
Set(string, string) error

String(string) string

Bool(string) bool
}

type Trie interface {
GetKey([]byte) []byte
GetAccount(address Address) (*StateAccount, error)
Hash() Hash
NodeIterator(startKey []byte) NodeIterator
Prove(key []byte, fromLevel uint, proofDb KeyValueWriter) error
}

type StateAccount struct {
Nonce uint64
Balance *big.Int
Root Hash // merkle root of the storage trie
CodeHash []byte
}

type NodeIterator interface {
Next(bool) bool
Error() error
Hash() Hash
Parent() Hash
Path() []byte
NodeBlob() []byte
Leaf() bool
LeafKey() []byte
LeafBlob() []byte
LeafProof() [][]byte
AddResolver(NodeResolver)
}

type NodeResolver func(owner Hash, path []byte, hash Hash) []byte

type KeyValueWriter interface {
Put(key []byte, value []byte) error
Delete(key []byte) error
}

0 comments on commit 13375d3

Please sign in to comment.