bookkeeping

package
v0.0.0-...-15eb78e Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxInitialGenesisAllocationSize is the maximum number of accounts that are supported when
	// bootstrapping a new network. The number of account *can* grow further after the bootstrapping.
	// This value is used exclusively for the messagepack decoder, and has no affect on the network
	// capabilities/capacity in any way.
	MaxInitialGenesisAllocationSize = 100000000
)

Variables

This section is empty.

Functions

func ProcessUpgradeParams

func ProcessUpgradeParams(prev BlockHeader) (uv UpgradeVote, us UpgradeState, err error)

ProcessUpgradeParams determines our upgrade vote, applies it, and returns the generated UpgradeVote and the new UpgradeState

func SignedTxnGroupsFlatten

func SignedTxnGroupsFlatten(txgroups [][]transactions.SignedTxn) (res []transactions.SignedTxn)

SignedTxnGroupsFlatten combines all groups into a flat slice of SignedTxns.

func SignedTxnsToGroups

func SignedTxnsToGroups(txns []transactions.SignedTxn) (res [][]transactions.SignedTxn)

SignedTxnsToGroups splits a slice of SignedTxns into groups.

Types

type Block

type Block struct {
	BlockHeader
	Payset transactions.Payset `codec:"txns"`
}

A Block contains the Payset and metadata corresponding to a given Round.

func MakeBlock

func MakeBlock(prev BlockHeader) Block

MakeBlock constructs a new valid block with an empty payset and an unset Seed.

func MakeGenesisBlock

func MakeGenesisBlock(proto protocol.ConsensusVersion, genesisBal GenesisBalances, genesisID string, genesisHash crypto.Digest) (Block, error)

MakeGenesisBlock creates a genesis block, including setup of RewardsState.

func (*Block) CanMarshalMsg

func (_ *Block) CanMarshalMsg(z interface{}) bool

func (*Block) CanUnmarshalMsg

func (_ *Block) CanUnmarshalMsg(z interface{}) bool

func (Block) ConsensusProtocol

func (block Block) ConsensusProtocol() config.ConsensusParams

ConsensusProtocol returns the consensus protocol params for a block

func (Block) ContentsMatchHeader

func (block Block) ContentsMatchHeader() bool

ContentsMatchHeader checks that the TxnRoot matches what's in the header, as the header is what the block hash authenticates. If we're given an untrusted block and a known-good hash, we can't trust the block's transactions unless we validate this.

func (Block) DecodePaysetFlat

func (block Block) DecodePaysetFlat() ([]transactions.SignedTxnWithAD, error)

DecodePaysetFlat decodes block.Payset using DecodeSignedTxn, and flattens groups.

func (Block) DecodePaysetGroups

func (block Block) DecodePaysetGroups() ([][]transactions.SignedTxnWithAD, error)

DecodePaysetGroups decodes block.Payset using DecodeSignedTxn, and returns the transactions in groups.

블록안에 들어있는 서명된 트랜잭션 그룹을 반환한다.

func (Block) Digest

func (block Block) Digest() crypto.Digest

Digest returns a cryptographic digest summarizing the Block.

func (Block) GenesisHash

func (block Block) GenesisHash() crypto.Digest

GenesisHash returns the genesis hash from the block header

func (Block) GenesisID

func (block Block) GenesisID() string

GenesisID returns the genesis ID from the block header

func (*Block) MarshalMsg

func (z *Block) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*Block) MsgIsZero

func (z *Block) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*Block) Msgsize

func (z *Block) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Block) PaysetCommit

func (block Block) PaysetCommit() (crypto.Digest, error)

PaysetCommit computes the commitment to the payset, using the appropriate commitment plan based on the block's protocol.

func (Block) Round

func (block Block) Round() basics.Round

Round returns the Round for which the Block is relevant

func (*Block) Seed

func (block *Block) Seed() committee.Seed

Seed returns the Block's random seed.

func (Block) String

func (b Block) String() string

func (Block) TxnMerkleTree

func (block Block) TxnMerkleTree() (*merklearray.Tree, error)

TxnMerkleTree returns a cryptographic commitment to the transactions in the block, along with their ApplyData, as a Merkle tree. This allows the caller to either extract the root hash (for inclusion in the block header), or to generate proofs of membership for transactions that are in this block.

블록안의 트랜잭션들에 대한 머클트리를 반환한다. 이것은 호출자가 root hash를 추출하거나 블록안의 트랜잭션들에 대한 멤버십 증명을 생성할 수 있다.

func (*Block) UnmarshalMsg

func (z *Block) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

func (Block) WithSeed

func (block Block) WithSeed(s committee.Seed) Block

WithSeed returns a copy of the Block with the seed set to s.

type BlockHash

type BlockHash crypto.Digest

BlockHash represents the hash of a block

func (*BlockHash) CanMarshalMsg

func (_ *BlockHash) CanMarshalMsg(z interface{}) bool

func (*BlockHash) CanUnmarshalMsg

func (_ *BlockHash) CanUnmarshalMsg(z interface{}) bool

func (*BlockHash) MarshalMsg

func (z *BlockHash) MarshalMsg(b []byte) []byte

MarshalMsg implements msgp.Marshaler

func (BlockHash) MarshalText

func (b BlockHash) MarshalText() ([]byte, error)

MarshalText returns the BlockHash string as an array of bytes

func (*BlockHash) MsgIsZero

func (z *BlockHash) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*BlockHash) Msgsize

func (z *BlockHash) Msgsize() int

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (BlockHash) String

func (b BlockHash) String() string

func (*BlockHash) UnmarshalMsg

func (z *BlockHash) UnmarshalMsg(bts []byte) ([]byte, error)

UnmarshalMsg implements msgp.Unmarshaler

func (*BlockHash) UnmarshalText

func (b *BlockHash) UnmarshalText(text []byte) error

UnmarshalText initializes the BlockHash from an array of bytes.

type BlockHeader

type BlockHeader struct {
	Round basics.Round `codec:"rnd"`

	// The hash of the previous block
	Branch BlockHash `codec:"prev"`

	// Sortition seed
	Seed committee.Seed `codec:"seed"`

	// TxnRoot authenticates the set of transactions appearing in the block.
	// The commitment is computed based on the PaysetCommit type specified
	// in the block's consensus protocol.
	/*
		TxnRoot는 블록에 나타나는 트랜잭션 집합을 인증한다.
	*/
	TxnRoot crypto.Digest `codec:"txn"`

	// TimeStamp in seconds since epoch
	TimeStamp int64 `codec:"ts"`

	// Genesis ID to which this block belongs.
	GenesisID string `codec:"gen"`

	// Genesis hash to which this block belongs.
	/*
		이 블록이 속한 제네시스 해시
	*/
	GenesisHash crypto.Digest `codec:"gh"`

	// Rewards.
	//
	// When a block is applied, some amount of rewards are accrued to
	// every account with AccountData.Status=/=NotParticipating.  The
	// amount is (thisBlock.RewardsLevel-prevBlock.RewardsLevel) of
	// MicroNovas for every whole config.Protocol.RewardUnit of MicroNovas in
	// that account's AccountData.MicroNovas.
	//
	// Rewards are not compounded (i.e., not added to AccountData.MicroNovas)
	// until some other transaction is executed on that account.
	//
	// Not compounding rewards allows us to precisely know how many algos
	// of rewards will be distributed without having to examine every
	// account to determine if it should get one more algo of rewards
	// because compounding formed another whole config.Protocol.RewardUnit
	// of algos.
	/*
		블록이 적용되면 AccountData.Status가 NotParticipating가 아닌 계정들에게 보상이 적립된다.
		보상은 이 계정에서 다른 트랜잭션이 실행되기 전까지 내 자산으로 들어오지 않는다.
	*/
	RewardsState

	// Consensus protocol versioning.
	//
	// Each block is associated with a version of the consensus protocol,
	// stored under UpgradeState.CurrentProtocol.  The protocol version
	// for a block can be determined without having to first decode the
	// block and its CurrentProtocol field, and this field is present for
	// convenience and explicitness.  Block.Valid() checks that this field
	// correctly matches the expected protocol version.
	//
	// Each block is associated with at most one active upgrade proposal
	// (a new version of the protocol).  An upgrade proposal can be made
	// by a block proposer, as long as no other upgrade proposal is active.
	// The upgrade proposal lasts for many rounds (UpgradeVoteRounds), and
	// in each round, that round's block proposer votes to support (or not)
	// the proposed upgrade.
	//
	// If enough votes are collected, the proposal is approved, and will
	// definitely take effect.  The proposal lingers for some number of
	// rounds to give clients a chance to notify users about an approved
	// upgrade, if the client doesn't support it, so the user has a chance
	// to download updated client software.
	//
	// Block proposers influence this upgrade machinery through two fields
	// in UpgradeVote: UpgradePropose, which proposes an upgrade to a new
	// protocol, and UpgradeApprove, which signals approval of the current
	// proposal.
	//
	// Once a block proposer determines its UpgradeVote, then UpdateState
	// is updated deterministically based on the previous UpdateState and
	// the new block's UpgradeVote.
	UpgradeState
	UpgradeVote

	// TxnCounter counts the number of transactions committed in the
	// ledger, from the time at which support for this feature was
	// introduced.
	//
	// Specifically, TxnCounter is the number of the next transaction
	// that will be committed after this block.  It is 0 when no
	// transactions have ever been committed (since TxnCounter
	// started being supported).
	TxnCounter uint64 `codec:"tc"`

	// CompactCert tracks the state of compact certs, potentially
	// for multiple types of certs.
	//msgp:sort protocol.CompactCertType protocol.SortCompactCertTy
	/*
		CompactCert는 잠재적으로 여러 유형의 인증서에 대한 컴팩트 인증서의 상태를 추적.
	*/
	CompactCert map[protocol.CompactCertType]CompactCertState `codec:"cc,allocbound=protocol.NumCompactCertTypes"`

	// ParticipationUpdates contains the information needed to mark
	// certain accounts offline because their participation keys expired
	ParticipationUpdates
	// contains filtered or unexported fields
}

A BlockHeader represents the metadata and commitments to the state of a Block. The Algorand Ledger may be defined minimally as a cryptographically authenticated series of BlockHeader objects.

블록헤더는 블록의 상태에 대한 메타데이터 및 확신을 나타낸다.
알고랜드 원장은 암호적으로 인증된 블록헤더 객체들의 일련의 집합이라고 정의할 수 있다.

func (*BlockHeader) CanMarshalMsg

func (_ *BlockHeader) CanMarshalMsg(z interface{}) bool

func (*BlockHeader) CanUnmarshalMsg

func (_ *BlockHeader) CanUnmarshalMsg(z interface{}) bool

func (BlockHeader) DecodeSignedTxn

DecodeSignedTxn converts a SignedTxnInBlock from a block to SignedTxn and its associated ApplyData.

func (BlockHeader) EncodeSignedTxn

EncodeSignedTxn converts a SignedTxn and ApplyData into a SignedTxnInBlock for that block.

func (BlockHeader) Hash

func (bh BlockHeader) Hash() BlockHash

Hash returns the hash of a block header. The hash of a block is the hash of its header.

func (*BlockHeader) MarshalMsg

func (z *BlockHeader) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*BlockHeader) MsgIsZero

func (z *BlockHeader) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*BlockHeader) Msgsize

func (z *BlockHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (BlockHeader) NextVersionInfo

func (bh BlockHeader) NextVersionInfo() (ver protocol.ConsensusVersion, rnd basics.Round, supported bool)

NextVersionInfo returns information about the next expected protocol version. If no upgrade is scheduled, return the current protocol.

func (BlockHeader) PreCheck

func (bh BlockHeader) PreCheck(prev BlockHeader) error

PreCheck checks if the block header bh is a valid successor to the previous block's header, prev.

func (BlockHeader) ToBeHashed

func (bh BlockHeader) ToBeHashed() (protocol.HashID, []byte)

ToBeHashed implements the crypto.Hashable interface

func (*BlockHeader) UnmarshalMsg

func (z *BlockHeader) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type CompactCertState

type CompactCertState struct {

	// CompactCertVoters is the root of a Merkle tree containing the
	// online accounts that will help sign a compact certificate.  The
	// Merkle root, and the compact certificate, happen on blocks that
	// are a multiple of ConsensusParams.CompactCertRounds.  For blocks
	// that are not a multiple of ConsensusParams.CompactCertRounds,
	// this value is zero.
	CompactCertVoters crypto.GenericDigest `codec:"v"`

	// CompactCertVotersTotal is the total number of micronovas held by
	// the accounts in CompactCertVoters (or zero, if the merkle root is
	// zero).  This is intended for computing the threshold of votes to
	// expect from CompactCertVoters.
	CompactCertVotersTotal basics.MicroNovas `codec:"t"`

	// CompactCertNextRound is the next round for which we will accept
	// a CompactCert transaction.
	CompactCertNextRound basics.Round `codec:"n"`
	// contains filtered or unexported fields
}

CompactCertState tracks the state of compact certificates.

func (*CompactCertState) CanMarshalMsg

func (_ *CompactCertState) CanMarshalMsg(z interface{}) bool

func (*CompactCertState) CanUnmarshalMsg

func (_ *CompactCertState) CanUnmarshalMsg(z interface{}) bool

func (*CompactCertState) MarshalMsg

func (z *CompactCertState) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*CompactCertState) MsgIsZero

func (z *CompactCertState) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*CompactCertState) Msgsize

func (z *CompactCertState) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*CompactCertState) UnmarshalMsg

func (z *CompactCertState) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Genesis

type Genesis struct {

	// The SchemaID allows nodes to store data specific to a particular
	// universe (in case of upgrades at development or testing time),
	// and as an optimization to quickly check if two nodes are in
	// the same universe.
	SchemaID string `codec:"id"`

	// Network identifies the unique algorand network for which the ledger
	// is valid.
	// Note the Network name should not include a '-', as we generate the
	// GenesisID from "<Network>-<SchemaID>"; the '-' makes it easy
	// to distinguish between the network and schema.
	Network protocol.NetworkID `codec:"network"`

	// Proto is the consensus protocol in use at the genesis block.
	Proto protocol.ConsensusVersion `codec:"proto"`

	// Allocation determines the initial accounts and their state.
	Allocation []GenesisAllocation `codec:"alloc,allocbound=MaxInitialGenesisAllocationSize"`

	// RewardsPool is the address of the rewards pool.
	RewardsPool string `codec:"rwd"`

	// FeeSink is the address of the fee sink.
	FeeSink string `codec:"fees"`

	// Timestamp for the genesis block
	Timestamp int64 `codec:"timestamp"`

	// Arbitrary genesis comment string - will be excluded from file if empty
	Comment string `codec:"comment"`

	// DevMode defines whether this network operates in a developer mode or not. Developer mode networks
	// are a single node network, that operates without the agreement service being active. In liue of the
	// agreement service, a new block is generated each time a node receives a transaction group. The
	// default value for this field is "false", which makes this field empty from it's encoding, and
	// therefore backward compatible.
	DevMode bool `codec:"devmode"`
	// contains filtered or unexported fields
}

A Genesis object defines an Algorand "universe" -- a set of nodes that can talk to each other, agree on the ledger contents, etc. This is defined by the initial account states (GenesisAllocation), the initial consensus protocol (GenesisProto), and the schema of the ledger.

Genesis객체는 알고랜드의 세계를 정의한다 - 서로 통신할 수 있고, 원장 콘텐츠에 대해 동의 하는 등의 일을 수행할 수 있는 노드 이것은 최초 계정 상태(GenesisAllocation)와 최초 합의 프로토콜(GenesisProto)과 원장의 스키마에 의해 정의된다.

func LoadGenesisFromFile

func LoadGenesisFromFile(genesisFile string) (genesis Genesis, err error)

LoadGenesisFromFile attempts to load a Genesis structure from a (presumably) genesis.json file.

func (*Genesis) CanMarshalMsg

func (_ *Genesis) CanMarshalMsg(z interface{}) bool

func (*Genesis) CanUnmarshalMsg

func (_ *Genesis) CanUnmarshalMsg(z interface{}) bool

func (Genesis) ID

func (genesis Genesis) ID() string

ID is the effective Genesis identifier - the combination of the network and the ledger schema version

func (*Genesis) MarshalMsg

func (z *Genesis) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*Genesis) MsgIsZero

func (z *Genesis) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*Genesis) Msgsize

func (z *Genesis) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Genesis) ToBeHashed

func (genesis Genesis) ToBeHashed() (protocol.HashID, []byte)

ToBeHashed impements the crypto.Hashable interface.

func (*Genesis) UnmarshalMsg

func (z *Genesis) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type GenesisAllocation

type GenesisAllocation struct {
	Address string             `codec:"addr"`
	Comment string             `codec:"comment"`
	State   basics.AccountData `codec:"state"`
	// contains filtered or unexported fields
}

A GenesisAllocation object represents an allocation of algos to an address in the genesis block. Address is the checksummed short address. Comment is a note about what this address is representing, and is purely informational. State is the initial account state.

GenesisAllocation은 제네시스블록(최초블록)의 주소에 할당된 알고의양을 나타낸다. State는 최초 계정의 상태이다(AccountData)

func (*GenesisAllocation) CanMarshalMsg

func (_ *GenesisAllocation) CanMarshalMsg(z interface{}) bool

func (*GenesisAllocation) CanUnmarshalMsg

func (_ *GenesisAllocation) CanUnmarshalMsg(z interface{}) bool

func (*GenesisAllocation) MarshalMsg

func (z *GenesisAllocation) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*GenesisAllocation) MsgIsZero

func (z *GenesisAllocation) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*GenesisAllocation) Msgsize

func (z *GenesisAllocation) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*GenesisAllocation) UnmarshalMsg

func (z *GenesisAllocation) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type GenesisBalances

type GenesisBalances struct {
	Balances    map[basics.Address]basics.AccountData
	FeeSink     basics.Address
	RewardsPool basics.Address
	Timestamp   int64
}

GenesisBalances contains the information needed to generate a new ledger GenesisBalances는 새로운 원장을 생성하기위해 필요한 정보들을 포함한다.

func MakeGenesisBalances

func MakeGenesisBalances(balances map[basics.Address]basics.AccountData, feeSink, rewardsPool basics.Address) GenesisBalances

MakeGenesisBalances returns the information needed to bootstrap the ledger based on the current time

func MakeTimestampedGenesisBalances

func MakeTimestampedGenesisBalances(balances map[basics.Address]basics.AccountData, feeSink, rewardsPool basics.Address, timestamp int64) GenesisBalances

MakeTimestampedGenesisBalances returns the information needed to bootstrap the ledger based on a given time

type ParticipationUpdates

type ParticipationUpdates struct {

	// ExpiredParticipationAccounts contains a list of online accounts
	// that needs to be converted to offline since their
	// participation key expired.
	ExpiredParticipationAccounts []basics.Address `codec:"partupdrmv,allocbound=config.MaxProposedExpiredOnlineAccounts"`
	// contains filtered or unexported fields
}

ParticipationUpdates represents participation account data that needs to be checked/acted on by the network

func (*ParticipationUpdates) CanMarshalMsg

func (_ *ParticipationUpdates) CanMarshalMsg(z interface{}) bool

func (*ParticipationUpdates) CanUnmarshalMsg

func (_ *ParticipationUpdates) CanUnmarshalMsg(z interface{}) bool

func (*ParticipationUpdates) MarshalMsg

func (z *ParticipationUpdates) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*ParticipationUpdates) MsgIsZero

func (z *ParticipationUpdates) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*ParticipationUpdates) Msgsize

func (z *ParticipationUpdates) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ParticipationUpdates) UnmarshalMsg

func (z *ParticipationUpdates) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type RewardsState

type RewardsState struct {

	// The FeeSink accepts transaction fees. It can only spend to
	// the incentive pool.
	FeeSink basics.Address `codec:"fees"`

	// The RewardsPool accepts periodic injections from the
	// FeeSink and continually redistributes them to adresses as
	// rewards.
	RewardsPool basics.Address `codec:"rwd"`

	// RewardsLevel specifies how many rewards, in MicroNovas,
	// have been distributed to each config.Protocol.RewardUnit
	// of MicroNovas since genesis.
	/*

	 */
	RewardsLevel uint64 `codec:"earn"`

	// The number of new MicroNovas added to the participation stake from rewards at the next round.
	RewardsRate uint64 `codec:"rate"`

	// The number of leftover MicroNovas after the distribution of RewardsRate/rewardUnits
	// MicroNovas for every reward unit in the next round.
	RewardsResidue uint64 `codec:"frac"`

	// The round at which the RewardsRate will be recalculated.
	RewardsRecalculationRound basics.Round `codec:"rwcalr"`
	// contains filtered or unexported fields
}

RewardsState represents the global parameters controlling the rate at which accounts accrue rewards.

RewardsState는 계정에서 보상이 발생하는 비율을 제어하는 ​​전역 매개변수를 나타낸다.

func (*RewardsState) CanMarshalMsg

func (_ *RewardsState) CanMarshalMsg(z interface{}) bool

func (*RewardsState) CanUnmarshalMsg

func (_ *RewardsState) CanUnmarshalMsg(z interface{}) bool

func (*RewardsState) MarshalMsg

func (z *RewardsState) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*RewardsState) MsgIsZero

func (z *RewardsState) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*RewardsState) Msgsize

func (z *RewardsState) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (RewardsState) NextRewardsState

func (s RewardsState) NextRewardsState(nextRound basics.Round, nextProto config.ConsensusParams, incentivePoolBalance basics.MicroNovas, totalRewardUnits uint64, log logging.Logger) (res RewardsState)

NextRewardsState computes the RewardsState of the subsequent round given the subsequent consensus parameters, along with the incentive pool balance and the total reward units in the system as of the current round.

func (*RewardsState) UnmarshalMsg

func (z *RewardsState) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UpgradeState

type UpgradeState struct {
	CurrentProtocol       protocol.ConsensusVersion `codec:"proto"`
	NextProtocol          protocol.ConsensusVersion `codec:"nextproto"`
	NextProtocolApprovals uint64                    `codec:"nextyes"`
	// NextProtocolVoteBefore specify the last voting round for the next protocol proposal. If there is no voting for
	// an upgrade taking place, this would be zero.
	NextProtocolVoteBefore basics.Round `codec:"nextbefore"`
	// NextProtocolSwitchOn specify the round number at which the next protocol would be adopted. If there is no upgrade taking place,
	// nor a wait for the next protocol, this would be zero.
	NextProtocolSwitchOn basics.Round `codec:"nextswitch"`
}

UpgradeState tracks the protocol upgrade state machine. It is, strictly speaking, computable from the history of all UpgradeVotes but we keep it in the block for explicitness and convenience (instead of materializing it separately, like balances).

type UpgradeVote

type UpgradeVote struct {

	// UpgradePropose indicates a proposed upgrade
	UpgradePropose protocol.ConsensusVersion `codec:"upgradeprop"`

	// UpgradeDelay indicates the time between acceptance and execution
	UpgradeDelay basics.Round `codec:"upgradedelay"`

	// UpgradeApprove indicates a yes vote for the current proposal
	UpgradeApprove bool `codec:"upgradeyes"`
	// contains filtered or unexported fields
}

UpgradeVote represents the vote of the block proposer with respect to protocol upgrades.

func (*UpgradeVote) CanMarshalMsg

func (_ *UpgradeVote) CanMarshalMsg(z interface{}) bool

func (*UpgradeVote) CanUnmarshalMsg

func (_ *UpgradeVote) CanUnmarshalMsg(z interface{}) bool

func (*UpgradeVote) MarshalMsg

func (z *UpgradeVote) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*UpgradeVote) MsgIsZero

func (z *UpgradeVote) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*UpgradeVote) Msgsize

func (z *UpgradeVote) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UpgradeVote) UnmarshalMsg

func (z *UpgradeVote) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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