Skip to content

Commit

Permalink
Merkle roots processor performance improvement (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkouv authored Dec 19, 2024
1 parent e7d9aa1 commit 6badcdb
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions commit/merkleroot/observation.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,32 @@ func (p *Processor) getObservation(
nextState := previousOutcome.nextState()
switch nextState {
case selectingRangesForReport:
offRampNextSeqNums := p.observer.ObserveOffRampNextSeqNums(ctx)
onRampLatestSeqNums := p.observer.ObserveLatestOnRampSeqNums(ctx, p.destChain)
rmnRemoteCfg := p.observer.ObserveRMNRemoteCfg(ctx, p.destChain)
var (
offRampNextSeqNums []plugintypes.SeqNumChain
onRampLatestSeqNums []plugintypes.SeqNumChain
rmnRemoteCfg rmntypes.RemoteConfig
)

eg := &errgroup.Group{}

eg.Go(func() error {
offRampNextSeqNums = p.observer.ObserveOffRampNextSeqNums(ctx)
return nil
})

eg.Go(func() error {
onRampLatestSeqNums = p.observer.ObserveLatestOnRampSeqNums(ctx, p.destChain)
return nil
})

eg.Go(func() error {
rmnRemoteCfg = p.observer.ObserveRMNRemoteCfg(ctx, p.destChain)
return nil
})

if err := eg.Wait(); err != nil {
return Observation{}, nextState, fmt.Errorf("failed to get observation: %w", err)
}

return Observation{
OnRampMaxSeqNums: onRampLatestSeqNums,
Expand Down

0 comments on commit 6badcdb

Please sign in to comment.