sandbox

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockSandbox

type MockSandbox struct {
	TestParams           param.Params
	TestStore            *store.MockStore
	TestCommittee        committee.Committee
	TestCommitteeSigners []crypto.Signer
	TestAcceptSortition  bool
	TestPowerDelta       int64
}

MockSandbox is a testing mock for sandbox.

func MockingSandbox

func MockingSandbox() *MockSandbox

func (*MockSandbox) Account

func (m *MockSandbox) Account(addr crypto.Address) *account.Account

func (*MockSandbox) Committee

func (m *MockSandbox) Committee() committee.Reader

func (*MockSandbox) CurrentHeight

func (m *MockSandbox) CurrentHeight() uint32

func (*MockSandbox) IterateAccounts

func (m *MockSandbox) IterateAccounts(consumer func(crypto.Address, *account.Account, bool))

func (*MockSandbox) IterateValidators

func (m *MockSandbox) IterateValidators(consumer func(*validator.Validator, bool))

func (*MockSandbox) MakeNewAccount

func (m *MockSandbox) MakeNewAccount(_ crypto.Address) *account.Account

func (*MockSandbox) MakeNewValidator

func (m *MockSandbox) MakeNewValidator(pub *bls.PublicKey) *validator.Validator

func (*MockSandbox) Params

func (m *MockSandbox) Params() param.Params

func (*MockSandbox) PowerDelta added in v0.12.0

func (m *MockSandbox) PowerDelta() int64

func (*MockSandbox) RecentBlockByStamp added in v0.12.0

func (m *MockSandbox) RecentBlockByStamp(stamp hash.Stamp) (uint32, *block.Block)

func (*MockSandbox) UpdateAccount

func (m *MockSandbox) UpdateAccount(addr crypto.Address, acc *account.Account)

func (*MockSandbox) UpdatePowerDelta added in v0.12.0

func (m *MockSandbox) UpdatePowerDelta(delta int64)

func (*MockSandbox) UpdateValidator

func (m *MockSandbox) UpdateValidator(val *validator.Validator)

func (*MockSandbox) Validator

func (m *MockSandbox) Validator(addr crypto.Address) *validator.Validator

func (*MockSandbox) VerifyProof

type Sandbox

type Sandbox interface {
	Account(crypto.Address) *account.Account
	MakeNewAccount(crypto.Address) *account.Account
	UpdateAccount(crypto.Address, *account.Account)

	Validator(crypto.Address) *validator.Validator
	MakeNewValidator(*bls.PublicKey) *validator.Validator
	UpdateValidator(*validator.Validator)
	UpdatePowerDelta(delta int64)
	PowerDelta() int64

	VerifyProof(hash.Stamp, sortition.Proof, *validator.Validator) bool
	Committee() committee.Reader
	RecentBlockByStamp(stamp hash.Stamp) (uint32, *block.Block)

	Params() param.Params
	CurrentHeight() uint32

	IterateAccounts(consumer func(addr crypto.Address, acc *account.Account, updated bool))
	IterateValidators(consumer func(val *validator.Validator, updated bool))
}

func NewSandbox

func NewSandbox(store store.Reader, params param.Params,
	committee committee.Reader, totalPower int64) Sandbox

Jump to

Keyboard shortcuts

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