Documentation
¶
Index ¶
- func CommitBlocks(t *testing.T, client *simulated.Backend, numBlocks int, ...)
- func CreateAccount(chainID *big.Int) (*bind.TransactOpts, error)
- func ExtractRPCErrorData(err error) error
- func NewSimulatedEVMEnvironment(t *testing.T, cfg *EnvironmentConfig) (*L1Environment, *L2Environment)
- func Reorg(t *testing.T, client *simulated.Backend, reorgSizeInBlocks uint64)
- func RequireProcessorUpdated(t *testing.T, processor Processorer, targetBlock uint64, ...)
- func SendTx(ctx context.Context, client *SimulatedBackendWithMutex, ...) error
- type AggoraclecommitteeConfig
- type CommonEnvironment
- type EnvironmentConfig
- type EthTxManager
- func (_m *EthTxManager) Add(ctx context.Context, to *common.Address, value *big.Int, data []byte, ...) (common.Hash, error)
- func (_m *EthTxManager) EXPECT() *EthTxManager_Expecter
- func (_m *EthTxManager) From() common.Address
- func (_m *EthTxManager) Remove(ctx context.Context, id common.Hash) error
- func (_m *EthTxManager) Result(ctx context.Context, id common.Hash) (zkevm_ethtx_managertypes.MonitoredTxResult, error)
- func (_m *EthTxManager) ResultsByStatus(ctx context.Context, statuses []zkevm_ethtx_managertypes.MonitoredTxStatus) ([]zkevm_ethtx_managertypes.MonitoredTxResult, error)
- type EthTxManager_Add_Call
- type EthTxManager_Expecter
- func (_e *EthTxManager_Expecter) Add(ctx interface{}, to interface{}, value interface{}, data interface{}, ...) *EthTxManager_Add_Call
- func (_e *EthTxManager_Expecter) From() *EthTxManager_From_Call
- func (_e *EthTxManager_Expecter) Remove(ctx interface{}, id interface{}) *EthTxManager_Remove_Call
- func (_e *EthTxManager_Expecter) Result(ctx interface{}, id interface{}) *EthTxManager_Result_Call
- func (_e *EthTxManager_Expecter) ResultsByStatus(ctx interface{}, statuses interface{}) *EthTxManager_ResultsByStatus_Call
- type EthTxManager_From_Call
- type EthTxManager_Remove_Call
- func (_c *EthTxManager_Remove_Call) Return(_a0 error) *EthTxManager_Remove_Call
- func (_c *EthTxManager_Remove_Call) Run(run func(ctx context.Context, id common.Hash)) *EthTxManager_Remove_Call
- func (_c *EthTxManager_Remove_Call) RunAndReturn(run func(context.Context, common.Hash) error) *EthTxManager_Remove_Call
- type EthTxManager_Result_Call
- func (_c *EthTxManager_Result_Call) Return(_a0 zkevm_ethtx_managertypes.MonitoredTxResult, _a1 error) *EthTxManager_Result_Call
- func (_c *EthTxManager_Result_Call) Run(run func(ctx context.Context, id common.Hash)) *EthTxManager_Result_Call
- func (_c *EthTxManager_Result_Call) RunAndReturn(...) *EthTxManager_Result_Call
- type EthTxManager_ResultsByStatus_Call
- func (_c *EthTxManager_ResultsByStatus_Call) Return(_a0 []zkevm_ethtx_managertypes.MonitoredTxResult, _a1 error) *EthTxManager_ResultsByStatus_Call
- func (_c *EthTxManager_ResultsByStatus_Call) Run(...) *EthTxManager_ResultsByStatus_Call
- func (_c *EthTxManager_ResultsByStatus_Call) RunAndReturn(...) *EthTxManager_ResultsByStatus_Call
- type L1Environment
- type L2Environment
- type L2GERManagerContractType
- type Processorer
- type SimulatedBackendSetup
- type SimulatedBackendWithMutex
- type TestClient
- type TestClientOption
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 ¶
ExtractRPCErrorData tries to extract the error data from the provided error
func NewSimulatedEVMEnvironment ¶ added in v0.7.0
func NewSimulatedEVMEnvironment(t *testing.T, cfg *EnvironmentConfig) (*L1Environment, *L2Environment)
NewSimulatedEVMEnvironment creates a new simulated environment with EVM L1 and L2 chains.
func RequireProcessorUpdated ¶
func RequireProcessorUpdated(t *testing.T, processor Processorer, targetBlock uint64, ethClient aggkittypes.BaseEthereumClienter)
Types ¶
type AggoraclecommitteeConfig ¶ added in v0.7.0
type CommonEnvironment ¶
type CommonEnvironment struct {
SimBackend *simulated.Backend
GERAddr common.Address
AggOracleCommitteeAddr 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.0
type EnvironmentConfig struct {
L1RPCClient aggkittypes.RPCClienter
L2RPCClient aggkittypes.RPCClienter
L2GERManagerType L2GERManagerContractType
AggOracleCommitteeCfg AggoraclecommitteeConfig
}
func DefaultEnvironmentConfig ¶ added in v0.5.0
func DefaultEnvironmentConfig(l2GERManagerType L2GERManagerContractType) *EnvironmentConfig
type EthTxManager ¶ added in v0.4.0
EthTxManager is an autogenerated mock type for the EthTxManager type
func NewEthTxManMock ¶
func NewEthTxManMock( t *testing.T, client *SimulatedBackendWithMutex, 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
Remove provides a mock function with given fields: ctx, id
func (*EthTxManager) Result ¶ added in v0.4.0
func (_m *EthTxManager) Result(ctx context.Context, id common.Hash) (zkevm_ethtx_managertypes.MonitoredTxResult, error)
Result provides a mock function with given fields: ctx, id
func (*EthTxManager) ResultsByStatus ¶ added in v0.4.0
func (_m *EthTxManager) ResultsByStatus(ctx context.Context, statuses []zkevm_ethtx_managertypes.MonitoredTxStatus) ([]zkevm_ethtx_managertypes.MonitoredTxResult, error)
ResultsByStatus provides a mock function with given fields: ctx, statuses
type EthTxManager_Add_Call ¶ added in v0.4.0
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 (_c *EthTxManager_Add_Call) Return(_a0 common.Hash, _a1 error) *EthTxManager_Add_Call
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
func (_c *EthTxManager_Add_Call) RunAndReturn(run func(context.Context, *common.Address, *big.Int, []byte, uint64, *types.BlobTxSidecar) (common.Hash, error)) *EthTxManager_Add_Call
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
func (_e *EthTxManager_Expecter) From() *EthTxManager_From_Call
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
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 (_c *EthTxManager_From_Call) Return(_a0 common.Address) *EthTxManager_From_Call
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
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 (_c *EthTxManager_Remove_Call) Return(_a0 error) *EthTxManager_Remove_Call
func (*EthTxManager_Remove_Call) Run ¶ added in v0.4.0
func (_c *EthTxManager_Remove_Call) Run(run func(ctx context.Context, id common.Hash)) *EthTxManager_Remove_Call
func (*EthTxManager_Remove_Call) RunAndReturn ¶ added in v0.4.0
func (_c *EthTxManager_Remove_Call) RunAndReturn(run func(context.Context, common.Hash) error) *EthTxManager_Remove_Call
type EthTxManager_Result_Call ¶ added in v0.4.0
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 (_c *EthTxManager_Result_Call) Return(_a0 zkevm_ethtx_managertypes.MonitoredTxResult, _a1 error) *EthTxManager_Result_Call
func (*EthTxManager_Result_Call) Run ¶ added in v0.4.0
func (_c *EthTxManager_Result_Call) Run(run func(ctx context.Context, id common.Hash)) *EthTxManager_Result_Call
func (*EthTxManager_Result_Call) RunAndReturn ¶ added in v0.4.0
func (_c *EthTxManager_Result_Call) RunAndReturn(run func(context.Context, common.Hash) (zkevm_ethtx_managertypes.MonitoredTxResult, error)) *EthTxManager_Result_Call
type EthTxManager_ResultsByStatus_Call ¶ added in v0.4.0
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 (_c *EthTxManager_ResultsByStatus_Call) Return(_a0 []zkevm_ethtx_managertypes.MonitoredTxResult, _a1 error) *EthTxManager_ResultsByStatus_Call
func (*EthTxManager_ResultsByStatus_Call) Run ¶ added in v0.4.0
func (_c *EthTxManager_ResultsByStatus_Call) Run(run func(ctx context.Context, statuses []zkevm_ethtx_managertypes.MonitoredTxStatus)) *EthTxManager_ResultsByStatus_Call
func (*EthTxManager_ResultsByStatus_Call) RunAndReturn ¶ added in v0.4.0
func (_c *EthTxManager_ResultsByStatus_Call) RunAndReturn(run func(context.Context, []zkevm_ethtx_managertypes.MonitoredTxStatus) ([]zkevm_ethtx_managertypes.MonitoredTxResult, error)) *EthTxManager_ResultsByStatus_Call
type L1Environment ¶
type L1Environment struct {
CommonEnvironment
GERContract *polygonzkevmglobalexitrootv2.Polygonzkevmglobalexitrootv2
InfoTreeSync *l1infotreesync.L1InfoTreeSync
}
L1Environment contains simulated setup 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
GERManagerSovereignSC *globalexitrootmanagerl2sovereignchain.Globalexitrootmanagerl2sovereignchain
GERManagerLegacySC *polygonzkevmglobalexitrootv2.Polygonzkevmglobalexitrootv2
AggOracleCommitteeContract *aggoraclecommittee.Aggoraclecommittee
AggoracleSender aggoracle.ChainSender
EthTxManagerMock *EthTxManager
}
L2Environment contains simulated setup for L2 network.
func L2Setup ¶
func L2Setup(t *testing.T, cfg *EnvironmentConfig, l1Setup *L1Environment) *L2Environment
L2Setup creates a new L2 environment.
type L2GERManagerContractType ¶ added in v0.7.0
type L2GERManagerContractType int
const ( SovereignChainL2GERContract L2GERManagerContractType = iota LegacyL2GERContract )
type Processorer ¶
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 SimulatedBackendWithMutex ¶ added in v0.7.0
Wrapper struct to associate a mutex with each simulated backend instance
type TestClient ¶
type TestClient struct {
simulated.Client
aggkittypes.RPCClienter
}
func NewTestClient ¶ added in v0.5.0
func NewTestClient(ethClient simulated.Client, opts ...TestClientOption) *TestClient
NewTestClient creates a new TestClient with optional configurations.
type TestClientOption ¶ added in v0.5.0
type TestClientOption func(*TestClient)
TestClientOption defines a function signature for optional parameters.
func WithRPCClienter ¶ added in v0.5.0
func WithRPCClienter(rpcClient aggkittypes.RPCClienter) TestClientOption
WithRPCClienter sets the optional RPCClienter.