alien

package
v0.0.0-...-f68444d Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Overview

Package alien implements the delegated-proof-of-stake consensus engine.

Package alien implements the delegated-proof-of-stake consensus engine.

Index

Constants

View Source
const (
	SigerQueueFixBlockNumber             = 591790
	SigerElectNewEffectBlockNumber       = 661874
	MinerUpdateStateFixBlockNumber       = 757054
	TallyPunishdProcessEffectBlockNumber = 757114
	TallyPunishdFixBlockNumber           = 774331
	StorageEffectBlockNumber             = 834261

	SPledgeRevertFixBlockNumber = 894333
	AdjustSPRBlockNumber        = 974868 //Adjust calc StoragePledgeReward

	StorageChBwEffectNumber = 1170700

	PledgeRevertLockEffectNumber = 1495994

	StoragePledgeOptEffectNumber = 1608207
	FixLeaseCapacityNumber       = 1660014
	PosrIncentiveEffectNumber    = 1744720
	PosrExitNewRuleEffectNumber  = 1953447
	PosrNewCalEffectNumber       = 2306412
	PosNewEffectNumber           = 2558551

	PosLastPunishFixNumber        = 2566675
	PosAutoExitPunishChangeNumber = 2755395
	GrantEffectNumber             = 3713619
)
View Source
const (
	LOCKREWARDDATA    = "reward"
	LOCKFLOWDATA      = "flow"
	LOCKBANDWIDTHDATA = "bandwidth"
	LOCKPOSEXITDATA   = "posplexit"
	LOCKPEXITDATA     = "posexit"
)
View Source
const (
	SPledgeNormal    = 0
	SPledgeExit      = 1
	SPledgeRemoving  = 5 //30-day verification failed
	SPledgeRetrun    = 6 //SRT and pledge deposit have been returned
	LeaseNotPledged  = 0
	LeaseNormal      = 1
	LeaseUserRescind = 2
	LeaseExpiration  = 3
	LeaseBreach      = 4
	LeaseReturn      = 6
)
View Source
const (
	RepairBalanceNumber = 1170523
)

Variables

View Source
var (
	BurnBase                 = big.NewInt(10000)
	BandwidthMakeupPunishDay = uint64(30)

	IncentivePeriod          = big.NewInt(30)
	BandwidthAdjustPeriodDay = uint64(7)
)
View Source
var (
	ErrDeclareParameter = "1001"
)
View Source
var (

	// ErrInvalidTimestamp is returned if the timestamp of a block is lower than
	// the previous block's timestamp + the minimum block period.
	ErrInvalidTimestamp = errors.New("invalid timestamp")
)

Various error messages to mark blocks invalid. These should be private to prevent engine specific errors from being referenced in the remainder of the codebase, inherently breaking if the engine is swapped out. Please put common error types into the consensus package.

View Source
var SCCurrentBlockReward = map[uint64]map[uint64]uint64{
	1: {1: 100},
	2: {1: 30, 2: 70},
	3: {1: 15, 2: 30, 3: 55},
	4: {1: 5, 2: 15, 3: 30, 4: 50},
	5: {1: 5, 2: 10, 3: 15, 4: 25, 5: 45},
	6: {1: 1, 2: 4, 3: 10, 4: 15, 5: 25, 6: 45},
}

SCCurrentBlockReward is base on scMaxCountPerPeriod = 6

Functions

func Acc

func Acc(b1, b2, n string) string

func AlienRLP

func AlienRLP(header *types.Header) []byte

CliqueRLP returns the rlp bytes which needs to be signed for the proof-of-authority sealing. The RLP to sign consists of the entire header apart from the 65 byte signature contained at the end of the extra data.

Note, the method requires the extra data to be at least 65 bytes, otherwise it panics. This is done to avoid accidentally using both forms (signature present or not), which could be abused to produce different hashes for the same header.

func ByteToUint64LittleEndian

func ByteToUint64LittleEndian(b []byte) uint64

func FlowMinerReportEncodeRlp

func FlowMinerReportEncodeRlp(items []*FlowMinerReport) (error, []byte)

func Hash

func Hash(b1, b2, pos string) string

//////////////////////////////////////////////////////////////////////////////////////////////

func PledgeItemEncodeRlp

func PledgeItemEncodeRlp(items []*PledgeItem) (error, []byte)

func SealHash

func SealHash(header *types.Header) (hash common.Hash)

SealHash returns the hash of a block prior to it being sealed.

func Sha1

func Sha1(orgin []byte) string

func UInt64ToByteLittleEndian

func UInt64ToByteLittleEndian(i uint64) []byte

Types

type API

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

API is a user facing RPC API to allow controlling the signer and voting mechanisms of the delegated-proof-of-stake scheme.

func (*API) GetCandidateAutoExitAtNumber

func (api *API) GetCandidateAutoExitAtNumber(number uint64) (*SnapCanAutoExit, error)

func (*API) GetCapSuccAddrsAtNumber

func (api *API) GetCapSuccAddrsAtNumber(number uint64) (*SnapshotCapSuccAddrs, error)

func (*API) GetGrantProfitAtNumber

func (api *API) GetGrantProfitAtNumber(number uint64) ([]consensus.GrantProfitRecord, error)

func (*API) GetLockRewardAtNumber

func (api *API) GetLockRewardAtNumber(number uint64) ([]LockRewardRecord, error)

func (*API) GetRentSucAtNumber

func (api *API) GetRentSucAtNumber(number uint64) (*SnapshotRentSuc, error)

func (*API) GetRevertSRTAtNumber

func (api *API) GetRevertSRTAtNumber(number uint64) (*SnapshotRevertSRT, error)

func (*API) GetSPledgeAtNumber

func (api *API) GetSPledgeAtNumber(number uint64) (*SnapshotSPledge, error)

func (*API) GetSPledgeCapVerAtNumber

func (api *API) GetSPledgeCapVerAtNumber(number uint64) (*SnapshotSPledgeCapVer, error)

func (*API) GetSPledgeInfoByAddr

func (api *API) GetSPledgeInfoByAddr(address common.Address) (*SnapshotSPledgeInfo, error)

func (*API) GetSRTBalAtNumber

func (api *API) GetSRTBalAtNumber(number uint64) (*SnapshotSRT, error)

func (*API) GetSRTBalance

func (api *API) GetSRTBalance(address common.Address) (*SnapshotAddrSRT, error)

func (*API) GetSRTBalanceAtNumber

func (api *API) GetSRTBalanceAtNumber(address common.Address, number uint64) (*SnapshotAddrSRT, error)

func (*API) GetSTGBandwidthMakeup

func (api *API) GetSTGBandwidthMakeup() (*SnapshotSTGbwMakeup, error)

func (*API) GetSnapshot

func (api *API) GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error)

GetSnapshot retrieves the state snapshot at a given block.

func (*API) GetSnapshotAtHash

func (api *API) GetSnapshotAtHash(hash common.Hash) (*Snapshot, error)

GetSnapshotAtHash retrieves the state snapshot at a given block.

func (*API) GetSnapshotAtNumber

func (api *API) GetSnapshotAtNumber(number uint64) (*Snapshot, error)

GetSnapshotAtNumber retrieves the state snapshot at a given block.

func (*API) GetSnapshotFlowAtNumber

func (api *API) GetSnapshotFlowAtNumber(number uint64) (*SnapshotFlow, error)

func (*API) GetSnapshotFlowMinerAtNumber

func (api *API) GetSnapshotFlowMinerAtNumber(number uint64) (*SnapshotFlowMiner, error)

func (*API) GetSnapshotFlowReportAtNumber

func (api *API) GetSnapshotFlowReportAtNumber(number uint64) (*SnapshotFlowReport, error)

func (*API) GetSnapshotReleaseAtNumber

func (api *API) GetSnapshotReleaseAtNumber(number uint64, part string) (*SnapshotRelease, error)

func (*API) GetSnapshotReleaseAtNumber2

func (api *API) GetSnapshotReleaseAtNumber2(number uint64, part string, startLNum uint64, endLNum uint64) (*SnapshotRelease, error)

func (*API) GetSnapshotSignerAtNumber

func (api *API) GetSnapshotSignerAtNumber(number uint64) (*SnapshotSign, error)

func (*API) GetStorageDecimalValueAtNumber

func (api *API) GetStorageDecimalValueAtNumber(number uint64, part string) (*SnapshotSPledgeDecimalValue, error)

func (*API) GetStorageRatioValueAtNumber

func (api *API) GetStorageRatioValueAtNumber(number uint64, value *big.Int, part string) (*SnapshotSPledgeRatioValue, error)

func (*API) GetStorageRatiosAtNumber

func (api *API) GetStorageRatiosAtNumber(number uint64) (*SnapshotStorageRatios, error)

func (*API) GetStorageRewardAtNumber

func (api *API) GetStorageRewardAtNumber(number uint64, part string) (*SnapshotStorageReward, error)

func (*API) GetStorageValueAtNumber

func (api *API) GetStorageValueAtNumber(number uint64, part string) (*SnapshotSPledgeValue, error)

func (*API) GetSucSPledgeAtNumber

func (api *API) GetSucSPledgeAtNumber(number uint64) (*SnapshotSucSPledge, error)

type Alien

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

Alien is the delegated-proof-of-stake consensus engine.

func New

func New(config *params.AlienConfig, db ethdb.Database) *Alien

New creates a Alien delegated-proof-of-stake consensus engine with the initial signers set to the ones provided by the user.

func (*Alien) APIs

func (a *Alien) APIs(chain consensus.ChainHeaderReader) []rpc.API

APIs implements consensus.Engine, returning the user facing RPC API to allow controlling the signer voting.

func (*Alien) ApplyGenesis

func (a *Alien) ApplyGenesis(chain consensus.ChainHeaderReader, genesisHash common.Hash) error

ApplyGenesis

func (*Alien) Author

func (a *Alien) Author(header *types.Header) (common.Address, error)

Author implements consensus.Engine, returning the Ethereum address recovered from the signature in the header's extra-data section.

func (*Alien) Authorize

func (a *Alien) Authorize(signer common.Address, signFn SignerFn, signTxFn SignTxFn)

Authorize injects a private key into the consensus engine to mint new blocks with.

func (*Alien) CalcDifficulty

func (a *Alien) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int

CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty that a new block should have based on the previous blocks in the chain and the current signer.

func (*Alien) Close

func (a *Alien) Close() error

Close implements consensus.Engine. It's a noop for clique as there are no background threads.

func (*Alien) Finalize

func (a *Alien) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, grantProfit []consensus.GrantProfitRecord, gasReward *big.Int) error

Finalize implements consensus.Engine, ensuring no uncles are set, nor block rewards given.

func (*Alien) FinalizeAndAssemble

func (a *Alien) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, grantProfit []consensus.GrantProfitRecord, gasReward *big.Int) (*types.Block, error)

func (*Alien) GrantProfit

func (*Alien) Prepare

func (a *Alien) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error

Prepare implements consensus.Engine, preparing all the consensus fields of the header for running the transactions on top.

func (*Alien) RepairBal

func (a *Alien) RepairBal(state *state.StateDB, number uint64)

func (*Alien) Seal

func (a *Alien) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error

Seal implements consensus.Engine, attempting to create a sealed block using the local signing credentials.

func (*Alien) SealHash

func (a *Alien) SealHash(header *types.Header) common.Hash

SealHash returns the hash of a block prior to it being sealed.

func (*Alien) StorageProofNew

func (a *Alien) StorageProofNew(storageProofRecord []StorageProofRecord, verifyInfo string, pledgeAddr common.Address, storagepledge *SPledge, chain consensus.ChainHeaderReader, currNumber *big.Int) ([]string, []StorageProofRecord)

func (*Alien) VerifyHeader

func (a *Alien) VerifyHeader(chain consensus.ChainHeaderReader, state *state.StateDB, header *types.Header, seal bool) error

VerifyHeader checks whether a header conforms to the consensus rules.

func (*Alien) VerifyHeaderExtra

func (a *Alien) VerifyHeaderExtra(chain consensus.ChainHeaderReader, header *types.Header, verifyExtra []byte) error

func (*Alien) VerifyHeaders

func (a *Alien) VerifyHeaders(chain consensus.ChainHeaderReader, state *state.StateDB, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)

VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers. The method returns a quit channel to abort the operations and a results channel to retrieve the async verifications (the order is that of the input slice).

func (*Alien) VerifyLockReward

func (a *Alien) VerifyLockReward(header *types.Header, snap *Snapshot, chain consensus.ChainHeaderReader, currentHeaderExtra HeaderExtra) error

func (*Alien) VerifySeal

func (a *Alien) VerifySeal(chain consensus.ChainHeaderReader, state *state.StateDB, header *types.Header) error

VerifySeal implements consensus.Engine, checking whether the signature contained in the header satisfies the consensus protocol requirements.

func (*Alien) VerifyUncles

func (a *Alien) VerifyUncles(chain consensus.ChainReader, block *types.Block) error

VerifyUncles implements consensus.Engine, always returning an error for any uncles as this consensus mechanism doesn't permit uncles.

type BandwidthMakeup

type BandwidthMakeup struct {
	OldBandwidth  *big.Int `json:"oldbandwidth"`
	BurnRatio     *big.Int `json:"burnratio"`
	DepositMakeup *big.Int `json:"depositmakeup"`
	AdjustCount   uint64   `json:"adjustCount"`
}

type BandwidthPunishRecord

type BandwidthPunishRecord struct {
	Target   common.Address
	WdthPnsh uint32
}

type CCNotice

type CCNotice struct {
	CurrentCharging map[common.Hash]GasCharging `json:"currentCharging"` // common.Hash here is the proposal txHash not the hash of side chain
	ConfirmReceived map[common.Hash]NoticeCR    `json:"confirmReceived"` // record the confirm address
}

CCNotice (cross chain notice) contain the information main chain need to notify given side chain

type CandidateChangeRateRecord

type CandidateChangeRateRecord struct {
	Target common.Address
	Rate   *big.Int
}

type CandidatePEntrustExitRecord

type CandidatePEntrustExitRecord struct {
	Target  common.Address
	Hash    common.Hash
	Address common.Address
	Amount  *big.Int
}

type CandidatePledgeEntrustRecord

type CandidatePledgeEntrustRecord struct {
	Target  common.Address
	Amount  *big.Int
	Address common.Address
	Hash    common.Hash
}

type CandidatePledgeNewRecord

type CandidatePledgeNewRecord struct {
	Target  common.Address
	Amount  *big.Int
	Manager common.Address
	Hash    common.Hash
}

type CandidatePledgeRecord

type CandidatePledgeRecord struct {
	Target common.Address
	Amount *big.Int
}

type CandidatePunishRecord

type CandidatePunishRecord struct {
	Target common.Address
	Amount *big.Int
	Credit uint32
}

type CandidateState

type CandidateState struct {
	SignerNumber uint64   `json:"signernumber"`
	Stake        *big.Int `json:"stake"`
}

type ClaimedBandwidth

type ClaimedBandwidth struct {
	ISPQosID         uint32 `json:"ispqosid"`
	BandwidthClaimed uint32 `json:"bandwidthclaimed"`
}

type ClaimedBandwidthRecord

type ClaimedBandwidthRecord struct {
	Target    common.Address
	Amount    *big.Int
	ISPQosID  uint32
	Bandwidth uint32
}

type ConfigDepositRecord

type ConfigDepositRecord struct {
	Who    uint32
	Amount *big.Int
}

type Confirmation

type Confirmation struct {
	Signer      common.Address
	BlockNumber *big.Int
}

Confirmation : confirmation come from custom tx which data like "ufo:1:event:confirm:123" 123 is the block number be confirmed Sender of tx is Signer only if the signer in the SignerQueue for block number 123

type Declare

type Declare struct {
	ProposalHash common.Hash
	Declarer     common.Address
	Decision     bool
}

Declare : declare come from custom tx which data like "ufo:1:event:declare:hash:yes" proposal only come from the current candidates hash is the hash of proposal tx

type DefaultLockState

type DefaultLockState struct {
}

*

  • ExtraStateDB

func NewDefaultLockState

func NewDefaultLockState(root common.Hash) (*DefaultLockState, error)

func (*DefaultLockState) AddLockReward

func (c *DefaultLockState) AddLockReward(LockReward []LockRewardRecord, snap *Snapshot, db ethdb.Database, number uint64) ([]LockRewardRecord, error)

func (*DefaultLockState) CommitData

func (c *DefaultLockState) CommitData() (common.Hash, common.Hash, error)

func (*DefaultLockState) PayLockReward

func (c *DefaultLockState) PayLockReward(LockAccountsRoot common.Hash, number uint64, state *state.StateDB) error

type DefaultSRTState

type DefaultSRTState struct {
	StorageHash common.Hash `json:"storage"`
	Hash        common.Hash `json:"root"`
	// contains filtered or unexported fields
}

func (*DefaultSRTState) Add

func (c *DefaultSRTState) Add(addr common.Address, amount *big.Int)

func (*DefaultSRTState) Copy

func (c *DefaultSRTState) Copy() SRTState

func (*DefaultSRTState) Del

func (c *DefaultSRTState) Del(addr common.Address)

func (*DefaultSRTState) Get

func (c *DefaultSRTState) Get(addr common.Address) *big.Int

func (*DefaultSRTState) GetAll

func (c *DefaultSRTState) GetAll() map[common.Address]*big.Int

func (*DefaultSRTState) Load

func (c *DefaultSRTState) Load(db ethdb.Database, hash common.Hash) error

func (*DefaultSRTState) Root

func (c *DefaultSRTState) Root() common.Hash

func (*DefaultSRTState) Save

func (c *DefaultSRTState) Save(db ethdb.Database) (common.Hash, error)

func (*DefaultSRTState) Set

func (c *DefaultSRTState) Set(addr common.Address, amount *big.Int)

func (*DefaultSRTState) Sub

func (c *DefaultSRTState) Sub(addr common.Address, amount *big.Int) error

type DeviceBindRecord

type DeviceBindRecord struct {
	Device    common.Address
	Revenue   common.Address
	Contract  common.Address
	MultiSign common.Address
	Type      uint32
	Bind      bool
}

type ExchangeNFCRecord

type ExchangeNFCRecord struct {
	Target common.Address
	Amount *big.Int
}

type ExchangeSRTRecord

type ExchangeSRTRecord struct {
	Target common.Address `json:"target"`
	Amount *big.Int       `json:"amount"`
}

type FULLBalanceData

type FULLBalanceData struct {
	Balance   *big.Int                 `json:"purchasetotal"`
	CostTotal map[common.Hash]*big.Int `json:"consumetotal"`
}

type FlowMinerReport

type FlowMinerReport struct {
	Target       common.Address `json:"target"`
	Hash         common.Hash    `json:"hash"`
	ReportNumber uint32         `json:"reportnumber"`
	FlowValue1   uint64         `json:"rewardflow"`
	FlowValue2   uint64         `json:"consumeflow"`
}

type FlowMinerSnap

type FlowMinerSnap struct {
	DayStartTime       uint64                                              `json:"dayStartTime"`
	FlowMinerPrevTotal uint64                                              `json:"flowminerPrevTotal"`
	FlowMiner          map[common.Address]map[common.Hash]*FlowMinerReport `json:"flowminerCurr"`
	FlowMinerPrev      map[common.Address]map[common.Hash]*FlowMinerReport `json:"flowminerPrev"`
	FlowMinerCache     []string                                            `json:"flowminerCurCache"`
	FlowMinerPrevCache []string                                            `json:"flowminerPrevCache"`
}

func NewFlowMinerSnap

func NewFlowMinerSnap(dayStartTime uint64) *FlowMinerSnap

type FlowRecord

type FlowRecord struct {
	Target     common.Address
	Amount     *big.Int
	FlowValue1 uint64 `json:"realFlowvalue"`
	FlowValue2 uint64 `json:"validFlowvalue"`
}

type GasCharging

type GasCharging struct {
	Target common.Address `json:"address"` // target address on side chain
	Volume uint64         `json:"volume"`  // volume of gas need charge (unit is ttc)
	Hash   common.Hash    `json:"hash"`    // the hash of proposal, use as id of this proposal
}

type HeaderExtra

type HeaderExtra struct {
	CurrentBlockConfirmations []Confirmation
	CurrentBlockVotes         []Vote
	CurrentBlockProposals     []Proposal
	CurrentBlockDeclares      []Declare
	ModifyPredecessorVotes    []Vote
	LoopStartTime             uint64
	SignerQueue               []common.Address
	SignerMissing             []common.Address
	ConfirmedBlockNumber      uint64
	SideChainConfirmations    []SCConfirmation
	SideChainSetCoinbases     []SCSetCoinbase
	SideChainNoticeConfirmed  []SCConfirmation
	SideChainCharging         []GasCharging //This only exist in side chain's header.Extra

	ExchangeNFC      []ExchangeNFCRecord
	DeviceBind       []DeviceBindRecord
	CandidatePledge  []CandidatePledgeRecord
	CandidatePunish  []CandidatePunishRecord
	MinerStake       []MinerStakeRecord
	CandidateExit    []common.Address
	ClaimedBandwidth []ClaimedBandwidthRecord
	FlowMinerExit    []common.Address
	BandwidthPunish  []BandwidthPunishRecord
	ConfigExchRate   uint32
	ConfigOffLine    uint32
	ConfigDeposit    []ConfigDepositRecord
	ConfigISPQOS     []ISPQOSRecord
	LockParameters   []LockParameterRecord
	ManagerAddress   []ManagerAddressRecord
	FlowHarvest      *big.Int
	LockReward       []LockRewardRecord
	GrantProfit      []consensus.GrantProfitRecord
	FlowReport       []MinerFlowReportRecord

	StoragePledge       []SPledgeRecord
	StoragePledgeExit   []SPledgeExitRecord
	LeaseRequest        []LeaseRequestRecord
	ExchangeSRT         []ExchangeSRTRecord
	LeasePledge         []LeasePledgeRecord
	LeaseRenewal        []LeaseRenewalRecord
	LeaseRenewalPledge  []LeaseRenewalPledgeRecord
	LeaseRescind        []LeaseRescindRecord
	StorageRecoveryData []SPledgeRecoveryRecord
	StorageProofRecord  []StorageProofRecord

	StorageExchangePrice   []StorageExchangePriceRecord
	ExtraStateRoot         common.Hash
	LockAccountsRoot       common.Hash
	StorageDataRoot        common.Hash
	StorageExchangeBw      []StorageExchangeBwRecord
	SRTDataRoot            common.Hash
	StorageBwPay           []StorageBwPayRecord
	GrantProfitHash        common.Hash
	CandidatePledgeNew     []CandidatePledgeNewRecord
	CandidatePledgeEntrust []CandidatePledgeEntrustRecord
	CandidatePEntrustExit  []CandidatePEntrustExitRecord
	CandidateAutoExit      []common.Address
	CandidateChangeRate    []CandidateChangeRateRecord
}

HeaderExtra is the struct of info in header.Extra[extraVanity:len(header.extra)-extraSeal] HeaderExtra is the current struct

type HeaderExtraV5

type HeaderExtraV5 struct {
	CurrentBlockConfirmations []Confirmation
	CurrentBlockVotes         []Vote
	CurrentBlockProposals     []Proposal
	CurrentBlockDeclares      []Declare
	ModifyPredecessorVotes    []Vote
	LoopStartTime             uint64
	SignerQueue               []common.Address
	SignerMissing             []common.Address
	ConfirmedBlockNumber      uint64
	SideChainConfirmations    []SCConfirmation
	SideChainSetCoinbases     []SCSetCoinbase
	SideChainNoticeConfirmed  []SCConfirmation
	SideChainCharging         []GasCharging //This only exist in side chain's header.Extra

	ExchangeNFC      []ExchangeNFCRecord
	DeviceBind       []DeviceBindRecord
	CandidatePledge  []CandidatePledgeRecord
	CandidatePunish  []CandidatePunishRecord
	MinerStake       []MinerStakeRecord
	CandidateExit    []common.Address
	ClaimedBandwidth []ClaimedBandwidthRecord
	FlowMinerExit    []common.Address
	BandwidthPunish  []BandwidthPunishRecord
	ConfigExchRate   uint32
	ConfigOffLine    uint32
	ConfigDeposit    []ConfigDepositRecord
	ConfigISPQOS     []ISPQOSRecord
	LockParameters   []LockParameterRecord
	ManagerAddress   []ManagerAddressRecord
	FlowHarvest      *big.Int
	LockReward       []LockRewardRecord
	GrantProfit      []consensus.GrantProfitRecord
	FlowReport       []MinerFlowReportRecord

	StoragePledge       []SPledgeRecord
	StoragePledgeExit   []SPledgeExitRecord
	LeaseRequest        []LeaseRequestRecord
	ExchangeSRT         []ExchangeSRTRecord
	LeasePledge         []LeasePledgeRecord
	LeaseRenewal        []LeaseRenewalRecord
	LeaseRenewalPledge  []LeaseRenewalPledgeRecord
	LeaseRescind        []LeaseRescindRecord
	StorageRecoveryData []SPledgeRecoveryRecord
	StorageProofRecord  []StorageProofRecord

	StorageExchangePrice []StorageExchangePriceRecord
	ExtraStateRoot       common.Hash
	LockAccountsRoot     common.Hash
	StorageDataRoot      common.Hash
	StorageExchangeBw    []StorageExchangeBwRecord
	SRTDataRoot          common.Hash
	StorageBwPay         []StorageBwPayRecord
	GrantProfitHash      common.Hash
}

type ISPQOSRecord

type ISPQOSRecord struct {
	ISPID uint32
	QOS   uint32
}

type Lease

type Lease struct {
	Address                     common.Address               `json:"address"`
	DepositAddress              common.Address               `json:"depositaddress"`
	Capacity                    *big.Int                     `json:"capacity"`
	RootHash                    common.Hash                  `json:"roothash"`
	Deposit                     *big.Int                     `json:"deposit"`
	UnitPrice                   *big.Int                     `json:"unitprice"`
	Cost                        *big.Int                     `json:"cost"`
	Duration                    *big.Int                     `json:"duration"`
	StorageFile                 map[common.Hash]*StorageFile `json:"storagefile"`
	LeaseList                   map[common.Hash]*LeaseDetail `json:"leaselist"`
	LastVerificationTime        *big.Int                     `json:"lastverificationtime"`
	LastVerificationSuccessTime *big.Int                     `json:"lastverificationsuccesstime"`
	ValidationFailureTotalTime  *big.Int                     `json:"validationfailuretotaltime"`
	Status                      int                          `json:"status"`
	Hash                        common.Hash                  `json:"validhash"`
}

*

*Rental structure

type Lease2

type Lease2 struct {
	Address                     common.Address                `json:"address"`
	Status                      int                           `json:"status"`
	LastVerificationTime        *big.Int                      `json:"lastverificationtime"`
	LastVerificationSuccessTime *big.Int                      `json:"lastverificationsuccesstime"`
	ValidationFailureTotalTime  *big.Int                      `json:"validationfailuretotaltime"`
	LeaseList                   map[common.Hash]*LeaseDetail2 `json:"leaselist"`
}

type Lease3

type Lease3 struct {
	Hash   common.Hash `json:"hash"`
	Status int         `json:"status"`
}

type LeaseDetail

type LeaseDetail struct {
	RequestHash                common.Hash `json:"requesthash"`
	PledgeHash                 common.Hash `json:"pledgehash"`
	RequestTime                *big.Int    `json:"requesttime"`
	StartTime                  *big.Int    `json:"starttime"`
	Duration                   *big.Int    `json:"duration"`
	Cost                       *big.Int    `json:"cost"`
	Deposit                    *big.Int    `json:"deposit"`
	ValidationFailureTotalTime *big.Int    `json:"validationfailuretotaltime"`
	Revert                     int         `json:"revert"`
	Hash                       common.Hash `json:"validhash"`
}

*

  • Lease list

type LeaseDetail2

type LeaseDetail2 struct {
	Deposit *big.Int `json:"deposit"`
}

type LeasePledgeRecord

type LeasePledgeRecord struct {
	Address        common.Address `json:"address"`
	DepositAddress common.Address `json:"depositaddress"`
	Hash           common.Hash    `json:"hash"`
	Capacity       *big.Int       `json:"capacity"`
	RootHash       common.Hash    `json:"roothash"`
	BurnSRTAmount  *big.Int       `json:"burnsrtamount"`
	BurnAmount     *big.Int       `json:"burnamount"`
	Duration       *big.Int       `json:"duration"`
	BurnSRTAddress common.Address `json:"burnsrtaddress"`
	PledgeHash     common.Hash    `json:"pledgehash"`
	LeftCapacity   *big.Int       `json:"leftcapacity"`
	LeftRootHash   common.Hash    `json:"leftroothash"`
}

type LeaseRenewalPledgeRecord

type LeaseRenewalPledgeRecord struct {
	Address        common.Address `json:"address"`
	Hash           common.Hash    `json:"hash"`
	Capacity       *big.Int       `json:"capacity"`
	RootHash       common.Hash    `json:"roothash"`
	BurnSRTAmount  *big.Int       `json:"burnsrtamount"`
	BurnAmount     *big.Int       `json:"burnamount"`
	Duration       *big.Int       `json:"duration"`
	BurnSRTAddress common.Address `json:"burnsrtaddress"`
	PledgeHash     common.Hash    `json:"pledgehash"`
}

type LeaseRenewalRecord

type LeaseRenewalRecord struct {
	Address  common.Address `json:"address"`
	Duration *big.Int       `json:"duration"`
	Hash     common.Hash    `json:"hash"`
	Price    *big.Int       `json:"price"`
	Tenant   common.Address `json:"tenant"`
	NewHash  common.Hash    `json:"newhash"`
	Capacity *big.Int       `json:"capacity"`
}

type LeaseRequestRecord

type LeaseRequestRecord struct {
	Tenant   common.Address `json:"tenant"`
	Address  common.Address `json:"address"`
	Capacity *big.Int       `json:"capacity"`
	Duration *big.Int       `json:"duration"`
	Price    *big.Int       `json:"price"`
	Hash     common.Hash    `json:"hash"`
}

type LeaseRescindRecord

type LeaseRescindRecord struct {
	Address common.Address `json:"address"`
	Hash    common.Hash    `json:"hash"`
}

type LockBalanceData

type LockBalanceData struct {
	RewardBalance map[uint32]*big.Int               `json:"rewardbalance"`
	LockBalance   map[uint64]map[uint32]*PledgeItem `json:"lockbalance"`
}

type LockData

type LockData struct {
	FlowRevenue map[common.Address]*LockBalanceData `json:"flowrevenve"`
	CacheL1     []common.Hash                       `json:"cachel1"` // Store chceckout data
	CacheL2     common.Hash                         `json:"cachel2"` //Store data of the previous day
	//rlsLockBalance map[common.Address]*RlsLockData     // The release lock data
	Locktype string `json:"Locktype"`
}

func NewLockData

func NewLockData(t string) *LockData

type LockParameter

type LockParameter struct {
	LockPeriod uint32 `json:"LockPeriod"`
	RlsPeriod  uint32 `json:"ReleasePeriod"`
	Interval   uint32 `json:"ReleaseInterval"`
}

type LockParameterRecord

type LockParameterRecord struct {
	LockPeriod uint32
	RlsPeriod  uint32
	Interval   uint32
	Who        uint32
}

type LockProfitSnap

type LockProfitSnap struct {
	Number        uint64      `json:"number"` // Block number where the snapshot was created
	Hash          common.Hash `json:"hash"`   // Block hash where the snapshot was created
	RewardLock    *LockData   `json:"reward"`
	FlowLock      *LockData   `json:"flow"`
	BandwidthLock *LockData   `json:"bandwidth"`
	PosPgExitLock *LockData   `json:"storagePgExit"`
	PosExitLock   *LockData   `json:"posexitlock"`
}

func NewLockProfitSnap

func NewLockProfitSnap() *LockProfitSnap

type LockRewardRecord

type LockRewardRecord struct {
	Target     common.Address
	Amount     *big.Int
	IsReward   uint32
	FlowValue1 uint64 `rlp:"optional"` //Real Flow Value
	FlowValue2 uint64 `rlp:"optional"` //valid Flow Value
}

type LockState

type LockState interface {
	PayLockReward(LockAccountsRoot common.Hash, number uint64, state *state.StateDB) error
	CommitData() (common.Hash, common.Hash, error)
	AddLockReward(LockReward []LockRewardRecord, snap *Snapshot, db ethdb.Database, number uint64) ([]LockRewardRecord, error)
}

func NewLockState

func NewLockState(root, lockaccounts common.Hash, number uint64) (LockState, error)

type ManagerAddressRecord

type ManagerAddressRecord struct {
	Target common.Address
	Who    uint32
}

type MinerFlowReportItem

type MinerFlowReportItem struct {
	Target       common.Address
	ReportNumber uint32
	FlowValue1   uint64
	FlowValue2   uint64
}

type MinerFlowReportRecord

type MinerFlowReportRecord struct {
	ChainHash     common.Hash
	ReportTime    uint64
	ReportContent []MinerFlowReportItem
}

type MinerStakeRecord

type MinerStakeRecord struct {
	Target common.Address
	Stake  *big.Int
}

type NoticeCR

type NoticeCR struct {
	NRecord map[common.Address]bool `json:"noticeConfirmRecord"`
	Number  uint64                  `json:"firstReceivedNumber"` // this number will fill when there are more than 2/3+1 maxSignerCnt
	Type    uint64                  `json:"noticeType"`
	Success bool                    `json:"success"`
}

type OldHeaderExtra

type OldHeaderExtra struct {
	CurrentBlockConfirmations []Confirmation
	CurrentBlockVotes         []Vote
	CurrentBlockProposals     []Proposal
	CurrentBlockDeclares      []Declare
	ModifyPredecessorVotes    []Vote
	LoopStartTime             uint64
	SignerQueue               []common.Address
	SignerMissing             []common.Address
	ConfirmedBlockNumber      uint64
	SideChainConfirmations    []SCConfirmation
	SideChainSetCoinbases     []SCSetCoinbase
	SideChainNoticeConfirmed  []SCConfirmation
	SideChainCharging         []GasCharging //This only exist in side chain's header.Extra

	ExchangeNFC      []ExchangeNFCRecord
	DeviceBind       []DeviceBindRecord
	CandidatePledge  []CandidatePledgeRecord
	CandidatePunish  []CandidatePunishRecord
	MinerStake       []MinerStakeRecord
	CandidateExit    []common.Address
	ClaimedBandwidth []ClaimedBandwidthRecord
	FlowMinerExit    []common.Address
	BandwidthPunish  []BandwidthPunishRecord
	ConfigExchRate   uint32
	ConfigOffLine    uint32
	ConfigDeposit    []ConfigDepositRecord
	ConfigISPQOS     []ISPQOSRecord
	LockParameters   []LockParameterRecord
	ManagerAddress   []ManagerAddressRecord
	FlowHarvest      *big.Int
	LockReward       []LockRewardRecord
	GrantProfit      []consensus.GrantProfitRecord
	FlowReport       []MinerFlowReportRecord
}

type PledgeDetail

type PledgeDetail struct {
	Address common.Address `json:"address"`
	Height  uint64         `json:"height"`
	Amount  *big.Int       `json:"amount"`
}

type PledgeItem

type PledgeItem struct {
	Amount *big.Int `json:"lockamount"`
	//Reward          *big.Int       `json:"bandwidthreward"`
	PledgeType      uint32         `json:"type"`
	Playment        *big.Int       `json:"playment"`
	LockPeriod      uint32         `json:"lockperiod"`
	RlsPeriod       uint32         `json:"releaseperiod"`
	Interval        uint32         `json:"releaseinterval"`
	StartHigh       uint64         `json:"startblocknumber"`
	TargetAddress   common.Address `json:"targetaddress"`
	RevenueAddress  common.Address `json:"revenueaddress"`
	RevenueContract common.Address `json:"contractaddress"`
	MultiSignature  common.Address `json:"multisignatureaddress"`

	BurnAddress common.Address `json:"burnaddress"`
	BurnRatio   *big.Int       `json:"burnratio"`
	BurnAmount  *big.Int       `json:"burnamount"`
}

func NewPledgeItem

func NewPledgeItem(amount *big.Int) *PledgeItem

type PosPledgeItem

type PosPledgeItem struct {
	Manager     common.Address                `json:"manager"`
	Active      uint64                        `json:"active"`
	TotalAmount *big.Int                      `json:"totalamount"`
	Detail      map[common.Hash]*PledgeDetail `json:"detail"`
	LastPunish  uint64                        `json:"lastpunish"`
	DisRate     *big.Int                      `json:"distributerate"`
}

type Proposal

type Proposal struct {
	Hash                   common.Hash    `json:"hash"`                   // tx hash
	ReceivedNumber         *big.Int       `json:"receivenumber"`          // block number of proposal received
	CurrentDeposit         *big.Int       `json:"currentdeposit"`         // received deposit for this proposal
	ValidationLoopCnt      uint64         `json:"validationloopcount"`    // validation block number length of this proposal from the received block number
	ProposalType           uint64         `json:"proposaltype"`           // type of proposal 1 - add candidate 2 - remove candidate ...
	Proposer               common.Address `json:"proposer"`               // proposer
	TargetAddress          common.Address `json:"candidateaddress"`       // candidate need to add/remove if candidateNeedPD == true
	MinerRewardPerThousand uint64         `json:"minerrewardperthousand"` // reward of miner + side chain miner
	SCHash                 common.Hash    `json:"schash"`                 // side chain genesis parent hash need to add/remove
	SCBlockCountPerPeriod  uint64         `json:"scblockcountperpersiod"` // the number block sealed by this side chain per period, default 1
	SCBlockRewardPerPeriod uint64         `json:"scblockrewardperperiod"` // the reward of this side chain per period if SCBlockCountPerPeriod reach, default 0. SCBlockRewardPerPeriod/1000 * MinerRewardPerThousand/1000 * BlockReward is the reward for this side chain
	Declares               []*Declare     `json:"declares"`               // Declare this proposal received (always empty in block header)
	MinVoterBalance        uint64         `json:"minvoterbalance"`        // value of minVoterBalance , need to mul big.Int(1e+18)
	ProposalDeposit        uint64         `json:"proposaldeposit"`        // The deposit need to be frozen during before the proposal get final conclusion. (TTC)
	SCRentFee              uint64         `json:"screntfee"`              // number of TTC coin, not wei
	SCRentRate             uint64         `json:"screntrate"`             // how many coin you want for 1 TTC on main chain
	SCRentLength           uint64         `json:"screntlength"`           // minimize block number of main chain , the rent fee will be used as reward of side chain miner.
}

Proposal : proposal come from custom tx which data like "ufo:1:event:proposal:candidate:add:address" or "ufo:1:event:proposal:percentage:60" proposal only come from the current candidates not only candidate add/remove , current signer can proposal for params modify like percentage of reward distribution ...

type RefundGas

type RefundGas map[common.Address]*big.Int

RefundGas : refund gas to tx sender

type RefundHash

type RefundHash map[common.Hash]RefundPair

RefundHash :

type RefundPair

type RefundPair struct {
	Sender   common.Address
	GasPrice *big.Int
}

RefundPair :

type RevenueParameter

type RevenueParameter struct {
	RevenueAddress  common.Address `json:"revenueaddress"`
	RevenueContract common.Address `json:"contractaddress"`
	MultiSignature  common.Address `json:"multisignatureaddress"`
}

type RlsLockData

type RlsLockData struct {
	LockBalance map[uint64]map[uint32]*PledgeItem // The primary key is lock number, The second key is pledge type
}

type SCBlockReward

type SCBlockReward struct {
	RewardScoreMap map[common.Address]uint64 `json:"rewardscore"` //sum(this value) in one period == 100
}

Score to calculate at one main chain block, for calculate the side chain reward

type SCConfirmation

type SCConfirmation struct {
	Hash     common.Hash
	Coinbase common.Address // the side chain signer , may be diff from signer in main chain
	Number   uint64
	LoopInfo []string
}

SCConfirmation is the confirmed tx send by side chain super node

type SCRecord

type SCRecord struct {
	Record              map[uint64][]*SCConfirmation `json:"record"`              // Confirmation Record of one side chain
	LastConfirmedNumber uint64                       `json:"lastConfirmedNumber"` // Last confirmed header number of one side chain
	MaxHeaderNumber     uint64                       `json:"maxHeaderNumber"`     // max header number of one side chain
	CountPerPeriod      uint64                       `json:"countPerPeriod"`      // block sealed per period on this side chain
	RewardPerPeriod     uint64                       `json:"rewardPerPeriod"`     // full reward per period, number per thousand
	RentReward          map[common.Hash]*SCRentInfo  `json:"rentReward"`          // reward info by rent
}

SCRecord is the state record for side chain

type SCRentInfo

type SCRentInfo struct {
	RentPerPeriod   *big.Int `json:"rentPerPeriod"`
	MaxRewardNumber *big.Int `json:"maxRewardNumber"`
}

type SCReward

type SCReward struct {
	SCBlockRewardMap map[uint64]*SCBlockReward `json:"scblockrewards"`
}

Record for one side chain

type SCSetCoinbase

type SCSetCoinbase struct {
	Hash     common.Hash
	Signer   common.Address
	Coinbase common.Address
	Type     bool
}

SCSetCoinbase is the tx send by main chain super node which can set coinbase for side chain

type SExpireRecord

type SExpireRecord struct {
	Address common.Address `json:"address"`
	Hash    common.Hash    `json:"hash"`
}

type SPledge

type SPledge struct {
	Address                     common.Address         `json:"address"`
	StorageSpaces               *SPledgeSpaces         `json:"storagespaces"`
	Number                      *big.Int               `json:"number"`
	TotalCapacity               *big.Int               `json:"totalcapacity"`
	Bandwidth                   *big.Int               `json:"bandwidth"`
	Price                       *big.Int               `json:"price"`
	StorageSize                 *big.Int               `json:"storagesize"`
	SpaceDeposit                *big.Int               `json:"spacedeposit"`
	Lease                       map[common.Hash]*Lease `json:"lease"`
	LastVerificationTime        *big.Int               `json:"lastverificationtime"`
	LastVerificationSuccessTime *big.Int               `json:"lastverificationsuccesstime"`
	ValidationFailureTotalTime  *big.Int               `json:"validationfailuretotaltime"`
	PledgeStatus                *big.Int               `json:"pledgeStatus"`
	Hash                        common.Hash            `json:"validhash"`
}

* Storage pledge struct

type SPledge2

type SPledge2 struct {
	PledgeStatus                *big.Int                `json:"pledgeStatus"`
	StorageCapacity             *big.Int                `json:"storagecapacity"`
	Lease                       map[common.Hash]*Lease2 `json:"lease"`
	LastVerificationTime        *big.Int                `json:"lastverificationtime"`
	LastVerificationSuccessTime *big.Int                `json:"lastverificationsuccesstime"`
	ValidationFailureTotalTime  *big.Int                `json:"validationfailuretotaltime"`
}

type SPledge3

type SPledge3 struct {
	PledgeStatus  *big.Int `json:"pledgeStatus"`
	TotalCapacity *big.Int `json:"totalcapacity"`
	LeftCapacity  *big.Int `json:"leftcapacity"`
	Lease         []Lease3 `json:"lease"`
}

type SPledgeExitRecord

type SPledgeExitRecord struct {
	Address      common.Address `json:"address"`
	PledgeStatus *big.Int       `json:"pledgeStatus"`
}

type SPledgeRecord

type SPledgeRecord struct {
	PledgeAddr      common.Address `json:"pledgeAddr"`
	Address         common.Address `json:"address"`
	Price           *big.Int       `json:"price"`
	SpaceDeposit    *big.Int       `json:"spacedeposit"`
	StorageCapacity *big.Int       `json:"storagecapacity"`
	StorageSize     *big.Int       `json:"storagesize"`
	RootHash        common.Hash    `json:"roothash"`
	PledgeNumber    *big.Int       `json:"pledgeNumber"`
	Bandwidth       *big.Int       `json:"bandwidth"`
}

type SPledgeRecoveryRecord

type SPledgeRecoveryRecord struct {
	Address       common.Address `json:"address"`
	LeaseHash     []common.Hash  `json:"leaseHash"`
	SpaceCapacity *big.Int       `json:"spaceCapacity"`
	RootHash      common.Hash    `json:"rootHash"`
	ValidNumber   *big.Int       `json:"validNumber"`
}

type SPledgeSpaces

type SPledgeSpaces struct {
	Address                     common.Address               `json:"address"`
	StorageCapacity             *big.Int                     `json:"storagecapacity"`
	RootHash                    common.Hash                  `json:"roothash"`
	StorageFile                 map[common.Hash]*StorageFile `json:"storagefile"`
	LastVerificationTime        *big.Int                     `json:"lastverificationtime"`
	LastVerificationSuccessTime *big.Int                     `json:"lastverificationsuccesstime"`
	ValidationFailureTotalTime  *big.Int                     `json:"validationfailuretotaltime"`
	Hash                        common.Hash                  `json:"validhash"`
}

*

  • Storage space

type SRTItem

type SRTItem struct {
	Addr   common.Address
	Amount *big.Int
}

type SRTState

type SRTState interface {
	Set(addr common.Address, amount *big.Int)
	Add(addr common.Address, amount *big.Int)
	Sub(addr common.Address, amount *big.Int) error
	Get(addr common.Address) *big.Int
	Del(addr common.Address)
	Copy() SRTState
	Load(db ethdb.Database, hash common.Hash) error
	Save(db ethdb.Database) (common.Hash, error)
	Root() common.Hash
	GetAll() map[common.Address]*big.Int
}

func NewDefaultSRTState

func NewDefaultSRTState() (SRTState, error)

func NewSRT

func NewSRT(root common.Hash, db ethdb.Database) (SRTState, error)

func NewTrieSRTState

func NewTrieSRTState(root common.Hash, db ethdb.Database) (SRTState, error)

type SignPledgeItem

type SignPledgeItem struct {
	TotalAmount *big.Int `json:"totalamount"`
	LastPunish  uint64   `json:"lastpunish"`
	DisRate     *big.Int `json:"distributerate"`
}

type SignTxFn

SignTxFn is a signTx

type SignerFn

type SignerFn func(signer accounts.Account, mimeType string, message []byte) ([]byte, error)

SignerFn hashes and signs the data to be signed by a backing account.

type SignerItem

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

type SignerSlice

type SignerSlice []SignerItem

func (SignerSlice) Len

func (s SignerSlice) Len() int

func (SignerSlice) Less

func (s SignerSlice) Less(i, j int) bool

func (SignerSlice) Swap

func (s SignerSlice) Swap(i, j int)

type SnapCache

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

type SnapCanAutoExit

type SnapCanAutoExit struct {
	CandidateAutoExit []common.Address `json:"candidateautoexit"`
}

type Snapshot

type Snapshot struct {
	LCRS uint64 // Loop count to recreate signers from top tally

	Period          uint64                                            `json:"period"`            // Period of seal each block
	Number          uint64                                            `json:"number"`            // Block number where the snapshot was created
	ConfirmedNumber uint64                                            `json:"confirmedNumber"`   // Block number confirmed when the snapshot was created
	Hash            common.Hash                                       `json:"hash"`              // Block hash where the snapshot was created
	HistoryHash     []common.Hash                                     `json:"historyHash"`       // Block hash list for two recent loop
	Signers         []*common.Address                                 `json:"signers"`           // Signers queue in current header
	Votes           map[common.Address]*Vote                          `json:"votes"`             // All validate votes from genesis block
	Tally           map[common.Address]*big.Int                       `json:"tally"`             // Stake for each candidate address
	Voters          map[common.Address]*big.Int                       `json:"voters"`            // Block number for each voter address
	Candidates      map[common.Address]uint64                         `json:"candidates"`        // Candidates for Signers (0- adding procedure 1- normal 2- removing procedure)
	Punished        map[common.Address]uint64                         `json:"punished"`          // The signer be punished count cause of missing seal
	Confirmations   map[uint64][]*common.Address                      `json:"confirms"`          // The signer confirm given block number
	Proposals       map[common.Hash]*Proposal                         `json:"proposals"`         // The Proposals going or success (failed proposal will be removed)
	HeaderTime      uint64                                            `json:"headerTime"`        // Time of the current header
	LoopStartTime   uint64                                            `json:"loopStartTime"`     // Start Time of the current loop
	ProposalRefund  map[uint64]map[common.Address]*big.Int            `json:"proposalRefund"`    // Refund proposal deposit
	SCCoinbase      map[common.Hash]map[common.Address]common.Address `json:"sideChainCoinbase"` // main chain set Coinbase of side chain setting
	SCRecordMap     map[common.Hash]*SCRecord                         `json:"sideChainRecord"`   // main chain record Confirmation of side chain setting
	SCRewardMap     map[common.Hash]*SCReward                         `json:"sideChainReward"`   // main chain record Side Chain Reward
	SCNoticeMap     map[common.Hash]*CCNotice                         `json:"sideChainNotice"`   // main chain record Notification to side chain
	LocalNotice     *CCNotice                                         `json:"localNotice"`       // side chain record Notification
	MinerReward     uint64                                            `json:"minerReward"`       // miner reward per thousand
	MinVB           *big.Int                                          `json:"minVoterBalance"`   // min voter balance
	FULBalance      map[common.Address]*FULLBalanceData               `json:"fulbalancedata"`
	RevenueNormal   map[common.Address]*RevenueParameter              `json:"normalrevenueaddress"`
	RevenueFlow     map[common.Address]*RevenueParameter              `json:"flowrevenueaddress"`
	CandidatePledge map[common.Address]*PledgeItem                    `json:"candidatepledge"`
	TallyMiner      map[common.Address]*CandidateState                `json:"tallyminer"` // Stake for each miner address
	FlowPledge      map[common.Address]*PledgeItem                    `json:"flowminerpledge"`
	Bandwidth       map[common.Address]*ClaimedBandwidth              `json:"claimedbandwidth"`
	FlowHarvest     *big.Int                                          `json:"flowharvest"`
	//FlowRevenue     map[common.Address]*LockBalanceData                 `json:"flowrevenve"`
	FlowRevenue  *LockProfitSnap
	SystemConfig SystemParameter `json:"systemconfig"`
	FlowMiner    *FlowMinerSnap  `json:"flowminer"`
	//FlowMiner      map[common.Address]map[common.Hash]*FlowMinerReport `json:"flowminerCurr"`
	//FlowMinerPrev  map[common.Address]map[common.Hash]*FlowMinerReport `json:"flowminerPrev"`
	FlowTotal      *big.Int                          `json:"flowtotal"`
	SCMinerRevenue map[common.Address]common.Address `json:"scminerrevenue"`
	SCFlowPledge   map[common.Address]bool           `json:"scflowpledge"`
	SCFULBalance   map[common.Address]*big.Int       `json:"fulbalance"`
	SignerMissing  []common.Address                  `json:"signermissing"`
	TallySigner    map[common.Address]uint64         `json:"tallySigner"`
	//StoragePledge      map[common.Address]*PledgeItem                    `json:"Storagepledge"`
	StorageData *StorageData `json:"storagedata"`

	ExStateRoot        common.Hash                          `json:"extrasstateRoot"`
	GrantListRoot      common.Hash                          `json:"grantListRoot"`
	RevenueStorage     map[common.Address]*RevenueParameter `json:"storagerevenueaddress"`
	SRT                SRTState                             `json:"-"`
	SRTHash            common.Hash                          `json:"srthash"`
	STGBandwidthMakeup map[common.Address]*BandwidthMakeup  `json:"stgbandwidthmakeup"`
	PosPledge          map[common.Address]*PosPledgeItem    `json:"pospledge"`
	// contains filtered or unexported fields
}

Snapshot is the state of the authorization voting at a given point in time.

type SnapshotAddrSRT

type SnapshotAddrSRT struct {
	AddrSrtBal *big.Int `json:"addrsrtbal"`
}

type SnapshotCapSuccAddrs

type SnapshotCapSuccAddrs struct {
	CapSuccAddrs map[common.Address]*big.Int `json:"capsuccaddrs"`
}

type SnapshotFlow

type SnapshotFlow struct {
	LockReward []FlowRecord `json:"flowrecords"`
}

type SnapshotFlowMiner

type SnapshotFlowMiner struct {
	DayStartTime        uint64                                              `json:"dayStartTime"`
	FlowMinerPrevTotal  uint64                                              `json:"flowminerPrevTotal"`
	FlowMiner           map[common.Address]map[common.Hash]*FlowMinerReport `json:"flowminerCurr"`
	FlowMinerReport     []*FlowMinerReport                                  `json:"flowminerReport"`
	FlowMinerPrev       map[common.Address]map[common.Hash]*FlowMinerReport `json:"flowminerPrev"`
	FlowMinerPrevReport []*FlowMinerReport                                  `json:"flowminerPrevReport"`
}

type SnapshotFlowReport

type SnapshotFlowReport struct {
	FlowReport []MinerFlowReportRecord `json:"flowreport"`
}

type SnapshotRelease

type SnapshotRelease struct {
	CandidatePledge map[common.Address]*PledgeItem      `json:"candidatepledge"`
	FlowPledge      map[common.Address]*PledgeItem      `json:"flowminerpledge"`
	FlowRevenue     map[common.Address]*LockBalanceData `json:"flowrevenve"`
}

type SnapshotRentSuc

type SnapshotRentSuc struct {
	RentSuc []common.Hash `json:"rentsuc"`
}

type SnapshotRevertSRT

type SnapshotRevertSRT struct {
	RevertSRT []ExchangeSRTRecord `json:"revertsrt"`
}

type SnapshotSPledge

type SnapshotSPledge struct {
	StoragePledge map[common.Address]*SPledge2 `json:"spledge"`
}

type SnapshotSPledgeCapVer

type SnapshotSPledgeCapVer struct {
	SpledgeCapVer map[common.Address]*big.Int `json:"spledgecapver"`
}

type SnapshotSPledgeDecimalValue

type SnapshotSPledgeDecimalValue struct {
	SpledgeDecimalValue decimal.Decimal `json:"spledgedecimalvalue"`
}

type SnapshotSPledgeInfo

type SnapshotSPledgeInfo struct {
	SPledgeInfo map[common.Address]*SPledge3 `json:"spledgeinfo"`
}

type SnapshotSPledgeRatioValue

type SnapshotSPledgeRatioValue struct {
	SpledgeRatioValue decimal.Decimal `json:"spledgeratiovalue"`
}

type SnapshotSPledgeValue

type SnapshotSPledgeValue struct {
	SpledgeValue *big.Int `json:"spledgevalue"`
}

type SnapshotSRT

type SnapshotSRT struct {
	SrtBal map[common.Address]*big.Int `json:"srtbal"`
}

type SnapshotSTGbwMakeup

type SnapshotSTGbwMakeup struct {
	STGBandwidthMakeup map[common.Address]*BandwidthMakeup `json:"stgbandwidthmakeup"`
}

type SnapshotSign

type SnapshotSign struct {
	LoopStartTime uint64                             `json:"loopStartTime"`
	Signers       []*common.Address                  `json:"signers"`
	Punished      map[common.Address]uint64          `json:"punished"`
	SignPledge    map[common.Address]*SignPledgeItem `json:"signpledge"`
}

type SnapshotStorageRatios

type SnapshotStorageRatios struct {
	Ratios map[common.Address]*StorageRatio `json:"ratios"`
}

type SnapshotStorageReward

type SnapshotStorageReward struct {
	StorageReward StorageReward `json:"storagereward"`
}

type SnapshotSucSPledge

type SnapshotSucSPledge struct {
	SucSPledge []common.Address `json:"sucspledge"`
}

type SpaceRewardRecord

type SpaceRewardRecord struct {
	Target  common.Address `json:"target"`
	Amount  *big.Int       `json:"amount"`
	Revenue common.Address `json:"revenue"`
}

type SrtAccount

type SrtAccount struct {
	Address common.Address
	Balance *big.Int
}

func (*SrtAccount) AddBalance

func (s *SrtAccount) AddBalance(amount *big.Int)

func (*SrtAccount) Encode

func (s *SrtAccount) Encode() ([]byte, error)

func (*SrtAccount) GetBalance

func (s *SrtAccount) GetBalance() *big.Int

func (*SrtAccount) SetBalance

func (s *SrtAccount) SetBalance(amount *big.Int)

func (*SrtAccount) SubBalance

func (s *SrtAccount) SubBalance(amount *big.Int) error

type SrtBalRecord

type SrtBalRecord struct {
	Address common.Address
	Amount  *big.Int
}

type SrtBalSlice

type SrtBalSlice []SrtBalRecord

func (SrtBalSlice) Len

func (s SrtBalSlice) Len() int

func (SrtBalSlice) Less

func (s SrtBalSlice) Less(i, j int) bool

func (SrtBalSlice) Swap

func (s SrtBalSlice) Swap(i, j int)

type SrtTrie

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

=========================================================================

func NewSrtTrie

func NewSrtTrie(root common.Hash, db ethdb.Database) (*SrtTrie, error)

====================================================================================

func (*SrtTrie) Add

func (s *SrtTrie) Add(addr common.Address, amount *big.Int)

func (*SrtTrie) Copy

func (s *SrtTrie) Copy() SRTState

func (*SrtTrie) Del

func (s *SrtTrie) Del(addr common.Address)

func (*SrtTrie) Get

func (s *SrtTrie) Get(addr common.Address) *big.Int

func (*SrtTrie) GetAll

func (s *SrtTrie) GetAll() map[common.Address]*big.Int

func (*SrtTrie) GetOrNewAccount

func (s *SrtTrie) GetOrNewAccount(addr common.Address) *SrtAccount

func (*SrtTrie) Hash

func (s *SrtTrie) Hash() common.Hash

func (*SrtTrie) Load

func (s *SrtTrie) Load(db ethdb.Database, hash common.Hash) error

func (*SrtTrie) Root

func (s *SrtTrie) Root() common.Hash

func (*SrtTrie) Save

func (s *SrtTrie) Save(db ethdb.Database) (common.Hash, error)

func (*SrtTrie) Set

func (s *SrtTrie) Set(addr common.Address, amount *big.Int)

func (*SrtTrie) Sub

func (s *SrtTrie) Sub(addr common.Address, amount *big.Int) error

func (*SrtTrie) TireDB

func (s *SrtTrie) TireDB() *trie.Database

type StorageBwPayRecord

type StorageBwPayRecord struct {
	Address common.Address `json:"address"`
	Amount  *big.Int       `json:"amount"`
}

type StorageData

type StorageData struct {
	StoragePledge map[common.Address]*SPledge `json:"spledge"`
	Hash          common.Hash                 `json:"validhash"`
}

func NewStorageSnap

func NewStorageSnap() *StorageData

type StorageExchangeBwRecord

type StorageExchangeBwRecord struct {
	Address   common.Address `json:"address"`
	Bandwidth *big.Int       `json:"bandwidth"`
}

type StorageExchangePriceRecord

type StorageExchangePriceRecord struct {
	Address common.Address `json:"address"`
	Price   *big.Int       `json:"price"`
}

type StorageFile

type StorageFile struct {
	Capacity                    *big.Int    `json:"capacity"`
	CreateTime                  *big.Int    `json:"createtime"`
	LastVerificationTime        *big.Int    `json:"lastverificationtime"`
	LastVerificationSuccessTime *big.Int    `json:"lastverificationsuccesstime"`
	ValidationFailureTotalTime  *big.Int    `json:"validationfailuretotaltime"`
	Hash                        common.Hash `json:"validhash"`
}

*

  • Rental structure

type StorageHeaderExtraV1

type StorageHeaderExtraV1 struct {
	CurrentBlockConfirmations []Confirmation
	CurrentBlockVotes         []Vote
	CurrentBlockProposals     []Proposal
	CurrentBlockDeclares      []Declare
	ModifyPredecessorVotes    []Vote
	LoopStartTime             uint64
	SignerQueue               []common.Address
	SignerMissing             []common.Address
	ConfirmedBlockNumber      uint64
	SideChainConfirmations    []SCConfirmation
	SideChainSetCoinbases     []SCSetCoinbase
	SideChainNoticeConfirmed  []SCConfirmation
	SideChainCharging         []GasCharging //This only exist in side chain's header.Extra

	ExchangeNFC      []ExchangeNFCRecord
	DeviceBind       []DeviceBindRecord
	CandidatePledge  []CandidatePledgeRecord
	CandidatePunish  []CandidatePunishRecord
	MinerStake       []MinerStakeRecord
	CandidateExit    []common.Address
	ClaimedBandwidth []ClaimedBandwidthRecord
	FlowMinerExit    []common.Address
	BandwidthPunish  []BandwidthPunishRecord
	ConfigExchRate   uint32
	ConfigOffLine    uint32
	ConfigDeposit    []ConfigDepositRecord
	ConfigISPQOS     []ISPQOSRecord
	LockParameters   []LockParameterRecord
	ManagerAddress   []ManagerAddressRecord
	FlowHarvest      *big.Int
	LockReward       []LockRewardRecord
	GrantProfit      []consensus.GrantProfitRecord
	FlowReport       []MinerFlowReportRecord

	StoragePledge       []SPledgeRecord
	StoragePledgeExit   []SPledgeExitRecord
	LeaseRequest        []LeaseRequestRecord
	ExchangeSRT         []ExchangeSRTRecord
	LeasePledge         []LeasePledgeRecord
	LeaseRenewal        []LeaseRenewalRecord
	LeaseRenewalPledge  []LeaseRenewalPledgeRecord
	LeaseRescind        []LeaseRescindRecord
	StorageRecoveryData []SPledgeRecoveryRecord
	StorageProofRecord  []StorageProofRecord

	StorageExchangePrice []StorageExchangePriceRecord
	ExtraStateRoot       common.Hash
	LockAccountsRoot     common.Hash
	StorageDataRoot      common.Hash
}

type StorageHeaderExtraV2

type StorageHeaderExtraV2 struct {
	CurrentBlockConfirmations []Confirmation
	CurrentBlockVotes         []Vote
	CurrentBlockProposals     []Proposal
	CurrentBlockDeclares      []Declare
	ModifyPredecessorVotes    []Vote
	LoopStartTime             uint64
	SignerQueue               []common.Address
	SignerMissing             []common.Address
	ConfirmedBlockNumber      uint64
	SideChainConfirmations    []SCConfirmation
	SideChainSetCoinbases     []SCSetCoinbase
	SideChainNoticeConfirmed  []SCConfirmation
	SideChainCharging         []GasCharging //This only exist in side chain's header.Extra

	ExchangeNFC      []ExchangeNFCRecord
	DeviceBind       []DeviceBindRecord
	CandidatePledge  []CandidatePledgeRecord
	CandidatePunish  []CandidatePunishRecord
	MinerStake       []MinerStakeRecord
	CandidateExit    []common.Address
	ClaimedBandwidth []ClaimedBandwidthRecord
	FlowMinerExit    []common.Address
	BandwidthPunish  []BandwidthPunishRecord
	ConfigExchRate   uint32
	ConfigOffLine    uint32
	ConfigDeposit    []ConfigDepositRecord
	ConfigISPQOS     []ISPQOSRecord
	LockParameters   []LockParameterRecord
	ManagerAddress   []ManagerAddressRecord
	FlowHarvest      *big.Int
	LockReward       []LockRewardRecord
	GrantProfit      []consensus.GrantProfitRecord
	FlowReport       []MinerFlowReportRecord

	StoragePledge       []SPledgeRecord
	StoragePledgeExit   []SPledgeExitRecord
	LeaseRequest        []LeaseRequestRecord
	ExchangeSRT         []ExchangeSRTRecord
	LeasePledge         []LeasePledgeRecord
	LeaseRenewal        []LeaseRenewalRecord
	LeaseRenewalPledge  []LeaseRenewalPledgeRecord
	LeaseRescind        []LeaseRescindRecord
	StorageRecoveryData []SPledgeRecoveryRecord
	StorageProofRecord  []StorageProofRecord

	StorageExchangePrice []StorageExchangePriceRecord
	ExtraStateRoot       common.Hash
	LockAccountsRoot     common.Hash
	StorageDataRoot      common.Hash
	StorageExchangeBw    []StorageExchangeBwRecord
}

type StorageHeaderExtraV3

type StorageHeaderExtraV3 struct {
	CurrentBlockConfirmations []Confirmation
	CurrentBlockVotes         []Vote
	CurrentBlockProposals     []Proposal
	CurrentBlockDeclares      []Declare
	ModifyPredecessorVotes    []Vote
	LoopStartTime             uint64
	SignerQueue               []common.Address
	SignerMissing             []common.Address
	ConfirmedBlockNumber      uint64
	SideChainConfirmations    []SCConfirmation
	SideChainSetCoinbases     []SCSetCoinbase
	SideChainNoticeConfirmed  []SCConfirmation
	SideChainCharging         []GasCharging //This only exist in side chain's header.Extra

	ExchangeNFC      []ExchangeNFCRecord
	DeviceBind       []DeviceBindRecord
	CandidatePledge  []CandidatePledgeRecord
	CandidatePunish  []CandidatePunishRecord
	MinerStake       []MinerStakeRecord
	CandidateExit    []common.Address
	ClaimedBandwidth []ClaimedBandwidthRecord
	FlowMinerExit    []common.Address
	BandwidthPunish  []BandwidthPunishRecord
	ConfigExchRate   uint32
	ConfigOffLine    uint32
	ConfigDeposit    []ConfigDepositRecord
	ConfigISPQOS     []ISPQOSRecord
	LockParameters   []LockParameterRecord
	ManagerAddress   []ManagerAddressRecord
	FlowHarvest      *big.Int
	LockReward       []LockRewardRecord
	GrantProfit      []consensus.GrantProfitRecord
	FlowReport       []MinerFlowReportRecord

	StoragePledge       []SPledgeRecord
	StoragePledgeExit   []SPledgeExitRecord
	LeaseRequest        []LeaseRequestRecord
	ExchangeSRT         []ExchangeSRTRecord
	LeasePledge         []LeasePledgeRecord
	LeaseRenewal        []LeaseRenewalRecord
	LeaseRenewalPledge  []LeaseRenewalPledgeRecord
	LeaseRescind        []LeaseRescindRecord
	StorageRecoveryData []SPledgeRecoveryRecord
	StorageProofRecord  []StorageProofRecord

	StorageExchangePrice []StorageExchangePriceRecord
	ExtraStateRoot       common.Hash
	LockAccountsRoot     common.Hash
	StorageDataRoot      common.Hash
	StorageExchangeBw    []StorageExchangeBwRecord
	SRTDataRoot          common.Hash
}

type StorageHeaderExtraV4

type StorageHeaderExtraV4 struct {
	CurrentBlockConfirmations []Confirmation
	CurrentBlockVotes         []Vote
	CurrentBlockProposals     []Proposal
	CurrentBlockDeclares      []Declare
	ModifyPredecessorVotes    []Vote
	LoopStartTime             uint64
	SignerQueue               []common.Address
	SignerMissing             []common.Address
	ConfirmedBlockNumber      uint64
	SideChainConfirmations    []SCConfirmation
	SideChainSetCoinbases     []SCSetCoinbase
	SideChainNoticeConfirmed  []SCConfirmation
	SideChainCharging         []GasCharging //This only exist in side chain's header.Extra

	ExchangeNFC      []ExchangeNFCRecord
	DeviceBind       []DeviceBindRecord
	CandidatePledge  []CandidatePledgeRecord
	CandidatePunish  []CandidatePunishRecord
	MinerStake       []MinerStakeRecord
	CandidateExit    []common.Address
	ClaimedBandwidth []ClaimedBandwidthRecord
	FlowMinerExit    []common.Address
	BandwidthPunish  []BandwidthPunishRecord
	ConfigExchRate   uint32
	ConfigOffLine    uint32
	ConfigDeposit    []ConfigDepositRecord
	ConfigISPQOS     []ISPQOSRecord
	LockParameters   []LockParameterRecord
	ManagerAddress   []ManagerAddressRecord
	FlowHarvest      *big.Int
	LockReward       []LockRewardRecord
	GrantProfit      []consensus.GrantProfitRecord
	FlowReport       []MinerFlowReportRecord

	StoragePledge       []SPledgeRecord
	StoragePledgeExit   []SPledgeExitRecord
	LeaseRequest        []LeaseRequestRecord
	ExchangeSRT         []ExchangeSRTRecord
	LeasePledge         []LeasePledgeRecord
	LeaseRenewal        []LeaseRenewalRecord
	LeaseRenewalPledge  []LeaseRenewalPledgeRecord
	LeaseRescind        []LeaseRescindRecord
	StorageRecoveryData []SPledgeRecoveryRecord
	StorageProofRecord  []StorageProofRecord

	StorageExchangePrice []StorageExchangePriceRecord
	ExtraStateRoot       common.Hash
	LockAccountsRoot     common.Hash
	StorageDataRoot      common.Hash
	StorageExchangeBw    []StorageExchangeBwRecord
	SRTDataRoot          common.Hash
	StorageBwPay         []StorageBwPayRecord
}

type StorageProofRecord

type StorageProofRecord struct {
	Address                     common.Address `json:"address"`
	LeaseHash                   common.Hash    `json:"leaseHash"`
	RootHash                    common.Hash    `json:"rootHash"`
	LastVerificationTime        *big.Int       `json:"lastverificationtime"`
	LastVerificationSuccessTime *big.Int       `json:"lastverificationsuccesstime"`
}

type StorageRatio

type StorageRatio struct {
	Capacity *big.Int        `json:"capacity"`
	Ratio    decimal.Decimal `json:"ratio"`
}

type StorageReward

type StorageReward struct {
	Reward     []SpaceRewardRecord `json:"reward"`
	LockPeriod uint32              `json:"LockPeriod"`
	RlsPeriod  uint32              `json:"ReleasePeriod"`
	Interval   uint32              `json:"ReleaseInterval"`
}

type SystemParameter

type SystemParameter struct {
	ExchRate       uint32                    `json:"ExchangeRatio"`
	OffLine        uint32                    `json:"OfflinePenalty"`
	Deposit        map[uint32]*big.Int       `json:"SeniorityThreshold"`
	QosConfig      map[uint32]uint32         `json:"BandwidthQOS"`
	ManagerAddress map[uint32]common.Address `json:"FoundationAddress"`
	LockParameters map[uint32]*LockParameter `json:"PledgeParameter"`
}

type TallyItem

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

type TallySlice

type TallySlice []TallyItem

func (TallySlice) Len

func (s TallySlice) Len() int

func (TallySlice) Less

func (s TallySlice) Less(i, j int) bool

func (TallySlice) Swap

func (s TallySlice) Swap(i, j int)

type Vote

type Vote struct {
	Voter     common.Address `json:"voter"`
	Candidate common.Address `json:"candidate"`
	Stake     *big.Int       `json:"stake"`
}

Vote : vote come from custom tx which data like "ufo:1:event:vote" Sender of tx is Voter, the tx.to is Candidate Stake is the balance of Voter when create this vote

Directories

Path Synopsis
Package state provides a caching layer atop the utg state trie.
Package state provides a caching layer atop the utg state trie.
snapshot
Package snapshot implements a journalled, dynamic state dump.
Package snapshot implements a journalled, dynamic state dump.

Jump to

Keyboard shortcuts

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