Documentation ¶
Index ¶
- Constants
- Variables
- func BigInt(value string) (*big.Int, error)
- func ChecksumAddress(address string) (string, error)
- func CleanAddress(address string) (string, error)
- func CleanHexString(hex string) (string, error)
- func DecodeBase58(s string) []byte
- func EncodeBase58(b []byte) string
- func Has0xPrefix(str string) bool
- func HexToBig(hex string) (*big.Int, error)
- func NewTruncatedError(err error) error
- func ValidateChain(blocks []*api.BlockMetadata, lastBlock *api.BlockMetadata) error
- type Checker
- type CheckerFactory
- type NativeParser
- type NativeParserFactory
- type Params
- type ParityCheckFailedError
- type Parser
- type ParserBuilder
- func (b *ParserBuilder) Build() fx.Option
- func (b *ParserBuilder) SetCheckerFactory(checkerFactory CheckerFactory) *ParserBuilder
- func (b *ParserBuilder) SetRosettaParserFactory(rosettaParserFactory RosettaParserFactory) *ParserBuilder
- func (b *ParserBuilder) SetValidatorFactory(validatorFactory ValidatorFactory) *ParserBuilder
- type ParserFactory
- type ParserFactoryOption
- type ParserParams
- type PreProcessor
- type RosettaChecker
- type RosettaParser
- type RosettaParserFactory
- type TrustlessValidator
- type ValidatorFactory
Constants ¶
View Source
const (
GenesisBlockIndex = int64(0)
)
Variables ¶
Functions ¶
func ChecksumAddress ¶
func CleanAddress ¶
CleanAddress cleans up an address string by removing all characters leading up to the address
func CleanHexString ¶
CleanHexString cleans up a hex string by removing all leading 0s
func DecodeBase58 ¶
func EncodeBase58 ¶
func Has0xPrefix ¶
Has0xPrefix returns true if the string beings with `0x` or `0X`
func NewTruncatedError ¶
func ValidateChain ¶
func ValidateChain(blocks []*api.BlockMetadata, lastBlock *api.BlockMetadata) error
ValidateChain checks if the chain is continuous.
Types ¶
type Checker ¶
type Checker interface { GetPreProcessor() PreProcessor CompareNativeBlocks(ctx context.Context, height uint64, expectedBlock *api.NativeBlock, actualBlock *api.NativeBlock) error ValidateRosettaBlock(ctx context.Context, request *api.ValidateRosettaBlockRequest, actualRosettaBlock *api.RosettaBlock) error }
Checker defines the interface to compare blocks (in different format) for parity check purposes. For example, CompareRosettaBlocks can be added to the interface when we support Rosetta format.
func NewChecker ¶
func NewChecker(params ParserParams, preProcessor PreProcessor, rosettaChecker RosettaChecker) (Checker, error)
func NewDefaultChecker ¶
func NewDefaultChecker(params ParserParams) (Checker, error)
type CheckerFactory ¶
type CheckerFactory func(params ParserParams) (Checker, error)
type NativeParser ¶
type NativeParser interface { ParseBlock(ctx context.Context, rawBlock *api.Block) (*api.NativeBlock, error) GetTransaction(ctx context.Context, nativeBlock *api.NativeBlock, transactionHash string) (*api.NativeTransaction, error) }
type NativeParserFactory ¶
type NativeParserFactory func(params ParserParams, opts ...ParserFactoryOption) (NativeParser, error)
type Params ¶
type Params struct { fx.In fxparams.Params Aleo ParserFactory `name:"aleo" optional:"true"` Bitcoin ParserFactory `name:"bitcoin" optional:"true"` Bsc ParserFactory `name:"bsc" optional:"true"` Ethereum ParserFactory `name:"ethereum" optional:"true"` Rosetta ParserFactory `name:"rosetta" optional:"true"` Solana ParserFactory `name:"solana" optional:"true"` Polygon ParserFactory `name:"polygon" optional:"true"` Avacchain ParserFactory `name:"avacchain" optional:"true"` Arbitrum ParserFactory `name:"arbitrum" optional:"true"` Optimism ParserFactory `name:"optimism" optional:"true"` Fantom ParserFactory `name:"fantom" optional:"true"` Base ParserFactory `name:"base" optional:"true"` Aptos ParserFactory `name:"aptos" optional:"true"` EthereumBeacon ParserFactory `name:"ethereum/beacon" optional:"true"` CosmosStaking ParserFactory `name:"cosmos/staking" optional:"true"` CardanoStaking ParserFactory `name:"cardano/staking" optional:"true"` }
type ParityCheckFailedError ¶
func (*ParityCheckFailedError) Error ¶
func (e *ParityCheckFailedError) Error() string
type Parser ¶
type Parser interface { ParseNativeBlock(ctx context.Context, rawBlock *api.Block) (*api.NativeBlock, error) GetNativeTransaction(ctx context.Context, nativeBlock *api.NativeBlock, transactionHash string) (*api.NativeTransaction, error) ParseRosettaBlock(ctx context.Context, rawBlock *api.Block) (*api.RosettaBlock, error) CompareNativeBlocks(ctx context.Context, height uint64, expectedBlock, actualBlock *api.NativeBlock) error // ValidateBlock Given a native block, validates whether the block data is cryptographically correct. ValidateBlock(ctx context.Context, nativeBlock *api.NativeBlock) error // ValidateAccountState Given an account's state verification request and the target block, verifies that the account state is valid. If successful, return the stored account state. Otherwise, return error. ValidateAccountState(ctx context.Context, req *api.ValidateAccountStateRequest) (*api.ValidateAccountStateResponse, error) // ValidateRosettaBlock Given other block source (native, etc), validates whether transaction operations show the correct balance transfer. ValidateRosettaBlock(ctx context.Context, req *api.ValidateRosettaBlockRequest, actualRosettaBlock *api.RosettaBlock) error }
type ParserBuilder ¶
type ParserBuilder struct {
// contains filtered or unexported fields
}
func NewParserBuilder ¶
func NewParserBuilder(name string, nativeParserFactory NativeParserFactory) *ParserBuilder
func (*ParserBuilder) Build ¶
func (b *ParserBuilder) Build() fx.Option
func (*ParserBuilder) SetCheckerFactory ¶
func (b *ParserBuilder) SetCheckerFactory(checkerFactory CheckerFactory) *ParserBuilder
func (*ParserBuilder) SetRosettaParserFactory ¶
func (b *ParserBuilder) SetRosettaParserFactory(rosettaParserFactory RosettaParserFactory) *ParserBuilder
func (*ParserBuilder) SetValidatorFactory ¶
func (b *ParserBuilder) SetValidatorFactory(validatorFactory ValidatorFactory) *ParserBuilder
type ParserFactory ¶
type ParserFactoryOption ¶
type ParserFactoryOption func(options any)
type PreProcessor ¶
type PreProcessor interface {
PreProcessNativeBlock(expected, actual *api.NativeBlock) error
}
type RosettaChecker ¶
type RosettaChecker interface {
ValidateRosettaBlock(ctx context.Context, request *api.ValidateRosettaBlockRequest, actualRosettaBlock *api.RosettaBlock) error
}
type RosettaParser ¶
type RosettaParser interface {
ParseBlock(ctx context.Context, rawBlock *api.Block) (*api.RosettaBlock, error)
}
func NewNotImplementedRosettaParser ¶
func NewNotImplementedRosettaParser(params ParserParams, nativeParser NativeParser, opts ...ParserFactoryOption) (RosettaParser, error)
type RosettaParserFactory ¶
type RosettaParserFactory func(params ParserParams, nativeParser NativeParser, opts ...ParserFactoryOption) (RosettaParser, error)
type TrustlessValidator ¶
type TrustlessValidator interface { ValidateBlock(ctx context.Context, nativeBlock *api.NativeBlock) error ValidateAccountState(ctx context.Context, req *api.ValidateAccountStateRequest) (*api.ValidateAccountStateResponse, error) }
TrustlessValidator validates the block payload and account state using cryptographic algorithms. The goal is to have the level of cryptographic security that is comparable to the native blockchain.
func NewNotImplementedValidator ¶
func NewNotImplementedValidator(params ParserParams) TrustlessValidator
type ValidatorFactory ¶
type ValidatorFactory func(params ParserParams) TrustlessValidator
Click to show internal directories.
Click to hide internal directories.