Documentation ¶
Index ¶
- Constants
- type AccountMap
- type Builder
- type Config
- type LvLDBReaderConfig
- type LvlDBReader
- func (ldr *LvlDBReader) GetBlockByHash(hash common.Hash) (*types.Block, error)
- func (ldr *LvlDBReader) GetBlockByNumber(number uint64) (*types.Block, error)
- func (ldr *LvlDBReader) GetReceiptsByHash(hash common.Hash) (types.Receipts, error)
- func (ldr *LvlDBReader) GetTdByHash(hash common.Hash) (*big.Int, error)
- func (ldr *LvlDBReader) StateDB() state.Database
- type PublicStateDiffAPI
- func (api *PublicStateDiffAPI) StateDiffAt(ctx context.Context, blockNumber uint64, params sd.Params) (*sd.Payload, error)
- func (api *PublicStateDiffAPI) StateTrieAt(ctx context.Context, blockNumber uint64, params sd.Params) (*sd.Payload, error)
- func (api *PublicStateDiffAPI) WriteStateDiffAt(ctx context.Context, blockNumber uint64, params sd.Params) error
- func (api *PublicStateDiffAPI) WriteStateDiffsInRange(ctx context.Context, start, stop uint64, params sd.Params) error
- type RangeRequest
- type Reader
- type Service
- func (sds *Service) APIs() []rpc.API
- func (sds *Service) Loop(wg *sync.WaitGroup) error
- func (sds *Service) Protocols() []p2p.Protocol
- func (sds *Service) Run(rngs []RangeRequest) error
- func (sds *Service) Start() error
- func (sds *Service) StateDiffAt(blockNumber uint64, params sd.Params) (*sd.Payload, error)
- func (sds *Service) StateDiffFor(blockHash common.Hash, params sd.Params) (*sd.Payload, error)
- func (sds *Service) StateTrieAt(blockNumber uint64, params sd.Params) (*sd.Payload, error)
- func (sds *Service) Stop() error
- func (sds *Service) WriteStateDiffAt(blockNumber uint64, params sd.Params) error
- func (sds *Service) WriteStateDiffFor(blockHash common.Hash, params sd.Params) error
- func (sds *Service) WriteStateDiffsInRange(start, stop uint64, params sd.Params) error
- type StateDiffService
Constants ¶
const APIName = "statediff"
APIName is the namespace used for the state diffing service API
const APIVersion = "0.0.1"
APIVersion is the version of the state diffing service API
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountMap ¶ added in v0.1.0
type AccountMap map[string]accountWrapper
AccountMap is a mapping of hex encoded path => account wrapper
type Builder ¶ added in v0.1.0
type Builder interface { BuildStateDiffObject(args sd.Args, params sd.Params) (sd.StateObject, error) BuildStateTrieObject(current *types.Block) (sd.StateObject, error) WriteStateDiffObject(args sd.StateRoots, params sd.Params, output sdtypes.StateNodeSink, codeOutput sdtypes.CodeSink) error }
Builder interface exposes the method for building a state diff between two blocks
type Config ¶ added in v0.1.0
type Config struct { ServiceWorkers uint TrieWorkers uint WorkerQueueSize uint PreRuns []RangeRequest }
Config holds config params for the statediffing service
type LvLDBReaderConfig ¶ added in v0.2.6
type LvLDBReaderConfig struct { TrieConfig *trie.Config ChainConfig *params.ChainConfig Path, AncientPath string DBCacheSize int }
LvLDBReaderConfig struct for initializing a LvlDBReader
type LvlDBReader ¶
type LvlDBReader struct {
// contains filtered or unexported fields
}
LvlDBReader exposes the necessary Reader methods on lvldb
func NewLvlDBReader ¶
func NewLvlDBReader(conf LvLDBReaderConfig) (*LvlDBReader, error)
NewLvlDBReader creates a new Read using LevelDB
func (*LvlDBReader) GetBlockByHash ¶
GetBlockByHash gets block by hash
func (*LvlDBReader) GetBlockByNumber ¶
func (ldr *LvlDBReader) GetBlockByNumber(number uint64) (*types.Block, error)
func (*LvlDBReader) GetReceiptsByHash ¶
GetReceiptsByHash gets receipt by hash
func (*LvlDBReader) GetTdByHash ¶
GetTdByHash gets td by hash
func (*LvlDBReader) StateDB ¶
func (ldr *LvlDBReader) StateDB() state.Database
StateDB returns the underlying statedb
type PublicStateDiffAPI ¶
type PublicStateDiffAPI struct {
// contains filtered or unexported fields
}
PublicStateDiffAPI provides an RPC interface that can be used to fetch historical diffs from leveldb directly
func NewPublicStateDiffAPI ¶
func NewPublicStateDiffAPI(sds StateDiffService) *PublicStateDiffAPI
NewPublicStateDiffAPI creates an rpc interface for the underlying statediff service
func (*PublicStateDiffAPI) StateDiffAt ¶
func (api *PublicStateDiffAPI) StateDiffAt(ctx context.Context, blockNumber uint64, params sd.Params) (*sd.Payload, error)
StateDiffAt returns a state diff payload at the specific blockheight
func (*PublicStateDiffAPI) StateTrieAt ¶
func (api *PublicStateDiffAPI) StateTrieAt(ctx context.Context, blockNumber uint64, params sd.Params) (*sd.Payload, error)
StateTrieAt returns a state trie payload at the specific blockheight
func (*PublicStateDiffAPI) WriteStateDiffAt ¶ added in v0.2.0
func (api *PublicStateDiffAPI) WriteStateDiffAt(ctx context.Context, blockNumber uint64, params sd.Params) error
WriteStateDiffAt writes a state diff object directly to DB at the specific blockheight
func (*PublicStateDiffAPI) WriteStateDiffsInRange ¶ added in v0.2.6
func (api *PublicStateDiffAPI) WriteStateDiffsInRange(ctx context.Context, start, stop uint64, params sd.Params) error
WriteStateDiffsInRange writes the state diff objects for the provided block range, with the provided params
type RangeRequest ¶ added in v0.2.6
RangeRequest holds range quest work params
type Reader ¶ added in v0.2.6
type Reader interface { GetBlockByHash(hash common.Hash) (*types.Block, error) GetBlockByNumber(number uint64) (*types.Block, error) GetReceiptsByHash(hash common.Hash) (types.Receipts, error) GetTdByHash(hash common.Hash) (*big.Int, error) StateDB() state.Database }
Reader interface required by the statediffing service
type Service ¶
type Service struct { // Used to build the state diff objects Builder Builder // contains filtered or unexported fields }
Service is the underlying struct for the state diffing service
func NewStateDiffService ¶
NewStateDiffService creates a new Service
func (*Service) Run ¶ added in v0.2.7
func (sds *Service) Run(rngs []RangeRequest) error
Run does a one-off processing run on the provided RangeRequests + any pre-runs, exiting afterwards
func (*Service) StateDiffAt ¶
StateDiffAt returns a state diff object payload at the specific blockheight This operation cannot be performed back past the point of db pruning; it requires an archival node for historical data
func (*Service) StateDiffFor ¶ added in v0.2.0
StateDiffFor returns a state diff object payload for the specific blockhash This operation cannot be performed back past the point of db pruning; it requires an archival node for historical data
func (*Service) StateTrieAt ¶
StateTrieAt returns a state trie object payload at the specified blockheight This operation cannot be performed back past the point of db pruning; it requires an archival node for historical data
func (*Service) WriteStateDiffAt ¶ added in v0.2.0
WriteStateDiffAt writes a state diff at the specific blockheight directly to the database This operation cannot be performed back past the point of db pruning; it requires an archival node for historical data
func (*Service) WriteStateDiffFor ¶ added in v0.2.0
WriteStateDiffFor writes a state diff for the specific blockHash directly to the database This operation cannot be performed back past the point of db pruning; it requires an archival node for historical data
type StateDiffService ¶ added in v0.2.6
type StateDiffService interface { // Lifecycle Start() and Stop() node.Lifecycle // APIs and Protocols() interface for node service registration APIs() []rpc.API Protocols() []p2p.Protocol // Loop is the main event loop for processing state diffs Loop(wg *sync.WaitGroup) error // Run is a one-off command to run on a predefined set of ranges Run(ranges []RangeRequest) error // StateDiffAt method to get state diff object at specific block StateDiffAt(blockNumber uint64, params sd.Params) (*sd.Payload, error) // StateDiffFor method to get state diff object at specific block StateDiffFor(blockHash common.Hash, params sd.Params) (*sd.Payload, error) // StateTrieAt method to get state trie object at specific block StateTrieAt(blockNumber uint64, params sd.Params) (*sd.Payload, error) // WriteStateDiffAt method to write state diff object directly to DB WriteStateDiffAt(blockNumber uint64, params sd.Params) error // WriteStateDiffFor method to get state trie object at specific block WriteStateDiffFor(blockHash common.Hash, params sd.Params) error // WriteStateDiffsInRange method to wrtie state diff objects within the range directly to the DB WriteStateDiffsInRange(start, stop uint64, params sd.Params) error }
StateDiffService is the state-diffing service interface