Documentation ¶
Overview ¶
Package gnoland contains the bootstrapping code to launch a gno.land node.
Index ¶
- Constants
- Variables
- func EndBlocker(collector *collector[validatorUpdate], vmk vm.VMKeeperI, app endBlockerApp) func(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
- func LoadPackage(pkg gnomod.Pkg, creator bft.Address, fee std.Fee, deposit std.Coins) (std.Tx, error)
- func NewApp(dataRootDir string, skipFailingGenesisTxs bool, evsw events.EventSwitch, ...) (abci.Application, error)
- func NewAppWithOptions(cfg *AppOptions) (abci.Application, error)
- func NewDefaultGenesisConfig(chainid string) *bft.GenesisDoc
- func NewDefaultTMConfig(rootdir string) *tmcfg.Config
- func NewInMemoryNode(logger *slog.Logger, cfg *InMemoryNodeConfig) (*node.Node, error)
- func NewMockedPrivValidator() bft.PrivValidator
- func NoopGenesisTxResultHandler(_ sdk.Context, _ std.Tx, _ sdk.Result)
- func PanicOnFailingTxResultHandler(_ sdk.Context, _ std.Tx, res sdk.Result)
- func ProtoGnoAccount() std.Account
- type AppOptions
- type Balance
- type Balances
- func (bs Balances) Get(address crypto.Address) (balance Balance, ok bool)
- func (bs Balances) LeftMerge(from Balances)
- func (bs Balances) List() []Balance
- func (bs Balances) LoadFromEntries(entries ...string) error
- func (bs Balances) LoadFromSheet(sheet io.Reader) error
- func (bs Balances) Set(address crypto.Address, amount std.Coins)
- type GenesisTxResultHandler
- type GnoAccount
- type GnoGenesisState
- type GnoTxMetadata
- type InMemoryNodeConfig
- type InitChainerConfig
- type Param
- type TxWithMetadata
Constants ¶
const ( ParamKindString = "string" ParamKindInt64 = "int64" ParamKindUint64 = "uint64" ParamKindBool = "bool" ParamKindBytes = "bytes" )
Variables ¶
var ( ErrBalanceEmptyAddress = errors.New("balance address is empty") ErrBalanceEmptyAmount = errors.New("balance amount is empty") )
var Package = amino.RegisterPackage(amino.NewPackage( "github.com/gnolang/gno/gno.land/pkg/gnoland", "gno", amino.GetCallersDirname(), ).WithDependencies().WithTypes( &GnoAccount{}, "Account", GnoGenesisState{}, "GenesisState", TxWithMetadata{}, "TxWithMetadata", GnoTxMetadata{}, "GnoTxMetadata", ))
Functions ¶
func EndBlocker ¶
func EndBlocker( collector *collector[validatorUpdate], vmk vm.VMKeeperI, app endBlockerApp, ) func( ctx sdk.Context, req abci.RequestEndBlock, ) abci.ResponseEndBlock
EndBlocker defines the logic executed after every block. Currently, it parses events that happened during execution to calculate validator set changes
func LoadPackage ¶
func LoadPackage(pkg gnomod.Pkg, creator bft.Address, fee std.Fee, deposit std.Coins) (std.Tx, error)
LoadPackage loads a single package into a `std.Tx`
func NewApp ¶
func NewApp( dataRootDir string, skipFailingGenesisTxs bool, evsw events.EventSwitch, logger *slog.Logger, ) (abci.Application, error)
NewApp creates the gno.land application.
func NewAppWithOptions ¶
func NewAppWithOptions(cfg *AppOptions) (abci.Application, error)
NewAppWithOptions creates the gno.land application with specified options.
func NewDefaultGenesisConfig ¶
func NewDefaultGenesisConfig(chainid string) *bft.GenesisDoc
NewDefaultGenesisConfig creates a default configuration for an in-memory node.
func NewDefaultTMConfig ¶
func NewInMemoryNode ¶
NewInMemoryNode creates an in-memory gnoland node. In this mode, the node does not persist any data and uses an in-memory database. The `InMemoryNodeConfig.TMConfig.RootDir` should point to the correct gno repository to load the stdlibs.
func NewMockedPrivValidator ¶
func NewMockedPrivValidator() bft.PrivValidator
NewMockedPrivValidator generate a new key
func NoopGenesisTxResultHandler ¶
NoopGenesisTxResultHandler is a no-op GenesisTxResultHandler.
func PanicOnFailingTxResultHandler ¶
PanicOnFailingTxResultHandler handles genesis transactions by panicking if res.IsErr() returns true.
func ProtoGnoAccount ¶
Types ¶
type AppOptions ¶
type AppOptions struct { DB dbm.DB // required Logger *slog.Logger // required EventSwitch events.EventSwitch // required VMOutput io.Writer // optional InitChainerConfig // options related to InitChainer }
AppOptions contains the options to create the gno.land ABCI application.
func TestAppOptions ¶
func TestAppOptions(db dbm.DB) *AppOptions
TestAppOptions provides a "ready" default AppOptions for use with NewAppWithOptions, using the provided db.
type Balance ¶
func LoadGenesisBalancesFile ¶
LoadGenesisBalancesFile loads genesis balances from the provided file path.
func (Balance) MarshalAmino ¶
func (*Balance) UnmarshalAmino ¶
type Balances ¶
func GetBalancesFromEntries ¶
func NewBalances ¶
func NewBalances() Balances
func (Balances) LoadFromEntries ¶
LoadFromEntries extracts the balance entries in the form of <address>=<amount>
func (Balances) LoadFromSheet ¶
LoadFromSheet extracts the balance sheet from the passed in balance sheet file, that has the format of <address>=<amount>ugnot
type GenesisTxResultHandler ¶
GenesisTxResultHandler is called in the InitChainer after a genesis transaction is executed.
type GnoAccount ¶
type GnoAccount struct {
std.BaseAccount
}
type GnoGenesisState ¶
type GnoGenesisState struct { Balances []Balance `json:"balances"` Txs []TxWithMetadata `json:"txs"` Params []Param `json:"params"` }
type GnoTxMetadata ¶
type GnoTxMetadata struct {
Timestamp int64 `json:"timestamp"`
}
type InMemoryNodeConfig ¶
type InMemoryNodeConfig struct { PrivValidator bft.PrivValidator // identity of the validator Genesis *bft.GenesisDoc TMConfig *tmcfg.Config DB *memdb.MemDB // will be initialized if nil VMOutput io.Writer // optional // If StdlibDir not set, then it's filepath.Join(TMConfig.RootDir, "gnovm", "stdlibs") InitChainerConfig }
type InitChainerConfig ¶
type InitChainerConfig struct { // Handles the results of each genesis transaction. GenesisTxResultHandler // Standard library directory. StdlibDir string // Whether to keep a record of the DB operations to load standard libraries, // so they can be quickly replicated on additional genesis executions. // This should be used for integration testing, where InitChainer will be // called several times. CacheStdlibLoad bool // contains filtered or unexported fields }
InitChainerConfig keeps the configuration for the InitChainer. NewAppWithOptions will set InitChainerConfig.InitChainer as its InitChainer function.
func (InitChainerConfig) InitChainer ¶
func (cfg InitChainerConfig) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
InitChainer is the function that can be used as a sdk.InitChainer.
type Param ¶
type Param struct {
// contains filtered or unexported fields
}
func LoadGenesisParamsFile ¶
LoadGenesisParamsFile loads genesis params from the provided file path.
func (Param) MarshalAmino ¶
func (*Param) UnmarshalAmino ¶
type TxWithMetadata ¶
type TxWithMetadata struct { Tx std.Tx `json:"tx"` Metadata *GnoTxMetadata `json:"metadata,omitempty"` }
func LoadGenesisTxsFile ¶
func LoadGenesisTxsFile(path string, chainID string, genesisRemote string) ([]TxWithMetadata, error)
LoadGenesisTxsFile loads genesis transactions from the provided file path. XXX: Improve the way we generate and load this file
func LoadPackagesFromDir ¶
LoadPackagesFromDir loads gno packages from a directory. It creates and returns a list of transactions based on these packages.
func ReadGenesisTxs ¶
func ReadGenesisTxs(ctx context.Context, path string) ([]TxWithMetadata, error)
ReadGenesisTxs reads the genesis txs from the given file path