Documentation
¶
Index ¶
- func ExpectBalanceChange(addr sdk.AccAddress, beforeSnapshot *BalanceSnapshot, ...)
- func ResetExpectedDeltas(accounts []*AccountBalanceInfo)
- func TakeBalanceSnapshots(accounts []*AccountBalanceInfo, grpcHandler grpc.Handler)
- func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmApp, options ...network.ConfigOption)
- func VerifyBalanceChanges(accounts []*AccountBalanceInfo, grpcHandler grpc.Handler, ...)
- type AccountBalanceInfo
- type AccountType
- type BalanceSnapshot
- type CallsData
- type DepositEvent
- type PrecompileIntegrationTestSuite
- type PrecompileUnitTestSuite
- type WithdrawalEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpectBalanceChange ¶ added in v0.5.0
func ExpectBalanceChange( addr sdk.AccAddress, beforeSnapshot *BalanceSnapshot, expectedIntegerDelta *big.Int, expectedFractionalDelta *big.Int, description string, grpcHandler grpc.Handler, )
ExpectBalanceChange verifies expected balance changes after operations
func ResetExpectedDeltas ¶ added in v0.5.0
func ResetExpectedDeltas(accounts []*AccountBalanceInfo)
ResetExpectedDeltas resets all account balance deltas to zero
func TakeBalanceSnapshots ¶ added in v0.5.0
func TakeBalanceSnapshots(accounts []*AccountBalanceInfo, grpcHandler grpc.Handler)
TakeBalanceSnapshots captures current balance states for all accounts
func TestPrecompileIntegrationTestSuite ¶
func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmApp, options ...network.ConfigOption)
func VerifyBalanceChanges ¶ added in v0.5.0
func VerifyBalanceChanges( accounts []*AccountBalanceInfo, grpcHandler grpc.Handler, expectedRemainder *big.Int, )
VerifyBalanceChanges verifies expected balance changes for all accounts
Types ¶
type AccountBalanceInfo ¶ added in v0.5.0
type AccountBalanceInfo struct {
AccountType AccountType
Address sdk.AccAddress
BeforeSnapshot *BalanceSnapshot
IntegerDelta *big.Int
FractionalDelta *big.Int
}
AccountBalanceInfo holds balance tracking information for a test account
func GetAccountBalance ¶ added in v0.5.0
func GetAccountBalance(accounts []*AccountBalanceInfo, accountType AccountType) *AccountBalanceInfo
GetAccountBalance returns the AccountBalanceInfo for a given account type
func InitializeAccountBalances ¶ added in v0.5.0
func InitializeAccountBalances( senderAddr, receiverAddr sdk.AccAddress, precompileAddr, contractAddr common.Address, ) []*AccountBalanceInfo
InitializeAccountBalances creates the account balance tracking slice with proper addresses
type AccountType ¶ added in v0.5.0
type AccountType int
AccountType represents different account types in the test
const ( Sender AccountType = iota Receiver Precompile Contract PrecisebankModule )
func (AccountType) String ¶ added in v0.5.0
func (at AccountType) String() string
String returns the string representation of AccountType
type BalanceSnapshot ¶ added in v0.5.0
BalanceSnapshot represents a snapshot of account balances for testing
func GetBalanceSnapshot ¶ added in v0.5.0
func GetBalanceSnapshot(addr sdk.AccAddress, grpcHandler grpc.Handler) (*BalanceSnapshot, error)
GetBalanceSnapshot gets complete balance information using grpcHandler
type CallsData ¶
type CallsData struct {
// contains filtered or unexported fields
}
CallsData is a helper struct to hold the addresses and ABIs for the different contract instances that are subject to testing here.
type PrecompileIntegrationTestSuite ¶
type PrecompileIntegrationTestSuite struct {
// contains filtered or unexported fields
}
type PrecompileUnitTestSuite ¶
func NewPrecompileUnitTestSuite ¶
func NewPrecompileUnitTestSuite( create network.CreateEvmApp, options ...network.ConfigOption, ) *PrecompileUnitTestSuite
func (*PrecompileUnitTestSuite) SetupTest ¶
func (s *PrecompileUnitTestSuite) SetupTest(chainID testconstants.ChainID)
SetupTest allows to configure the testing suite embedding a network with a custom chainID. This is important to check that the correct address is used for the precompile.
func (*PrecompileUnitTestSuite) TestEmitDepositEvent ¶
func (s *PrecompileUnitTestSuite) TestEmitDepositEvent()
func (*PrecompileUnitTestSuite) TestEmitWithdrawalEvent ¶
func (s *PrecompileUnitTestSuite) TestEmitWithdrawalEvent()