icstage

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalVersion1 int = iota
	GlobalVersion2
)
View Source
const (
	TypeIScoreClaim int = iota
	TypeEventDelegation
	TypeEventBond
	TypeEventEnable
	TypeBlockProduce
	TypeGlobal
	TypeEventVotedReward
	TypeEventDelegationV2
	TypeEventDelegated
)

Variables

View Source
var (
	IScoreClaimKey  = containerdb.ToKey(containerdb.RLPBuilder, []byte{0x10})
	EventKey        = containerdb.ToKey(containerdb.RLPBuilder, []byte{0x20})
	BlockProduceKey = containerdb.ToKey(containerdb.RLPBuilder, []byte{0x30})
	ValidatorKey    = containerdb.ToKey(containerdb.RLPBuilder, []byte{0x40})
	HashKey         = containerdb.ToKey(containerdb.PrefixedHashBuilder, []byte{0x70})
	GlobalKey       = containerdb.ToKey(containerdb.RawBuilder, HashKey.Append(globalKey).Build()).Build()
	EventSizeKey    = containerdb.ToKey(containerdb.RawBuilder, HashKey.Append(eventsKey).Build())
	ValidatorsKey   = containerdb.ToKey(containerdb.RawBuilder, HashKey.Append(validatorsKey).Build())
)

Functions

func NewObjectImpl

func NewObjectImpl(tag icobject.Tag) (icobject.Impl, error)

Types

type BlockProduce

type BlockProduce struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func NewBlockProduce added in v0.9.7

func NewBlockProduce(pIndex, vCount int, vMask *big.Int) *BlockProduce

func ToBlockProduce

func ToBlockProduce(obj trie.Object) *BlockProduce

func (*BlockProduce) Clear

func (bp *BlockProduce) Clear()

func (*BlockProduce) Equal

func (bp *BlockProduce) Equal(o icobject.Impl) bool

func (*BlockProduce) Format added in v0.9.7

func (bp *BlockProduce) Format(f fmt.State, c rune)

func (*BlockProduce) IsEmpty

func (bp *BlockProduce) IsEmpty() bool

func (*BlockProduce) ProposerIndex

func (bp *BlockProduce) ProposerIndex() int

func (*BlockProduce) RLPDecodeFields

func (bp *BlockProduce) RLPDecodeFields(decoder codec.Decoder) error

func (*BlockProduce) RLPEncodeFields

func (bp *BlockProduce) RLPEncodeFields(encoder codec.Encoder) error

func (*BlockProduce) SetProposerIndex added in v0.9.7

func (bp *BlockProduce) SetProposerIndex(index int)

func (*BlockProduce) SetVoteCount added in v0.9.7

func (bp *BlockProduce) SetVoteCount(count int)

func (*BlockProduce) SetVoteMask added in v0.9.7

func (bp *BlockProduce) SetVoteMask(mask *big.Int)

func (*BlockProduce) String added in v0.9.7

func (bp *BlockProduce) String() string

func (*BlockProduce) Version

func (bp *BlockProduce) Version() int

func (*BlockProduce) VoteCount

func (bp *BlockProduce) VoteCount() int

func (*BlockProduce) VoteMask

func (bp *BlockProduce) VoteMask() *big.Int

type EnableStatus added in v0.9.7

type EnableStatus int
const (
	ESEnable EnableStatus = iota
	ESDisableTemp
	ESDisablePermanent
	ESMax
)

func (EnableStatus) IsDisabledPermanently added in v0.9.8

func (ef EnableStatus) IsDisabledPermanently() bool

func (EnableStatus) IsDisabledTemporarily added in v0.9.7

func (ef EnableStatus) IsDisabledTemporarily() bool

func (EnableStatus) IsEnabled added in v0.9.7

func (ef EnableStatus) IsEnabled() bool

func (EnableStatus) String added in v0.9.7

func (ef EnableStatus) String() string

type EventDelegationV2 added in v0.9.10

type EventDelegationV2 struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func NewEventDelegationV2 added in v0.9.10

func NewEventDelegationV2(addr *common.Address, delegated VoteList, delegating VoteList) *EventDelegationV2

func ToEventDelegationV2 added in v0.9.10

func ToEventDelegationV2(obj trie.Object) *EventDelegationV2

func (*EventDelegationV2) Delegated added in v0.9.10

func (e *EventDelegationV2) Delegated() VoteList

func (*EventDelegationV2) Delegating added in v0.9.10

func (e *EventDelegationV2) Delegating() VoteList

func (*EventDelegationV2) Equal added in v0.9.10

func (e *EventDelegationV2) Equal(o icobject.Impl) bool

func (*EventDelegationV2) Format added in v0.9.10

func (e *EventDelegationV2) Format(f fmt.State, c rune)

func (*EventDelegationV2) From added in v0.9.10

func (e *EventDelegationV2) From() *common.Address

func (*EventDelegationV2) RLPDecodeFields added in v0.9.10

func (e *EventDelegationV2) RLPDecodeFields(decoder codec.Decoder) error

func (*EventDelegationV2) RLPEncodeFields added in v0.9.10

func (e *EventDelegationV2) RLPEncodeFields(encoder codec.Encoder) error

func (*EventDelegationV2) Version added in v0.9.10

func (e *EventDelegationV2) Version() int

type EventEnable

type EventEnable struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func NewEventEnable added in v0.9.7

func NewEventEnable(target *common.Address, status EnableStatus) *EventEnable

func ToEventEnable

func ToEventEnable(obj trie.Object) *EventEnable

func (*EventEnable) Equal

func (ee *EventEnable) Equal(o icobject.Impl) bool

func (*EventEnable) Format added in v0.9.7

func (ee *EventEnable) Format(f fmt.State, c rune)

func (*EventEnable) RLPDecodeFields

func (ee *EventEnable) RLPDecodeFields(decoder codec.Decoder) error

func (*EventEnable) RLPEncodeFields

func (ee *EventEnable) RLPEncodeFields(encoder codec.Encoder) error

func (*EventEnable) Status added in v0.9.7

func (ee *EventEnable) Status() EnableStatus

func (*EventEnable) Target

func (ee *EventEnable) Target() *common.Address

func (*EventEnable) Version

func (ee *EventEnable) Version() int

type EventVote

type EventVote struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func NewEventVote added in v0.9.7

func NewEventVote(addr *common.Address, votes VoteList) *EventVote

func ToEventVote

func ToEventVote(obj trie.Object) *EventVote

func (*EventVote) Equal

func (e *EventVote) Equal(o icobject.Impl) bool

func (*EventVote) Format added in v0.9.7

func (e *EventVote) Format(f fmt.State, c rune)

func (*EventVote) From

func (e *EventVote) From() *common.Address

func (*EventVote) RLPDecodeFields

func (e *EventVote) RLPDecodeFields(decoder codec.Decoder) error

func (*EventVote) RLPEncodeFields

func (e *EventVote) RLPEncodeFields(encoder codec.Encoder) error

func (*EventVote) Version

func (e *EventVote) Version() int

func (*EventVote) Votes

func (e *EventVote) Votes() VoteList

type EventVotedReward added in v0.9.8

type EventVotedReward struct {
	icobject.NoDatabase
}

func NewEventVotedReward added in v0.9.8

func NewEventVotedReward() *EventVotedReward

func ToEventVotedReward added in v0.9.8

func ToEventVotedReward(obj trie.Object) *EventVotedReward

func (*EventVotedReward) Equal added in v0.9.8

func (ee *EventVotedReward) Equal(o icobject.Impl) bool

func (*EventVotedReward) Format added in v0.9.8

func (ee *EventVotedReward) Format(f fmt.State, c rune)

func (*EventVotedReward) RLPDecodeFields added in v0.9.8

func (ee *EventVotedReward) RLPDecodeFields(decoder codec.Decoder) error

func (*EventVotedReward) RLPEncodeFields added in v0.9.8

func (ee *EventVotedReward) RLPEncodeFields(encoder codec.Encoder) error

func (*EventVotedReward) Version added in v0.9.8

func (ee *EventVotedReward) Version() int

type Global

type Global interface {
	icobject.Impl
	GetV1() *GlobalV1
	GetV2() *GlobalV2
	GetIISSVersion() int
	GetStartHeight() int64
	GetOffsetLimit() int
	GetTermPeriod() int
	GetRevision() int
	GetElectedPRepCount() int
	GetBondRequirement() int
	String() string
}

func NewGlobal

func NewGlobal(version int) (Global, error)

func ToGlobal

func ToGlobal(obj trie.Object) Global

type GlobalV1

type GlobalV1 struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func NewGlobalV1 added in v0.9.7

func NewGlobalV1(
	iissVersion int,
	startHeight int64,
	offsetLimit int,
	revision int,
	irep *big.Int,
	rrep *big.Int,
	mainPRepCount int,
	electedPRepCount int,
) *GlobalV1

func (*GlobalV1) Equal

func (g *GlobalV1) Equal(impl icobject.Impl) bool

func (*GlobalV1) Format added in v0.9.7

func (g *GlobalV1) Format(f fmt.State, c rune)

func (*GlobalV1) GetBondRequirement

func (g *GlobalV1) GetBondRequirement() int

func (*GlobalV1) GetElectedPRepCount

func (g *GlobalV1) GetElectedPRepCount() int

func (*GlobalV1) GetIISSVersion

func (g *GlobalV1) GetIISSVersion() int

func (*GlobalV1) GetIRep added in v0.9.7

func (g *GlobalV1) GetIRep() *big.Int

func (*GlobalV1) GetMainRepCount added in v0.9.7

func (g *GlobalV1) GetMainRepCount() int

func (*GlobalV1) GetOffsetLimit

func (g *GlobalV1) GetOffsetLimit() int

func (*GlobalV1) GetRRep added in v0.9.7

func (g *GlobalV1) GetRRep() *big.Int

func (*GlobalV1) GetRevision

func (g *GlobalV1) GetRevision() int

func (*GlobalV1) GetStartHeight

func (g *GlobalV1) GetStartHeight() int64

func (*GlobalV1) GetTermPeriod

func (g *GlobalV1) GetTermPeriod() int

func (*GlobalV1) GetV1

func (g *GlobalV1) GetV1() *GlobalV1

func (*GlobalV1) GetV2

func (g *GlobalV1) GetV2() *GlobalV2

func (*GlobalV1) RLPDecodeFields

func (g *GlobalV1) RLPDecodeFields(decoder codec.Decoder) error

func (*GlobalV1) RLPEncodeFields

func (g *GlobalV1) RLPEncodeFields(encoder codec.Encoder) error

func (*GlobalV1) String

func (g *GlobalV1) String() string

func (*GlobalV1) Version

func (g *GlobalV1) Version() int

type GlobalV2

type GlobalV2 struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func NewGlobalV2 added in v0.9.7

func NewGlobalV2(
	iissVersion int,
	startHeight int64,
	offsetLimit int,
	revision int,
	iglobal *big.Int,
	iprep *big.Int,
	ivoter *big.Int,
	icps *big.Int,
	irelay *big.Int,
	electedPRepCount int,
	bondRequirement int,
) *GlobalV2

func (*GlobalV2) Equal

func (g *GlobalV2) Equal(impl icobject.Impl) bool

func (*GlobalV2) Format added in v0.9.7

func (g *GlobalV2) Format(f fmt.State, c rune)

func (*GlobalV2) GetBondRequirement

func (g *GlobalV2) GetBondRequirement() int

func (*GlobalV2) GetElectedPRepCount

func (g *GlobalV2) GetElectedPRepCount() int

func (*GlobalV2) GetICps added in v0.9.7

func (g *GlobalV2) GetICps() *big.Int

func (*GlobalV2) GetIGlobal added in v0.9.7

func (g *GlobalV2) GetIGlobal() *big.Int

func (*GlobalV2) GetIISSVersion

func (g *GlobalV2) GetIISSVersion() int

func (*GlobalV2) GetIPRep added in v0.9.7

func (g *GlobalV2) GetIPRep() *big.Int

func (*GlobalV2) GetIRelay added in v0.9.7

func (g *GlobalV2) GetIRelay() *big.Int

func (*GlobalV2) GetIVoter added in v0.9.7

func (g *GlobalV2) GetIVoter() *big.Int

func (*GlobalV2) GetOffsetLimit

func (g *GlobalV2) GetOffsetLimit() int

func (*GlobalV2) GetRevision

func (g *GlobalV2) GetRevision() int

func (*GlobalV2) GetStartHeight

func (g *GlobalV2) GetStartHeight() int64

func (*GlobalV2) GetTermPeriod

func (g *GlobalV2) GetTermPeriod() int

func (*GlobalV2) GetV1

func (g *GlobalV2) GetV1() *GlobalV1

func (*GlobalV2) GetV2

func (g *GlobalV2) GetV2() *GlobalV2

func (*GlobalV2) RLPDecodeFields

func (g *GlobalV2) RLPDecodeFields(decoder codec.Decoder) error

func (*GlobalV2) RLPEncodeFields

func (g *GlobalV2) RLPEncodeFields(encoder codec.Encoder) error

func (*GlobalV2) String

func (g *GlobalV2) String() string

func (*GlobalV2) Version

func (g *GlobalV2) Version() int

type IScoreClaim

type IScoreClaim struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func NewIScoreClaim added in v0.9.7

func NewIScoreClaim(value *big.Int) *IScoreClaim

func ToIScoreClaim

func ToIScoreClaim(obj trie.Object) *IScoreClaim

func (*IScoreClaim) Added

func (ic *IScoreClaim) Added(amount *big.Int) *IScoreClaim

func (*IScoreClaim) Equal

func (ic *IScoreClaim) Equal(impl icobject.Impl) bool

func (*IScoreClaim) Format added in v0.9.7

func (ic *IScoreClaim) Format(f fmt.State, c rune)

func (*IScoreClaim) RLPDecodeFields added in v0.9.7

func (ic *IScoreClaim) RLPDecodeFields(decoder codec.Decoder) error

func (*IScoreClaim) RLPEncodeFields added in v0.9.7

func (ic *IScoreClaim) RLPEncodeFields(encoder codec.Encoder) error

func (*IScoreClaim) String added in v0.9.7

func (ic *IScoreClaim) String() string

func (*IScoreClaim) Value added in v0.9.7

func (ic *IScoreClaim) Value() *big.Int

func (*IScoreClaim) Version added in v0.9.7

func (ic *IScoreClaim) Version() int

type Snapshot

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

func NewSnapshot

func NewSnapshot(database db.Database, hash []byte) *Snapshot

func NewSnapshotWithBuilder

func NewSnapshotWithBuilder(builder merkle.Builder, hash []byte) *Snapshot

func (*Snapshot) Bytes

func (ss *Snapshot) Bytes() []byte

func (*Snapshot) Filter

func (ss *Snapshot) Filter(prefix []byte) trie.IteratorForObject

func (*Snapshot) Flush

func (ss *Snapshot) Flush() error

func (*Snapshot) GetBlockProduce

func (ss *Snapshot) GetBlockProduce(offset int) (*BlockProduce, error)

func (*Snapshot) GetGlobal

func (ss *Snapshot) GetGlobal() (Global, error)

func (*Snapshot) GetValidators added in v0.9.7

func (ss *Snapshot) GetValidators() (ret []module.Address, err error)

type State

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

func NewState

func NewState(database db.Database) *State

func NewStateFromSnapshot

func NewStateFromSnapshot(ss *Snapshot) *State

func (*State) AddBlockProduce

func (s *State) AddBlockProduce(blockHeight int64, proposer module.Address, voters []module.Address) error

func (*State) AddEventBond

func (s *State) AddEventBond(offset int, from module.Address, votes VoteList) (int64, *icobject.Object, error)

func (*State) AddEventDelegated added in v0.9.10

func (s *State) AddEventDelegated(offset int, from module.Address, votes VoteList) (int64, *icobject.Object, error)

func (*State) AddEventDelegation

func (s *State) AddEventDelegation(offset int, from module.Address, votes VoteList) (int64, *icobject.Object, error)

func (*State) AddEventDelegationV2 added in v0.9.10

func (s *State) AddEventDelegationV2(offset int, from module.Address, delegated VoteList, delegating VoteList) (int64, *icobject.Object, error)

func (*State) AddEventEnable

func (s *State) AddEventEnable(offset int, target module.Address, status EnableStatus) (int64, error)

func (*State) AddEventVotedReward added in v0.9.8

func (s *State) AddEventVotedReward(offset int) (int64, error)

func (*State) AddGlobalV1

func (s *State) AddGlobalV1(revision int, startHeight int64, offsetLimit int, irep *big.Int, rrep *big.Int,
	mainPRepCount int, electedPRepCount int,
) error

func (*State) AddGlobalV2

func (s *State) AddGlobalV2(revision int, startHeight int64, offsetLimit int, iglobal *big.Int, iprep *big.Int,
	ivoter *big.Int, icps *big.Int, irelay *big.Int, electedPRepCount int, bondRequirement int,
) error

func (*State) AddIScoreClaim

func (s *State) AddIScoreClaim(addr module.Address, amount *big.Int) (*IScoreClaim, error)

func (*State) ClearCache added in v0.9.7

func (s *State) ClearCache()

func (*State) GetEvent added in v0.9.10

func (s *State) GetEvent(offset int, index int64) (*icobject.Object, error)

func (*State) GetGlobal added in v0.9.7

func (s *State) GetGlobal() (Global, error)

func (*State) GetIScoreClaim

func (s *State) GetIScoreClaim(addr module.Address) (*IScoreClaim, error)

func (*State) GetSnapshot

func (s *State) GetSnapshot() *Snapshot

func (*State) Reset

func (s *State) Reset(ss *Snapshot)

func (*State) ResetEventSize added in v0.9.7

func (s *State) ResetEventSize() error

type Vote

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

func NewVote

func NewVote(address *common.Address, value *big.Int) *Vote

func (*Vote) Amount

func (v *Vote) Amount() *big.Int

func (*Vote) Clone

func (v *Vote) Clone() *Vote

func (*Vote) Equal

func (v *Vote) Equal(v2 *Vote) bool

func (*Vote) Format added in v0.9.7

func (v *Vote) Format(f fmt.State, c rune)

func (*Vote) RLPDecodeSelf added in v0.9.7

func (v *Vote) RLPDecodeSelf(decoder codec.Decoder) error

func (*Vote) RLPEncodeSelf added in v0.9.7

func (v *Vote) RLPEncodeSelf(encoder codec.Encoder) error

func (*Vote) SetAmount added in v0.9.7

func (v *Vote) SetAmount(amount *big.Int)

func (*Vote) To

func (v *Vote) To() module.Address

type VoteList

type VoteList []*Vote

func (VoteList) Clone

func (vl VoteList) Clone() VoteList

func (*VoteList) Delete

func (vl *VoteList) Delete(i int) error

func (VoteList) Equal

func (vl VoteList) Equal(vl2 VoteList) bool

func (VoteList) Has added in v0.9.7

func (vl VoteList) Has() bool

func (VoteList) ToMap added in v0.9.7

func (vl VoteList) ToMap() map[string]*Vote

func (*VoteList) Update

func (vl *VoteList) Update(vl2 VoteList)

Jump to

Keyboard shortcuts

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