Skip to content

Commit

Permalink
make legacy URL optional for v03, make block number required for cond…
Browse files Browse the repository at this point in the history
…itional using data streams (#13263)
  • Loading branch information
shileiwill authored May 20, 2024
1 parent b00ad69 commit 14ec6c4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/tall-eagles-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

tune debugging script #bugfix
4 changes: 2 additions & 2 deletions core/scripts/chaincli/DEBUGGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ Execute the following command based on your upkeep type:
- For custom logic:
```bash
go run main.go keeper debug UPKEEP_ID [OPTIONAL BLOCK_NUMBER]
go run main.go keeper debug UPKEEP_ID [BLOCK_NUMBER]
```
If you don't specify a block number, the debugging script uses the latest block.
If you don't specify a block number, the debugging script uses the latest block for checkUpkeep and simulatePerformUpkeep. For conditional upkeeps using streams lookup, a BLOCK_NUMBER is required.
- For log trigger upkeep:
Expand Down
8 changes: 7 additions & 1 deletion core/scripts/chaincli/handler/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ func (k *Keeper) Debug(ctx context.Context, args []string) {
message("upkeep reverted with StreamsLookup")
message(fmt.Sprintf("StreamsLookup data: {FeedParamKey: %s, Feeds: %v, TimeParamKey: %s, Time: %d, ExtraData: %s}", streamsLookupErr.FeedParamKey, streamsLookupErr.Feeds, streamsLookupErr.TimeParamKey, streamsLookupErr.Time.Uint64(), hexutil.Encode(streamsLookupErr.ExtraData)))

if blockNum == 0 {
failCheckConfig("Data streams requires a valid block number for conditional upkeeps, append a block number to your command", nil)
}
streamsLookup := &mercury.StreamsLookup{
StreamsLookupError: &mercury.StreamsLookupError{
FeedParamKey: streamsLookupErr.FeedParamKey,
Expand All @@ -293,14 +296,17 @@ func (k *Keeper) Debug(ctx context.Context, args []string) {
if !allowed {
resolveIneligible("upkeep reverted with StreamsLookup but is not allowed to access streams")
}
if k.cfg.DataStreamsLegacyURL == "" {
failCheckConfig("Data streams v02 requires Legacy URL, check your DATA_STREAMS settings in .env", nil)
}
} else if streamsLookup.IsMercuryV03() {
// handle v0.3
message("using data streams lookup v0.3")
} else {
resolveIneligible("upkeep reverted with StreamsLookup but the configuration is invalid")
}

if k.cfg.DataStreamsLegacyURL == "" || k.cfg.DataStreamsURL == "" || k.cfg.DataStreamsID == "" || k.cfg.DataStreamsKey == "" {
if k.cfg.DataStreamsURL == "" || k.cfg.DataStreamsID == "" || k.cfg.DataStreamsKey == "" {
failCheckConfig("Data streams configs not set properly for this network, check your DATA_STREAMS settings in .env", nil)
}

Expand Down

0 comments on commit 14ec6c4

Please sign in to comment.