validator

package
v4.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DATABASE_NAME     = "DATABASE_NAME"
	DATABASE_HOSTNAME = "DATABASE_HOSTNAME"
	DATABASE_PORT     = "DATABASE_PORT"
	DATABASE_USER     = "DATABASE_USER"
	DATABASE_PASSWORD = "DATABASE_PASSWORD"
)

Env variables

Variables

This section is empty.

Functions

func InitIPFSBlockService

func InitIPFSBlockService(ipfsPath string) (blockservice.BlockService, error)

InitIPFSBlockService is used to configure and return a BlockService using an ipfs repo path (e.g. ~/.ipfs)

func NewDB

func NewDB() (*sqlx.DB, error)

NewDB returns a new sqlx.DB from config/cli/env variables

func PublishRaw

func PublishRaw(tx *sqlx.Tx, codec, mh uint64, raw []byte, blockNumber uint64) (string, error)

PublishRaw derives a cid from raw bytes and provided codec and multihash type, and writes it to the db tx

func RawdataToCid

func RawdataToCid(codec uint64, rawdata []byte, multiHash uint64) (cid.Cid, error)

RawdataToCid takes the desired codec, multihash type, and a slice of bytes and returns the proper cid of the object.

func ResetTestDB

func ResetTestDB(db *sqlx.DB) error

ResetTestDB drops all rows in the test db public.blocks table

Types

type Config

type Config struct {
	Hostname string
	Name     string
	User     string
	Password string
	Port     int
}

func (*Config) ConnString

func (c *Config) ConnString() string

func (*Config) Init

func (c *Config) Init()

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator is used for validating Ethereum state and storage tries on PG-IPFS

func NewIPFSValidator

func NewIPFSValidator(bs blockservice.BlockService) *Validator

NewIPFSValidator returns a new trie validator ontop of an IPFS blockservice

func NewPGIPFSValidator

func NewPGIPFSValidator(db *sqlx.DB) *Validator

NewPGIPFSValidator returns a new trie validator ontop of a connection pool for an IPFS backing Postgres database

func NewValidator

func NewValidator(kvs ethdb.KeyValueStore, database ethdb.Database) *Validator

NewValidator returns a new trie validator Validating the completeness of a modified merkle patricia tries requires traversing the entire trie and verifying that every node is present, this is an expensive operation

func (*Validator) Close

func (v *Validator) Close() error

Close implements io.Closer it deregisters the groupcache name

func (*Validator) GetCacheStats

func (v *Validator) GetCacheStats() groupcache.Stats

func (*Validator) ValidateStateTrie

func (v *Validator) ValidateStateTrie(stateRoot common.Hash) error

ValidateStateTrie returns an error if the state trie for the provided state root cannot be confirmed as complete This does not consider child storage tries

func (*Validator) ValidateStorageTrie

func (v *Validator) ValidateStorageTrie(address common.Address, storageRoot common.Hash) error

ValidateStorageTrie returns an error if the storage trie for the provided storage root and contract address cannot be confirmed as complete

func (*Validator) ValidateTrie

func (v *Validator) ValidateTrie(stateRoot common.Hash) error

ValidateTrie returns an error if the state and storage tries for the provided state root cannot be confirmed as complete This does consider child storage tries

Jump to

Keyboard shortcuts

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