retriever

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryAnchor

func QueryAnchor(config *params.ChainConfig, bc core.ChainContext, statedb *state.StateDB, header *types.Header,
	address common.Address, remoteChainId uint64) ([]common.Address, int)

Types

type Anchor

type Anchor = common.Address

type AnchorSet

type AnchorSet map[Anchor]struct{}

func NewAnchorSet

func NewAnchorSet(anchors []Anchor) *AnchorSet

func (*AnchorSet) IsAnchor

func (as *AnchorSet) IsAnchor(address common.Address) bool

func (*AnchorSet) IsAnchorSignedCtx

func (as *AnchorSet) IsAnchorSignedCtx(tx *cc.CrossTransaction, signer cc.CtxSigner) (common.Address, bool)

func (AnchorSet) String

func (as AnchorSet) String() string

type ChainInvoke

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

ChainInvoke invoke blockchain interfaces to get block and transaction states

func NewChainInvoke

func NewChainInvoke(chain simpletrigger.BlockChain) *ChainInvoke

func (ChainInvoke) CurrentBlockNumber

func (c ChainInvoke) CurrentBlockNumber() uint64

func (ChainInvoke) GetConfirmedTransactionNumberOnChain

func (c ChainInvoke) GetConfirmedTransactionNumberOnChain(tx trigger.Transaction) uint64

func (ChainInvoke) GetTransactionNumberOnChain

func (c ChainInvoke) GetTransactionNumberOnChain(tx trigger.Transaction) uint64

func (ChainInvoke) GetTransactionTimeOnChain

func (c ChainInvoke) GetTransactionTimeOnChain(tx trigger.Transaction) uint64

func (ChainInvoke) IsTransactionExpired

func (c ChainInvoke) IsTransactionExpired(tx trigger.Transaction, expiredHeight uint64) bool

type EvmInvoke

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

EvmInvoke invoke evm interfaces to call contract function

func NewEvmInvoke

func NewEvmInvoke(bc core.ChainContext, header *types.Header, stateDB *state.StateDB, config *params.ChainConfig,
	vmCfg vm.Config) *EvmInvoke

func (EvmInvoke) CallContract

func (e EvmInvoke) CallContract(from common.Address, to *common.Address, function []byte, inputs ...[]byte) ([]byte, error)

type SimpleRetriever

type SimpleRetriever struct {
	*ChainInvoke
	*SimpleValidator
	// contains filtered or unexported fields
}

func (*SimpleRetriever) CanAcceptTxs

func (s *SimpleRetriever) CanAcceptTxs() bool

func (*SimpleRetriever) ConfirmedDepth

func (s *SimpleRetriever) ConfirmedDepth() uint64

type SimpleValidator

type SimpleValidator struct {
	*SimpleRetriever
	// contains filtered or unexported fields
}

func NewSimpleValidator

func NewSimpleValidator(contract common.Address, chain simpletrigger.BlockChain, config *cross.Config, chainConfig *params.ChainConfig) *SimpleValidator

func (*SimpleValidator) ExpireNumber

func (v *SimpleValidator) ExpireNumber() int

func (*SimpleValidator) IsLocalCtx

func (v *SimpleValidator) IsLocalCtx(ctx trigger.Transaction) bool

func (*SimpleValidator) IsRemoteCtx

func (v *SimpleValidator) IsRemoteCtx(ctx trigger.Transaction) bool

func (*SimpleValidator) RequireSignatures

func (v *SimpleValidator) RequireSignatures() int

func (*SimpleValidator) UpdateAnchors

func (v *SimpleValidator) UpdateAnchors(info *cc.RemoteChainInfo) error

func (*SimpleValidator) VerifyContract

func (v *SimpleValidator) VerifyContract(cws trigger.Transaction) error

send message to verify ctx in the cross contract (must exist makerTx in source-chain, do not took by others in destination-chain)

func (*SimpleValidator) VerifyExpire

func (v *SimpleValidator) VerifyExpire(ctx *cc.CrossTransaction) error

func (*SimpleValidator) VerifySigner

func (v *SimpleValidator) VerifySigner(ctx *cc.CrossTransaction, signChain, validChain *big.Int) (common.Address, error)

* validate ctx signed by anchor

  • signChain: 交易签名的链ID
  • validChain: 验证链ID,即本链跨链合约保存的其他链ID,需要验证签名的anchor是否与这条链需要的anchor相同

Jump to

Keyboard shortcuts

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