Skip to content

Commit

Permalink
name functions consistently in ChainSender interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Dec 11, 2024
1 parent 614a334 commit 337ca0b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions aggoracle/chaingersender/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ func NewEVMChainGERSender(
}, nil
}

func (c *EVMChainGERSender) IsGERAlreadyInjected(ger common.Hash) (bool, error) {
func (c *EVMChainGERSender) IsGERInjected(ger common.Hash) (bool, error) {
timestamp, err := c.gerContract.GlobalExitRootMap(&bind.CallOpts{Pending: false}, ger)
if err != nil {
return false, fmt.Errorf("error calling gerContract.GlobalExitRootMap: %w", err)
}

return timestamp.Cmp(big.NewInt(0)) != 0, nil
return timestamp.Cmp(common.Big0) != 0, nil
}

func (c *EVMChainGERSender) UpdateGERWaitUntilMined(ctx context.Context, ger common.Hash) error {
func (c *EVMChainGERSender) InjectGER(ctx context.Context, ger common.Hash) error {
ticker := time.NewTicker(c.waitPeriodMonitorTx)
defer ticker.Stop()

Expand Down
2 changes: 1 addition & 1 deletion aggoracle/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func runTest(
time.Sleep(time.Millisecond * 150)
expectedGER, err := gerL1Contract.GetLastGlobalExitRoot(&bind.CallOpts{Pending: false})
require.NoError(t, err)
isInjected, err := sender.IsGERAlreadyInjected(expectedGER)
isInjected, err := sender.IsGERInjected(expectedGER)
require.NoError(t, err)
require.True(t, isInjected, fmt.Sprintf("iteration %d, GER: %s", i, common.Bytes2Hex(expectedGER[:])))
}
Expand Down
8 changes: 4 additions & 4 deletions aggoracle/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ type L1InfoTreer interface {
}

type ChainSender interface {
IsGERAlreadyInjected(ger common.Hash) (bool, error)
UpdateGERWaitUntilMined(ctx context.Context, ger common.Hash) error
IsGERInjected(ger common.Hash) (bool, error)
InjectGER(ctx context.Context, ger common.Hash) error
}

type AggOracle struct {
Expand Down Expand Up @@ -85,7 +85,7 @@ func (a *AggOracle) processLatestGER(ctx context.Context, blockNumToFetch *uint6
// Update the block number for the next iteration
*blockNumToFetch = blockNum

alreadyInjected, err := a.chainSender.IsGERAlreadyInjected(gerToInject)
alreadyInjected, err := a.chainSender.IsGERInjected(gerToInject)
if err != nil {
return fmt.Errorf("error checking if GER is already injected: %w", err)
}
Expand All @@ -95,7 +95,7 @@ func (a *AggOracle) processLatestGER(ctx context.Context, blockNumToFetch *uint6
}

a.logger.Infof("injecting new GER: %s", gerToInject.Hex())
if err := a.chainSender.UpdateGERWaitUntilMined(ctx, gerToInject); err != nil {
if err := a.chainSender.InjectGER(ctx, gerToInject); err != nil {
return fmt.Errorf("error injecting GER %s: %w", gerToInject.Hex(), err)
}

Expand Down
2 changes: 1 addition & 1 deletion claimsponsor/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestE2EL1toEVML2(t *testing.T) {
time.Sleep(time.Millisecond * 300)
expectedGER, err := env.GERL1Contract.GetLastGlobalExitRoot(&bind.CallOpts{Pending: false})
require.NoError(t, err)
isInjected, err := env.AggOracleSender.IsGERAlreadyInjected(expectedGER)
isInjected, err := env.AggOracleSender.IsGERInjected(expectedGER)
require.NoError(t, err)
require.True(t, isInjected, fmt.Sprintf("iteration %d, GER: %s", i, common.Bytes2Hex(expectedGER[:])))

Expand Down
2 changes: 1 addition & 1 deletion lastgersync/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestE2E(t *testing.T) {
time.Sleep(time.Millisecond * 150)
expectedGER, err := env.GERL1Contract.GetLastGlobalExitRoot(&bind.CallOpts{Pending: false})
require.NoError(t, err)
isInjected, err := env.AggOracleSender.IsGERAlreadyInjected(expectedGER)
isInjected, err := env.AggOracleSender.IsGERInjected(expectedGER)
require.NoError(t, err)
require.True(t, isInjected, fmt.Sprintf("iteration %d, GER: %s", i, common.Bytes2Hex(expectedGER[:])))

Expand Down

0 comments on commit 337ca0b

Please sign in to comment.