Documentation
¶
Index ¶
- Constants
- func HexToAddress(s string) common.Address
- func NewReceiver(src, dst chain.BTPAddress, urls []string, rawOpts json.RawMessage, ...) (chain.Receiver, error)
- func NewSender(src, dst chain.BTPAddress, urls []string, w wallet.Wallet, ...) (chain.Sender, error)
- func SealHash(header *types.Header, chainId *big.Int) (hash ethCommon.Hash)
- type Address
- type BMCRelayMethodParams
- type BMCStatus
- type BlockNotification
- type BlockRequest
- type BnOptions
- type Client
- func (cl *Client) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (cl *Client) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]ethTypes.Log, error)
- func (cl *Client) GetBMCClient() *bmcperiphery.Bmcperiphery
- func (cl *Client) GetBalance(ctx context.Context, hexAddr string) (*big.Int, error)
- func (cl *Client) GetBlockByHash(hash common.Hash) (*bscTypes.Block, error)
- func (cl *Client) GetBlockNumber() (uint64, error)
- func (cl *Client) GetBlockReceipts(hash common.Hash) (ethTypes.Receipts, error)
- func (c *Client) GetChainID() *big.Int
- func (c *Client) GetEthClient() *ethclient.Client
- func (cl *Client) GetHeaderByHeight(ctx context.Context, height *big.Int) (*ethTypes.Header, error)
- func (cl *Client) GetMedianGasPriceForBlock(ctx context.Context) (gasPrice *big.Int, gasHeight *big.Int, err error)
- func (cl *Client) GetStatus(opts *bind.CallOpts, _link string) (bmcperiphery.TypesLinkStats, error)
- func (cl *Client) HandleRelayMessage(opts *bind.TransactOpts, _prev string, _msg []byte) (*ethTypes.Transaction, error)
- func (c *Client) Log() log.Logger
- func (cl *Client) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (cl *Client) ParseMessage(log ethTypes.Log) (*bmcperiphery.BmcperipheryMessage, error)
- func (cl *Client) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (cl *Client) TransactionByHash(ctx context.Context, blockHash common.Hash) (tx *ethTypes.Transaction, isPending bool, err error)
- func (cl *Client) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
- func (cl *Client) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*ethTypes.Transaction, error)
- func (cl *Client) TransactionReceipt(ctx context.Context, txHash common.Hash) (*ethTypes.Receipt, error)
- type EVMLog
- type EventFilter
- type EventLog
- type HexBytes
- type HexInt
- type IClient
- type IVerifier
- type Receipt
- type ReceiptProof
- type ReceiverOptions
- type RelayMessage
- type Signature
- type TransactionHashParam
- type TransactionParam
- type TransactionResult
- type Verifier
- func (vr *Verifier) ChainID() *big.Int
- func (vr *Verifier) IsValidator(addr ethCommon.Address, curHeight *big.Int) bool
- func (vr *Verifier) Next() *big.Int
- func (vr *Verifier) ParentHash() ethCommon.Hash
- func (vr *Verifier) Update(header *types.Header) (err error)
- func (vr *Verifier) Verify(header *types.Header, nextHeader *types.Header, receipts ethTypes.Receipts) error
- type VerifierOptions
Constants ¶
View Source
const ( BlockInterval = 3 * time.Second BlockHeightPollInterval = BlockInterval * 5 BlockFinalityConfirmations = 10 MonitorBlockMaxConcurrency = 300 // number of concurrent requests to synchronize older blocks from source chain RPCCallRetry = 5 )
View Source
const ( JsonrpcApiVersion = 3 JsonrpcErrorCodeSystem jsonrpc.ErrorCode = -31000 JsonrpcErrorCodeTxPoolOverflow jsonrpc.ErrorCode = -31001 JsonrpcErrorCodePending jsonrpc.ErrorCode = -31002 JsonrpcErrorCodeExecuting jsonrpc.ErrorCode = -31003 JsonrpcErrorCodeNotFound jsonrpc.ErrorCode = -31004 JsonrpcErrorLackOfResource jsonrpc.ErrorCode = -31005 JsonrpcErrorCodeTimeout jsonrpc.ErrorCode = -31006 JsonrpcErrorCodeSystemTimeout jsonrpc.ErrorCode = -31007 JsonrpcErrorCodeScore jsonrpc.ErrorCode = -30000 )
View Source
const ( DuplicateTransactionError = iota + 2000 TransactionPoolOverflowError ExpiredTransactionError FutureTransactionError TransitionInterruptedError InvalidTransactionError InvalidQueryError InvalidResultError NoActiveContractError NotContractAddressError InvalidPatchDataError CommittedTransactionError )
View Source
const ( ResultStatusSuccess = "0x1" ResultStatusFailureCodeRevert = 32 ResultStatusFailureCodeEnd = 99 )
View Source
const ( ParliaGasLimitBoundDivisor uint64 = 256 // The bound divisor of the gas limit, used in update calculations. MinGasLimit uint64 = 5000 // Minimum the gas limit may ever be. MaxGasLimit uint64 = 0x7fffffffffffffff // Maximum the gas limit (2^63-1). )
View Source
const (
DefaultGasLimit = 25000000
)
Variables ¶
This section is empty.
Functions ¶
func HexToAddress ¶
func NewReceiver ¶
func NewReceiver( src, dst chain.BTPAddress, urls []string, rawOpts json.RawMessage, l log.Logger) (chain.Receiver, error)
Types ¶
type BMCRelayMethodParams ¶
type BMCStatus ¶
type BMCStatus struct {
TxSeq HexInt `json:"tx_seq"`
RxSeq HexInt `json:"rx_seq"`
BMRIndex HexInt `json:"relay_idx"`
RotateHeight HexInt `json:"rotate_height"`
RotateTerm HexInt `json:"rotate_term"`
DelayLimit HexInt `json:"delay_limit"`
MaxAggregation HexInt `json:"max_agg"`
CurrentHeight HexInt `json:"cur_height"`
RxHeight HexInt `json:"rx_height"`
RxHeightSrc HexInt `json:"rx_height_src"`
BlockIntervalSrc HexInt `json:"block_interval_src"`
BlockIntervalDst HexInt `json:"block_interval_dst"`
}
type BlockNotification ¶
type BlockRequest ¶
type BlockRequest struct {
Height *big.Int `json:"height"`
EventFilters []*EventFilter `json:"eventFilters,omitempty"`
SrcContractAddress common.Address `json:"srcContractAddress,omitempty"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
grouped rpc api clients
func (*Client) CallContract ¶
func (*Client) FilterLogs ¶
func (*Client) GetBMCClient ¶
func (cl *Client) GetBMCClient() *bmcperiphery.Bmcperiphery
func (*Client) GetBalance ¶
func (*Client) GetBlockByHash ¶
func (*Client) GetBlockNumber ¶
func (*Client) GetBlockReceipts ¶
func (*Client) GetChainID ¶
func (*Client) GetEthClient ¶
func (*Client) GetHeaderByHeight ¶
func (*Client) GetMedianGasPriceForBlock ¶
func (*Client) GetStatus ¶
func (cl *Client) GetStatus(opts *bind.CallOpts, _link string) (bmcperiphery.TypesLinkStats, error)
func (*Client) HandleRelayMessage ¶
func (cl *Client) HandleRelayMessage(opts *bind.TransactOpts, _prev string, _msg []byte) (*ethTypes.Transaction, error)
func (*Client) ParseMessage ¶
func (cl *Client) ParseMessage(log ethTypes.Log) (*bmcperiphery.BmcperipheryMessage, error)
func (*Client) SuggestGasPrice ¶
func (*Client) TransactionByHash ¶
func (*Client) TransactionCount ¶
func (*Client) TransactionInBlock ¶
type EVMLog ¶
type EventFilter ¶
type IClient ¶
type IClient interface {
Log() log.Logger
GetBalance(ctx context.Context, hexAddr string) (*big.Int, error)
GetBlockNumber() (uint64, error)
GetBlockByHash(hash common.Hash) (*bscTypes.Block, error)
GetHeaderByHeight(ctx context.Context, height *big.Int) (*ethTypes.Header, error)
GetBlockReceipts(hash common.Hash) (ethTypes.Receipts, error)
GetMedianGasPriceForBlock(ctx context.Context) (gasPrice *big.Int, gasHeight *big.Int, err error)
GetChainID() *big.Int
// ethClient
FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]ethTypes.Log, error)
SuggestGasPrice(ctx context.Context) (*big.Int, error)
NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
TransactionByHash(ctx context.Context, blockHash common.Hash) (tx *ethTypes.Transaction, isPending bool, err error)
CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
TransactionReceipt(ctx context.Context, txHash common.Hash) (*ethTypes.Receipt, error)
TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*ethTypes.Transaction, error)
// bmcClient
ParseMessage(log ethTypes.Log) (*bmcperiphery.BmcperipheryMessage, error)
HandleRelayMessage(opts *bind.TransactOpts, _prev string, _msg []byte) (*ethTypes.Transaction, error)
GetStatus(opts *bind.CallOpts, _link string) (bmcperiphery.TypesLinkStats, error)
}
type Receipt ¶
type Receipt struct {
// Consensus fields: These fields are defined by the Yellow Paper
Type uint8
PostState []byte
Status uint64
CumulativeGasUsed uint64
Bloom []byte
Logs []*EVMLog
TxHash common.Hash
ContractAddress common.Address
GasUsed uint64
BlockHash common.Hash
BlockNumber uint64
TransactionIndex uint
}
func MakeReceipt ¶
type ReceiptProof ¶
type ReceiverOptions ¶
type ReceiverOptions struct {
SyncConcurrency uint64 `json:"syncConcurrency"`
Verifier *VerifierOptions `json:"verifier"`
}
func (*ReceiverOptions) Unmarshal ¶
func (opts *ReceiverOptions) Unmarshal(v map[string]interface{}) error
type RelayMessage ¶
type RelayMessage struct {
ReceiptProofs [][]byte
// contains filtered or unexported fields
}
type TransactionHashParam ¶
type TransactionParam ¶
type TransactionParam struct {
FromAddress string `json:"from" validate:"required,t_addr_eoa"`
ToAddress string `json:"to" validate:"required,t_addr"`
NetworkID HexInt `json:"nid" validate:"required,t_int"`
Params interface{} `json:"params,omitempty"`
TransactOpt *bind.TransactOpts
}
type TransactionResult ¶
type TransactionResult struct {
To Address `json:"to"`
CumulativeStepUsed HexInt `json:"cumulativeStepUsed"`
StepUsed HexInt `json:"stepUsed"`
StepPrice HexInt `json:"stepPrice"`
EventLogs []struct {
Addr Address `json:"scoreAddress"`
Indexed []string `json:"indexed"`
Data []string `json:"data"`
} `json:"eventLogs"`
LogsBloom HexBytes `json:"logsBloom"`
Status HexInt `json:"status"`
Failure *struct {
CodeValue HexInt `json:"code"`
MessageValue string `json:"message"`
} `json:"failure,omitempty"`
SCOREAddress Address `json:"scoreAddress,omitempty"`
BlockHash HexBytes `json:"blockHash" validate:"required,t_hash"`
BlockHeight HexInt `json:"blockHeight" validate:"required,t_int"`
TxIndex HexInt `json:"txIndex" validate:"required,t_int"`
TxHash HexBytes `json:"txHash" validate:"required,t_int"`
}
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
next points to height whose parentHash is expected parentHash of height h is got from next-1's hash
func (*Verifier) IsValidator ¶
func (*Verifier) ParentHash ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.