-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to ocr2keepers latest (#10179)
* Upgrade to ocr2keepers latest * update type * add todo * update * update ocr2keepers * added payload builder * get latest block once * update ocr2keepers * Hook in payload builder to delegate * hook in dependencies * fix conditionals * add missing file * use state unknown from ocr2keepers * update block subscriber to latest * update * update ocr2keepers * remove logs * small fixes * fix transmit event provider * fixes * logs * revert block subscriber changes * fix build * cleanup * update block subscriber * fix close * add nil protection * fix integration test * go mod tidy * fix tests --------- Co-authored-by: amirylm <[email protected]>
- Loading branch information
Showing
20 changed files
with
129 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
core/services/ocr2/plugins/ocr2keeper/evm21/core/interfaces.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package core | ||
|
||
import ( | ||
"context" | ||
|
||
ocr2keepers "github.com/smartcontractkit/ocr2keepers/pkg/v3/types" | ||
) | ||
|
||
// UpkeepStateReader is the interface for reading the current state of upkeeps. | ||
type UpkeepStateReader interface { | ||
SelectByWorkIDsInRange(ctx context.Context, start, end int64, workIDs ...string) ([]ocr2keepers.UpkeepState, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
core/services/ocr2/plugins/ocr2keeper/evm21/payload_builder.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package evm | ||
|
||
import ( | ||
"context" | ||
|
||
ocr2keepers "github.com/smartcontractkit/ocr2keepers/pkg/v3/types" | ||
|
||
"github.com/smartcontractkit/chainlink/v2/core/logger" | ||
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evm21/core" | ||
) | ||
|
||
type payloadBuilder struct { | ||
lggr logger.Logger | ||
} | ||
|
||
var _ ocr2keepers.PayloadBuilder = &payloadBuilder{} | ||
|
||
func NewPayloadBuilder(lggr logger.Logger) *payloadBuilder { | ||
return &payloadBuilder{ | ||
lggr: lggr, | ||
} | ||
} | ||
|
||
func (b *payloadBuilder) BuildPayloads(ctx context.Context, proposals ...ocr2keepers.CoordinatedBlockProposal) ([]ocr2keepers.UpkeepPayload, error) { | ||
payloads := make([]ocr2keepers.UpkeepPayload, len(proposals)) | ||
for i, p := range proposals { | ||
b.lggr.Debugf("building payload for coordinated block proposal %+v", p) | ||
var checkData []byte | ||
switch core.GetUpkeepType(p.UpkeepID) { | ||
case ocr2keepers.LogTrigger: | ||
checkData = []byte{} // TODO: call recoverer | ||
case ocr2keepers.ConditionTrigger: | ||
// Trigger.BlockNumber and Trigger.BlockHash are already coordinated | ||
checkData = []byte{} // CheckData derived on chain for conditionals | ||
// TODO: check for upkeepID being active upkeep here | ||
default: | ||
} | ||
payload, err := core.NewUpkeepPayload(p.UpkeepID.BigInt(), p.Trigger, checkData) | ||
if err != nil { | ||
b.lggr.Warnw("failed to build payload", "err", err, "upkeepID", p.UpkeepID) | ||
payloads[i] = ocr2keepers.UpkeepPayload{} | ||
continue | ||
} | ||
payloads[i] = payload | ||
} | ||
|
||
return payloads, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.