Skip to content

Commit

Permalink
fix: resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
rachit77 committed Sep 17, 2024
2 parents 4fa3c8f + c647413 commit 283f5ed
Show file tree
Hide file tree
Showing 41 changed files with 651 additions and 611 deletions.
9 changes: 6 additions & 3 deletions aggoracle/chaingersender/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type EthTxManager interface {
}

type EVMChainGERSender struct {
logger *log.Logger
gerContract *pessimisticglobalexitroot.Pessimisticglobalexitroot
gerAddr common.Address
sender common.Address
Expand All @@ -60,6 +61,7 @@ type EVMConfig struct {
}

func NewEVMChainGERSender(
logger *log.Logger,
l2GlobalExitRoot, sender common.Address,
l2Client EthClienter,
ethTxMan EthTxManager,
Expand All @@ -72,6 +74,7 @@ func NewEVMChainGERSender(
}

return &EVMChainGERSender{
logger: logger,
gerContract: gerContract,
gerAddr: l2GlobalExitRoot,
sender: sender,
Expand Down Expand Up @@ -106,10 +109,10 @@ func (c *EVMChainGERSender) UpdateGERWaitUntilMined(ctx context.Context, ger com
}
for {
time.Sleep(c.waitPeriodMonitorTx)
log.Debugf("waiting for tx %s to be mined", id.Hex())
c.logger.Debugf("waiting for tx %s to be mined", id.Hex())
res, err := c.ethTxMan.Result(ctx, id)
if err != nil {
log.Error("error calling ethTxMan.Result: ", err)
c.logger.Error("error calling ethTxMan.Result: ", err)
}
switch res.Status {
case ethtxmanager.MonitoredTxStatusCreated,
Expand All @@ -122,7 +125,7 @@ func (c *EVMChainGERSender) UpdateGERWaitUntilMined(ctx context.Context, ger com
ethtxmanager.MonitoredTxStatusFinalized:
return nil
default:
log.Error("unexpected tx status: ", res.Status)
c.logger.Error("unexpected tx status: ", res.Status)
}
}
}
22 changes: 11 additions & 11 deletions aggoracle/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type ChainSender interface {
}

type AggOracle struct {
logger *log.Logger
ticker *time.Ticker
l1Client ethereum.ChainReader
l1Info L1InfoTreer
Expand All @@ -31,6 +32,7 @@ type AggOracle struct {
}

func New(
logger *log.Logger,
chainSender ChainSender,
l1Client ethereum.ChainReader,
l1InfoTreeSyncer L1InfoTreer,
Expand All @@ -44,6 +46,7 @@ func New(
}

return &AggOracle{
logger: logger,
ticker: ticker,
l1Client: l1Client,
l1Info: l1InfoTreeSyncer,
Expand All @@ -65,34 +68,31 @@ func (a *AggOracle) Start(ctx context.Context) {
if err != nil {
switch {
case errors.Is(err, l1infotreesync.ErrBlockNotProcessed):
log.Debugf("syncer is not ready for the block %d", blockNumToFetch)
a.logger.Debugf("syncer is not ready for the block %d", blockNumToFetch)

case errors.Is(err, l1infotreesync.ErrNotFound):
blockNumToFetch = 0
log.Debugf("syncer has not found any GER until block %d", blockNumToFetch)
a.logger.Debugf("syncer has not found any GER until block %d", blockNumToFetch)

default:
log.Error("error calling getLastFinalisedGER: ", err)
a.logger.Error("error calling getLastFinalisedGER: ", err)
}

continue
}
if alreadyInjected, err := a.chainSender.IsGERAlreadyInjected(gerToInject); err != nil {
log.Error("error calling isGERAlreadyInjected: ", err)

a.logger.Error("error calling isGERAlreadyInjected: ", err)
continue
} else if alreadyInjected {
log.Debugf("GER %s already injected", gerToInject.Hex())

a.logger.Debugf("GER %s already injected", gerToInject.Hex())
continue
}
log.Infof("injecting new GER: %s", gerToInject.Hex())
a.logger.Infof("injecting new GER: %s", gerToInject.Hex())
if err := a.chainSender.UpdateGERWaitUntilMined(ctx, gerToInject); err != nil {
log.Errorf("error calling updateGERWaitUntilMined, when trying to inject GER %s: %v", gerToInject.Hex(), err)

a.logger.Errorf("error calling updateGERWaitUntilMined, when trying to inject GER %s: %v", gerToInject.Hex(), err)
continue
}
log.Infof("GER %s injected", gerToInject.Hex())
a.logger.Infof("GER %s injected", gerToInject.Hex())
case <-ctx.Done():
return
}
Expand Down
Loading

0 comments on commit 283f5ed

Please sign in to comment.