helpers

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: Apache-2.0, MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitBlocks

func CommitBlocks(t *testing.T, client *simulated.Backend, numBlocks int, waitDuration time.Duration)

commitBlocks commits the specified number of blocks with the given client and waits for the specified duration after each block

func CreateAccount

func CreateAccount(chainID *big.Int) (*bind.TransactOpts, error)

CreateAccount creates new private key and corresponding transaction signer

func ExtractRPCErrorData

func ExtractRPCErrorData(err error) error

ExtractRPCErrorData tries to extract the error data from the provided error

func Reorg

func Reorg(t *testing.T, client *simulated.Backend, reorgSizeInBlocks uint64)

func RequireProcessorUpdated

func RequireProcessorUpdated(t *testing.T, processor Processorer, targetBlock uint64)

func SendTx

func SendTx(ctx context.Context, client *simulated.Backend, auth *bind.TransactOpts,
	to *common.Address, data []byte, value *big.Int) error

SendTx is a helper function that creates the legacy transaction, sings it and sends against simulated environment

Types

type AggoracleWithEVMChain

type AggoracleWithEVMChain struct {
	L1Environment
	L2Environment
	AggOracle   *aggoracle.AggOracle
	NetworkIDL2 uint32
}

func NewE2EEnvWithEVML2

func NewE2EEnvWithEVML2(t *testing.T, cfg *EnvironmentConfig) *AggoracleWithEVMChain

NewE2EEnvWithEVML2 creates a new E2E environment with EVM L1 and L2 chains.

type CommonEnvironment

type CommonEnvironment struct {
	SimBackend     *simulated.Backend
	GERAddr        common.Address
	BridgeContract *polygonzkevmbridgev2.Polygonzkevmbridgev2
	BridgeAddr     common.Address
	Auth           *bind.TransactOpts
	ReorgDetector  *reorgdetector.ReorgDetector
	BridgeSync     *bridgesync.BridgeSync
}

CommonEnvironment contains common setup results used in both L1 and L2 network setups.

type EnvironmentConfig added in v0.5.1

type EnvironmentConfig struct {
	L1RPCClient aggkittypes.RPCClienter
	L2RPCClient aggkittypes.RPCClienter
}

func DefaultEnvironmentConfig added in v0.5.1

func DefaultEnvironmentConfig() *EnvironmentConfig

type EthTxManager added in v0.4.0

type EthTxManager struct {
	mock.Mock
}

EthTxManager is an autogenerated mock type for the EthTxManager type

func NewEthTxManMock

func NewEthTxManMock(
	t *testing.T,
	client *simulated.Backend,
	auth *bind.TransactOpts,
) *EthTxManager

func NewEthTxManager added in v0.4.0

func NewEthTxManager(t interface {
	mock.TestingT
	Cleanup(func())
}) *EthTxManager

NewEthTxManager creates a new instance of EthTxManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*EthTxManager) Add added in v0.4.0

func (_m *EthTxManager) Add(ctx context.Context, to *common.Address, value *big.Int, data []byte, gasOffset uint64, sidecar *types.BlobTxSidecar) (common.Hash, error)

Add provides a mock function with given fields: ctx, to, value, data, gasOffset, sidecar

func (*EthTxManager) EXPECT added in v0.4.0

func (_m *EthTxManager) EXPECT() *EthTxManager_Expecter

func (*EthTxManager) From added in v0.4.0

func (_m *EthTxManager) From() common.Address

From provides a mock function with no fields

func (*EthTxManager) Remove added in v0.4.0

func (_m *EthTxManager) Remove(ctx context.Context, id common.Hash) error

Remove provides a mock function with given fields: ctx, id

func (*EthTxManager) Result added in v0.4.0

Result provides a mock function with given fields: ctx, id

func (*EthTxManager) ResultsByStatus added in v0.4.0

ResultsByStatus provides a mock function with given fields: ctx, statuses

type EthTxManager_Add_Call added in v0.4.0

type EthTxManager_Add_Call struct {
	*mock.Call
}

EthTxManager_Add_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Add'

func (*EthTxManager_Add_Call) Return added in v0.4.0

func (*EthTxManager_Add_Call) Run added in v0.4.0

func (_c *EthTxManager_Add_Call) Run(run func(ctx context.Context, to *common.Address, value *big.Int, data []byte, gasOffset uint64, sidecar *types.BlobTxSidecar)) *EthTxManager_Add_Call

func (*EthTxManager_Add_Call) RunAndReturn added in v0.4.0

type EthTxManager_Expecter added in v0.4.0

type EthTxManager_Expecter struct {
	// contains filtered or unexported fields
}

func (*EthTxManager_Expecter) Add added in v0.4.0

func (_e *EthTxManager_Expecter) Add(ctx interface{}, to interface{}, value interface{}, data interface{}, gasOffset interface{}, sidecar interface{}) *EthTxManager_Add_Call

Add is a helper method to define mock.On call

  • ctx context.Context
  • to *common.Address
  • value *big.Int
  • data []byte
  • gasOffset uint64
  • sidecar *types.BlobTxSidecar

func (*EthTxManager_Expecter) From added in v0.4.0

From is a helper method to define mock.On call

func (*EthTxManager_Expecter) Remove added in v0.4.0

func (_e *EthTxManager_Expecter) Remove(ctx interface{}, id interface{}) *EthTxManager_Remove_Call

Remove is a helper method to define mock.On call

  • ctx context.Context
  • id common.Hash

func (*EthTxManager_Expecter) Result added in v0.4.0

func (_e *EthTxManager_Expecter) Result(ctx interface{}, id interface{}) *EthTxManager_Result_Call

Result is a helper method to define mock.On call

  • ctx context.Context
  • id common.Hash

func (*EthTxManager_Expecter) ResultsByStatus added in v0.4.0

func (_e *EthTxManager_Expecter) ResultsByStatus(ctx interface{}, statuses interface{}) *EthTxManager_ResultsByStatus_Call

ResultsByStatus is a helper method to define mock.On call

  • ctx context.Context
  • statuses []zkevm_ethtx_managertypes.MonitoredTxStatus

type EthTxManager_From_Call added in v0.4.0

type EthTxManager_From_Call struct {
	*mock.Call
}

EthTxManager_From_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'From'

func (*EthTxManager_From_Call) Return added in v0.4.0

func (*EthTxManager_From_Call) Run added in v0.4.0

func (_c *EthTxManager_From_Call) Run(run func()) *EthTxManager_From_Call

func (*EthTxManager_From_Call) RunAndReturn added in v0.4.0

func (_c *EthTxManager_From_Call) RunAndReturn(run func() common.Address) *EthTxManager_From_Call

type EthTxManager_Remove_Call added in v0.4.0

type EthTxManager_Remove_Call struct {
	*mock.Call
}

EthTxManager_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove'

func (*EthTxManager_Remove_Call) Return added in v0.4.0

func (*EthTxManager_Remove_Call) Run added in v0.4.0

func (*EthTxManager_Remove_Call) RunAndReturn added in v0.4.0

type EthTxManager_Result_Call added in v0.4.0

type EthTxManager_Result_Call struct {
	*mock.Call
}

EthTxManager_Result_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Result'

func (*EthTxManager_Result_Call) Return added in v0.4.0

func (*EthTxManager_Result_Call) Run added in v0.4.0

func (*EthTxManager_Result_Call) RunAndReturn added in v0.4.0

type EthTxManager_ResultsByStatus_Call added in v0.4.0

type EthTxManager_ResultsByStatus_Call struct {
	*mock.Call
}

EthTxManager_ResultsByStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResultsByStatus'

func (*EthTxManager_ResultsByStatus_Call) Return added in v0.4.0

func (*EthTxManager_ResultsByStatus_Call) Run added in v0.4.0

type L1Environment

L1Environment contains setup results for L1 network.

func L1Setup

func L1Setup(t *testing.T, cfg *EnvironmentConfig) *L1Environment

L1Setup creates a new L1 environment.

type L2Environment

type L2Environment struct {
	CommonEnvironment
	GERContract      *globalexitrootmanagerl2sovereignchain.Globalexitrootmanagerl2sovereignchain
	AggoracleSender  aggoracle.ChainSender
	EthTxManagerMock *EthTxManager
}

L2Environment contains setup results for L1 network.

func L2Setup

func L2Setup(t *testing.T, cfg *EnvironmentConfig) *L2Environment

L2Setup creates a new L2 environment.

type Processorer

type Processorer interface {
	GetLastProcessedBlock(ctx context.Context) (uint64, error)
}

type SimulatedBackendSetup

type SimulatedBackendSetup struct {
	UserAuth            *bind.TransactOpts
	DeployerAuth        *bind.TransactOpts
	BridgeProxyAddr     common.Address
	BridgeProxyContract *polygonzkevmbridgev2.Polygonzkevmbridgev2
}

SimulatedBackendSetup defines the setup for a simulated backend.

func NewSimulatedBackend

func NewSimulatedBackend(t *testing.T,
	balances map[common.Address]types.Account,
	deployerAuth *bind.TransactOpts) (*simulated.Backend, *SimulatedBackendSetup)

NewSimulatedBackend creates a simulated backend with two accounts: user and deployer.

func (*SimulatedBackendSetup) DeployBridge

func (s *SimulatedBackendSetup) DeployBridge(client *simulated.Backend,
	gerAddr common.Address, networkID uint32) error

DeployBridge deploys the bridge contract

type TestClient

type TestClient struct {
	simulated.Client
	aggkittypes.RPCClienter
}

func NewTestClient added in v0.5.1

func NewTestClient(ethClient simulated.Client, opts ...TestClientOption) *TestClient

NewTestClient creates a new TestClient with optional configurations.

func (*TestClient) Call added in v0.5.1

func (t *TestClient) Call(result any, method string, args ...any) error

type TestClientOption added in v0.5.1

type TestClientOption func(*TestClient)

TestClientOption defines a function signature for optional parameters.

func WithRPCClienter added in v0.5.1

func WithRPCClienter(rpcClient aggkittypes.RPCClienter) TestClientOption

WithRPCClienter sets the optional RPCClienter.

Jump to

Keyboard shortcuts

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