bsc

package
v0.0.0-...-a76333c Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubModuleName = "bsc-client"
)

Variables

View Source
var (
	ErrInvalidLengthBsc        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowBsc          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupBsc = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidGenesisBlock   = tibctypes.Register(moduleName, 2, "invalid genesis block")
	ErrInvalidValidatorBytes = tibctypes.Register(moduleName, 3, "invalid validators bytes length")

	// ErrUnknownBlock is returned when the list of validators is requested for a block
	// that is not part of the local blockchain.
	ErrUnknownBlock = tibctypes.Register(moduleName, 4, "unknown block")
	ErrFutureBlock  = tibctypes.Register(moduleName, 5, "block in the future")

	// ErrMissingVanity is returned if a block's extra-data section is shorter than
	// 32 bytes, which is required to store the signer vanity.
	ErrMissingVanity = tibctypes.Register(moduleName, 6, "extra-data 32 byte vanity prefix missing")

	// ErrMissingSignature is returned if a block's extra-data section doesn't seem
	// to contain a 65 byte secp256k1 signature.
	ErrMissingSignature = tibctypes.Register(moduleName, 7, "extra-data 65 byte signature suffix missing")

	// ErrInvalidMixDigest is returned if a block's mix digest is non-zero.
	ErrInvalidMixDigest = tibctypes.Register(moduleName, 8, "non-zero mix digest")

	// ErrInvalidUncleHash is returned if a block contains an non-empty uncle list.
	ErrInvalidUncleHash = tibctypes.Register(moduleName, 9, "non empty uncle hash")

	// ErrInvalidDifficulty is returned if the difficulty of a block is missing.
	ErrInvalidDifficulty = tibctypes.Register(moduleName, 10, "invalid difficulty")
	ErrUnknownAncestor   = tibctypes.Register(moduleName, 11, "unknown ancestor")
	// ErrCoinBaseMisMatch is returned if a header's coinbase do not match with signature
	ErrCoinBaseMisMatch = tibctypes.Register(moduleName, 12, "coinbase do not match with signature")
	// ErrUnauthorizedValidator is returned if a header is signed by a non-authorized entity.
	ErrUnauthorizedValidator = tibctypes.Register(moduleName, 13, "unauthorized validator")
	// ErrRecentlySigned is returned if a header is signed by an authorized entity
	// that already signed a header recently, thus is temporarily not allowed to.
	ErrRecentlySigned = tibctypes.Register(moduleName, 14, "recently signed")
	// ErrWrongDifficulty is returned if the difficulty of a block doesn't match the
	// turn of the signer.
	ErrWrongDifficulty = tibctypes.Register(moduleName, 15, "wrong difficulty")
	// ErrExtraValidators is returned if non-sprint-end block contain validator data in
	// their extra-data fields.
	ErrExtraValidators = tibctypes.Register(moduleName, 16, "non-sprint-end block contains extra validator list")
	// ErrInvalidSpanValidators is returned if a block contains an
	// invalid list of validators (i.e. non divisible by 20 bytes).
	ErrInvalidSpanValidators = tibctypes.Register(moduleName, 17, "invalid validator list on sprint end block")

	ErrInvalidProof = tibctypes.Register(moduleName, 18, "invalid proof")
)

IBC bsc client sentinel errors

View Source
var (
	ModuleCdc = codec.NewAminoCodec(amino)
)

Functions

func ParseValidators

func ParseValidators(extra []byte) ([][]byte, error)

func RegisterInterfaces

func RegisterInterfaces(registry types.InterfaceRegistry)

Types

type BlockNonce

type BlockNonce [nonceByteLength]byte

A BlockNonce is a 64-bit hash which proves (combined with the mix-hash) that a sufficient amount of computation has been carried out on a block.

func BytesToBlockNonce

func BytesToBlockNonce(b []byte) BlockNonce

BlockNonce converts a byte slice to a bloom filter. It panics if b is not of suitable size.

func (*BlockNonce) SetBytes

func (b *BlockNonce) SetBytes(d []byte)

SetBytes sets the content of b to the given bytes. It panics if d is not of suitable size.

type Bloom

type Bloom [bloomByteLength]byte

Bloom represents a 2048 bit bloom filter.

func BytesToBloom

func BytesToBloom(b []byte) Bloom

BytesToBloom converts a byte slice to a bloom filter. It panics if b is not of suitable size.

func (*Bloom) SetBytes

func (b *Bloom) SetBytes(d []byte)

SetBytes sets the content of b to the given bytes. It panics if d is not of suitable size.

type BscHeader

type BscHeader struct {
	ParentHash  common.Hash    `json:"parentHash"       gencodec:"required"`
	UncleHash   common.Hash    `json:"sha3Uncles"       gencodec:"required"`
	Coinbase    common.Address `json:"miner"            gencodec:"required"`
	Root        common.Hash    `json:"stateRoot"        gencodec:"required"`
	TxHash      common.Hash    `json:"transactionsRoot" gencodec:"required"`
	ReceiptHash common.Hash    `json:"receiptsRoot"     gencodec:"required"`
	Bloom       Bloom          `json:"logsBloom"        gencodec:"required"`
	Difficulty  *big.Int       `json:"difficulty"       gencodec:"required"`
	Number      *big.Int       `json:"number"           gencodec:"required"`
	GasLimit    uint64         `json:"gasLimit"         gencodec:"required"`
	GasUsed     uint64         `json:"gasUsed"          gencodec:"required"`
	Time        uint64         `json:"timestamp"        gencodec:"required"`
	Extra       []byte         `json:"extraData"        gencodec:"required"`
	MixDigest   common.Hash    `json:"mixHash"`
	Nonce       BlockNonce     `json:"nonce"`
}

BscHeader represents a block header in the Ethereum blockchain.

func (BscHeader) ToHeader

func (h BscHeader) ToHeader() Header

type ClientState

type ClientState struct {
	Header          Header   `protobuf:"bytes,1,opt,name=header,proto3" json:"header"`
	ChainId         uint64   `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	Epoch           uint64   `protobuf:"varint,3,opt,name=epoch,proto3" json:"epoch,omitempty"`
	BlockInteval    uint64   `protobuf:"varint,4,opt,name=block_inteval,json=blockInteval,proto3" json:"block_inteval,omitempty"`
	Validators      [][]byte `protobuf:"bytes,5,rep,name=validators,proto3" json:"validators,omitempty"`
	RecentSigners   []Signer `protobuf:"bytes,6,rep,name=recent_signers,json=recentSigners,proto3" json:"recent_signers"`
	ContractAddress []byte   `protobuf:"bytes,7,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"`
	TrustingPeriod  uint64   `protobuf:"varint,8,opt,name=trusting_period,json=trustingPeriod,proto3" json:"trusting_period,omitempty"`
}

ClientState from bsc tracks the current validator set, latest height, and a possible frozen height.

func (ClientState) ClientType

func (m ClientState) ClientType() string

func (*ClientState) Descriptor

func (*ClientState) Descriptor() ([]byte, []int)

func (ClientState) GetDelayBlock

func (m ClientState) GetDelayBlock() uint64

func (ClientState) GetDelayTime

func (m ClientState) GetDelayTime() uint64

func (ClientState) GetLatestHeight

func (m ClientState) GetLatestHeight() tibctypes.Height

func (ClientState) GetPrefix

func (m ClientState) GetPrefix() tibctypes.Prefix

func (*ClientState) Marshal

func (m *ClientState) Marshal() (dAtA []byte, err error)

func (*ClientState) MarshalTo

func (m *ClientState) MarshalTo(dAtA []byte) (int, error)

func (*ClientState) MarshalToSizedBuffer

func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ClientState) ProtoMessage

func (*ClientState) ProtoMessage()

func (*ClientState) Reset

func (m *ClientState) Reset()

func (*ClientState) Size

func (m *ClientState) Size() (n int)

func (*ClientState) String

func (m *ClientState) String() string

func (*ClientState) Unmarshal

func (m *ClientState) Unmarshal(dAtA []byte) error

func (ClientState) Validate

func (m ClientState) Validate() error

func (*ClientState) XXX_DiscardUnknown

func (m *ClientState) XXX_DiscardUnknown()

func (*ClientState) XXX_Marshal

func (m *ClientState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ClientState) XXX_Merge

func (m *ClientState) XXX_Merge(src proto.Message)

func (*ClientState) XXX_Size

func (m *ClientState) XXX_Size() int

func (*ClientState) XXX_Unmarshal

func (m *ClientState) XXX_Unmarshal(b []byte) error

type ConsensusState

type ConsensusState struct {
	// timestamp that corresponds to the block height in which the ConsensusState
	// was stored.
	Timestamp uint64        `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	Number    client.Height `protobuf:"bytes,2,opt,name=number,proto3" json:"number"`
	Root      []byte        `protobuf:"bytes,3,opt,name=root,proto3" json:"root,omitempty"`
}

ConsensusState defines the consensus state from bsc.

func (*ConsensusState) ClientType

func (m *ConsensusState) ClientType() string

func (*ConsensusState) Descriptor

func (*ConsensusState) Descriptor() ([]byte, []int)

func (*ConsensusState) GetRoot

func (m *ConsensusState) GetRoot() tibctypes.Root

func (*ConsensusState) GetTimestamp

func (m *ConsensusState) GetTimestamp() uint64

func (*ConsensusState) Marshal

func (m *ConsensusState) Marshal() (dAtA []byte, err error)

func (*ConsensusState) MarshalTo

func (m *ConsensusState) MarshalTo(dAtA []byte) (int, error)

func (*ConsensusState) MarshalToSizedBuffer

func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ConsensusState) ProtoMessage

func (*ConsensusState) ProtoMessage()

func (*ConsensusState) Reset

func (m *ConsensusState) Reset()

func (*ConsensusState) Size

func (m *ConsensusState) Size() (n int)

func (*ConsensusState) String

func (m *ConsensusState) String() string

func (*ConsensusState) Unmarshal

func (m *ConsensusState) Unmarshal(dAtA []byte) error

func (*ConsensusState) ValidateBasic

func (m *ConsensusState) ValidateBasic() error

func (*ConsensusState) XXX_DiscardUnknown

func (m *ConsensusState) XXX_DiscardUnknown()

func (*ConsensusState) XXX_Marshal

func (m *ConsensusState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ConsensusState) XXX_Merge

func (m *ConsensusState) XXX_Merge(src proto.Message)

func (*ConsensusState) XXX_Size

func (m *ConsensusState) XXX_Size() int

func (*ConsensusState) XXX_Unmarshal

func (m *ConsensusState) XXX_Unmarshal(b []byte) error
type Header struct {
	ParentHash  []byte        `protobuf:"bytes,1,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"`
	UncleHash   []byte        `protobuf:"bytes,2,opt,name=uncle_hash,json=uncleHash,proto3" json:"uncle_hash,omitempty"`
	Coinbase    []byte        `protobuf:"bytes,3,opt,name=coinbase,proto3" json:"coinbase,omitempty"`
	Root        []byte        `protobuf:"bytes,4,opt,name=root,proto3" json:"root,omitempty"`
	TxHash      []byte        `protobuf:"bytes,5,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"`
	ReceiptHash []byte        `protobuf:"bytes,6,opt,name=receipt_hash,json=receiptHash,proto3" json:"receipt_hash,omitempty"`
	Bloom       []byte        `protobuf:"bytes,7,opt,name=bloom,proto3" json:"bloom,omitempty"`
	Difficulty  uint64        `protobuf:"varint,8,opt,name=difficulty,proto3" json:"difficulty,omitempty"`
	Height      client.Height `protobuf:"bytes,9,opt,name=height,proto3" json:"height"`
	GasLimit    uint64        `protobuf:"varint,10,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"`
	GasUsed     uint64        `protobuf:"varint,11,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"`
	Time        uint64        `protobuf:"varint,12,opt,name=time,proto3" json:"time,omitempty"`
	Extra       []byte        `protobuf:"bytes,13,opt,name=extra,proto3" json:"extra,omitempty"`
	MixDigest   []byte        `protobuf:"bytes,14,opt,name=mix_digest,json=mixDigest,proto3" json:"mix_digest,omitempty"`
	Nonce       []byte        `protobuf:"bytes,15,opt,name=nonce,proto3" json:"nonce,omitempty"`
}

Header defines the bsc client consensus Header.

func (Header) ClientType

func (h Header) ClientType() string

func (*Header) Descriptor

func (*Header) Descriptor() ([]byte, []int)

func (Header) GetHeight

func (h Header) GetHeight() tibctypes.Height

func (*Header) Hash

func (h *Header) Hash() common.Hash

Hash returns the block hash of the header, which is simply the keccak256 hash of its RLP encoding.

func (*Header) Marshal

func (m *Header) Marshal() (dAtA []byte, err error)

func (*Header) MarshalTo

func (m *Header) MarshalTo(dAtA []byte) (int, error)

func (*Header) MarshalToSizedBuffer

func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Header) ProtoMessage

func (*Header) ProtoMessage()

func (*Header) Reset

func (m *Header) Reset()

func (*Header) Size

func (m *Header) Size() (n int)

func (*Header) String

func (m *Header) String() string

func (Header) ToBscHeader

func (h Header) ToBscHeader() BscHeader

func (*Header) Unmarshal

func (m *Header) Unmarshal(dAtA []byte) error

func (Header) ValidateBasic

func (h Header) ValidateBasic() error

func (*Header) XXX_DiscardUnknown

func (m *Header) XXX_DiscardUnknown()

func (*Header) XXX_Marshal

func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Header) XXX_Merge

func (m *Header) XXX_Merge(src proto.Message)

func (*Header) XXX_Size

func (m *Header) XXX_Size() int

func (*Header) XXX_Unmarshal

func (m *Header) XXX_Unmarshal(b []byte) error

type Proof

type Proof struct {
	Address      string           `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	Balance      string           `protobuf:"bytes,2,opt,name=balance,proto3" json:"balance,omitempty"`
	CodeHash     string           `protobuf:"bytes,3,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"`
	Nonce        string           `protobuf:"bytes,4,opt,name=nonce,proto3" json:"nonce,omitempty"`
	StorageHash  string           `protobuf:"bytes,5,opt,name=storage_hash,json=storageHash,proto3" json:"storage_hash,omitempty"`
	AccountProof []string         `protobuf:"bytes,6,rep,name=account_proof,json=accountProof,proto3" json:"account_proof,omitempty"`
	StorageProof []*StorageResult `protobuf:"bytes,7,rep,name=storage_proof,json=storageProof,proto3" json:"storage_proof,omitempty"`
}

func (*Proof) Descriptor

func (*Proof) Descriptor() ([]byte, []int)

func (*Proof) Marshal

func (m *Proof) Marshal() (dAtA []byte, err error)

func (*Proof) MarshalTo

func (m *Proof) MarshalTo(dAtA []byte) (int, error)

func (*Proof) MarshalToSizedBuffer

func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Proof) ProtoMessage

func (*Proof) ProtoMessage()

func (*Proof) Reset

func (m *Proof) Reset()

func (*Proof) Size

func (m *Proof) Size() (n int)

func (*Proof) String

func (m *Proof) String() string

func (*Proof) Unmarshal

func (m *Proof) Unmarshal(dAtA []byte) error

func (*Proof) XXX_DiscardUnknown

func (m *Proof) XXX_DiscardUnknown()

func (*Proof) XXX_Marshal

func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Proof) XXX_Merge

func (m *Proof) XXX_Merge(src proto.Message)

func (*Proof) XXX_Size

func (m *Proof) XXX_Size() int

func (*Proof) XXX_Unmarshal

func (m *Proof) XXX_Unmarshal(b []byte) error

type ProofAccount

type ProofAccount struct {
	Nonce    *big.Int
	Balance  *big.Int
	Storage  common.Hash
	Codehash common.Hash
}

ProofAccount ...

type Signer

type Signer struct {
	Height    client.Height `protobuf:"bytes,1,opt,name=height,proto3" json:"height"`
	Validator []byte        `protobuf:"bytes,2,opt,name=validator,proto3" json:"validator,omitempty"`
}

func (*Signer) Descriptor

func (*Signer) Descriptor() ([]byte, []int)

func (*Signer) GetHeight

func (m *Signer) GetHeight() client.Height

func (*Signer) GetValidator

func (m *Signer) GetValidator() []byte

func (*Signer) Marshal

func (m *Signer) Marshal() (dAtA []byte, err error)

func (*Signer) MarshalTo

func (m *Signer) MarshalTo(dAtA []byte) (int, error)

func (*Signer) MarshalToSizedBuffer

func (m *Signer) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Signer) ProtoMessage

func (*Signer) ProtoMessage()

func (*Signer) Reset

func (m *Signer) Reset()

func (*Signer) Size

func (m *Signer) Size() (n int)

func (*Signer) String

func (m *Signer) String() string

func (*Signer) Unmarshal

func (m *Signer) Unmarshal(dAtA []byte) error

func (*Signer) XXX_DiscardUnknown

func (m *Signer) XXX_DiscardUnknown()

func (*Signer) XXX_Marshal

func (m *Signer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Signer) XXX_Merge

func (m *Signer) XXX_Merge(src proto.Message)

func (*Signer) XXX_Size

func (m *Signer) XXX_Size() int

func (*Signer) XXX_Unmarshal

func (m *Signer) XXX_Unmarshal(b []byte) error

type StorageResult

type StorageResult struct {
	Key   string   `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value string   `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	Proof []string `protobuf:"bytes,3,rep,name=proof,proto3" json:"proof,omitempty"`
}

func (*StorageResult) Descriptor

func (*StorageResult) Descriptor() ([]byte, []int)

func (*StorageResult) Marshal

func (m *StorageResult) Marshal() (dAtA []byte, err error)

func (*StorageResult) MarshalTo

func (m *StorageResult) MarshalTo(dAtA []byte) (int, error)

func (*StorageResult) MarshalToSizedBuffer

func (m *StorageResult) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*StorageResult) ProtoMessage

func (*StorageResult) ProtoMessage()

func (*StorageResult) Reset

func (m *StorageResult) Reset()

func (*StorageResult) Size

func (m *StorageResult) Size() (n int)

func (*StorageResult) String

func (m *StorageResult) String() string

func (*StorageResult) Unmarshal

func (m *StorageResult) Unmarshal(dAtA []byte) error

func (*StorageResult) XXX_DiscardUnknown

func (m *StorageResult) XXX_DiscardUnknown()

func (*StorageResult) XXX_Marshal

func (m *StorageResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StorageResult) XXX_Merge

func (m *StorageResult) XXX_Merge(src proto.Message)

func (*StorageResult) XXX_Size

func (m *StorageResult) XXX_Size() int

func (*StorageResult) XXX_Unmarshal

func (m *StorageResult) XXX_Unmarshal(b []byte) error

type ValidatorSet

type ValidatorSet struct {
	Validators [][]byte `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty"`
}

func (*ValidatorSet) Descriptor

func (*ValidatorSet) Descriptor() ([]byte, []int)

func (*ValidatorSet) GetValidators

func (m *ValidatorSet) GetValidators() [][]byte

func (*ValidatorSet) Marshal

func (m *ValidatorSet) Marshal() (dAtA []byte, err error)

func (*ValidatorSet) MarshalTo

func (m *ValidatorSet) MarshalTo(dAtA []byte) (int, error)

func (*ValidatorSet) MarshalToSizedBuffer

func (m *ValidatorSet) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ValidatorSet) ProtoMessage

func (*ValidatorSet) ProtoMessage()

func (*ValidatorSet) Reset

func (m *ValidatorSet) Reset()

func (*ValidatorSet) Size

func (m *ValidatorSet) Size() (n int)

func (*ValidatorSet) String

func (m *ValidatorSet) String() string

func (*ValidatorSet) Unmarshal

func (m *ValidatorSet) Unmarshal(dAtA []byte) error

func (*ValidatorSet) XXX_DiscardUnknown

func (m *ValidatorSet) XXX_DiscardUnknown()

func (*ValidatorSet) XXX_Marshal

func (m *ValidatorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ValidatorSet) XXX_Merge

func (m *ValidatorSet) XXX_Merge(src proto.Message)

func (*ValidatorSet) XXX_Size

func (m *ValidatorSet) XXX_Size() int

func (*ValidatorSet) XXX_Unmarshal

func (m *ValidatorSet) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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