sandbox

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: MIT Imports: 13 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
	TestAcceptSortition  bool
	TestJoinedValidators map[crypto.Address]bool
	TestCommittedTrxs    map[tx.ID]*tx.Tx
	TestPowerDelta       int64
	// contains filtered or unexported fields
}

MockSandbox is a testing mock for sandbox.

func MockingSandbox

func MockingSandbox(ts *testsuite.TestSuite) *MockSandbox

func (*MockSandbox) Account

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

func (*MockSandbox) AccumulatedFee added in v0.15.0

func (m *MockSandbox) AccumulatedFee() amount.Amount

func (*MockSandbox) AnyRecentTransaction added in v0.15.0

func (m *MockSandbox) AnyRecentTransaction(txID tx.ID) bool

func (*MockSandbox) CommitTransaction added in v0.15.0

func (m *MockSandbox) CommitTransaction(trx *tx.Tx)

func (*MockSandbox) Committee

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

func (*MockSandbox) CurrentHeight

func (m *MockSandbox) CurrentHeight() uint32

func (*MockSandbox) IsBanned added in v1.1.3

func (*MockSandbox) IsBanned(crypto.Address) bool

func (*MockSandbox) IsJoinedCommittee added in v0.15.0

func (m *MockSandbox) IsJoinedCommittee(addr crypto.Address) bool

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, bool))

func (*MockSandbox) JoinedToCommittee added in v0.15.0

func (m *MockSandbox) JoinedToCommittee(addr crypto.Address)

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) 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)

	CommitTransaction(trx *tx.Tx)
	AnyRecentTransaction(txID tx.ID) bool
	IsBanned(crypto.Address) bool

	Validator(crypto.Address) *validator.Validator
	MakeNewValidator(*bls.PublicKey) *validator.Validator
	UpdateValidator(*validator.Validator)
	JoinedToCommittee(crypto.Address)
	IsJoinedCommittee(crypto.Address) bool
	UpdatePowerDelta(delta int64)
	PowerDelta() int64
	AccumulatedFee() amount.Amount

	VerifyProof(uint32, sortition.Proof, *validator.Validator) bool
	Committee() committee.Reader

	Params() *param.Params
	CurrentHeight() uint32

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

func NewSandbox

func NewSandbox(height uint32, str store.Reader, params *param.Params,
	cmt committee.Reader, totalPower int64,
) Sandbox

Jump to

Keyboard shortcuts

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