dev

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyCreatorPackage = errors.New("no creator specified for package")
	ErrEmptyDepositPackage = errors.New("no deposit specified for package")
)
View Source
var DefaultFee = std.NewFee(50000, std.MustParseCoin(ugnot.ValueString(1000000)))
View Source
var ErrEmptyState = errors.New("empty state")

Functions

This section is empty.

Types

type Node

type Node struct {
	*node.Node
	// contains filtered or unexported fields
}

Node is not thread safe

func NewDevNode

func NewDevNode(ctx context.Context, cfg *NodeConfig) (*Node, error)

func (*Node) Client

func (n *Node) Client() client.Client

func (*Node) Close

func (n *Node) Close() error

func (*Node) ExportCurrentState

func (n *Node) ExportCurrentState(ctx context.Context) ([]std.Tx, error)

Export the current state as list of txs

func (*Node) ExportStateAsGenesis

func (n *Node) ExportStateAsGenesis(ctx context.Context) (*bft.GenesisDoc, error)

Export the current state as genesis doc

func (*Node) GetBlockTransactions

func (n *Node) GetBlockTransactions(blockNum uint64) ([]std.Tx, error)

GetBlockTransactions returns the transactions contained within the specified block, if any

func (*Node) GetLatestBlockNumber

func (n *Node) GetLatestBlockNumber() (uint64, error)

GetBlockTransactions returns the transactions contained within the specified block, if any GetLatestBlockNumber returns the latest block height from the chain

func (*Node) GetRemoteAddress

func (n *Node) GetRemoteAddress() string

func (*Node) ListPkgs

func (n *Node) ListPkgs() []gnomod.Pkg

func (*Node) MoveBy

func (n *Node) MoveBy(ctx context.Context, x int) error

MoveBy adjusts the current state of the node by `x` transactions. `x` can be negative to move backward or positive to move forward, however, index boundaries are respected with a lower limit of 0 and upper limit equaling the total number of states. If a move is successful, node is reloaded.

func (*Node) MoveToNextTX

func (n *Node) MoveToNextTX(ctx context.Context) error

func (*Node) MoveToPreviousTX

func (n *Node) MoveToPreviousTX(ctx context.Context) error

func (*Node) Reload

func (n *Node) Reload(ctx context.Context) error

Reload saves the current state, stops the node if running, starts a new node, and re-apply previously saved state along with packages updated by `UpdatePackages`. If any transaction, including 'addpkg', fails, it will be ignored. Use 'Reset' to completely reset the node's state in case of persistent errors.

func (*Node) ReloadAll

func (n *Node) ReloadAll(ctx context.Context) error

ReloadAll updates all currently known packages and then reloads the node. It's actually a simple combination between `UpdatePackage` and `Reload` method.

func (*Node) Reset

func (n *Node) Reset(ctx context.Context) error

Reset stops the node, if running, and reloads it with a new genesis state, effectively ignoring the current state.

func (*Node) SaveCurrentState

func (n *Node) SaveCurrentState(ctx context.Context) error

Save the current state as initialState

func (*Node) SendTransaction

func (n *Node) SendTransaction(tx *std.Tx) error

SendTransaction executes a broadcast commit send of the specified transaction to the chain

func (*Node) UpdatePackages

func (n *Node) UpdatePackages(paths ...string) error

UpdatePackages updates the currently known packages. It will be taken into consideration in the next reload of the node.

type NodeConfig

type NodeConfig struct {
	Logger                *slog.Logger
	DefaultDeployer       crypto.Address
	BalancesList          []gnoland.Balance
	PackagesPathList      []PackagePath
	Emitter               emitter.Emitter
	InitialTxs            []std.Tx
	TMConfig              *tmcfg.Config
	SkipFailingGenesisTxs bool
	NoReplay              bool
	MaxGasPerBlock        int64
	ChainID               string
}

func DefaultNodeConfig

func DefaultNodeConfig(rootdir string) *NodeConfig

type Package

type Package struct {
	gnomod.Pkg
	Creator crypto.Address
	Deposit std.Coins
}

type PackagePath

type PackagePath struct {
	Path    string
	Creator crypto.Address
	Deposit std.Coins
}

func ResolvePackagePathQuery

func ResolvePackagePathQuery(bk *address.Book, path string) (PackagePath, error)

type PackagesMap

type PackagesMap map[string]Package

func NewPackagesMap

func NewPackagesMap(ppaths []PackagePath) (PackagesMap, error)

func (PackagesMap) Load

func (pm PackagesMap) Load(fee std.Fee) ([]std.Tx, error)

Jump to

Keyboard shortcuts

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