instruction

package
v0.0.0-...-7ece11e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 16 Imported by: 0

README

Instruction

Stake

  • Stake Shard ["stake", "pubkey1,pubkey2,..." "shard" "txStake1,txStake2,..." "rewardReceiver1,rewardReceiver2,..." "flag1,flag2,..."]

["stake", "pubkey1,pubkey2,..." "beacon" "txStake1,txStake2,..." "rewardReceiver1,rewardReceiver2,..." "flag1,flag2,..."]

Swap

  • Normal case: ["swap" "inPubkey1,inPubkey2,..." "outPupkey1, outPubkey2,..." "shard" "{shardID}" "punishedPubkey1,..."]

    ["swap" "inPubkey1,inPubkey2,..." "outPupkey1, outPubkey2,..." "beacon" "punishedPubkey1,..."]

  • Replace case: ["swap" "inPubkey1,inPubkey2,..." "outPupkey1, outPubkey2,..." "beacon" "" "punishedPubkey1,..." "newRewardReceiver1,..."]

    ["swap" "inPubkey1,inPubkey2,..." "outPupkey1, outPubkey2,..." "shard" "{shardID}" "punishedPubkey1,..." "newRewardReceiver1,..."]

Assign

["assign" "shardCandidate1,shardCandidate2,..." "shard" "{shardID}"]

Stop auto stake

["stopautostake" "pubkey1,pubkey2,..."]

Random

["random" "{nonce}" "{blockheight}" "{timestamp}" "{bitcoinTimestamp}"]

Request Shard Swap

```["request_shard_swap" "inPubkey1,inPubkey2,..." "outPupkey1, outPubkey2,..." "{shardID}" "epoch" "RandomNumber"] ```

Confirm Shard Swap

```["confirm_shard_swap" "inPubkey1,inPubkey2,..." "outPupkey1, outPubkey2,..." "{shardID}" "epoch" "RandomNumber"] ```

Documentation

Index

Constants

View Source
const (
	SWAP_SHARD_ACTION              = "swapshard"
	SWAP_ACTION                    = "swap"
	RANDOM_ACTION                  = "random"
	RE_DELEGATE                    = "redelegate"
	STAKE_ACTION                   = "stake"
	BEACON_STAKE_ACTION            = "bstake"
	ASSIGN_ACTION                  = "assign"
	ASSIGN_SYNC_ACTION             = "assignsync"
	STOP_AUTO_STAKE_ACTION         = "stopautostake"
	SET_ACTION                     = "set"
	RETURN_ACTION                  = "return"
	UNSTAKE_ACTION                 = "unstake"
	ADD_STAKING_ACTION             = "addstake"
	RETURN_BEACON_ACTION           = "returnb"
	SHARD_INST                     = "shard"
	BEACON_INST                    = "beacon"
	SPLITTER                       = ","
	TRUE                           = "true"
	FALSE                          = "false"
	FINISH_SYNC_ACTION             = "finishsync"
	REQ_DREWARD_ACTION             = "reqdreward"
	MINT_DREWARD_ACTION            = "mintdreward"
	SHARE_PRICE                    = "shareprice"
	ENABLE_FEATURE                 = "enablefeature"
	DEQUEUE                        = "dequeue"
	OUTDATED_DEQUEUE_REASON        = "outdated"
	ACCEPT_BLOCK_REWARD_V3_ACTION  = "acceptblockrewardv3"
	SHARD_RECEIVE_REWARD_V3_ACTION = "shardreceiverewardv3"

	SHARD_RECEIVE_REWARD_V1_ACTION = 43
	ACCEPT_BLOCK_REWARD_V1_ACTION  = 37
	SHARD_REWARD_INST              = "shardRewardInst"
)
View Source
const (
	SWAP_BY_END_EPOCH = iota
	SWAP_BY_SLASHING
	SWAP_BY_INCREASE_COMMITTEES_SIZE
	SWAP_BY_DECREASE_COMMITTEES_SIZE
)

Swap Instruction Sub Type

View Source
const (
	BEACON_CHAIN_ID = -1
)

Variables

View Source
var (
	ErrAssignInstruction = errors.New("assign instruction error")
)
View Source
var (
	ErrDequeueInstruction = errors.New("dequeue instruction error")
)
View Source
var (
	ErrEnableFeatureInstruction = errors.New("enable feature instruction error")
)
View Source
var (
	ErrFinishSyncInstruction = errors.New("finish sync instruction error")
)
View Source
var (
	ErrRequestDelegationRewardInstruction = errors.New("Request delegation reward instruction error")
)
View Source
var (
	ErrSharePriceInstruction = errors.New("share price instruction error")
)
View Source
var Logger = instructionLogger{}

Global instant to use

Functions

func IsConsensusInstruction

func IsConsensusInstruction(action string) bool

func NewShardReceiveRewardV1WithValue

func NewShardReceiveRewardV1WithValue(reward map[common.Hash]uint64, epoch uint64, shardID byte) ([][]string, error)

func ValidateAcceptBlockRewardInstructionSanity

func ValidateAcceptBlockRewardInstructionSanity(instruction []string) error

func ValidateAddStakingInstructionSanity

func ValidateAddStakingInstructionSanity(instruction []string) error

func ValidateAssignInstructionSanity

func ValidateAssignInstructionSanity(instruction []string) error

ValidateAssignInstructionSanity ...

func ValidateBeaconStakeInstructionSanity

func ValidateBeaconStakeInstructionSanity(instruction []string) error

validate stake instruction sanity beaconprocess.go: 1122 - 1165 beaconproducer.go: 386

func ValidateDequeueInstructionSanity

func ValidateDequeueInstructionSanity(instruction []string) error

ValidateFeatureEnableInstructionSanity ...

func ValidateEnableFeatureInstructionSanity

func ValidateEnableFeatureInstructionSanity(instruction []string) error

ValidateFeatureEnableInstructionSanity ...

func ValidateFinishSyncInstructionSanity

func ValidateFinishSyncInstructionSanity(instruction []string) error

ValidateFinishSyncInstructionSanity ...

func ValidateMintDelegationRewardInstructionSanity

func ValidateMintDelegationRewardInstructionSanity(instruction []string) error

func ValidateRandomInstructionSanity

func ValidateRandomInstructionSanity(instruction []string) error

func ValidateReDelegateInstructionSanity

func ValidateReDelegateInstructionSanity(instruction []string) error

func ValidateRequestDelegationRewardInstructionSanity

func ValidateRequestDelegationRewardInstructionSanity(instruction []string) error

ValidateRequestDelegationRewardInstructionSanity ...

func ValidateReturnBeaconStakingInstructionSanity

func ValidateReturnBeaconStakingInstructionSanity(instruction []string) error

func ValidateReturnStakingInstructionSanity

func ValidateReturnStakingInstructionSanity(instruction []string) error

func ValidateShardReceiveRewardV3InstructionFromString

func ValidateShardReceiveRewardV3InstructionFromString(instruction []string) error

func ValidateSharePriceInstructionSanity

func ValidateSharePriceInstructionSanity(instruction []string) error

ValidateSharePriceInstructionSanity ...

func ValidateStakeInstructionSanity

func ValidateStakeInstructionSanity(instruction []string) error

validate stake instruction sanity beaconprocess.go: 1122 - 1165 beaconproducer.go: 386

func ValidateStopAutoStakeInstructionSanity

func ValidateStopAutoStakeInstructionSanity(instruction []string) error

func ValidateSwapInstructionSanity

func ValidateSwapInstructionSanity(instruction []string) error

validate swap instruction sanity new reward receiver only present in replace committee beaconproducer.go: 356 - 367

func ValidateSwapShardInstructionSanity

func ValidateSwapShardInstructionSanity(instruction []string) error

validate SwapShard instruction sanity new reward receiver only present in replace committee beaconproducer.go: 356 - 367

func ValidateUnstakeInstructionSanity

func ValidateUnstakeInstructionSanity(instruction []string) error

ValidateUnstakeInstructionSanity : Validate unstake instruction data type

Types

type AcceptBlockRewardV1

type AcceptBlockRewardV1 struct {
	ShardID          byte
	TxsFee           map[common.Hash]uint64
	ShardBlockHeight uint64
}

func NewAcceptBlockRewardV1WithValue

func NewAcceptBlockRewardV1WithValue(
	shardID byte,
	txsFee map[common.Hash]uint64,
	shardBlockHeight uint64,
) *AcceptBlockRewardV1

func NewAcceptedBlockRewardV1FromString

func NewAcceptedBlockRewardV1FromString(
	inst string,
) (*AcceptBlockRewardV1, error)

func (*AcceptBlockRewardV1) String

func (blockRewardInfo *AcceptBlockRewardV1) String() ([]string, error)

type AcceptBlockRewardV3

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

AcceptBlockRewardV3 store block reward for one subset of committees in shard

func ImportAcceptBlockRewardInstructionFromString

func ImportAcceptBlockRewardInstructionFromString(instruction []string) (*AcceptBlockRewardV3, error)

func NewAcceptBlockRewardV3

func NewAcceptBlockRewardV3() *AcceptBlockRewardV3

func NewAcceptBlockRewardV3WithValue

func NewAcceptBlockRewardV3WithValue(
	subsetID, shardID byte,
	txsFee map[common.Hash]uint64,
	shardBlockHeight uint64,
) *AcceptBlockRewardV3

func ValidateAndImportAcceptBlockRewardV3InstructionFromString

func ValidateAndImportAcceptBlockRewardV3InstructionFromString(instruction []string) (*AcceptBlockRewardV3, error)

func (*AcceptBlockRewardV3) GetType

func (a *AcceptBlockRewardV3) GetType() string

func (*AcceptBlockRewardV3) IsEmpty

func (a *AcceptBlockRewardV3) IsEmpty() bool

func (*AcceptBlockRewardV3) ShardBlockHeight

func (a *AcceptBlockRewardV3) ShardBlockHeight() uint64

func (*AcceptBlockRewardV3) ShardID

func (a *AcceptBlockRewardV3) ShardID() byte

func (*AcceptBlockRewardV3) String

func (a *AcceptBlockRewardV3) String() []string

func (*AcceptBlockRewardV3) SubsetID

func (a *AcceptBlockRewardV3) SubsetID() byte

func (*AcceptBlockRewardV3) TxsFee

func (a *AcceptBlockRewardV3) TxsFee() map[common.Hash]uint64

read only function

type AddStakingInstruction

type AddStakingInstruction struct {
	CommitteePublicKeys       []string
	StakingAmount             []uint64
	StakingTxIDs              []string
	CommitteePublicKeysStruct []incognitokey.CommitteePublicKey
}

func ImportAddStakingInstructionFromString

func ImportAddStakingInstructionFromString(instruction []string) *AddStakingInstruction

func NewAddStakingInstruction

func NewAddStakingInstruction() *AddStakingInstruction

func NewAddStakingInstructionWithValue

func NewAddStakingInstructionWithValue(publicKeys []string, stakingAmount []uint64, txIDs []string) *AddStakingInstruction

func ValidateAndImportAddStakingInstructionFromString

func ValidateAndImportAddStakingInstructionFromString(instruction []string) (*AddStakingInstruction, error)

func (*AddStakingInstruction) DeleteSingleElement

func (s *AddStakingInstruction) DeleteSingleElement(index int)

func (*AddStakingInstruction) GetType

func (s *AddStakingInstruction) GetType() string

func (*AddStakingInstruction) IsEmpty

func (s *AddStakingInstruction) IsEmpty() bool

func (*AddStakingInstruction) SetPublicKeys

func (s *AddStakingInstruction) SetPublicKeys(publicKeys []string) (*AddStakingInstruction, error)

func (*AddStakingInstruction) SetStakingAmount

func (s *AddStakingInstruction) SetStakingAmount(stakingAmount []uint64) (*AddStakingInstruction, error)

func (*AddStakingInstruction) SetTxIDs

func (s *AddStakingInstruction) SetTxIDs(txIDs []string) (*AddStakingInstruction, error)

func (*AddStakingInstruction) ToString

func (s *AddStakingInstruction) ToString() []string

type AssignInstruction

type AssignInstruction struct {
	ChainID               int
	ShardCandidates       []string
	ShardCandidatesStruct []incognitokey.CommitteePublicKey
}

AssignInstruction : Assign instruction format: ["assign action", publickeys, shard or beacon chain, shard_id]

func ImportAssignInstructionFromString

func ImportAssignInstructionFromString(instruction []string) (*AssignInstruction, error)

ImportAssignInstructionFromString is unsafe method

func NewAssignInstruction

func NewAssignInstruction() *AssignInstruction

func NewAssignInstructionWithValue

func NewAssignInstructionWithValue(chainID int, shardCandidates []string) *AssignInstruction

func ValidateAndImportAssignInstructionFromString

func ValidateAndImportAssignInstructionFromString(instruction []string) (*AssignInstruction, error)

func (*AssignInstruction) GetType

func (a *AssignInstruction) GetType() string

func (*AssignInstruction) IsEmpty

func (a *AssignInstruction) IsEmpty() bool

func (*AssignInstruction) SetChainID

func (a *AssignInstruction) SetChainID(chainID int) *AssignInstruction

func (*AssignInstruction) SetShardCandidates

func (a *AssignInstruction) SetShardCandidates(shardCandidates []string) *AssignInstruction

func (*AssignInstruction) ToString

func (a *AssignInstruction) ToString() []string

type BeaconStakeInstruction

type BeaconStakeInstruction struct {
	PublicKeys            []string
	PublicKeyStructs      []incognitokey.CommitteePublicKey
	Chain                 string
	TxStakes              []string
	TxStakeHashes         []common.Hash
	RewardReceivers       []string
	RewardReceiverStructs []privacy.PaymentAddress
	AutoStakingFlag       []bool
	StakingAmount         []uint64
	FunderAddress         []string
	FunderAddressStructs  []privacy.PaymentAddress
}

BeaconStakeInstruction : BeaconStakeInstruction Format: ["STAKE_ACTION", list_public_keys, chain or beacon, list_txs, list_reward_addresses, list_autostaking_status(boolean)]

func ImportBeaconStakeInstructionFromString

func ImportBeaconStakeInstructionFromString(instruction []string) *BeaconStakeInstruction

ImportBeaconStakeInstructionFromString is unsafe method

func ImportInitBeaconStakeInstructionFromString

func ImportInitBeaconStakeInstructionFromString(instruction []string) *BeaconStakeInstruction

ImportBeaconStakeInstructionFromString is unsafe method

func NewBeaconStakeInstruction

func NewBeaconStakeInstruction() *BeaconStakeInstruction

func ValidateAndImportBeaconStakeInstructionFromString

func ValidateAndImportBeaconStakeInstructionFromString(instruction []string) (*BeaconStakeInstruction, error)

func (*BeaconStakeInstruction) GetType

func (s *BeaconStakeInstruction) GetType() string

func (*BeaconStakeInstruction) IsEmpty

func (s *BeaconStakeInstruction) IsEmpty() bool

func (*BeaconStakeInstruction) SetAutoStakingFlag

func (s *BeaconStakeInstruction) SetAutoStakingFlag(autoStakingFlag []bool) *BeaconStakeInstruction

func (*BeaconStakeInstruction) SetChain

func (*BeaconStakeInstruction) SetFunderAddress

func (s *BeaconStakeInstruction) SetFunderAddress(funderAddress []string) *BeaconStakeInstruction

func (*BeaconStakeInstruction) SetPublicKeys

func (s *BeaconStakeInstruction) SetPublicKeys(publicKeys []string) (*BeaconStakeInstruction, error)

func (*BeaconStakeInstruction) SetRewardReceivers

func (s *BeaconStakeInstruction) SetRewardReceivers(rewardReceivers []string) *BeaconStakeInstruction

func (*BeaconStakeInstruction) SetTxStakes

func (s *BeaconStakeInstruction) SetTxStakes(txStakes []string) *BeaconStakeInstruction

func (*BeaconStakeInstruction) ToString

func (s *BeaconStakeInstruction) ToString() []string

type CommitteeStateInstruction

type CommitteeStateInstruction struct {
	SwapInstructions          []*SwapInstruction
	StakeInstructions         []*StakeInstruction
	AssignInstructions        []*AssignInstruction
	StopAutoStakeInstructions []*StopAutoStakeInstruction
}

func (*CommitteeStateInstruction) ToString

func (i *CommitteeStateInstruction) ToString(action string) [][]string

the order of instruction must always be maintain

func (*CommitteeStateInstruction) ValidateAndFilterStakeInstructionsV1

func (i *CommitteeStateInstruction) ValidateAndFilterStakeInstructionsV1(v *ViewEnvironment)

FilterInstructions filter duplicate instruction duplicate instruction is result from delay of shard and beacon

type DequeueInstruction

type DequeueInstruction struct {
	Reason      string
	DequeueList map[int][]int //shardID -> pending index
}

func ImportDequeueInstructionFromString

func ImportDequeueInstructionFromString(instruction []string) (*DequeueInstruction, error)

ImportFeatureEnableInstructionFromString is unsafe method

func NewDequeueInstruction

func NewDequeueInstruction() *DequeueInstruction

func NewDequeueInstructionWithValue

func NewDequeueInstructionWithValue(reason string, dequeueList map[int][]int) *DequeueInstruction

func ValidateAndImportDequeueInstructionFromString

func ValidateAndImportDequeueInstructionFromString(instruction []string) (*DequeueInstruction, error)

func (*DequeueInstruction) GetType

func (f *DequeueInstruction) GetType() string

func (*DequeueInstruction) IsEmpty

func (f *DequeueInstruction) IsEmpty() bool

func (*DequeueInstruction) ToString

func (f *DequeueInstruction) ToString() []string

type EnableFeatureInstruction

type EnableFeatureInstruction struct {
	Features []string
}

FeatureEnableInstruction : format: "finish_sync", "0", "key1,key2"

func ImportEnableFeatureInstructionFromString

func ImportEnableFeatureInstructionFromString(instruction []string) (*EnableFeatureInstruction, error)

ImportFeatureEnableInstructionFromString is unsafe method

func NewEnableFeatureInstruction

func NewEnableFeatureInstruction() *EnableFeatureInstruction

func NewEnableFeatureInstructionWithValue

func NewEnableFeatureInstructionWithValue(feature []string) *EnableFeatureInstruction

func ValidateAndImportEnableFeatureInstructionFromString

func ValidateAndImportEnableFeatureInstructionFromString(instruction []string) (*EnableFeatureInstruction, error)

func (*EnableFeatureInstruction) GetType

func (f *EnableFeatureInstruction) GetType() string

func (*EnableFeatureInstruction) IsEmpty

func (f *EnableFeatureInstruction) IsEmpty() bool

func (*EnableFeatureInstruction) ToString

func (f *EnableFeatureInstruction) ToString() []string

type FinishSyncInstruction

type FinishSyncInstruction struct {
	ChainID          int
	PublicKeys       []string
	PublicKeysStruct []incognitokey.CommitteePublicKey
}

FinishSyncInstruction : format: "finish_sync", "0", "key1,key2"

func ImportFinishSyncInstructionFromString

func ImportFinishSyncInstructionFromString(instruction []string) (*FinishSyncInstruction, error)

ImportFinishSyncInstructionFromString is unsafe method

func NewFinishSyncInstruction

func NewFinishSyncInstruction() *FinishSyncInstruction

func NewFinishSyncInstructionWithValue

func NewFinishSyncInstructionWithValue(chainID int, publicKeys []string) *FinishSyncInstruction

func ValidateAndImportFinishSyncInstructionFromString

func ValidateAndImportFinishSyncInstructionFromString(instruction []string) (*FinishSyncInstruction, error)

func (*FinishSyncInstruction) GetType

func (f *FinishSyncInstruction) GetType() string

func (*FinishSyncInstruction) IsEmpty

func (f *FinishSyncInstruction) IsEmpty() bool

func (*FinishSyncInstruction) SetChainID

func (f *FinishSyncInstruction) SetChainID(chainID int) *FinishSyncInstruction

func (*FinishSyncInstruction) SetPublicKeys

func (f *FinishSyncInstruction) SetPublicKeys(publicKeys []string) *FinishSyncInstruction

func (*FinishSyncInstruction) ToString

func (f *FinishSyncInstruction) ToString() []string

type Instruction

type Instruction interface {
	GetType() string
	ToString() []string
}

func BuildAddStakingInstructionFromString

func BuildAddStakingInstructionFromString(instruction []string) (Instruction, error)

func BuildFinishSyncInstructionFromString

func BuildFinishSyncInstructionFromString(instruction []string) (Instruction, error)

func BuildRandomInstructionFromString

func BuildRandomInstructionFromString(instruction []string) (Instruction, error)

func BuildReDelegateInstructionFromString

func BuildReDelegateInstructionFromString(instruction []string) (Instruction, error)

func BuildReturnBeaconStakingInstructionFromString

func BuildReturnBeaconStakingInstructionFromString(instruction []string) (Instruction, error)

func BuildReturnStakingInstructionFromString

func BuildReturnStakingInstructionFromString(instruction []string) (Instruction, error)

func BuildStakeInstructionFromString

func BuildStakeInstructionFromString(instruction []string) (Instruction, error)

func BuildStopAutoStakeInstructionFromString

func BuildStopAutoStakeInstructionFromString(instruction []string) (Instruction, error)

func BuildSwapInstructionFromString

func BuildSwapInstructionFromString(instruction []string) (Instruction, error)

func BuildSwapShardInstructionFromString

func BuildSwapShardInstructionFromString(instruction []string) (Instruction, error)

func BuildUnstakeInstructionFromString

func BuildUnstakeInstructionFromString(instruction []string) (Instruction, error)

func ValidateAndImportConsensusInstructionFromListString

func ValidateAndImportConsensusInstructionFromListString(insts [][]string) []Instruction

func ValidateAndImportInstructionFromString

func ValidateAndImportInstructionFromString(inst []string) (
	instStr Instruction,
	err error,
)

type MintDelegationRewardInstruction

type MintDelegationRewardInstruction struct {
	PaymentAddresses       []string
	PaymentAddressesStruct []key.PaymentAddress
	RewardAmount           []uint64
	TxRequestIDs           []string
	TxRequestIdHashes      []common.Hash
}

func ImportMintDelegationRewardInstructionFromString

func ImportMintDelegationRewardInstructionFromString(instruction []string) (*MintDelegationRewardInstruction, error)

func NewMintDelegationRewardIns

func NewMintDelegationRewardIns() *MintDelegationRewardInstruction

func NewMintDelegationRewardInsWithValue

func NewMintDelegationRewardInsWithValue(
	txsRequest []string,
	paymentAddresses []string,
	rewardAmount []uint64,
) *MintDelegationRewardInstruction

func ValidateAndImportMintDelegationRewardInstructionFromString

func ValidateAndImportMintDelegationRewardInstructionFromString(instruction []string) (*MintDelegationRewardInstruction, error)

func (*MintDelegationRewardInstruction) AddNewMintInfo

func (mI *MintDelegationRewardInstruction) AddNewMintInfo(paymentAddress string, amount uint64, requestID string)

func (*MintDelegationRewardInstruction) GetPaymentAddresses

func (mI *MintDelegationRewardInstruction) GetPaymentAddresses() []string

func (*MintDelegationRewardInstruction) GetPaymentAddressesStruct

func (mI *MintDelegationRewardInstruction) GetPaymentAddressesStruct() []key.PaymentAddress

func (*MintDelegationRewardInstruction) GetRequestIDHashes

func (mI *MintDelegationRewardInstruction) GetRequestIDHashes() []common.Hash

func (*MintDelegationRewardInstruction) GetRequestIDs

func (mI *MintDelegationRewardInstruction) GetRequestIDs() []string

func (*MintDelegationRewardInstruction) GetRewardAmount

func (mI *MintDelegationRewardInstruction) GetRewardAmount() []uint64

func (*MintDelegationRewardInstruction) GetType

func (*MintDelegationRewardInstruction) IsEmpty

func (mI *MintDelegationRewardInstruction) IsEmpty() bool

func (*MintDelegationRewardInstruction) SetPaymentAddresses

func (mI *MintDelegationRewardInstruction) SetPaymentAddresses(payments []string) (*MintDelegationRewardInstruction, error)

func (*MintDelegationRewardInstruction) SetRequestTXIDs

func (*MintDelegationRewardInstruction) SetRewardAmount

func (*MintDelegationRewardInstruction) ToString

func (mI *MintDelegationRewardInstruction) ToString() []string

type RandomInstruction

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

Random Instruction which get nonce from bitcoin block

func ImportRandomInstructionFromString

func ImportRandomInstructionFromString(instruction []string) *RandomInstruction

ImportRandomInstructionFromString is unsafe method

func NewRandomInstruction

func NewRandomInstruction() *RandomInstruction

func NewRandomInstructionWithValue

func NewRandomInstructionWithValue(btcNonce int64) *RandomInstruction

func ValidateAndImportRandomInstructionFromString

func ValidateAndImportRandomInstructionFromString(instruction []string) (*RandomInstruction, error)

func (*RandomInstruction) GetType

func (s *RandomInstruction) GetType() string

func (*RandomInstruction) RandomNumber

func (s *RandomInstruction) RandomNumber() int64

func (*RandomInstruction) ToString

func (s *RandomInstruction) ToString() []string

type ReDelegateInstruction

type ReDelegateInstruction struct {
	CommitteePublicKeys       []string
	CommitteePublicKeysStruct []incognitokey.CommitteePublicKey
	DelegateList              []string
	DelegateListStruct        []incognitokey.CommitteePublicKey
	DelegateUIDList           []string
}

func ImportReDelegateInstructionFromString

func ImportReDelegateInstructionFromString(instruction []string) *ReDelegateInstruction

func NewReDelegateInstruction

func NewReDelegateInstruction() *ReDelegateInstruction

func NewReDelegateInstructionWithValue

func NewReDelegateInstructionWithValue(publicKeys, redelegateList, uIDs []string) *ReDelegateInstruction

func ValidateAndImportReDelegateInstructionFromString

func ValidateAndImportReDelegateInstructionFromString(instruction []string) (*ReDelegateInstruction, error)

func (*ReDelegateInstruction) DeleteSingleElement

func (s *ReDelegateInstruction) DeleteSingleElement(index int)

func (*ReDelegateInstruction) GetType

func (s *ReDelegateInstruction) GetType() string

func (*ReDelegateInstruction) IsEmpty

func (s *ReDelegateInstruction) IsEmpty() bool

func (*ReDelegateInstruction) SetDelegateList

func (s *ReDelegateInstruction) SetDelegateList(delegateList []string) (*ReDelegateInstruction, error)

func (*ReDelegateInstruction) SetDelegateListUID

func (s *ReDelegateInstruction) SetDelegateListUID(delegateUIDList []string) (*ReDelegateInstruction, error)

func (*ReDelegateInstruction) SetPublicKeys

func (s *ReDelegateInstruction) SetPublicKeys(publicKeys []string) (*ReDelegateInstruction, error)

func (*ReDelegateInstruction) ToString

func (s *ReDelegateInstruction) ToString() []string

type RequestDelegationRewardInstruction

type RequestDelegationRewardInstruction struct {
	IncPaymentAddrs       []string
	IncPaymentAddrStructs []key.PaymentAddress
	TxRequestIDs          []string
}

func ImportRequestDelegationRewardInstructionFromString

func ImportRequestDelegationRewardInstructionFromString(instruction []string) (*RequestDelegationRewardInstruction, error)

ImportRequestDelegationRewardInstructionFromString is unsafe method

func NewRequestDelegationRewardInstruction

func NewRequestDelegationRewardInstruction() *RequestDelegationRewardInstruction

func NewRequestDelegationRewardInstructionWithValue

func NewRequestDelegationRewardInstructionWithValue(paymentAddrs []string, requestID []string) *RequestDelegationRewardInstruction

func ValidateAndImportRequestDelegationRewardInstructionFromString

func ValidateAndImportRequestDelegationRewardInstructionFromString(instruction []string) (*RequestDelegationRewardInstruction, error)

func (*RequestDelegationRewardInstruction) GetType

func (*RequestDelegationRewardInstruction) IsEmpty

func (*RequestDelegationRewardInstruction) SetPaymentAddrs

func (*RequestDelegationRewardInstruction) SetRequestTXIDs

func (*RequestDelegationRewardInstruction) ToString

type ReturnBeaconStakeInstruction

type ReturnBeaconStakeInstruction struct {
	PublicKeys       []string
	PublicKeysStruct []incognitokey.CommitteePublicKey
	ReturnAmounts    []uint64
	PercentReturns   []uint
	Reasons          []int
}

func ImportReturnBeaconStakingInstructionFromString

func ImportReturnBeaconStakingInstructionFromString(instruction []string) (*ReturnBeaconStakeInstruction, error)

func NewReturnBeaconStakeIns

func NewReturnBeaconStakeIns() *ReturnBeaconStakeInstruction

func NewReturnBeaconStakeInsWithValue

func NewReturnBeaconStakeInsWithValue(
	publicKeys []string,
	reason []int,
	amounts []uint64,
) *ReturnBeaconStakeInstruction

func ValidateAndImportReturnBeaconStakingInstructionFromString

func ValidateAndImportReturnBeaconStakingInstructionFromString(instruction []string) (*ReturnBeaconStakeInstruction, error)

func (*ReturnBeaconStakeInstruction) AddNewRequest

func (rsI *ReturnBeaconStakeInstruction) AddNewRequest(publicKey string, amount uint64)

func (*ReturnBeaconStakeInstruction) GetPercentReturns

func (rsI *ReturnBeaconStakeInstruction) GetPercentReturns() []uint

func (*ReturnBeaconStakeInstruction) GetPublicKey

func (rsI *ReturnBeaconStakeInstruction) GetPublicKey() []string

func (*ReturnBeaconStakeInstruction) GetReason

func (rsI *ReturnBeaconStakeInstruction) GetReason() []int

func (*ReturnBeaconStakeInstruction) GetReturnAmounts

func (rsI *ReturnBeaconStakeInstruction) GetReturnAmounts() []uint64

func (*ReturnBeaconStakeInstruction) GetType

func (rsI *ReturnBeaconStakeInstruction) GetType() string

func (*ReturnBeaconStakeInstruction) IsEmpty

func (rsI *ReturnBeaconStakeInstruction) IsEmpty() bool

func (*ReturnBeaconStakeInstruction) SetPercentReturns

func (rsI *ReturnBeaconStakeInstruction) SetPercentReturns(percentReturns []uint) error

func (*ReturnBeaconStakeInstruction) SetPublicKeys

func (rsI *ReturnBeaconStakeInstruction) SetPublicKeys(publicKeys []string) (*ReturnBeaconStakeInstruction, error)

func (*ReturnBeaconStakeInstruction) SetReasons

func (rsI *ReturnBeaconStakeInstruction) SetReasons(reason []int) error

func (*ReturnBeaconStakeInstruction) SetReturnAmounts

func (rsI *ReturnBeaconStakeInstruction) SetReturnAmounts(amounts []uint64) error

func (*ReturnBeaconStakeInstruction) ToString

func (rsI *ReturnBeaconStakeInstruction) ToString() []string

type ReturnStakeInstruction

type ReturnStakeInstruction struct {
	PublicKeys       []string
	PublicKeysStruct []incognitokey.CommitteePublicKey
	StakingTXIDs     []string
	StakingTxHashes  []common.Hash
	PercentReturns   []uint
}

ReturnStakeInstruction : format: "return", "key1,key2,key3", "1231231,312312321,12312321", "100,100,100,100"

func ImportReturnStakingInstructionFromString

func ImportReturnStakingInstructionFromString(instruction []string) (*ReturnStakeInstruction, error)

func NewReturnStakeIns

func NewReturnStakeIns() *ReturnStakeInstruction

func NewReturnStakeInsWithValue

func NewReturnStakeInsWithValue(
	publicKeys []string,
	txStake []string,
) *ReturnStakeInstruction

func ValidateAndImportReturnStakingInstructionFromString

func ValidateAndImportReturnStakingInstructionFromString(instruction []string) (*ReturnStakeInstruction, error)

func (*ReturnStakeInstruction) AddNewRequest

func (rsI *ReturnStakeInstruction) AddNewRequest(publicKey string, stakingTx string)

func (*ReturnStakeInstruction) GetPercentReturns

func (rsI *ReturnStakeInstruction) GetPercentReturns() []uint

func (*ReturnStakeInstruction) GetPublicKey

func (rsI *ReturnStakeInstruction) GetPublicKey() []string

func (*ReturnStakeInstruction) GetStakingTX

func (rsI *ReturnStakeInstruction) GetStakingTX() []string

func (*ReturnStakeInstruction) GetType

func (rsI *ReturnStakeInstruction) GetType() string

func (*ReturnStakeInstruction) IsEmpty

func (rsI *ReturnStakeInstruction) IsEmpty() bool

func (*ReturnStakeInstruction) SetPercentReturns

func (rsI *ReturnStakeInstruction) SetPercentReturns(percentReturns []uint) error

func (*ReturnStakeInstruction) SetPublicKeys

func (rsI *ReturnStakeInstruction) SetPublicKeys(publicKeys []string) (*ReturnStakeInstruction, error)

func (*ReturnStakeInstruction) SetStakingTXIDs

func (rsI *ReturnStakeInstruction) SetStakingTXIDs(txIDs []string) (*ReturnStakeInstruction, error)

func (*ReturnStakeInstruction) ToString

func (rsI *ReturnStakeInstruction) ToString() []string

type ShardBlockRewardInfo

type ShardBlockRewardInfo struct {
	ShardReward map[common.Hash]uint64
	Epoch       uint64
}

ShardBlockRewardInfo IS LEGACY CODE, DO NOT MAKE ANY MODIFICATION

func NewShardReceiveRewardV1FromString

func NewShardReceiveRewardV1FromString(inst string) (*ShardBlockRewardInfo, error)

type ShardReceiveRewardV3

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

func ImportShardReceiveRewardV3InstructionFromString

func ImportShardReceiveRewardV3InstructionFromString(instruction []string) (*ShardReceiveRewardV3, error)

func NewShardReceiveRewardV3

func NewShardReceiveRewardV3() *ShardReceiveRewardV3

func NewShardReceiveRewardV3WithValue

func NewShardReceiveRewardV3WithValue(
	reward map[common.Hash]uint64,
	epoch uint64, shardID, subsetID byte,
) *ShardReceiveRewardV3

func ValidateAndImportShardReceiveRewardV3InstructionFromString

func ValidateAndImportShardReceiveRewardV3InstructionFromString(instruction []string) (*ShardReceiveRewardV3, error)

func (*ShardReceiveRewardV3) Epoch

func (shardSubsetReward *ShardReceiveRewardV3) Epoch() uint64

func (*ShardReceiveRewardV3) GetType

func (shardSubsetReward *ShardReceiveRewardV3) GetType() string

func (*ShardReceiveRewardV3) IsEmpty

func (shardSubsetReward *ShardReceiveRewardV3) IsEmpty() bool

func (*ShardReceiveRewardV3) Reward

func (shardSubsetReward *ShardReceiveRewardV3) Reward() map[common.Hash]uint64

read only function

func (*ShardReceiveRewardV3) SetSubsetID

func (shardSubsetReward *ShardReceiveRewardV3) SetSubsetID(subsetID byte) *ShardReceiveRewardV3

func (*ShardReceiveRewardV3) ShardID

func (shardSubsetReward *ShardReceiveRewardV3) ShardID() byte

func (*ShardReceiveRewardV3) String

func (shardSubsetReward *ShardReceiveRewardV3) String() []string

func (*ShardReceiveRewardV3) SubsetID

func (shardSubsetReward *ShardReceiveRewardV3) SubsetID() byte

type SharePriceInstruction

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

func NewSharePriceInstruction

func NewSharePriceInstruction() *SharePriceInstruction

func ValidateAndImportSharePriceInstructionFromString

func ValidateAndImportSharePriceInstructionFromString(instruction []string) (*SharePriceInstruction, error)

func (*SharePriceInstruction) AddPrice

func (f *SharePriceInstruction) AddPrice(id string, price uint64) *SharePriceInstruction

func (*SharePriceInstruction) GetType

func (f *SharePriceInstruction) GetType() string

func (*SharePriceInstruction) GetValue

func (f *SharePriceInstruction) GetValue() map[string]uint64

func (*SharePriceInstruction) IsEmpty

func (f *SharePriceInstruction) IsEmpty() bool

func (*SharePriceInstruction) ToString

func (f *SharePriceInstruction) ToString() []string

type StakeInstruction

type StakeInstruction struct {
	PublicKeys            []string
	PublicKeyStructs      []incognitokey.CommitteePublicKey
	Chain                 string
	TxStakes              []string
	TxStakeHashes         []common.Hash
	RewardReceivers       []string
	RewardReceiverStructs []privacy.PaymentAddress
	AutoStakingFlag       []bool
}

StakeInstruction : StakeInstruction Format: ["STAKE_ACTION", list_public_keys, chain or beacon, list_txs, list_reward_addresses, list_autostaking_status(boolean)]

func ImportInitStakeInstructionFromString

func ImportInitStakeInstructionFromString(instruction []string) *StakeInstruction

ImportStakeInstructionFromString is unsafe method

func ImportStakeInstructionFromString

func ImportStakeInstructionFromString(instruction []string) *StakeInstruction

ImportStakeInstructionFromString is unsafe method

func NewStakeInstruction

func NewStakeInstruction() *StakeInstruction

func NewStakeInstructionWithValue

func NewStakeInstructionWithValue(
	publicKeys []string, chain string,
	txStakes []string, rewardReceivers []string,
	autoStakingFlag []bool) *StakeInstruction

func ValidateAndImportStakeInstructionFromString

func ValidateAndImportStakeInstructionFromString(instruction []string) (*StakeInstruction, error)

func (*StakeInstruction) GetType

func (s *StakeInstruction) GetType() string

func (*StakeInstruction) IsEmpty

func (s *StakeInstruction) IsEmpty() bool

func (*StakeInstruction) SetAutoStakingFlag

func (s *StakeInstruction) SetAutoStakingFlag(autoStakingFlag []bool) *StakeInstruction

func (*StakeInstruction) SetChain

func (s *StakeInstruction) SetChain(chain string) *StakeInstruction

func (*StakeInstruction) SetPublicKeys

func (s *StakeInstruction) SetPublicKeys(publicKeys []string) (*StakeInstruction, error)

func (*StakeInstruction) SetRewardReceivers

func (s *StakeInstruction) SetRewardReceivers(rewardReceivers []string) *StakeInstruction

func (*StakeInstruction) SetTxStakes

func (s *StakeInstruction) SetTxStakes(txStakes []string) *StakeInstruction

func (*StakeInstruction) ToString

func (s *StakeInstruction) ToString() []string

type StopAutoStakeInstruction

type StopAutoStakeInstruction struct {
	CommitteePublicKeys       []string
	CommitteePublicKeysStruct []incognitokey.CommitteePublicKey
}

func ImportStopAutoStakeInstructionFromString

func ImportStopAutoStakeInstructionFromString(instruction []string) *StopAutoStakeInstruction

func NewStopAutoStakeInstruction

func NewStopAutoStakeInstruction() *StopAutoStakeInstruction

func NewStopAutoStakeInstructionWithValue

func NewStopAutoStakeInstructionWithValue(publicKeys []string) *StopAutoStakeInstruction

func ValidateAndImportStopAutoStakeInstructionFromString

func ValidateAndImportStopAutoStakeInstructionFromString(instruction []string) (*StopAutoStakeInstruction, error)

func (*StopAutoStakeInstruction) DeleteSingleElement

func (s *StopAutoStakeInstruction) DeleteSingleElement(index int)

func (*StopAutoStakeInstruction) GetType

func (s *StopAutoStakeInstruction) GetType() string

func (*StopAutoStakeInstruction) IsEmpty

func (s *StopAutoStakeInstruction) IsEmpty() bool

func (*StopAutoStakeInstruction) SetPublicKeys

func (s *StopAutoStakeInstruction) SetPublicKeys(publicKeys []string) (*StopAutoStakeInstruction, error)

func (*StopAutoStakeInstruction) ToString

func (s *StopAutoStakeInstruction) ToString() []string

type SwapInstruction

type SwapInstruction struct {
	InPublicKeys        []string
	InPublicKeyStructs  []incognitokey.CommitteePublicKey
	OutPublicKeys       []string
	OutPublicKeyStructs []incognitokey.CommitteePublicKey
	ChainID             int
	// old slashing, never used
	PunishedPublicKeys string
	// this field is only for replace committee
	NewRewardReceivers       []string
	NewRewardReceiverStructs []privacy.PaymentAddress
	IsReplace                bool
}

SwapInstruction : Swap instruction format: ["swap-action", list-keys-in, list-keys-out, shard or beacon chain, shard_id(optional), "punished public key", "new reward receivers"]

func ImportSwapInstructionFromString

func ImportSwapInstructionFromString(instruction []string) *SwapInstruction

func NewSwapInstruction

func NewSwapInstruction() *SwapInstruction

func NewSwapInstructionWithValue

func NewSwapInstructionWithValue(inPublicKeys []string, outPublicKeys []string, chainID int) *SwapInstruction

func ValidateAndImportSwapInstructionFromString

func ValidateAndImportSwapInstructionFromString(instruction []string) (*SwapInstruction, error)

func (*SwapInstruction) GetType

func (s *SwapInstruction) GetType() string

func (*SwapInstruction) IsEmpty

func (s *SwapInstruction) IsEmpty() bool

func (*SwapInstruction) SetChainID

func (s *SwapInstruction) SetChainID(chainID int) *SwapInstruction

func (*SwapInstruction) SetInPublicKeys

func (s *SwapInstruction) SetInPublicKeys(inPublicKeys []string) (*SwapInstruction, error)

func (*SwapInstruction) SetIsReplace

func (s *SwapInstruction) SetIsReplace(isReplace bool) *SwapInstruction

func (*SwapInstruction) SetNewRewardReceivers

func (s *SwapInstruction) SetNewRewardReceivers(newRewardReceivers []string) *SwapInstruction

func (*SwapInstruction) SetOutPublicKeys

func (s *SwapInstruction) SetOutPublicKeys(outPublicKeys []string) (*SwapInstruction, error)

func (*SwapInstruction) SetPunishedPublicKeys

func (s *SwapInstruction) SetPunishedPublicKeys(punishedPublicKeys string) *SwapInstruction

func (*SwapInstruction) ToString

func (s *SwapInstruction) ToString() []string

type SwapShardInstruction

type SwapShardInstruction struct {
	InPublicKeys        []string
	InPublicKeyStructs  []incognitokey.CommitteePublicKey
	OutPublicKeys       []string
	OutPublicKeyStructs []incognitokey.CommitteePublicKey
	ChainID             int // which shard
	Type                int // sub type of swap shard instruction
}

SwapShardInstruction Shard Swap Instruction

func ImportSwapShardInstructionFromString

func ImportSwapShardInstructionFromString(instruction []string) *SwapShardInstruction

func NewSwapShardInstruction

func NewSwapShardInstruction() *SwapShardInstruction

func NewSwapShardInstructionWithShardID

func NewSwapShardInstructionWithShardID(chainID int) *SwapShardInstruction

func NewSwapShardInstructionWithValue

func NewSwapShardInstructionWithValue(
	inPublicKeys, outPublicKeys []string,
	chainID, typeIns int) *SwapShardInstruction

func ValidateAndImportSwapShardInstructionFromString

func ValidateAndImportSwapShardInstructionFromString(instruction []string) (*SwapShardInstruction, error)

func (*SwapShardInstruction) GetType

func (s *SwapShardInstruction) GetType() string

func (*SwapShardInstruction) IsEmpty

func (s *SwapShardInstruction) IsEmpty() bool

func (*SwapShardInstruction) SetChainID

func (s *SwapShardInstruction) SetChainID(chainID int) *SwapShardInstruction

func (*SwapShardInstruction) SetInPublicKeys

func (s *SwapShardInstruction) SetInPublicKeys(inPublicKeys []string) (*SwapShardInstruction, error)

func (*SwapShardInstruction) SetOutPublicKeys

func (s *SwapShardInstruction) SetOutPublicKeys(outPublicKeys []string) (*SwapShardInstruction, error)

func (*SwapShardInstruction) SetType

func (s *SwapShardInstruction) SetType(typeIns int) *SwapShardInstruction

func (*SwapShardInstruction) ToString

func (s *SwapShardInstruction) ToString() []string

type UnstakeInstruction

type UnstakeInstruction struct {
	CommitteePublicKeys       []string
	CommitteePublicKeysStruct []incognitokey.CommitteePublicKey
}

UnstakeInstruction : Hold and verify data for unstake action

func ImportUnstakeInstructionFromString

func ImportUnstakeInstructionFromString(instruction []string) *UnstakeInstruction

ImportUnstakeInstructionFromString : Import unstake instruction from string

func NewUnstakeInstruction

func NewUnstakeInstruction() *UnstakeInstruction

NewUnstakeInstruction : Default constructor

func NewUnstakeInstructionWithValue

func NewUnstakeInstructionWithValue(committeePublicKeys []string) *UnstakeInstruction

NewUnstakeInstructionWithValue : Constructor with value

func ValidateAndImportUnstakeInstructionFromString

func ValidateAndImportUnstakeInstructionFromString(instruction []string) (*UnstakeInstruction, error)

ValidateAndImportUnstakeInstructionFromString : Validate and import unstake instruction from string

func (*UnstakeInstruction) DeleteSingleElement

func (unstakeIns *UnstakeInstruction) DeleteSingleElement(index int)

func (*UnstakeInstruction) GetType

func (unstakeIns *UnstakeInstruction) GetType() string

GetType : Get type of unstake instruction

func (*UnstakeInstruction) InsertIntoStateDB

func (unstakeIns *UnstakeInstruction) InsertIntoStateDB(sDB *statedb.StateDB) error

InsertIntoStateDB : insert unstake instruction to statedb

func (*UnstakeInstruction) IsEmpty

func (unstakeIns *UnstakeInstruction) IsEmpty() bool

func (*UnstakeInstruction) SetCommitteePublicKeys

func (unstakeInstruction *UnstakeInstruction) SetCommitteePublicKeys(publicKeys []string) error

func (*UnstakeInstruction) ToString

func (unstakeIns *UnstakeInstruction) ToString() []string

ToString : Convert class to string

type ViewEnvironment

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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