context

package
v0.0.0-...-ac1e388 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PerPage            = 100 // (0, 100]
	QueryConsensusPath = "/custom/" + "headersync" + "/" + "consensus_peers"
	// TODO: change ccm.ModuleName
	CosmosCrossChainModName = "bor"
	RightHeightUpdate       = "update latest height"
	CosmosProofKey          = "make_from_cosmos_proof"
	ProofPath               = "/store/" + "bor" + "/key"
	TxAlreadyExist          = "already done"
	NewEpoch                = "lower than epoch switching height"
	SeqErr                  = "verify correct account sequence and chain-id"
	BroadcastConnTimeOut    = "connection timed out"
	UtxoNotEnough           = "current utxo is not enoug"
	ChanBufSize             = 256
	QueryAccPath            = "/custom/acc/account"
	CosmosTxNotInEpoch      = "Compare height"
	NoUsefulHeaders         = "no header you commited is useful"
)

Variables

View Source
var (
	RCtx = &Ctx{}
)
View Source
var (
	SleepSecs = func(n int) {
		time.Sleep(time.Duration(n) * time.Second)
	}
)

Functions

func GetAccountByPassword

func GetAccountByPassword(sdk *sdkp.PolySdk, path string, pwd []byte) (*poly_go_sdk.Account, error)

func InitCtx

func InitCtx(conf *config.TendermintConfig, db *db.BoltDB, poly *poly_go_sdkp.PolySdk, tclinet *rpcclient.HTTP) error

Types

type CosmosInfo

type CosmosInfo struct {
	// type 1 means header and tx; type 2 means only header;
	Type InfoType

	// to update height of chain
	Height int64

	// tx part
	Tx *CosmosTx

	// header part
	Hdrs []*cosmos.CosmosHeader
}

type CosmosSeq

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

func (*CosmosSeq) GetAndAdd

func (seq *CosmosSeq) GetAndAdd() uint64

type CosmosTx

type CosmosTx struct {
	Tx          *rpctypes.ResultTx
	ProofHeight int64
	Proof       []byte
	PVal        []byte
}

type Ctx

type Ctx struct {
	// configuration
	Conf *config.TendermintConfig

	// To transfer cross chain tx from listening to relaying
	ToCosmos chan *PolyInfo
	ToPoly   chan *CosmosInfo

	// Cosmos
	CMRpcCli *rpcclient.HTTP
	CMPrivk  tcrypto.PrivKey
	CMAcc    ctypes.AccAddress
	CMSeq    *CosmosSeq
	CMAccNum uint64

	CMGas uint64
	CMCdc *codec.Codec

	// Poly chain
	Poly    *poly_go_sdkp.PolySdk
	PolyAcc *poly_go_sdk.Account

	// DB
	Db *db.BoltDB
}

type InfoType

type InfoType int
const (
	TyTx InfoType = iota
	TyHeader
	TyUpdateHeight
)

type PolyInfo

type PolyInfo struct {
	// type 0 means only tx; type 2 means header and tx; type 1 means only header;
	Type InfoType

	// to update height of Poly on COSMOS
	Height uint32

	// tx part
	Tx *PolyTx

	// header part
	Hdr *types.Header

	// proof of header which is not during current epoch
	HeaderProof string

	// any header in current epoch can be trust anchor
	EpochAnchor string
}

type PolyTx

type PolyTx struct {
	Height      uint32
	Proof       string
	TxHash      string
	IsEpoch     bool
	CCID        []byte
	FromChainId uint64
}

Jump to

Keyboard shortcuts

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