reseeding

package module
v0.0.0-...-4ade6c6 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: Apache-2.0 Imports: 32 Imported by: 0

README

Reseeding module

Implements reseeding logic for RandApp application.

How it works

  • Participants sends seeds to the module as a transaction using the MsgSeed message:
type MsgSeed struct {
	Sender sdk.AccAddress
	Seed   []byte
}
  • Module stores those messages until you get a polka (2/3 + 1) votes for a given seed. Then the seed will be transferred to the Tendermint Consensus by calling the EndBlock() function
  • Multiple seeds may be competing for a polka; as soon as one seed gets enough votes and gets transferred to Tendermint, all loser seeds are deleted.

Example of seed sending

./${YOUR_APP_CLI_BIN} tx reseeding send ${YOUR_SEED} --chain-id=${YOUR_CHAIN} --from ${ACCOUNT}

Note that there is a reseeder script implemented by corestar.io that implements a bitcoin last-block-hash based seed.

Documentation

Index

Constants

View Source
const (
	ModuleName = types.ModuleName
	StoreKey   = types.StoreKey
	RouterKey  = types.RouterKey
)
View Source
const (
	EventTypeNewCurrentSeed = "EventTypeNewCurrentSeed"
	EventTypeSeedSaved      = "EventTypeSeedSaved"
)

Variables

View Source
var (
	NewGenesisState     = types.NewGenesisState
	DefaultGenesisState = types.DefaultGenesisState
	ValidateGenesis     = types.ValidateGenesis
	RegisterCodec       = types.RegisterCodec
	NewKeeper           = keeper.NewKeeper
)

Functions

func BeginBlocker

func BeginBlocker(ctx sdk.Context, k keeper.Keeper)

BeginBlocker will persist the current header and validator set as a historical entry and prune the oldest entry based on the HistoricalEntries parameter

func EndBlocker

func EndBlocker(ctx sdk.Context, k keeper.Keeper) abci.ModuleEndBlock

Called every block, update validator set

func ExportGenesis

func ExportGenesis(ctx sdk.Context, k Keeper) types.GenesisState

ExportGenesis returns a GenesisState for a given context and keeper.

func GenericHandler

func GenericHandler(k Keeper, stakingKeeper staking.Keeper) sdk.Handler

GenericHandler routes the messages to the handlers

func HandleMsgSeed

func HandleMsgSeed(ctx sdk.Context, msg types.MsgSeed, k keeper.Keeper, stakingKeeper staking.Keeper) (*sdk.Result, error)

func InitGenesis

func InitGenesis(ctx sdk.Context, k Keeper, data types.GenesisState)

InitGenesis sets reseeding information for genesis.

func NewPubKey

func NewPubKey(pk string) (res crypto.PubKey)

func NewQuerier

func NewQuerier() sdk.Querier

Types

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

AppModule supply app module

func NewAppModule

func NewAppModule(keeper Keeper, stakingKeeper staking.Keeper) AppModule

NewAppModule creates a new AppModule object

func (AppModule) BeginBlock

func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock)

BeginBlock module begin-block

func (AppModule) EndBlock

EndBlock module end-block

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage

ExportGenesis module export genesis

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate

InitGenesis module init-genesis

func (AppModule) Name

func (AppModule) Name() string

Name defines module name

func (AppModule) NewHandler

func (am AppModule) NewHandler() sdk.Handler

NewHandler module handler

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

NewQuerierHandler module querier

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

QuerierRoute module querier route name

func (AppModule) RegisterInvariants

func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)

RegisterInvariants registers the reseeding module invariants

func (AppModule) Route

func (AppModule) Route() string

Route module message route name

type AppModuleBasic

type AppModuleBasic struct{}

AppModuleBasic app module basics object

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis() json.RawMessage

DefaultGenesis default genesis state

func (AppModuleBasic) GetQueryCmd

func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command

GetQueryCmd gets the root query command of this module

func (AppModuleBasic) GetTxCmd

func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command

GetTxCmd gets the root tx command of this module

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

Name defines module name

func (AppModuleBasic) RegisterCodec

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

RegisterCodec registers module codec

func (AppModuleBasic) RegisterRESTRoutes

func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)

RegisterRESTRoutes registers rest routes

func (AppModuleBasic) ValidateGenesis

func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error

ValidateGenesis module validate genesis

type Keeper

type Keeper = keeper.Keeper

type MsgSeed

type MsgSeed = types.MsgSeed

Directories

Path Synopsis
client
cli
internal

Jump to

Keyboard shortcuts

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