types

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = ModuleName

	CodePublicKeyDecode      sdk.CodeType = 101
	CodeProtocolVersionParse sdk.CodeType = 102
	CodeTomlParse            sdk.CodeType = 103
	CodeInvalidValidator     sdk.CodeType = 201
	CodeInvalidDelegation    sdk.CodeType = 202
	CodeInvalidInput         sdk.CodeType = 203
	CodeInvalidAddress       sdk.CodeType = sdk.CodeInvalidAddress
)
View Source
const (
	// ModuleName uses for schema name in key-value store
	ModuleName = "executionlayer"

	// StoreKey sets schema name from ModuleName
	HashMapStoreKey = ModuleName + "_hashmap"

	// key value
	GenesisBlockHashKey = "genesisblockhash"
	GenesisConfigKey    = "genesisconf"
	GenesisAccountKey   = "genesisaccount"
	CandidateBlockKey   = "candidateblock"
)
View Source
const (
	// TODO: Why can't we just have one string description which can be JSON by convention
	MaxMonikerLength  = 70
	MaxIdentityLength = 3000
	MaxWebsiteLength  = 140
	MaxDetailsLength  = 280
)

nolint

View Source
const DoNotModifyDesc = "[do-not-modify]"

constant used in flags to indicate that description field should not be updated

View Source
const RouterKey = ModuleName

RouterKey is not in sense yet

Variables

View Source
var (
	EEStateKey   = []byte{0x11}
	ValidatorKey = []byte{0x21}
)
View Source
var (
	// DefaultMintWasm : DO NOT EDIT. https://github.com/CasperLabs/CasperLabs/tree/v0.9.0/execution-engine/contracts/system/mint-install
	DefaultMintWasm = []byte{}/* 871455 elements not displayed */

	// DefaultPosWasm : DO NOT EDIT. https://github.com/CasperLabs/CasperLabs/tree/v0.9.0/execution-engine/contracts/system/pos-install
	DefaultPosWasm = []byte{}/* 963359 elements not displayed */

)
View Source
var ModuleCdc *codec.Codec

ModuleCdc is used as a codec in types package

Functions

func ErrBadDelegationAddr added in v0.3.0

func ErrBadDelegationAddr(codespace sdk.CodespaceType) sdk.Error

func ErrBadDelegationAmount added in v0.3.0

func ErrBadDelegationAmount(codespace sdk.CodespaceType) sdk.Error

func ErrBadValidatorAddr added in v0.3.0

func ErrBadValidatorAddr(codespace sdk.CodespaceType) sdk.Error

func ErrDescriptionLength added in v0.3.0

func ErrDescriptionLength(codespace sdk.CodespaceType, descriptor string, got, max int) sdk.Error

func ErrNilDelegatorAddr added in v0.3.0

func ErrNilDelegatorAddr(codespace sdk.CodespaceType) sdk.Error

func ErrNilValidatorAddr added in v0.3.0

func ErrNilValidatorAddr(codespace sdk.CodespaceType) sdk.Error

func ErrProtocolVersionParse

func ErrProtocolVersionParse(codespace sdk.CodespaceType, protocolVersion string) sdk.Error

ErrProtocolVersionParse is an error

func ErrPublicKeyDecode

func ErrPublicKeyDecode(codespace sdk.CodespaceType, publicKey string) sdk.Error

ErrPublicKeyDecode is an error

func ErrTomlParse added in v0.2.0

func ErrTomlParse(codespace sdk.CodespaceType, keyString string) sdk.Error

ErrTomlParse is an error

func GetEEStateKey added in v0.3.0

func GetEEStateKey(eeState []byte) []byte

func GetValidatorKey added in v0.3.0

func GetValidatorKey(operatorAddr sdk.ValAddress) []byte

func MustMarshalValidator added in v0.3.0

func MustMarshalValidator(cdc *codec.Codec, validator Validator) []byte

return the redelegation

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the Amino codec

func ToChainSpecGenesisConfig

func ToChainSpecGenesisConfig(gs GenesisState) (*ipc.ChainSpec_GenesisConfig, error)

func ToProtocolVersion added in v0.3.0

func ToProtocolVersion(pvString string) (*state.ProtocolVersion, error)

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis :

Types

type Account

type Account struct {
	// PublicKey : base64 encoded public key string
	PublicKey           PublicKey `json:"public_key"`
	InitialBalance      string    `json:"initial_balance"`
	InitialBondedAmount string    `json:"initial_bonded_amount"`
}

Account : Genesis Account Information.

type CandidateBlock added in v0.3.0

type CandidateBlock struct {
	Hash  []byte      `json:"hash"`
	Bonds []*ipc.Bond `json:"bonds"`
}

type Description added in v0.3.0

type Description struct {
	Moniker  string `json:"moniker" yaml:"moniker"`   // name
	Identity string `json:"identity" yaml:"identity"` // optional identity signature (ex. UPort or Keybase)
	Website  string `json:"website" yaml:"website"`   // optional website link
	Details  string `json:"details" yaml:"details"`   // optional details
}

Description - description fields for a validator

func NewDescription added in v0.3.0

func NewDescription(moniker, identity, website, details string) Description

NewDescription returns a new Description with the provided values.

func (Description) EnsureLength added in v0.3.0

func (d Description) EnsureLength() (Description, sdk.Error)

EnsureLength ensures the length of a validator's description.

func (Description) UpdateDescription added in v0.3.0

func (d Description) UpdateDescription(d2 Description) (Description, sdk.Error)

UpdateDescription updates the fields of a given description. An error is returned if the resulting description contains an invalid length.

type Genesis

type Genesis struct {
	Timestamp       uint64 `json:"timestamp"`
	MintWasm        []byte `json:"mint_wasm"`
	PosWasm         []byte `json:"pos_wasm"`
	ProtocolVersion string `json:"protocol_version"`
}

Genesis : Chain Genesis information

type GenesisConf

type GenesisConf struct {
	Genesis   Genesis   `json:"genesis"`
	WasmCosts WasmCosts `json:"wasm_costs"`
}

GenesisConf : the executionlayer configuration that must be provided at genesis.

type GenesisState

type GenesisState struct {
	GenesisConf GenesisConf `json:"genesis_conf"`
	Accounts    []Account   `json:"accounts"`
	ChainName   string      `json:"chain_name"`
}

GenesisState : the executionlayer state that must be provided at genesis.

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns a default genesis state

func NewGenesisState

func NewGenesisState(genesisConf GenesisConf, accounts []Account, chainName string) GenesisState

NewGenesisState creates a new genesis state.

type MsgBond added in v0.3.0

type MsgBond struct {
	FromAddress sdk.AccAddress `json:"from_address"`
	ValAddress  sdk.ValAddress `json:"val_address"`
	SessionCode []byte         `json:"session_code"`
	SessionArgs []byte         `json:"session_args"`
	PaymentCode []byte         `json:"payment_code"`
	PaymentArgs []byte         `json:"payment_args"`
	GasPrice    uint64         `json:"gas_price"`
}

______________________________________________________________________

func NewMsgBond added in v0.3.0

func NewMsgBond(
	fromAddress sdk.AccAddress, valAddress sdk.ValAddress,
	sessionCode []byte, sessionArgs []byte,
	paymentCode []byte, paymentArgs []byte,
	gasPrice uint64,
) MsgBond

NewMsgBond is a constructor function for MsgSetName

func (MsgBond) GetSignBytes added in v0.3.0

func (msg MsgBond) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgBond) GetSigners added in v0.3.0

func (msg MsgBond) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgBond) Route added in v0.3.0

func (msg MsgBond) Route() string

Route should return the name of the module

func (MsgBond) Type added in v0.3.0

func (msg MsgBond) Type() string

Type should return the action

func (MsgBond) ValidateBasic added in v0.3.0

func (msg MsgBond) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgCreateValidator added in v0.3.0

type MsgCreateValidator struct {
	Description      Description    `json:"description" yaml:"description"`
	DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
	ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
	PubKey           crypto.PubKey  `json:"pubkey" yaml:"pubkey"`
}

______________________________________________________________________ MsgCreateValidator - struct for bonding transactions

func NewMsgCreateValidator added in v0.3.0

func NewMsgCreateValidator(
	valAddr sdk.ValAddress, pubKey crypto.PubKey,
	description Description,
) MsgCreateValidator

Default way to create validator. Delegator address and validator address are the same

func (MsgCreateValidator) GetSignBytes added in v0.3.0

func (msg MsgCreateValidator) GetSignBytes() []byte

GetSignBytes returns the message bytes to sign over.

func (MsgCreateValidator) GetSigners added in v0.3.0

func (msg MsgCreateValidator) GetSigners() []sdk.AccAddress

Return address(es) that must sign over msg.GetSignBytes()

func (MsgCreateValidator) MarshalJSON added in v0.3.0

func (msg MsgCreateValidator) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface to provide custom JSON serialization of the MsgCreateValidator type.

func (MsgCreateValidator) Route added in v0.3.0

func (msg MsgCreateValidator) Route() string

nolint

func (MsgCreateValidator) Type added in v0.3.0

func (msg MsgCreateValidator) Type() string

func (*MsgCreateValidator) UnmarshalJSON added in v0.3.0

func (msg *MsgCreateValidator) UnmarshalJSON(bz []byte) error

UnmarshalJSON implements the json.Unmarshaler interface to provide custom JSON deserialization of the MsgCreateValidator type.

func (MsgCreateValidator) ValidateBasic added in v0.3.0

func (msg MsgCreateValidator) ValidateBasic() sdk.Error

quick validity check

type MsgExecute

type MsgExecute struct {
	BlockHash            []byte         `json:"block_hash"`
	ExecAccount          sdk.AccAddress `json:"exec_account"`
	ContractOwnerAccount sdk.AccAddress `json:"contract_owner_account"`
	SessionCode          []byte         `json:"session_code"`
	SessionArgs          []byte         `json:"session_args"`
	PaymentCode          []byte         `json:"payment_code"`
	PaymentArgs          []byte         `json:"payment_args"`
	GasPrice             uint64         `json:"gas_price"`
}

MsgExecute for sending deploy to execution engine

func NewMsgExecute

func NewMsgExecute(
	blockHash []byte,
	execAccount sdk.AccAddress, contractOwnerAccount sdk.AccAddress,
	sessionCode []byte, sessionArgs []byte,
	paymentCode []byte, paymentArgs []byte,
	gasPrice uint64,
) MsgExecute

NewMsgExecute is a constructor function for MsgSetName

func (MsgExecute) GetSignBytes

func (msg MsgExecute) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgExecute) GetSigners

func (msg MsgExecute) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgExecute) Route

func (msg MsgExecute) Route() string

Route should return the name of the module

func (MsgExecute) Type

func (msg MsgExecute) Type() string

Type should return the action

func (MsgExecute) ValidateBasic

func (msg MsgExecute) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgTransfer added in v0.3.0

type MsgTransfer struct {
	TokenOwnerAccount sdk.AccAddress `json:"token_owner_account"`
	FromAccount       sdk.AccAddress `json:"from_account"`
	ToAccount         sdk.AccAddress `json:"to_account"`
	TransferCode      []byte         `json:"transfer_code"`
	TransferArgs      []byte         `json:"transfer_args"`
	PaymentCode       []byte         `json:"payment_code"`
	PaymentArgs       []byte         `json:"payment_args"`
	GasPrice          uint64         `json:"gas_price"`
}

MsgTransfer for sending deploy to execution engine

func NewMsgTransfer added in v0.3.0

func NewMsgTransfer(
	tokenOwnerAccount sdk.AccAddress,
	fromAccount, toAccount sdk.AccAddress,
	transferCode, transferArgs, paymentCode, paymentArgs []byte,
	gasPrice uint64,
) MsgTransfer

NewMsgTransfer is a constructor function for MsgSetName

func (MsgTransfer) GetSignBytes added in v0.3.0

func (msg MsgTransfer) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgTransfer) GetSigners added in v0.3.0

func (msg MsgTransfer) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgTransfer) Route added in v0.3.0

func (msg MsgTransfer) Route() string

Route should return the name of the module

func (MsgTransfer) Type added in v0.3.0

func (msg MsgTransfer) Type() string

Type should return the action

func (MsgTransfer) ValidateBasic added in v0.3.0

func (msg MsgTransfer) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgUnBond added in v0.3.0

type MsgUnBond struct {
	FromAddress sdk.AccAddress `json:"from_address"`
	ValAddress  sdk.ValAddress `json:"val_address"`
	SessionCode []byte         `json:"session_code"`
	SessionArgs []byte         `json:"session_args"`
	PaymentCode []byte         `json:"payment_code"`
	PaymentArgs []byte         `json:"payment_args"`
	GasPrice    uint64         `json:"gas_price"`
}

______________________________________________________________________

func NewMsgUnBond added in v0.3.0

func NewMsgUnBond(
	fromAddress sdk.AccAddress, valAddress sdk.ValAddress,
	sessionCode []byte, sessionArgs []byte,
	paymentCode []byte, paymentArgs []byte,
	gasPrice uint64,
) MsgUnBond

NewMsgBond is a constructor function for MsgSetName

func (MsgUnBond) GetSignBytes added in v0.3.0

func (msg MsgUnBond) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgUnBond) GetSigners added in v0.3.0

func (msg MsgUnBond) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgUnBond) Route added in v0.3.0

func (msg MsgUnBond) Route() string

Route should return the name of the module

func (MsgUnBond) Type added in v0.3.0

func (msg MsgUnBond) Type() string

Type should return the action

func (MsgUnBond) ValidateBasic added in v0.3.0

func (msg MsgUnBond) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type PublicKey

type PublicKey []byte

PublicKey for Execution Engines

func NewPublicKey

func NewPublicKey(base64PublicKey string) (*PublicKey, error)

NewPublicKey is constructor for PublicKey, accepts base64 encoded public key string and returns PublicKey

func ToPublicKey

func ToPublicKey(addr sdk.Address) PublicKey

ToPublicKey convert sdk.Address(AccAddress, ValAddress...) to PublicKey appending null padding. we currently use sdk.Address as public key for PoC. This should be removed later.

type QueryExecutionLayer

type QueryExecutionLayer struct {
	KeyType string `json:"key_type"`
	KeyData string `json:"key_data"`
	Path    string `json:"path"`
}

QueryExecutionLayer payload for a EE query

func (QueryExecutionLayer) String

func (q QueryExecutionLayer) String() string

implement fmt.Stringer

type QueryExecutionLayerDetail

type QueryExecutionLayerDetail struct {
	StateHash []byte `json:"state_hash"`
	KeyType   string `json:"key_type"`
	KeyData   string `json:"key_data"`
	Path      string `json:"path"`
}

QueryExecutionLayerDetail payload for a EE query

func (QueryExecutionLayerDetail) String

func (q QueryExecutionLayerDetail) String() string

implement fmt.Stringer

type QueryExecutionLayerResp

type QueryExecutionLayerResp struct {
	Value string `json:"value"`
}

QueryExecutionLayerResp is used for response of EE query

func (QueryExecutionLayerResp) String

func (q QueryExecutionLayerResp) String() string

implement fmt.Stringer

type QueryGetBalance

type QueryGetBalance struct {
	Address PublicKey
}

QueryGetBalance payload for balance query in the latest data

func (QueryGetBalance) String

func (q QueryGetBalance) String() string

implement fmt.Stringer

type QueryGetBalanceDetail

type QueryGetBalanceDetail struct {
	StateHash []byte
	Address   PublicKey
}

QueryGetBalanceDetail payload for balance query

func (QueryGetBalanceDetail) String

func (q QueryGetBalanceDetail) String() string

implement fmt.Stringer

type UnitHashMap

type UnitHashMap struct {
	EEState []byte `json:"ee_state"`
}

UnitHashMap used to define Unit account structure

func NewUnitHashMap

func NewUnitHashMap() UnitHashMap

NewUnitHashMap returns a new UnitAccount

func (UnitHashMap) String

func (u UnitHashMap) String() string

implement fmt.Stringer

type Validator added in v0.3.0

type Validator struct {
	OperatorAddress sdk.ValAddress `json:"operator_address" yaml:"operator_address"` // address of the validator's operator; bech encoded in JSON
	ConsPubKey      crypto.PubKey  `json:"consensus_pubkey" yaml:"consensus_pubkey"` // the consensus public key of the validator; bech encoded in JSON
	Description     Description    `json:"description" yaml:"description"`           // description terms for the validator
	Stake           string         `json:"stake" yaml: "stake"`
}

Validator - save a validater information

func MustUnmarshalValidator added in v0.3.0

func MustUnmarshalValidator(cdc *codec.Codec, value []byte) Validator

unmarshal a redelegation from a store value

func NewValidator added in v0.3.0

func NewValidator(operator sdk.ValAddress, pubKey crypto.PubKey, description Description, stake string) Validator

NewValidator - initialize a new validator

func UnmarshalValidator added in v0.3.0

func UnmarshalValidator(cdc *codec.Codec, value []byte) (validator Validator, err error)

unmarshal a redelegation from a store value

func (Validator) ConsAddress added in v0.3.0

func (v Validator) ConsAddress() sdk.ConsAddress

return the TM validator address

func (Validator) MarshalJSON added in v0.3.0

func (v Validator) MarshalJSON() ([]byte, error)

MarshalJSON marshals the validator to JSON using Bech32

func (Validator) String added in v0.3.0

func (v Validator) String() string

String returns a human readable string representation of a validator.

func (Validator) TestEquivalent added in v0.3.0

func (v Validator) TestEquivalent(v2 Validator) bool

only the vitals

func (*Validator) UnmarshalJSON added in v0.3.0

func (v *Validator) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the validator from JSON using Bech32

type WasmCosts

type WasmCosts struct {
	Regular           uint32 `json:"regular" toml:"regular"`
	DivMultiplier     uint32 `json:"div_multiplier" toml:"div-multiplier"`
	MulMultiplier     uint32 `json:"mul_multiplier" toml:"mul-multiplier"`
	MemMultiplier     uint32 `json:"mem_multiplier" toml:"mem-multiplier"`
	MemInitialPages   uint32 `json:"mem_initial_pages" toml:"mem-initial-pages"`
	MemGrowPerPage    uint32 `json:"mem_grow_per_page" toml:"mem-grow-per-page"`
	MemCopyPerByte    uint32 `json:"mem_copy_per_byte" toml:"mem-copy-per-byte"`
	MaxStackHeight    uint32 `json:"max_stack_height" toml:"max-stack-height"`
	OpcodesMultiplier uint32 `json:"opcodes_multiplier" toml:"opcodes-multiplier"`
	OpcodesDivisor    uint32 `json:"opcodes_divisor" toml:"opcodes-divisor"`
}

WasmCosts : CasperLabs EE Wasm Cost table

Jump to

Keyboard shortcuts

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