Skip to content

Commit

Permalink
AUTO-6622 Enable v0.3 StreamsLookup to also use blockNumber (#10986)
Browse files Browse the repository at this point in the history
* AUTO-6622 Enable v0.3 StreamsLookup to also use blockNumber

* add another test

* format
  • Loading branch information
cmalec authored Oct 18, 2023
1 parent 4e0a0b4 commit e740c8c
Show file tree
Hide file tree
Showing 2 changed files with 180 additions and 26 deletions.
6 changes: 3 additions & 3 deletions core/services/ocr2/plugins/ocr2keeper/evm21/streams_lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (r *EvmRegistry) streamsLookup(ctx context.Context, checkResults []ocr2keep
checkResults[i].IneligibilityReason = uint8(encoding.UpkeepFailureReasonMercuryAccessNotAllowed)
continue
}
} else if l.FeedParamKey != feedIDs || l.TimeParamKey != timestamp {
} else if l.FeedParamKey != feedIDs {
// if mercury version cannot be determined, set failure reason
lggr.Debugf("at block %d upkeep %s NOT allowed to query Mercury server", block, upkeepId)
checkResults[i].IneligibilityReason = uint8(encoding.UpkeepFailureReasonInvalidRevertDataInput)
Expand Down Expand Up @@ -289,7 +289,7 @@ func (r *EvmRegistry) doMercuryRequest(ctx context.Context, sl *StreamsLookup, l
for i := range sl.Feeds {
go r.singleFeedRequest(ctx, ch, i, sl, lggr)
}
} else if sl.FeedParamKey == feedIDs && sl.TimeParamKey == timestamp {
} else if sl.FeedParamKey == feedIDs {
// only mercury v0.3
resultLen = 1
isMercuryV03 = true
Expand Down Expand Up @@ -441,7 +441,7 @@ func (r *EvmRegistry) multiFeedsRequest(ctx context.Context, ch chan<- MercuryDa
// feedIDs: {strings.Join(sl.Feeds, ",")},
// timestamp: {sl.Time.String()},
//}
params := fmt.Sprintf("%s=%s&%s=%s", feedIDs, strings.Join(sl.Feeds, ","), timestamp, sl.Time.String())
params := fmt.Sprintf("%s=%s&%s=%s", feedIDs, strings.Join(sl.Feeds, ","), sl.TimeParamKey, sl.Time.String())
reqUrl := fmt.Sprintf("%s%s%s", r.mercury.cred.URL, mercuryBatchPathV03, params)
lggr.Debugf("request URL for upkeep %s userId %s: %s", sl.upkeepId.String(), r.mercury.cred.Username, reqUrl)

Expand Down
Loading

0 comments on commit e740c8c

Please sign in to comment.