helpers

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: AGPL-3.0 Imports: 29 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) *AggoracleWithEVMChain

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

type ClientRenamed

type ClientRenamed simulated.Client

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

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

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

func (*EthTxManagerMock_Add_Call) Run

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

type EthTxManagerMock_Expecter

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

func (*EthTxManagerMock_Expecter) Add

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

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

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

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

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

func (*EthTxManagerMock_Remove_Call) Run

func (*EthTxManagerMock_Remove_Call) RunAndReturn

type EthTxManagerMock_Result_Call

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

func (*EthTxManagerMock_Result_Call) Run

type EthTxManagerMock_ResultsByStatus_Call

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

type L1Environment

L1Environment contains setup results for L1 network.

func L1Setup

func L1Setup(t *testing.T) *L1Environment

L1Setup creates a new L1 environment.

type L2Environment

L2Environment contains setup results for L1 network.

func L2Setup

func L2Setup(t *testing.T) *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 {
	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