Documentation ¶
Index ¶
- Constants
- Variables
- func BytesToHex(h []byte) []byte
- func CloneTransaction[T any, C TXConstraint[T]](tx *T) *T
- func CopyAddress(src *common.Address) *common.Address
- func GenerateTransactionAndSigner(nonce uint64, to *Address, value *big.Int, data []byte) (*Transaction, *Signer, error)
- func GenerateWrongSignTransactionAndSigner(illegalSign bool) (*Transaction, *Signer, error)
- func HexToBytes(src []byte) []byte
- func InitEIP155Signer(chainId *big.Int)
- func IsZeroBytes(bytes []byte) bool
- func MarshalObjects[T any, Constraint CodecObjectConstraint[T]](objs []*T) ([]byte, error)
- func MarshalReceipts(objs []*Receipt) ([]byte, error)
- func MarshalTransactions(objs []*Transaction) ([]byte, error)
- func PrefixedRlpHash(prefix byte, x any) *common.Hash
- func RecoverPlain(hash []byte, R, S, Vb *big.Int, homestead bool) ([]byte, error)
- func RecycleTrieNode(n Node)
- func RlpHash(x any) *common.Hash
- func UnmarshalObjects[T any, Constraint CodecObjectConstraint[T]](data []byte) ([]*T, error)
- func UnmarshalObjectsWithIndex[T any, Constraint CodecObjectConstraint[T]](data []byte, index uint64) (*T, error)
- type AccessList
- type AccessListTx
- func (tx *AccessListTx) EffectiveGasPrice(baseFee *big.Int) *big.Int
- func (tx *AccessListTx) GetAccessList() types.AccessList
- func (tx *AccessListTx) GetChainID() *big.Int
- func (tx *AccessListTx) GetData() []byte
- func (tx *AccessListTx) GetGas() uint64
- func (tx *AccessListTx) GetGasFeeCap() *big.Int
- func (tx *AccessListTx) GetGasPrice() *big.Int
- func (tx *AccessListTx) GetGasTipCap() *big.Int
- func (tx *AccessListTx) GetIncentiveAddress() *common.Address
- func (tx *AccessListTx) GetNonce() uint64
- func (tx *AccessListTx) GetTo() *common.Address
- func (tx *AccessListTx) GetValue() *big.Int
- func (tx *AccessListTx) RawSignatureValues() (v, r, s *big.Int)
- func (tx *AccessListTx) TxType() byte
- type AccessTuple
- type Address
- type Block
- type BlockBody
- type BlockExtra
- type BlockHeader
- type Bloom
- type CallArgs
- type ChainMeta
- type Child
- type CodecObject
- type CodecObjectConstraint
- type CoinNumber
- type ConsensusParams
- type DynamicFeeTx
- func (tx *DynamicFeeTx) EffectiveGasPrice(baseFee *big.Int) *big.Int
- func (tx *DynamicFeeTx) GetAccessList() types.AccessList
- func (tx *DynamicFeeTx) GetChainID() *big.Int
- func (tx *DynamicFeeTx) GetData() []byte
- func (tx *DynamicFeeTx) GetGas() uint64
- func (tx *DynamicFeeTx) GetGasFeeCap() *big.Int
- func (tx *DynamicFeeTx) GetGasPrice() *big.Int
- func (tx *DynamicFeeTx) GetGasTipCap() *big.Int
- func (tx *DynamicFeeTx) GetIncentiveAddress() *common.Address
- func (tx *DynamicFeeTx) GetNonce() uint64
- func (tx *DynamicFeeTx) GetTo() *common.Address
- func (tx *DynamicFeeTx) GetValue() *big.Int
- func (tx *DynamicFeeTx) RawSignatureValues() (v, r, s *big.Int)
- func (tx *DynamicFeeTx) TxType() byte
- type EIP155Signer
- type Eip2930Signer
- type EpochInfo
- type EvmLog
- type FinanceParams
- type Hash
- func (h *Hash) Bytes() []byte
- func (h *Hash) CalculateHash() ([]byte, error)
- func (h *Hash) Clone() *Hash
- func (h *Hash) ETHHash() common.Hash
- func (h *Hash) Equals(other mt.Content) (bool, error)
- func (h *Hash) IsZero() bool
- func (h *Hash) MarshalJSON() ([]byte, error)
- func (h *Hash) SetBytes(b []byte)
- func (h *Hash) Size() int
- func (h *Hash) String() string
- func (h *Hash) UnmarshalJSON(data []byte) error
- type IncentiveTx
- func (tx *IncentiveTx) EffectiveGasPrice(baseFee *big.Int) *big.Int
- func (tx *IncentiveTx) GetAccessList() types.AccessList
- func (tx *IncentiveTx) GetChainID() *big.Int
- func (tx *IncentiveTx) GetData() []byte
- func (tx *IncentiveTx) GetGas() uint64
- func (tx *IncentiveTx) GetGasFeeCap() *big.Int
- func (tx *IncentiveTx) GetGasPrice() *big.Int
- func (tx *IncentiveTx) GetGasTipCap() *big.Int
- func (tx *IncentiveTx) GetIncentiveAddress() *common.Address
- func (tx *IncentiveTx) GetNonce() uint64
- func (tx *IncentiveTx) GetTo() *common.Address
- func (tx *IncentiveTx) GetValue() *big.Int
- func (tx *IncentiveTx) RawSignatureValues() (v, r, s *big.Int)
- func (tx *IncentiveTx) TxType() byte
- type InnerAccount
- type InternalNode
- type KeccakState
- type LeafNode
- type LegacyTx
- func (tx *LegacyTx) EffectiveGasPrice(baseFee *big.Int) *big.Int
- func (tx *LegacyTx) GetAccessList() types.AccessList
- func (tx *LegacyTx) GetChainID() *big.Int
- func (tx *LegacyTx) GetData() []byte
- func (tx *LegacyTx) GetGas() uint64
- func (tx *LegacyTx) GetGasFeeCap() *big.Int
- func (tx *LegacyTx) GetGasPrice() *big.Int
- func (tx *LegacyTx) GetGasTipCap() *big.Int
- func (tx *LegacyTx) GetIncentiveAddress() *common.Address
- func (tx *LegacyTx) GetNonce() uint64
- func (tx *LegacyTx) GetTo() *common.Address
- func (tx *LegacyTx) GetValue() *big.Int
- func (tx *LegacyTx) RawSignatureValues() (v, r, s *big.Int)
- func (tx *LegacyTx) TxType() byte
- type LondonSigner
- type MiscParams
- type Node
- type NodeInfo
- type NodeKey
- type NodeKeyHeap
- type NodeMetaData
- type NodeStatus
- type RbftTransaction
- type Receipt
- type ReceiptStatus
- type Signer
- type SnapshotJournal
- type SnapshotJournalEntry
- type StakeParams
- type StateDelta
- type TXConstraint
- type Transaction
- func GenerateAccessListTxAndSigner() (*Transaction, error)
- func GenerateDynamicFeeTxAndSinger() (*Transaction, error)
- func GenerateEmptyTransactionAndSigner() (*Transaction, error)
- func GenerateTransactionWithGasPrice(nonce uint64, gas uint64, gasPrice *big.Int, s *Signer) (*Transaction, error)
- func GenerateTransactionWithSigner(nonce uint64, to *Address, value *big.Int, data []byte, s *Signer) (*Transaction, error)
- func UnmarshalTransactionWithIndex(data []byte, index uint64) (*Transaction, error)
- func UnmarshalTransactions(data []byte) ([]*Transaction, error)
- func (tx *Transaction) Clone() *Transaction
- func (tx *Transaction) DecodeRLP(s *rlp.Stream) error
- func (tx *Transaction) EncodeRLP(w io.Writer) error
- func (tx *Transaction) FromCallArgs(callArgs CallArgs)
- func (tx *Transaction) GetAccessList() types.AccessList
- func (tx *Transaction) GetChainID() *big.Int
- func (tx *Transaction) GetExtra() []byte
- func (tx *Transaction) GetFrom() *Address
- func (tx *Transaction) GetGas() uint64
- func (tx *Transaction) GetGasFeeCap() *big.Int
- func (tx *Transaction) GetGasPrice() *big.Int
- func (tx *Transaction) GetGasTipCap() *big.Int
- func (tx *Transaction) GetHash() *Hash
- func (tx *Transaction) GetInner() TxData
- func (tx *Transaction) GetNonce() uint64
- func (tx *Transaction) GetPayload() []byte
- func (tx *Transaction) GetRawSignature() (v, r, s *big.Int)
- func (tx *Transaction) GetSignHash() *Hash
- func (tx *Transaction) GetSignature() []byte
- func (tx *Transaction) GetTimeStamp() int64
- func (tx *Transaction) GetTo() *Address
- func (tx *Transaction) GetType() byte
- func (tx *Transaction) GetValue() *big.Int
- func (tx *Transaction) GetVersion() []byte
- func (tx *Transaction) Marshal() ([]byte, error)
- func (tx *Transaction) MarshalBinary() ([]byte, error)
- func (tx *Transaction) MarshalJSON() ([]byte, error)
- func (tx *Transaction) Protected() bool
- func (tx *Transaction) RbftClone() RbftTransaction
- func (tx *Transaction) RbftGetAccessList() AccessList
- func (tx *Transaction) RbftGetData() []byte
- func (tx *Transaction) RbftGetFrom() string
- func (tx *Transaction) RbftGetGasFeeCap() *big.Int
- func (tx *Transaction) RbftGetGasLimit() uint64
- func (tx *Transaction) RbftGetGasPrice() *big.Int
- func (tx *Transaction) RbftGetNonce() uint64
- func (tx *Transaction) RbftGetSize() int
- func (tx *Transaction) RbftGetTimeStamp() int64
- func (tx *Transaction) RbftGetTo() string
- func (tx *Transaction) RbftGetTxHash() string
- func (tx *Transaction) RbftGetValue() *big.Int
- func (tx *Transaction) RbftIsConfigTx() bool
- func (tx *Transaction) RbftMarshal() ([]byte, error)
- func (tx *Transaction) RbftUnmarshal(raw []byte) error
- func (tx *Transaction) Sign(prv *ecdsa.PrivateKey) error
- func (tx *Transaction) SignByTxType(prv *ecdsa.PrivateKey) error
- func (tx *Transaction) Size() int
- func (tx *Transaction) Unmarshal(buf []byte) error
- func (tx *Transaction) UnmarshalBinary(b []byte) error
- func (tx *Transaction) VerifySignature() error
- type TransactionMeta
- type TrieJournal
- type TxData
Constants ¶
const ( ProposerElectionTypeWRF = "wrf" ProposerElectionTypeAbnormalRotation = "abnormal-rotation" RatioLimit = 10000 )
const ( TrieDegree = 16 TypeInternalNode = 0 TypeLeafNode = 1 )
const ( LegacyTxType = iota AccessListTxType DynamicFeeTxType IncentiveTxType )
Transaction types.
const (
BloomByteLength = 256
)
Lengths of hashes and addresses in bytes.
Variables ¶
var AxcUnit = big.NewInt(1_000000000_000000000)
var AxcUnitStr = "axc"
var GmolUnit = big.NewInt(1_000000000)
var GmolUnitStr = "gmol"
var MolUnit = big.NewInt(1)
var MolUnitStr = "mol"
Functions ¶
func BytesToHex ¶
BytesToHex expand normal bytes to hex bytes (nibbles)
func CloneTransaction ¶
func CloneTransaction[T any, C TXConstraint[T]](tx *T) *T
func GenerateWrongSignTransactionAndSigner ¶
func GenerateWrongSignTransactionAndSigner(illegalSign bool) (*Transaction, *Signer, error)
NOTICE!! this function just supoort for unit test case
func HexToBytes ¶
HexToBytes compress hex bytes (also called nibbles) to normal bytes
func InitEIP155Signer ¶
func IsZeroBytes ¶
func MarshalObjects ¶
func MarshalObjects[T any, Constraint CodecObjectConstraint[T]](objs []*T) ([]byte, error)
func MarshalReceipts ¶
func MarshalTransactions ¶
func MarshalTransactions(objs []*Transaction) ([]byte, error)
func PrefixedRlpHash ¶
PrefixedRlpHash writes the prefix into the hasher before rlp-encoding x. It's used for typed transactions.
func RecoverPlain ¶
func RecycleTrieNode ¶
func RecycleTrieNode(n Node)
func UnmarshalObjects ¶
func UnmarshalObjects[T any, Constraint CodecObjectConstraint[T]](data []byte) ([]*T, error)
func UnmarshalObjectsWithIndex ¶
func UnmarshalObjectsWithIndex[T any, Constraint CodecObjectConstraint[T]](data []byte, index uint64) (*T, error)
Types ¶
type AccessList ¶
type AccessList []AccessTuple
AccessList is an EIP-2930 access list.
func (AccessList) ToEthAccessList ¶
func (l AccessList) ToEthAccessList() types.AccessList
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 types.AccessList // EIP-2930 access list V, R, S *big.Int // signature values }
AccessListTx is the data of EIP-2930 access list transactions.
func (*AccessListTx) EffectiveGasPrice ¶
func (tx *AccessListTx) EffectiveGasPrice(baseFee *big.Int) *big.Int
func (*AccessListTx) GetAccessList ¶
func (tx *AccessListTx) GetAccessList() types.AccessList
func (*AccessListTx) GetChainID ¶
func (tx *AccessListTx) GetChainID() *big.Int
func (*AccessListTx) GetData ¶
func (tx *AccessListTx) GetData() []byte
func (*AccessListTx) GetGas ¶
func (tx *AccessListTx) GetGas() uint64
func (*AccessListTx) GetGasFeeCap ¶
func (tx *AccessListTx) GetGasFeeCap() *big.Int
func (*AccessListTx) GetGasPrice ¶
func (tx *AccessListTx) GetGasPrice() *big.Int
func (*AccessListTx) GetGasTipCap ¶
func (tx *AccessListTx) GetGasTipCap() *big.Int
func (*AccessListTx) GetIncentiveAddress ¶
func (tx *AccessListTx) GetIncentiveAddress() *common.Address
func (*AccessListTx) GetNonce ¶
func (tx *AccessListTx) GetNonce() uint64
func (*AccessListTx) GetTo ¶
func (tx *AccessListTx) GetTo() *common.Address
func (*AccessListTx) GetValue ¶
func (tx *AccessListTx) GetValue() *big.Int
func (*AccessListTx) RawSignatureValues ¶
func (tx *AccessListTx) RawSignatureValues() (v, r, s *big.Int)
func (*AccessListTx) TxType ¶
func (tx *AccessListTx) TxType() byte
type AccessTuple ¶
AccessTuple is the element type of an access list.
func (AccessTuple) ToEthAccessTuple ¶
func (t AccessTuple) ToEthAccessTuple() types.AccessTuple
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
func NewAddress ¶
NewAddress BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped address the left.
func NewAddressByStr ¶
func (*Address) ETHAddress ¶
func (*Address) MarshalJSON ¶
func (*Address) SetBytes ¶
SetBytes sets the address to the value of b. If b is larger than len(a) it will panic.
func (*Address) String ¶
String returns an EIP55-compliant hex string representation of the address.
func (*Address) UnmarshalJSON ¶
type Block ¶
type Block struct { Header *BlockHeader Transactions []*Transaction Extra *BlockExtra }
func (*Block) CalculateSize ¶
type BlockBody ¶
type BlockBody struct { Transactions []*Transaction Extra *BlockExtra }
type BlockExtra ¶
type BlockExtra struct { // full block size Size int64 }
For TIMC and system contract
func (*BlockExtra) Clone ¶
func (b *BlockExtra) Clone() *BlockExtra
func (*BlockExtra) Marshal ¶
func (b *BlockExtra) Marshal() ([]byte, error)
func (*BlockExtra) Unmarshal ¶
func (b *BlockExtra) Unmarshal(data []byte) error
type BlockHeader ¶
type BlockHeader struct { Number uint64 StateRoot *Hash TxRoot *Hash ReceiptRoot *Hash ParentHash *Hash Timestamp int64 Epoch uint64 Bloom *Bloom ProposerNodeID uint64 GasPrice uint64 GasUsed uint64 TotalGasFee *big.Int GasFeeReward *big.Int // contains filtered or unexported fields }
func (*BlockHeader) CalculateHash ¶
func (h *BlockHeader) CalculateHash() *Hash
func (*BlockHeader) Clone ¶
func (h *BlockHeader) Clone() *BlockHeader
func (*BlockHeader) Hash ¶
func (h *BlockHeader) Hash() *Hash
func (*BlockHeader) Marshal ¶
func (h *BlockHeader) Marshal() ([]byte, error)
func (*BlockHeader) Unmarshal ¶
func (h *BlockHeader) Unmarshal(data []byte) error
type Bloom ¶
type Bloom [BloomByteLength]byte
type CallArgs ¶
type CallArgs struct { From *common.Address `json:"from"` To *common.Address `json:"to"` Gas *hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` Value *hexutil.Big `json:"value"` Nonce *hexutil.Uint64 `json:"nonce"` Data *hexutil.Bytes `json:"data"` Input *hexutil.Bytes `json:"input"` AccessList *types.AccessList `json:"accessList"` ChainID *hexutil.Big `json:"chainId,omitempty"` }
CallArgs represents the arguments for a call.
func (*CallArgs) ToTransaction ¶
func (args *CallArgs) ToTransaction() *types.Transaction
ToTransaction converts the arguments to a transaction. This assumes that setDefaults has been called.
type CodecObject ¶
type CodecObjectConstraint ¶
type CodecObjectConstraint[T any] interface { *T CodecObject }
type CoinNumber ¶
func CoinNumberByAxc ¶
func CoinNumberByAxc(axc uint64) *CoinNumber
func CoinNumberByBigInt ¶
func CoinNumberByBigInt(x *big.Int) *CoinNumber
func CoinNumberByGmol ¶
func CoinNumberByGmol(gmol uint64) *CoinNumber
func CoinNumberByMol ¶
func CoinNumberByMol(mol uint64) *CoinNumber
func ParseCoinNumber ¶
func ParseCoinNumber(valueStr string) (*CoinNumber, error)
func (*CoinNumber) Clone ¶
func (c *CoinNumber) Clone() *CoinNumber
func (*CoinNumber) InitNoZero ¶
func (c *CoinNumber) InitNoZero()
func (*CoinNumber) MarshalText ¶
func (c *CoinNumber) MarshalText() (text []byte, err error)
func (*CoinNumber) String ¶
func (c *CoinNumber) String() string
func (*CoinNumber) ToBigInt ¶
func (c *CoinNumber) ToBigInt() *big.Int
func (*CoinNumber) UnmarshalText ¶
func (c *CoinNumber) UnmarshalText(b []byte) error
type ConsensusParams ¶
type ConsensusParams struct { // The proposer election type, default is wrf // wrf: WRF // abnormal-rotation: rotating by view(pbft logic, disable auto change proposer) ProposerElectionType string `mapstructure:"proposer_election_type" toml:"proposer_election_type" json:"proposer_election_type"` // The number of sustained blocks per Checkpoint. CheckpointPeriod uint64 `mapstructure:"checkpoint_period" toml:"checkpoint_period" json:"checkpoint_period"` // Used to calculate max log size in memory: CheckpointPeriod*HighWatermarkCheckpointPeriod. HighWatermarkCheckpointPeriod uint64 `` /* 127-byte string literal not displayed */ // The minimum number of validators in the network. MinValidatorNum uint64 `mapstructure:"min_validator_num" toml:"min_validator_num" json:"min_validator_num"` // The maximum number of validators in the network. MaxValidatorNum uint64 `mapstructure:"max_validator_num" toml:"max_validator_num" json:"max_validator_num"` // The maximum number of packaged transactions per block. BlockMaxTxNum uint64 `mapstructure:"block_max_tx_num" toml:"block_max_tx_num" json:"block_max_tx_num"` // Enable timed gen empty block feature. EnableTimedGenEmptyBlock bool `mapstructure:"enable_timed_gen_empty_block" toml:"enable_timed_gen_empty_block" json:"enable_timed_gen_empty_block"` // The weight of the faulty node after viewchange is triggered is set to the weight so that the node has a low probability of blocking. NotActiveWeight int64 `mapstructure:"not_active_weight" toml:"not_active_weight" json:"not_active_weight"` // The low weight of the viewchange node is restored to normal after the specified number of rounds. AbnormalNodeExcludeView uint64 `mapstructure:"abnormal_node_exclude_view" toml:"abnormal_node_exclude_view" json:"abnormal_node_exclude_view"` // The block interval for node to propose again in validators num percentage, // Ensure that a node cannot continuously produce blocks // min is 1, max is validatorSetNum - 1 AgainProposeIntervalBlockInValidatorsNumPercentage uint64 `` /* 202-byte string literal not displayed */ // ContinuousNullRequestToleranceNumber Viewchange will be sent when there is a packageable transaction locally and n nullrequests are received consecutively. ContinuousNullRequestToleranceNumber uint64 `` /* 151-byte string literal not displayed */ // ReBroadcastToleranceNumber replicate will rebroadcast pending ready txs when receiving null requests from primary above the threshold // !!! notice!!! this param must smaller than ContinuousNullRequestToleranceNumber ReBroadcastToleranceNumber uint64 `mapstructure:"rebroadcast_tolerance_number" toml:"rebroadcast_tolerance_number" json:"rebroadcast_tolerance_number"` }
func (*ConsensusParams) Validate ¶
func (p *ConsensusParams) Validate() error
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 types.AccessList // Signature values V *big.Int `json:"v" gencodec:"required"` R *big.Int `json:"r" gencodec:"required"` S *big.Int `json:"s" gencodec:"required"` }
func (*DynamicFeeTx) EffectiveGasPrice ¶
func (tx *DynamicFeeTx) EffectiveGasPrice(baseFee *big.Int) *big.Int
func (*DynamicFeeTx) GetAccessList ¶
func (tx *DynamicFeeTx) GetAccessList() types.AccessList
func (*DynamicFeeTx) GetChainID ¶
func (tx *DynamicFeeTx) GetChainID() *big.Int
func (*DynamicFeeTx) GetData ¶
func (tx *DynamicFeeTx) GetData() []byte
func (*DynamicFeeTx) GetGas ¶
func (tx *DynamicFeeTx) GetGas() uint64
func (*DynamicFeeTx) GetGasFeeCap ¶
func (tx *DynamicFeeTx) GetGasFeeCap() *big.Int
func (*DynamicFeeTx) GetGasPrice ¶
func (tx *DynamicFeeTx) GetGasPrice() *big.Int
func (*DynamicFeeTx) GetGasTipCap ¶
func (tx *DynamicFeeTx) GetGasTipCap() *big.Int
func (*DynamicFeeTx) GetIncentiveAddress ¶
func (tx *DynamicFeeTx) GetIncentiveAddress() *common.Address
func (*DynamicFeeTx) GetNonce ¶
func (tx *DynamicFeeTx) GetNonce() uint64
func (*DynamicFeeTx) GetTo ¶
func (tx *DynamicFeeTx) GetTo() *common.Address
func (*DynamicFeeTx) GetValue ¶
func (tx *DynamicFeeTx) GetValue() *big.Int
func (*DynamicFeeTx) RawSignatureValues ¶
func (tx *DynamicFeeTx) RawSignatureValues() (v, r, s *big.Int)
type EIP155Signer ¶
type EIP155Signer struct {
// contains filtered or unexported fields
}
type Eip2930Signer ¶
type Eip2930Signer struct{ EIP155Signer }
func NewEIP2930Signer ¶
func NewEIP2930Signer(chainId *big.Int) Eip2930Signer
NewEIP2930Signer returns a signer that accepts EIP-2930 access list transactions, EIP-155 replay protected transactions, and legacy Homestead transactions.
func (Eip2930Signer) SignatureValues ¶
func (s Eip2930Signer) SignatureValues(tx *Transaction, sig []byte) (R, S, V *big.Int, err error)
type EpochInfo ¶
type EpochInfo struct { // Epoch number. Epoch uint64 `mapstructure:"epoch" toml:"epoch" json:"epoch"` // The number of blocks lasting per Epoch (must be a multiple of the CheckpointPeriod). EpochPeriod uint64 `mapstructure:"epoch_period" toml:"epoch_period" json:"epoch_period"` // Epoch start block. StartBlock uint64 `mapstructure:"start_block" toml:"start_block" json:"start_block"` // Consensus params. ConsensusParams ConsensusParams `mapstructure:"consensus_params" toml:"consensus_params" json:"consensus_params"` // FinanceParams params about gas FinanceParams FinanceParams `mapstructure:"finance_params" toml:"finance_params" json:"finance_params"` // StakeParams params about stake StakeParams StakeParams `mapstructure:"stake_params" toml:"stake_params" json:"stake_params"` MiscParams MiscParams `mapstructure:"misc_params" toml:"misc_params" json:"misc_params"` }
type EvmLog ¶
type EvmLog struct { Address *Address Topics []*Hash Data []byte BlockNumber uint64 TransactionHash *Hash TransactionIndex uint64 BlockHash *Hash LogIndex uint64 Removed bool }
func (*EvmLog) MarshalJSON ¶
MarshalJSON marshals as JSON.
type FinanceParams ¶
type FinanceParams struct { GasLimit uint64 `mapstructure:"gas_limit" toml:"gas_limit" json:"gas_limit"` MinGasPrice *CoinNumber `mapstructure:"min_gas_price" toml:"min_gas_price" json:"min_gas_price"` }
func (*FinanceParams) Validate ¶
func (p *FinanceParams) Validate() error
type Hash ¶
type Hash struct {
// contains filtered or unexported fields
}
func NewHashByStr ¶
func (*Hash) CalculateHash ¶
CalculateHash hashes the values of a TestContent
func (*Hash) MarshalJSON ¶
func (*Hash) UnmarshalJSON ¶
type IncentiveTx ¶
type IncentiveTx 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 types.AccessList IncentiveAddress *common.Address // Signature values V *big.Int `json:"v" gencodec:"required"` R *big.Int `json:"r" gencodec:"required"` S *big.Int `json:"s" gencodec:"required"` }
func (*IncentiveTx) EffectiveGasPrice ¶
func (tx *IncentiveTx) EffectiveGasPrice(baseFee *big.Int) *big.Int
func (*IncentiveTx) GetAccessList ¶
func (tx *IncentiveTx) GetAccessList() types.AccessList
func (*IncentiveTx) GetChainID ¶
func (tx *IncentiveTx) GetChainID() *big.Int
func (*IncentiveTx) GetData ¶
func (tx *IncentiveTx) GetData() []byte
func (*IncentiveTx) GetGas ¶
func (tx *IncentiveTx) GetGas() uint64
func (*IncentiveTx) GetGasFeeCap ¶
func (tx *IncentiveTx) GetGasFeeCap() *big.Int
func (*IncentiveTx) GetGasPrice ¶
func (tx *IncentiveTx) GetGasPrice() *big.Int
func (*IncentiveTx) GetGasTipCap ¶
func (tx *IncentiveTx) GetGasTipCap() *big.Int
func (*IncentiveTx) GetIncentiveAddress ¶
func (tx *IncentiveTx) GetIncentiveAddress() *common.Address
func (*IncentiveTx) GetNonce ¶
func (tx *IncentiveTx) GetNonce() uint64
func (*IncentiveTx) GetTo ¶
func (tx *IncentiveTx) GetTo() *common.Address
func (*IncentiveTx) GetValue ¶
func (tx *IncentiveTx) GetValue() *big.Int
func (*IncentiveTx) RawSignatureValues ¶
func (tx *IncentiveTx) RawSignatureValues() (v, r, s *big.Int)
func (*IncentiveTx) TxType ¶
func (tx *IncentiveTx) TxType() byte
type InnerAccount ¶
type InnerAccount struct { Nonce uint64 `json:"nonce"` Balance *big.Int `json:"balance"` CodeHash []byte `json:"code_hash"` StorageRoot common.Hash `json:"storage_root"` }
func (*InnerAccount) CopyOrNewIfEmpty ¶
func (o *InnerAccount) CopyOrNewIfEmpty() *InnerAccount
func (*InnerAccount) InnerAccountChanged ¶
func (o *InnerAccount) InnerAccountChanged(account1 *InnerAccount) bool
func (*InnerAccount) Marshal ¶
func (o *InnerAccount) Marshal() ([]byte, error)
Marshal marshals the account into byte
func (*InnerAccount) String ¶
func (o *InnerAccount) String() string
func (*InnerAccount) Unmarshal ¶
func (o *InnerAccount) Unmarshal(data []byte) error
Unmarshal unmarshals the account byte into structure
type InternalNode ¶
type InternalNode struct { Children [TrieDegree]*Child // contains filtered or unexported fields }
func (*InternalNode) Encode ¶
func (n *InternalNode) Encode() []byte
func (*InternalNode) GetHash ¶
func (n *InternalNode) GetHash() common.Hash
func (*InternalNode) Type ¶
func (n *InternalNode) Type() int
type LeafNode ¶
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 }
LegacyTx is the transaction data of regular Ethereum transactions.
func (*LegacyTx) EffectiveGasPrice ¶
func (*LegacyTx) GetAccessList ¶
func (tx *LegacyTx) GetAccessList() types.AccessList
func (*LegacyTx) GetChainID ¶
func (*LegacyTx) GetGasFeeCap ¶
func (*LegacyTx) GetGasPrice ¶
func (*LegacyTx) GetGasTipCap ¶
func (*LegacyTx) GetIncentiveAddress ¶
func (*LegacyTx) RawSignatureValues ¶
type LondonSigner ¶
type LondonSigner struct{ EIP155Signer }
func NewLondonSigner ¶
func NewLondonSigner(chainId *big.Int) LondonSigner
func (LondonSigner) SignatureValues ¶
func (s LondonSigner) SignatureValues(tx *Transaction, sig []byte) (R, S, V *big.Int, err error)
type MiscParams ¶
type MiscParams struct {
TxMaxSize uint64 `mapstructure:"tx_max_size" toml:"tx_max_size" json:"tx_max_size"`
}
func (*MiscParams) Validate ¶
func (p *MiscParams) Validate() error
type Node ¶
type Node interface { Encode() []byte GetHash() common.Hash Copy() Node Type() int String() string // just for debug }
func UnmarshalJMTNodeFromPb ¶
type NodeInfo ¶
type NodeInfo struct { // The node serial number is unique in the entire network. // Once allocated, it will not change. // It is allocated through the governance contract in a manner similar to the self-incrementing primary key. ID uint64 `json:"id"` // Use BLS12-381(Use of new consensus algorithm) ConsensusPubKey string `json:"consensus_pub_key"` // Use ed25519(Currently used in consensus and p2p) P2PPubKey string `json:"p2p_pub_key"` P2PID string `json:"p2p_id"` // Operator address, with permission to manage node (can update) OperatorAddress string `json:"operator_address"` // Meta data (can update) MetaData NodeMetaData `json:"meta_data"` // Node status Status NodeStatus `json:"status"` }
type NodeKey ¶
type NodeKey struct { Version uint64 // version of current tree node. Path []byte // addressing path from root to current node. Path is part of LeafNode.Key. Type []byte // additional field for identify a tree uniquely together with Version and Path. }
func DecodeNodeKey ¶
DecodeNodeKey decode from bytes in physical storage to NodeKey
type NodeKeyHeap ¶
type NodeKeyHeap []*NodeKey // max heap to store NodeKey
func (NodeKeyHeap) Len ¶
func (h NodeKeyHeap) Len() int
func (NodeKeyHeap) Less ¶
func (h NodeKeyHeap) Less(i, j int) bool
func (*NodeKeyHeap) Pop ¶
func (h *NodeKeyHeap) Pop() any
func (*NodeKeyHeap) Push ¶
func (h *NodeKeyHeap) Push(x any)
func (NodeKeyHeap) Swap ¶
func (h NodeKeyHeap) Swap(i, j int)
type NodeMetaData ¶
type NodeStatus ¶
type NodeStatus uint8
const ( NodeStatusDataSyncer NodeStatus = iota NodeStatusCandidate NodeStatusActive NodeStatusPendingInactive NodeStatusExited )
status constants, the order is important
type RbftTransaction ¶
type RbftTransaction interface { RbftGetTxHash() string RbftGetFrom() string RbftGetTo() string RbftGetTimeStamp() int64 RbftGetData() []byte RbftGetNonce() uint64 RbftUnmarshal(raw []byte) error RbftMarshal() ([]byte, error) RbftIsConfigTx() bool RbftGetSize() int RbftGetGasPrice() *big.Int RbftGetGasLimit() uint64 RbftGetGasFeeCap() *big.Int RbftGetValue() *big.Int RbftGetAccessList() AccessList RbftClone() RbftTransaction }
type Receipt ¶
type Receipt struct { TxHash *Hash Ret []byte Status ReceiptStatus GasUsed uint64 CumulativeGasUsed uint64 EffectiveGasPrice *big.Int EvmLogs []*EvmLog Bloom *Bloom ContractAddress *Address }
func UnmarshalReceipts ¶
type ReceiptStatus ¶
type ReceiptStatus int32
const ( ReceiptSUCCESS ReceiptStatus = 0 ReceiptFAILED ReceiptStatus = 1 )
func (ReceiptStatus) String ¶
func (x ReceiptStatus) String() string
type Signer ¶
type Signer struct { Sk *ecdsa.PrivateKey Addr *Address }
func GenerateSigner ¶
func LoadSignerWithPk ¶
type SnapshotJournal ¶
type SnapshotJournal struct {
Journals []*SnapshotJournalEntry
}
func DecodeSnapshotJournal ¶
func DecodeSnapshotJournal(data []byte) (*SnapshotJournal, error)
func (*SnapshotJournal) Encode ¶
func (j *SnapshotJournal) Encode() ([]byte, error)
type SnapshotJournalEntry ¶
type SnapshotJournalEntry struct { Address *Address PrevAccount *InnerAccount AccountChanged bool PrevStates map[string][]byte }
func (*SnapshotJournalEntry) String ¶
func (entry *SnapshotJournalEntry) String() string
type StakeParams ¶
type StakeParams struct { StakeEnable bool `mapstructure:"stake_enable" toml:"stake_enable" json:"stake_enable"` MaxAddStakeRatio uint64 `mapstructure:"max_add_stake_ratio" toml:"max_add_stake_ratio" json:"max_add_stake_ratio"` MaxUnlockStakeRatio uint64 `mapstructure:"max_unlock_stake_ratio" toml:"max_unlock_stake_ratio" json:"max_unlock_stake_ratio"` MaxUnlockingRecordNum uint64 `mapstructure:"max_unlocking_record_num" toml:"max_unlocking_record_num" json:"max_unlocking_record_num"` // unit: seconds UnlockPeriod uint64 `mapstructure:"unlock_period" toml:"unlock_period" json:"unlock_period"` MaxPendingInactiveValidatorRatio uint64 `` /* 139-byte string literal not displayed */ MinDelegateStake *CoinNumber `mapstructure:"min_delegate_stake" toml:"min_delegate_stake" json:"min_delegate_stake"` MinValidatorStake *CoinNumber `mapstructure:"min_validator_stake" toml:"min_validator_stake" json:"min_validator_stake"` MaxValidatorStake *CoinNumber `mapstructure:"max_validator_stake" toml:"max_validator_stake" json:"max_validator_stake"` EnablePartialUnlock bool `mapstructure:"enable_partial_unlock" toml:"enable_partial_unlock" json:"enable_partial_unlock"` }
func (*StakeParams) Validate ¶
func (p *StakeParams) Validate() error
type StateDelta ¶
type StateDelta struct {
Journal []*TrieJournal
}
func DecodeStateDelta ¶
func DecodeStateDelta(data []byte) (*StateDelta, error)
func (*StateDelta) Encode ¶
func (delta *StateDelta) Encode() []byte
type TXConstraint ¶
type TXConstraint[T any] interface { *T RbftTransaction }
TXConstraint is used to ensure that the pointer of T must be RbftTransaction
type Transaction ¶
type Transaction struct { Inner TxData // Consensus contents of a transaction Time time.Time // Time first seen locally (spam avoidance) // contains filtered or unexported fields }
Transaction is an Ethereum transaction.
func GenerateAccessListTxAndSigner ¶
func GenerateAccessListTxAndSigner() (*Transaction, error)
func GenerateDynamicFeeTxAndSinger ¶
func GenerateDynamicFeeTxAndSinger() (*Transaction, error)
func GenerateEmptyTransactionAndSigner ¶
func GenerateEmptyTransactionAndSigner() (*Transaction, error)
func UnmarshalTransactionWithIndex ¶
func UnmarshalTransactionWithIndex(data []byte, index uint64) (*Transaction, error)
func UnmarshalTransactions ¶
func UnmarshalTransactions(data []byte) ([]*Transaction, error)
func (*Transaction) Clone ¶
func (tx *Transaction) Clone() *Transaction
func (*Transaction) DecodeRLP ¶
func (tx *Transaction) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements rlp.Decoder
func (*Transaction) EncodeRLP ¶
func (tx *Transaction) EncodeRLP(w io.Writer) error
EncodeRLP implements rlp.Encoder
func (*Transaction) FromCallArgs ¶
func (tx *Transaction) FromCallArgs(callArgs CallArgs)
func (*Transaction) GetAccessList ¶
func (tx *Transaction) GetAccessList() types.AccessList
func (*Transaction) GetChainID ¶
func (tx *Transaction) GetChainID() *big.Int
func (*Transaction) GetExtra ¶
func (tx *Transaction) GetExtra() []byte
func (*Transaction) GetFrom ¶
func (tx *Transaction) GetFrom() *Address
func (*Transaction) GetGas ¶
func (tx *Transaction) GetGas() uint64
func (*Transaction) GetGasFeeCap ¶
func (tx *Transaction) GetGasFeeCap() *big.Int
func (*Transaction) GetGasPrice ¶
func (tx *Transaction) GetGasPrice() *big.Int
func (*Transaction) GetGasTipCap ¶
func (tx *Transaction) GetGasTipCap() *big.Int
func (*Transaction) GetHash ¶
func (tx *Transaction) GetHash() *Hash
func (*Transaction) GetInner ¶
func (tx *Transaction) GetInner() TxData
func (*Transaction) GetNonce ¶
func (tx *Transaction) GetNonce() uint64
func (*Transaction) GetPayload ¶
func (tx *Transaction) GetPayload() []byte
func (*Transaction) GetRawSignature ¶
func (tx *Transaction) GetRawSignature() (v, r, s *big.Int)
RawSignatureValues returns the V, R, S signature values of the transaction. The return values should not be modified by the caller.
func (*Transaction) GetSignHash ¶
func (tx *Transaction) GetSignHash() *Hash
func (*Transaction) GetSignature ¶
func (tx *Transaction) GetSignature() []byte
func (*Transaction) GetTimeStamp ¶
func (tx *Transaction) GetTimeStamp() int64
func (*Transaction) GetTo ¶
func (tx *Transaction) GetTo() *Address
func (*Transaction) GetType ¶
func (tx *Transaction) GetType() byte
Type returns the transaction type.
func (*Transaction) GetValue ¶
func (tx *Transaction) GetValue() *big.Int
func (*Transaction) GetVersion ¶
func (tx *Transaction) GetVersion() []byte
func (*Transaction) Marshal ¶
func (tx *Transaction) Marshal() ([]byte, error)
func (*Transaction) MarshalBinary ¶
func (tx *Transaction) MarshalBinary() ([]byte, error)
MarshalBinary returns the canonical encoding of the transaction. For legacy transactions, it returns the RLP encoding. For EIP-2718 typed transactions, it returns the type and payload.
func (*Transaction) MarshalJSON ¶
func (tx *Transaction) MarshalJSON() ([]byte, error)
func (*Transaction) Protected ¶
func (tx *Transaction) Protected() bool
Protected says whether the transaction is replay-protected.
func (*Transaction) RbftClone ¶
func (tx *Transaction) RbftClone() RbftTransaction
func (*Transaction) RbftGetAccessList ¶
func (tx *Transaction) RbftGetAccessList() AccessList
func (*Transaction) RbftGetData ¶
func (tx *Transaction) RbftGetData() []byte
func (*Transaction) RbftGetFrom ¶
func (tx *Transaction) RbftGetFrom() string
func (*Transaction) RbftGetGasFeeCap ¶
func (tx *Transaction) RbftGetGasFeeCap() *big.Int
func (*Transaction) RbftGetGasLimit ¶
func (tx *Transaction) RbftGetGasLimit() uint64
func (*Transaction) RbftGetGasPrice ¶
func (tx *Transaction) RbftGetGasPrice() *big.Int
func (*Transaction) RbftGetNonce ¶
func (tx *Transaction) RbftGetNonce() uint64
func (*Transaction) RbftGetSize ¶
func (tx *Transaction) RbftGetSize() int
func (*Transaction) RbftGetTimeStamp ¶
func (tx *Transaction) RbftGetTimeStamp() int64
func (*Transaction) RbftGetTo ¶
func (tx *Transaction) RbftGetTo() string
func (*Transaction) RbftGetTxHash ¶
func (tx *Transaction) RbftGetTxHash() string
func (*Transaction) RbftGetValue ¶
func (tx *Transaction) RbftGetValue() *big.Int
func (*Transaction) RbftIsConfigTx ¶
func (tx *Transaction) RbftIsConfigTx() bool
func (*Transaction) RbftMarshal ¶
func (tx *Transaction) RbftMarshal() ([]byte, error)
func (*Transaction) RbftUnmarshal ¶
func (tx *Transaction) RbftUnmarshal(raw []byte) error
func (*Transaction) Sign ¶
func (tx *Transaction) Sign(prv *ecdsa.PrivateKey) error
func (*Transaction) SignByTxType ¶
func (tx *Transaction) SignByTxType(prv *ecdsa.PrivateKey) error
func (*Transaction) Size ¶
func (tx *Transaction) Size() int
func (*Transaction) Unmarshal ¶
func (tx *Transaction) Unmarshal(buf []byte) error
func (*Transaction) UnmarshalBinary ¶
func (tx *Transaction) UnmarshalBinary(b []byte) error
UnmarshalBinary decodes the canonical encoding of transactions. It supports legacy RLP transactions and EIP2718 typed transactions.
func (*Transaction) VerifySignature ¶
func (tx *Transaction) VerifySignature() error
type TransactionMeta ¶
func (*TransactionMeta) Marshal ¶
func (m *TransactionMeta) Marshal() ([]byte, error)
func (*TransactionMeta) Unmarshal ¶
func (m *TransactionMeta) Unmarshal(data []byte) error
type TrieJournal ¶
type TxData ¶
type TxData interface { TxType() byte // returns the type ID GetChainID() *big.Int GetAccessList() types.AccessList GetData() []byte GetGas() uint64 GetGasPrice() *big.Int GetGasTipCap() *big.Int GetGasFeeCap() *big.Int GetValue() *big.Int GetNonce() uint64 GetTo() *common.Address GetIncentiveAddress() *common.Address RawSignatureValues() (v, r, s *big.Int) EffectiveGasPrice(baseFee *big.Int) *big.Int // contains filtered or unexported methods }
TxData is the underlying data of a transaction.
This is implemented by DynamicFeeTx, LegacyTx and AccessListTx.