Documentation ¶
Index ¶
- Constants
- Variables
- func AuditingMessageHash(id common.ChainID, height common.Height, hob common.Hash, audited bool) ([]byte, error)
- func AvailableSignatureValues(v, r, s *big.Int) bool
- func BridgeProcessingIdToName(id []byte) (string, bool)
- func BridgeReqRespKey(height common.Height, addr common.Address, nonce uint64) []byte
- func CheckElectedNextRoot(blockVersion uint16, fromHeader *common.Hash, next, real *Committee) error
- func CheckElectedNextRootByEpochComm(blockVersion uint16, root *common.Hash, epochComm *EpochCommittee) error
- func ContractHasMethods(code []byte, ab abi.ABI, methodNames ...string) error
- func DecodeSignature(sig []byte) (r, s, v *big.Int)
- func ETHChainID(tkmChainID common.ChainID, txVersion uint16) uint64
- func EmptyBytesIfNil(bs []byte) []byte
- func Encode2Signature(R, S, Vb *big.Int, homestead bool) ([]byte, error)
- func FromETHChainID(ethChainId *big.Int) (common.ChainID, error)
- func GenElectedNextRoot(blockVersion uint16, next, real *Committee) *common.Hash
- func HashSliceValueDecoder(r io.Reader) (o interface{}, err error)
- func HashSliceValueEncoder(o interface{}, w io.Writer) error
- func HashSliceValueExpander(hashBytes []byte, adpater db.DataAdapter) (valueBytes []byte, err error)
- func HashSliceValueHasher(value interface{}, valueBytes []byte) (hashBytes []byte, err error)
- func InPosv3Names(input []byte, names ...string) bool
- func InitBridgeAbi()
- func InitBridgeInfoAbi()
- func InitCSAbi()
- func InitForwarderAbi()
- func InitMCommAbi()
- func InitManageChainsAbi()
- func InitRRAbi()
- func InitSRAbi()
- func InitVersionAbi()
- func IsBlockValidateError(err error) bool
- func IsBlockValidateFailed(err error) bool
- func IsMalicious(err error) bool
- func IsPosv3InputOf(name string, input []byte) bool
- func LegacyTxVMatchChainID(chainid common.ChainID, V *big.Int) error
- func NewIdentifier(priv []byte) (common.Identifier, error)
- func NewIdentifierByHex(privHexString string) (common.Identifier, error)
- func NewIdentifierByHexWithoutError(privHexString string) common.Identifier
- func NewNodeIdentifier(priv []byte) (common.NodeIdentifier, error)
- func NewNodeIdentifierByHex(privHexString string) (common.NodeIdentifier, error)
- func NewNodeIdentifierByHexWithoutError(privHexString string) common.NodeIdentifier
- func NewPosv3Award(rewardType RewardType, era common.EraNum) ([]byte, error)
- func NewPosv3Report(nid common.NodeID, nodeType common.NodeType, chainid common.ChainID, ...) ([]byte, error)
- func NewPosv3UnDelegate(nidHash common.Hash) ([]byte, error)
- func NewPosv3Withdraw(nidHash common.Hash) ([]byte, error)
- func NewRRPenalize(nodeId common.NodeID, typeCode uint16, subChainId common.ChainID, ...) ([]byte, error)
- func NewRevertError(revertMsg []byte) error
- func PrefixedRlpHash(prefix byte, x interface{}) (h common.Hash)
- func PrivateToPublicSlice(priv []byte) ([]byte, error)
- func PubKeyCanRecover() bool
- func PubToNodeID(pub []byte) (common.NodeID, error)
- func RRDepositRequestHash(nodeId common.NodeID, nodeType common.NodeType, bindAddr common.Address, ...) []byte
- func ReachAudited(auditorSize, auditedSize int) bool
- func ReachCommit(commSize, committed int) bool
- func ReachConfirm(commSize, confirmed int) bool
- func ReachPrepare(commSize, prepared int) bool
- func ReachRevealed(auditorSize, revealedSize int) bool
- func RebootMainChainHash(lastHeight common.Height, lastHash common.Hash, comm *Committee) ([]byte, error)
- func RlpHash(x interface{}) (h common.Hash)
- func SetupChains(chains *ChainTrie, chaininfosMap map[common.ChainID]*common.ChainInfos)
- func ToMalicious(err error, typ MaliciousType) error
- func TransactionStringForHash(chainid common.ChainID, from *common.Address, to *common.Address, nonce uint64, ...) string
- func TrieRootEqual(a, b []byte) bool
- func TrieRootHashEqual(h *common.Hash, root []byte) bool
- func ValidateFailed(err error) error
- func VerifyHash(hash, pub, sig []byte) bool
- func VerifyHashWithPub(hash, pub, sig []byte) (bool, []byte)
- func VerifyMsg(v interface{}, pub, sig []byte) bool
- func VerifyMsgWithPub(v interface{}, pub, sig []byte) (bool, []byte)
- func WithdrawingExpireEra(requestEra common.EraNum) common.EraNum
- type AccessList
- type AccessListTx
- type AccessTuple
- type Account
- type AccountDelta
- type AccountState
- type Accounts
- type ActFailedResult
- type ActResult
- type ActRptType
- type AllCommEntries
- type AllCommEntry
- type AttendanceRecord
- func (a *AttendanceRecord) AddDataNodeStat(nodeId common.NodeID)
- func (a *AttendanceRecord) AuditString(num common.BlockNum) string
- func (a *AttendanceRecord) AuditedChains(num common.BlockNum) common.ChainIDs
- func (a *AttendanceRecord) CheckAudits(num common.BlockNum, summaries []*BlockSummary) error
- func (a *AttendanceRecord) Clone() *AttendanceRecord
- func (a *AttendanceRecord) Hash() (*common.Hash, error)
- func (a *AttendanceRecord) HashValue() ([]byte, error)
- func (a *AttendanceRecord) IsLegalFirst(chainIds common.ChainIDs, datanodes common.NodeIDs) error
- func (a *AttendanceRecord) IsLegalNext(next *AttendanceRecord) error
- func (a *AttendanceRecord) NoAudits() bool
- func (a *AttendanceRecord) Proposed(commId common.CommID, commSize int) int
- func (a *AttendanceRecord) SetAbsentness(epoch common.EpochNum, block common.BlockNum)
- func (a *AttendanceRecord) SetAttendance(epoch common.EpochNum, block common.BlockNum)
- func (a *AttendanceRecord) SetAudits(num common.BlockNum, summaries []*BlockSummary)
- func (a *AttendanceRecord) String() string
- type AttendanceReportTxFilter
- type AuditRequest
- type AuditingMessage
- func (a *AuditingMessage) AuditHash() ([]byte, error)
- func (a *AuditingMessage) GetChainID() common.ChainID
- func (a *AuditingMessage) InfoString(level common.IndentLevel) string
- func (a *AuditingMessage) String() string
- func (a *AuditingMessage) Validate() ([]byte, error)
- func (a *AuditingMessage) Verify(ider func(nid common.NodeID) bool) error
- func (a *AuditingMessage) VerifyByList(auditorIds common.NodeIDs) error
- func (a *AuditingMessage) VerifyByMap(auditors map[common.NodeID]struct{}) error
- type AuditorMsgsForDB
- type AuditorMsgsForDBs
- type AuditorPas
- func (a *AuditorPas) Clone() *AuditorPas
- func (a *AuditorPas) Equal(o *AuditorPas) bool
- func (a *AuditorPas) InfoString(level common.IndentLevel) string
- func (a *AuditorPas) Key() []byte
- func (a *AuditorPas) String() string
- func (a *AuditorPas) Verify(id common.ChainID, height common.Height, hob []byte) (pub []byte, err error)
- type AuditorPass
- func (as AuditorPass) Clone() AuditorPass
- func (as AuditorPass) Equal(os AuditorPass) bool
- func (as AuditorPass) HashValue() ([]byte, error)
- func (as AuditorPass) InfoString(level common.IndentLevel) string
- func (as AuditorPass) Len() int
- func (as AuditorPass) Less(i, j int) bool
- func (as AuditorPass) Merge(apass AuditorPass) AuditorPass
- func (as AuditorPass) Swap(i, j int)
- func (as AuditorPass) Verify(id common.ChainID, height common.Height, hashOfBlock []byte, ...) (audited, revealed map[common.NodeID]*AuditorPas, err error)
- func (as AuditorPass) VerifyByAuditors(id common.ChainID, height common.Height, hob []byte, ...) error
- type BlockBody
- func (bb *BlockBody) AttendanceRoot() (*common.Hash, error)
- func (bb *BlockBody) AuditedInfoString(level common.IndentLevel, num common.BlockNum) string
- func (bb *BlockBody) ConfirmedChains() []common.ChainID
- func (bb *BlockBody) ElectResultRoot() (*common.Hash, error)
- func (bb *BlockBody) Formalize()
- func (bb *BlockBody) GenElectedNextRoot(blockVersion uint16) *common.Hash
- func (bb *BlockBody) HdsRoot() (*common.Hash, error)
- func (bb *BlockBody) InfoString(level common.IndentLevel) string
- func (bb *BlockBody) PreElectRoot() (*common.Hash, error)
- func (bb *BlockBody) ProofNextComm(version uint16) (nextComm *Committee, commRoot *common.Hash, proof *common.MerkleProofs, ...)
- func (bb *BlockBody) SeedFactorRoot() (*common.Hash, error)
- func (bb *BlockBody) TransactionsRoot(blockVersion uint16) (*common.Hash, error)
- func (bb *BlockBody) TxParamsRoot() (*common.Hash, error)
- func (bb *BlockBody) TxProofHash(blockVersion uint16, txIndex, rrIndex int, proofs *common.MerkleProofs) ([]byte, error)
- type BlockCursor
- type BlockEMessage
- func (b *BlockEMessage) BlockNum() common.BlockNum
- func (b *BlockEMessage) CheckHashs() error
- func (b *BlockEMessage) EpochNum() common.EpochNum
- func (b *BlockEMessage) EraString() string
- func (b *BlockEMessage) Formalize()
- func (b *BlockEMessage) FullString() string
- func (b *BlockEMessage) GenRestartedComm(chainid common.ChainID) (*RestartedComm, error)
- func (b *BlockEMessage) GetChainID() common.ChainID
- func (b *BlockEMessage) GetHeight() common.Height
- func (b *BlockEMessage) HasTx() bool
- func (b *BlockEMessage) Hash() common.Hash
- func (b *BlockEMessage) InfoString(level common.IndentLevel) string
- func (b *BlockEMessage) IsValid() bool
- func (b *BlockEMessage) Logger(logger logrus.FieldLogger, defaultLevel ...logrus.Level) func(string, ...interface{})
- func (b *BlockEMessage) MakeHdsProof(subId common.ChainID, height common.Height, proofChain *trie.ProofChain) ([]byte, error)
- func (b *BlockEMessage) SetRestarting(pheight common.Height, phash *common.Hash, restarted *RestartedComm)
- func (b *BlockEMessage) String() string
- type BlockHeader
- func (h *BlockHeader) AllFullString() string
- func (h *BlockHeader) AllString() string
- func (h *BlockHeader) Clone() *BlockHeader
- func (h *BlockHeader) ContentString(names []string, noNils ...bool) string
- func (h *BlockHeader) Equal(o *BlockHeader) bool
- func (h *BlockHeader) Era() common.EraNum
- func (h *BlockHeader) FullString() string
- func (h BlockHeader) GetHeight() common.Height
- func (h *BlockHeader) Hash() common.Hash
- func (h *BlockHeader) HashValue() ([]byte, error)
- func (h *BlockHeader) InfoString(level common.IndentLevel) string
- func (h *BlockHeader) MakeProof(typ trie.ProofType, proofChain *trie.ProofChain) (hashOfHeader []byte, err error)
- func (h *BlockHeader) RandomSeed() []byte
- func (h *BlockHeader) String() string
- func (h *BlockHeader) Summary() string
- type BlockHeighter
- type BlockHistoryProof
- type BlockReport
- func (r *BlockReport) CAS(o *BlockReport) (*BlockReport, error)
- func (r *BlockReport) Clone() *BlockReport
- func (r *BlockReport) DestChainID() common.ChainID
- func (r *BlockReport) GetChainID() common.ChainID
- func (r *BlockReport) Hash() common.Hash
- func (r *BlockReport) ProofingHeight() common.Height
- func (r *BlockReport) String() string
- func (r *BlockReport) Verify(lastHeight common.Height, lastHob []byte, comm *Committee, ...) error
- func (r *BlockReport) VerifyHistoryProof(proofingHeight common.Height, proofingHob []byte) error
- type BlockRequest
- type BlockResponse
- type BlockSummary
- func (s *BlockSummary) Compare(o *BlockSummary) int
- func (s *BlockSummary) Equal(o *BlockSummary) bool
- func (s *BlockSummary) FastEqual(o *BlockSummary) bool
- func (s *BlockSummary) GetBlockHash() common.Hash
- func (s *BlockSummary) GetChainID() common.ChainID
- func (s *BlockSummary) GetHeight() common.Height
- func (s *BlockSummary) HashValue() ([]byte, error)
- func (s *BlockSummary) HeaderEqual(header *BlockHeader) bool
- func (s *BlockSummary) HistoryProofing() common.Height
- func (s *BlockSummary) Hob() []byte
- func (s *BlockSummary) InfoString(level common.IndentLevel) string
- func (s *BlockSummary) IsValid() bool
- func (s *BlockSummary) MakeProof() (*trie.NodeProof, error)
- func (s *BlockSummary) String() string
- func (s *BlockSummary) Summary() string
- type BlockSummarys
- func (ss BlockSummarys) Equal(os BlockSummarys) bool
- func (ss BlockSummarys) FastEqual(os BlockSummarys) bool
- func (ss BlockSummarys) InfoString(level common.IndentLevel) string
- func (ss BlockSummarys) Len() int
- func (ss BlockSummarys) Less(i, j int) bool
- func (ss BlockSummarys) Summary() string
- func (ss BlockSummarys) Swap(i, j int)
- type BlockValidateError
- type Bonus
- type Bonuses
- type BridgeExtra
- type BridgeInfo
- func (*BridgeInfo) BridgeInfoKey(chainId common.ChainID, contract common.Address) []byte
- func (b *BridgeInfo) Clone() *BridgeInfo
- func (b *BridgeInfo) ErcType(chain common.ChainID, contract common.Address) (typ MappingType, exist bool)
- func (b *BridgeInfo) IsMainContract(chain common.ChainID, contract common.Address) bool
- func (b *BridgeInfo) IsMapping(chain common.ChainID, contract common.Address) bool
- func (b *BridgeInfo) Key() []byte
- func (b *BridgeInfo) Match(o *BridgeInfo) bool
- func (b *BridgeInfo) SameMain(o *BridgeInfo) bool
- func (b *BridgeInfo) String() string
- func (b *BridgeInfo) Validate() error
- type BridgeInfos
- type BridgeReq
- func (r *BridgeReq) Clone() *BridgeReq
- func (r *BridgeReq) Equal(o *BridgeReq) bool
- func (r *BridgeReq) Failed() bool
- func (r *BridgeReq) Key() []byte
- func (r *BridgeReq) MakeWithdrawingInput() ([]byte, error)
- func (r *BridgeReq) String() string
- func (r *BridgeReq) Succeeded() bool
- func (r *BridgeReq) ToFailedTx(nonce uint64) (*Transaction, error)
- func (r *BridgeReq) ToProcessingTx(nonce uint64) (*Transaction, error)
- func (r *BridgeReq) Validate() error
- type BridgeReqExtra
- type BridgeReqInfo
- type BridgeReqStatus
- type BridgeResp
- func (p *BridgeResp) Clone() *BridgeResp
- func (p *BridgeResp) Equal(o *BridgeResp) bool
- func (p *BridgeResp) Key() []byte
- func (p *BridgeResp) StatusString() string
- func (p *BridgeResp) String() string
- func (p *BridgeResp) Succeeded() bool
- func (p *BridgeResp) ToUpdateTx(nonce uint64) (*Transaction, error)
- type BridgeTargetNode
- func (n *BridgeTargetNode) Clone() *BridgeTargetNode
- func (n *BridgeTargetNode) HashValue() ([]byte, error)
- func (n *BridgeTargetNode) Key() []byte
- func (n *BridgeTargetNode) MakeProof(index BridgeTargetNodeProofIndex, proofs *common.MerkleProofs) ([]byte, *common.MerkleProofs, error)
- func (n *BridgeTargetNode) String() string
- type BridgeTargetNodeProofIndex
- type BridgeTxFilter
- type BridgeUpdateReqParams
- type CancelCashCheckRequest
- type CashCheck
- type CashRequest
- type ChainConfirmed
- type ChainConfirmeds
- type ChainElectResult
- func (c *ChainElectResult) Clone() *ChainElectResult
- func (c *ChainElectResult) ElectingName() ElectingName
- func (c *ChainElectResult) Equal(o *ChainElectResult) bool
- func (c *ChainElectResult) HashValue() ([]byte, error)
- func (c *ChainElectResult) IsNormal() bool
- func (c *ChainElectResult) IsPreElecting() bool
- func (c *ChainElectResult) IsPreElectingOrRestarting() bool
- func (c *ChainElectResult) IsRestarting() bool
- func (c *ChainElectResult) Match(comm *Committee) error
- func (c *ChainElectResult) ResultLen() int
- func (c *ChainElectResult) String() string
- func (c *ChainElectResult) Success() bool
- func (c *ChainElectResult) ToCommittee() *Committee
- type ChainElectResults
- func (cs ChainElectResults) Equal(os ChainElectResults) bool
- func (cs ChainElectResults) HashValue() ([]byte, error)
- func (cs ChainElectResults) HavePreElectingsOrRestartings() bool
- func (cs ChainElectResults) InfoString(level common.IndentLevel) string
- func (cs ChainElectResults) Len() int
- func (cs ChainElectResults) Less(i, j int) bool
- func (cs ChainElectResults) ProofHash(index int, proofs *common.MerkleProofs) ([]byte, error)
- func (cs ChainElectResults) ProofRestarting(id common.ChainID, lastHeight common.Height, lastHob *common.Hash) (*ChainElectResult, *common.MerkleProofs, error)
- func (cs ChainElectResults) String() string
- func (cs ChainElectResults) Swap(i, j int)
- func (cs ChainElectResults) ToMap() map[common.ChainID]*ChainElectResult
- type ChainEpochCommittee
- type ChainInfoChange
- type ChainSetting
- type ChainStats
- type ChainTrie
- func (c *ChainTrie) CheckPoint() (checkpoint int, root []byte, err error)
- func (c *ChainTrie) Commit() error
- func (c *ChainTrie) Copy() *ChainTrie
- func (c *ChainTrie) DeleteInfo(id common.ChainID) (changed bool, oldInfo *common.ChainInfos, err error)
- func (c *ChainTrie) GenesisNodes() map[common.NodeID]common.NodeType
- func (c *ChainTrie) GetAllChainInfos() []*common.ChainInfos
- func (c *ChainTrie) GetChainChildren(id common.ChainID) common.ChainIDs
- func (c *ChainTrie) GetChainInfos(id common.ChainID) (*common.ChainInfos, bool)
- func (c *ChainTrie) GetChainList() common.ChainIDs
- func (c *ChainTrie) GetDataNodeList(id common.ChainID) common.NodeIDs
- func (c *ChainTrie) GetDataNodeMap() map[common.ChainID]map[common.NodeID]struct{}
- func (c *ChainTrie) GetDataNodes(id common.ChainID) (datas map[common.NodeID]struct{})
- func (c *ChainTrie) GetGenesisDataNodeList(id common.ChainID) common.NodeIDs
- func (c *ChainTrie) GetLiveChainInfos(id common.ChainID) (*common.ChainInfos, bool)
- func (c *ChainTrie) GetNodeType(nid common.NodeID) (isGen bool, nt common.NodeType, chainid common.ChainID, exist bool)
- func (c *ChainTrie) GetReportChildren(id common.ChainID) common.ChainIDs
- func (c *ChainTrie) GetRewardChainID() common.ChainID
- func (c *ChainTrie) GetShardInfo(id common.ChainID) (shardInfo common.ShardInfo)
- func (c *ChainTrie) GetVrfChainList() common.ChainIDs
- func (c *ChainTrie) HashValue() ([]byte, error)
- func (c *ChainTrie) IsInUsingDataNode(nid common.NodeID) (common.ChainID, bool)
- func (c *ChainTrie) IsNoGas(chainId common.ChainID) (bool, common.ChainID)
- func (c *ChainTrie) PreCommit() ([]byte, error)
- func (c *ChainTrie) PutInfo(info *common.ChainInfos) error
- func (c *ChainTrie) RangeAllInfos(oneInfosCallback func(oneInfos *common.ChainInfos))
- func (c *ChainTrie) Rebase(dbase db.Database) (*ChainTrie, error)
- func (c *ChainTrie) RevertTo(checkpoint int, root []byte) error
- func (c *ChainTrie) Rollback()
- func (c *ChainTrie) SetTo(newTrie *trie.Trie) error
- func (c *ChainTrie) String() string
- type ChangeChainInfoRequest
- func (s *ChangeChainInfoRequest) DataDeserialize(vr rtl.ValueReader) error
- func (s *ChangeChainInfoRequest) DataSerialize(w io.Writer) error
- func (s *ChangeChainInfoRequest) Deserialization(r io.Reader) (shouldBeNil bool, err error)
- func (s *ChangeChainInfoRequest) GetData() (o interface{}, exist bool)
- func (s *ChangeChainInfoRequest) GetPubs() [][]byte
- func (s *ChangeChainInfoRequest) GetSigs() [][]byte
- func (s *ChangeChainInfoRequest) Serialization(w io.Writer) error
- func (s *ChangeChainInfoRequest) SetPubs(pubs [][]byte)
- func (s *ChangeChainInfoRequest) SetSigs(sigs [][]byte)
- func (s *ChangeChainInfoRequest) String() string
- type Cipher
- type CommEntries
- type CommEntry
- type Committee
- func (c *Committee) Add(id common.NodeID)
- func (c *Committee) Clone() *Committee
- func (c *Committee) Compare(o *Committee) int
- func (c *Committee) CopyMembers(committee *Committee)
- func (c *Committee) Equal(o *Committee) bool
- func (c *Committee) FromPublicKeys(pks [][]byte) (*Committee, error)
- func (c *Committee) FullString() string
- func (c *Committee) Hash() common.Hash
- func (c *Committee) Index(id common.NodeID) common.CommID
- func (c *Committee) InfoString(level common.IndentLevel) string
- func (c *Committee) IsAvailable() bool
- func (c *Committee) IsIn(id common.NodeID) bool
- func (c *Committee) IsProposor(id common.NodeID, num common.BlockNum) bool
- func (c *Committee) ProposerAt(num common.BlockNum) common.NodeID
- func (c *Committee) PublicKeys() [][]byte
- func (c *Committee) ReachRequires(ok int) bool
- func (c *Committee) Reset()
- func (c *Committee) SetMembers(ids common.NodeIDs) *Committee
- func (c *Committee) Size() int
- func (c *Committee) String() string
- type CommitteeIndex
- type CompatibleDelta
- type ConfirmedInfo
- func (c *ConfirmedInfo) CanProofHob() bool
- func (c *ConfirmedInfo) Clone() *ConfirmedInfo
- func (c *ConfirmedInfo) CommConfirmed() bool
- func (c *ConfirmedInfo) Compare(o *ConfirmedInfo) int
- func (c *ConfirmedInfo) Copy() *ConfirmedInfo
- func (c *ConfirmedInfo) GetHeight() common.Height
- func (c *ConfirmedInfo) GetLastConfirmedBy() common.Height
- func (c *ConfirmedInfo) HashValue() ([]byte, error)
- func (c *ConfirmedInfo) InfoString(level common.IndentLevel) string
- func (c *ConfirmedInfo) ProofHob() (*trie.NodeProof, error)
- func (c *ConfirmedInfo) ShouldRestart(current common.Height) bool
- func (c *ConfirmedInfo) String() string
- func (c *ConfirmedInfo) UnConfirmComm()
- type ConfirmedSummary
- func (s *ConfirmedSummary) ConfirmedChain() common.ChainID
- func (s *ConfirmedSummary) ConfirmedHeight() common.Height
- func (s *ConfirmedSummary) ConfirmedHob() []byte
- func (s *ConfirmedSummary) HeaderProof(proofs *trie.ProofChain) (proofedHob []byte, err error)
- func (s *ConfirmedSummary) MainBlock() *BlockEMessage
- func (s *ConfirmedSummary) MainHeader() *BlockHeader
- func (s *ConfirmedSummary) MainHeight() common.Height
- func (s *ConfirmedSummary) ShortHeaderProof(proofs *trie.ProofChain) error
- func (s *ConfirmedSummary) String() string
- type Confirmer
- type ConfirmingProof
- type ConsNodeRewardExtra
- type ConsensusContext
- func (ctx *ConsensusContext) RealTime() bool
- func (ctx *ConsensusContext) Restoring() bool
- func (ctx *ConsensusContext) SetCommitting() *ConsensusContext
- func (ctx *ConsensusContext) SetPreparing() *ConsensusContext
- func (ctx *ConsensusContext) SetProposing() *ConsensusContext
- func (ctx *ConsensusContext) String() string
- type ConsensusStage
- type ContractLogger
- type CreateResult
- type DSError
- type DataNodeRewardExtra
- type DataRequester
- type DelegateResult
- type DeltaFrom
- type DeltaFromKey
- type DeltaFroms
- type DeltaRequestMessage
- type DeltasGroup
- type DeltasPack
- type DepositResult
- type DynamicFeeTx
- type EIP155Signer
- func (s EIP155Signer) Equal(s2 Signer) bool
- func (s EIP155Signer) Hash(tx *ETHTransaction) common.Hash
- func (s EIP155Signer) HashGtkm(tx *Transaction) common.Hash
- func (s EIP155Signer) HashGtkmWithSig(tx *Transaction) common.Hash
- func (s EIP155Signer) RecoverSigAndPub(tx *ETHTransaction) (sig, pub []byte, err error)
- func (s EIP155Signer) Sender(tx *ETHTransaction) (common.Address, error)
- func (s EIP155Signer) SignatureValues(ethChainid *big.Int, txType byte, sig []byte) (R, S, V *big.Int, err error)
- type ETHTransaction
- func (tx *ETHTransaction) AccessList() AccessList
- func (tx *ETHTransaction) ChainId() *big.Int
- func (tx *ETHTransaction) Data() []byte
- func (tx *ETHTransaction) From() *common.Address
- func (tx *ETHTransaction) Gas() uint64
- func (tx *ETHTransaction) GasFeeCap() *big.Int
- func (tx *ETHTransaction) GasPrice() *big.Int
- func (tx *ETHTransaction) GasTipCap() *big.Int
- func (tx *ETHTransaction) GetSigner() Signer
- func (tx *ETHTransaction) HasSignatureValues() (v, r, s *big.Int, exist bool)
- func (tx *ETHTransaction) Hash() common.Hash
- func (tx *ETHTransaction) HashValue() ([]byte, error)
- func (tx *ETHTransaction) MarshalBinary() ([]byte, error)
- func (tx *ETHTransaction) Nonce() uint64
- func (tx *ETHTransaction) Protected() bool
- func (tx *ETHTransaction) RawSignatureValues() (v, r, s *big.Int)
- func (tx *ETHTransaction) To() *common.Address
- func (tx *ETHTransaction) ToTransaction() (*Transaction, error)
- func (tx *ETHTransaction) Type() uint8
- func (tx *ETHTransaction) UnmarshalBinary(b []byte) error
- func (tx *ETHTransaction) Value() *big.Int
- type ElectMessage
- type ElectMessages
- type ElectResult
- func (r *ElectResult) FromResulter(resulter ElectResulter) *ElectResult
- func (r *ElectResult) GetChainID() common.ChainID
- func (r *ElectResult) GetElectingChainID() common.ChainID
- func (r *ElectResult) GetEpochNum() common.EpochNum
- func (r *ElectResult) GetNodeID() common.NodeID
- func (r *ElectResult) GetRRProof() *RRProofs
- func (r *ElectResult) GetVrfResult() (*common.Hash, []byte, *common.Hash, uint32)
- func (r *ElectResult) IsPreElecting() bool
- func (r *ElectResult) String() string
- type ElectResulter
- type ElectResults
- type ElectingName
- type EpochAllCommittee
- func (c *EpochAllCommittee) AddReComm(start, elected common.Height, comm *Committee) (changed bool, err error)
- func (c *EpochAllCommittee) AppendReComm(start common.Height, elected common.Height, comm *Committee) error
- func (c *EpochAllCommittee) Clone() *EpochAllCommittee
- func (c *EpochAllCommittee) CommAt(height common.Height) (*Committee, error)
- func (c *EpochAllCommittee) CommGetAndCompare(last, current common.Height) (comm *Committee, changed bool, err error)
- func (c *EpochAllCommittee) Compare(o *EpochAllCommittee) int
- func (c *EpochAllCommittee) Equal(o *EpochAllCommittee) bool
- func (c *EpochAllCommittee) FirstComm() *Committee
- func (c *EpochAllCommittee) From(ec *EpochCommittee) *EpochAllCommittee
- func (c *EpochAllCommittee) InfoString(level common.IndentLevel) string
- func (c *EpochAllCommittee) IsAvailable() bool
- func (c *EpochAllCommittee) LastComm() (startAt common.Height, comm *Committee)
- func (c *EpochAllCommittee) String() string
- func (c *EpochAllCommittee) ToNormalComm() *EpochCommittee
- type EpochCommittee
- func (c *EpochCommittee) Clone() *EpochCommittee
- func (c *EpochCommittee) Comm() *Committee
- func (c *EpochCommittee) Equal(o *EpochCommittee) bool
- func (c *EpochCommittee) Hash(blockVersion uint16) common.Hash
- func (c *EpochCommittee) InfoString(level common.IndentLevel) string
- func (c *EpochCommittee) IsAvailable() bool
- func (c *EpochCommittee) IsEmpty() bool
- func (c *EpochCommittee) String() string
- type Extra
- type FrontierSigner
- func (f FrontierSigner) ChainID() *big.Int
- func (f FrontierSigner) Equal(s2 Signer) bool
- func (f FrontierSigner) Hash(tx *ETHTransaction) common.Hash
- func (f FrontierSigner) HashGtkm(tx *Transaction) common.Hash
- func (f FrontierSigner) HashGtkmWithSig(tx *Transaction) common.Hash
- func (f FrontierSigner) RecoverSig(tx *ETHTransaction) (sig []byte)
- func (f FrontierSigner) RecoverSigAndPub(tx *ETHTransaction) (sig, pub []byte, err error)
- func (f FrontierSigner) Sender(tx *ETHTransaction) (common.Address, error)
- func (f FrontierSigner) SignatureValues(ethChainid *big.Int, txType byte, sig []byte) (r, s, v *big.Int, err error)
- type GasExtra
- type HdsSummary
- func (s *HdsSummary) ConfirmedChain() common.ChainID
- func (s *HdsSummary) ConfirmedHeight() common.Height
- func (s *HdsSummary) ConfirmedHob() []byte
- func (s *HdsSummary) HeaderProof(proofChain *trie.ProofChain) (proofedHob []byte, err error)
- func (s *HdsSummary) MainBlock() *BlockEMessage
- func (s *HdsSummary) MainHeader() *BlockHeader
- func (s *HdsSummary) MainHeight() common.Height
- func (s *HdsSummary) ShortHeaderProof(proofChain *trie.ProofChain) error
- func (s *HdsSummary) String() string
- type HisTree
- type HistoryBlock
- type HistoryProof
- type HomesteadSigner
- func (h HomesteadSigner) ChainID() *big.Int
- func (h HomesteadSigner) Equal(s2 Signer) bool
- func (h HomesteadSigner) RecoverSigAndPub(tx *ETHTransaction) (sig, pub []byte, err error)
- func (h HomesteadSigner) Sender(tx *ETHTransaction) (common.Address, error)
- func (h HomesteadSigner) SignatureValues(ethChainid *big.Int, txType byte, sig []byte) (r, s, v *big.Int, err error)
- type KeccakState
- type LegacyTx
- type Log
- type Logs
- type MChainBootNode
- type MChainBootNodeShouldBe
- type MChainCommInput
- type MChainDataNodeShouldBe
- type MChainInfoInput
- type MChainInfoInputShouldBe
- type MChainInfoOutput
- type MChainInfoOutputShouldBe
- type MaliciousError
- type MaliciousType
- type MappingType
- type MissingHeights
- func (m MissingHeights) Get(id common.ChainID) (start common.Height, length int, exist bool)
- func (m MissingHeights) IDs() common.ChainIDs
- func (m MissingHeights) MostUrgent() (id common.ChainID, start common.Height, length int, exist bool)
- func (m MissingHeights) Put(id common.ChainID, start common.Height, length int)
- type NodeAddresses
- type NodeAddressesList
- type NodeResult
- func (n *NodeResult) Clone() *NodeResult
- func (n *NodeResult) Equal(o *NodeResult) bool
- func (n *NodeResult) FromVrfResulter(resulter VrfResulter) *NodeResult
- func (n *NodeResult) GetNodeID() common.NodeID
- func (n *NodeResult) GetRRProof() *RRProofs
- func (n *NodeResult) GetVrfResult() (sorthash *common.Hash, proof []byte, factorHash *common.Hash, randNum uint32)
- func (n *NodeResult) String() string
- type NodeResults
- func (ns NodeResults) AgreeWith(os NodeResults) error
- func (ns NodeResults) Clone() NodeResults
- func (ns NodeResults) Equal(os NodeResults) bool
- func (ns NodeResults) Len() int
- func (ns NodeResults) Less(i, j int) bool
- func (ns NodeResults) ManagedCommVerifyAll(nidHashes []common.Hash) error
- func (ns NodeResults) Remove(os NodeResults) NodeResults
- func (ns NodeResults) Swap(i, j int)
- func (ns NodeResults) ToMap() map[common.NodeID]*NodeResult
- type NodeState
- type OneDeltas
- type POSInfo
- type PbftBlockNum
- type PenalizeResult
- type PenaltySet
- type PenaltySets
- type PostState
- type PreElectPhase
- type PreElecting
- func (pe *PreElecting) Clone() *PreElecting
- func (pe *PreElecting) Equal(o *PreElecting) bool
- func (pe *PreElecting) HashValue() ([]byte, error)
- func (pe *PreElecting) IsManagedComm() bool
- func (pe *PreElecting) IsRestarting() bool
- func (pe *PreElecting) IsValidManagedComm() bool
- func (pe *PreElecting) IsVrf() bool
- func (pe *PreElecting) PreSeed() (*common.Seed, error)
- func (pe *PreElecting) RestartSeed() (*common.Seed, error)
- func (pe *PreElecting) RestartingPart() RestartingPart
- func (pe *PreElecting) String() string
- func (pe *PreElecting) ToPack() *PreElecting
- func (pe *PreElecting) TypeString() string
- func (pe *PreElecting) VrfSeed() (vrfseed *common.Seed, isRestarting bool, err error)
- type PreElectings
- func (p PreElectings) Equal(o PreElectings) bool
- func (p PreElectings) HashValue() ([]byte, error)
- func (p PreElectings) InfoString(level common.IndentLevel) string
- func (p PreElectings) Len() int
- func (p PreElectings) Less(i, j int) bool
- func (p PreElectings) String() string
- func (p PreElectings) Swap(i, j int)
- type PreelectionConnect
- type PreelectionExamine
- type PreelectionExit
- type PreelectionPrepare
- type PreelectionStart
- type PreelectionSync
- type PubAndSig
- func (p *PubAndSig) Clone() *PubAndSig
- func (p *PubAndSig) Compare(o *PubAndSig) int
- func (p *PubAndSig) Equal(o *PubAndSig) bool
- func (p *PubAndSig) Equals(v interface{}) bool
- func (p *PubAndSig) FullString() string
- func (p *PubAndSig) GetPublicKey(hashOfMsg []byte) ([]byte, error)
- func (p *PubAndSig) InfoString(_ common.IndentLevel) string
- func (p *PubAndSig) IsValid() bool
- func (p *PubAndSig) Key() []byte
- func (p *PubAndSig) Signer(hashOfMsg []byte) (common.NodeID, error)
- func (p *PubAndSig) String() string
- func (p *PubAndSig) VerifiedNodeID(hashOfMsg []byte) (common.NodeID, error)
- func (p *PubAndSig) Verify(hashOfMsg []byte) (pubKey []byte, err error)
- type PubAndSigs
- func (ps PubAndSigs) Clone() PubAndSigs
- func (ps PubAndSigs) Equal(os PubAndSigs) bool
- func (ps PubAndSigs) Equals(o interface{}) bool
- func (ps PubAndSigs) FromPubsAndSigs(pubs, sigs [][]byte) (PubAndSigs, error)
- func (ps PubAndSigs) InfoString(level common.IndentLevel) string
- func (ps PubAndSigs) Len() int
- func (ps PubAndSigs) Less(i, j int) bool
- func (ps PubAndSigs) Merge(os PubAndSigs) PubAndSigs
- func (ps PubAndSigs) Swap(i, j int)
- func (ps PubAndSigs) Verify(h []byte) (int, error)
- func (ps PubAndSigs) VerifyByComm(comm *Committee, h []byte) error
- func (ps PubAndSigs) VerifyByNodeIDs(nids common.NodeIDs, hashOfObject []byte, sizeChecker func(int) error) (PubAndSigs, error)
- func (ps PubAndSigs) VerifyByPubs(pks [][]byte, hashOfObject []byte, sizeChecker func(int) error) (PubAndSigs, error)
- type RRAType
- type RRAct
- func (a *RRAct) Clone() *RRAct
- func (a *RRAct) Copy() *RRAct
- func (a *RRAct) FailedResult(err error) *ActFailedResult
- func (a *RRAct) IsValid() bool
- func (a *RRAct) Serialization(w io.Writer) error
- func (a *RRAct) String() string
- func (a *RRAct) ToUnDelegating() *UnDelegating
- func (a *RRAct) ToWithdrawing() *Withdrawing
- func (a *RRAct) WithdrawAll() bool
- type RRActReceipt
- type RRActReceipts
- type RRActs
- func (s RRActs) Clone() RRActs
- func (s RRActs) Delegating(delegated *big.Int) *big.Int
- func (s RRActs) Depositing(amount *big.Int) *big.Int
- func (s RRActs) FailedResults(err error) RRActReceipts
- func (s RRActs) Filter(typs ...RRAType) RRActs
- func (s RRActs) InfoString(indentLevel common.IndentLevel) string
- func (s RRActs) Len() int
- func (s RRActs) Less(i, j int) bool
- func (s RRActs) Swap(i, j int)
- type RRC
- type RRInfo
- func (r *RRInfo) Available() bool
- func (r *RRInfo) AvailableAmount() *big.Int
- func (r *RRInfo) Clone() *RRInfo
- func (r *RRInfo) Compatible(nodeIdHash common.Hash, _ common.NodeType, _ common.Address) bool
- func (r *RRInfo) Copy() *RRInfo
- func (r *RRInfo) Depositing() *big.Int
- func (r *RRInfo) Equal(o *RRInfo) bool
- func (r *RRInfo) HashValue() ([]byte, error)
- func (r *RRInfo) InfoEquals(v *RRInfo) bool
- func (r *RRInfo) InfoString(indentLevel common.IndentLevel) string
- func (r *RRInfo) IsGenesis() (bool, common.NodeType)
- func (r *RRInfo) Key() []byte
- func (r *RRInfo) ShouldRemove() bool
- func (r *RRInfo) String() string
- func (r *RRInfo) Summary() string
- func (r *RRInfo) ValidAmount() *big.Int
- func (r *RRInfo) ValidDelegated() *big.Int
- type RRProofs
- func (p *RRProofs) Clone() *RRProofs
- func (p *RRProofs) Equal(o *RRProofs) bool
- func (p *RRProofs) InfoString(level common.IndentLevel) string
- func (p *RRProofs) IsValid() bool
- func (p *RRProofs) PrintString() string
- func (p *RRProofs) String() string
- func (p *RRProofs) VerifyProof(nodeIdHash common.Hash, root common.Hash) error
- type RRProofsMessage
- type RRProofsRequest
- type RRReceiptIndex
- type RRStatus
- type RRStatusAct
- type RRSyncData
- type RebootMainChainMessage
- type RebootedComm
- type Receipt
- func (r *Receipt) Clone() *Receipt
- func (r *Receipt) Err() error
- func (r *Receipt) GasFeeString() string
- func (r *Receipt) GetPostRoot() []byte
- func (r *Receipt) HashValue() ([]byte, error)
- func (r *Receipt) InfoString(level common.IndentLevel) string
- func (r *Receipt) Revert() []byte
- func (r *Receipt) String() string
- func (r *Receipt) Success() bool
- type Receipts
- type RestartComm
- func (r *RestartComm) Clone() *RestartComm
- func (r *RestartComm) CmpOrder(o *RestartComm) int
- func (r *RestartComm) Compare(o *RestartComm) int
- func (r *RestartComm) HeightString() string
- func (r *RestartComm) InfoString(level common.IndentLevel) string
- func (r *RestartComm) IsValid() bool
- func (r *RestartComm) String() string
- func (r *RestartComm) Summary() string
- type RestartCommEMessage
- type RestartComms
- func (rs RestartComms) Clone() RestartComms
- func (rs RestartComms) Compare(os RestartComms) int
- func (rs RestartComms) Len() int
- func (rs RestartComms) Less(i, j int) bool
- func (rs RestartComms) LocateBy(height common.Height) (*RestartComm, error)
- func (rs RestartComms) Summary() string
- func (rs RestartComms) Swap(i, j int)
- type RestartHistories
- func (hs RestartHistories) Clone() RestartHistories
- func (hs RestartHistories) Compare(os RestartHistories) int
- func (hs RestartHistories) JustBefore(height common.Height) *RestartHistory
- func (hs RestartHistories) Len() int
- func (hs RestartHistories) Less(i, j int) bool
- func (hs RestartHistories) Summary() string
- func (hs RestartHistories) Swap(i, j int)
- type RestartHistory
- func (h *RestartHistory) Clone() *RestartHistory
- func (h *RestartHistory) Compare(o *RestartHistory) int
- func (h *RestartHistory) HeightCompare(o *RestartHistory) int
- func (h *RestartHistory) InfoString(level common.IndentLevel) string
- func (h *RestartHistory) Key() []byte
- func (h *RestartHistory) StartHeight() common.Height
- func (h *RestartHistory) String() string
- func (h *RestartHistory) Summary() string
- type RestartedComm
- type RestartingPart
- type RewardAndRedemptionTxFilter
- type RewardRequest
- func (a *RewardRequest) AuditResult() (countMap map[common.NodeID]int, penaltyMap map[common.NodeID]common.ChainID, ...)
- func (a *RewardRequest) CheckFields() error
- func (a *RewardRequest) Clone() *RewardRequest
- func (a *RewardRequest) DestChainID() common.ChainID
- func (a *RewardRequest) Formalize()
- func (a *RewardRequest) GetChainID() common.ChainID
- func (a *RewardRequest) Hash() common.Hash
- func (a *RewardRequest) HashValue() ([]byte, error)
- func (a *RewardRequest) InfoString(level common.IndentLevel) string
- func (a *RewardRequest) IsValid() bool
- func (a *RewardRequest) String() string
- func (a *RewardRequest) Verify(proofedHash common.Hash) error
- type RewardRequests
- func (rs RewardRequests) InfoString(level common.IndentLevel) string
- func (rs RewardRequests) LastRewardEpochs() map[common.ChainID]common.EpochNum
- func (rs RewardRequests) Len() int
- func (rs RewardRequests) Less(i, j int) bool
- func (rs RewardRequests) String() string
- func (rs RewardRequests) Swap(i, j int)
- type RewardType
- type RpcFilter
- type ScErcInfo
- type SeedFactor
- type SetChainSettingRequest
- func (s *SetChainSettingRequest) DataDeserialize(vr rtl.ValueReader) error
- func (s *SetChainSettingRequest) DataSerialize(w io.Writer) error
- func (s *SetChainSettingRequest) Deserialization(r io.Reader) (shouldBeNil bool, err error)
- func (s *SetChainSettingRequest) GetData() (o interface{}, exist bool)
- func (s *SetChainSettingRequest) GetPubs() [][]byte
- func (s *SetChainSettingRequest) GetSigs() [][]byte
- func (s *SetChainSettingRequest) Serialization(w io.Writer) error
- func (s *SetChainSettingRequest) SetPubs(pubs [][]byte)
- func (s *SetChainSettingRequest) SetSigs(sigs [][]byte)
- func (s *SetChainSettingRequest) String() string
- type ShardDeltaMessage
- type ShardTransaction
- type ShardWaterline
- type Signer
- type SigsAndPubs
- type StatusResult
- type StorageSize
- type TXIndex
- type TkmTx
- type TokenType
- type Transaction
- func MakeTx(chainid common.ChainID, from, to *common.Address, nonce uint64, val *big.Int, ...) (*Transaction, error)
- func NewNormalTx(chainid common.ChainID, from, to *common.Address, nonce uint64, val *big.Int, ...) *Transaction
- func NewTx(chainid common.ChainID, from, to *common.Address, nonce uint64, uselocal bool, ...) *Transaction
- func (tx *Transaction) AccessList() AccessList
- func (tx *Transaction) Clone() *Transaction
- func (tx Transaction) DeprecatedHash() ([]byte, error)
- func (tx *Transaction) ETHChainID() *big.Int
- func (tx *Transaction) ETHTxType() byte
- func (tx *Transaction) Equal(o *Transaction) bool
- func (tx *Transaction) ExtraKeys() (extra *Extra)
- func (tx *Transaction) ForwardTimes() (times int, innerTx *Transaction)
- func (tx Transaction) FullString() string
- func (tx *Transaction) Gas() uint64
- func (tx *Transaction) GasFeeCap() *big.Int
- func (tx *Transaction) GasPrice() *big.Int
- func (tx *Transaction) GasTipCap() *big.Int
- func (tx Transaction) GetChainID() common.ChainID
- func (tx *Transaction) GetSignature() (*PubAndSig, error)
- func (tx *Transaction) GetTkmExtra() []byte
- func (tx *Transaction) HasSig() bool
- func (tx *Transaction) Hash() common.Hash
- func (tx Transaction) HashValue() ([]byte, error)
- func (tx *Transaction) InfoString(level common.IndentLevel) string
- func (tx *Transaction) IsLegalIncomingTx(expectingChainId common.ChainID) error
- func (tx *Transaction) IsLegalVmTx(expectingChainId common.ChainID) error
- func (tx *Transaction) MultiSign(privs ...[]byte) error
- func (tx *Transaction) RawSignatureValues() (v, r, s *big.Int)
- func (tx *Transaction) SetExtraKeys(extras *Extra) error
- func (tx *Transaction) SetSignatureValues(V, R, S *big.Int) error
- func (tx *Transaction) SetTkmExtra(extra []byte) error
- func (tx *Transaction) Sign(priv []byte) error
- func (tx Transaction) String() string
- func (tx *Transaction) Summary() string
- func (tx *Transaction) ToETH(sig []byte) (*ETHTransaction, error)
- func (tx *Transaction) VerifySig(pas *PubAndSig) error
- type TxData
- type TxFilter
- type TxFinalProof
- type TxParam
- type TxParams
- func (p *TxParams) Append(param *TxParam) error
- func (p *TxParams) AppendBytes(param []byte)
- func (p *TxParams) AppendSlice(params [][]byte, size int) error
- func (p *TxParams) Appends(tps *TxParams)
- func (p *TxParams) Clone() *TxParams
- func (p *TxParams) Equal(o *TxParams) bool
- func (p *TxParams) GetParam(at int) []byte
- func (p *TxParams) GetTxParam(at int) (*TxParam, error)
- func (p *TxParams) IsEmpty() bool
- func (p *TxParams) MustSlice() [][]byte
- func (p *TxParams) Slice(i int, js ...int) *TxParams
- func (p *TxParams) String() string
- func (p *TxParams) ToSlice() [][]byte
- type Txs
- type UnDelegateResult
- type UnDelegating
- func (u *UnDelegating) Clone() *UnDelegating
- func (u *UnDelegating) Compare(o *UnDelegating) int
- func (u *UnDelegating) Equal(o *UnDelegating) bool
- func (u *UnDelegating) ExpireEra() common.EraNum
- func (u *UnDelegating) Expired(era common.EraNum) bool
- func (u *UnDelegating) IsValid() bool
- func (u *UnDelegating) String() string
- type UnDelegatings
- func (us UnDelegatings) Add(txHash common.Hash, ud *UnDelegating) (rs UnDelegatings, changed bool, result *UnDelegateResult, err error)
- func (us UnDelegatings) AddAct(act *RRAct) (rs UnDelegatings, changed bool, result *UnDelegateResult, err error)
- func (us UnDelegatings) All() *big.Int
- func (us UnDelegatings) Clone() UnDelegatings
- func (us UnDelegatings) Copy() UnDelegatings
- func (us UnDelegatings) Equal(os UnDelegatings) bool
- func (us UnDelegatings) InfoString(level common.IndentLevel) string
- func (us UnDelegatings) Len() int
- func (us UnDelegatings) Less(i, j int) bool
- func (us UnDelegatings) String() string
- func (us UnDelegatings) Swap(i, j int)
- type VrfResulter
- type Waterlines
- type WithdrawResult
- type Withdrawing
- func (w *Withdrawing) Clone() *Withdrawing
- func (w *Withdrawing) Compare(o *Withdrawing) int
- func (w *Withdrawing) Equal(o *Withdrawing) bool
- func (w *Withdrawing) ExpireEra() common.EraNum
- func (w *Withdrawing) Expired(era common.EraNum) bool
- func (w *Withdrawing) IsValid() bool
- func (w *Withdrawing) String() string
- func (w *Withdrawing) WithdrawingAll() bool
- type Withdrawings
- func (ws Withdrawings) Add(act *RRAct) (rs Withdrawings, changed bool, result *WithdrawResult, err error)
- func (ws Withdrawings) After(era common.EraNum) (after Withdrawings, removed int)
- func (ws Withdrawings) All() (withdrawing *big.Int, withdrawingAll bool)
- func (ws Withdrawings) Clone() Withdrawings
- func (ws Withdrawings) Copy() Withdrawings
- func (ws Withdrawings) Equal(os Withdrawings) bool
- func (ws Withdrawings) GetWithdrawing(expireEra common.EraNum) *Withdrawing
- func (ws Withdrawings) HasWithdrawingAll() (int, bool)
- func (ws Withdrawings) InfoString(level common.IndentLevel) string
- func (ws Withdrawings) Len() int
- func (ws Withdrawings) Less(i, j int) bool
- func (ws Withdrawings) String() string
- func (ws Withdrawings) Swap(i, j int)
Constants ¶
const ( // testing constant AccountNum = 100 InitAccountVal = 100000000 )
const ( MinimumCommSize = 4 // when a sub-chain has not been confirmed for N>=ChainStoppedThreshold consecutive blocks // on the main chain, it is considered that the sub-chain has stopped. ChainStoppedThreshold = 1000 )
const ( BHPreviousHash = 0 BHHashHistory = 1 BHChainID = 2 BHHeight = 3 BHEmpty = 4 BHParentHeight = 5 BHParentHash = 6 BHRewardAddress = 7 BHCommitteeHash = 8 BHElectedNextRoot = 9 BHNewCommitteeSeed = 10 BHMergedDeltaRoot = 11 BHBalanceDeltaRoot = 12 BHStateRoot = 13 BHChainInfoRoot = 14 BHWaterlinesRoot = 15 BHVCCRoot = 16 BHCashedRoot = 17 BHTransactionRoot = 18 BHReceiptRoot = 19 BHHdsRoot = 20 BHTimeStamp = 21 BHAttendanceHash = 22 BHRewardedCursor = 23 BHRREra = 24 BHRRRoot = 25 BHRRNextRoot = 26 BHRRChangingRoot = 27 BHElectResultRoot = 28 BHPreElectedRoot = 29 BHFactorRoot = 30 BHRRReceiptRoot = 31 BHVersion = 32 BHConfirmedRoot = 33 BHRewardedEra = 34 BHBridgeRoot = 35 BHRandomHash = 36 BHSeedGenerated = 37 BHTxParams = 38 BHSize = 39 )
const ( BridgeInfoCreate = "createMap" BridgeInfoRemove = "removeMap" BridgeInfoList = "listMappingsOf" BridgeInfoGet = "getMappingInfoTo" )
const ( // no version ConfirmedV0 = 0 // merkle hash ConfirmedV1 = 1 ConfirmedVersion = ConfirmedV1 )
const ( MTDoubleSign = MaliciousType(401) // signing for different blocks at the same height in the same chain MTDoubleAuditing = MaliciousType(501) // double sign Audited and Revealed for the same block MTOneBlockMultiAuditing = MaliciousType(502) // Audited different blocks at the same height in the same chain )
const ( TxVersion0 = 0 // compatible with Ethereum's transaction hash, pay attention to the tx.Hash() and tx.HashValue() // methods when upgrading the version ETHHashTxVersion = 2 NewBaseChainTxVersion = 3 ETHConvertVersion = 4 // 1: There is a bug in V0, which leads to insufficient amount when creating or invoking the // contract, and the transaction will be packaged, but the nonce value does not increase // 2: ETH compatible, add base chain id for conversion to ETH chainid // 3: update base chain id from 100007 to 70000 // 4: convert Transaction to ETHTransaction with correct TxType even if there is no TxType in Extras // DyanamicFeeTx: if GasTipCap or GasFeeCap not nil, or // AccessListTxType: if AccessList it not nil, or // LegacyTxType: else TxVersion = ETHConvertVersion // V0's BlockSummary.Hash Only a through transmission of BlockHash, can't reflect the location // information of the block, and can't complete the proof of cross chain. V1 adds chainid and // height to hash SummaryVersion0 = 0 // original version SummaryVersion1 = 1 // add chainid and height to hash SummaryVersion2 = 2 // add HistoryProof and AuditorPass for auditing, use Header instead of chainid+height+BlockHash SummaryVersion3 = 3 // HashValue changes SummaryVersion4 = 4 // rollback to original version (ChainID+Height+HoB+Comm) SummaryVersion5 = 5 // use HistoryProof to proof NextComm.Hash() -> BlockHash, if NextComm exists SummaryVersion = SummaryVersion5 // RRInfoVersion: // 1: NodeCount // 2: statue // 3: newpos (Avail, Voted, VotedAmount, Settles) // 4: PoSv3 (Voted/VotedAmount removed, add Delegated) RRInfoVersion = 4 RRInfoVNewPos = 3 // RRActVersion: 1: Account RRActVersion = 1 // BlockHeader version // 1: add RRReceiptRoot reserved for v2.11.0 // make merkle trie root with all properties in the object // make receipt root as merkle trie hash of receipts // Calculate blockHeader.TransactionRoot using transaction hash value with signature // modify the calculation method of ElectedNextRoot // 2: since v2.11.03, add ConfirmedRoot // 3: since v2.12.0, add RewardedEra // 4: since v3.1.0, placeholder in v2.14.2, add BridgeRoot // 5: since v3.2.0, placeholder in v2.14.2, add Random // 6: since v3.2.1, placeholder in v2.14.2, new strategy of generating seed (Header.FactorRoot=Sign(Body.SeedFactor), NewCommitteeSeed=Header.FactorRoot[:SeedLength]|BlockNum>=SeedBlock) // 7: since v2.14.2, parameters generated by proposer for transactions: TxParams // 8: since v2.14.4, all integer fields use the hash value of uint64 big-endian serialized bytes (for the convenience of solidity) BlockVersionV0 = 0 BlockVersionV1 = 1 BlockVersionV2 = 2 BlockVersionV3 = 3 BlockVersionV4 = 4 BlockVersionV5 = 5 BlockVersionV6 = 6 BlockVersionV7 = 7 BlockVersionV8 = 8 BlockVersion = BlockVersionV8 // RewardReqeust version // 1: add SubProof/MainProof/ProofedHeight/Version RewardReqV0 = 0 RewardReqV1 = 1 RewardReqVersion = RewardReqV1 ReceiptV0 = 0 ReceiptV1 = 1 // use RLP to serialize the Receipt object ReceiptV2 = 2 // use the merkle root of Logs to calculate the hash value of Receipt ReceiptVersion = ReceiptV2 )
const ( DefaultMinConsensusRR = 10000 // Lower limit of consensus node pledges, (202012: from 50000->10000) DefaultMaxConsensusRR = 10000 // The consensus node pledges is calculated at most according to this,(202012: from 50000->10000) DefaultMinDataRR = 50000 // Lower limit of data node pledges, (202012: from 200000->50000) DefaultMaxDataRR = 500000 // The data node pledges is calculated at most according to this, (202012: from 200000->50000, 202201: -> 500000) )
const ( LengthOfSignature = 65 LengthOfPublicKey = 65 LengthOfPrivateKey = 32 )
const ( LegacyTxType = iota AccessListTxType DynamicFeeTxType )
const ( TxTypeMax = 0x7f TkmTxType = 0x7f )
const ( Posv3ReportName = "report" Posv3AuditedName = "reportWithAudit" Posv3AwardName = "award" Posv3WithdrawName = "withdrawnDeposit" Posv3UnDelegateName = "delegationRevoked" )
const ( ENRestarting = ElectingName("RESTARTING") ENCommitRestarting = ElectingName("CO-RESTARTING") ENPreelect = ElectingName("PREELECT") ENPreOrRestart = ElectingName("PREELECT/RESTARTING") ENNormalVrf = ElectingName("NORMALVRF") ENSyncRestart = ElectingName("SYNC-RESTART") ENReboot = ElectingName("REBOOT") ENCommitReboot = ElectingName("CO-REBOOT") ENUnknown = ElectingName("UNKNOWN") )
const ( // ReceiptStatusFailed is the status code of a transaction if execution failed. ReceiptStatusFailed = 0 // ReceiptStatusSuccessful is the status code of a transaction if execution succeeded. ReceiptStatusSuccessful = 1 )
const ( BridgeTransERC20 = "transferERC20" BridgeTransERC721 = "transferERC721" BridgeTransERC1155 = "transferERC1155" BridgeBurnERC20 = "burnERC20" BridgeBurnERC721 = "burnERC721" BridgeBurnERC1155 = "burnERC1155" BridgeWithdraw = "withdraw" BridgeProcessReq20 = "processERC20Req" BridgeProcessReq721 = "processERC721Req" BridgeProcessReq1155 = "processERC1155Req" BridgeProcessFailed = "processFailed" BridgeUpdateReq = "updateReqStatus" BridgeRemoveReqs = "removeProcessedReqs" BridgeRemoveResps = "removeProcessedResps" BridgeOnERC721 = "onERC721Received" BridgeOnERC1155 = "onERC1155Received" // TKM Bridge ERC20 TBE20Transfer = "transfer" TBE20TransFrom = "transferFrom" TBE20Mint = "sysBridgeMint" TBE20BurnFrom = "sysBridgeBurn" // TKM Bridge ERC721 TBE721TransFrom = "safeTransferFrom" TBE721Claim = "sysBridgeClaim" TBE721Burn = "sysBridgeBurn" // TKM Bridge ERC1155 TBE1155TransFrom = "safeTransferFrom" TBE1155Mint = "sysBridgeMint" TBE1155Burn = "sysBridgeBurn" )
const ( MChainCreateChain = "createChain" MChainRemoveChain = "removeChain" MChainStartChain = "startChain" MChainGetInfo = "getChainInfo" MChainAddBootNode = "addBootNode" MChainRemoveBootNode = "removeBootNode" MChainAddDataNode = "addDataNode" MChainRemoveDataNode = "removeDataNode" MChainAddAdmin = "addAdmin" MChainDelAdmin = "delAdmin" MChainSetNoGas = "setNoGas" MChainClrNoGas = "clrNoGas" MChainRestartChain = "restartChain" )
const ( MCommAddNode = "addNodes" MCommDelNode = "delNodes" MCommListNodes = "listNodes" )
const ( CSNameSet = "set" CSNameUnset = "unset" CSNameGet = "get" )
const ( RRMergedToEName = "MergedTo" RRDepositMName = "deposit" RRWithdrawMName = "withdraw" RRWithdrawPartMName = "withdrawPart" RRProofMName = "proof" RRGetInfoMName = "getInfo" RRGetDepositAmountMName = "getDepositAmount" RRGetOngoingAmountMName = "getOngoingAmount" RRSetStatusMName = "setStatus" RRClrStatusMName = "clrStatus" RRDelegateMName = "delegate" RRUnDelegateMName = "undelegate" RRAddPenaltyTypeMName = "addPenaltyType" RRModifyPenaltyTypeMName = "modifyPenaltyType" RRDeletePenaltyTypeMName = "deletePenaltyType" RRGetPenaltyTypeMName = "getPenaltyType" RRPenalizeMName = "penalize" RRPendingPenaltyEName = "PendingPenalty" )
const ( SRRewardDetailName = "RewardDetail" )
const ( UpdateVersionName = "updateVersion" GetVersionName = "getVersion" )
const ( BridgeExtraReqType = 0 BridgeExtraStatusType = 1 BridgeExtraRemoveReqsType = 2 BridgeExtraRemoveRespsType = 3 BridgeExtraReqFailedType = 4 )
const (
AccFlagBanned = iota // account banned
)
const (
ForwarderForwardMName = "forward"
)
const (
MaxGasLimit uint64 = 30000000
)
const (
PenaltyByAuditing uint16 = 0x10
)
const Posv3AbiJson string = `` /* 2404-byte string literal not displayed */
const Push4Op = 0x63
const ( // since v2.14.2, HisProof for the proof from CashRequest.ProofHeight or CancelCashCheckRequest.ConfirmedHeight // to ProposingBlock.Header.ParentHash TxParamV0 = 0 )
const (
WithdrawDelayEras = 2 // Withdraw lags 2 eras
)
Required Reserve related
Variables ¶
var ( TypeOfAccountPtr = reflect.TypeOf((*Account)(nil)) TypeOfAccountDeltaPtr = reflect.TypeOf((*AccountDelta)(nil)) )
var ( // build-in accounts AddressOfChainInfoManage = common.BytesToAddress([]byte{1, 0, 0}) AddressOfManageChains = common.BytesToAddress([]byte{1, 1, 0}) AddressOfChainSettings = common.BytesToAddress([]byte{1, 0, 1}) AddressOfNewChainSettings = common.BytesToAddress([]byte{1, 1, 1}) AddressOfRequiredReserve = common.BytesToAddress([]byte{1, 0, 2}) AddressOfPenalty = common.BytesToAddress([]byte{1, 0, 3}) AddressOfManageCommittee = common.BytesToAddress([]byte{1, 0, 4}) AddressOfUpdateVersion = common.BytesToAddress([]byte{1, 0, 5}) AddressOfBridgeInfo = common.BytesToAddress([]byte{1, 0, 6}) AddressOfForwarder = common.BytesToAddress([]byte{1, 0, 7}) // forward the principal tx to vm by agent tx and all gas paid by agent. NEVER set to NoGas!! AddressOfTronProto = common.BytesToAddress([]byte{1, 0, 8}) AddressOfWriteCashCheck = common.BytesToAddress([]byte{2, 0, 0}) AddressOfCashCashCheck = common.BytesToAddress([]byte{3, 0, 0}) AddressOfCancelCashCheck = common.BytesToAddress([]byte{4, 0, 0}) AddressOfCurrencyExchanger = common.BytesToAddress([]byte{5, 0, 0}) AddressOfLocalCurrencyMinter = common.BytesToAddress([]byte{5, 0, 1}) AddressOfTryPocFrom = common.BytesToAddress([]byte{6, 0, 0}) AddressOfRewardFrom = common.HexToAddress("1111111111111111111111111111111111111111") // reward account AddressOfRewardForGenesis = common.HexToAddress("0x0b70e6f67512bcd07b7d1cbbd04dbbfadfbeaf37") // binding account of genesis nodes AddressOfBlackHole = common.HexToAddress("2222222222222222222222222222222222222222") // melt down currency AddressOfGasReward = AddressOfBlackHole // melt down gas AddressOfSysBridge = common.HexToAddress("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") // bridge )
var ( ErrTxChainNotMatch = errors.New("chain id not match") ErrTxIllegalFrom = errors.New("missing or an illegal from address") ErrTxIllegalValue = errors.New("illegal value") ErrTxIllegalInput = errors.New("value and to address needed when input is empty") ErrTxGasTooLarge = fmt.Errorf("too large gas limit it must be less than %d", MaxGasLimit) ErrTxMainChain = errors.New("system contract call is the only legal tx in main chain") )
var ( TypeOfBridgeInfoPtr = reflect.TypeOf((*BridgeInfo)(nil)) TypeOfBridgeTargetNodePtr = reflect.TypeOf((*BridgeTargetNode)(nil)) TypeOfBridgeReqPtr = reflect.TypeOf((*BridgeReq)(nil)) TypeOfBridgeRespPtr = reflect.TypeOf((*BridgeResp)(nil)) )
var ( TypeOfConfirmedInfoPtr = reflect.TypeOf((*ConfirmedInfo)(nil)) TypeOfRestartHistoryPtr = reflect.TypeOf((*RestartHistory)(nil)) )
var ( DefaultMinConsensusRRBig = new(big.Int).Mul(big.NewInt(DefaultMinConsensusRR), BigTKM) // Pledge threshold for consensus nodes DefaultMaxConsensusRRBig = new(big.Int).Mul(big.NewInt(DefaultMaxConsensusRR), BigTKM) DefaultMinDataRRBig = new(big.Int).Mul(big.NewInt(DefaultMinDataRR), BigTKM) // Pledge threshold for data node DefaultMaxDataRRBig = new(big.Int).Mul(big.NewInt(DefaultMaxDataRR), BigTKM) )
var ( BigShannon = big.NewInt(1000000000) BigTKM = big.NewInt(0).Mul(BigShannon, BigShannon) )
var ( BridgeAbi abi.ABI BridgeErc20Abi abi.ABI BridgeErc721Abi abi.ABI BridgeErc1155Abi abi.ABI )
var ( RRAbi abi.ABI RRMergedToEventSig common.Hash RRPenalizedEventSig common.Hash RRPenalizeID string )
var ( SRAbi abi.ABI SRRewardDetailEventSig common.Hash )
var ( ErrInvalidSig = errors.New("invalid transaction v, r, s values") ErrTxTypeNotSupported = errors.New("transaction type not supported") )
var BridgeInfoAbi abi.ABI
var CSAbi abi.ABI
var (
ErrDuplicatedMsg = errors.New("duplicated message")
)
var ErrExecutionReverted = errors.New("execution reverted")
var ForwarderAbi abi.ABI
var MChainsAbi abi.ABI
var MCommAbi abi.ABI
var PbftBlockNumer func(bn common.BlockNum) PbftBlockNum
var Posv3Abi abi.ABI
var VersionAbi abi.ABI
Functions ¶
func AuditingMessageHash ¶
func AvailableSignatureValues ¶ added in v0.1.2
func BridgeProcessingIdToName ¶ added in v0.4.0
func BridgeReqRespKey ¶ added in v0.4.0
func CheckElectedNextRoot ¶
func CheckElectedNextRootByEpochComm ¶
func CheckElectedNextRootByEpochComm(blockVersion uint16, root *common.Hash, epochComm *EpochCommittee) error
func ContractHasMethods ¶ added in v0.4.0
func DecodeSignature ¶
func ETHChainID ¶
func EmptyBytesIfNil ¶ added in v0.4.0
func FromETHChainID ¶
func GenElectedNextRoot ¶
func HashSliceValueDecoder ¶
func HashSliceValueEncoder ¶
func HashSliceValueExpander ¶
func HashSliceValueExpander(hashBytes []byte, adpater db.DataAdapter) (valueBytes []byte, err error)
It's just a hash value, and the hash value is key, so you don't need to save it
func HashSliceValueHasher ¶
Only hash is reserved. The data of CashCheck is provided by the client, so the value itself is the hash value
func InPosv3Names ¶
func InitBridgeAbi ¶ added in v0.4.0
func InitBridgeAbi()
func InitBridgeInfoAbi ¶ added in v0.4.0
func InitBridgeInfoAbi()
func InitForwarderAbi ¶
func InitForwarderAbi()
func InitMCommAbi ¶
func InitMCommAbi()
func InitManageChainsAbi ¶
func InitManageChainsAbi()
func InitVersionAbi ¶
func InitVersionAbi()
func IsBlockValidateError ¶
func IsBlockValidateFailed ¶
func IsMalicious ¶
func IsPosv3InputOf ¶
func LegacyTxVMatchChainID ¶
func NewIdentifier ¶
func NewIdentifierByHex ¶
func NewIdentifierByHexWithoutError ¶
func NewIdentifierByHexWithoutError(privHexString string) common.Identifier
func NewNodeIdentifier ¶
func NewNodeIdentifierByHex ¶
func NewNodeIdentifierByHexWithoutError ¶
func NewNodeIdentifierByHexWithoutError(privHexString string) common.NodeIdentifier
func NewPosv3Award ¶
func NewPosv3Award(rewardType RewardType, era common.EraNum) ([]byte, error)
func NewPosv3Report ¶
func NewPosv3UnDelegate ¶
func NewPosv3Withdraw ¶
func NewRRPenalize ¶ added in v0.4.0
func NewRevertError ¶
func PrefixedRlpHash ¶
func PrefixedRlpHash(prefix byte, x interface{}) (h common.Hash)
PrefixedRlpHash writes the prefix into the hasher before rlp-encoding x. It's used for typed transactions.
func PrivateToPublicSlice ¶
func PubKeyCanRecover ¶
func PubKeyCanRecover() bool
func PubToNodeID ¶
func RRDepositRequestHash ¶
func ReachAudited ¶
func ReachCommit ¶
func ReachConfirm ¶
func ReachPrepare ¶
func ReachRevealed ¶
func RebootMainChainHash ¶
func RlpHash ¶
func RlpHash(x interface{}) (h common.Hash)
RlpHash encodes x and hashes the encoded bytes.
func SetupChains ¶
func SetupChains(chains *ChainTrie, chaininfosMap map[common.ChainID]*common.ChainInfos)
func ToMalicious ¶
func ToMalicious(err error, typ MaliciousType) error
func TransactionStringForHash ¶
func TransactionStringForHash(chainid common.ChainID, from *common.Address, to *common.Address, nonce uint64, uselocal bool, val *big.Int, input []byte, extra []byte) string
Deprecated
func TrieRootEqual ¶
func TrieRootHashEqual ¶
func ValidateFailed ¶
func VerifyHashWithPub ¶
func VerifyMsgWithPub ¶
func WithdrawingExpireEra ¶
func WithdrawingExpireEra(requestEra common.EraNum) common.EraNum
Types ¶
type AccessList ¶
type AccessList []AccessTuple
AccessList is an EIP-2930 access list.
func (AccessList) Like ¶ added in v0.4.0
func (al AccessList) Like(ol AccessList) bool
func (AccessList) StorageKeys ¶
func (al AccessList) StorageKeys() int
StorageKeys returns the total number of storage keys in the access list.
func (AccessList) String ¶
func (al AccessList) String() string
type AccessListTx ¶
type AccessListTx struct { ChainID *big.Int // destination chain ID Nonce uint64 // nonce of sender account GasPrice *big.Int // wei per gas Gas uint64 // gas limit To *common.Address `rlp:"nil"` // nil means contract creation Value *big.Int // wei amount Data []byte // contract invocation input data AccessList AccessList // EIP-2930 access list V, R, S *big.Int // signature values }
AccessListTx is the data of EIP-2930 access list transactions.
type AccessTuple ¶
type AccessTuple struct { Address common.Address `json:"address" gencodec:"required"` StorageKeys []common.Hash `json:"storageKeys" gencodec:"required"` }
AccessTuple is the element type of an access list.
func (AccessTuple) Like ¶ added in v0.4.0
func (a AccessTuple) Like(o AccessTuple) bool
type Account ¶
type Account struct { Addr common.Address `json:"address"` // account address Nonce uint64 `json:"nonce"` // next transaction nonce Balance *big.Int `json:"balance"` // basic currency, never be nil LocalCurrency *big.Int `json:"localCurrency"` // local currency (if exist), could be nil StorageRoot []byte `json:"storageRoot"` // storage for contract,Trie(key: Hash, value: Hash) CodeHash []byte `json:"codeHash"` // hash of contract code LongStorageRoot []byte `json:"longStorageRoot"` // more complex storage for contract, Trie(key: Hash, value: []byte) Creator *common.Address `json:"creator"` // the creator of the current contract account Flags *big.Int `json:"flags"` // one bit for one flag Properties []byte `json:"properties"` // properties in json format }
1. currency type can be determinded in a normal transfer, default is basic currency 2. in contract calling, value type can be determinded. solidity contract can only use local currency if it has a local currency in the chain.
func NewAccount ¶ added in v0.4.0
func (*Account) HashValue ¶
for compatible with old version, if there's no local currency and LongStorage, hash should same with the hash of old version account. TODO delete compatible when restart the chain with new version
func (*Account) IsUserContract ¶
type AccountDelta ¶
type AccountDelta struct { Addr common.Address Delta *big.Int // Balance modification CurrencyDelta *big.Int // LocalCurrency modification (if has) }
func NewAccountDelta ¶
func NewAccountDelta(addr common.Address, delta *big.Int, currencyDelta *big.Int) *AccountDelta
func (*AccountDelta) Add ¶
func (d *AccountDelta) Add(delta *big.Int)
func (*AccountDelta) AddCurrency ¶
func (d *AccountDelta) AddCurrency(delta *big.Int)
func (*AccountDelta) Address ¶
func (d *AccountDelta) Address() common.Address
func (*AccountDelta) HashValue ¶
func (d *AccountDelta) HashValue() ([]byte, error)
TODO delete compatible when restart the chain with new version
func (*AccountDelta) String ¶
func (d *AccountDelta) String() string
type AccountState ¶
type AccountState interface { Address() common.Address GetAccount() *Account }
type ActFailedResult ¶
type ActFailedResult struct { TxHash common.Hash Error error }
func (*ActFailedResult) Receipt ¶
func (r *ActFailedResult) Receipt() *RRActReceipt
func (*ActFailedResult) String ¶
func (r *ActFailedResult) String() string
type ActResult ¶
type ActResult interface { Receipt() *RRActReceipt String() string }
type ActRptType ¶
type ActRptType byte
const ( ARMerged ActRptType = iota ARCreated ARIgnored )
func (ActRptType) String ¶
func (t ActRptType) String() string
type AllCommEntries ¶
type AllCommEntries []*CommEntry
func (AllCommEntries) Len ¶
func (e AllCommEntries) Len() int
func (AllCommEntries) Less ¶
func (e AllCommEntries) Less(i, j int) bool
func (AllCommEntries) String ¶
func (e AllCommEntries) String() string
func (AllCommEntries) Swap ¶
func (e AllCommEntries) Swap(i, j int)
type AllCommEntry ¶
type AllCommEntry struct { ChainID common.ChainID EpochNum common.EpochNum Comm *EpochAllCommittee }
func (*AllCommEntry) Available ¶
func (e *AllCommEntry) Available() bool
func (*AllCommEntry) String ¶
func (e *AllCommEntry) String() string
type AttendanceRecord ¶
type AttendanceRecord struct { Epoch common.EpochNum // current epoch Attendance *big.Int // Indicates by bit whether the corresponding data block is empty, Attendance.Bit(BlockNum)==1 is normal block and ==0 is empty block DataNodes common.NodeIDs // List of datanode nodeid in ascending order Stats []int // Stats of alive data nodes AuditChains common.ChainIDs // since v3.2.1, auditing chains, same order in each slot in the Audits bits, created when AttendanceRecord creating, no modifying allowed Audits *big.Int // since v3.2.1, audition record, EpochLength*NumberOfChains bits // contains filtered or unexported fields }
Even if it is an empty block, the attendance table must be filled in. Otherwise, when the last block of epoch is an empty block, the data node will not be able to report the attendance table (the previous block cannot prove the attendance of the following block). Therefore, the empty block should not only fill in the attendance table, but also fill in the attendance hash in the header. In this way, the attendance table of each block is locked in the header, so there is no need to record blocknum separately
func NewAttendanceRecord ¶
func NewAttendanceRecord(epoch common.EpochNum, chainIds common.ChainIDs, dataNodes ...common.NodeID) *AttendanceRecord
func (*AttendanceRecord) AddDataNodeStat ¶
func (a *AttendanceRecord) AddDataNodeStat(nodeId common.NodeID)
func (*AttendanceRecord) AuditString ¶ added in v0.4.0
func (a *AttendanceRecord) AuditString(num common.BlockNum) string
func (*AttendanceRecord) AuditedChains ¶ added in v0.4.0
func (a *AttendanceRecord) AuditedChains(num common.BlockNum) common.ChainIDs
func (*AttendanceRecord) CheckAudits ¶ added in v0.4.0
func (a *AttendanceRecord) CheckAudits(num common.BlockNum, summaries []*BlockSummary) error
func (*AttendanceRecord) Clone ¶
func (a *AttendanceRecord) Clone() *AttendanceRecord
func (*AttendanceRecord) Hash ¶
func (a *AttendanceRecord) Hash() (*common.Hash, error)
func (*AttendanceRecord) HashValue ¶ added in v0.4.0
func (a *AttendanceRecord) HashValue() ([]byte, error)
func (*AttendanceRecord) IsLegalFirst ¶
func (a *AttendanceRecord) IsLegalFirst(chainIds common.ChainIDs, datanodes common.NodeIDs) error
func (*AttendanceRecord) IsLegalNext ¶
func (a *AttendanceRecord) IsLegalNext(next *AttendanceRecord) error
func (*AttendanceRecord) NoAudits ¶ added in v0.4.0
func (a *AttendanceRecord) NoAudits() bool
func (*AttendanceRecord) Proposed ¶
func (a *AttendanceRecord) Proposed(commId common.CommID, commSize int) int
func (*AttendanceRecord) SetAbsentness ¶
func (a *AttendanceRecord) SetAbsentness(epoch common.EpochNum, block common.BlockNum)
func (*AttendanceRecord) SetAttendance ¶
func (a *AttendanceRecord) SetAttendance(epoch common.EpochNum, block common.BlockNum)
func (*AttendanceRecord) SetAudits ¶ added in v0.4.0
func (a *AttendanceRecord) SetAudits(num common.BlockNum, summaries []*BlockSummary)
func (*AttendanceRecord) String ¶
func (a *AttendanceRecord) String() string
type AttendanceReportTxFilter ¶
type AttendanceReportTxFilter struct{}
func (AttendanceReportTxFilter) Filter ¶
func (f AttendanceReportTxFilter) Filter(tx *Transaction) bool
type AuditRequest ¶
type AuditRequest struct { ChainId common.ChainID NodelId common.NodeID Height common.Height }
func (*AuditRequest) GetChainID ¶
func (a *AuditRequest) GetChainID() common.ChainID
func (*AuditRequest) String ¶
func (a *AuditRequest) String() string
type AuditingMessage ¶
type AuditingMessage struct { ChainID common.ChainID Height common.Height BlockHash common.Hash Type bool // true for audited, false for revealed Pas *PubAndSig }
func (*AuditingMessage) AuditHash ¶
func (a *AuditingMessage) AuditHash() ([]byte, error)
func (*AuditingMessage) GetChainID ¶
func (a *AuditingMessage) GetChainID() common.ChainID
func (*AuditingMessage) InfoString ¶
func (a *AuditingMessage) InfoString(level common.IndentLevel) string
func (*AuditingMessage) String ¶
func (a *AuditingMessage) String() string
func (*AuditingMessage) Validate ¶
func (a *AuditingMessage) Validate() ([]byte, error)
func (*AuditingMessage) Verify ¶
func (a *AuditingMessage) Verify(ider func(nid common.NodeID) bool) error
func (*AuditingMessage) VerifyByList ¶
func (a *AuditingMessage) VerifyByList(auditorIds common.NodeIDs) error
func (*AuditingMessage) VerifyByMap ¶
func (a *AuditingMessage) VerifyByMap(auditors map[common.NodeID]struct{}) error
type AuditorMsgsForDB ¶
type AuditorMsgsForDB struct { BlockHash common.Hash Pass AuditorPass }
func (*AuditorMsgsForDB) String ¶
func (p *AuditorMsgsForDB) String() string
type AuditorMsgsForDBs ¶
type AuditorMsgsForDBs []*AuditorMsgsForDB
func (AuditorMsgsForDBs) Len ¶
func (ps AuditorMsgsForDBs) Len() int
func (AuditorMsgsForDBs) Less ¶
func (ps AuditorMsgsForDBs) Less(i, j int) bool
func (AuditorMsgsForDBs) String ¶
func (ps AuditorMsgsForDBs) String() string
func (AuditorMsgsForDBs) Swap ¶
func (ps AuditorMsgsForDBs) Swap(i, j int)
type AuditorPas ¶
func (*AuditorPas) Clone ¶
func (a *AuditorPas) Clone() *AuditorPas
func (*AuditorPas) Equal ¶ added in v0.4.0
func (a *AuditorPas) Equal(o *AuditorPas) bool
func (*AuditorPas) InfoString ¶
func (a *AuditorPas) InfoString(level common.IndentLevel) string
func (*AuditorPas) Key ¶
func (a *AuditorPas) Key() []byte
func (*AuditorPas) String ¶
func (a *AuditorPas) String() string
type AuditorPass ¶
type AuditorPass []*AuditorPas
func (AuditorPass) Clone ¶
func (as AuditorPass) Clone() AuditorPass
func (AuditorPass) Equal ¶ added in v0.4.0
func (as AuditorPass) Equal(os AuditorPass) bool
func (AuditorPass) InfoString ¶
func (as AuditorPass) InfoString(level common.IndentLevel) string
func (AuditorPass) Len ¶
func (as AuditorPass) Len() int
func (AuditorPass) Less ¶
func (as AuditorPass) Less(i, j int) bool
func (AuditorPass) Merge ¶
func (as AuditorPass) Merge(apass AuditorPass) AuditorPass
func (AuditorPass) Swap ¶
func (as AuditorPass) Swap(i, j int)
func (AuditorPass) Verify ¶
func (as AuditorPass) Verify(id common.ChainID, height common.Height, hashOfBlock []byte, auditors map[common.NodeID]struct{}) (audited, revealed map[common.NodeID]*AuditorPas, err error)
func (AuditorPass) VerifyByAuditors ¶
func (as AuditorPass) VerifyByAuditors(id common.ChainID, height common.Height, hob []byte, auditors map[common.NodeID]struct{}) error
type BlockBody ¶
type BlockBody struct { NextCommittee *Committee // election results of the next committee // Deprecated NCMsg []*ElectMessage // election requests for chains (in main chain) DeltaFroms DeltaFroms // deltas merged to current shard Txs []*Transaction // transactions TxsPas []*PubAndSig // signatures corresponding to packaged transactions Deltas []*AccountDelta // the delta generated by packaged transactions on current shard needs to be sent to other shards Hds []*BlockSummary // block summary reported by children chains Attendance *AttendanceRecord // attendance table of the current epoch RewardReqs RewardRequests // self-proving reward request of each chain received on the main chain ElectingResults ChainElectResults // Since v1.5.0, a list of election results, it's a preelection when Epoch.IsNil()==true, others are local election PreElectings PreElectings // Since v1.5.0, the list of preselections in progress, sorted by (expire, chainid) NextRealCommittee *Committee // Since v1.5.0, when election finished, the result will be put into NextCommittee. If the election is failed, the current committee will continue to be used in the next epoch. At this time, the current committee needs to be written into this field, which can be brought with it when reporting. SeedFactor SeedFactor // Since v2.0.0, random factor of seed. since v3.2.1, used as the factor of generating seed Restarting *RestartedComm // Since v2.11.5, sub-chain restarting comm and its generation proof Rebooted *RebootedComm // Since v2.12.0, main chain rebooted comm and admin signatures RandomSig []byte // Since v3.2.0, placeholder in v2.14.2, random for chain, signature by proposer TxParams [][]byte // since v2.14.2, parameters generated by proposer for transactions }
func (*BlockBody) AttendanceRoot ¶
func (*BlockBody) AuditedInfoString ¶ added in v0.4.0
func (*BlockBody) ConfirmedChains ¶
func (bb *BlockBody) ConfirmedChains() []common.ChainID
func (*BlockBody) ElectResultRoot ¶
func (*BlockBody) GenElectedNextRoot ¶
func (*BlockBody) InfoString ¶
func (*BlockBody) PreElectRoot ¶
func (*BlockBody) ProofNextComm ¶
func (bb *BlockBody) ProofNextComm(version uint16) (nextComm *Committee, commRoot *common.Hash, proof *common.MerkleProofs, err error)
the proof from hash of next committee to the value of header.ElectedNextRoot
func (*BlockBody) SeedFactorRoot ¶
func (*BlockBody) TransactionsRoot ¶
func (*BlockBody) TxParamsRoot ¶
func (*BlockBody) TxProofHash ¶
func (bb *BlockBody) TxProofHash(blockVersion uint16, txIndex, rrIndex int, proofs *common.MerkleProofs) ([]byte, error)
since v2.10.11, In order to generate the proof from the transaction hash with the signature, the calculation method of the TransactionRoot and the ReceiptRoot in the BlockHeader is changed, resulting in incompatibility with the historical data from the current version
type BlockCursor ¶
type BlockCursor struct { Height common.Height Hash []byte }
BlockCursor Cursor information used to record blocks, including block height and block hash
type BlockEMessage ¶
type BlockEMessage struct { BlockHeader *BlockHeader BlockBody *BlockBody BlockPass PubAndSigs }
func (*BlockEMessage) BlockNum ¶
func (b *BlockEMessage) BlockNum() common.BlockNum
func (*BlockEMessage) CheckHashs ¶
func (b *BlockEMessage) CheckHashs() error
CheckHashs Recalculate and verify the data in the header according to the body data, and return the corresponding error if it fails
func (*BlockEMessage) EpochNum ¶
func (b *BlockEMessage) EpochNum() common.EpochNum
func (*BlockEMessage) EraString ¶
func (b *BlockEMessage) EraString() string
func (*BlockEMessage) Formalize ¶
func (b *BlockEMessage) Formalize()
func (*BlockEMessage) FullString ¶
func (b *BlockEMessage) FullString() string
func (*BlockEMessage) GenRestartedComm ¶
func (b *BlockEMessage) GenRestartedComm(chainid common.ChainID) (*RestartedComm, error)
func (*BlockEMessage) GetChainID ¶
func (b *BlockEMessage) GetChainID() common.ChainID
func (*BlockEMessage) GetHeight ¶
func (b *BlockEMessage) GetHeight() common.Height
func (*BlockEMessage) HasTx ¶ added in v0.2.2
func (b *BlockEMessage) HasTx() bool
func (*BlockEMessage) Hash ¶
func (b *BlockEMessage) Hash() common.Hash
func (*BlockEMessage) InfoString ¶
func (b *BlockEMessage) InfoString(level common.IndentLevel) string
func (*BlockEMessage) IsValid ¶
func (b *BlockEMessage) IsValid() bool
func (*BlockEMessage) Logger ¶ added in v0.2.2
func (b *BlockEMessage) Logger(logger logrus.FieldLogger, defaultLevel ...logrus.Level) func(string, ...interface{})
func (*BlockEMessage) MakeHdsProof ¶
func (b *BlockEMessage) MakeHdsProof(subId common.ChainID, height common.Height, proofChain *trie.ProofChain) ([]byte, error)
func (*BlockEMessage) SetRestarting ¶ added in v0.4.0
func (b *BlockEMessage) SetRestarting(pheight common.Height, phash *common.Hash, restarted *RestartedComm)
func (*BlockEMessage) String ¶
func (b *BlockEMessage) String() string
type BlockHeader ¶
type BlockHeader struct { PreviousHash common.Hash `json:"previoushash" short:"Prev"` // the hash of the previous block header on current chain HashHistory common.Hash `json:"history" short:"History"` // hash of the history tree of hash for each block recorded in height order ChainID common.ChainID `json:"chainid"` // current chain id Height common.Height `json:"height"` // height of current block Empty bool `json:"empty"` // empty block ParentHeight common.Height `json:"-" short:"Parent"` // height of parent height, is 0 if current is main chain ParentHash *common.Hash `json:"-" short:"PHash"` // block hash of main chain block at ParentHeight, nil if current is main chain RewardAddress common.Address `json:"-"` // reward to AttendanceHash *common.Hash `json:"-" short:"Attendence"` // The current epoch attendance record hash RewardedCursor *common.Height `json:"-" short:"Rewarded"` // The last processed main chain height for rewarding, while the current chain is the reward chain CommitteeHash *common.Hash `json:"-" short:"Comm"` // current epoch Committee member trie root hash ElectedNextRoot *common.Hash `json:"-" short:"NextComm"` // root hash of the election result of next epoch committee members Seed *common.Seed `json:"seed" short:"Seed"` // Current election seeds, only in the main chain. Since v3.2.1, never be nil in main chain, the seed for election. RREra *common.EraNum `json:"-" short:"Era"` // the era corresponding to the root of the current Required Reserve tree. When this value is inconsistent with the height of main chain, it indicates that a new RR tree needs to be calculated RRRoot *common.Hash `json:"-" short:"RRR"` // root hash of the Required Reserve tree in current era. Only in the reward chain and the main chain RRNextRoot *common.Hash `json:"-" short:"RRN"` // root hash of the Required Reserve tree in next era. Only in the reward chain and the main chain RRChangingRoot *common.Hash `json:"-" short:"RRC"` // changes waiting to be processed in current era MergedDeltaRoot *common.Hash `json:"mergeroot" short:"Merged"` // Root hash of the merged delta sent from other shards BalanceDeltaRoot *common.Hash `json:"deltaroot"` // Root hash of the generated deltas by this block which needs to be sent to the other shards StateRoot common.Hash `json:"stateroot" short:"Root"` // account on current chain state trie root hash ChainInfoRoot *common.Hash `json:"-" short:"Chains"` // for main chain only: all chain info trie root hash WaterlinesRoot *common.Hash `json:"-" short:"Waterline"` // since v2.3.0, the waterlines of other shards to current chain after the execution of this block. nil represent all zeros. Because the value of the previous block needs to be inherited when the block is empty, values after block execution recorded. VCCRoot *common.Hash `json:"-" short:"VCC"` // Root hash of transfer out check tree in business chain CashedRoot *common.Hash `json:"-" short:"Cashed"` // Root hash of transfer in check tree in business chain TransactionRoot *common.Hash `json:"-" short:"TxRoot"` // transactions in current block trie root hash ReceiptRoot *common.Hash `json:"-" short:"Receipts"` // receipts for transactions in current block trie root hash HdsRoot *common.Hash `json:"-" short:"Hds"` // if there's any child chain of current chain, this is the Merkle trie root hash generated by the reported block header information of the child chain in order TimeStamp uint64 `json:"timestamp"` ElectResultRoot *common.Hash `json:"-" short:"ElectResult"` // Since v1.5.0, Election result hash root (including pre election and ordinary election, ordinary one has not been provided yet) PreElectRoot *common.Hash `json:"-" short:"PreElect"` // Since v1.5.0, the root hash of current preelecting list sorted by (Expire, ChainID), only in the main chain FactorRoot *common.Hash `json:"-" short:"Factor"` // since v2.0.0, seed random factor hash. Since v3.2.1, used for generating vrf seed by Hash(body.SeedFactor) at the first non-empty block after pbft.consts.SeedBlock. RRReceiptRoot *common.Hash `json:"-" short:"RRRpts"` // since v2.10.12, in v2.11.0 receipts of RRActs applied in current block Version uint16 `json:"-" short:"V"` // since v2.10.12 ConfirmedRoot *common.Hash `json:"-" short:"Confirmed"` // since v2.11.3, trie root of all sub-confirmed infos RewardedEra *common.EraNum `json:"-"` // since v2.12.0, record the next era that should issue the prize. If it is nil, it means that it is still in PoSv2, and the prize is issued according to epoch. BridgeRoot *common.Hash `json:"-" short:"Bridge"` // since v3.1.0, placeholder in v2.14.2, bridge info root for main chain, bridge requests root for sub-chains RandomHash *common.Hash `json:"-" short:"Random"` // since v3.2.0, placeholder in v2.14.2, used by PREVRANDAO opcode in EIP-4399, =signature(Hash(PreviousHash, Height), ProposerPrivateKey) SeedGenerated bool `json:"-"` // since v3.2.1, placeholder in v2.14.2, indicates whether a new round of seed is generated TxParamsRoot *common.Hash `json:"-"` // since v2.14.2, merkle hash root of tx parameters generated by proposer for the transaction }
func (*BlockHeader) AllFullString ¶
func (h *BlockHeader) AllFullString() string
func (*BlockHeader) AllString ¶
func (h *BlockHeader) AllString() string
func (*BlockHeader) Clone ¶
func (h *BlockHeader) Clone() *BlockHeader
func (*BlockHeader) ContentString ¶
func (h *BlockHeader) ContentString(names []string, noNils ...bool) string
func (*BlockHeader) Equal ¶
func (h *BlockHeader) Equal(o *BlockHeader) bool
func (*BlockHeader) Era ¶
func (h *BlockHeader) Era() common.EraNum
func (*BlockHeader) FullString ¶
func (h *BlockHeader) FullString() string
func (BlockHeader) GetHeight ¶
func (h BlockHeader) GetHeight() common.Height
func (*BlockHeader) Hash ¶
func (h *BlockHeader) Hash() common.Hash
func (*BlockHeader) HashValue ¶
func (h *BlockHeader) HashValue() ([]byte, error)
func (*BlockHeader) InfoString ¶
func (h *BlockHeader) InfoString(level common.IndentLevel) string
func (*BlockHeader) MakeProof ¶
func (h *BlockHeader) MakeProof(typ trie.ProofType, proofChain *trie.ProofChain) (hashOfHeader []byte, err error)
func (*BlockHeader) RandomSeed ¶ added in v0.4.0
func (h *BlockHeader) RandomSeed() []byte
func (*BlockHeader) String ¶
func (h *BlockHeader) String() string
func (*BlockHeader) Summary ¶
func (h *BlockHeader) Summary() string
type BlockHeighter ¶
type BlockHeighter interface { GetHeight() common.Height Hash() common.Hash }
type BlockHistoryProof ¶
type BlockHistoryProof trie.ProofChain
two blocks (A and B) in one chain, A.Height < B.Height 1. Hash(A) -> B.HashHistory 2. B.HashHistory -> Hash(B)
type BlockReport ¶
type BlockReport struct { ToChainId common.ChainID BlockHeader *BlockHeader // the header of the reporting block NextComm *EpochCommittee // next committee when election finished BlockPass []*PubAndSig // signatures of committee members who comfirmed reporting block. can be changed to aggregate signature in the future HistoryProof trie.ProofChain // the proof from the hash of last confirmed block to HistoryRoot of current block AuditPass AuditorPass }
BlockReport report of Block
func (*BlockReport) CAS ¶
func (r *BlockReport) CAS(o *BlockReport) (*BlockReport, error)
if two reports are for the same block: 1. merge signs and auditings 2. replacing HistoryProof if necessary 3. add NextComm if old report doesnot have but new one has
func (*BlockReport) Clone ¶
func (r *BlockReport) Clone() *BlockReport
func (*BlockReport) DestChainID ¶
func (r *BlockReport) DestChainID() common.ChainID
func (*BlockReport) GetChainID ¶
func (r *BlockReport) GetChainID() common.ChainID
func (*BlockReport) Hash ¶
func (r *BlockReport) Hash() common.Hash
func (*BlockReport) ProofingHeight ¶
func (r *BlockReport) ProofingHeight() common.Height
func (*BlockReport) String ¶
func (r *BlockReport) String() string
func (*BlockReport) Verify ¶
func (r *BlockReport) Verify(lastHeight common.Height, lastHob []byte, comm *Committee, auditors map[common.NodeID]struct{}) error
func (*BlockReport) VerifyHistoryProof ¶
func (r *BlockReport) VerifyHistoryProof(proofingHeight common.Height, proofingHob []byte) error
type BlockRequest ¶
type BlockRequest struct { ChainId common.ChainID Height common.Height NodeId common.NodeID RandNum int64 }
func (*BlockRequest) GetChainID ¶
func (b *BlockRequest) GetChainID() common.ChainID
func (*BlockRequest) GetHeight ¶
func (b *BlockRequest) GetHeight() common.Height
func (*BlockRequest) String ¶
func (b *BlockRequest) String() string
type BlockResponse ¶
type BlockResponse struct { ToNodeId common.NodeID Block *BlockEMessage RandNum int64 }
func (*BlockResponse) GetChainID ¶
func (br *BlockResponse) GetChainID() common.ChainID
func (*BlockResponse) GetHeight ¶
func (br *BlockResponse) GetHeight() common.Height
func (*BlockResponse) String ¶
func (br *BlockResponse) String() string
type BlockSummary ¶
type BlockSummary struct { ChainId common.ChainID Height common.Height BlockHash *common.Hash // since v1.5.0, the election result of the next committee whill be packaged together. // Because only the data and comm node will receive the report and record the next committee // of the sub chain. Since the new elected node has already been synchronizing the main chain, // it will not synchronize the data again, then it will not be able to synchronize all the sub // chain committee information, resulting in the nodes missing the corresponding information // when the new epoch begins. NextComm *EpochCommittee // V0's BlockSummary.Hash is same with blockhash, which can't reflect the location information // of the block, and can't complete the proof of cross chain. V1 adds chainid and height to hash Version uint16 // since v2.11.0, record the continuity from the last confirmed block height on the sub-chain // to the current confirmed block // since v3.1.0, should be nil // since v3.2.6, used for proof NextComm.Hash() -> BlockHash Proofs trie.ProofChain // since v2.11.3, the size of a header is about 20 hashes, and one proof of a header content // is 6 hashes in the new version, so when there are more than 3 proofs (NextCommProof, // HisRootProof, ParentProof), use the header to replace the 3 sets of values and the proofs // is more cost-effective // since v3.2.1, deprecated // since v3.2.6, if sub-chain is the REWARD chain, use Header instead of (ChainID,Height,BlockHash) // for RREra/RRRoot/RRNextRoot Header *BlockHeader // since v2.11.0, record the audit result of the current block // since v3.1.0, should be nil // Deprecated AuditorPass AuditorPass }
func (*BlockSummary) Compare ¶ added in v0.4.0
func (s *BlockSummary) Compare(o *BlockSummary) int
func (*BlockSummary) Equal ¶ added in v0.4.0
func (s *BlockSummary) Equal(o *BlockSummary) bool
func (*BlockSummary) FastEqual ¶ added in v0.4.0
func (s *BlockSummary) FastEqual(o *BlockSummary) bool
func (*BlockSummary) GetBlockHash ¶ added in v0.4.0
func (s *BlockSummary) GetBlockHash() common.Hash
func (*BlockSummary) GetChainID ¶
func (s *BlockSummary) GetChainID() common.ChainID
func (*BlockSummary) GetHeight ¶
func (s *BlockSummary) GetHeight() common.Height
func (*BlockSummary) HashValue ¶
func (s *BlockSummary) HashValue() ([]byte, error)
func (*BlockSummary) HeaderEqual ¶ added in v0.4.0
func (s *BlockSummary) HeaderEqual(header *BlockHeader) bool
func (*BlockSummary) HistoryProofing ¶
func (s *BlockSummary) HistoryProofing() common.Height
func (*BlockSummary) Hob ¶
func (s *BlockSummary) Hob() []byte
func (*BlockSummary) InfoString ¶
func (s *BlockSummary) InfoString(level common.IndentLevel) string
func (*BlockSummary) IsValid ¶
func (s *BlockSummary) IsValid() bool
func (*BlockSummary) MakeProof ¶
func (s *BlockSummary) MakeProof() (*trie.NodeProof, error)
block hash proof
func (*BlockSummary) String ¶
func (s *BlockSummary) String() string
func (*BlockSummary) Summary ¶
func (s *BlockSummary) Summary() string
type BlockSummarys ¶
type BlockSummarys []*BlockSummary
func (BlockSummarys) Equal ¶ added in v0.4.0
func (ss BlockSummarys) Equal(os BlockSummarys) bool
func (BlockSummarys) FastEqual ¶ added in v0.4.0
func (ss BlockSummarys) FastEqual(os BlockSummarys) bool
func (BlockSummarys) InfoString ¶
func (ss BlockSummarys) InfoString(level common.IndentLevel) string
func (BlockSummarys) Len ¶
func (ss BlockSummarys) Len() int
func (BlockSummarys) Less ¶
func (ss BlockSummarys) Less(i, j int) bool
func (BlockSummarys) Summary ¶
func (ss BlockSummarys) Summary() string
func (BlockSummarys) Swap ¶
func (ss BlockSummarys) Swap(i, j int)
type BlockValidateError ¶
type BlockValidateError struct {
// contains filtered or unexported fields
}
func (*BlockValidateError) Error ¶
func (e *BlockValidateError) Error() string
func (*BlockValidateError) ValidateFailed ¶
func (e *BlockValidateError) ValidateFailed() bool
type Bonus ¶
type Bonus struct { Winner common.Address `json:"winner"` // bonus winner Val *big.Int `json:"value"` // bonus value }
func (*Bonus) FormatForRLP ¶
type BridgeExtra ¶ added in v0.4.0
type BridgeExtra struct { // Type==0: process request, mint or transfer tx generated by request // type==1: update request status by response // type==2: remove processed requests // type==3: remove processed responses Type uint8 `json:"type"` }
func (*BridgeExtra) Reset ¶ added in v0.4.0
func (e *BridgeExtra) Reset()
func (*BridgeExtra) String ¶ added in v0.4.0
func (e *BridgeExtra) String() string
type BridgeInfo ¶ added in v0.4.0
type BridgeInfo struct { MappingChain common.ChainID MappingContract common.Address FromChain common.ChainID FromContract common.Address Type TokenType }
defination of bridge stored in main chain
- there are two types of contracts: main contract and mapping contract, each mapping contract can only correspond to one main contract. To contract can only be a mapping contract.
- for safety, it is required that all the tokens on the mapping contract are mint from the system bridge, and others cannot mint, so as to ensure that the token on the account of the system bridge address on the main contract and the token on the mapping contract of all modified contracts can be the same. one-to-one
- creating the Trie with (ToChain, ToContract) as the unique key ensures that each mapping contract corresponds to only one main contract.
- the transfer from the main contract to the mapping contract uses TRANSFER-MINT
- the transfer from the mapping contract to the main contract uses BURN-TRANSFER
- mapping contracts of the same (FromChain, FromContract) can be transferred to each other using the BURN-MINT pair
- 合约分为主合约和映射合约两种,每一个映射合约只能对应一个主合约。to合约只能是映射合约。
- 为了安全,需要所有映射合约上的token都是由系统桥mint出来的,其他人无法mint,这样才能保 证主合约上系统桥地址的账户上的token与所有改合约的映射合约上的token才能一一对应
- 以 (ToChain, ToContract)为唯一键创建Trie,可以保证每个映射合约只对应一个主合约。
- 从主合约到映射合约的转移使用 TRANSFER-MINT
- 从映射合约到主合约的转移使用 BURN-TRANSFER
- 相同(FromChain, FromContract)的合约可以互相转移,使用BURN-MINT对
func (*BridgeInfo) BridgeInfoKey ¶ added in v0.4.0
func (*BridgeInfo) BridgeInfoKey(chainId common.ChainID, contract common.Address) []byte
func (*BridgeInfo) Clone ¶ added in v0.4.0
func (b *BridgeInfo) Clone() *BridgeInfo
func (*BridgeInfo) ErcType ¶ added in v0.4.0
func (b *BridgeInfo) ErcType(chain common.ChainID, contract common.Address) (typ MappingType, exist bool)
func (*BridgeInfo) IsMainContract ¶ added in v0.4.0
func (b *BridgeInfo) IsMainContract(chain common.ChainID, contract common.Address) bool
func (*BridgeInfo) IsMapping ¶ added in v0.4.0
func (b *BridgeInfo) IsMapping(chain common.ChainID, contract common.Address) bool
func (*BridgeInfo) Key ¶ added in v0.4.0
func (b *BridgeInfo) Key() []byte
unique by (FromChain,FromContract,ToChain,ToContract)
func (*BridgeInfo) Match ¶ added in v0.4.0
func (b *BridgeInfo) Match(o *BridgeInfo) bool
func (*BridgeInfo) SameMain ¶ added in v0.4.0
func (b *BridgeInfo) SameMain(o *BridgeInfo) bool
func (*BridgeInfo) String ¶ added in v0.4.0
func (b *BridgeInfo) String() string
DONOT change because used in system bridge contract returned error
func (*BridgeInfo) Validate ¶ added in v0.4.0
func (b *BridgeInfo) Validate() error
type BridgeInfos ¶ added in v0.4.0
type BridgeInfos []*BridgeInfo
func (BridgeInfos) String ¶ added in v0.4.0
func (s BridgeInfos) String() string
type BridgeReq ¶ added in v0.4.0
type BridgeReq struct { FromChain common.ChainID // FromContract common.Address // mapping contract if BURNING, main contract if TRANSFERING Height common.Height // the height of the block in which the requested transaction packed ToChain common.ChainID // bridge target chain ToContract common.Address // bridge target contract, get from BridgeInfo in main chain ToAccount common.Address // request user Nonce uint64 // nonce of transaction generate this request Value *big.Int // value of erc20, amount of 721/1155 TokenID *big.Int // not nil if Type is 721 or 1155 Data []byte // used for mint1155 TokenType TokenType // token type FromContractType MappingType // used to determine which method should be called when generating a withdraw transaction TargetContractType MappingType // used to determine which method should be called when generating a proccess transaction, regardless of whether the BridgeInfo in the main chain has changed Status BridgeReqStatus // 0: not responded, 1: process successful, 2: process failed }
bridge mint or burn request, generated and stored in from-chain, processed in target-chain key: Height(8)+ToAccount(20)+Nonce(8), ordered with height and unique by account+nonce
func (*BridgeReq) MakeWithdrawingInput ¶ added in v0.4.0
func (*BridgeReq) String ¶ added in v0.4.0
DONOT change because this method is used in system bridge contract returned error value
func (*BridgeReq) ToFailedTx ¶ added in v0.4.0
func (r *BridgeReq) ToFailedTx(nonce uint64) (*Transaction, error)
func (*BridgeReq) ToProcessingTx ¶ added in v0.4.0
func (r *BridgeReq) ToProcessingTx(nonce uint64) (*Transaction, error)
type BridgeReqExtra ¶ added in v0.4.0
type BridgeReqExtra struct { Type uint8 `json:"type"` // Type==0: mint or transfer tx generated by request From common.ChainID `json:"from"` // from chain id Height common.Height `json:"height"` // the height of the block where bridge request packed Account common.Address `json:"account"` // the requester of the bridge request Nonce uint64 `json:"nonce"` // the nonce of the tx of bridge request }
func (*BridgeReqExtra) IsValid ¶ added in v0.4.0
func (e *BridgeReqExtra) IsValid() bool
func (*BridgeReqExtra) Reset ¶ added in v0.4.0
func (e *BridgeReqExtra) Reset()
func (*BridgeReqExtra) String ¶ added in v0.4.0
func (e *BridgeReqExtra) String() string
type BridgeReqInfo ¶ added in v0.4.0
type BridgeReqInfo struct { FromChain *big.Int `abi:"fromChain"` Height *big.Int `abi:"height"` Account common.Address `abi:"account"` Nonce *big.Int `abi:"nonce"` ContractType *big.Int `abi:"contractType"` }
func (*BridgeReqInfo) FromReq ¶ added in v0.4.0
func (i *BridgeReqInfo) FromReq(req *BridgeReq) (*BridgeReqInfo, error)
func (*BridgeReqInfo) GetFromChain ¶ added in v0.4.0
func (i *BridgeReqInfo) GetFromChain() common.ChainID
func (*BridgeReqInfo) String ¶ added in v0.4.0
func (i *BridgeReqInfo) String() string
func (*BridgeReqInfo) Validate ¶ added in v0.4.0
func (i *BridgeReqInfo) Validate() (sourceChain common.ChainID, reqHeight common.Height, nonce uint64, mt MappingType, err error)
type BridgeReqStatus ¶ added in v0.4.0
type BridgeReqStatus uint8
const ( BReqNotRespond BridgeReqStatus = 0 BReqSuccess BridgeReqStatus = 1 BReqFailed BridgeReqStatus = 2 )
func (BridgeReqStatus) IsFailed ¶ added in v0.4.0
func (s BridgeReqStatus) IsFailed() bool
func (BridgeReqStatus) IsSuccess ¶ added in v0.4.0
func (s BridgeReqStatus) IsSuccess() bool
func (BridgeReqStatus) IsValid ¶ added in v0.4.0
func (s BridgeReqStatus) IsValid() bool
func (BridgeReqStatus) String ¶ added in v0.4.0
func (s BridgeReqStatus) String() string
type BridgeResp ¶ added in v0.4.0
type BridgeResp struct { SourceChain common.ChainID // where the request generated ReqHeight common.Height // the height of from chain block where the request generated TargetChain common.ChainID // where the request processed and also where the response generated BlockHeight common.Height // the height of block where the request processed Account common.Address // request.ToAccount Nonce uint64 // request.Nonce Status uint8 // 0: failed, 1: succeed }
the response of the request send from SourceChain to TargetChain a response should be send from TargetChain to SourceChain to update the status of the request SourceChain is the key in the upper level of the trie which is not included in the struct
func (*BridgeResp) Clone ¶ added in v0.4.0
func (p *BridgeResp) Clone() *BridgeResp
func (*BridgeResp) Equal ¶ added in v0.4.0
func (p *BridgeResp) Equal(o *BridgeResp) bool
func (*BridgeResp) Key ¶ added in v0.4.0
func (p *BridgeResp) Key() []byte
same with the key of BridgeReq: BlockHeight + Account + Nonce, FromChain is the key in upper level
func (*BridgeResp) StatusString ¶ added in v0.4.0
func (p *BridgeResp) StatusString() string
func (*BridgeResp) String ¶ added in v0.4.0
func (p *BridgeResp) String() string
func (*BridgeResp) Succeeded ¶ added in v0.4.0
func (p *BridgeResp) Succeeded() bool
func (*BridgeResp) ToUpdateTx ¶ added in v0.4.0
func (p *BridgeResp) ToUpdateTx(nonce uint64) (*Transaction, error)
type BridgeTargetNode ¶ added in v0.4.0
type BridgeTargetNode struct { ToChainID common.ChainID // the target chain of generated bridge requests, and the from chain of all processed requests ReqCursor common.Height // the last height of processed requests from ToChainID ReqRoot []byte // trie root of requests to ToChainID RespCursor common.Height // the last height of processed responses from ToChainID RespRoot []byte // trie root of responses to ToChainID }
Bridge request trie node, generate trie root for block header TargetChainID -> (Height, Account, Nonce) -> Requests
func (*BridgeTargetNode) Clone ¶ added in v0.4.0
func (n *BridgeTargetNode) Clone() *BridgeTargetNode
func (*BridgeTargetNode) HashValue ¶ added in v0.4.0
func (n *BridgeTargetNode) HashValue() ([]byte, error)
func (*BridgeTargetNode) Key ¶ added in v0.4.0
func (n *BridgeTargetNode) Key() []byte
func (*BridgeTargetNode) MakeProof ¶ added in v0.4.0
func (n *BridgeTargetNode) MakeProof(index BridgeTargetNodeProofIndex, proofs *common.MerkleProofs) ([]byte, *common.MerkleProofs, error)
func (*BridgeTargetNode) String ¶ added in v0.4.0
func (n *BridgeTargetNode) String() string
type BridgeTargetNodeProofIndex ¶ added in v0.4.0
type BridgeTargetNodeProofIndex int
const ( BridgeTargetNodeToChain BridgeTargetNodeProofIndex = 0 BridgeTargetNodeReqCursor BridgeTargetNodeProofIndex = 1 BridgeTargetNodeReqRoot BridgeTargetNodeProofIndex = 2 BridgeTargetNodeRespCursor BridgeTargetNodeProofIndex = 3 BridgeTargetNodeRespRoot BridgeTargetNodeProofIndex = 4 )
func (BridgeTargetNodeProofIndex) IsValid ¶ added in v0.4.0
func (i BridgeTargetNodeProofIndex) IsValid() bool
type BridgeTxFilter ¶ added in v0.4.0
type BridgeTxFilter struct{}
func (BridgeTxFilter) Filter ¶ added in v0.4.0
func (f BridgeTxFilter) Filter(tx *Transaction) bool
type BridgeUpdateReqParams ¶ added in v0.4.0
type BridgeUpdateReqParams struct { ReqHeight uint64 `abi:"_reqHeight"` TargetChain uint32 `abi:"_targetChain"` RespHeight uint64 `abi:"_respHeight"` Account common.Address `abi:"_account"` Nonce uint64 `abi:"_nonce"` Success bool `abi:"_success"` }
func (*BridgeUpdateReqParams) GetRespHeight ¶ added in v0.4.0
func (p *BridgeUpdateReqParams) GetRespHeight() common.Height
func (*BridgeUpdateReqParams) GetTargetChain ¶ added in v0.4.0
func (p *BridgeUpdateReqParams) GetTargetChain() common.ChainID
func (*BridgeUpdateReqParams) Params ¶ added in v0.4.0
func (p *BridgeUpdateReqParams) Params() (common.ChainID, common.Height, common.Address, uint64, BridgeReqStatus)
type CancelCashCheckRequest ¶
type CancelCashCheckRequest struct { Check *CashCheck `json:"check"` // cheque to be voided AbsenceChainID common.ChainID `json:"chain"` // the target chain of the proof AbsenceHeight common.Height `json:"height"` // block height of target chain which proof prove to ProofedHash common.Hash `json:"header"` // the proof target hash of Proofs CCCProofs trie.ProofChain `json:"absence"` // CashedTrie's proof of non-existence of check Proofs trie.ProofChain `json:"proofs"` // from CashedTrie.Root Proof chain to the target of proof ConfirmedHeight common.Height `json:"confirmedHeight"` // the main chain block height which confirmed target block header }
a valid cancel request must:
- CCCProofs.IsExist(Hash(Check))==false, means the check not cashed
- Proofs[0].PType==trie.ProofHeaderCCCRoot, to proof it's a CashedTrie proof
- Proofs[0].IsHeaderOf(Check.ToChain, AbsenceHeight)==true, to proof that the current proof is actually generated by the block of target height of the target chain
- ProofedHash==Hash(Block(ChainID:MainChainID, Height:ConfirmedHeight)), the proof target is the main chain block hash at ConfirmedHeight
- Proofs.Proof(CCCProofs.ExistenceHash())==AbsenceHeaderHash, that is the proof required.
func (*CancelCashCheckRequest) InfoString ¶
func (c *CancelCashCheckRequest) InfoString(level common.IndentLevel) string
func (*CancelCashCheckRequest) String ¶
func (c *CancelCashCheckRequest) String() string
type CashCheck ¶
type CashCheck struct { ParentChain common.ChainID `json:"ParentChain"` // parent of source chain IsShard bool `json:"IsShard"` // whether the source chain is a sharding chain FromChain common.ChainID `json:"FromChain"` // id of source chain FromAddress common.Address `json:"FromAddr"` // address of source account Nonce uint64 `json:"Nonce"` // nonce of the tx to write the CashCheck ToChain common.ChainID `json:"ToChain"` // target chain id ToAddress common.Address `json:"ToAddr"` // address of the target account ExpireHeight common.Height `json:"ExpireHeight"` // The expired height refers to that when the height of the target chain exceeds (excluding) this value, the check cannot be withdrawn and can only be returned UserLocal bool `json:"UseLocal"` // true: local currency, false: basic currency, default is false Amount *big.Int `json:"Amount"` // amount of the check CurrencyID common.CoinID `json:"CoinID"` // Currency ID, new field, 0 when uselocal==false, currency ID when =true, and 0 for old version data }
Verifiable Cash Check, for cross chain transfer In order to avoid synchronous recovery of ChainInfos in main chain when recovering data, the chain information is input by the user, and it is enough to check whether the local data is legal when executing (because even if the main chain data is not synchronized, the local chain information can still be known). If the input error can be retrieved through cancel 为了避免恢复数据时还要同步恢复0链的chains,链信息由用户输入,在执行时检查本侧数据是否合法即可(因为就算不同步0链 数据,本地链信息还是可以知道的)。输入错误可以通过cancel找回
func (*CashCheck) Deserialization ¶
func (*CashCheck) Serialization ¶
4 bytes FromChain + 20 bytes FromAddress + 8 bytes Nonce + 4 bytes ToChain + 20 bytes ToAddress + 8 bytes ExpireHeight + 1 byte len(Amount.Bytes()) + Amount.Bytes() all BigEndian
type CashRequest ¶
type CashRequest struct { Check *CashCheck `json:"check"` // check information to be cashed ProofedChainID common.ChainID `json:"chain"` // the target chain of the proof (main chain) ProofHeight common.Height `json:"height"` // proof from check hash to block.hash of source chain, and then to main chain block.hash. this is the corresponding main chain block height ProofHeaderHash common.Hash `json:"header"` // block hash which height is specified by ProofHeight Proofs trie.ProofChain `json:"proofs"` // proof of check }
Check cashing request object is generated by RPC interface and submitted to the target chain through TX. the whole transmission process uses the serialization of this object
func (*CashRequest) InfoString ¶
func (r *CashRequest) InfoString(level common.IndentLevel) string
func (*CashRequest) String ¶
func (r *CashRequest) String() string
func (*CashRequest) Verify ¶
func (r *CashRequest) Verify() (hashOfCheck []byte, err error)
type ChainConfirmed ¶
type ChainConfirmed struct { ChainID common.ChainID `json:"chainid"` Info *ConfirmedInfo `json:"info"` ReHistories RestartHistories `json:"restarts"` }
func (*ChainConfirmed) Compare ¶
func (c *ChainConfirmed) Compare(o *ChainConfirmed) int
func (*ChainConfirmed) InfoString ¶
func (c *ChainConfirmed) InfoString(level common.IndentLevel) string
func (*ChainConfirmed) String ¶
func (c *ChainConfirmed) String() string
func (*ChainConfirmed) Summary ¶ added in v0.4.0
func (c *ChainConfirmed) Summary() string
type ChainConfirmeds ¶
type ChainConfirmeds []*ChainConfirmed
func (ChainConfirmeds) FromTrie ¶
func (cs ChainConfirmeds) FromTrie(confirmedTrie *trie.Trie) ChainConfirmeds
func (ChainConfirmeds) Len ¶
func (cs ChainConfirmeds) Len() int
func (ChainConfirmeds) Less ¶
func (cs ChainConfirmeds) Less(i, j int) bool
func (ChainConfirmeds) Summary ¶ added in v0.4.0
func (cs ChainConfirmeds) Summary() string
func (ChainConfirmeds) Swap ¶
func (cs ChainConfirmeds) Swap(i, j int)
type ChainElectResult ¶
type ChainElectResult struct { ChainID common.ChainID // Election chain Epoch common.EpochNum // The Epoch where the election took place, the value of the pre-election is NilEpoch Results NodeResults LastHeight common.Height // since v2.11.5, last confirmed height of restarting sub-chain, 0 for normal and pre electing LastHash *common.Hash // since v2.11.5, last confirmed block hash of restarting sub-chain, nil for normal and pre electing }
The compound data structure packed in the block, the memory and the form of the data set in the block
func (*ChainElectResult) Clone ¶
func (c *ChainElectResult) Clone() *ChainElectResult
func (*ChainElectResult) ElectingName ¶
func (c *ChainElectResult) ElectingName() ElectingName
func (*ChainElectResult) Equal ¶
func (c *ChainElectResult) Equal(o *ChainElectResult) bool
func (*ChainElectResult) HashValue ¶
func (c *ChainElectResult) HashValue() ([]byte, error)
func (*ChainElectResult) IsNormal ¶
func (c *ChainElectResult) IsNormal() bool
func (*ChainElectResult) IsPreElecting ¶
func (c *ChainElectResult) IsPreElecting() bool
func (*ChainElectResult) IsPreElectingOrRestarting ¶
func (c *ChainElectResult) IsPreElectingOrRestarting() bool
func (*ChainElectResult) IsRestarting ¶
func (c *ChainElectResult) IsRestarting() bool
func (*ChainElectResult) Match ¶
func (c *ChainElectResult) Match(comm *Committee) error
func (*ChainElectResult) ResultLen ¶
func (c *ChainElectResult) ResultLen() int
func (*ChainElectResult) String ¶
func (c *ChainElectResult) String() string
func (*ChainElectResult) Success ¶
func (c *ChainElectResult) Success() bool
func (*ChainElectResult) ToCommittee ¶
func (c *ChainElectResult) ToCommittee() *Committee
type ChainElectResults ¶
type ChainElectResults []*ChainElectResult
func (ChainElectResults) Equal ¶
func (cs ChainElectResults) Equal(os ChainElectResults) bool
func (ChainElectResults) HashValue ¶
func (cs ChainElectResults) HashValue() ([]byte, error)
func (ChainElectResults) HavePreElectingsOrRestartings ¶
func (cs ChainElectResults) HavePreElectingsOrRestartings() bool
Whether there has any pre-election or restarting result
func (ChainElectResults) InfoString ¶
func (cs ChainElectResults) InfoString(level common.IndentLevel) string
func (ChainElectResults) Len ¶
func (cs ChainElectResults) Len() int
func (ChainElectResults) Less ¶
func (cs ChainElectResults) Less(i, j int) bool
func (ChainElectResults) ProofHash ¶
func (cs ChainElectResults) ProofHash(index int, proofs *common.MerkleProofs) ([]byte, error)
func (ChainElectResults) ProofRestarting ¶
func (cs ChainElectResults) ProofRestarting(id common.ChainID, lastHeight common.Height, lastHob *common.Hash) (*ChainElectResult, *common.MerkleProofs, error)
func (ChainElectResults) String ¶
func (cs ChainElectResults) String() string
func (ChainElectResults) Swap ¶
func (cs ChainElectResults) Swap(i, j int)
func (ChainElectResults) ToMap ¶
func (cs ChainElectResults) ToMap() map[common.ChainID]*ChainElectResult
type ChainEpochCommittee ¶
type ChainEpochCommittee struct { ChainID common.ChainID Epoch common.EpochNum Comm *EpochAllCommittee }
func (*ChainEpochCommittee) Compare ¶
func (c *ChainEpochCommittee) Compare(o *ChainEpochCommittee) int
func (*ChainEpochCommittee) String ¶
func (c *ChainEpochCommittee) String() string
type ChainInfoChange ¶
type ChainInfoChange struct { Sender common.Address // TX.From Nonce uint64 // TX.Nonce, Sender + Nonce combination should prevent replay attacks Data []byte // information to be modified }
func (*ChainInfoChange) Deserialization ¶
func (s *ChainInfoChange) Deserialization(r io.Reader) (shouldBeNil bool, err error)
func (*ChainInfoChange) Serialization ¶
func (s *ChainInfoChange) Serialization(w io.Writer) error
func (*ChainInfoChange) String ¶
func (s *ChainInfoChange) String() string
type ChainSetting ¶
type ChainSetting struct { Sender common.Address // Address of sender, should same with TX.From Nonce uint64 // TX.Nonce, Sender+Nonce combination should prevent replay attacks Name string // setting name to be set Data []byte // setting value to be set }
func (*ChainSetting) Deserialization ¶
func (s *ChainSetting) Deserialization(r io.Reader) (shouldBeNil bool, err error)
func (*ChainSetting) Serialization ¶
func (s *ChainSetting) Serialization(w io.Writer) error
func (*ChainSetting) String ¶
func (s *ChainSetting) String() string
type ChainStats ¶
type ChainStats struct { ChainID common.ChainID `json:"chainid"` // id of current chain BaseChainID uint64 `json:"basechainid"` // common.BigChainIDBase ETHChainID string `json:"ethchainid"` // eth chain id of current chain CurrentHeight uint64 `json:"currentheight"` // current height of the chain SumTxCount uint64 `json:"txcount"` // The number of current chain transactions after this launch AllTps uint64 `json:"tps"` // Current chain TPS after this launch LastEpochTps uint64 `json:"tpsLastEpoch"` // TPS of the previous epoch after this launch LastNTps uint64 `json:"tpsLastN"` // TPS of previous %N blocks Lives uint64 `json:"lives"` // Running time after this launch (in seconds) AccountCount uint64 `json:"accountcount"` // 0 EpochLength uint64 `json:"epochlength"` // The number of blocks in one epoch AvgEpochDuration uint64 `json:"epochduration"` // Average time of an epoch (in seconds) LastEpochDuration uint64 `json:"lastepochduration"` // The time spent in the last epoch (in seconds) LastNDuration uint64 `json:"lastNduration"` // Time spent in the previous %N blocks (in seconds) LastEpochBlockTime uint64 `json:"lastEpochBlockTime"` // The average block time of the last epcoh (in milliseconds) LastNBlockTime uint64 `json:"lastNBlockTime"` // Average block time of previous %N blocks (in milliseconds) N uint64 `json:"N"` // The value of N GasLimit uint64 `json:"gaslimit"` // Current chain default GasLimit GasPrice string `json:"gasprice"` // Current chain default GasPrice CurrentComm []common.NodeID `json:"currentcomm"` // The node list of the current committee of the chain LastConfirmed []*ChainConfirmed `json:"confirmed"` // last confirmed infos of sub-chains Version string `json:"version"` // Version of current node }
func (*ChainStats) InfoString ¶
func (s *ChainStats) InfoString(level common.IndentLevel) string
func (*ChainStats) String ¶
func (s *ChainStats) String() string
type ChainTrie ¶
type ChainTrie struct {
// contains filtered or unexported fields
}
func NewChainTrie ¶
func (*ChainTrie) CheckPoint ¶
func (*ChainTrie) DeleteInfo ¶
func (*ChainTrie) GenesisNodes ¶
func (c *ChainTrie) GenesisNodes() map[common.NodeID]common.NodeType
According to ChainTrie data, all genesis consensus nodes and genesisi data nodes are obtained to generate the genesis required reserve tree
func (*ChainTrie) GetAllChainInfos ¶
func (c *ChainTrie) GetAllChainInfos() []*common.ChainInfos
func (*ChainTrie) GetChainChildren ¶
func (c *ChainTrie) GetChainChildren(id common.ChainID) common.ChainIDs
func (*ChainTrie) GetChainInfos ¶
func (*ChainTrie) GetChainList ¶
func (c *ChainTrie) GetChainList() common.ChainIDs
func (*ChainTrie) GetDataNodeList ¶
func (c *ChainTrie) GetDataNodeList(id common.ChainID) common.NodeIDs
func (*ChainTrie) GetDataNodeMap ¶
func (c *ChainTrie) GetDataNodeMap() map[common.ChainID]map[common.NodeID]struct{}
func (*ChainTrie) GetDataNodes ¶
func (c *ChainTrie) GetDataNodes(id common.ChainID) (datas map[common.NodeID]struct{})
func (*ChainTrie) GetGenesisDataNodeList ¶
func (c *ChainTrie) GetGenesisDataNodeList(id common.ChainID) common.NodeIDs
func (*ChainTrie) GetLiveChainInfos ¶
func (*ChainTrie) GetNodeType ¶
func (*ChainTrie) GetReportChildren ¶
func (c *ChainTrie) GetReportChildren(id common.ChainID) common.ChainIDs
func (*ChainTrie) GetRewardChainID ¶
func (c *ChainTrie) GetRewardChainID() common.ChainID
func (*ChainTrie) GetShardInfo ¶
func (c *ChainTrie) GetShardInfo(id common.ChainID) (shardInfo common.ShardInfo)
func (*ChainTrie) GetVrfChainList ¶
func (c *ChainTrie) GetVrfChainList() common.ChainIDs
func (*ChainTrie) IsInUsingDataNode ¶
Whether the node is the data node in use. If yes, the chain ID and true are returned; otherwise, chainid is meaningless and false returned
func (*ChainTrie) IsNoGas ¶
Whether the chain does not need pay gas feed. If true, the second value returns the chain ID with the AttrNoGas attribute
func (*ChainTrie) RangeAllInfos ¶
func (c *ChainTrie) RangeAllInfos(oneInfosCallback func(oneInfos *common.ChainInfos))
type ChangeChainInfoRequest ¶
type ChangeChainInfoRequest struct { Data *ChainInfoChange Sigs [][]byte // signature list Pubs [][]byte // public key list corresponding to signature one by one }
func (*ChangeChainInfoRequest) DataDeserialize ¶
func (s *ChangeChainInfoRequest) DataDeserialize(vr rtl.ValueReader) error
func (*ChangeChainInfoRequest) DataSerialize ¶
func (s *ChangeChainInfoRequest) DataSerialize(w io.Writer) error
func (*ChangeChainInfoRequest) Deserialization ¶
func (s *ChangeChainInfoRequest) Deserialization(r io.Reader) (shouldBeNil bool, err error)
func (*ChangeChainInfoRequest) GetData ¶
func (s *ChangeChainInfoRequest) GetData() (o interface{}, exist bool)
func (*ChangeChainInfoRequest) GetPubs ¶
func (s *ChangeChainInfoRequest) GetPubs() [][]byte
func (*ChangeChainInfoRequest) GetSigs ¶
func (s *ChangeChainInfoRequest) GetSigs() [][]byte
func (*ChangeChainInfoRequest) Serialization ¶
func (s *ChangeChainInfoRequest) Serialization(w io.Writer) error
func (*ChangeChainInfoRequest) SetPubs ¶
func (s *ChangeChainInfoRequest) SetPubs(pubs [][]byte)
func (*ChangeChainInfoRequest) SetSigs ¶
func (s *ChangeChainInfoRequest) SetSigs(sigs [][]byte)
func (*ChangeChainInfoRequest) String ¶
func (s *ChangeChainInfoRequest) String() string
type Cipher ¶
type Cipher interface { Name() string Sign(priv []byte, hash []byte) (sig []byte, err error) Verify(pub []byte, hash []byte, sig []byte) bool RecoverPub(hash, sig []byte) ([]byte, error) PubFromNodeId(id []byte) []byte PubToNodeIdBytes(pub []byte) ([]byte, error) PubFromPriv(priv []byte) ([]byte, error) ValidateSignatureValues(v byte, r, s *big.Int, homestead bool) bool }
var TKMCipher Cipher
type CommEntries ¶
type CommEntries []*CommEntry
func (CommEntries) Len ¶
func (e CommEntries) Len() int
func (CommEntries) Less ¶
func (e CommEntries) Less(i, j int) bool
func (CommEntries) String ¶
func (e CommEntries) String() string
func (CommEntries) Swap ¶
func (e CommEntries) Swap(i, j int)
type CommEntry ¶
type CommEntry struct { ChainID common.ChainID EpochNum common.EpochNum Comm *EpochAllCommittee }
type Committee ¶
type Committee struct { Members []common.NodeID // contains filtered or unexported fields }
func NewCommittee ¶
func NewCommittee() *Committee
func (*Committee) CopyMembers ¶
func (*Committee) FromPublicKeys ¶
func (*Committee) FullString ¶
func (*Committee) InfoString ¶
func (*Committee) IsAvailable ¶
func (*Committee) IsProposor ¶
func (*Committee) ProposerAt ¶ added in v0.4.0
func (c *Committee) ProposerAt(num common.BlockNum) common.NodeID
func (*Committee) PublicKeys ¶
func (*Committee) ReachRequires ¶
func (*Committee) SetMembers ¶
type CommitteeIndex ¶
type CommitteeIndex struct { // height of the block where the committee has been announced At common.Height // the proof from hash of block at height of last committee announced to current block root hash (history trie) HistoryProof trie.ProofChain // the history height proofed by HistoryProof ProofedHeight common.Height }
preifx+NextEpochNum -> CommitteeIndex(block info of next committee announced) It is used to record the height of the block where the current chain releases the election results of the next consensus committee, and record the proof of the block height Hash recorded by the previous CommitteeIndex to the current block hash. Use this record to generate proof of legality for any consensus committee of current chain.
- currentComm=(genesis committee from a trusted source), currentEpoch=0, lastIndex=index
- index=(CommitteeIndex at currentEpoch+1), check lastIndex.HistoryProof legality
- block=getBlock(index.At), check signatures with currentComm, headerProof=(proof from block.header.ElectedNextRoot to Hash(block.header))
fixme: For compatibility with old data, allow HistoryProof in CommitteeIndex of Epoch>1 to be
nil and ProofedHeight==NilHeight. Because the CommitteeIndex before the upgrade does not exist, the first CommitteeIndex after the upgrade cannot generate the corresponding HistoryProof. Doing so will lead to security breaches. For example, after malicious nodes are replaced with illegal Committee data, HistoryProof is not provided, making the client unable to verify. Only when all the CommitteeIndex starting from Epoch=1 are connected in series with HistoryProof, can the authenticity of the last CommitteeIndex be proved.
func (*CommitteeIndex) String ¶
func (c *CommitteeIndex) String() string
type CompatibleDelta ¶
for compatible with old version hash of AccountDelta TODO delete compatible when restart the chain with new version
type ConfirmedInfo ¶
type ConfirmedInfo struct { // the main chain height confirmed current info By common.Height `json:"main" rtlorder:"0"` // since v2.11.5, the height at which the latest restart committee was confirmed // 1. When the current main chain height exceeds the By field ChainStoppedThreshold, then // By>=RestartConfirmed, enter the sub-chain restart election stage, and prevent repeated // elections through the records in Preelecting // 2. Set RestartConfirmed when the restart committee election is successful, and enter the // sub-chain restart phase. At this time, RestartConfirmed>By. // 3. In the restart phase, when the current main chain height exceeds the ChainStoppedThreshold // of the RestartConfirmed field, it is considered that the restart has failed, and the // sub-chain restart election phase is entered again. // 最近一次重启委员会被确认的高度。 // 1. 当前主链高度超过By字段ChainStoppedThreshold时,此时By>=RestartConfirmed,进入子链重启选举阶段,并通过 // Preelecting中的记录防止重复启动选举 // 2. 重启委员会选举成功时设置LastRestart,进入子链重启阶段,此时LastRestart>By。 // 3. 重启阶段中,当前主链高度超过LastRestart字段ChainStoppedThreshold时,认为重启失败,则再次进入子链 // 重启选举阶段。 RestartConfirmed common.Height `json:"lastRestart" rtlorder:"4"` // last confirmed height Height common.Height `json:"height" rtlorder:"1"` // hash of the last confirmed block which height is the last confirmed height Hob []byte `json:"hob" rtlorder:"2"` // last confirmed epoch for the committee to take effect, should be height.EpochNum() or height.EpochNum()+1 CommEpoch common.EpochNum `json:"commEpoch" rtlorder:"3"` // since v2.12.0, the last confirmed RewardRequest.Epoch LastRewardEpoch *common.EpochNum `json:"rewardEpoch" rtlorder:"5"` // since v2.12.0, record the restarted history of the chain // ReHistories RestartHistories `json:"rehistories" rtlorder:"6"` ReHistoryRoot []byte `json:"rehistoryroot" rtlorder:"6"` // since v2.14.3, Version uint16 `json:"version" rtlorder:"7"` }
func (*ConfirmedInfo) CanProofHob ¶
func (c *ConfirmedInfo) CanProofHob() bool
func (*ConfirmedInfo) Clone ¶
func (c *ConfirmedInfo) Clone() *ConfirmedInfo
func (*ConfirmedInfo) CommConfirmed ¶
func (c *ConfirmedInfo) CommConfirmed() bool
func (*ConfirmedInfo) Compare ¶
func (c *ConfirmedInfo) Compare(o *ConfirmedInfo) int
func (*ConfirmedInfo) Copy ¶
func (c *ConfirmedInfo) Copy() *ConfirmedInfo
func (*ConfirmedInfo) GetHeight ¶ added in v0.4.0
func (c *ConfirmedInfo) GetHeight() common.Height
func (*ConfirmedInfo) GetLastConfirmedBy ¶ added in v0.4.0
func (c *ConfirmedInfo) GetLastConfirmedBy() common.Height
func (*ConfirmedInfo) HashValue ¶
func (c *ConfirmedInfo) HashValue() ([]byte, error)
func (*ConfirmedInfo) InfoString ¶
func (c *ConfirmedInfo) InfoString(level common.IndentLevel) string
func (*ConfirmedInfo) ShouldRestart ¶
func (c *ConfirmedInfo) ShouldRestart(current common.Height) bool
func (*ConfirmedInfo) String ¶
func (c *ConfirmedInfo) String() string
func (*ConfirmedInfo) UnConfirmComm ¶
func (c *ConfirmedInfo) UnConfirmComm()
type ConfirmedSummary ¶
type ConfirmedSummary struct { Block *BlockEMessage // used to generate ConfirmedRoot -> Hash(block) and provides block sigs TrieProof trie.ProofChain // Hash(ConfirmedInfo) -> ConfirmedRoot SubChain common.ChainID Confirmed *ConfirmedInfo // use to generate Hash(confirmed block) -> Hash(ConfirmedInfo) }
func (*ConfirmedSummary) ConfirmedChain ¶
func (s *ConfirmedSummary) ConfirmedChain() common.ChainID
func (*ConfirmedSummary) ConfirmedHeight ¶
func (s *ConfirmedSummary) ConfirmedHeight() common.Height
func (*ConfirmedSummary) ConfirmedHob ¶ added in v0.2.2
func (s *ConfirmedSummary) ConfirmedHob() []byte
func (*ConfirmedSummary) HeaderProof ¶
func (s *ConfirmedSummary) HeaderProof(proofs *trie.ProofChain) (proofedHob []byte, err error)
func (*ConfirmedSummary) MainBlock ¶
func (s *ConfirmedSummary) MainBlock() *BlockEMessage
func (*ConfirmedSummary) MainHeader ¶
func (s *ConfirmedSummary) MainHeader() *BlockHeader
func (*ConfirmedSummary) MainHeight ¶
func (s *ConfirmedSummary) MainHeight() common.Height
func (*ConfirmedSummary) ShortHeaderProof ¶ added in v0.2.2
func (s *ConfirmedSummary) ShortHeaderProof(proofs *trie.ProofChain) error
func (*ConfirmedSummary) String ¶
func (s *ConfirmedSummary) String() string
type ConfirmingProof ¶
type ConfirmingProof interface { ConfirmedChain() common.ChainID ConfirmedHeight() common.Height ConfirmedHob() []byte MainHeight() common.Height MainHeader() *BlockHeader MainBlock() *BlockEMessage // generate a proof from the hash of the confirmed block in sub-chain to the hash of // main-chain block which containing the confirmation. // proofingHob: hash of confirmed block in sub-chain // proofedHob: hash of main-chain block contains the confirmation HeaderProof(proofs *trie.ProofChain) (proofedHob []byte, err error) ShortHeaderProof(proofs *trie.ProofChain) error String() string }
type ConsNodeRewardExtra ¶
type ConsNodeRewardExtra struct { Type common.NodeType `json:"type"` // reward type == node type ChainID common.ChainID `json:"chain"` // chain Epoch common.EpochNum `json:"epoch"` // epoch the node in the committee Turn int `json:"turn"` // position in committee Blocks int `json:"block"` // number of block proposed by this node in this epoch Fault int `json:"fault"` // number of empty blocks occurs by this node in the epoch Units string `json:"units"` // rat string of deposit unit count }
func NewConsNodeRewardExtra ¶
func NewConsNodeRewardExtra(chainid common.ChainID, epoch common.EpochNum, pos, blocks, empties int, unitCount *big.Rat) *ConsNodeRewardExtra
type ConsensusContext ¶ added in v0.4.0
type ConsensusContext struct { ChainID common.ChainID Stage ConsensusStage Reviving bool // reviving consensus Replaying bool // replaying blocks in data node Syncing bool // syncing blocks for get world state of the chain }
func (*ConsensusContext) RealTime ¶ added in v0.4.0
func (ctx *ConsensusContext) RealTime() bool
func (*ConsensusContext) Restoring ¶ added in v0.4.0
func (ctx *ConsensusContext) Restoring() bool
func (*ConsensusContext) SetCommitting ¶ added in v0.4.0
func (ctx *ConsensusContext) SetCommitting() *ConsensusContext
func (*ConsensusContext) SetPreparing ¶ added in v0.4.0
func (ctx *ConsensusContext) SetPreparing() *ConsensusContext
func (*ConsensusContext) SetProposing ¶ added in v0.4.0
func (ctx *ConsensusContext) SetProposing() *ConsensusContext
func (*ConsensusContext) String ¶ added in v0.4.0
func (ctx *ConsensusContext) String() string
type ConsensusStage ¶ added in v0.4.0
type ConsensusStage uint8
const ( CSProposing ConsensusStage = iota CSPreparing CSCommitting )
func (ConsensusStage) Committing ¶ added in v0.4.0
func (s ConsensusStage) Committing() bool
func (ConsensusStage) Preparing ¶ added in v0.4.0
func (s ConsensusStage) Preparing() bool
func (ConsensusStage) Proposing ¶ added in v0.4.0
func (s ConsensusStage) Proposing() bool
func (ConsensusStage) Short ¶ added in v0.4.0
func (s ConsensusStage) Short() string
func (ConsensusStage) String ¶ added in v0.4.0
func (s ConsensusStage) String() string
type ContractLogger ¶
type ContractLogger interface { Register(address common.Address, ab abi.ABI) Has(address *common.Address) bool InputString(address common.Address, input []byte) string ReturnsString(address common.Address, funcSig []byte, output []byte) string EventString(address common.Address, txLog *Log) string FindAbi(address common.Address) (abi.ABI, bool) }
var SysContractLogger ContractLogger
type CreateResult ¶
type CreateResult struct { TxHash common.Hash `json:"-"` NIDH common.Hash `json:"nidh"` Addr common.Address `json:"binding"` Amount *big.Int `json:"amount"` }
func (*CreateResult) Receipt ¶
func (r *CreateResult) Receipt() *RRActReceipt
func (*CreateResult) String ¶
func (r *CreateResult) String() string
type DataNodeRewardExtra ¶
type DataNodeRewardExtra struct { Type common.NodeType `json:"type"` // reward type == node type Era common.EraNum `json:"era"` Nidh common.Hash `json:"nidh"` OldAmount *big.Int `json:"-"` NewAmount *big.Int `json:"-"` Ratio *big.Rat `json:"-"` Reward *big.Int `json:"-"` OldAmountStr string `json:"oldamount"` NewAmountStr string `json:"newamount"` RatioStr string `json:"ratio"` }
func NewDataNodeRewardExtra ¶
func (*DataNodeRewardExtra) String ¶
func (e *DataNodeRewardExtra) String() string
type DataRequester ¶
type DelegateResult ¶
type DelegateResult struct { TxHash common.Hash `json:"-"` Type ActRptType `json:"-"` NIDH common.Hash `json:"nidh"` Prev *big.Int `json:"pervAmount,omitempty"` New *big.Int `json:"newAmount,omitempty"` }
func (*DelegateResult) Receipt ¶
func (r *DelegateResult) Receipt() *RRActReceipt
func (*DelegateResult) String ¶
func (r *DelegateResult) String() string
type DeltaFrom ¶
type DeltaFrom struct { Key DeltaFromKey Deltas []*AccountDelta }
type DeltaFromKey ¶
type DeltaFromKey struct { ShardID common.ChainID Height common.Height }
func BytesToDeltaFromKey ¶
func BytesToDeltaFromKey(bytes []byte) DeltaFromKey
func (DeltaFromKey) Bytes ¶
func (d DeltaFromKey) Bytes() []byte
func (DeltaFromKey) Cmp ¶
func (d DeltaFromKey) Cmp(to DeltaFromKey) int
func (DeltaFromKey) String ¶
func (d DeltaFromKey) String() string
type DeltaFroms ¶
type DeltaFroms []DeltaFrom
func (DeltaFroms) Len ¶
func (f DeltaFroms) Len() int
func (DeltaFroms) Less ¶
func (f DeltaFroms) Less(i, j int) bool
func (DeltaFroms) Summary ¶
func (f DeltaFroms) Summary() string
func (DeltaFroms) Swap ¶
func (f DeltaFroms) Swap(i, j int)
type DeltaRequestMessage ¶
type DeltaRequestMessage struct { FromID common.ChainID // source chain of requested delta ToID common.ChainID // target chain of requested delta Start common.Height // The starting height of the source chain where the requested delta is located Length int // The number of delta requested, starting from start (including start) }
func (*DeltaRequestMessage) A ¶
func (m *DeltaRequestMessage) A() common.Height
func (*DeltaRequestMessage) B ¶
func (m *DeltaRequestMessage) B() common.Height
func (*DeltaRequestMessage) DestChainID ¶
func (m *DeltaRequestMessage) DestChainID() common.ChainID
func (*DeltaRequestMessage) GetChainID ¶
func (m *DeltaRequestMessage) GetChainID() common.ChainID
func (*DeltaRequestMessage) String ¶
func (m *DeltaRequestMessage) String() string
type DeltasGroup ¶
type DeltasGroup []*OneDeltas
Pack deltas generated by multiple blocks together. It is sent to the target chain at one time. Proof chain:root of the trie generated with deltas in block A (1)-> A.BalanceDeltaRoot (2)-> A.BlockHeader.Hash
(3)-> current block B.HashHistory (4)-> B.BlockHeader.Hash (5)-> (block C in main chain which confirmed block B).HdsRoot (6)-> C.BlockHeader.Hash
func (DeltasGroup) Len ¶
func (g DeltasGroup) Len() int
func (DeltasGroup) Less ¶
func (g DeltasGroup) Less(i, j int) bool
func (DeltasGroup) Summary ¶
func (g DeltasGroup) Summary() string
func (DeltasGroup) Swap ¶
func (g DeltasGroup) Swap(i, j int)
type DeltasPack ¶
type DeltasPack struct { FromID common.ChainID // source chain id ToChainID common.ChainID // target shard id ProofedHeight common.Height // block B of source shard was confirmed by the main chain ProofToMain trie.ProofChain // proof from B.Hash to C.Hash MainHeight common.Height // the height of main chain block C which packed and confirmed block B Pack DeltasGroup // deltas of each block from source chain }
ProofToMain.Proof(BlockHash of ProofedHeight) == BlockHash of MainHeight (5)(6)
func (*DeltasPack) DestChainID ¶
func (d *DeltasPack) DestChainID() common.ChainID
func (*DeltasPack) GetChainID ¶
func (d *DeltasPack) GetChainID() common.ChainID
func (*DeltasPack) String ¶
func (d *DeltasPack) String() string
type DepositResult ¶
type DepositResult struct { TxHash common.Hash `json:"-"` Type ActRptType `json:"-"` NIDH common.Hash `json:"nidh"` Addr common.Address `json:"address"` Prev *big.Int `json:"pervAmount,omitempty"` New *big.Int `json:"newAmount,omitempty"` }
func (*DepositResult) Receipt ¶
func (r *DepositResult) Receipt() *RRActReceipt
func (*DepositResult) String ¶
func (r *DepositResult) String() string
type DynamicFeeTx ¶
type DynamicFeeTx struct { ChainID *big.Int Nonce uint64 GasTipCap *big.Int GasFeeCap *big.Int Gas uint64 To *common.Address `rlp:"nil"` // nil means contract creation Value *big.Int Data []byte AccessList AccessList // Signature values V *big.Int `json:"v" gencodec:"required"` R *big.Int `json:"r" gencodec:"required"` S *big.Int `json:"s" gencodec:"required"` }
type EIP155Signer ¶
type EIP155Signer struct { }
EIP155Signer implements Signer using the EIP-155 rules. This accepts transactions which are replay-protected as well as unprotected homestead transactions.
func NewEIP155Signer ¶
func NewEIP155Signer() EIP155Signer
func NewEIP155Signer(chainId *big.Int) EIP155Signer {
func (EIP155Signer) Equal ¶
func (s EIP155Signer) Equal(s2 Signer) bool
func (EIP155Signer) Hash ¶
func (s EIP155Signer) Hash(tx *ETHTransaction) common.Hash
Hash returns the hash to be signed by the sender. It does not uniquely identify the transaction.
func (EIP155Signer) HashGtkm ¶
func (s EIP155Signer) HashGtkm(tx *Transaction) common.Hash
HashGtkm returns the hash to be signed by the sender. It does not uniquely identify the transaction.
func (EIP155Signer) HashGtkmWithSig ¶
func (s EIP155Signer) HashGtkmWithSig(tx *Transaction) common.Hash
HashGtkmWithSig returns the hash to be signed by the sender. It does not uniquely identify the transaction.
func (EIP155Signer) RecoverSigAndPub ¶
func (s EIP155Signer) RecoverSigAndPub(tx *ETHTransaction) (sig, pub []byte, err error)
func (EIP155Signer) Sender ¶
func (s EIP155Signer) Sender(tx *ETHTransaction) (common.Address, error)
func (EIP155Signer) SignatureValues ¶
func (s EIP155Signer) SignatureValues(ethChainid *big.Int, txType byte, sig []byte) (R, S, V *big.Int, err error)
SignatureValues returns signature values. This signature needs to be in the [R || S || V] format where V is 0 or 1.
type ETHTransaction ¶
type ETHTransaction struct {
// contains filtered or unexported fields
}
ETHTransaction is an Ethereum transaction.
func (*ETHTransaction) AccessList ¶
func (tx *ETHTransaction) AccessList() AccessList
AccessList returns the access list of the transaction.
func (*ETHTransaction) ChainId ¶
func (tx *ETHTransaction) ChainId() *big.Int
ChainId returns the EIP155 chain ID of the transaction. The return value will always be non-nil. For legacy transactions which are not replay-protected, the return value is zero.
func (*ETHTransaction) Data ¶
func (tx *ETHTransaction) Data() []byte
Data returns the input data of the transaction.
func (*ETHTransaction) From ¶
func (tx *ETHTransaction) From() *common.Address
func (*ETHTransaction) Gas ¶
func (tx *ETHTransaction) Gas() uint64
Gas returns the gas limit of the transaction.
func (*ETHTransaction) GasFeeCap ¶
func (tx *ETHTransaction) GasFeeCap() *big.Int
GasFeeCap returns the fee cap per gas of the transaction.
func (*ETHTransaction) GasPrice ¶
func (tx *ETHTransaction) GasPrice() *big.Int
GasPrice returns the gas price of the transaction.
func (*ETHTransaction) GasTipCap ¶
func (tx *ETHTransaction) GasTipCap() *big.Int
GasTipCap returns the gasTipCap per gas of the transaction.
func (*ETHTransaction) GetSigner ¶
func (tx *ETHTransaction) GetSigner() Signer
func (*ETHTransaction) HasSignatureValues ¶
func (tx *ETHTransaction) HasSignatureValues() (v, r, s *big.Int, exist bool)
func (*ETHTransaction) Hash ¶
func (tx *ETHTransaction) Hash() common.Hash
Hash returns the transaction hash. should same with Transaction.Hash()
func (*ETHTransaction) HashValue ¶
func (tx *ETHTransaction) HashValue() ([]byte, error)
Signer is different with Signer in ethereum. there's no chainid in it. If LegacyTx does not have a legal (V,R,S), the calculation of signature hash will be wrong. Therefore, ETHTransaction does not support signature operations, and therefore the Signer.Hash method is deleted
func (*ETHTransaction) MarshalBinary ¶
func (tx *ETHTransaction) MarshalBinary() ([]byte, error)
func (*ETHTransaction) Nonce ¶
func (tx *ETHTransaction) Nonce() uint64
Nonce returns the sender account nonce of the transaction.
func (*ETHTransaction) Protected ¶
func (tx *ETHTransaction) Protected() bool
Protected says whether the transaction is replay-protected.
func (*ETHTransaction) RawSignatureValues ¶
func (tx *ETHTransaction) RawSignatureValues() (v, r, s *big.Int)
func (*ETHTransaction) To ¶
func (tx *ETHTransaction) To() *common.Address
To returns the recipient address of the transaction. For contract-creation transactions, To returns nil.
func (*ETHTransaction) ToTransaction ¶
func (tx *ETHTransaction) ToTransaction() (*Transaction, error)
func (*ETHTransaction) Type ¶
func (tx *ETHTransaction) Type() uint8
Type returns the transaction type.
func (*ETHTransaction) UnmarshalBinary ¶
func (tx *ETHTransaction) UnmarshalBinary(b []byte) error
func (*ETHTransaction) Value ¶
func (tx *ETHTransaction) Value() *big.Int
Value returns the ether amount of the transaction.
type ElectMessage ¶
type ElectMessage struct { // EpochNum is the current epoch number // I.e., the elected committee is for epoch EpochNum+1 EpochNum common.EpochNum `json:"epoch"` // the epoch when election starts ElectChainID common.ChainID `json:"chainid"` // contains filtered or unexported fields }
func (*ElectMessage) GetChainID ¶
func (p *ElectMessage) GetChainID() common.ChainID
func (*ElectMessage) GetHeader ¶ added in v0.4.0
func (p *ElectMessage) GetHeader() *BlockHeader
func (*ElectMessage) Hash ¶
func (p *ElectMessage) Hash() common.Hash
func (*ElectMessage) SetHeader ¶ added in v0.4.0
func (p *ElectMessage) SetHeader(header *BlockHeader)
func (*ElectMessage) String ¶
func (p *ElectMessage) String() string
type ElectMessages ¶
type ElectMessages []*ElectMessage
func (ElectMessages) InfoString ¶
func (s ElectMessages) InfoString(level common.IndentLevel) string
func (ElectMessages) String ¶
func (s ElectMessages) String() string
type ElectResult ¶
type ElectResult struct { NodeID common.NodeID // Node ID participating in the election ChainID common.ChainID // Election chain Epoch common.EpochNum // Epoch of the election Sorthash *common.Hash // The result of the VRF algorithm Proof []byte // Proof of VRF algorithm results RRProof *RRProofs // The proof of the deposit of the nodes participating in the election }
Election results in a unified format, used when transmitting separately In order to be compatible with VRFResultEMessage, the format is compatible
func (*ElectResult) FromResulter ¶
func (r *ElectResult) FromResulter(resulter ElectResulter) *ElectResult
func (*ElectResult) GetChainID ¶
func (r *ElectResult) GetChainID() common.ChainID
func (*ElectResult) GetElectingChainID ¶
func (r *ElectResult) GetElectingChainID() common.ChainID
func (*ElectResult) GetEpochNum ¶
func (r *ElectResult) GetEpochNum() common.EpochNum
func (*ElectResult) GetNodeID ¶
func (r *ElectResult) GetNodeID() common.NodeID
func (*ElectResult) GetRRProof ¶
func (r *ElectResult) GetRRProof() *RRProofs
func (*ElectResult) GetVrfResult ¶
func (r *ElectResult) GetVrfResult() (*common.Hash, []byte, *common.Hash, uint32)
func (*ElectResult) IsPreElecting ¶
func (r *ElectResult) IsPreElecting() bool
func (*ElectResult) String ¶
func (r *ElectResult) String() string
type ElectResulter ¶
type ElectResulter interface { // The chain ID where the election occurs should be distinguished from the GetChainID() // method of the ChainEvent interface GetElectingChainID() common.ChainID // The Epoch where the election took place, the value of the pre-election is NilEpoch GetEpochNum() common.EpochNum VrfResulter }
Election result interface
type ElectResults ¶
type ElectResults []*ElectResult
func (ElectResults) HashValue ¶
func (rs ElectResults) HashValue() ([]byte, error)
func (ElectResults) Len ¶
func (rs ElectResults) Len() int
func (ElectResults) Less ¶
func (rs ElectResults) Less(i, j int) bool
sorted by (ChainID, EpochNum, Sorthash, NodeID)
func (ElectResults) Swap ¶
func (rs ElectResults) Swap(i, j int)
func (ElectResults) ToPreElectMap ¶
func (rs ElectResults) ToPreElectMap() map[common.ChainID]map[common.NodeID]*ElectResult
type ElectingName ¶
type ElectingName string
func (ElectingName) String ¶
func (n ElectingName) String() string
type EpochAllCommittee ¶
type EpochAllCommittee struct { Result *Committee Real *Committee Restarted RestartComms // restarted comm list if exist }
the type persisted in database, compatible with serialized data of EpochCommittee in database
func NewEpochAllComm ¶
func NewEpochAllComm(result *Committee, current *Committee) *EpochAllCommittee
func (*EpochAllCommittee) AddReComm ¶
func (c *EpochAllCommittee) AddReComm(start, elected common.Height, comm *Committee) (changed bool, err error)
func (*EpochAllCommittee) AppendReComm ¶
func (c *EpochAllCommittee) AppendReComm(start common.Height, elected common.Height, comm *Committee) error
func (*EpochAllCommittee) Clone ¶
func (c *EpochAllCommittee) Clone() *EpochAllCommittee
func (*EpochAllCommittee) CommAt ¶
func (c *EpochAllCommittee) CommAt(height common.Height) (*Committee, error)
func (*EpochAllCommittee) CommGetAndCompare ¶
func (c *EpochAllCommittee) CommGetAndCompare(last, current common.Height) (comm *Committee, changed bool, err error)
Returns the committee corresponding to the current height, and returns whether the committee corresponding to the two heights has changed
func (*EpochAllCommittee) Compare ¶
func (c *EpochAllCommittee) Compare(o *EpochAllCommittee) int
func (*EpochAllCommittee) Equal ¶
func (c *EpochAllCommittee) Equal(o *EpochAllCommittee) bool
func (*EpochAllCommittee) FirstComm ¶
func (c *EpochAllCommittee) FirstComm() *Committee
func (*EpochAllCommittee) From ¶
func (c *EpochAllCommittee) From(ec *EpochCommittee) *EpochAllCommittee
func (*EpochAllCommittee) InfoString ¶
func (c *EpochAllCommittee) InfoString(level common.IndentLevel) string
func (*EpochAllCommittee) IsAvailable ¶
func (c *EpochAllCommittee) IsAvailable() bool
func (*EpochAllCommittee) LastComm ¶
func (c *EpochAllCommittee) LastComm() (startAt common.Height, comm *Committee)
func (*EpochAllCommittee) String ¶
func (c *EpochAllCommittee) String() string
func (*EpochAllCommittee) ToNormalComm ¶
func (c *EpochAllCommittee) ToNormalComm() *EpochCommittee
type EpochCommittee ¶
type EpochCommittee struct { Result *Committee // actual election results Real *Committee // the final result, if Result.IsAvailable()==false, then Real is the actual Committee. Otherwise, it is nil }
the type in Event (BlockReport/BlockSummary)
func NewEpochComm ¶
func NewEpochComm(result *Committee, current *Committee) *EpochCommittee
func (*EpochCommittee) Clone ¶
func (c *EpochCommittee) Clone() *EpochCommittee
func (*EpochCommittee) Comm ¶
func (c *EpochCommittee) Comm() *Committee
func (*EpochCommittee) Equal ¶
func (c *EpochCommittee) Equal(o *EpochCommittee) bool
func (*EpochCommittee) Hash ¶
func (c *EpochCommittee) Hash(blockVersion uint16) common.Hash
used for generating BlockHeader.ElectedNextRoot
func (*EpochCommittee) InfoString ¶
func (c *EpochCommittee) InfoString(level common.IndentLevel) string
func (*EpochCommittee) IsAvailable ¶
func (c *EpochCommittee) IsAvailable() bool
func (*EpochCommittee) IsEmpty ¶
func (c *EpochCommittee) IsEmpty() bool
func (*EpochCommittee) String ¶
func (c *EpochCommittee) String() string
type Extra ¶
type Extra struct { Type byte `json:"type"` Gas uint64 `json:"gas"` GasPrice *big.Int `json:"gasPrice,omitempty"` // wei per gas GasTipCap *big.Int `json:",omitempty"` GasFeeCap *big.Int `json:",omitempty"` AccessList AccessList `json:",omitempty"` V *big.Int `json:",omitempty"` // V=v+35+2*ethChainId if Type==0, V=v if Type==1 or Type==2, (v==0||v==1) R *big.Int `json:",omitempty"` S *big.Int `json:",omitempty"` TkmExtra []byte `json:",omitempty"` }
func (*Extra) GetTkmExtra ¶
func (*Extra) SetTkmExtra ¶
type FrontierSigner ¶
type FrontierSigner struct{}
func (FrontierSigner) ChainID ¶
func (f FrontierSigner) ChainID() *big.Int
func (FrontierSigner) Equal ¶
func (f FrontierSigner) Equal(s2 Signer) bool
func (FrontierSigner) Hash ¶
func (f FrontierSigner) Hash(tx *ETHTransaction) common.Hash
Hash returns the hash to be signed by the sender. It does not uniquely identify the transaction.
func (FrontierSigner) HashGtkm ¶
func (f FrontierSigner) HashGtkm(tx *Transaction) common.Hash
HashGtkm returns the hash to be signed by the sender. It does not uniquely identify the transaction.
func (FrontierSigner) HashGtkmWithSig ¶
func (f FrontierSigner) HashGtkmWithSig(tx *Transaction) common.Hash
HashGtkm returns the hash to be signed by the sender. It does not uniquely identify the transaction.
func (FrontierSigner) RecoverSig ¶
func (f FrontierSigner) RecoverSig(tx *ETHTransaction) (sig []byte)
func (FrontierSigner) RecoverSigAndPub ¶
func (f FrontierSigner) RecoverSigAndPub(tx *ETHTransaction) (sig, pub []byte, err error)
func (FrontierSigner) Sender ¶
func (f FrontierSigner) Sender(tx *ETHTransaction) (common.Address, error)
func (FrontierSigner) SignatureValues ¶
func (f FrontierSigner) SignatureValues(ethChainid *big.Int, txType byte, sig []byte) (r, s, v *big.Int, err error)
SignatureValues returns signature values. This signature needs to be in the [R || S || V] format where V is 0 or 1.
type HdsSummary ¶ added in v0.2.2
type HdsSummary struct { Block *BlockEMessage Summaries []*BlockSummary SubChain common.ChainID Height common.Height Index int }
func MakeHdsSummary ¶ added in v0.2.2
func MakeHdsSummary(mainBlock *BlockEMessage, subId common.ChainID, height common.Height) (*HdsSummary, error)
func (*HdsSummary) ConfirmedChain ¶ added in v0.2.2
func (s *HdsSummary) ConfirmedChain() common.ChainID
func (*HdsSummary) ConfirmedHeight ¶ added in v0.2.2
func (s *HdsSummary) ConfirmedHeight() common.Height
func (*HdsSummary) ConfirmedHob ¶ added in v0.2.2
func (s *HdsSummary) ConfirmedHob() []byte
func (*HdsSummary) HeaderProof ¶ added in v0.2.2
func (s *HdsSummary) HeaderProof(proofChain *trie.ProofChain) (proofedHob []byte, err error)
HeaderProof Get the proof from a packaged HdsSummary in the current block to the hash of this block
func (*HdsSummary) MainBlock ¶ added in v0.2.2
func (s *HdsSummary) MainBlock() *BlockEMessage
func (*HdsSummary) MainHeader ¶ added in v0.2.2
func (s *HdsSummary) MainHeader() *BlockHeader
func (*HdsSummary) MainHeight ¶ added in v0.2.2
func (s *HdsSummary) MainHeight() common.Height
func (*HdsSummary) ShortHeaderProof ¶ added in v0.2.2
func (s *HdsSummary) ShortHeaderProof(proofChain *trie.ProofChain) error
func (*HdsSummary) String ¶ added in v0.2.2
func (s *HdsSummary) String() string
type HistoryBlock ¶
type HistoryBlock struct {
Block *BlockEMessage
}
func (*HistoryBlock) BlockNum ¶
func (b *HistoryBlock) BlockNum() common.BlockNum
func (*HistoryBlock) EpochNum ¶
func (b *HistoryBlock) EpochNum() common.EpochNum
func (*HistoryBlock) GetChainID ¶
func (b *HistoryBlock) GetChainID() common.ChainID
func (*HistoryBlock) GetHeight ¶
func (b *HistoryBlock) GetHeight() common.Height
func (*HistoryBlock) Hash ¶
func (b *HistoryBlock) Hash() common.Hash
func (*HistoryBlock) String ¶
func (b *HistoryBlock) String() string
type HistoryProof ¶
type HistoryProof trie.ProofChain
func (HistoryProof) InfoString ¶
func (p HistoryProof) InfoString(level common.IndentLevel) string
func (HistoryProof) String ¶
func (p HistoryProof) String() string
type HomesteadSigner ¶
type HomesteadSigner struct{ FrontierSigner }
HomesteadSigner HomesteadTransaction implements TransactionInterface using the homestead rules.
func (HomesteadSigner) ChainID ¶
func (h HomesteadSigner) ChainID() *big.Int
func (HomesteadSigner) Equal ¶
func (h HomesteadSigner) Equal(s2 Signer) bool
func (HomesteadSigner) RecoverSigAndPub ¶
func (h HomesteadSigner) RecoverSigAndPub(tx *ETHTransaction) (sig, pub []byte, err error)
func (HomesteadSigner) Sender ¶
func (h HomesteadSigner) Sender(tx *ETHTransaction) (common.Address, error)
func (HomesteadSigner) SignatureValues ¶
func (h HomesteadSigner) SignatureValues(ethChainid *big.Int, txType byte, sig []byte) (r, s, v *big.Int, err error)
SignatureValues returns signature values. This signature needs to be in the [R || S || V] format where V is 0 or 1.
type KeccakState ¶
KeccakState wraps sha3.state. In addition to the usual hash methods, it also supports Read to get a variable amount of data from the hash state. Read is faster than Sum because it doesn't copy the internal state, but also modifies the internal state.
type LegacyTx ¶
type LegacyTx struct { Nonce uint64 // nonce of sender account GasPrice *big.Int // wei per gas Gas uint64 // gas limit To *common.Address `rlp:"nil"` // nil means contract creation Value *big.Int // wei amount Data []byte // contract invocation input data V, R, S *big.Int // signature values }
为了使ETHSigner无状态,Signer中的chainId被取消。因此,当VRS信息不全时,会导致LegacyTx的chainID()和Hash()方法的错误 Hash()方法返回错误的signature hash值,会影响签名等一系列问题。 所以,在GTKM中,LegacyTx只能存储有签名的完全信息。这一点,由所有创建ETHTransaction的地方确保。 需要签名时,可以使用Transaction对象 LegacyTx is the transaction data of regular Ethereum transactions.
type Log ¶
type Log struct { // Consensus fields: // address of the contract that generated the event Address common.Address `json:"address" gencodec:"required"` // list of topics provided by the contract. Topics []common.Hash `json:"topics" gencodec:"required"` // supplied by the contract, usually ABI-encoded Data []byte `json:"data" gencodec:"required"` // Derived fields. These fields are filled in by the node // but not secured by consensus. // block in which the transaction was included BlockNumber uint64 `json:"blockNumber" gencodec:"required"` // hash of the transaction TxHash common.Hash `json:"transactionHash" gencodec:"required"` // index of the transaction in the block TxIndex uint `json:"transactionIndex" gencodec:"required"` // index of the log in the receipt Index uint `json:"logIndex" gencodec:"required"` // hash of the block in which the transaction was included BlockHash *common.Hash `json:"blockHash"` }
func (*Log) InfoString ¶
func (*Log) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type MChainBootNode ¶
type MChainBootNode struct { NodeID []byte `abi:"nodeId"` IP string `abi:"ip"` BPort uint16 `abi:"bport"` CPort0 uint16 `abi:"cport0"` CPort1 uint16 `abi:"cport1"` DPort0 uint16 `abi:"dport0"` DPort1 uint16 `abi:"dport1"` RPort uint16 `abi:"rport"` }
func DataserverToBootNode ¶
func DataserverToBootNode(server common.Dataserver) MChainBootNode
func DataserversToBootNodes ¶
func DataserversToBootNodes(servers []common.Dataserver) []MChainBootNode
func (MChainBootNode) InfoString ¶
func (n MChainBootNode) InfoString(level common.IndentLevel) string
func (MChainBootNode) ToDataserver ¶
func (n MChainBootNode) ToDataserver(chainId common.ChainID) (*common.Dataserver, error)
type MChainBootNodeShouldBe ¶
type MChainCommInput ¶
type MChainDataNodeShouldBe ¶
type MChainInfoInput ¶
type MChainInfoInput struct { ID uint32 `abi:"id"` ParentChain uint32 `abi:"parentChain"` CoinID uint16 `abi:"coinId"` CoinName string `abi:"coinName"` Admins [][]byte `abi:"adminPubs"` GenesisCommIds [][]byte `abi:"genesisCommIds"` BootNodes []MChainBootNode `abi:"bootNodes"` ElectionType string `abi:"electionType"` ChainVersion string `abi:"chainVersion"` GenesisDatas [][]byte `abi:"genesisDatas"` RRProofs [][]byte `abi:"rrProofs"` Attrs []string `abi:"attrs"` }
func (*MChainInfoInput) ToChainInfo ¶
func (req *MChainInfoInput) ToChainInfo(mode common.ChainMode) (*common.ChainInfos, error)
func (*MChainInfoInput) VerifyProofs ¶
func (req *MChainInfoInput) VerifyProofs(rrRoot common.Hash) error
type MChainInfoInputShouldBe ¶
type MChainInfoInputShouldBe struct { ID uint32 `abi:"id"` ParentChain uint32 `abi:"parentChain"` CoinID uint16 `abi:"coinId"` CoinName string `abi:"coinName"` Admins [][]byte `abi:"adminPubs"` BootNodes []MChainBootNodeShouldBe `abi:"bootNodes"` ElectionType string `abi:"electionType"` ChainVersion string `abi:"chainVersion"` GenesisDatas []MChainDataNodeShouldBe `abi:"genesisDatas"` RRProofs [][]byte `abi:"rrProofs"` Attrs []string `abi:"attrs"` }
type MChainInfoOutput ¶
type MChainInfoOutput struct { ID uint32 `abi:"id"` ParentChain uint32 `abi:"parentChain"` Mode string `abi:"mode"` CoinID uint16 `abi:"coinId"` CoinName string `abi:"coinName"` Admins [][]byte `abi:"adminPubs"` GenesisCommIds [][]byte `abi:"genesisCommIds"` BootNodes []MChainBootNode `abi:"bootNodes"` ElectionType string `abi:"electionType"` ChainVersion string `abi:"chainVersion"` GenesisDatas [][]byte `abi:"genesisDatas"` DataNodeIds [][]byte `abi:"dataNodeIds"` Attrs []string `abi:"attrs"` }
func ChainInfosToOutput ¶
func ChainInfosToOutput(infos *common.ChainInfos) (output MChainInfoOutput)
func (*MChainInfoOutput) InfoString ¶
func (o *MChainInfoOutput) InfoString(level common.IndentLevel) string
type MChainInfoOutputShouldBe ¶
type MChainInfoOutputShouldBe struct { ID uint32 `abi:"id"` ParentChain uint32 `abi:"parentChain"` Mode string `abi:"mode"` CoinID uint16 `abi:"coinId"` CoinName string `abi:"coinName"` Admins [][]byte `abi:"adminPubs"` GenesisCommIds [][]byte `abi:"genesisCommIds"` BootNodes []MChainBootNodeShouldBe `abi:"bootNodes"` ElectionType string `abi:"electionType"` ChainVersion string `abi:"chainVersion"` DataNodeIds []MChainDataNodeShouldBe `abi:"dataNodeIds"` Attrs []string `abi:"attrs"` }
type MaliciousError ¶
type MaliciousError struct {
// contains filtered or unexported fields
}
func (*MaliciousError) Error ¶
func (m *MaliciousError) Error() string
type MaliciousType ¶
type MaliciousType int
type MappingType ¶ added in v0.4.0
type MappingType byte
const ( MT_MAIN MappingType = 0 MT_MAPPING MappingType = 1 )
func (MappingType) IsValid ¶ added in v0.4.0
func (e MappingType) IsValid() bool
func (MappingType) String ¶ added in v0.4.0
func (e MappingType) String() string
func (MappingType) ToBig ¶ added in v0.4.0
func (e MappingType) ToBig() *big.Int
type MissingHeights ¶
type MissingHeights map[common.ChainID][2]uint64
shardid -> [0]:start height, [1]:length of missing heights
func (MissingHeights) Get ¶
func (m MissingHeights) Get(id common.ChainID) (start common.Height, length int, exist bool)
func (MissingHeights) IDs ¶
func (m MissingHeights) IDs() common.ChainIDs
func (MissingHeights) MostUrgent ¶
func (m MissingHeights) MostUrgent() (id common.ChainID, start common.Height, length int, exist bool)
func (MissingHeights) Put ¶
func (m MissingHeights) Put(id common.ChainID, start common.Height, length int)
type NodeAddresses ¶
type NodeAddresses struct { NIDH common.Hash Addrs []common.Address }
func (*NodeAddresses) Compare ¶
func (n *NodeAddresses) Compare(o *NodeAddresses) int
func (*NodeAddresses) String ¶
func (n *NodeAddresses) String() string
type NodeAddressesList ¶
type NodeAddressesList []*NodeAddresses
func (NodeAddressesList) String ¶
func (l NodeAddressesList) String() string
func (NodeAddressesList) ToMap ¶
func (l NodeAddressesList) ToMap() map[common.Hash][]common.Address
type NodeResult ¶
type NodeResult struct { NodeID common.NodeID // The ID of the node participating in the election. For ManagedComm, only this field is needed, and the other fields are empty Sorthash *common.Hash // The result of the VRF algorithm Proof []byte // Proof of VRF algorithm results RRProof *RRProofs // The proof of the deposit of the nodes participating in the election FactorHash *common.Hash // since v2.0.0 The node declares the hash of the random factor participating in the seed calculation RandNum uint32 // since v2.10.12 }
Because the ChainID/Epoch information is missing, it cannot be used alone and needs to be used in conjunction with ChainElectResult
func (*NodeResult) Clone ¶
func (n *NodeResult) Clone() *NodeResult
func (*NodeResult) Equal ¶
func (n *NodeResult) Equal(o *NodeResult) bool
func (*NodeResult) FromVrfResulter ¶
func (n *NodeResult) FromVrfResulter(resulter VrfResulter) *NodeResult
func (*NodeResult) GetNodeID ¶
func (n *NodeResult) GetNodeID() common.NodeID
func (*NodeResult) GetRRProof ¶
func (n *NodeResult) GetRRProof() *RRProofs
func (*NodeResult) GetVrfResult ¶
func (n *NodeResult) GetVrfResult() (sorthash *common.Hash, proof []byte, factorHash *common.Hash, randNum uint32)
func (*NodeResult) String ¶
func (n *NodeResult) String() string
type NodeResults ¶
type NodeResults []*NodeResult
func (NodeResults) AgreeWith ¶
func (ns NodeResults) AgreeWith(os NodeResults) error
func (NodeResults) Clone ¶
func (ns NodeResults) Clone() NodeResults
func (NodeResults) Equal ¶
func (ns NodeResults) Equal(os NodeResults) bool
func (NodeResults) Len ¶
func (ns NodeResults) Len() int
func (NodeResults) Less ¶
func (ns NodeResults) Less(i, j int) bool
func (NodeResults) ManagedCommVerifyAll ¶
func (ns NodeResults) ManagedCommVerifyAll(nidHashes []common.Hash) error
func (NodeResults) Remove ¶
func (ns NodeResults) Remove(os NodeResults) NodeResults
the difference of ns - os
func (NodeResults) Swap ¶
func (ns NodeResults) Swap(i, j int)
func (NodeResults) ToMap ¶
func (ns NodeResults) ToMap() map[common.NodeID]*NodeResult
type NodeState ¶
type NodeState struct { NodeId common.NodeID ChainId common.ChainID Height common.Height BlockSig []byte Ip string BasicPort uint16 DataPort uint16 ConPort0 uint16 ConPort1 uint16 }
func (*NodeState) GetChainID ¶
func (b *NodeState) GetChainID() common.ChainID
type OneDeltas ¶
type OneDeltas struct { // the height of the block A where delta generated Height common.Height // All deltas in a block corresponding to a shard to another shard Deltas []*AccountDelta // The proof of this group of delta to the hash of block A at Height (1)(2) Proof trie.ProofChain // The proof to HashHistory of block B (specified by DeltasPack) used in this transmission (3). // You can use this proof.Key() judge the authenticity of Height. When Height==DeltasPack.ProofedHeight, // this proof is nil. At this time, verify with ProofedHeight in DeltasPack. // 到本次传输统一使用的块B(由DeltasPack指定)的HashHistory的证明(3)。可以用此proof.Key()判 // 断Height的真实性。当Height==DeltasPack.ProofedHeight时,此证明为nil。此时与DeltasPack // 中的ProofedHeight做验证。 HistoryProof trie.ProofChain // Proof from the HashHistory of block B to the Hash of block B (4). // When Height==DeltasPack.ProofedHeight, this proof is nil. // At this time, verify with ProofedHeight in DeltasPack. // 从块B的HashHistory到块B的Hash的证明(4)。当Height==DeltasPack.ProofedHeight时,此证明为nil。 // 此时与DeltasPack中的ProofedHeight做验证。 ProofToB trie.ProofChain }
Proof.Proof(MerkleHash(Deltas)) == BlockHash of Height (1)(2) HistoryProof.Proof(BlockHash of Height) == BlockHash of DeltasPack.ProofedHeight (3)(4)
type POSInfo ¶
type POSInfo struct { NidHash []byte `abi:"nidHash"` Height uint64 `abi:"height"` NodeType uint8 `abi:"nodeType"` Depositing *big.Int `abi:"depositing"` ValidAmount *big.Int `abi:"validAmount"` Available *big.Int `abi:"available"` RewardAddr common.Address `abi:"rewardAddr"` Version uint16 `abi:"version"` NodeCount uint32 `abi:"nodeCount"` Status uint16 `abi:"status"` Delegated *big.Int `abi:"delegated"` ValidDelegated *big.Int `abi:"validDelegated"` }
type PbftBlockNum ¶
type PenalizeResult ¶ added in v0.4.0
type PenalizeResult struct { TxHash common.Hash `json:"-"` Type ActRptType `json:"-"` NIDH common.Hash `json:"nidh"` Amount *big.Int `json:"penalized"` }
func (*PenalizeResult) Receipt ¶ added in v0.4.0
func (p *PenalizeResult) Receipt() *RRActReceipt
func (*PenalizeResult) String ¶ added in v0.4.0
func (p *PenalizeResult) String() string
type PenaltySet ¶ added in v0.4.0
PenaltySet is used to record the info of penalty set specified by Type. When Rate is not nil, the penalty mechanism will take effect according to the pledge ratio. Rate must not be less than or equal to 0. When Value is not nil, the absolute value penalty mechanism takes effect, and Value must not be less than or equal to 0. Rate/Value cannot be non-nil at the same time. When they are all nil, it means a penalty record with no pledge will be deducted.
func NewPenaltySet ¶ added in v0.4.0
func (*PenaltySet) Clone ¶ added in v0.4.0
func (s *PenaltySet) Clone() *PenaltySet
func (*PenaltySet) CompareType ¶ added in v0.4.0
func (s *PenaltySet) CompareType(o *PenaltySet) int
func (*PenaltySet) IsValid ¶ added in v0.4.0
func (s *PenaltySet) IsValid() bool
func (*PenaltySet) Penalize ¶ added in v0.4.0
func (s *PenaltySet) Penalize(depositing *big.Int) *big.Int
func (*PenaltySet) String ¶ added in v0.4.0
func (s *PenaltySet) String() string
func (*PenaltySet) Values ¶ added in v0.4.0
func (s *PenaltySet) Values() (num, denom, value *big.Int)
type PenaltySets ¶ added in v0.4.0
type PenaltySets []*PenaltySet
func (PenaltySets) Formalize ¶ added in v0.4.0
func (ps PenaltySets) Formalize() (PenaltySets, error)
func (PenaltySets) Get ¶ added in v0.4.0
func (ps PenaltySets) Get(typeCode uint16) (int, *PenaltySet)
must be sorted
func (PenaltySets) Len ¶ added in v0.4.0
func (ps PenaltySets) Len() int
func (PenaltySets) Less ¶ added in v0.4.0
func (ps PenaltySets) Less(i, j int) bool
func (PenaltySets) String ¶ added in v0.4.0
func (ps PenaltySets) String() string
func (PenaltySets) Swap ¶ added in v0.4.0
func (ps PenaltySets) Swap(i, j int)
type PreElectPhase ¶
type PreElectPhase byte
const ( PECreating PreElectPhase = 0x0 + iota // new pre-election PEElecting // pre-electing PEStarting // starting PEExiting // exiting )
Create pre-election stage: Create when the contract is successfully executed, enter the Creating
stage, broadcast and delete when proposing, there is no CachedHash at this time.
Pre-election phase: In the commit block phase, use block.PreElectings to overwrite the electings
in the cache, and clear the corresponding creating/results/elected cache.
For different stages:
Creating: Enter the Electing phase, add CachedHash, and generate a PreelectionStart control event, which is responsible for sending out the election information of this node Electing: Add CachedHash Starting: No need to deal with Exiting: When the Starting timeout, switch to Exiting package, when receiving Exiting in the package, you need to send a control event to check whether the target chain is started, if not you need to exit
Pre-launch phase: When reaching Electing.Expire, if the election result is successful, enter the
Starting phase and pack
创建预选举阶段: 合约执行成功时创建,进入Creating阶段,打包时广播并删除,此时没有CachedHash。 预选举阶段: 在commit block阶段,使用block.PreElectings覆盖缓存中的electings, 并清除相应creating/results/elected缓存。针对不同阶段:
Creating: 进入Electing阶段,补CachedHash,并产生PreelectionStart控制消息,该消息负责向外发送本节点的参选信息 Electing: 补CachedHash Starting: 无需处理 Exiting: 当Starting超时时,转为Exiting打包,接收到包中Exiting时,需要发送控制消息检查目标链是否启动了,没有启动需要退出
预启动阶段: 到达Electing.Expire时,如果选举结果成功,则进入Starting阶段并打包
func (PreElectPhase) String ¶
func (p PreElectPhase) String() string
type PreElecting ¶
type PreElecting struct { // Chain of pre-election ChainID common.ChainID // Current execution stage Phase PreElectPhase // Seed of main chain when pre-electing Seed *common.Seed // Count the number of election retrys, because the election may not be successful, and the // election can be automatically started again (3 times in total) Count int // The height of the main chain when the pre-election starts. Because the Hash value of the // current block is required when creating PreElecting, it cannot be stored in the object and // needs to be obtained from the data node when synchronizing data Start common.Height // Hash of the main chain block at preelecting startup, with value in cache, nil in BlockBody CachedHash *common.Hash // When the new chain is a ManagedComm chain, NidHashes saves the hash values of all authorized // node IDs, which are the basis for the pre-election. The election type can also be judged // based on whether this field is empty NidHashes []common.Hash // Electing phase: the height of the main chain at which the pre-election ends; // Starting phase: the height of the main chain at which consensus is initiated Expire common.Height // since v2.11.5, added support for restarting subchains, using LastConsHeight/LastConsHash // to record the world state at restart of sub-chain LastConsHeight common.Height LastConsHash *common.Hash }
The pre-election records, generated by the contract call of creation of the chain or the start of the pre-election, are put into the block after the main chain is generated. The consensused pre-election, which is generated from the Start block of the main chain and continues until the Expire block, has been kept in the main chain block until it is deleted. Makes the pre-election well documented. And it is necessary to synchronize the preElectCache in the main chain DataHolder when the new node synchronizes the main chain data, because the seed required by the VRF algorithm will be recorded in the cache. 由创建链或启动预选举合约产生的预选举记录,在主链生成后放入块中,以此 发布经过共识的预选举,从主链的第Start块生成,一直持续到Expire块之后 被主链共识删除为止一直保存在主链块中。使得预选举有据可查。 且需要在新节点同步主链数据时将主链DataHolder中的preElectCache一起 同步,因为在cache中会记录VRF算法需要的seed。
func (*PreElecting) Clone ¶
func (pe *PreElecting) Clone() *PreElecting
func (*PreElecting) Equal ¶
func (pe *PreElecting) Equal(o *PreElecting) bool
func (*PreElecting) HashValue ¶
func (pe *PreElecting) HashValue() ([]byte, error)
func (*PreElecting) IsManagedComm ¶
func (pe *PreElecting) IsManagedComm() bool
func (*PreElecting) IsRestarting ¶
func (pe *PreElecting) IsRestarting() bool
func (*PreElecting) IsValidManagedComm ¶
func (pe *PreElecting) IsValidManagedComm() bool
func (*PreElecting) IsVrf ¶
func (pe *PreElecting) IsVrf() bool
func (*PreElecting) PreSeed ¶
func (pe *PreElecting) PreSeed() (*common.Seed, error)
func (*PreElecting) RestartSeed ¶
func (pe *PreElecting) RestartSeed() (*common.Seed, error)
func (*PreElecting) RestartingPart ¶ added in v0.4.0
func (pe *PreElecting) RestartingPart() RestartingPart
func (*PreElecting) String ¶
func (pe *PreElecting) String() string
func (*PreElecting) ToPack ¶
func (pe *PreElecting) ToPack() *PreElecting
Generate objects for packaging, the pre-election information in the block does not include BlockHash
func (*PreElecting) TypeString ¶
func (pe *PreElecting) TypeString() string
func (*PreElecting) VrfSeed ¶
func (pe *PreElecting) VrfSeed() (vrfseed *common.Seed, isRestarting bool, err error)
type PreElectings ¶
type PreElectings []*PreElecting
Objects placed in the block, the ongoing pre-election list sorted by (Expire, ChainID), and generate MerkleTreeHash into the block header
func (PreElectings) Equal ¶
func (p PreElectings) Equal(o PreElectings) bool
func (PreElectings) HashValue ¶
func (p PreElectings) HashValue() ([]byte, error)
Calculate MerkelHash, need to sort before calling
func (PreElectings) InfoString ¶
func (p PreElectings) InfoString(level common.IndentLevel) string
func (PreElectings) Len ¶
func (p PreElectings) Len() int
func (PreElectings) Less ¶
func (p PreElectings) Less(i, j int) bool
func (PreElectings) String ¶
func (p PreElectings) String() string
func (PreElectings) Swap ¶
func (p PreElectings) Swap(i, j int)
type PreelectionConnect ¶
type PreelectionConnect struct { ChainID common.ChainID // The chain that needs to be connected after the pre-election Height common.Height // Record the height of the main chain generating the message, and to distinguish different events (to avoid Hash duplication) Comm *Committee // Committee after pre-election RestartingPart }
Node internal control event. When the pre-election enters the startup phase, and the node is selected, this message is sent to connect to the network, and the corresponding identity of the chain is set to PREELECT Create at performing commitPreelects.checkElected when executing StateDB.Commit.
func (*PreelectionConnect) GetChainID ¶
func (p *PreelectionConnect) GetChainID() common.ChainID
func (*PreelectionConnect) StartingEpoch ¶
func (p *PreelectionConnect) StartingEpoch() common.EpochNum
func (*PreelectionConnect) String ¶
func (p *PreelectionConnect) String() string
type PreelectionExamine ¶
type PreelectionExamine struct { ChainID common.ChainID Height common.Height RestartingPart }
Node internal control event, the consensus node checks whether the consensus is normal during the pre-election startup phase Create at preforming commitPreelects.checkElected when executing StateDB.Commit
func (PreelectionExamine) GetChainID ¶
func (p PreelectionExamine) GetChainID() common.ChainID
func (*PreelectionExamine) String ¶
func (p *PreelectionExamine) String() string
type PreelectionExit ¶
type PreelectionExit struct { ChainID common.ChainID Height common.Height }
Node internal control event, consensus node found failure in the pre-election during the startup phase, exit the network, and close consensus Create at performing commitPreelects when executing StateDB.Commit. (Fault tolerance mechanism) or create at preforming commitPreelects.checkElected when executing StateDB.Commit
func (PreelectionExit) GetChainID ¶
func (p PreelectionExit) GetChainID() common.ChainID
func (*PreelectionExit) String ¶
func (p *PreelectionExit) String() string
type PreelectionPrepare ¶
type PreelectionPrepare struct { ChainID common.ChainID Height common.Height Comm *Committee // Committee after pre-election RestartingPart }
func (*PreelectionPrepare) GetChainID ¶
func (p *PreelectionPrepare) GetChainID() common.ChainID
func (*PreelectionPrepare) StartingEpoch ¶
func (p *PreelectionPrepare) StartingEpoch() common.EpochNum
func (*PreelectionPrepare) String ¶
func (p *PreelectionPrepare) String() string
type PreelectionStart ¶
type PreelectionStart struct { ChainID common.ChainID // the chain starting preelection ParentHeight common.Height // the main chain height when starting the preelection RestartingPart }
Node internal control event. When you need to start a preelection, just send a message to the queue Create at performing commitPreelects when executing StateDB.Commit.
func (*PreelectionStart) GetChainID ¶
func (p *PreelectionStart) GetChainID() common.ChainID
func (*PreelectionStart) String ¶
func (p *PreelectionStart) String() string
type PreelectionSync ¶
type PreelectionSync struct { ChainID common.ChainID Height common.Height RestartingPart }
Node internal control event, the data node starts to broadcast synchronous data during the pre-election startup phase Create at preforming commitPreelects.checkElected when executing StateDB.Commit
func (PreelectionSync) GetChainID ¶
func (p PreelectionSync) GetChainID() common.ChainID
func (*PreelectionSync) String ¶
func (p *PreelectionSync) String() string
type PubAndSig ¶
func (*PubAndSig) FullString ¶
func (*PubAndSig) InfoString ¶
func (*PubAndSig) VerifiedNodeID ¶
type PubAndSigs ¶
type PubAndSigs []*PubAndSig
func VerifyRebootMainChain ¶
func VerifyRebootMainChain(lastHeight common.Height, lastHash common.Hash, comm *Committee, pass PubAndSigs, adminPks [][]byte) (PubAndSigs, error)
func (PubAndSigs) Clone ¶
func (ps PubAndSigs) Clone() PubAndSigs
func (PubAndSigs) Equal ¶
func (ps PubAndSigs) Equal(os PubAndSigs) bool
func (PubAndSigs) Equals ¶
func (ps PubAndSigs) Equals(o interface{}) bool
func (PubAndSigs) FromPubsAndSigs ¶
func (ps PubAndSigs) FromPubsAndSigs(pubs, sigs [][]byte) (PubAndSigs, error)
create new PubAndSigs with pubs & sigs
func (PubAndSigs) InfoString ¶
func (ps PubAndSigs) InfoString(level common.IndentLevel) string
func (PubAndSigs) Len ¶
func (ps PubAndSigs) Len() int
func (PubAndSigs) Less ¶
func (ps PubAndSigs) Less(i, j int) bool
sort by (signature, public key), in order to be compatible with the original bug version
func (PubAndSigs) Merge ¶
func (ps PubAndSigs) Merge(os PubAndSigs) PubAndSigs
func (PubAndSigs) Swap ¶
func (ps PubAndSigs) Swap(i, j int)
func (PubAndSigs) VerifyByComm ¶
func (ps PubAndSigs) VerifyByComm(comm *Committee, h []byte) error
func (PubAndSigs) VerifyByNodeIDs ¶
func (ps PubAndSigs) VerifyByNodeIDs(nids common.NodeIDs, hashOfObject []byte, sizeChecker func(int) error) (PubAndSigs, error)
func (PubAndSigs) VerifyByPubs ¶
func (ps PubAndSigs) VerifyByPubs(pks [][]byte, hashOfObject []byte, sizeChecker func(int) error) (PubAndSigs, error)
type RRAType ¶
type RRAType byte
Required Reserve Act Type
const ( RRADeposit RRAType = iota // Deposit RRAPenalty // Confiscation deposit RRAWithdraw // Withdraw RRAStatus // since v2.11.0, NewStatus>0: RRInfo.Status |= uint16(NewStatus), NewStatus<0:RRInfo.Status &= (^uint16(-NewStatus)) RRADelegate // since v2.12.0, account delegate to a consensus node RRAUnDelegate // since v2.12.0, account un-delegate from a consensus node RRAMax // The valid value must be less than this value )
type RRAct ¶
type RRAct struct { // current operation type Typ RRAType `rtlorder:"0"` // main chain block height at the time of request Height common.Height `rtlorder:"1"` // nil when withdrawing all, or (since v2.9.17) positive numbers (could be negative when clear status) // or (since 2.11.0) voting data node id (BytesToNodeID(Amount.Bytes())) Amount *big.Int `rtlorder:"2"` // since v2.11.0, pool deposit or withdraw account Account *common.Address `rtlorder:"5"` // since v2.11.0, charge ratio for pool node ChargeRatio *big.Rat `rtlorder:"6"` // chain id of the transaction executed that generated this action RelatingChainID common.ChainID `rtlorder:"3"` // the transaction that caused this action (Deposit/Withdraw/Status refers to the transaction // submitted by the user, and the penalty refers to the report transaction, etc.) RelatingTxHash common.Hash `rtlorder:"4"` // since v2.11.0, version: 1-Account Version uint16 `rtlorder:"7"` }
Record changes for the same node, because all changes must be compatible, that is, NodeID/Addr must be equal, and effective Typ must also be equal, so these three pieces of information can only be recorded in RRC.
func (*RRAct) FailedResult ¶
func (a *RRAct) FailedResult(err error) *ActFailedResult
func (*RRAct) ToUnDelegating ¶
func (a *RRAct) ToUnDelegating() *UnDelegating
func (*RRAct) ToWithdrawing ¶
func (a *RRAct) ToWithdrawing() *Withdrawing
func (*RRAct) WithdrawAll ¶
type RRActReceipt ¶
type RRActReceipt struct { TxHash common.Hash `json:"txHash"` Status uint8 `json:"status"` Type ActRptType `json:"type"` Msg string `json:"msg"` // json format of returned value }
used to record the result of each RRAct generated by the transaction specified by (TxChainID, TxHash) after asynchronous execution
func (*RRActReceipt) InfoString ¶
func (r *RRActReceipt) InfoString(level common.IndentLevel) string
func (*RRActReceipt) String ¶
func (r *RRActReceipt) String() string
type RRActReceipts ¶
type RRActReceipts []*RRActReceipt
func (RRActReceipts) HashValue ¶
func (rs RRActReceipts) HashValue() ([]byte, error)
func (RRActReceipts) String ¶
func (rs RRActReceipts) String() string
type RRActs ¶
type RRActs []*RRAct
func (RRActs) FailedResults ¶
func (s RRActs) FailedResults(err error) RRActReceipts
func (RRActs) InfoString ¶
type RRC ¶
type RRC struct { NodeIDHash common.Hash // NodeID hash of the changing node Addr common.Address // Binding address Typ common.NodeType // Node type Acts RRActs // Changing list according to the order of transaction execution, execute in the order of priority during execution }
Required Reserve Change
func (*RRC) InfoString ¶
type RRInfo ¶
type RRInfo struct { // The hash value of the NodeID of the node is used to store information in a more // private way. It can also reduce storage capacity NodeIDHash common.Hash `rtlorder:"0"` // The main chain block height at the time of the last deposit // because we use Height==0 to indicate that it's a genesis node, so there should be // no user node deposit at this moment. // since v3.2.1, use NilHeight for genesis node. // First, both 0 and NilHeight of Height are judged as genesis node, and when switching // era, replace all Height==0 with NilHeight. Then, // TODO: through the upgrade, the judgment condition of genesis node is set to NilHeight. // Only after that can support stateful chain startup Height common.Height `rtlorder:"1"` // Which type of node, supports common.Consensus/common.Data Type common.NodeType `rtlorder:"2"` // If it is not nil, it means that this deposit has been applied for withdrawing and // will no longer participate in the calculation. When the value >= current era, execute // the withdrawing. Redemption will be executed at the end of the era. // since v2.14.2 always set to nil WithdrawDemand *common.EraNum `rtlorder:"3"` // Record the number of penalties, initially 0, +1 after each Penalty execution PenalizedTimes int `rtlorder:"4"` // Depositing: sum of all the deposits of the node Amount *big.Int `rtlorder:"5"` // The percentage of the effective pledge amount of the current node in the total // effective pledge. If it is nil, it indicates that the current pledge does not // account for the proportion. It may be waiting for withdrawing at this time. Ratio *big.Rat `rtlorder:"6"` // Reward binding address RewardAddr common.Address `rtlorder:"7"` // Since v1.3.4. When WithdrawDemand!=nil, record all pending withdrawing records. If it // exists, the withdrawing due in the list will be executed every era. Withdrawings Withdrawings `rtlorder:"8"` // since v1.5.0. Version number, used for compatible Version uint16 `rtlorder:"9"` // since v1.5.0。Used to record a total of valid pledged consensus nodes, only valid // when Type==common.Consensus, others are 0 NodeCount uint32 `rtlorder:"10"` // since v2.9.17, node status Status uint16 `rtlorder:"11"` // since v2.11.0, available amount of the node, use for election and settle Avail *big.Int `rtlorder:"12"` // removed by v2.12.0 // // since v2.11.0, voted data node id hash // Voted *common.Hash `rtlorder:"13"` // // since v2.11.0, voted amount of current data node // VotedAmount *big.Int `rtlorder:"14"` // // since v2.11.0, if not nil means it's a pool node (only Type==common.Consensus supports pool mode) // Settles *SettleInfo `rtlorder:"15"` // since v2.12.0, record the total amount delegated to this node by different accounts // The Voted/VotedAmount/Settles of all nodes on the test chain are nil, so directly // delete Voted/VotedAmount and add a new field here, which will not affect the // deserialized value, but versioning is still required Delegated *big.Int `rtlorder:"14"` // since v2.12.0, revoking delegation list Undelegatings UnDelegatings `rtlorder:"15"` }
Required Reserve Information of the node
func CreateGenesisRRInfo ¶
func (*RRInfo) AvailableAmount ¶
Returns the pledge amount of the specified type of nodeType of the current node
func (*RRInfo) Compatible ¶
Compatibility check
func (*RRInfo) Depositing ¶
Return the pledge amount after subtracting the amount to be redeemed
func (*RRInfo) InfoEquals ¶
Compare the immutable information except Ratio and NodeCount because ratio and nodecount are generated as a whole at the end, there is no need to compare
func (*RRInfo) InfoString ¶
func (*RRInfo) ShouldRemove ¶
func (*RRInfo) ValidAmount ¶
The current effective pledge amount (minus the part being redeemed)
func (*RRInfo) ValidDelegated ¶
type RRProofs ¶
type RRProofs struct { Info *RRInfo Proof trie.ProofChain }
func (*RRProofs) InfoString ¶
func (*RRProofs) PrintString ¶
func (*RRProofs) VerifyProof ¶
type RRProofsMessage ¶
type RRProofsMessage struct { NodeId common.NodeID Era common.EraNum RootHash common.Hash Proofs *RRProofs }
func (*RRProofsMessage) GetChainID ¶
func (rm *RRProofsMessage) GetChainID() common.ChainID
func (*RRProofsMessage) String ¶
func (rm *RRProofsMessage) String() string
type RRProofsRequest ¶
type RRProofsRequest struct { ToChainId common.ChainID NodeId common.NodeID Era common.EraNum RootHash common.Hash }
func (*RRProofsRequest) GetChainID ¶
func (rr *RRProofsRequest) GetChainID() common.ChainID
func (*RRProofsRequest) String ¶
func (rr *RRProofsRequest) String() string
type RRReceiptIndex ¶
type RRReceiptIndex struct { RootOfReceipts common.Hash Index uint32 }
func NewRRActReceiptIndex ¶
func NewRRActReceiptIndex(rootOfReceipts []byte, index uint32) *RRReceiptIndex
type RRStatusAct ¶
func (*RRStatusAct) Ignored ¶
func (a *RRStatusAct) Ignored() bool
func (*RRStatusAct) Merge ¶
func (a *RRStatusAct) Merge(b *RRStatusAct) error
func (*RRStatusAct) Todo ¶
func (a *RRStatusAct) Todo() (act uint16, setOrClr bool)
type RRSyncData ¶
type RRSyncData struct { CurrentInfos []*RRInfo NextChangedInfos []*RRInfo Deleted []common.Hash Changing []*RRC }
func (*RRSyncData) InfoString ¶
func (d *RRSyncData) InfoString() string
func (*RRSyncData) String ¶
func (d *RRSyncData) String() string
type RebootMainChainMessage ¶
type RebootMainChainMessage struct { // the last consensused block info LastHeight common.Height LastHash common.Hash // reboot committee, start consensus at LastHeight+1 Comm *Committee // multi sig by main chain administrators PaSs PubAndSigs }
when there is a problem with the main chain (such as stop, or a bad block), broadcast this message in the main chain to restart the main chain consensus. there's no way to call a contract function because the consensus has stopped.
func (*RebootMainChainMessage) GetChainID ¶
func (r *RebootMainChainMessage) GetChainID() common.ChainID
func (*RebootMainChainMessage) String ¶
func (r *RebootMainChainMessage) String() string
func (*RebootMainChainMessage) Verify ¶
func (r *RebootMainChainMessage) Verify(adminPks [][]byte) (PubAndSigs, error)
type RebootedComm ¶
type RebootedComm struct { Comm *Committee AdminPass PubAndSigs }
主链出现问题时,需要通过广播带有主链管理员多签的RebootMainChainMessage进行主链重启。 主链重启后的第一个块,无论是否为空块,都需要:
- 将BlockHeader.CommitteeHash修改为新comm的hash,使用BlockBody.Rebooted校验合法性
- 不管是因为故障还是作恶被发现,当前committee已经不可用,又因为有可能会Keep Comm,所以为了简单,直接取消 当前comm的权利,如果已经选出下一届comm,则一起作废,并由新的RebootedComm替代,同时,如果下一届Comm已 被主链确认,则还需要将ConfirmedInfo.CommEpoch回滚。
- 使用 BlockHeader.Height-1(LastHeight), BlockHeader.PreviousHash(LastHash), BlockBody.Rebooted.Comm, BlockBody.Rebooted.AdminPass, 以及当前主链管理员公钥列表 对BlockBody.Rebooted信息进行校验
- 更新主链对应ConfirmedInfo中的RestartedHistory
func (*RebootedComm) InfoString ¶
func (r *RebootedComm) InfoString(level common.IndentLevel) string
func (*RebootedComm) String ¶
func (r *RebootedComm) String() string
type Receipt ¶
type Receipt struct { // Consensus fields PostState []byte `json:"root"` // It is used to record the information of transaction execution in JSON format, such as gas, cost "gas", and world state "root" after execution. Status uint64 `json:"status"` CumulativeGasUsed uint64 `json:"cumulativeGasUsed" gencodec:"required"` Logs []*Log `json:"logs" gencodec:"required"` // Implementation fields (don't reorder!) TxHash common.Hash `json:"transactionHash" gencodec:"required"` ContractAddress *common.Address `json:"contractAddress"` GasUsed uint64 `json:"gasUsed" gencodec:"required"` Out []byte `json:"out" gencodec:"required"` Error string `json:"error"` GasBonuses []*Bonus `json:"gasBonuses"` Version uint16 `json:"version"` }
Receipt represents the results of a transaction.
func NewRawReceipt ¶
func NewReceipt ¶
NewReceipt creates a barebone transaction receipt, copying the init fields. since v2.10.11, In order to generate the proof from the transaction hash with the signature, the calculation method of the TransactionRoot and the ReceiptRoot in the BlockHeader is changed, resulting in incompatibility with the historical data from the current version
func ReadReceipt ¶
ReadReceipt retrieves a specific transaction receipt from the database, along with its added positional metadata.
func (*Receipt) GasFeeString ¶
func (*Receipt) GetPostRoot ¶
func (*Receipt) InfoString ¶
type RestartComm ¶
type RestartComm struct { Start common.Height // the height of the restarted comm start consensus ElectedHeight common.Height // the height of the main chain block where the restarting comm elected Comm *Committee // restarted comm }
func (*RestartComm) Clone ¶
func (r *RestartComm) Clone() *RestartComm
func (*RestartComm) CmpOrder ¶
func (r *RestartComm) CmpOrder(o *RestartComm) int
func (*RestartComm) Compare ¶
func (r *RestartComm) Compare(o *RestartComm) int
func (*RestartComm) HeightString ¶
func (r *RestartComm) HeightString() string
func (*RestartComm) InfoString ¶
func (r *RestartComm) InfoString(level common.IndentLevel) string
func (*RestartComm) IsValid ¶
func (r *RestartComm) IsValid() bool
func (*RestartComm) String ¶
func (r *RestartComm) String() string
func (*RestartComm) Summary ¶
func (r *RestartComm) Summary() string
type RestartCommEMessage ¶
type RestartCommEMessage struct {
Comm *CommEntry
}
func (*RestartCommEMessage) GetChainID ¶
func (m *RestartCommEMessage) GetChainID() common.ChainID
func (*RestartCommEMessage) Hash ¶
func (m *RestartCommEMessage) Hash() common.Hash
func (*RestartCommEMessage) String ¶
func (m *RestartCommEMessage) String() string
type RestartComms ¶
type RestartComms []*RestartComm
func (RestartComms) Clone ¶
func (rs RestartComms) Clone() RestartComms
func (RestartComms) Compare ¶
func (rs RestartComms) Compare(os RestartComms) int
func (RestartComms) Len ¶
func (rs RestartComms) Len() int
func (RestartComms) Less ¶
func (rs RestartComms) Less(i, j int) bool
func (RestartComms) LocateBy ¶
func (rs RestartComms) LocateBy(height common.Height) (*RestartComm, error)
func (RestartComms) Summary ¶
func (rs RestartComms) Summary() string
func (RestartComms) Swap ¶
func (rs RestartComms) Swap(i, j int)
type RestartHistories ¶
type RestartHistories []*RestartHistory
func (RestartHistories) Clone ¶
func (hs RestartHistories) Clone() RestartHistories
func (RestartHistories) Compare ¶
func (hs RestartHistories) Compare(os RestartHistories) int
func (RestartHistories) JustBefore ¶
func (hs RestartHistories) JustBefore(height common.Height) *RestartHistory
func (RestartHistories) Len ¶
func (hs RestartHistories) Len() int
func (RestartHistories) Less ¶
func (hs RestartHistories) Less(i, j int) bool
func (RestartHistories) Summary ¶
func (hs RestartHistories) Summary() string
func (RestartHistories) Swap ¶
func (hs RestartHistories) Swap(i, j int)
type RestartHistory ¶
type RestartHistory struct { LastHeight common.Height // the last block height when the chain stopped, restart height would be LastHeight+1 LastHash common.Hash // hash of the last block when the chain stopped ElectedHeight common.Height // the height of the main chain block where the restarting comm elected (packed) Comm *Committee // the elected restarting comm }
func (*RestartHistory) Clone ¶
func (h *RestartHistory) Clone() *RestartHistory
func (*RestartHistory) Compare ¶
func (h *RestartHistory) Compare(o *RestartHistory) int
func (*RestartHistory) HeightCompare ¶
func (h *RestartHistory) HeightCompare(o *RestartHistory) int
func (*RestartHistory) InfoString ¶
func (h *RestartHistory) InfoString(level common.IndentLevel) string
func (*RestartHistory) StartHeight ¶
func (h *RestartHistory) StartHeight() common.Height
func (*RestartHistory) String ¶
func (h *RestartHistory) String() string
func (*RestartHistory) Summary ¶
func (h *RestartHistory) Summary() string
type RestartedComm ¶
type RestartedComm struct { // the restarting comm election result which packaged in the block Result *ChainElectResult // 1. one of Body.ElectingResults -> Header.ElectResultRoot // 2. Header.ElectResultRoot -> root hash of Header Proof trie.ProofChain }
Since v2.11.5 When the sub-chain has not been confirmed by the main chain for a long time due to various reasons (such as: the consensus committee is evil, the available nodes of the consensus committee do not meet the consensus conditions, etc.), it is considered that the sub-chain needs to be restarted. The restarted new committee is elected on the main chain, so the election information of this RestartComm needs to be packaged into the first block after the restart of the sub-chain (regardless of whether it is an empty block or not) 当子链因为各种原因长时间没有被主链确认(如:共识委员会作恶、共识委员会可用节点不满足共识条件等),则认为该子链 需要重启。重启所使用的新的委员会是在主链上进行的选举,因此需要将此RestartComm的选举信息打包到子链重启后的第 一个块中(无论其是否为空块) Add the RestartedComm item in BlockBody to save the election result and proof of RestartComm on the main chain. At the same time, BlockBody.ParentHeight must be the block height containing the election result information, and ParentHash is the Hash of the main chain block, which can be used to verify the proof in RestartedComm 在BlockBody中增加RestartedComm项,用来保存RestartComm在主链上的选举结果及其证明。同时 BlockBody.ParentHeight必须是包含此选举结果信息的块高,ParentHash则是该主链块Hash,可以用来验证 RestartedComm中的证明 The first block after the sub-chain restarts, whether it is an empty block or not, requires:
- Modify BlockHeader.CommitteeHash to the hash of the new restarting comm, and use BlockBody.Restarting to verify the legitimacy
- No matter if it is discovered due to malfunction or malicious actions, the current committee is no longer available, and because it is possible to keep Comm, so for simplicity, the next committee is directly cancelled. Alternative to RestartedComm. At the same time, if the next Comm has been confirmed by the main chain, the ConfirmedInfo.CommEpoch needs to be rolled back.
- Record the value of the restart committee and its legality proof in BlockBody.Restarting, and use ParentHash to verify the legality
- Set BlockHeader.ParentHeight/BlockHeader.ParentHash to the block information when the current RestartComm is successfully elected on the main chain
子链重启后的第一个块,无论是否为空块,都需要:
- 将BlockHeader.CommitteeHash修改为新comm的hash,使用BlockBody.Restarting验证合法性
- 不管是因为故障还是作恶被发现,当前committee已经不可用,又因为有可能会Keep Comm,所以为了简单,直接取消 当前comm的权利,如果已经选出下一届comm,则一起作废,并由新的RestartedComm替代,同时,如果下一届Comm已 被主链确认,则还需要将ConfirmedInfo.CommEpoch回滚。
- 在BlockBody.Restarting中记录重启委员会的值及其合法性证明,使用ParentHash验证合法性
- 将BlockHeader.ParentHeight/BlockHeader.ParentHash设置为当前RestartComm在主链上被选举成功时的块信息
func (*RestartedComm) Clone ¶
func (r *RestartedComm) Clone() *RestartedComm
func (*RestartedComm) Comm ¶
func (r *RestartedComm) Comm() *Committee
func (*RestartedComm) Equal ¶
func (r *RestartedComm) Equal(o *RestartedComm) bool
func (*RestartedComm) String ¶
func (r *RestartedComm) String() string
func (*RestartedComm) Verify ¶
func (r *RestartedComm) Verify(parentHash *common.Hash) error
type RestartingPart ¶
type RestartingPart struct { LastHeight common.Height // since v2.11.5, last confirmed height of restarting sub-chain LashHash *common.Hash // since v2.11.5, last confirmed block hash of restarting sub-chain }
func (RestartingPart) IsRestarting ¶
func (p RestartingPart) IsRestarting() bool
func (RestartingPart) NameString ¶
func (p RestartingPart) NameString() ElectingName
func (RestartingPart) PartString ¶
func (p RestartingPart) PartString() string
type RewardAndRedemptionTxFilter ¶
type RewardAndRedemptionTxFilter struct{}
func (RewardAndRedemptionTxFilter) Filter ¶
func (f RewardAndRedemptionTxFilter) Filter(tx *Transaction) bool
type RewardRequest ¶
type RewardRequest struct { ChainId common.ChainID CommitteePks [][]byte // The public key list of the members of the current committee in the order of proposing Epoch common.EpochNum // Epoch where the reward is declared LastHeader *BlockHeader // The block header of the last block of the epoch declared Attendance *AttendanceRecord // The attendance table of the last block, which contains the attendance records of the entire epoch PASs PubAndSigs // Signature list for the last block // since v2.12.0, add proof of legitimacy for reward requests. // // Since the reward request has been proven to the confirmed block, the signature list (PASs) and // the public key list (CommitteePks) of the block in the original request can be nil. // 1. let A be the block of the reward request (the last block in rewarding epoch). // 2. let B be the block of the current sub-chain confirmed by the main chain (for sub chains only). // 3. let C be the block of main chain which confirmed B (or A for main chain) // 4. sub-chains: Hash(A) -> B.HashHistory (verify by BigKey()) -> Hash(B)(verify by // SubProof[len(SubProof)-1].IsHeaderOf() and Proof()), could be nil if A==B // main-chain: nil // 5. sub-chains: Hash(B) -> C.HdsRoot -> Hash(C) // main-chain: Hash(A) -> C.HashHistory -> Hash(C) // 6. height of C // 7. if ChainID is main chain id, SubProof/MainProof could be nil, ProofedHeight could be 0 // // The requester of sub-chain must use the latest confirmed block in the main chain to prove // the request. At this time, the main chain committee must have the block information // corresponding to the proofedHeight. If the block specified by ProofedHeight is not in the // local disk when the committee member verifies, the verification can be considered to have // failed. None-validating nodes should record directly. // // Verification steps: // 1. Attendance.Hash() == LastHeader.AttendanceHash // 2. SubProof is the proof of LastHeader: SubProof[:len(Proof)-1].BigKey() equals LastHeader.Height // 3. get block hash (BoH) of ProofedHeight in local database // 4. verify whether BoH == MainProof.Proof(SubProof.Proof(LastHeader.Hash())) // // Since the 0-chain data or consensus node may not be able to obtain the 0-chain block earlier than // the sub-chain data node, it is possible that when the sub-chain reqeusts a new request, the proofed // height of the proofs may be higher than the current height in main chain holder of the 0-chain data // or consensus node. // In order to prevent this kind of request from being lost, the 0-chain node does not check the proofed // height of proof when receiving the RewardRequest message, checks it when it is packaged. SubProof trie.ProofChain // 4 MainProof trie.ProofChain // 5 ProofedHeight common.Height // 6 Version uint16 }
TODO: add the proof from the LastHeader.Hash to the hash of the block where it's been confirmed
in main chain to ensure its validity. When the sub-chain receives confirmation from the main chain that the height has exceeded the last block of the Epoch to which the LastHeader belongs, it can be prooved and reported.
TODO: 增加从LastHeader到主链某高度block哈希的证明,以确保其有效性。需要在子链收到主链确认高度已超过LastHeader
所属Epoch最后一个块时,可以进行证明并上报。
func (*RewardRequest) AuditResult ¶ added in v0.4.0
func (a *RewardRequest) AuditResult() (countMap map[common.NodeID]int, penaltyMap map[common.NodeID]common.ChainID, err error)
func (*RewardRequest) CheckFields ¶
func (a *RewardRequest) CheckFields() error
func (*RewardRequest) Clone ¶
func (a *RewardRequest) Clone() *RewardRequest
func (*RewardRequest) DestChainID ¶
func (a *RewardRequest) DestChainID() common.ChainID
func (*RewardRequest) Formalize ¶
func (a *RewardRequest) Formalize()
func (*RewardRequest) GetChainID ¶
func (a *RewardRequest) GetChainID() common.ChainID
func (*RewardRequest) Hash ¶
func (a *RewardRequest) Hash() common.Hash
func (*RewardRequest) HashValue ¶
func (a *RewardRequest) HashValue() ([]byte, error)
func (*RewardRequest) InfoString ¶
func (a *RewardRequest) InfoString(level common.IndentLevel) string
func (*RewardRequest) IsValid ¶
func (a *RewardRequest) IsValid() bool
func (*RewardRequest) String ¶
func (a *RewardRequest) String() string
func (*RewardRequest) Verify ¶
func (a *RewardRequest) Verify(proofedHash common.Hash) error
type RewardRequests ¶
type RewardRequests []*RewardRequest
func (RewardRequests) InfoString ¶
func (rs RewardRequests) InfoString(level common.IndentLevel) string
func (RewardRequests) LastRewardEpochs ¶
func (rs RewardRequests) LastRewardEpochs() map[common.ChainID]common.EpochNum
func (RewardRequests) Len ¶
func (rs RewardRequests) Len() int
func (RewardRequests) Less ¶
func (rs RewardRequests) Less(i, j int) bool
func (RewardRequests) String ¶
func (rs RewardRequests) String() string
func (RewardRequests) Swap ¶
func (rs RewardRequests) Swap(i, j int)
type RewardType ¶
type RewardType uint8
const ( RTConsensus RewardType = iota RTData RTDelegation RTAudit )
func (RewardType) String ¶ added in v0.4.0
func (r RewardType) String() string
type RpcFilter ¶
type RpcFilter struct { Addrs []common.Address Topics [][]common.Hash BlockHash *common.Hash Begin, End common.Height // contains filtered or unexported fields }
type ScErcInfo ¶ added in v0.4.0
func NewErcInfo ¶ added in v0.4.0
func NewErcInfo(chain common.ChainID, addr common.Address) *ScErcInfo
type SeedFactor ¶
type SeedFactor []byte
func (SeedFactor) Clone ¶ added in v0.4.0
func (s SeedFactor) Clone() SeedFactor
func (SeedFactor) Equal ¶ added in v0.4.0
func (s SeedFactor) Equal(o SeedFactor) bool
type SetChainSettingRequest ¶
type SetChainSettingRequest struct { Data *ChainSetting // request content of setting Sigs [][]byte // signature list Pubs [][]byte // public key list corresponding to signature one by one }
func (*SetChainSettingRequest) DataDeserialize ¶
func (s *SetChainSettingRequest) DataDeserialize(vr rtl.ValueReader) error
func (*SetChainSettingRequest) DataSerialize ¶
func (s *SetChainSettingRequest) DataSerialize(w io.Writer) error
func (*SetChainSettingRequest) Deserialization ¶
func (s *SetChainSettingRequest) Deserialization(r io.Reader) (shouldBeNil bool, err error)
func (*SetChainSettingRequest) GetData ¶
func (s *SetChainSettingRequest) GetData() (o interface{}, exist bool)
func (*SetChainSettingRequest) GetPubs ¶
func (s *SetChainSettingRequest) GetPubs() [][]byte
func (*SetChainSettingRequest) GetSigs ¶
func (s *SetChainSettingRequest) GetSigs() [][]byte
func (*SetChainSettingRequest) Serialization ¶
func (s *SetChainSettingRequest) Serialization(w io.Writer) error
func (*SetChainSettingRequest) SetPubs ¶
func (s *SetChainSettingRequest) SetPubs(pubs [][]byte)
func (*SetChainSettingRequest) SetSigs ¶
func (s *SetChainSettingRequest) SetSigs(sigs [][]byte)
func (*SetChainSettingRequest) String ¶
func (s *SetChainSettingRequest) String() string
type ShardDeltaMessage ¶
type ShardDeltaMessage struct { ToChainID common.ChainID FromBlockHeader *BlockHeader Proof []common.Hash Deltas []*AccountDelta }
The shard chain is used to send to other shards the AccountDelta list processed by this shard should fall on the other shard. Including block header and the proof
func (*ShardDeltaMessage) DestChainID ¶
func (m *ShardDeltaMessage) DestChainID() common.ChainID
func (*ShardDeltaMessage) GetChainID ¶
func (m *ShardDeltaMessage) GetChainID() common.ChainID
func (*ShardDeltaMessage) String ¶
func (m *ShardDeltaMessage) String() string
type ShardTransaction ¶
type ShardTransaction struct { ToChainID common.ChainID Tx *Transaction }
func (*ShardTransaction) GetChainID ¶
func (s *ShardTransaction) GetChainID() common.ChainID
type ShardWaterline ¶
type ShardWaterline struct { ShardID common.ChainID // shard id Line common.Height // the height of the shard that deltas are to be merged next }
func (ShardWaterline) Equal ¶
func (s ShardWaterline) Equal(o ShardWaterline) bool
func (ShardWaterline) HashValue ¶
func (s ShardWaterline) HashValue() ([]byte, error)
func (ShardWaterline) String ¶
func (s ShardWaterline) String() string
type Signer ¶
type Signer interface { // Sender returns the sender address of the transaction. Sender(tx *ETHTransaction) (common.Address, error) // SignatureValues returns the raw R, S, V values corresponding to the // given signature. SignatureValues(ethChainid *big.Int, txType byte, sig []byte) (r, s, v *big.Int, err error) // // Hash returns 'signature hash', i.e. the transaction hash that is signed by the // // private key. This hash does not uniquely identify the transaction. Hash(tx *ETHTransaction) common.Hash HashGtkm(tx *Transaction) common.Hash HashGtkmWithSig(tx *Transaction) common.Hash // Equal returns true if the given signer is the same as the receiver. Equal(Signer) bool RecoverSigAndPub(tx *ETHTransaction) (sig, pub []byte, err error) }
Signer encapsulates transaction signature handling. The name of this type is slightly misleading because Signers don't actually sign, they're just for validating and processing of signatures.
Note that this interface is not a stable API and may change at any time to accommodate new protocol rules.
var ( ETHSigner Signer = NewLondonSigner() // ETHDefaultChainID = big.NewInt(1) )
func NewEIP2930Signer ¶
func NewEIP2930Signer() Signer
NewEIP2930Signer returns a signer that accepts EIP-2930 access list transactions, EIP-155 replay protected transactions, and legacy Homestead transactions.
func NewEIP2930Signer(chainId *big.Int) Signer { return eip2930Signer{NewEIP155Signer(chainId)}
func NewLondonSigner ¶
func NewLondonSigner() Signer
NewLondonSigner returns a signer that accepts - EIP-1559 dynamic fee transactions - EIP-2930 access list transactions, - EIP-155 replay protected transactions, and - legacy Homestead transactions.
func NewLondonSigner(chainId *big.Int) Signer { return londonSigner{eip2930Signer{NewEIP155Signer(chainId)}}
func NewTkmSigner ¶ added in v0.4.0
func NewTkmSigner() Signer
type SigsAndPubs ¶
type SigsAndPubs struct { Sigs [][]byte // signature list Pubs [][]byte // List of public keys corresponding to the signature list one-to-one }
func (*SigsAndPubs) GetPubs ¶
func (sp *SigsAndPubs) GetPubs() [][]byte
func (*SigsAndPubs) GetSigs ¶
func (sp *SigsAndPubs) GetSigs() [][]byte
func (*SigsAndPubs) SetPubs ¶
func (sp *SigsAndPubs) SetPubs(pubs [][]byte)
func (*SigsAndPubs) SetSigs ¶
func (sp *SigsAndPubs) SetSigs(sigs [][]byte)
type StatusResult ¶
type StatusResult struct { TxHash common.Hash `json:"-"` Type ActRptType `json:"-"` NIDH common.Hash `json:"nidh"` Prev uint16 `json:"prev"` New uint16 `json:"new"` }
func (*StatusResult) Receipt ¶
func (r *StatusResult) Receipt() *RRActReceipt
func (*StatusResult) String ¶
func (r *StatusResult) String() string
type StorageSize ¶
type StorageSize float64
type TkmTx ¶ added in v0.4.0
type TkmTx struct { ChainID *big.Int Nonce uint64 To *common.Address `rlp:"nil"` UseLocal bool Value *big.Int Data []byte Gas uint64 GasPrice *big.Int GasTipCap *big.Int GasFeeCap *big.Int AccessList AccessList Extra []byte Version uint16 MultiSigs [][]byte V, R, S *big.Int }
the TxData compactible with ETHTransaction that support all properties in TKM Transaction including all properties in LegacyTxType/AccessListTxType/DynamicFeeTxType
type TokenType ¶ added in v0.4.0
type TokenType byte
const ( // source ERC20: // function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); // target ERC20: // function mint(address _to, uint256 _value) external; // function burnFrom(address _to, uint256 _value) external; TT_ERC20 TokenType = 0 // source ERC721: // function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes calldata data) external payable; // target ERC721: // function claim(uint256 _tokenId, address _to) external; // function mint(address _to) external returns(uint256 _tokenId); // function burn(uint256 _tokenId) external; TT_ERC721 TokenType = 1 // source ERC1155: // function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external; // target ERC1155: // function mint(address _to, uint256 _id, uint256 _value, bytes calldata _data) external; // function burn(address _to, uint256 _id, uint256 _value) external; TT_ERC1155 TokenType = 2 )
type Transaction ¶
type Transaction struct { ChainID common.ChainID `json:"chainID"` // The chain ID that needs to process this transaction From *common.Address `json:"from"` // Address of transaction transmitter To *common.Address `json:"to"` // Address of transaction receiver Nonce uint64 `json:"nonce"` // Nonce of sender account UseLocal bool `json:"uselocal"` // true: local currency,false: basic currency; default false Val *big.Int `json:"value"` // Amount of the transaction Input hexutil.Bytes `json:"input"` // Contract code/initial parameters when creating a contract, or input parameters when calling a contract Extra hexutil.Bytes `json:"extra"` // Store transaction additional information Version uint16 `json:"version"` // Version number used to distinguish different execution methods when the transaction execution is incompatible due to upgrade MultiSigs PubAndSigs `json:"multiSigs"` // The signatures used to sign this transaction will only be used when there are multiple signatures. The signature of the transaction sender is not here. Not included in Hash // contains filtered or unexported fields }
func NewNormalTx ¶
func NewNormalTx(chainid common.ChainID, from, to *common.Address, nonce uint64, val *big.Int, input []byte) *Transaction
func (*Transaction) AccessList ¶
func (tx *Transaction) AccessList() AccessList
func (*Transaction) Clone ¶
func (tx *Transaction) Clone() *Transaction
func (Transaction) DeprecatedHash ¶
func (tx Transaction) DeprecatedHash() ([]byte, error)
Deprecated
func (*Transaction) ETHChainID ¶
func (tx *Transaction) ETHChainID() *big.Int
func (*Transaction) ETHTxType ¶
func (tx *Transaction) ETHTxType() byte
func (*Transaction) Equal ¶
func (tx *Transaction) Equal(o *Transaction) bool
func (*Transaction) ExtraKeys ¶
func (tx *Transaction) ExtraKeys() (extra *Extra)
EthKeys Type returns the ethtransaction type.
func (*Transaction) ForwardTimes ¶
func (tx *Transaction) ForwardTimes() (times int, innerTx *Transaction)
func (Transaction) FullString ¶
func (tx Transaction) FullString() string
func (*Transaction) Gas ¶
func (tx *Transaction) Gas() uint64
func (*Transaction) GasFeeCap ¶
func (tx *Transaction) GasFeeCap() *big.Int
func (*Transaction) GasPrice ¶
func (tx *Transaction) GasPrice() *big.Int
func (*Transaction) GasTipCap ¶
func (tx *Transaction) GasTipCap() *big.Int
func (Transaction) GetChainID ¶
func (tx Transaction) GetChainID() common.ChainID
func (*Transaction) GetSignature ¶
func (tx *Transaction) GetSignature() (*PubAndSig, error)
func (*Transaction) GetTkmExtra ¶
func (tx *Transaction) GetTkmExtra() []byte
func (*Transaction) HasSig ¶
func (tx *Transaction) HasSig() bool
func (Transaction) HashValue ¶
func (tx Transaction) HashValue() ([]byte, error)
transaction signature hash
func (*Transaction) InfoString ¶
func (tx *Transaction) InfoString(level common.IndentLevel) string
func (*Transaction) IsLegalIncomingTx ¶
func (tx *Transaction) IsLegalIncomingTx(expectingChainId common.ChainID) error
func (*Transaction) IsLegalVmTx ¶
func (tx *Transaction) IsLegalVmTx(expectingChainId common.ChainID) error
func (*Transaction) MultiSign ¶
func (tx *Transaction) MultiSign(privs ...[]byte) error
func (*Transaction) RawSignatureValues ¶
func (tx *Transaction) RawSignatureValues() (v, r, s *big.Int)
func (*Transaction) SetExtraKeys ¶
func (tx *Transaction) SetExtraKeys(extras *Extra) error
func (*Transaction) SetSignatureValues ¶
func (tx *Transaction) SetSignatureValues(V, R, S *big.Int) error
func (*Transaction) SetTkmExtra ¶
func (tx *Transaction) SetTkmExtra(extra []byte) error
func (*Transaction) Sign ¶
func (tx *Transaction) Sign(priv []byte) error
func (Transaction) String ¶
func (tx Transaction) String() string
func (*Transaction) Summary ¶
func (tx *Transaction) Summary() string
func (*Transaction) ToETH ¶
func (tx *Transaction) ToETH(sig []byte) (*ETHTransaction, error)
func (*Transaction) VerifySig ¶
func (tx *Transaction) VerifySig(pas *PubAndSig) error
type TxData ¶
type TxData interface { TxType() byte // returns the type ID // contains filtered or unexported methods }
TxData This is implemented by DynamicFeeTx, LegacyTx and AccessListTx.
type TxFilter ¶
type TxFilter interface {
Filter(tx *Transaction) bool
}
type TxFinalProof ¶
type TxFinalProof struct { Header *BlockHeader // block header verified by committee of Header.Height.Epoch in TKMClients Sigs PubAndSigs // committee signature list Tx *Transaction // proofing transaction Receipt *Receipt // receipt of proofing transaction // proof Hash(Receipt) -> Hash(Header). Otherwise, we need to distinguish whether // the proven transaction is on the main chain or the sub-chain to prove to // Header.ReceiptRoot or Header.ConfirmedRoot respectively ReceiptProof trie.ProofChain }
data structure of SPV of any transaction packed in any chain (main-chain or sub-chains) only blocks blocks that have been confirmed by the main chain on the sub-chain are considered final confirmation
func (*TxFinalProof) FinalVerify ¶ added in v0.3.1
func (p *TxFinalProof) FinalVerify() error
use the main chain block to prove the transaction on any chain Hash(Receipt) -> Hash(Sub.BlockA) -> Hash(Sub.BlockX) -> Main.BlockB.ConfirmedRoot or Hash(Main.BlockB), or: Hash(Receipt) -> Hash(Main.BlockA) -> Main.BlockB.HashHistory or Hash(Main.BlockB)
func (*TxFinalProof) InfoString ¶
func (p *TxFinalProof) InfoString(level common.IndentLevel) string
func (*TxFinalProof) LocalVerify ¶ added in v0.3.1
func (p *TxFinalProof) LocalVerify() error
prove the transaction receipt using the block containing the transaction Hash(Receipt) -> block.ReceiptRoot or Hash(block)
func (*TxFinalProof) Validate ¶
func (p *TxFinalProof) Validate(comm *Committee) error
type TxParam ¶
type TxParam struct { Version uint64 // for rtl compatibility HisProof trie.ProofChain // the history proof from ProofHeight/ConfirmedHeight in requests of cashing or cancelling CashCheck to ParentHeight in block header }
由于节点不能保证存储各链的历史数据,当一个节点重新执行历史块时,很有可能无法从本地获得历史数据进行验证, 导致执行结果与打包时不一致。为此,增加TxParam,由Proposer节点在打包块时,将这部分信息以自证方式保存 在块中,后续的校验则不用再使用历史数据。 Since the nodes cannot guarantee to store the historical data of each chain, when a node re-executes the historical block, it is very likely that the historical data cannot be obtained locally for verification, resulting in inconsistent execution results and packaging. To this end, TxParam is added, and when the Proposer node packs the block, this part of the information is stored in the block in a self-certified manner, and the subsequent verification does not need to use historical data. Always used for system contracts since v2.14.2
func (*TxParam) InfoString ¶
type TxParams ¶
type TxParams struct {
// contains filtered or unexported fields
}
func EmptyTxParams ¶
func EmptyTxParams() *TxParams
func NewTxParamsWithSlice ¶
func NilTxParams ¶
func (*TxParams) AppendBytes ¶
type UnDelegateResult ¶
type UnDelegateResult struct { TxHash common.Hash `json:"-"` Type ActRptType `json:"-"` NIDH common.Hash `json:"nidh"` Result *UnDelegating `json:"result,omitempty"` }
func (*UnDelegateResult) Receipt ¶
func (r *UnDelegateResult) Receipt() *RRActReceipt
func (*UnDelegateResult) String ¶
func (r *UnDelegateResult) String() string
type UnDelegating ¶
type UnDelegating struct { Demand common.EraNum `json:"demand"` // the era on when the revocation was issued Amount *big.Int `json:"amount"` // should not be nil }
since v2.12.0, delegation to be revoked
func (*UnDelegating) Clone ¶
func (u *UnDelegating) Clone() *UnDelegating
func (*UnDelegating) Compare ¶
func (u *UnDelegating) Compare(o *UnDelegating) int
func (*UnDelegating) Equal ¶
func (u *UnDelegating) Equal(o *UnDelegating) bool
func (*UnDelegating) ExpireEra ¶
func (u *UnDelegating) ExpireEra() common.EraNum
func (*UnDelegating) Expired ¶
func (u *UnDelegating) Expired(era common.EraNum) bool
func (*UnDelegating) IsValid ¶
func (u *UnDelegating) IsValid() bool
func (*UnDelegating) String ¶
func (u *UnDelegating) String() string
type UnDelegatings ¶
type UnDelegatings []*UnDelegating
func (UnDelegatings) Add ¶
func (us UnDelegatings) Add(txHash common.Hash, ud *UnDelegating) (rs UnDelegatings, changed bool, result *UnDelegateResult, err error)
func (UnDelegatings) AddAct ¶
func (us UnDelegatings) AddAct(act *RRAct) (rs UnDelegatings, changed bool, result *UnDelegateResult, err error)
func (UnDelegatings) All ¶
func (us UnDelegatings) All() *big.Int
func (UnDelegatings) Clone ¶
func (us UnDelegatings) Clone() UnDelegatings
func (UnDelegatings) Copy ¶
func (us UnDelegatings) Copy() UnDelegatings
func (UnDelegatings) Equal ¶
func (us UnDelegatings) Equal(os UnDelegatings) bool
func (UnDelegatings) InfoString ¶
func (us UnDelegatings) InfoString(level common.IndentLevel) string
func (UnDelegatings) Len ¶
func (us UnDelegatings) Len() int
func (UnDelegatings) Less ¶
func (us UnDelegatings) Less(i, j int) bool
func (UnDelegatings) String ¶
func (us UnDelegatings) String() string
func (UnDelegatings) Swap ¶
func (us UnDelegatings) Swap(i, j int)
type VrfResulter ¶
type VrfResulter interface { GetNodeID() common.NodeID GetVrfResult() (sortHash *common.Hash, proof []byte, factorHash *common.Hash, randNum uint32) GetRRProof() *RRProofs VrfVerify(seed common.Seed, rootHashAtEra common.Hash) error }
Election type interface based on VRF algorithm
type Waterlines ¶
type Waterlines []ShardWaterline
It is used to save the ordered waterlines of all other shards in the same group after the execution of this block in this chain
func (Waterlines) Equal ¶
func (ws Waterlines) Equal(os Waterlines) bool
func (Waterlines) HashValue ¶
func (ws Waterlines) HashValue() ([]byte, error)
func (Waterlines) Len ¶
func (ws Waterlines) Len() int
func (Waterlines) Less ¶
func (ws Waterlines) Less(i, j int) bool
func (Waterlines) Swap ¶
func (ws Waterlines) Swap(i, j int)
type WithdrawResult ¶
type WithdrawResult struct { TxHash common.Hash `json:"-"` Type ActRptType `json:"-"` NIDH common.Hash `json:"nidh"` Result *Withdrawing `json:"result,omitempty"` }
func (*WithdrawResult) Receipt ¶
func (r *WithdrawResult) Receipt() *RRActReceipt
func (*WithdrawResult) String ¶
func (r *WithdrawResult) String() string
type Withdrawing ¶
type Withdrawing struct { // since v2.11.0, change to the era of withdraw request execution, will cause the // generated withdraws to be delayed by one more WithdrawDelayEras. Demand common.EraNum `json:"demand"` // Withdraw amount, if nil, it means withdrawing all Amount *big.Int `json:"amount,omitempty"` }
expireEra >= (Withdrawing.Demand + WithdrawDelayEras) Withdrawing.Demand >= (DepositIndex.Era + MinDepositEras)
func (*Withdrawing) Clone ¶
func (w *Withdrawing) Clone() *Withdrawing
func (*Withdrawing) Compare ¶
func (w *Withdrawing) Compare(o *Withdrawing) int
order by (Demand, Account, Amount)
func (*Withdrawing) Equal ¶
func (w *Withdrawing) Equal(o *Withdrawing) bool
func (*Withdrawing) ExpireEra ¶
func (w *Withdrawing) ExpireEra() common.EraNum
func (*Withdrawing) Expired ¶
func (w *Withdrawing) Expired(era common.EraNum) bool
func (*Withdrawing) IsValid ¶
func (w *Withdrawing) IsValid() bool
func (*Withdrawing) String ¶
func (w *Withdrawing) String() string
func (*Withdrawing) WithdrawingAll ¶
func (w *Withdrawing) WithdrawingAll() bool
PoolAddr==nil && Amount==nil means the node is exiting from pledge
type Withdrawings ¶
type Withdrawings []*Withdrawing
func (Withdrawings) Add ¶
func (ws Withdrawings) Add(act *RRAct) (rs Withdrawings, changed bool, result *WithdrawResult, err error)
Create Withdrawing according to act, and insert or merge into ws according to the requested time and return, and return WithdrawResult at the same time. ws will not be modified.
func (Withdrawings) After ¶
func (ws Withdrawings) After(era common.EraNum) (after Withdrawings, removed int)
func (Withdrawings) All ¶
func (ws Withdrawings) All() (withdrawing *big.Int, withdrawingAll bool)
The total amount withdrawing to be withdrawed in the current withdrawing list. If all withdrawing are made, withdrawingAll is true, and the withdrawing value is meaningless
func (Withdrawings) Clone ¶
func (ws Withdrawings) Clone() Withdrawings
func (Withdrawings) Copy ¶
func (ws Withdrawings) Copy() Withdrawings
func (Withdrawings) Equal ¶
func (ws Withdrawings) Equal(os Withdrawings) bool
func (Withdrawings) GetWithdrawing ¶
func (ws Withdrawings) GetWithdrawing(expireEra common.EraNum) *Withdrawing
func (Withdrawings) HasWithdrawingAll ¶
func (ws Withdrawings) HasWithdrawingAll() (int, bool)
func (Withdrawings) InfoString ¶
func (ws Withdrawings) InfoString(level common.IndentLevel) string
func (Withdrawings) Len ¶
func (ws Withdrawings) Len() int
func (Withdrawings) Less ¶
func (ws Withdrawings) Less(i, j int) bool
func (Withdrawings) String ¶
func (ws Withdrawings) String() string
func (Withdrawings) Swap ¶
func (ws Withdrawings) Swap(i, j int)
Source Files ¶
- account.go
- adapt.go
- basic.go
- bridge.go
- bridgeinfo_abi.go
- chaintrie.go
- committees.go
- commons.go
- confirmed.go
- consensus.go
- consensusevents.go
- consts.go
- controller.go
- dataevents.go
- deltafrompool.go
- eth_access_list_tx.go
- eth_dynamic_fee_tx.go
- eth_legacy.go
- eth_tkm.go
- eth_transaction.go
- eth_txdata.go
- gen_log_json.go
- headertrie.go
- penalty.go
- posv3.go
- posv3_abi.go
- preelect.go
- proofs.go
- receipt.go
- requestsadmin.go
- requestscheck.go
- requesttools.go
- restartcomm.go
- reward.go
- rpcs.go
- scbridge_abi.go
- scforward_abi.go
- scmanagechains_abi.go
- scmcomm_abi.go
- scnewchainsetting_abi.go
- scrr_abi.go
- scsharereward_abi.go
- scversion_abi.go
- settles.go
- shared.go
- syscontracts.go
- transaction_signing.go
- tries.go
- txextras.go
- types.go
- utils.go
- vm.go