Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Comments fix
Browse files Browse the repository at this point in the history
  • Loading branch information
goran-ethernal committed Jan 16, 2024
1 parent 838bbaf commit 3da4ae8
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 131 deletions.
54 changes: 27 additions & 27 deletions etherman/etherman_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestGetSequencerAddr(t *testing.T) {
t.Run("Returns expected error on 'TrustedSequencer' call (improperly formatted output)", func(t *testing.T) {
t.Parallel()

ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand Down Expand Up @@ -101,7 +101,7 @@ func TestGetSequencerAddr(t *testing.T) {
t.Run("Returns expected error on 'RollupIDToRollupData' call (improperly formatted output)", func(t *testing.T) {
t.Parallel()

ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand Down Expand Up @@ -132,7 +132,7 @@ func TestGetSequencerAddr(t *testing.T) {
t.Run("Returns expected sequencer address", func(t *testing.T) {
t.Parallel()

ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand Down Expand Up @@ -179,7 +179,7 @@ func TestGetSequencerAddr(t *testing.T) {
func TestBuildTrustedVerifyBatches(t *testing.T) {
t.Parallel()
assert := assert.New(t)
ethman := getEtherman(mocks.NewIEthereumClient(t))
ethman := getEtherman(mocks.NewEthereumClientMock(t))

// Because we cant mock the ABI dependency is this the only test case that we somehow
// can have here in a unit test. Further test coverage can get achieved with e2e or integration tests.
Expand All @@ -205,7 +205,7 @@ func TestCallContract(t *testing.T) {
assert := assert.New(t)

t.Run("Returns expected value", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand Down Expand Up @@ -248,7 +248,7 @@ func TestCallContract(t *testing.T) {
})

t.Run("Returns expected error", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand Down Expand Up @@ -296,7 +296,7 @@ func TestCheckTxWasMined(t *testing.T) {
assert := assert.New(t)

t.Run("Returns expected error on 'ethereum.NotFound'", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -317,7 +317,7 @@ func TestCheckTxWasMined(t *testing.T) {
})

t.Run("Returns expected error", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -338,7 +338,7 @@ func TestCheckTxWasMined(t *testing.T) {
})

t.Run("Returns the expected values", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -364,7 +364,7 @@ func TestCurrentNonce(t *testing.T) {
assert := assert.New(t)

t.Run("Returns the expected nonce value", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -385,7 +385,7 @@ func TestCurrentNonce(t *testing.T) {
})

t.Run("Returns the expected error", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -411,7 +411,7 @@ func TestGetTx(t *testing.T) {
assert := assert.New(t)

t.Run("Returns the expected transaction", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -433,7 +433,7 @@ func TestGetTx(t *testing.T) {
})

t.Run("Returns the expected error", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -460,7 +460,7 @@ func TestGetTxReceipt(t *testing.T) {
assert := assert.New(t)

t.Run("Returns expected receipt", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -480,7 +480,7 @@ func TestGetTxReceipt(t *testing.T) {
})

t.Run("Returns expected error", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand Down Expand Up @@ -513,7 +513,7 @@ func TestSendTx(t *testing.T) {
)

t.Run("Returns expected value", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -531,7 +531,7 @@ func TestSendTx(t *testing.T) {
})

t.Run("Returns expected error", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -554,7 +554,7 @@ func TestSuggestedGasPrice(t *testing.T) {
assert := assert.New(t)

t.Run("Returns expected value", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -573,7 +573,7 @@ func TestSuggestedGasPrice(t *testing.T) {
})

t.Run("Returns expected error", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -597,7 +597,7 @@ func TestEstimateGas(t *testing.T) {
assert := assert.New(t)

t.Run("Returns the expected value", func(t *testing.T) {
ethclient := mocks.NewIEthereumClient(t)
ethclient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethclient)

ethclient.On(
Expand Down Expand Up @@ -628,7 +628,7 @@ func TestEstimateGas(t *testing.T) {
})

t.Run("Returns the expected error", func(t *testing.T) {
ethclient := mocks.NewIEthereumClient(t)
ethclient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethclient)

ethclient.On(
Expand Down Expand Up @@ -672,7 +672,7 @@ func TestSignTx(t *testing.T) {
)

t.Run("Returns the expected value", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

transaction, err := ethman.SignTx(context.TODO(), common.Address{}, txData)
Expand All @@ -695,7 +695,7 @@ func TestGetRevertMessage(t *testing.T) {
)

t.Run("Returns an empty string and the expected error", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -714,7 +714,7 @@ func TestGetRevertMessage(t *testing.T) {
})

t.Run("Returns an empty string and the error set to nil", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -735,7 +735,7 @@ func TestGetRevertMessage(t *testing.T) {
})

t.Run("Returns the expected revert reason string", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

key, _ := crypto.GenerateKey()
Expand Down Expand Up @@ -785,7 +785,7 @@ func TestGetLastBlock(t *testing.T) {
assert := assert.New(t)

t.Run("Returns the expected values", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand All @@ -812,7 +812,7 @@ func TestGetLastBlock(t *testing.T) {
})

t.Run("Returns the expected error", func(t *testing.T) {
ethClient := mocks.NewIEthereumClient(t)
ethClient := mocks.NewEthereumClientMock(t)
ethman := getEtherman(ethClient)

ethClient.On(
Expand Down
2 changes: 1 addition & 1 deletion etherman/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
)

//go:generate mockery --name IEthereumClient --output ../mocks --case=underscore --filename etherman_client.generated.go
//go:generate mockery --name IEthereumClient --structname EthereumClientMock --output ../mocks --case=underscore --filename etherman_client.generated.go
type IEthereumClient interface {
ethereum.ChainReader
ethereum.ChainStateReader
Expand Down
32 changes: 16 additions & 16 deletions interop/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
func TestNewExecutor(t *testing.T) {
cfg := &config.Config{}
interopAdminAddr := common.HexToAddress("0x1234567890abcdef")
etherman := mocks.NewIEtherman(t)
ethTxManager := mocks.NewIEthTxManager(t)
etherman := mocks.NewEthermanMock(t)
ethTxManager := mocks.NewEthTxManagerMock(t)

executor := New(nil, cfg, interopAdminAddr, etherman, ethTxManager)

Expand All @@ -43,8 +43,8 @@ func TestExecutor_CheckTx(t *testing.T) {
},
}
interopAdminAddr := common.HexToAddress("0x1234567890abcdef")
etherman := mocks.NewIEtherman(t)
ethTxManager := mocks.NewIEthTxManager(t)
etherman := mocks.NewEthermanMock(t)
ethTxManager := mocks.NewEthTxManagerMock(t)

executor := New(log.WithFields("test", "test"), cfg, interopAdminAddr, etherman, ethTxManager)

Expand Down Expand Up @@ -81,8 +81,8 @@ func TestExecutor_CheckTx(t *testing.T) {
func TestExecutor_VerifyZKP(t *testing.T) {
cfg := &config.Config{}
interopAdminAddr := common.HexToAddress("0x1234567890abcdef")
etherman := mocks.NewIEtherman(t)
ethTxManager := mocks.NewIEthTxManager(t)
etherman := mocks.NewEthermanMock(t)
ethTxManager := mocks.NewEthTxManagerMock(t)
tnx := tx.Tx{
LastVerifiedBatch: 0,
NewVerifiedBatch: 1,
Expand Down Expand Up @@ -128,8 +128,8 @@ func TestExecutor_VerifyZKP(t *testing.T) {
func TestExecutor_VerifySignature(t *testing.T) {
cfg := &config.Config{}
interopAdminAddr := common.HexToAddress("0x1234567890abcdef")
etherman := mocks.NewIEtherman(t)
ethTxManager := mocks.NewIEthTxManager(t)
etherman := mocks.NewEthermanMock(t)
ethTxManager := mocks.NewEthTxManagerMock(t)

executor := New(nil, cfg, interopAdminAddr, etherman, ethTxManager)

Expand Down Expand Up @@ -164,8 +164,8 @@ func TestExecutor_VerifySignature(t *testing.T) {
func TestExecutor_Execute(t *testing.T) {
cfg := &config.Config{}
interopAdminAddr := common.HexToAddress("0x1234567890abcdef")
etherman := mocks.NewIEtherman(t)
ethTxManager := mocks.NewIEthTxManager(t)
etherman := mocks.NewEthermanMock(t)
ethTxManager := mocks.NewEthTxManagerMock(t)

executor := New(log.WithFields("test", "test"), cfg, interopAdminAddr, etherman, ethTxManager)

Expand All @@ -182,8 +182,8 @@ func TestExecutor_Execute(t *testing.T) {
}

// Mock the ZkEVMClientCreator.NewClient method
mockZkEVMClientCreator := mocks.NewIZkEVMClientClientCreator(t)
mockZkEVMClient := mocks.NewIZkEVMClient(t)
mockZkEVMClientCreator := mocks.NewZkEVMClientClientCreatorMock(t)
mockZkEVMClient := mocks.NewZkEVMClientMock(t)

mockZkEVMClientCreator.On("NewClient", mock.Anything).Return(mockZkEVMClient).Once()
mockZkEVMClient.On("BatchByNumber", mock.Anything, big.NewInt(int64(signedTx.Tx.NewVerifiedBatch))).
Expand All @@ -205,8 +205,8 @@ func TestExecutor_Execute(t *testing.T) {
func TestExecutor_Settle(t *testing.T) {
cfg := &config.Config{}
interopAdminAddr := common.HexToAddress("0x1234567890abcdef")
etherman := mocks.NewIEtherman(t)
ethTxManager := mocks.NewIEthTxManager(t)
etherman := mocks.NewEthermanMock(t)
ethTxManager := mocks.NewEthTxManagerMock(t)
dbTx := &mocks.TxMock{}

executor := New(nil, cfg, interopAdminAddr, etherman, ethTxManager)
Expand Down Expand Up @@ -261,8 +261,8 @@ func TestExecutor_Settle(t *testing.T) {
func TestExecutor_GetTxStatus(t *testing.T) {
cfg := &config.Config{}
interopAdminAddr := common.HexToAddress("0x1234567890abcdef")
etherman := mocks.NewIEtherman(t)
ethTxManager := mocks.NewIEthTxManager(t)
etherman := mocks.NewEthermanMock(t)
ethTxManager := mocks.NewEthTxManagerMock(t)
dbTx := &mocks.TxMock{}

executor := New(nil, cfg, interopAdminAddr, etherman, ethTxManager)
Expand Down
14 changes: 7 additions & 7 deletions mocks/db.generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3da4ae8

Please sign in to comment.