validators

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2019 License: Apache-2.0 Imports: 11 Imported by: 16

Documentation

Overview

Package validators is a generated protocol buffer package.

It is generated from these files:

x/validators/codec.proto

It has these top-level messages:

ValidatorUpdate
Pubkey
SetValidatorsMsg
Accounts

Index

Constants

View Source
const (
	CodeEmptyDiff uint32 = 40
	CodeWrongType        = 41
)

ABCI Response Codes x/update_validators reserves 40 ~ 49.

View Source
const (
	// BucketName contains address that are allowed to update validators
	BucketName = "uvalid"
	// Key is used to store account data
	Key = "accounts"
)

Variables

View Source
var (
	ErrInvalidLengthCodec = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCodec   = fmt.Errorf("proto: integer overflow")
)

Functions

func AccountsWith

func AccountsWith(acct WeaveAccounts) orm.Object

func ErrEmptyDiff

func ErrEmptyDiff() error

func ErrWrongType

func ErrWrongType(t interface{}) error

func HasPermission

func HasPermission(accts WeaveAccounts, checkAddress CheckAddress) bool

func NewAccounts

func NewAccounts() orm.Object

NewWallet creates an empty wallet with this address serves as an object for the bucket

func NewBucket

func NewBucket() orm.Bucket

func RegisterQuery

func RegisterQuery(qr weave.QueryRouter)

RegisterQuery will register this bucket as "/validators"

func RegisterRoutes

func RegisterRoutes(r weave.Registry, auth x.Authenticator,
	control Controller)

RegisterRoutes will instantiate and register all handlers in this package

Types

type Accounts

type Accounts struct {
	Addresses [][]byte `protobuf:"bytes,1,rep,name=addresses" json:"addresses,omitempty"`
}

Accounts is a list of accounts allowed to update validators

func AsAccounts

func AsAccounts(a WeaveAccounts) *Accounts

func GetAccounts

func GetAccounts(bucket orm.Bucket, kv weave.KVStore) (*Accounts, error)

func (*Accounts) Copy

func (m *Accounts) Copy() orm.CloneableData

Copy makes new accounts object with the same addresses

func (*Accounts) Descriptor

func (*Accounts) Descriptor() ([]byte, []int)

func (*Accounts) GetAddresses

func (m *Accounts) GetAddresses() [][]byte

func (*Accounts) Marshal

func (m *Accounts) Marshal() (dAtA []byte, err error)

func (*Accounts) MarshalTo

func (m *Accounts) MarshalTo(dAtA []byte) (int, error)

func (*Accounts) ProtoMessage

func (*Accounts) ProtoMessage()

func (*Accounts) Reset

func (m *Accounts) Reset()

func (*Accounts) Size

func (m *Accounts) Size() (n int)

func (*Accounts) String

func (m *Accounts) String() string

func (*Accounts) Unmarshal

func (m *Accounts) Unmarshal(dAtA []byte) error

func (*Accounts) Validate

func (m *Accounts) Validate() error

type AuthCheckAddress

type AuthCheckAddress = func(auth x.Authenticator, ctx weave.Context) CheckAddress

type BaseController

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

BaseController is a simple implementation of controller wallet must return something that supports AsSet

func NewController

func NewController() BaseController

NewController returns a basic controller implementation

func (BaseController) CanUpdateValidators

func (c BaseController) CanUpdateValidators(store weave.KVStore, checkAddress CheckAddress, diff []abci.ValidatorUpdate) ([]abci.ValidatorUpdate, error)

type CheckAddress

type CheckAddress func(address weave.Address) bool

type Controller

type Controller interface {
	CanUpdateValidators(store weave.KVStore, checkAddress CheckAddress, diff []abci.ValidatorUpdate) ([]abci.ValidatorUpdate, error)
}

Controller is the functionality needed by cash.Handler and cash.Decorator. BaseController should work plenty fine, but you can add other logic if so desired

type Initializer

type Initializer struct{}

Initializer fulfils the InitStater interface to load data from the genesis file

func (Initializer) FromGenesis

func (Initializer) FromGenesis(opts weave.Options, kv weave.KVStore) error

FromGenesis will parse initial account info from genesis and save it to the database

type Pubkey added in v0.9.0

type Pubkey struct {
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
}

func (Pubkey) AsABCI added in v0.9.0

func (m Pubkey) AsABCI() abci.PubKey

func (*Pubkey) Descriptor added in v0.9.0

func (*Pubkey) Descriptor() ([]byte, []int)

func (*Pubkey) GetData added in v0.9.0

func (m *Pubkey) GetData() []byte

func (*Pubkey) GetType added in v0.9.0

func (m *Pubkey) GetType() string

func (*Pubkey) Marshal added in v0.9.0

func (m *Pubkey) Marshal() (dAtA []byte, err error)

func (*Pubkey) MarshalTo added in v0.9.0

func (m *Pubkey) MarshalTo(dAtA []byte) (int, error)

func (*Pubkey) ProtoMessage added in v0.9.0

func (*Pubkey) ProtoMessage()

func (*Pubkey) Reset added in v0.9.0

func (m *Pubkey) Reset()

func (*Pubkey) Size added in v0.9.0

func (m *Pubkey) Size() (n int)

func (*Pubkey) String added in v0.9.0

func (m *Pubkey) String() string

func (*Pubkey) Unmarshal added in v0.9.0

func (m *Pubkey) Unmarshal(dAtA []byte) error

type SetValidatorsMsg added in v0.8.0

type SetValidatorsMsg struct {
	ValidatorUpdates []*ValidatorUpdate `protobuf:"bytes,1,rep,name=validator_updates,json=validatorUpdates" json:"validator_updates,omitempty"`
}

This message is designed to update validator power

func (*SetValidatorsMsg) AsABCI added in v0.8.0

func (m *SetValidatorsMsg) AsABCI() []abci.ValidatorUpdate

func (*SetValidatorsMsg) Descriptor added in v0.8.0

func (*SetValidatorsMsg) Descriptor() ([]byte, []int)

func (*SetValidatorsMsg) GetValidatorUpdates added in v0.9.0

func (m *SetValidatorsMsg) GetValidatorUpdates() []*ValidatorUpdate

func (*SetValidatorsMsg) Marshal added in v0.8.0

func (m *SetValidatorsMsg) Marshal() (dAtA []byte, err error)

func (*SetValidatorsMsg) MarshalTo added in v0.8.0

func (m *SetValidatorsMsg) MarshalTo(dAtA []byte) (int, error)

func (*SetValidatorsMsg) Path added in v0.8.0

func (*SetValidatorsMsg) Path() string

Path returns the routing path for this message

func (*SetValidatorsMsg) ProtoMessage added in v0.8.0

func (*SetValidatorsMsg) ProtoMessage()

func (*SetValidatorsMsg) Reset added in v0.8.0

func (m *SetValidatorsMsg) Reset()

func (*SetValidatorsMsg) Size added in v0.8.0

func (m *SetValidatorsMsg) Size() (n int)

func (*SetValidatorsMsg) String added in v0.8.0

func (m *SetValidatorsMsg) String() string

func (*SetValidatorsMsg) Unmarshal added in v0.8.0

func (m *SetValidatorsMsg) Unmarshal(dAtA []byte) error

type UpdateHandler

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

UpdateHandler will handle sending coins

func NewUpdateHandler

func NewUpdateHandler(auth x.Authenticator, control Controller, checkAddr AuthCheckAddress) UpdateHandler

NewUpdateHandler creates a handler for SendMsg

func (UpdateHandler) Check

func (h UpdateHandler) Check(ctx weave.Context, store weave.KVStore,
	tx weave.Tx) (weave.CheckResult, error)

Check verifies all the preconditions

func (UpdateHandler) Deliver

func (h UpdateHandler) Deliver(ctx weave.Context, store weave.KVStore,
	tx weave.Tx) (weave.DeliverResult, error)

Deliver provides the diff given everything is okay with permissions and such Check did the same job already, so we can assume stuff goes okay

type ValidatorUpdate added in v0.9.0

type ValidatorUpdate struct {
	Pubkey Pubkey `protobuf:"bytes,1,opt,name=pubkey" json:"pubkey"`
	Power  int64  `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"`
}

ValidatorUpdate

func (ValidatorUpdate) AsABCI added in v0.9.0

func (*ValidatorUpdate) Descriptor added in v0.9.0

func (*ValidatorUpdate) Descriptor() ([]byte, []int)

func (*ValidatorUpdate) GetPower added in v0.9.0

func (m *ValidatorUpdate) GetPower() int64

func (*ValidatorUpdate) GetPubkey added in v0.9.0

func (m *ValidatorUpdate) GetPubkey() Pubkey

func (*ValidatorUpdate) Marshal added in v0.9.0

func (m *ValidatorUpdate) Marshal() (dAtA []byte, err error)

func (*ValidatorUpdate) MarshalTo added in v0.9.0

func (m *ValidatorUpdate) MarshalTo(dAtA []byte) (int, error)

func (*ValidatorUpdate) ProtoMessage added in v0.9.0

func (*ValidatorUpdate) ProtoMessage()

func (*ValidatorUpdate) Reset added in v0.9.0

func (m *ValidatorUpdate) Reset()

func (*ValidatorUpdate) Size added in v0.9.0

func (m *ValidatorUpdate) Size() (n int)

func (*ValidatorUpdate) String added in v0.9.0

func (m *ValidatorUpdate) String() string

func (*ValidatorUpdate) Unmarshal added in v0.9.0

func (m *ValidatorUpdate) Unmarshal(dAtA []byte) error

type WeaveAccounts

type WeaveAccounts struct {
	Addresses []weave.Address `json:"addresses"`
}

WeaveAccounts is used to parse the json from genesis file use weave.Address, so address in hex, not base64

func AsWeaveAccounts

func AsWeaveAccounts(a *Accounts) WeaveAccounts

func (WeaveAccounts) Validate

func (wa WeaveAccounts) Validate() error

Jump to

Keyboard shortcuts

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