stateroot

package
v0.94.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2021 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrStateMismatch means that local state root doesn't match the one
	// signed by state validators.
	ErrStateMismatch = errors.New("stateroot mismatch")
)

Functions

This section is empty.

Types

type Module

type Module struct {
	Store *storage.MemCachedStore
	// contains filtered or unexported fields
}

Module represents module for local processing of state roots.

func NewModule

NewModule returns new instance of stateroot module.

func (*Module) AddMPTBatch

func (s *Module) AddMPTBatch(index uint32, b mpt.Batch, cache *storage.MemCachedStore) (*mpt.Trie, *state.MPTRoot, error)

AddMPTBatch updates using provided batch.

func (*Module) AddStateRoot

func (s *Module) AddStateRoot(sr *state.MPTRoot) error

AddStateRoot adds validated state root provided by network.

func (*Module) CurrentLocalStateRoot

func (s *Module) CurrentLocalStateRoot() util.Uint256

CurrentLocalStateRoot returns hash of the local state root.

func (*Module) CurrentValidatedHeight

func (s *Module) CurrentValidatedHeight() uint32

CurrentValidatedHeight returns current state root validated height.

func (*Module) GetStateProof

func (s *Module) GetStateProof(root util.Uint256, key []byte) ([][]byte, error)

GetStateProof returns proof of having key in the MPT with the specified root.

func (*Module) GetStateRoot

func (s *Module) GetStateRoot(height uint32) (*state.MPTRoot, error)

GetStateRoot returns state root for a given height.

func (*Module) GetStateValidators

func (s *Module) GetStateValidators(height uint32) keys.PublicKeys

GetStateValidators returns current state validators.

func (*Module) Init

func (s *Module) Init(height uint32, enableRefCount bool) error

Init initializes state root module at the given height.

func (*Module) SetUpdateValidatorsCallback

func (s *Module) SetUpdateValidatorsCallback(f func(uint32, keys.PublicKeys))

SetUpdateValidatorsCallback sets callback for sending signed root.

func (*Module) UpdateCurrentLocal added in v0.94.1

func (s *Module) UpdateCurrentLocal(mpt *mpt.Trie, sr *state.MPTRoot)

UpdateCurrentLocal updates local caches using provided state root.

func (*Module) UpdateStateValidators

func (s *Module) UpdateStateValidators(height uint32, pubs keys.PublicKeys)

UpdateStateValidators updates list of state validator keys.

func (*Module) VerifyStateRoot

func (s *Module) VerifyStateRoot(r *state.MPTRoot) error

VerifyStateRoot checks if state root is valid.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL