helpers

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitBlocks added in v0.5.1

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 added in v0.5.1

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

CreateAccount creates new private key and corresponding transaction signer

func ExtractRPCErrorData added in v0.5.1

func ExtractRPCErrorData(err error) error

ExtractRPCErrorData tries to extract the error data from the provided error

func Reorg added in v0.5.1

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

func RequireProcessorUpdated added in v0.5.0

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

func SendTx added in v0.5.1

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 added in v0.5.1

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

func NewE2EEnvWithEVML2 added in v0.5.1

func NewE2EEnvWithEVML2(t *testing.T) *AggoracleWithEVMChain

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

type ClientRenamed

type ClientRenamed simulated.Client

type CommonEnvironment added in v0.5.1

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 EthTxManagerMock

type EthTxManagerMock struct {
	mock.Mock
}

EthTxManagerMock is an autogenerated mock type for the EthTxManager type

func NewEthTxManMock

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

func NewEthTxManagerMock

func NewEthTxManagerMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *EthTxManagerMock

NewEthTxManagerMock creates a new instance of EthTxManagerMock. 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 (*EthTxManagerMock) Add

func (_m *EthTxManagerMock) 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 (*EthTxManagerMock) EXPECT added in v0.5.1

func (*EthTxManagerMock) Remove

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

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

func (*EthTxManagerMock) Result

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

func (*EthTxManagerMock) ResultsByStatus

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

type EthTxManagerMock_Add_Call added in v0.5.1

type EthTxManagerMock_Add_Call struct {
	*mock.Call
}

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

func (*EthTxManagerMock_Add_Call) Return added in v0.5.1

func (*EthTxManagerMock_Add_Call) Run added in v0.5.1

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

func (*EthTxManagerMock_Add_Call) RunAndReturn added in v0.5.1

type EthTxManagerMock_Expecter added in v0.5.1

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

func (*EthTxManagerMock_Expecter) Add added in v0.5.1

func (_e *EthTxManagerMock_Expecter) Add(ctx interface{}, to interface{}, value interface{}, data interface{}, gasOffset interface{}, sidecar interface{}) *EthTxManagerMock_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 (*EthTxManagerMock_Expecter) Remove added in v0.5.1

func (_e *EthTxManagerMock_Expecter) Remove(ctx interface{}, id interface{}) *EthTxManagerMock_Remove_Call

Remove is a helper method to define mock.On call

  • ctx context.Context
  • id common.Hash

func (*EthTxManagerMock_Expecter) Result added in v0.5.1

func (_e *EthTxManagerMock_Expecter) Result(ctx interface{}, id interface{}) *EthTxManagerMock_Result_Call

Result is a helper method to define mock.On call

  • ctx context.Context
  • id common.Hash

func (*EthTxManagerMock_Expecter) ResultsByStatus added in v0.5.1

func (_e *EthTxManagerMock_Expecter) ResultsByStatus(ctx interface{}, statuses interface{}) *EthTxManagerMock_ResultsByStatus_Call

ResultsByStatus is a helper method to define mock.On call

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

type EthTxManagerMock_Remove_Call added in v0.5.1

type EthTxManagerMock_Remove_Call struct {
	*mock.Call
}

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

func (*EthTxManagerMock_Remove_Call) Return added in v0.5.1

func (*EthTxManagerMock_Remove_Call) Run added in v0.5.1

func (*EthTxManagerMock_Remove_Call) RunAndReturn added in v0.5.1

type EthTxManagerMock_Result_Call added in v0.5.1

type EthTxManagerMock_Result_Call struct {
	*mock.Call
}

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

func (*EthTxManagerMock_Result_Call) Return added in v0.5.1

func (*EthTxManagerMock_Result_Call) Run added in v0.5.1

func (*EthTxManagerMock_Result_Call) RunAndReturn added in v0.5.1

type EthTxManagerMock_ResultsByStatus_Call added in v0.5.1

type EthTxManagerMock_ResultsByStatus_Call struct {
	*mock.Call
}

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

func (*EthTxManagerMock_ResultsByStatus_Call) Return added in v0.5.1

func (*EthTxManagerMock_ResultsByStatus_Call) Run added in v0.5.1

type L1Environment added in v0.5.1

L1Environment contains setup results for L1 network.

func L1Setup added in v0.5.1

func L1Setup(t *testing.T) *L1Environment

L1Setup creates a new L1 environment.

type L2Environment added in v0.5.1

L2Environment contains setup results for L1 network.

func L2Setup added in v0.5.1

func L2Setup(t *testing.T) *L2Environment

L2Setup creates a new L2 environment.

type Processorer added in v0.5.0

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

type SimulatedBackendSetup added in v0.3.0

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 added in v0.5.1

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 added in v0.5.1

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

DeployBridge deploys the bridge contract

type TestClient

type TestClient struct {
	ClientRenamed
}

func (TestClient) Client

func (tc TestClient) Client() *rpc.Client

Jump to

Keyboard shortcuts

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