From 48f5f91e2bc4383c62db75a6a63712345e56ea99 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:10:20 -0700 Subject: [PATCH 001/117] Add node api wrapper for ergonomic cmd usage --- .../keystone/src/02_deploy_jobspecs_cmd.go | 87 ++--------- core/scripts/keystone/src/99_app.go | 141 ++++++++++++++++++ 2 files changed, 150 insertions(+), 78 deletions(-) diff --git a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go index 275943d6388..abc8b641607 100644 --- a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go +++ b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go @@ -1,21 +1,14 @@ package src import ( - "bytes" "errors" "flag" "fmt" "os" - "reflect" - "runtime" - "strings" - - "github.com/urfave/cli" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - "github.com/smartcontractkit/chainlink/v2/core/cmd" ) - +// Could be useful https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/scripts/chaincli/handler/scrape_node_config.go#L102 type deployJobSpecs struct{} func NewDeployJobSpecsCommand() *deployJobSpecs { @@ -79,87 +72,25 @@ func (g *deployJobSpecs) Run(args []string) { } for i, n := range nodes { - output := &bytes.Buffer{} - client, app := newApp(n, output) - fmt.Println("Logging in:", n.url) - loginFs := flag.NewFlagSet("test", flag.ContinueOnError) - loginFs.Bool("bypass-version-check", true, "") - loginCtx := cli.NewContext(app, loginFs, nil) - err := client.RemoteLogin(loginCtx) - helpers.PanicErr(err) - output.Reset() - + api := newNodeAPI(n) if !*onlyReplay { specToDeploy := flattenedSpecs[i].spec.ToString() specFragment := flattenedSpecs[i].spec[0:1] fmt.Printf("Deploying jobspec: %s\n... \n", specFragment) - fs := flag.NewFlagSet("test", flag.ExitOnError) - err = fs.Parse([]string{specToDeploy}) - helpers.PanicErr(err) - err = client.CreateJob(cli.NewContext(app, fs, nil)) + _, err := api.withArg(specToDeploy).exec(api.methods.CreateJob) if err != nil { fmt.Println("Failed to deploy job spec:", specFragment, "Error:", err) } - output.Reset() } - replayFs := flag.NewFlagSet("test", flag.ExitOnError) - flagSetApplyFromAction(client.ReplayFromBlock, replayFs, "") - err = replayFs.Set("block-number", fmt.Sprint(deployedContracts.SetConfigTxBlock)) - helpers.PanicErr(err) - err = replayFs.Set("evm-chain-id", fmt.Sprint(*chainID)) - helpers.PanicErr(err) - fmt.Printf("Replaying from block: %d\n", deployedContracts.SetConfigTxBlock) fmt.Printf("EVM Chain ID: %d\n\n", *chainID) - replayCtx := cli.NewContext(app, replayFs, nil) - err = client.ReplayFromBlock(replayCtx) - helpers.PanicErr(err) - } -} - -// flagSetApplyFromAction applies the flags from action to the flagSet. -// -// `parentCommand` will filter the app commands and only applies the flags if the command/subcommand has a parent with that name, if left empty no filtering is done -// -// Taken from: https://github.com/smartcontractkit/chainlink/blob/develop/core/cmd/shell_test.go#L590 -func flagSetApplyFromAction(action interface{}, flagSet *flag.FlagSet, parentCommand string) { - cliApp := cmd.Shell{} - app := cmd.NewApp(&cliApp) - - foundName := parentCommand == "" - actionFuncName := getFuncName(action) - - for _, command := range app.Commands { - flags := recursiveFindFlagsWithName(actionFuncName, command, parentCommand, foundName) - - for _, flag := range flags { - flag.Apply(flagSet) - } - } -} - -func recursiveFindFlagsWithName(actionFuncName string, command cli.Command, parent string, foundName bool) []cli.Flag { - if command.Action != nil { - if actionFuncName == getFuncName(command.Action) && foundName { - return command.Flags - } - } - - for _, subcommand := range command.Subcommands { - if !foundName { - foundName = strings.EqualFold(subcommand.Name, parent) - } - - found := recursiveFindFlagsWithName(actionFuncName, subcommand, parent, foundName) - if found != nil { - return found - } + api.withFlags(api.methods.ReplayFromBlock, func(fs *flag.FlagSet) { + err = fs.Set("block-number", fmt.Sprint(deployedContracts.SetConfigTxBlock)) + helpers.PanicErr(err) + err = fs.Set("evm-chain-id", fmt.Sprint(*chainID)) + helpers.PanicErr(err) + }).mustExec() } - return nil -} - -func getFuncName(i interface{}) string { - return runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name() } diff --git a/core/scripts/keystone/src/99_app.go b/core/scripts/keystone/src/99_app.go index 6e59932aa71..9a8fbad9e96 100644 --- a/core/scripts/keystone/src/99_app.go +++ b/core/scripts/keystone/src/99_app.go @@ -1,11 +1,20 @@ package src import ( + "bytes" + "encoding/json" + "errors" "flag" + "fmt" "io" + "reflect" + "runtime" + "strings" "github.com/urfave/cli" + "github.com/smartcontractkit/chainlink/v2/core/cmd" + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" clcmd "github.com/smartcontractkit/chainlink/v2/core/cmd" ) @@ -29,3 +38,135 @@ func newApp(n *node, writer io.Writer) (*clcmd.Shell, *cli.App) { client.Renderer = clcmd.RendererJSON{Writer: writer} return client, app } + +type nodeAPI struct { + methods *cmd.Shell + app *cli.App + output *bytes.Buffer + fs *flag.FlagSet + clientMethod func(*cli.Context) error +} + +func newNodeAPI(n *node) *nodeAPI { + output := &bytes.Buffer{} + methods, app := newApp(n, output) + + api := &nodeAPI{ + output: output, + methods: methods, + app: app, + fs: flag.NewFlagSet("test", flag.ContinueOnError), + } + + api.withFlags(api.methods.RemoteLogin, + func(fs *flag.FlagSet) { + fs.Set("bypass-version-check", fmt.Sprint(true)) + }).mustExec() + + return api +} + +func (c *nodeAPI) withArg(arg string) *nodeAPI { + + err := c.fs.Parse([]string{arg}) + helpers.PanicErr(err) + + return c +} + +func (c *nodeAPI) withArgs(args ...string) *nodeAPI { + err := c.fs.Parse(args) + helpers.PanicErr(err) + + return c +} + +func (c *nodeAPI) withFlags(clientMethod func(*cli.Context) error, applyFlags func(*flag.FlagSet)) *nodeAPI { + flagSetApplyFromAction(clientMethod, c.fs, "") + applyFlags(c.fs) + + c.clientMethod = clientMethod + + return c +} + +func (c *nodeAPI) exec(clientMethod ...func(*cli.Context) error) ([]byte, error) { + if len(clientMethod) > 1 { + PanicErr(errors.New("Only one client method allowed")) + } + + c.output.Reset() + defer c.output.Reset() + defer func() { c.fs = flag.NewFlagSet("test", flag.ContinueOnError) }() + + if c.clientMethod == nil { + c.clientMethod = clientMethod[0] + } + ctx := cli.NewContext(c.app, c.fs, nil) + err := c.clientMethod(ctx) + if err != nil { + return nil, err + } + + return c.output.Bytes(), nil +} + +func (c *nodeAPI) mustExec(clientMethod ...func(*cli.Context) error) []byte { + bytes, err := c.exec(clientMethod...) + helpers.PanicErr(err) + return bytes +} + +// flagSetApplyFromAction applies the flags from action to the flagSet. +// +// `parentCommand` will filter the app commands and only applies the flags if the command/subcommand has a parent with that name, if left empty no filtering is done +// +// Taken from: https://github.com/smartcontractkit/chainlink/blob/develop/core/cmd/shell_test.go#L590 +func flagSetApplyFromAction(action interface{}, flagSet *flag.FlagSet, parentCommand string) { + cliApp := cmd.Shell{} + app := cmd.NewApp(&cliApp) + + foundName := parentCommand == "" + actionFuncName := getFuncName(action) + + for _, command := range app.Commands { + flags := recursiveFindFlagsWithName(actionFuncName, command, parentCommand, foundName) + + for _, flag := range flags { + flag.Apply(flagSet) + } + } +} + +func recursiveFindFlagsWithName(actionFuncName string, command cli.Command, parent string, foundName bool) []cli.Flag { + if command.Action != nil { + if actionFuncName == getFuncName(command.Action) && foundName { + return command.Flags + } + } + + for _, subcommand := range command.Subcommands { + if !foundName { + foundName = strings.EqualFold(subcommand.Name, parent) + } + + found := recursiveFindFlagsWithName(actionFuncName, subcommand, parent, foundName) + if found != nil { + return found + } + } + return nil +} + +func getFuncName(i interface{}) string { + return runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name() +} + +func mustJSON[T any](bytes []byte) *T { + typedPayload := new(T) + err := json.Unmarshal(bytes, typedPayload) + if err != nil { + PanicErr(err) + } + return typedPayload +} From 11f32e99eeca44b4226def3575122b62d6331d39 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:10:52 -0700 Subject: [PATCH 002/117] Add streams trigger template --- .../keystone/templates/streams_trigger.toml | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 core/scripts/keystone/templates/streams_trigger.toml diff --git a/core/scripts/keystone/templates/streams_trigger.toml b/core/scripts/keystone/templates/streams_trigger.toml new file mode 100644 index 00000000000..370ed64e736 --- /dev/null +++ b/core/scripts/keystone/templates/streams_trigger.toml @@ -0,0 +1,76 @@ +name = "MATIC/USD-RefPrice-DFstaging-Premium-ArbitrumSepolia-001 | {{ feed_id }} | verifier_proxy {{ verifier_proxy_id }}" +type = "offchainreporting2" +schemaVersion = 1 +forwardingAllowed = false +maxTaskDuration = "0s" +contractID = "{{ contract_id }}" +relay = "evm" +pluginType = "mercury" +feedID = "{{ feed_id }}" +transmitterID = "{{ transmitter_id }}" +observationSource = """ +// data source 1 +// https://docs.chain.link/data-streams/concepts/liquidity-weighted-prices +// https://github.com/smartcontractkit/ea-framework-js/blob/272846061bd0871da41d844672509aa7b7784d62/src/adapter/lwba.ts#L62 +ds1_payload [type=bridge name="bridge-coinmetrics" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds1_benchmark [type=jsonparse path="data,mid"]; +ds1_bid [type=jsonparse path="data,bid"]; +ds1_ask [type=jsonparse path="data,ask"]; + +ds1_benchmark_multiply [type=multiply times=1000000000000000000]; +ds1_bid_multiply [type=multiply times=1000000000000000000]; +ds1_ask_multiply [type=multiply times=1000000000000000000]; +// data source 2 +ds2_payload [type=bridge name="bridge-tiingo" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds2_benchmark [type=jsonparse path="data,mid"]; +ds2_bid [type=jsonparse path="data,bid"]; +ds2_ask [type=jsonparse path="data,ask"]; + +ds2_benchmark_multiply [type=multiply times=1000000000000000000]; +ds2_bid_multiply [type=multiply times=1000000000000000000]; +ds2_ask_multiply [type=multiply times=1000000000000000000]; +// data source 3 +ds3_payload [type=bridge name="bridge-ncfx" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds3_benchmark [type=jsonparse path="data,mid"]; +ds3_bid [type=jsonparse path="data,bid"]; +ds3_ask [type=jsonparse path="data,ask"]; + +ds3_benchmark_multiply [type=multiply times=1000000000000000000]; +ds3_bid_multiply [type=multiply times=1000000000000000000]; +ds3_ask_multiply [type=multiply times=1000000000000000000]; +// benchmark +ds1_payload -> ds1_benchmark -> ds1_benchmark_multiply -> benchmark_price; +ds2_payload -> ds2_benchmark -> ds2_benchmark_multiply -> benchmark_price; +ds3_payload -> ds3_benchmark -> ds3_benchmark_multiply -> benchmark_price; +// The index is what determines how fields get assigned in a mercury report +// benchmark is always index 0 +// bid is always index 1 +// ask is always index 2 +// See https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/relay/evm/mercury/v3/data_source.go#L225 for more info +benchmark_price [type=median allowedFaults=2 index=0]; + +// bid +ds1_payload -> ds1_bid -> ds1_bid_multiply -> bid_price; +ds2_payload -> ds2_bid -> ds2_bid_multiply -> bid_price; +ds3_payload -> ds3_bid -> ds3_bid_multiply -> bid_price; +bid_price [type=median allowedFaults=2 index=1]; + +// ask +ds1_payload -> ds1_ask -> ds1_ask_multiply -> ask_price; +ds2_payload -> ds2_ask -> ds2_ask_multiply -> ask_price; +ds3_payload -> ds3_ask -> ds3_ask_multiply -> ask_price; +ask_price [type=median allowedFaults=2 index=2]; +""" + +[relayConfig] +chainID = "{{ chain_id }}" +enableTriggerCapability = true +fromBlock = "{{ from_block }}" + +[pluginConfig] +linkFeedID = "{{ link_feed_id }}" +nativeFeedID = "{{ native_feed_id }}" +# Dummy pub key +serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" +# We don't need to specify a mercury server URL here since we're using this as a trigger instead +serverURL = "wss://unknown" From 80523fe850a508ab0c6e896fc0490607f172c3e2 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:11:14 -0700 Subject: [PATCH 003/117] Add mock external adapter for v03 mercury --- .../external-adapter/99_external_adapter.go | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 core/scripts/keystone/src/external-adapter/99_external_adapter.go diff --git a/core/scripts/keystone/src/external-adapter/99_external_adapter.go b/core/scripts/keystone/src/external-adapter/99_external_adapter.go new file mode 100644 index 00000000000..4c768ce4ccd --- /dev/null +++ b/core/scripts/keystone/src/external-adapter/99_external_adapter.go @@ -0,0 +1,85 @@ +package main + +// Taken from https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/ocr2/plugins/mercury/integration_test.go#L1055 +import ( + "fmt" + "math/rand" + "net" + "net/http" + "net/http/httptest" +) + +func main() { + // Simulating MATIC/USD + initialValue := 0.4 + pctBounds := 0.3 + + externalAdapter(initialValue, "4001", pctBounds) + externalAdapter(initialValue, "4002", pctBounds) + externalAdapter(initialValue, "4003", pctBounds) + + select {} +} + +func externalAdapter(initialValue float64, port string, pctBounds float64) *httptest.Server { + // Create a custom listener on the specified port + listener, err := net.Listen("tcp", "localhost:"+port) + if err != nil { + panic(err) + } + + mid := initialValue + // we make step a tenth of the pctBounds to give ample room for the value to move + step := mid * pctBounds / 10 + bid := mid - step + ask := mid + step + // Calculate the floor and ceiling based on percentages of the initial value + ceiling := float64(initialValue) * (1 + pctBounds) + floor := float64(initialValue) * (1 - pctBounds) + + handler := http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + res.WriteHeader(http.StatusOK) + // [floor <= bid <= mid <= ask <= ceiling] + mid = adjustValue(mid, step, floor, ceiling) + bid = adjustValue(mid, step, floor, mid) + ask = adjustValue(mid, step, mid, ceiling) + + resp := fmt.Sprintf(`{"result": {"bid": %.4f, "mid": %.4f, "ask": %.4f}}`, bid, mid, ask) + + _, herr := res.Write([]byte(resp)) + if herr != nil { + fmt.Printf("failed to write response: %v", herr) + } + }) + + ea := &httptest.Server{ + Listener: listener, + Config: &http.Server{Handler: handler}, + } + ea.Start() + + fmt.Print("Mock external adapter started at ", ea.URL, "\n") + fmt.Printf("Initial value: %.4f, Floor: %.4f, Ceiling: %.4f\n", initialValue, floor, ceiling) + return ea +} + +// adjustValue takes a starting value and randomly shifts it up or down by a step. +// It ensures that the value stays within the specified bounds. +func adjustValue(start, step, floor, ceiling float64) float64 { + // Randomly choose to increase or decrease the value + if rand.Intn(2) == 0 { + step = -step + } + + // Apply the step to the starting value + newValue := start + step + + // Ensure the value is within the bounds + if newValue < floor { + newValue = floor + } else if newValue > ceiling { + newValue = ceiling + } + + return newValue +} From cd6d8619e19a5cc2f5e6d6c53c65b4ff0bd35046 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:17:11 -0700 Subject: [PATCH 004/117] First pass of streams trigger provisioning --- .../04_deploy_streams_trigger-sample.sh | 12 + core/scripts/keystone/main.go | 1 + .../src/03_deploy_streams_trigger_cmd.go | 241 +++++++++++ .../src/03_deploy_streams_trigger_cmd_test.go | 44 ++ core/scripts/keystone/src/99_files.go | 1 + .../03_deploy_streams_trigger_cmd_test.snap | 395 ++++++++++++++++++ 6 files changed, 694 insertions(+) create mode 100755 core/scripts/keystone/04_deploy_streams_trigger-sample.sh create mode 100644 core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go create mode 100644 core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go create mode 100755 core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap diff --git a/core/scripts/keystone/04_deploy_streams_trigger-sample.sh b/core/scripts/keystone/04_deploy_streams_trigger-sample.sh new file mode 100755 index 00000000000..5ccb9bcbc53 --- /dev/null +++ b/core/scripts/keystone/04_deploy_streams_trigger-sample.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# This is for arb sepolia, see jobspec on https://cl-df-mercury-arb-sepolia-0.main.stage.cldev.sh/jobs/34/definition +go run main.go \ + deploy-streams-trigger \ + --verifierproxycontractaddress=$VERIFIER_PROXY_CONTRACT_ADDRESS \ + --verifiercontractaddress=$VERIFIER_CONTRACT_ADDRESS \ + --chainid=$CHAIN_ID \ + --fromblock=$FROM_BLOCK \ + --linkfeedid=$LINK_FEED_ID \ + --nativefeedid=$NATIVE_FEED_ID \ + --feedid=$FEED_ID \ + --dryrun=true diff --git a/core/scripts/keystone/main.go b/core/scripts/keystone/main.go index 3486830ca32..6ded2f71218 100644 --- a/core/scripts/keystone/main.go +++ b/core/scripts/keystone/main.go @@ -22,6 +22,7 @@ func main() { src.NewDeployAndInitializeCapabilitiesRegistryCommand(), src.NewDeployWorkflowsCommand(), src.NewDeleteWorkflowsCommand(), + src.NewDeployStreamsTriggerCommand(), } commandsList := func(commands []command) string { diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go new file mode 100644 index 00000000000..9175e6cb415 --- /dev/null +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -0,0 +1,241 @@ +package src + +// This package deploys "offchainreporting2" job specs, which setup the streams trigger +// for the targetted node set +// See https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/ocr2/plugins/mercury/integration_test.go#L92 +// for how to setup the mercury portion of the streams trigger +// You can see how all fields are being used here: https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/ocr2/plugins/mercury/helpers_test.go#L314 +// https://github.com/smartcontractkit/infra-k8s/blob/be47098adfb605d79b5bab6aa601bcf443a6c48b/projects/chainlink/files/chainlink-clusters/cl-keystone-cap-one/config.yaml#L1 +// Trigger gets added to the registry here: https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/relay/evm/evm.go#L360 +// See integration workflow here: https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/capabilities/integration_tests/workflow.go#L15 +// ^ setup.go provides good insight too +import ( + "encoding/json" + "errors" + "flag" + "fmt" + "os" + "path/filepath" + "strconv" + "strings" + + "net/url" + + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + "github.com/smartcontractkit/chainlink/v2/core/bridges" + + "github.com/smartcontractkit/chainlink/v2/core/store/models" + "github.com/smartcontractkit/chainlink/v2/core/web/presenters" +) + +type deployStreamsTrigger struct{} + +func NewDeployStreamsTriggerCommand() *deployStreamsTrigger { + return &deployStreamsTrigger{} +} + +func (g *deployStreamsTrigger) Name() string { + return "deploy-streams-trigger" +} + +func (g *deployStreamsTrigger) Run(args []string) { + fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) + chainID := fs.Int64("chainid", 11155111, "chain id") + templatesLocation := fs.String("templates", "", "Custom templates location") + feedID := fs.String("feedid", "", "Feed ID") + linkFeedID := fs.String("linkfeedid", "", "Link Feed ID") + nativeFeedID := fs.String("nativefeedid", "", "Native Feed ID") + fromBlock := fs.Int64("fromblock", 0, "From block") + nodeList := fs.String("nodes", "", "Custom node list location") + publicKeys := fs.String("publickeys", "", "Custom public keys json location") + verifierContractAddress := fs.String("verifiercontractaddress", "", "Verifier contract address") + verifierProxyContractAddress := fs.String("verifierproxycontractaddress", "", "Verifier proxy contract address") + dryrun := fs.Bool("dryrun", false, "Dry run") + + err := fs.Parse(args) + if err != nil || chainID == nil || *chainID == 0 || + feedID == nil || *feedID == "" || + linkFeedID == nil || *linkFeedID == "" || + nativeFeedID == nil || *nativeFeedID == "" || + fromBlock == nil || *fromBlock == 0 || + verifierContractAddress == nil || *verifierContractAddress == "" || + verifierProxyContractAddress == nil || *verifierProxyContractAddress == "" { + fs.Usage() + os.Exit(1) + } + + if *publicKeys == "" { + *publicKeys = defaultPublicKeys + } + if *nodeList == "" { + *nodeList = defaultNodeList + } + if *templatesLocation == "" { + *templatesLocation = "templates" + } + + nodes := downloadNodeAPICredentials(*nodeList) + + jobspecs := genStreamsTriggerJobSpecs( + *publicKeys, + *nodeList, + *templatesLocation, + + *feedID, + *linkFeedID, + *nativeFeedID, + + *chainID, + *fromBlock, + + *verifierContractAddress, + *verifierProxyContractAddress, + ) + + // sanity check arr lengths + if len(nodes) != len(jobspecs) { + PanicErr(errors.New("Mismatched node and job spec lengths")) + } + + for i, n := range nodes { + api := newNodeAPI(n) + + specToDeploy := strings.Join(jobspecs[i], "\n") + specFragment := jobspecs[i][0:2] + if *dryrun { + fmt.Println("Dry run, skipping job deployment and bridge setup") + fmt.Printf("Deploying jobspec: %s\n... \n", specToDeploy) + continue + } else { + fmt.Printf("Deploying jobspec: %s\n... \n", specFragment) + } + + _, err := api.withArg(specToDeploy).exec(api.methods.CreateJob) + if err != nil { + fmt.Println("Failed to deploy job spec:", specFragment, "Error:", err) + } + + // hard coded bridges for now + createBridgeIfDoesNotExist(api, "bridge-coinmetrics", "http://localhost:4001") + createBridgeIfDoesNotExist(api, "bridge-tiingo", "http://localhost:4002") + createBridgeIfDoesNotExist(api, "bridge-ncfx", "http://localhost:4003") + + } +} + +func createBridgeIfDoesNotExist(api *nodeAPI, name string, eaURL string) { + if doesBridgeExist(api, name) { + fmt.Println("Bridge", name, "already exists, skipping creation") + return + } + + u, err := url.Parse(eaURL) + url := models.WebURL(*u) + // Confirmations and MinimumContractPayment are not used, so we can leave them as 0 + b := bridges.BridgeTypeRequest{ + Name: bridges.MustParseBridgeName(name), + URL: url, + } + payload, err := json.Marshal(b) + helpers.PanicErr(err) + + resp := api.withArg(string(payload)).mustExec(api.methods.CreateBridge) + resource := mustJSON[presenters.BridgeResource](resp) + fmt.Printf("Created bridge: %s %s\n", resource.Name, resource.URL) +} + +func doesBridgeExist(api *nodeAPI, name string) bool { + resp, err := api.withArg(name).exec(api.methods.ShowBridge) + + if err != nil { + return false + } + + b := mustJSON[presenters.BridgeResource](resp) + fmt.Printf("Found bridge: %s with URL: %s\n", b.Name, b.URL) + return true +} + +func genStreamsTriggerJobSpecs( + pubkeysPath string, + nodeListPath string, + templatesDir string, + + feedID string, + linkFeedID string, + nativeFeedID string, + + chainID int64, + fromBlock int64, + + verifierContractAddress string, + verifierProxyContractAddress string, +) (output [][]string) { + nodes := downloadNodeAPICredentials(nodeListPath) + nca := downloadNodePubKeys(nodeListPath, chainID, pubkeysPath) + lines, err := readLines(filepath.Join(templatesDir, streamsTriggerSpecTemplate)) + if err != nil { + PanicErr(err) + } + + for i := 0; i < len(nodes); i++ { + n := nca[i] + specLines := renderStreamsTriggerJobSpec( + lines, + + feedID, + linkFeedID, + nativeFeedID, + + chainID, + fromBlock, + + verifierContractAddress, + verifierProxyContractAddress, + + n, + ) + output = append(output, specLines) + } + + return output +} + +func renderStreamsTriggerJobSpec( + lines []string, + + feedID string, + linkFeedID string, + nativeFeedID string, + + chainID int64, + fromBlock int64, + + verifierContractAddress string, + verifierProxyContractAddress string, + + node NodeKeys, +) (output []string) { + chainIDStr := strconv.FormatInt(chainID, 10) + fromBlockStr := strconv.FormatInt(fromBlock, 10) + for _, l := range lines { + l = strings.Replace(l, "{{ feed_id }}", feedID, 1) + l = strings.Replace(l, "{{ link_feed_id }}", linkFeedID, 1) + l = strings.Replace(l, "{{ native_feed_id }}", nativeFeedID, 1) + + l = strings.Replace(l, "{{ chain_id }}", chainIDStr, 1) + l = strings.Replace(l, "{{ from_block }}", fromBlockStr, 1) + + // Verifier contract https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/ocr2/plugins/mercury/integration_test.go#L111 + l = strings.Replace(l, "{{ contract_id }}", verifierContractAddress, 1) + // Ends up just being part of the name as documentation, it's the proxy to the verifier contract + l = strings.Replace(l, "{{ verifier_proxy_id }}", verifierProxyContractAddress, 1) + + // TransmitterID is the CSA key of the node since it's offchain + // https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/ocr2/plugins/mercury/helpers_test.go#L219 + // https://github.com/smartcontractkit/chainlink-common/blob/9ee1e8cc8b9774c8f3eb92a722af5269469f46f4/pkg/types/mercury/types.go#L39 + l = strings.Replace(l, "{{ transmitter_id }}", node.CSAPublicKey, 1) + output = append(output, l) + } + return +} diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go new file mode 100644 index 00000000000..ea5ed744d29 --- /dev/null +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go @@ -0,0 +1,44 @@ +package src + +import ( + "strings" + "testing" + + "github.com/gkampitakis/go-snaps/snaps" +) + +func TestGenStreamsTriggerJobSpecs(t *testing.T) { + pubkeysPath := "./testdata/PublicKeys.json" + nodeListPath := "./testdata/NodeList.txt" + templatesDir := "../templates" + + feedID := "feed123" + linkFeedID := "linkfeed123" + nativeFeedID := "nativefeed123" + + chainID := int64(123456) + fromBlock := int64(10) + + verifierContractAddress := "verifier_contract_address" + verifierProxyContractAddress := "verifier_proxy_contract_address" + + output := genStreamsTriggerJobSpecs( + pubkeysPath, + nodeListPath, + templatesDir, + feedID, + linkFeedID, + nativeFeedID, + chainID, + fromBlock, + verifierContractAddress, + verifierProxyContractAddress, + ) + prettyOutputs := []string{} + for _, o := range output { + prettyOutputs = append(prettyOutputs, strings.Join(o, "\n")) + } + + testOutput := strings.Join(prettyOutputs, "\n\n-------------------------------------------------\n\n") + snaps.MatchSnapshot(t, testOutput) +} diff --git a/core/scripts/keystone/src/99_files.go b/core/scripts/keystone/src/99_files.go index 08ba12e4194..f1837d2379a 100644 --- a/core/scripts/keystone/src/99_files.go +++ b/core/scripts/keystone/src/99_files.go @@ -16,6 +16,7 @@ const ( defaultNodeList = ".cache/NodeList.txt" deployedContractsJSON = "deployed_contracts.json" bootstrapSpecTemplate = "bootstrap.toml" + streamsTriggerSpecTemplate = "streams_trigger.toml" cribOverrideTemplate = "crib-overrides.yaml" oracleSpecTemplate = "oracle.toml" ) diff --git a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap new file mode 100755 index 00000000000..40a5062b54b --- /dev/null +++ b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap @@ -0,0 +1,395 @@ + +[TestGenStreamsTriggerJobSpecs - 1] +name = "MATIC/USD-RefPrice-DFstaging-Premium-ArbitrumSepolia-001 | feed123 | verifier_proxy verifier_proxy_contract_address" +type = "offchainreporting2" +schemaVersion = 1 +forwardingAllowed = false +maxTaskDuration = "0s" +contractID = "verifier_contract_address" +relay = "evm" +pluginType = "mercury" +feedID = "feed123" +transmitterID = "csa_dbae6965bad0b0fa95ecc34a602eee1c0c570ddc29b56502e400d18574b8c3df" +observationSource = """ +// data source 1 +// https://docs.chain.link/data-streams/concepts/liquidity-weighted-prices +// https://github.com/smartcontractkit/ea-framework-js/blob/272846061bd0871da41d844672509aa7b7784d62/src/adapter/lwba.ts#L62 +ds1_payload [type=bridge name="bridge-coinmetrics" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds1_benchmark [type=jsonparse path="data,mid"]; +ds1_bid [type=jsonparse path="data,bid"]; +ds1_ask [type=jsonparse path="data,ask"]; + +ds1_benchmark_multiply [type=multiply times=1000000000000000000]; +ds1_bid_multiply [type=multiply times=1000000000000000000]; +ds1_ask_multiply [type=multiply times=1000000000000000000]; +// data source 2 +ds2_payload [type=bridge name="bridge-tiingo" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds2_benchmark [type=jsonparse path="data,mid"]; +ds2_bid [type=jsonparse path="data,bid"]; +ds2_ask [type=jsonparse path="data,ask"]; + +ds2_benchmark_multiply [type=multiply times=1000000000000000000]; +ds2_bid_multiply [type=multiply times=1000000000000000000]; +ds2_ask_multiply [type=multiply times=1000000000000000000]; +// data source 3 +ds3_payload [type=bridge name="bridge-ncfx" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds3_benchmark [type=jsonparse path="data,mid"]; +ds3_bid [type=jsonparse path="data,bid"]; +ds3_ask [type=jsonparse path="data,ask"]; + +ds3_benchmark_multiply [type=multiply times=1000000000000000000]; +ds3_bid_multiply [type=multiply times=1000000000000000000]; +ds3_ask_multiply [type=multiply times=1000000000000000000]; +// benchmark +ds1_payload -> ds1_benchmark -> ds1_benchmark_multiply -> benchmark_price; +ds2_payload -> ds2_benchmark -> ds2_benchmark_multiply -> benchmark_price; +ds3_payload -> ds3_benchmark -> ds3_benchmark_multiply -> benchmark_price; +// The index is what determines how fields get assigned in a mercury report +// benchmark is always index 0 +// bid is always index 1 +// ask is always index 2 +// See https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/relay/evm/mercury/v3/data_source.go#L225 for more info +benchmark_price [type=median allowedFaults=2 index=0]; + +// bid +ds1_payload -> ds1_bid -> ds1_bid_multiply -> bid_price; +ds2_payload -> ds2_bid -> ds2_bid_multiply -> bid_price; +ds3_payload -> ds3_bid -> ds3_bid_multiply -> bid_price; +bid_price [type=median allowedFaults=2 index=1]; + +// ask +ds1_payload -> ds1_ask -> ds1_ask_multiply -> ask_price; +ds2_payload -> ds2_ask -> ds2_ask_multiply -> ask_price; +ds3_payload -> ds3_ask -> ds3_ask_multiply -> ask_price; +ask_price [type=median allowedFaults=2 index=2]; +""" + +[relayConfig] +chainID = "123456" +enableTriggerCapability = true +fromBlock = "10" + +[pluginConfig] +linkFeedID = "linkfeed123" +nativeFeedID = "nativefeed123" +# Dummy pub key +serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" +# We don't need to specify a mercury server URL here since we're using this as a trigger instead +serverURL = "wss://unknown" + +------------------------------------------------- + +name = "MATIC/USD-RefPrice-DFstaging-Premium-ArbitrumSepolia-001 | feed123 | verifier_proxy verifier_proxy_contract_address" +type = "offchainreporting2" +schemaVersion = 1 +forwardingAllowed = false +maxTaskDuration = "0s" +contractID = "verifier_contract_address" +relay = "evm" +pluginType = "mercury" +feedID = "feed123" +transmitterID = "csa_c5cc655a9c19b69626519c4a72c44a94a3675daeba9c16cc23e010a7a6dac1be" +observationSource = """ +// data source 1 +// https://docs.chain.link/data-streams/concepts/liquidity-weighted-prices +// https://github.com/smartcontractkit/ea-framework-js/blob/272846061bd0871da41d844672509aa7b7784d62/src/adapter/lwba.ts#L62 +ds1_payload [type=bridge name="bridge-coinmetrics" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds1_benchmark [type=jsonparse path="data,mid"]; +ds1_bid [type=jsonparse path="data,bid"]; +ds1_ask [type=jsonparse path="data,ask"]; + +ds1_benchmark_multiply [type=multiply times=1000000000000000000]; +ds1_bid_multiply [type=multiply times=1000000000000000000]; +ds1_ask_multiply [type=multiply times=1000000000000000000]; +// data source 2 +ds2_payload [type=bridge name="bridge-tiingo" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds2_benchmark [type=jsonparse path="data,mid"]; +ds2_bid [type=jsonparse path="data,bid"]; +ds2_ask [type=jsonparse path="data,ask"]; + +ds2_benchmark_multiply [type=multiply times=1000000000000000000]; +ds2_bid_multiply [type=multiply times=1000000000000000000]; +ds2_ask_multiply [type=multiply times=1000000000000000000]; +// data source 3 +ds3_payload [type=bridge name="bridge-ncfx" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds3_benchmark [type=jsonparse path="data,mid"]; +ds3_bid [type=jsonparse path="data,bid"]; +ds3_ask [type=jsonparse path="data,ask"]; + +ds3_benchmark_multiply [type=multiply times=1000000000000000000]; +ds3_bid_multiply [type=multiply times=1000000000000000000]; +ds3_ask_multiply [type=multiply times=1000000000000000000]; +// benchmark +ds1_payload -> ds1_benchmark -> ds1_benchmark_multiply -> benchmark_price; +ds2_payload -> ds2_benchmark -> ds2_benchmark_multiply -> benchmark_price; +ds3_payload -> ds3_benchmark -> ds3_benchmark_multiply -> benchmark_price; +// The index is what determines how fields get assigned in a mercury report +// benchmark is always index 0 +// bid is always index 1 +// ask is always index 2 +// See https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/relay/evm/mercury/v3/data_source.go#L225 for more info +benchmark_price [type=median allowedFaults=2 index=0]; + +// bid +ds1_payload -> ds1_bid -> ds1_bid_multiply -> bid_price; +ds2_payload -> ds2_bid -> ds2_bid_multiply -> bid_price; +ds3_payload -> ds3_bid -> ds3_bid_multiply -> bid_price; +bid_price [type=median allowedFaults=2 index=1]; + +// ask +ds1_payload -> ds1_ask -> ds1_ask_multiply -> ask_price; +ds2_payload -> ds2_ask -> ds2_ask_multiply -> ask_price; +ds3_payload -> ds3_ask -> ds3_ask_multiply -> ask_price; +ask_price [type=median allowedFaults=2 index=2]; +""" + +[relayConfig] +chainID = "123456" +enableTriggerCapability = true +fromBlock = "10" + +[pluginConfig] +linkFeedID = "linkfeed123" +nativeFeedID = "nativefeed123" +# Dummy pub key +serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" +# We don't need to specify a mercury server URL here since we're using this as a trigger instead +serverURL = "wss://unknown" + +------------------------------------------------- + +name = "MATIC/USD-RefPrice-DFstaging-Premium-ArbitrumSepolia-001 | feed123 | verifier_proxy verifier_proxy_contract_address" +type = "offchainreporting2" +schemaVersion = 1 +forwardingAllowed = false +maxTaskDuration = "0s" +contractID = "verifier_contract_address" +relay = "evm" +pluginType = "mercury" +feedID = "feed123" +transmitterID = "csa_7407fc90c70895c0fb2bdf385e2e4918364bec1f7a74bad7fdf696bffafbcab8" +observationSource = """ +// data source 1 +// https://docs.chain.link/data-streams/concepts/liquidity-weighted-prices +// https://github.com/smartcontractkit/ea-framework-js/blob/272846061bd0871da41d844672509aa7b7784d62/src/adapter/lwba.ts#L62 +ds1_payload [type=bridge name="bridge-coinmetrics" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds1_benchmark [type=jsonparse path="data,mid"]; +ds1_bid [type=jsonparse path="data,bid"]; +ds1_ask [type=jsonparse path="data,ask"]; + +ds1_benchmark_multiply [type=multiply times=1000000000000000000]; +ds1_bid_multiply [type=multiply times=1000000000000000000]; +ds1_ask_multiply [type=multiply times=1000000000000000000]; +// data source 2 +ds2_payload [type=bridge name="bridge-tiingo" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds2_benchmark [type=jsonparse path="data,mid"]; +ds2_bid [type=jsonparse path="data,bid"]; +ds2_ask [type=jsonparse path="data,ask"]; + +ds2_benchmark_multiply [type=multiply times=1000000000000000000]; +ds2_bid_multiply [type=multiply times=1000000000000000000]; +ds2_ask_multiply [type=multiply times=1000000000000000000]; +// data source 3 +ds3_payload [type=bridge name="bridge-ncfx" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds3_benchmark [type=jsonparse path="data,mid"]; +ds3_bid [type=jsonparse path="data,bid"]; +ds3_ask [type=jsonparse path="data,ask"]; + +ds3_benchmark_multiply [type=multiply times=1000000000000000000]; +ds3_bid_multiply [type=multiply times=1000000000000000000]; +ds3_ask_multiply [type=multiply times=1000000000000000000]; +// benchmark +ds1_payload -> ds1_benchmark -> ds1_benchmark_multiply -> benchmark_price; +ds2_payload -> ds2_benchmark -> ds2_benchmark_multiply -> benchmark_price; +ds3_payload -> ds3_benchmark -> ds3_benchmark_multiply -> benchmark_price; +// The index is what determines how fields get assigned in a mercury report +// benchmark is always index 0 +// bid is always index 1 +// ask is always index 2 +// See https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/relay/evm/mercury/v3/data_source.go#L225 for more info +benchmark_price [type=median allowedFaults=2 index=0]; + +// bid +ds1_payload -> ds1_bid -> ds1_bid_multiply -> bid_price; +ds2_payload -> ds2_bid -> ds2_bid_multiply -> bid_price; +ds3_payload -> ds3_bid -> ds3_bid_multiply -> bid_price; +bid_price [type=median allowedFaults=2 index=1]; + +// ask +ds1_payload -> ds1_ask -> ds1_ask_multiply -> ask_price; +ds2_payload -> ds2_ask -> ds2_ask_multiply -> ask_price; +ds3_payload -> ds3_ask -> ds3_ask_multiply -> ask_price; +ask_price [type=median allowedFaults=2 index=2]; +""" + +[relayConfig] +chainID = "123456" +enableTriggerCapability = true +fromBlock = "10" + +[pluginConfig] +linkFeedID = "linkfeed123" +nativeFeedID = "nativefeed123" +# Dummy pub key +serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" +# We don't need to specify a mercury server URL here since we're using this as a trigger instead +serverURL = "wss://unknown" + +------------------------------------------------- + +name = "MATIC/USD-RefPrice-DFstaging-Premium-ArbitrumSepolia-001 | feed123 | verifier_proxy verifier_proxy_contract_address" +type = "offchainreporting2" +schemaVersion = 1 +forwardingAllowed = false +maxTaskDuration = "0s" +contractID = "verifier_contract_address" +relay = "evm" +pluginType = "mercury" +feedID = "feed123" +transmitterID = "csa_ef55caf17eefc2a9d547b5a3978d396bd237c73af99cd849a4758701122e3cba" +observationSource = """ +// data source 1 +// https://docs.chain.link/data-streams/concepts/liquidity-weighted-prices +// https://github.com/smartcontractkit/ea-framework-js/blob/272846061bd0871da41d844672509aa7b7784d62/src/adapter/lwba.ts#L62 +ds1_payload [type=bridge name="bridge-coinmetrics" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds1_benchmark [type=jsonparse path="data,mid"]; +ds1_bid [type=jsonparse path="data,bid"]; +ds1_ask [type=jsonparse path="data,ask"]; + +ds1_benchmark_multiply [type=multiply times=1000000000000000000]; +ds1_bid_multiply [type=multiply times=1000000000000000000]; +ds1_ask_multiply [type=multiply times=1000000000000000000]; +// data source 2 +ds2_payload [type=bridge name="bridge-tiingo" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds2_benchmark [type=jsonparse path="data,mid"]; +ds2_bid [type=jsonparse path="data,bid"]; +ds2_ask [type=jsonparse path="data,ask"]; + +ds2_benchmark_multiply [type=multiply times=1000000000000000000]; +ds2_bid_multiply [type=multiply times=1000000000000000000]; +ds2_ask_multiply [type=multiply times=1000000000000000000]; +// data source 3 +ds3_payload [type=bridge name="bridge-ncfx" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds3_benchmark [type=jsonparse path="data,mid"]; +ds3_bid [type=jsonparse path="data,bid"]; +ds3_ask [type=jsonparse path="data,ask"]; + +ds3_benchmark_multiply [type=multiply times=1000000000000000000]; +ds3_bid_multiply [type=multiply times=1000000000000000000]; +ds3_ask_multiply [type=multiply times=1000000000000000000]; +// benchmark +ds1_payload -> ds1_benchmark -> ds1_benchmark_multiply -> benchmark_price; +ds2_payload -> ds2_benchmark -> ds2_benchmark_multiply -> benchmark_price; +ds3_payload -> ds3_benchmark -> ds3_benchmark_multiply -> benchmark_price; +// The index is what determines how fields get assigned in a mercury report +// benchmark is always index 0 +// bid is always index 1 +// ask is always index 2 +// See https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/relay/evm/mercury/v3/data_source.go#L225 for more info +benchmark_price [type=median allowedFaults=2 index=0]; + +// bid +ds1_payload -> ds1_bid -> ds1_bid_multiply -> bid_price; +ds2_payload -> ds2_bid -> ds2_bid_multiply -> bid_price; +ds3_payload -> ds3_bid -> ds3_bid_multiply -> bid_price; +bid_price [type=median allowedFaults=2 index=1]; + +// ask +ds1_payload -> ds1_ask -> ds1_ask_multiply -> ask_price; +ds2_payload -> ds2_ask -> ds2_ask_multiply -> ask_price; +ds3_payload -> ds3_ask -> ds3_ask_multiply -> ask_price; +ask_price [type=median allowedFaults=2 index=2]; +""" + +[relayConfig] +chainID = "123456" +enableTriggerCapability = true +fromBlock = "10" + +[pluginConfig] +linkFeedID = "linkfeed123" +nativeFeedID = "nativefeed123" +# Dummy pub key +serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" +# We don't need to specify a mercury server URL here since we're using this as a trigger instead +serverURL = "wss://unknown" + +------------------------------------------------- + +name = "MATIC/USD-RefPrice-DFstaging-Premium-ArbitrumSepolia-001 | feed123 | verifier_proxy verifier_proxy_contract_address" +type = "offchainreporting2" +schemaVersion = 1 +forwardingAllowed = false +maxTaskDuration = "0s" +contractID = "verifier_contract_address" +relay = "evm" +pluginType = "mercury" +feedID = "feed123" +transmitterID = "csa_1b874ac2d54b966cec5a8358678ca6f030261aabf3372ce9dbea2d4eb9cdab3d" +observationSource = """ +// data source 1 +// https://docs.chain.link/data-streams/concepts/liquidity-weighted-prices +// https://github.com/smartcontractkit/ea-framework-js/blob/272846061bd0871da41d844672509aa7b7784d62/src/adapter/lwba.ts#L62 +ds1_payload [type=bridge name="bridge-coinmetrics" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds1_benchmark [type=jsonparse path="data,mid"]; +ds1_bid [type=jsonparse path="data,bid"]; +ds1_ask [type=jsonparse path="data,ask"]; + +ds1_benchmark_multiply [type=multiply times=1000000000000000000]; +ds1_bid_multiply [type=multiply times=1000000000000000000]; +ds1_ask_multiply [type=multiply times=1000000000000000000]; +// data source 2 +ds2_payload [type=bridge name="bridge-tiingo" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds2_benchmark [type=jsonparse path="data,mid"]; +ds2_bid [type=jsonparse path="data,bid"]; +ds2_ask [type=jsonparse path="data,ask"]; + +ds2_benchmark_multiply [type=multiply times=1000000000000000000]; +ds2_bid_multiply [type=multiply times=1000000000000000000]; +ds2_ask_multiply [type=multiply times=1000000000000000000]; +// data source 3 +ds3_payload [type=bridge name="bridge-ncfx" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; +ds3_benchmark [type=jsonparse path="data,mid"]; +ds3_bid [type=jsonparse path="data,bid"]; +ds3_ask [type=jsonparse path="data,ask"]; + +ds3_benchmark_multiply [type=multiply times=1000000000000000000]; +ds3_bid_multiply [type=multiply times=1000000000000000000]; +ds3_ask_multiply [type=multiply times=1000000000000000000]; +// benchmark +ds1_payload -> ds1_benchmark -> ds1_benchmark_multiply -> benchmark_price; +ds2_payload -> ds2_benchmark -> ds2_benchmark_multiply -> benchmark_price; +ds3_payload -> ds3_benchmark -> ds3_benchmark_multiply -> benchmark_price; +// The index is what determines how fields get assigned in a mercury report +// benchmark is always index 0 +// bid is always index 1 +// ask is always index 2 +// See https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/relay/evm/mercury/v3/data_source.go#L225 for more info +benchmark_price [type=median allowedFaults=2 index=0]; + +// bid +ds1_payload -> ds1_bid -> ds1_bid_multiply -> bid_price; +ds2_payload -> ds2_bid -> ds2_bid_multiply -> bid_price; +ds3_payload -> ds3_bid -> ds3_bid_multiply -> bid_price; +bid_price [type=median allowedFaults=2 index=1]; + +// ask +ds1_payload -> ds1_ask -> ds1_ask_multiply -> ask_price; +ds2_payload -> ds2_ask -> ds2_ask_multiply -> ask_price; +ds3_payload -> ds3_ask -> ds3_ask_multiply -> ask_price; +ask_price [type=median allowedFaults=2 index=2]; +""" + +[relayConfig] +chainID = "123456" +enableTriggerCapability = true +fromBlock = "10" + +[pluginConfig] +linkFeedID = "linkfeed123" +nativeFeedID = "nativefeed123" +# Dummy pub key +serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" +# We don't need to specify a mercury server URL here since we're using this as a trigger instead +serverURL = "wss://unknown" +--- From a2a3c296a26e5f18f8a4641ac069ec4538e176b3 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Sat, 7 Sep 2024 13:29:01 -0700 Subject: [PATCH 005/117] WIP: Add capabilities registry provisioner script --- ..._provision_capabilities_registry-sample.sh | 6 + core/scripts/keystone/main.go | 1 + .../keystone/src/01_deploy_contracts_cmd.go | 19 +- ...deploy_initialize_capabilities_registry.go | 90 +--- .../src/06_provision_capabilities_registry.go | 124 +++++ .../keystone/src/88_capabilities_registry.go | 464 ++++++++++++++++++ 6 files changed, 614 insertions(+), 90 deletions(-) create mode 100644 core/scripts/keystone/06_provision_capabilities_registry-sample.sh create mode 100644 core/scripts/keystone/src/06_provision_capabilities_registry.go create mode 100644 core/scripts/keystone/src/88_capabilities_registry.go diff --git a/core/scripts/keystone/06_provision_capabilities_registry-sample.sh b/core/scripts/keystone/06_provision_capabilities_registry-sample.sh new file mode 100644 index 00000000000..ede7cccfdcc --- /dev/null +++ b/core/scripts/keystone/06_provision_capabilities_registry-sample.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +go run main.go provision-capabilites-registry \ + --chainid=11155111 \ + --ethurl=$ETH_URL \ + --accountkey=$ACCOUNT_KEY diff --git a/core/scripts/keystone/main.go b/core/scripts/keystone/main.go index 6ded2f71218..2d56494a325 100644 --- a/core/scripts/keystone/main.go +++ b/core/scripts/keystone/main.go @@ -23,6 +23,7 @@ func main() { src.NewDeployWorkflowsCommand(), src.NewDeleteWorkflowsCommand(), src.NewDeployStreamsTriggerCommand(), + src.NewProvisionCapabilitesRegistryCommand(), } commandsList := func(commands []command) string { diff --git a/core/scripts/keystone/src/01_deploy_contracts_cmd.go b/core/scripts/keystone/src/01_deploy_contracts_cmd.go index 6fc3f1399cf..efe09c61339 100644 --- a/core/scripts/keystone/src/01_deploy_contracts_cmd.go +++ b/core/scripts/keystone/src/01_deploy_contracts_cmd.go @@ -18,8 +18,9 @@ import ( ) type deployedContracts struct { - OCRContract common.Address `json:"ocrContract"` - ForwarderContract common.Address `json:"forwarderContract"` + OCRContract common.Address `json:"ocrContract"` + ForwarderContract common.Address `json:"forwarderContract"` + CapabilityRegsitry common.Address `json:"capabilityRegistry"` // The block number of the transaction that set the config on the OCR3 contract. We use this to replay blocks from this point on // when we load the OCR3 job specs on the nodes. SetConfigTxBlock uint64 `json:"setConfigTxBlock"` @@ -134,11 +135,7 @@ func deploy( OCRContract: ocrContract.Address(), ForwarderContract: forwarderContract.Address(), } - jsonBytes, err := json.Marshal(contracts) - PanicErr(err) - - err = os.WriteFile(DeployedContractsFilePath(artefacts), jsonBytes, 0600) - PanicErr(err) + WriteDeployedContracts(contracts, artefacts) setOCR3Config(env, ocrConfig, artefacts) @@ -179,9 +176,13 @@ func setOCR3Config( // Write blocknumber of the transaction to the deployed contracts file loadedContracts.SetConfigTxBlock = receipt.BlockNumber.Uint64() - jsonBytes, err := json.Marshal(loadedContracts) + WriteDeployedContracts(loadedContracts, artefacts) +} + +func WriteDeployedContracts(contracts deployedContracts, artefactsDir string) { + jsonBytes, err := json.Marshal(contracts) PanicErr(err) - err = os.WriteFile(DeployedContractsFilePath(artefacts), jsonBytes, 0600) + err = os.WriteFile(DeployedContractsFilePath(artefactsDir), jsonBytes, 0600) PanicErr(err) } diff --git a/core/scripts/keystone/src/05_deploy_initialize_capabilities_registry.go b/core/scripts/keystone/src/05_deploy_initialize_capabilities_registry.go index f4e394b7da5..9414987737a 100644 --- a/core/scripts/keystone/src/05_deploy_initialize_capabilities_registry.go +++ b/core/scripts/keystone/src/05_deploy_initialize_capabilities_registry.go @@ -2,20 +2,16 @@ package src import ( "context" - "encoding/hex" "flag" "fmt" "log" "os" - "strings" "time" "github.com/ethereum/go-ethereum/common" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/durationpb" - ragetypes "github.com/smartcontractkit/libocr/ragep2p/types" - capabilitiespb "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb" "github.com/smartcontractkit/chainlink-common/pkg/values" @@ -32,7 +28,7 @@ type peer struct { } var ( - workflowDonPeers = []peer{ + hardcodedWorkflowDonPeers = []peer{ { PeerID: "12D3KooWBCF1XT5Wi8FzfgNCqRL76Swv8TRU3TiD4QiJm8NMNX7N", Signer: "0x9639dCc7D0ca4468B5f684ef89F12F0B365c9F6d", @@ -69,7 +65,7 @@ var ( EncryptionPublicKey: "0xed64ed4a2c2954f7390bfdf41a714934c0e55693ad1c0b91505d51f4eb9e4c06", }, } - triggerDonPeers = []peer{ + hardCodedTriggerDonPeers = []peer{ { PeerID: "12D3KooWBaiTbbRwwt2fbNifiL7Ew9tn3vds9AJE3Nf3eaVBX36m", Signer: "0x9CcE7293a4Cc2621b61193135A95928735e4795F", @@ -106,7 +102,7 @@ var ( EncryptionPublicKey: "0x54176f154052068943569b676fa7eec7dc836e17bbe743ce56b1c7e205191d9c", }, } - targetDonPeers = []peer{ + hardcodedTargetDonPeers = []peer{ { PeerID: "12D3KooWJrthXtnPHw7xyHFAxo6NxifYTvc8igKYaA6wRRRqtsMb", Signer: "0x3F82750353Ea7a051ec9bA011BC628284f9a5327", @@ -174,74 +170,6 @@ func (c *deployAndInitializeCapabilitiesRegistryCommand) Name() string { return "deploy-and-initialize-capabilities-registry" } -func peerIDToB(peerID string) ([32]byte, error) { - var peerIDB ragetypes.PeerID - err := peerIDB.UnmarshalText([]byte(peerID)) - if err != nil { - return [32]byte{}, err - } - - return peerIDB, nil -} - -func peers(ps []peer) ([][32]byte, error) { - out := [][32]byte{} - for _, p := range ps { - b, err := peerIDToB(p.PeerID) - if err != nil { - return nil, err - } - - out = append(out, b) - } - - return out, nil -} - -func peerToNode(nopID uint32, p peer) (kcr.CapabilitiesRegistryNodeParams, error) { - peerIDB, err := peerIDToB(p.PeerID) - if err != nil { - return kcr.CapabilitiesRegistryNodeParams{}, fmt.Errorf("failed to convert peerID: %w", err) - } - - sig := strings.TrimPrefix(p.Signer, "0x") - signerB, err := hex.DecodeString(sig) - if err != nil { - return kcr.CapabilitiesRegistryNodeParams{}, fmt.Errorf("failed to convert signer: %w", err) - } - - keyStr := strings.TrimPrefix(p.EncryptionPublicKey, "0x") - encKey, err := hex.DecodeString(keyStr) - if err != nil { - return kcr.CapabilitiesRegistryNodeParams{}, fmt.Errorf("failed to convert encryptionPublicKey: %w", err) - } - - var sigb [32]byte - var encKeyB [32]byte - copy(sigb[:], signerB) - copy(encKeyB[:], encKey) - - return kcr.CapabilitiesRegistryNodeParams{ - NodeOperatorId: nopID, - P2pId: peerIDB, - Signer: sigb, - EncryptionPublicKey: encKeyB, - }, nil -} - -// newCapabilityConfig returns a new capability config with the default config set as empty. -// Override the empty default config with functional options. -func newCapabilityConfig(opts ...func(*values.Map)) *capabilitiespb.CapabilityConfig { - dc := values.EmptyMap() - for _, opt := range opts { - opt(dc) - } - - return &capabilitiespb.CapabilityConfig{ - DefaultConfig: values.ProtoMap(dc), - } -} - // withDefaultConfig returns a function that sets the default config for a capability by merging // the provided map with the existing default config. This is a shallow merge. func withDefaultConfig(m map[string]any) func(*values.Map) { @@ -392,7 +320,7 @@ func (c *deployAndInitializeCapabilitiesRegistryCommand) Run(args []string) { nopID := recLog.NodeOperatorId nodes := []kcr.CapabilitiesRegistryNodeParams{} - for _, wfPeer := range workflowDonPeers { + for _, wfPeer := range hardcodedWorkflowDonPeers { n, innerErr := peerToNode(nopID, wfPeer) if innerErr != nil { panic(innerErr) @@ -402,7 +330,7 @@ func (c *deployAndInitializeCapabilitiesRegistryCommand) Run(args []string) { nodes = append(nodes, n) } - for _, triggerPeer := range triggerDonPeers { + for _, triggerPeer := range hardCodedTriggerDonPeers { n, innerErr := peerToNode(nopID, triggerPeer) if innerErr != nil { panic(innerErr) @@ -412,7 +340,7 @@ func (c *deployAndInitializeCapabilitiesRegistryCommand) Run(args []string) { nodes = append(nodes, n) } - for _, targetPeer := range targetDonPeers { + for _, targetPeer := range hardcodedTargetDonPeers { n, innerErr := peerToNode(nopID, targetPeer) if innerErr != nil { panic(innerErr) @@ -440,7 +368,7 @@ func (c *deployAndInitializeCapabilitiesRegistryCommand) Run(args []string) { helpers.ConfirmTXMined(ctx, env.Ec, tx, env.ChainID) // workflow DON - ps, err := peers(workflowDonPeers) + ps, err := peers(hardcodedWorkflowDonPeers) if err != nil { panic(err) } @@ -477,7 +405,7 @@ func (c *deployAndInitializeCapabilitiesRegistryCommand) Run(args []string) { } // trigger DON - ps, err = peers(triggerDonPeers) + ps, err = peers(hardCodedTriggerDonPeers) if err != nil { panic(err) } @@ -509,7 +437,7 @@ func (c *deployAndInitializeCapabilitiesRegistryCommand) Run(args []string) { } // target DON - ps, err = peers(targetDonPeers) + ps, err = peers(hardcodedTargetDonPeers) if err != nil { panic(err) } diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go new file mode 100644 index 00000000000..333a9434a34 --- /dev/null +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -0,0 +1,124 @@ +package src + +import ( + "context" + "flag" + "fmt" + "os" + + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" +) + +type provisionCR struct{} + +func NewProvisionCapabilitesRegistryCommand() *provisionCR { + return &provisionCR{} +} + +func (c *provisionCR) Name() string { + return "provision-capabilities-registry" +} + +func (c *provisionCR) Run(args []string) { + ctx := context.Background() + + fs := flag.NewFlagSet(c.Name(), flag.ExitOnError) + // create flags for all of the env vars then set the env vars to normalize the interface + // this is a bit of a hack but it's the easiest way to make this work + ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") + chainID := fs.Int64("chainid", 11155111, "chain ID of the Ethereum network to deploy to") + accountKey := fs.String("accountkey", "", "private key of the account to deploy from") + publicKeys := fs.String("publickeys", "", "Custom public keys json location") + nodeList := fs.String("nodes", "", "Custom node list location") + artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") + + err := fs.Parse(args) + if err != nil || + *ethUrl == "" || ethUrl == nil || + *chainID == 0 || chainID == nil || + *accountKey == "" || accountKey == nil { + fs.Usage() + os.Exit(1) + } + + if *artefactsDir == "" { + *artefactsDir = defaultArtefactsDir + } + if *publicKeys == "" { + *publicKeys = defaultPublicKeys + } + if *nodeList == "" { + *nodeList = defaultNodeList + } + + os.Setenv("ETH_URL", *ethUrl) + os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) + os.Setenv("ACCOUNT_KEY", *accountKey) + + env := helpers.SetupEnv(false) + + reg := getOrDeployCapabilitiesRegistry(ctx, *artefactsDir, env) + + // For now, trigger, target, and workflow DONs are the same node sets, and same don instance + // + // CHECKME: I *think* we can make different DON instances across the same nodes if we provision mulitiple OCR3 jobs, each other a different OCR2 key bundle so we get distinct signers yet the same PeerIDs, which makes sense since the nodes are the same + workflowDON := loadDON( + *publicKeys, + *chainID, + *nodeList, + ) + crProvisioner := NewCapabilityRegistryProvisioner(reg) + // We're using the default capability set for now + capSet := NewCapabilitySet() + crProvisioner.AddCapabilities(ctx, capSet) + + nodeOperator := NewNodeOperator(env.Owner.From, "MY_NODE_OPERATOR", workflowDON) + crProvisioner.AddNodeOperator(ctx, nodeOperator) + + // Note that both of these calls are simplified versions of the actual calls + // + // See the method documentation for more details + crProvisioner.AddNodes(ctx, nodeOperator, capSet) + crProvisioner.AddDON(ctx, nodeOperator, capSet, true, true) +} + +func loadDON(publicKeys string, chainID int64, nodeList string) []peer { + nca := downloadNodePubKeys(nodeList, chainID, publicKeys) + workflowDON := []peer{} + for _, n := range nca { + + p := peer{ + PeerID: n.P2PPeerID, + Signer: n.OCR2OnchainPublicKey, + } + workflowDON = append(workflowDON, p) + } + return workflowDON +} + +func getOrDeployCapabilitiesRegistry(ctx context.Context, artefactsDir string, env helpers.Environment) *kcr.CapabilitiesRegistry { + contracts, err := LoadDeployedContracts(artefactsDir) + if err != nil { + panic(err) + } + + if contracts.CapabilityRegsitry.String() == "0x" { + _, tx, capabilitiesRegistry, innerErr := kcr.DeployCapabilitiesRegistry(env.Owner, env.Ec) + if innerErr != nil { + panic(innerErr) + } + + helpers.ConfirmContractDeployed(ctx, env.Ec, tx, env.ChainID) + contracts.CapabilityRegsitry = capabilitiesRegistry.Address() + WriteDeployedContracts(contracts, artefactsDir) + return capabilitiesRegistry + } else { + capabilitiesRegistry, innerErr := kcr.NewCapabilitiesRegistry(contracts.CapabilityRegsitry, env.Ec) + if innerErr != nil { + panic(innerErr) + } + + return capabilitiesRegistry + } +} diff --git a/core/scripts/keystone/src/88_capabilities_registry.go b/core/scripts/keystone/src/88_capabilities_registry.go new file mode 100644 index 00000000000..17b0513ac03 --- /dev/null +++ b/core/scripts/keystone/src/88_capabilities_registry.go @@ -0,0 +1,464 @@ +package src + +import ( + "context" + "fmt" + "log" + "time" + + "strings" + + "encoding/hex" + + ragetypes "github.com/smartcontractkit/libocr/ragep2p/types" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/durationpb" + + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + + capabilitiespb "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb" + "github.com/smartcontractkit/chainlink-common/pkg/values" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + gethCommon "github.com/ethereum/go-ethereum/common" + gethTypes "github.com/ethereum/go-ethereum/core/types" + + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" +) + +type CapabilityRegistryProvisioner struct { + reg *kcr.CapabilitiesRegistry + env helpers.Environment +} + +func NewCapabilityRegistryProvisioner(reg *kcr.CapabilitiesRegistry) *CapabilityRegistryProvisioner { + return &CapabilityRegistryProvisioner{reg: reg} +} + +// AddCapabilities takes a capability set and provisions it in the registry. +func (c *CapabilityRegistryProvisioner) AddCapabilities(ctx context.Context, capSet CapabilitySet) { + tx, err := c.reg.AddCapabilities(c.env.Owner, capSet.Capabilities()) + if err != nil { + log.Printf("failed to call AddCapabilities: %s", err) + } + + helpers.ConfirmTXMined(ctx, c.env.Ec, tx, c.env.ChainID) +} + +// AddNodeOperator takes a node operator and provisions it in the registry. +// +// A node operator is a group of nodes that are all controlled by the same entity. The admin address is the +// address that controls the node operator. +// +// The name is a human-readable name for the node operator. +// +// The node operator is then added to the registry, and the registry will issue an ID for the node operator. +// The ID is then used when adding nodes to the registry such that the registry knows which nodes belong to which +// node operator. +func (c *CapabilityRegistryProvisioner) AddNodeOperator(ctx context.Context, nop NodeOperator) { + nop.BindToRegistry(c.reg) + tx, err := c.reg.AddNodeOperators(c.env.Owner, []kcr.CapabilitiesRegistryNodeOperator{ + { + Admin: nop.Admin, + Name: nop.Name, + }, + }) + if err != nil { + log.Printf("failed to AddNodeOperators: %s", err) + } + + receipt := helpers.ConfirmTXMined(ctx, c.env.Ec, tx, c.env.ChainID) + nop.SetCapabilityRegistryIssuedID(receipt) +} + +// AddNodes takes a node operators nodes, along with a capability set, then configures the registry such that +// each node is assigned the same capability set. The registry will then know that each node supports each of the +// capabilities in the set. +// +// This is a simplified version of the actual implementation, which is more flexible. The actual implementation +// allows for the ability to add different capability sets to different nodes, _and_ lets you add nodes from different +// node operators to the same capability set. This is not yet implemented here. +// +// Note that the registry must already have the capability set added via `AddCapabilities`, you cannot +// add capabilites that the registry is not yet aware of. +// +// Note that in terms of the provisioning process, this is not the last step. A capability is only active once +// there is a DON servicing yet. This is done via `AddDON`. +func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop NodeOperator, capSet CapabilitySet) { + params := []kcr.CapabilitiesRegistryNodeParams{} + for _, peer := range nop.DON { + node, innerErr := peerToNode(nop.id, peer) + if innerErr != nil { + panic(innerErr) + } + + // Technically we could be more flexible here, + // where we can have different capset assignment for each node + node.HashedCapabilityIds = capSet.CapabilityIDs() + + params = append(params, node) + } + + tx, err := c.reg.AddNodes(c.env.Owner, params) + if err != nil { + log.Printf("failed to AddNodes: %s", err) + } + helpers.ConfirmTXMined(ctx, c.env.Ec, tx, c.env.ChainID) +} + +// AddDON takes a node operator, a capability set, and provisions a DON with the given capabilities. +// +// A DON is a group of nodes that all support the same capability set. This set can be a subset of the +// capabilities that the nodes support. In other words, each node within the node set can support +// a different, possibly overlapping, set of capabilities, but a DON is a subgroup of those nodes that all support +// the same set of capabilities. +// +// A node can belong to multiple DONs, but it must belong to one and only one workflow DON. +// +// A DON can be a capability DON or a workflow DON, or both. +// +// When you want to add solely a workflow DON, you should set `acceptsWorkflows` to true and +// `isPublic` to false. +// This means that the DON can service workflow requests and will not service external capability requests. +// +// If you want to add solely a capability DON, you should set `acceptsWorkflows` to false and `isPublic` to true. This means that the DON +// will service external capability requests and reject workflow requests. +// +// If you want to add a DON that services both capabilities and workflows, you should set both `acceptsWorkflows` and `isPublic` to true. +// +// Another important distinction is that DON can comprise of nodes from different node operators, but for now, we're keeping it simple and restricting it to a single node operator. We also hard code F to 1. +func (c *CapabilityRegistryProvisioner) AddDON(ctx context.Context, nop NodeOperator, capSet CapabilitySet, isPublic bool, acceptsWorkflows bool) { + configs := capSet.Configs(c.reg) + + // Note: Technically we could be more flexible here, + // where we can have multiple DONs with different capability configurations + // and have a non-hardcoded number for F + tx, err := c.reg.AddDON(c.env.Owner, nop.MustGetPeerIDs(), configs, isPublic, acceptsWorkflows, 1) + if err != nil { + log.Printf("failed to AddDON: %s", err) + } + helpers.ConfirmTXMined(ctx, c.env.Ec, tx, c.env.ChainID) +} + +/* + * + * Capabilities + * + * + */ +const ( // Taken from https://github.com/smartcontractkit/chainlink/blob/29117850e9be1be1993dbf8f21cf13cbb6af9d24/core/capabilities/integration_tests/keystone_contracts_setup.go#L43 + CapabilityTypeTrigger = 0 + CapabilityTypeAction = 1 + CapabilityTypeConsensus = 2 + CapabilityTypeTarget = 3 +) + +type CapabillityProvisioner interface { + Config() kcr.CapabilitiesRegistryCapabilityConfiguration + Capability() kcr.CapabilitiesRegistryCapability + BindToRegistry(reg *kcr.CapabilitiesRegistry) + GetHashedCID() [32]byte +} + +type baseCapability struct { + registry *kcr.CapabilitiesRegistry + capability kcr.CapabilitiesRegistryCapability +} + +func (b *baseCapability) BindToRegistry(reg *kcr.CapabilitiesRegistry) { + b.registry = reg +} + +func (b *baseCapability) GetHashedCID() [32]byte { + if b.registry == nil { + panic(fmt.Errorf("registry not bound to capability, cannot get hashed capability ID")) + } + + return mustHashCapabilityID(b.registry, b.capability) +} + +func (b *baseCapability) config(config *capabilitiespb.CapabilityConfig) kcr.CapabilitiesRegistryCapabilityConfiguration { + configBytes, err := proto.Marshal(config) + if err != nil { + panic(err) + } + + return kcr.CapabilitiesRegistryCapabilityConfiguration{ + Config: configBytes, + CapabilityId: b.GetHashedCID(), + } +} + +func (b *baseCapability) Capability() kcr.CapabilitiesRegistryCapability { + return b.capability +} + +type ConsensusCapability struct { + baseCapability +} +var _ CapabillityProvisioner = &ConsensusCapability{} + +func (c *ConsensusCapability) Config() kcr.CapabilitiesRegistryCapabilityConfiguration { + // Note that this is hard-coded for now, we'll want to support more flexible configurations in the future + // for configuring consensus once it has more configuration options + config := &capabilitiespb.CapabilityConfig{ + DefaultConfig: values.Proto(values.EmptyMap()).GetMapValue(), + } + + return c.config(config) +} + +// NewOCR3V1ConsensusCapability returns a new ConsensusCapability for OCR3 +func NewOCR3V1ConsensusCapability() *ConsensusCapability { + return &ConsensusCapability{ + baseCapability{ + capability: kcr.CapabilitiesRegistryCapability{ + LabelledName: "offchain_reporting", + Version: "1.0.0", + CapabilityType: CapabilityTypeConsensus, + }, + }, + } +} + +type TargetCapability struct { + baseCapability +} +var _ CapabillityProvisioner = &TargetCapability{} + +func (t *TargetCapability) Config() kcr.CapabilitiesRegistryCapabilityConfiguration { + // Note that this is hard-coded for now, we'll want to support more flexible configurations in the future + // for configuring the target. This configuration is also specific to the write target + config := &capabilitiespb.CapabilityConfig{ + DefaultConfig: values.Proto(values.EmptyMap()).GetMapValue(), + RemoteConfig: &capabilitiespb.CapabilityConfig_RemoteTargetConfig{ + RemoteTargetConfig: &capabilitiespb.RemoteTargetConfig{ + RequestHashExcludedAttributes: []string{"signed_report.Signatures"}, + }, + }, + } + + return t.config(config) +} + +func NewEthereumSepoliaWriteTargetV1Capability() *TargetCapability { + return &TargetCapability{ + baseCapability{ + capability: kcr.CapabilitiesRegistryCapability{ + LabelledName: "write_ethereum-testnet_sepolia", + Version: "1.0.0", + CapabilityType: CapabilityTypeTarget, + }, + }, + } +} + +type TriggerCapability struct { + baseCapability +} + +var _ CapabillityProvisioner = &TriggerCapability{} + +func (t *TriggerCapability) Config() kcr.CapabilitiesRegistryCapabilityConfiguration { + // Note that this is hard-coded for now, we'll want to support more flexible configurations in the future + // for configuring the trigger. This configuration is also possibly specific to the streams trigger. + config := &capabilitiespb.CapabilityConfig{ + DefaultConfig: values.Proto(values.EmptyMap()).GetMapValue(), + RemoteConfig: &capabilitiespb.CapabilityConfig_RemoteTriggerConfig{ + RemoteTriggerConfig: &capabilitiespb.RemoteTriggerConfig{ + RegistrationRefresh: durationpb.New(20 * time.Second), + RegistrationExpiry: durationpb.New(60 * time.Second), + // We've hardcoded F + 1 here + MinResponsesToAggregate: uint32(1) + 1, + }, + }, + } + + return t.config(config) +} + +func NewStreamsTriggerV1Capability() *TriggerCapability { + return &TriggerCapability{ + baseCapability{ + capability: kcr.CapabilitiesRegistryCapability{ + LabelledName: "streams-trigger", + Version: "1.0.0", + CapabilityType: CapabilityTypeTrigger, + }, + }, + } +} + +func mustHashCapabilityID(reg *kcr.CapabilitiesRegistry, capability kcr.CapabilitiesRegistryCapability) [32]byte { + hashedCapabilityID, err := reg.GetHashedCapabilityId(&bind.CallOpts{}, capability.LabelledName, capability.Version) + if err != nil { + panic(err) + } + return hashedCapabilityID +} + +/* + * + * Capabililty Sets + * + * + */ +type CapabilitySet []CapabillityProvisioner + +func NewCapabilitySet(capabilities ...CapabillityProvisioner) CapabilitySet { + if len(capabilities) == 0 { + log.Println("No capabilities provided, using default capabillity set") + return []CapabillityProvisioner{ + NewStreamsTriggerV1Capability(), + NewEthereumSepoliaWriteTargetV1Capability(), + NewOCR3V1ConsensusCapability(), + } + } + + return capabilities +} + +func (c *CapabilitySet) Capabilities() []kcr.CapabilitiesRegistryCapability { + var definitions []kcr.CapabilitiesRegistryCapability + for _, cap := range *c { + definitions = append(definitions, cap.Capability()) + } + + return definitions +} + +func (c *CapabilitySet) CapabilityIDs() [][32]byte { + var ids [][32]byte + for _, cap := range *c { + ids = append(ids, cap.GetHashedCID()) + } + + return ids +} + +func (c *CapabilitySet) Configs(reg *kcr.CapabilitiesRegistry) []kcr.CapabilitiesRegistryCapabilityConfiguration { + var configs []kcr.CapabilitiesRegistryCapabilityConfiguration + for _, cap := range *c { + cap.BindToRegistry(reg) + configs = append(configs, cap.Config()) + } + + return configs +} + +/* + * + * Node Operator + * + * + */ + +type NodeOperator struct { + Admin gethCommon.Address + Name string + // This is a really simplified mapping + // We dont handle multichain, multi don, etc + // Take a look at https://github.com/smartcontractkit/chainlink/pull/14334/files#diff-9cd09c4e7efeae20108eea3eeeb1119bb923eecce51e98d9066ea0cee19af09c for a more complete version + // but we'll integrate with them in the future + DON []peer + + reg *kcr.CapabilitiesRegistry + // This ID is generated by the registry when the NodeOperator is added + id uint32 +} + +func NewNodeOperator(admin gethCommon.Address, name string, don []peer) NodeOperator { + return NodeOperator{ + Admin: admin, + Name: name, + DON: don, + } +} + +func (n *NodeOperator) BindToRegistry(reg *kcr.CapabilitiesRegistry) { + n.reg = reg +} + +func (n *NodeOperator) SetCapabilityRegistryIssuedID(receipt *gethTypes.Receipt) uint32 { + if n.reg == nil { + panic(fmt.Errorf("registry not bound to node operator, cannot set ID")) + } + // We'll need more complex handling for multiple node operators + // since we'll need to handle log ordering + recLog, err := n.reg.ParseNodeOperatorAdded(*receipt.Logs[0]) + if err != nil { + panic(err) + } + + n.id = recLog.NodeOperatorId + return n.id +} + +func (n *NodeOperator) MustGetPeerIDs() [][32]byte { + ps, err := peers(n.DON) + if err != nil { + panic(err) + } + + return ps +} + +func peerIDToB(peerID string) ([32]byte, error) { + var peerIDB ragetypes.PeerID + err := peerIDB.UnmarshalText([]byte(peerID)) + if err != nil { + return [32]byte{}, err + } + + return peerIDB, nil +} + +func peers(ps []peer) ([][32]byte, error) { + out := [][32]byte{} + for _, p := range ps { + b, err := peerIDToB(p.PeerID) + if err != nil { + return nil, err + } + + out = append(out, b) + } + + return out, nil +} + +func peerToNode(nopID uint32, p peer) (kcr.CapabilitiesRegistryNodeParams, error) { + peerIDB, err := peerIDToB(p.PeerID) + if err != nil { + return kcr.CapabilitiesRegistryNodeParams{}, fmt.Errorf("failed to convert peerID: %w", err) + } + + sig := strings.TrimPrefix(p.Signer, "0x") + signerB, err := hex.DecodeString(sig) + if err != nil { + return kcr.CapabilitiesRegistryNodeParams{}, fmt.Errorf("failed to convert signer: %w", err) + } + + var sigb [32]byte + copy(sigb[:], signerB) + + return kcr.CapabilitiesRegistryNodeParams{ + NodeOperatorId: nopID, + P2pId: peerIDB, + Signer: sigb, + }, nil +} + + +// newCapabilityConfig returns a new capability config with the default config set as empty. +// Override the empty default config with functional options. +func newCapabilityConfig(opts ...func(*values.Map)) *capabilitiespb.CapabilityConfig { + dc := values.EmptyMap() + for _, opt := range opts { + opt(dc) + } + + return &capabilitiespb.CapabilityConfig{ + DefaultConfig: values.ProtoMap(dc), + } +} From d7b70818b8806762526d3c29fee2c1822b173be8 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:04:27 -0700 Subject: [PATCH 006/117] Update nix flake --- flake.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.lock b/flake.lock index 71af2318c95..a14b4a5d0a3 100644 --- a/flake.lock +++ b/flake.lock @@ -94,7 +94,7 @@ "narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b", + "rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43", "type": "github" }, "original": { From d98f548d3fc8e861e0fe69f24dcc3f19f9ce7da5 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Fri, 13 Sep 2024 10:28:13 -0700 Subject: [PATCH 007/117] Fixup provisioning scripts --- .../src/06_provision_capabilities_registry.go | 2 -- core/scripts/keystone/src/99_app.go | 16 +++++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go index 333a9434a34..2ab53031152 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -61,8 +61,6 @@ func (c *provisionCR) Run(args []string) { reg := getOrDeployCapabilitiesRegistry(ctx, *artefactsDir, env) // For now, trigger, target, and workflow DONs are the same node sets, and same don instance - // - // CHECKME: I *think* we can make different DON instances across the same nodes if we provision mulitiple OCR3 jobs, each other a different OCR2 key bundle so we get distinct signers yet the same PeerIDs, which makes sense since the nodes are the same workflowDON := loadDON( *publicKeys, *chainID, diff --git a/core/scripts/keystone/src/99_app.go b/core/scripts/keystone/src/99_app.go index 9a8fbad9e96..e736c021652 100644 --- a/core/scripts/keystone/src/99_app.go +++ b/core/scripts/keystone/src/99_app.go @@ -6,13 +6,12 @@ import ( "errors" "flag" "fmt" + "github.com/urfave/cli" "io" "reflect" "runtime" "strings" - "github.com/urfave/cli" - "github.com/smartcontractkit/chainlink/v2/core/cmd" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" @@ -33,6 +32,7 @@ func newApp(n *node, writer io.Writer) (*clcmd.Shell, *cli.App) { app := clcmd.NewApp(client) fs := flag.NewFlagSet("blah", flag.ContinueOnError) fs.String("remote-node-url", n.url.String(), "") + fs.Bool("insecure-skip-verify", true, "") helpers.PanicErr(app.Before(cli.NewContext(nil, fs, nil))) // overwrite renderer since it's set to stdout after Before() is called client.Renderer = clcmd.RendererJSON{Writer: writer} @@ -58,16 +58,18 @@ func newNodeAPI(n *node) *nodeAPI { fs: flag.NewFlagSet("test", flag.ContinueOnError), } - api.withFlags(api.methods.RemoteLogin, - func(fs *flag.FlagSet) { - fs.Set("bypass-version-check", fmt.Sprint(true)) - }).mustExec() + fmt.Println("Logging in:", n.url) + loginFs := flag.NewFlagSet("test", flag.ContinueOnError) + loginFs.Bool("bypass-version-check", true, "") + loginCtx := cli.NewContext(app, loginFs, nil) + err := methods.RemoteLogin(loginCtx) + helpers.PanicErr(err) + output.Reset() return api } func (c *nodeAPI) withArg(arg string) *nodeAPI { - err := c.fs.Parse([]string{arg}) helpers.PanicErr(err) From f5ee544eaa384957724bd9de9e3f0d35e9a1e5c5 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Sun, 15 Sep 2024 17:44:51 -0700 Subject: [PATCH 008/117] Change default chainid to be 1337 --- core/scripts/keystone/01_deploy_contracts-sample.sh | 2 +- core/scripts/keystone/02_deploy_jobspecs-sample.sh | 2 +- core/scripts/keystone/03_gen_crib-sample.sh | 2 +- ...ploy_and_initialize_capabilities_registry-sample.sh | 2 +- core/scripts/keystone/src/01_deploy_contracts_cmd.go | 2 +- core/scripts/keystone/src/02_deploy_jobspecs_cmd.go | 2 +- .../keystone/src/03_gen_crib_cluster_overrides_cmd.go | 2 +- .../src/03_gen_crib_cluster_overrides_cmd_test.go | 2 +- .../src/05_deploy_initialize_capabilities_registry.go | 2 +- core/scripts/keystone/src/88_gen_jobspecs_test.go | 2 +- core/scripts/keystone/src/88_gen_ocr3_config_test.go | 2 +- .../03_gen_crib_cluster_overrides_cmd_test.snap | 10 +++++----- .../src/__snapshots__/88_gen_jobspecs_test.snap | 10 +++++----- core/scripts/keystone/templates/crib-overrides.yaml | 10 +++++----- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/core/scripts/keystone/01_deploy_contracts-sample.sh b/core/scripts/keystone/01_deploy_contracts-sample.sh index 89e77f4556f..6853b48920f 100755 --- a/core/scripts/keystone/01_deploy_contracts-sample.sh +++ b/core/scripts/keystone/01_deploy_contracts-sample.sh @@ -3,7 +3,7 @@ go run main.go \ deploy-contracts \ --ocrfile=ocr_config.json \ - --chainid=11155111 \ + --chainid=1337 \ --ethurl=ETH_URL \ --accountkey=ACCOUNT_KEY \ --onlysetconfig=false \ diff --git a/core/scripts/keystone/02_deploy_jobspecs-sample.sh b/core/scripts/keystone/02_deploy_jobspecs-sample.sh index e99d54e0d3b..212c0d820f7 100755 --- a/core/scripts/keystone/02_deploy_jobspecs-sample.sh +++ b/core/scripts/keystone/02_deploy_jobspecs-sample.sh @@ -2,6 +2,6 @@ go run main.go \ deploy-jobspecs \ - --chainid=11155111 \ + --chainid=1337 \ --p2pport=6690 \ --onlyreplay=false diff --git a/core/scripts/keystone/03_gen_crib-sample.sh b/core/scripts/keystone/03_gen_crib-sample.sh index 9193ef4f75b..2271f2dbe21 100755 --- a/core/scripts/keystone/03_gen_crib-sample.sh +++ b/core/scripts/keystone/03_gen_crib-sample.sh @@ -2,5 +2,5 @@ go run main.go \ generate-crib \ - --chainid=11155111 \ + --chainid=1337 \ --outpath=/tmp diff --git a/core/scripts/keystone/05_deploy_and_initialize_capabilities_registry-sample.sh b/core/scripts/keystone/05_deploy_and_initialize_capabilities_registry-sample.sh index 21c764be0e8..0fec03e7b42 100755 --- a/core/scripts/keystone/05_deploy_and_initialize_capabilities_registry-sample.sh +++ b/core/scripts/keystone/05_deploy_and_initialize_capabilities_registry-sample.sh @@ -2,7 +2,7 @@ go run main.go \ deploy-and-initialize-capabilities-registry \ - --chainid=11155111 \ + --chainid=1337 \ --ethurl=$ETH_URL \ --accountkey=$ACCOUNT_KEY \ --craddress=$CR_ADDRESS \ // 0x0d36aAC2Fd9d6d1C1F59251be6A2B337af27C52B diff --git a/core/scripts/keystone/src/01_deploy_contracts_cmd.go b/core/scripts/keystone/src/01_deploy_contracts_cmd.go index efe09c61339..2cdeb9dc06b 100644 --- a/core/scripts/keystone/src/01_deploy_contracts_cmd.go +++ b/core/scripts/keystone/src/01_deploy_contracts_cmd.go @@ -49,7 +49,7 @@ func (g *deployContracts) Run(args []string) { // create flags for all of the env vars then set the env vars to normalize the interface // this is a bit of a hack but it's the easiest way to make this work ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") - chainID := fs.Int64("chainid", 11155111, "chain ID of the Ethereum network to deploy to") + chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") accountKey := fs.String("accountkey", "", "private key of the account to deploy from") skipFunding := fs.Bool("skipfunding", false, "skip funding the transmitters") onlySetConfig := fs.Bool("onlysetconfig", false, "set the config on the OCR3 contract without deploying the contracts or funding transmitters") diff --git a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go index abc8b641607..76298dc1932 100644 --- a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go +++ b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go @@ -21,7 +21,7 @@ func (g *deployJobSpecs) Name() string { func (g *deployJobSpecs) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) - chainID := fs.Int64("chainid", 11155111, "chain id") + chainID := fs.Int64("chainid", 1337, "chain id") p2pPort := fs.Int64("p2pport", 6690, "p2p port") onlyReplay := fs.Bool("onlyreplay", false, "only replay the block from the OCR3 contract setConfig transaction") templatesLocation := fs.String("templates", "", "Custom templates location") diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go index 6b98951459e..b731d66cb93 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go @@ -21,7 +21,7 @@ func (g *generateCribClusterOverrides) Name() string { func (g *generateCribClusterOverrides) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) - chainID := fs.Int64("chainid", 11155111, "chain id") + chainID := fs.Int64("chainid", 1337, "chain id") outputPath := fs.String("outpath", "../crib", "the path to output the generated overrides") publicKeys := fs.String("publickeys", "", "Custom public keys json location") nodeList := fs.String("nodes", "", "Custom node list location") diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go index 53d43c2342f..ae420282615 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go @@ -8,7 +8,7 @@ import ( ) func TestGenerateCribConfig(t *testing.T) { - chainID := int64(11155111) + chainID := int64(1337) templatesDir := "../templates" forwarderAddress := "0x1234567890abcdef" publicKeysPath := "./testdata/PublicKeys.json" diff --git a/core/scripts/keystone/src/05_deploy_initialize_capabilities_registry.go b/core/scripts/keystone/src/05_deploy_initialize_capabilities_registry.go index 9414987737a..c960686aeba 100644 --- a/core/scripts/keystone/src/05_deploy_initialize_capabilities_registry.go +++ b/core/scripts/keystone/src/05_deploy_initialize_capabilities_registry.go @@ -195,7 +195,7 @@ func (c *deployAndInitializeCapabilitiesRegistryCommand) Run(args []string) { // create flags for all of the env vars then set the env vars to normalize the interface // this is a bit of a hack but it's the easiest way to make this work ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") - chainID := fs.Int64("chainid", 11155111, "chain ID of the Ethereum network to deploy to") + chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") accountKey := fs.String("accountkey", "", "private key of the account to deploy from") capabilityRegistryAddress := fs.String("craddress", "", "address of the capability registry") diff --git a/core/scripts/keystone/src/88_gen_jobspecs_test.go b/core/scripts/keystone/src/88_gen_jobspecs_test.go index 7af11646c4e..8e021bb5005 100644 --- a/core/scripts/keystone/src/88_gen_jobspecs_test.go +++ b/core/scripts/keystone/src/88_gen_jobspecs_test.go @@ -28,7 +28,7 @@ func (d *donHostSpec) ToString() string { func TestGenSpecs(t *testing.T) { pubkeysPath := "./testdata/PublicKeys.json" nodeListPath := "./testdata/NodeList.txt" - chainID := int64(11155111) + chainID := int64(1337) p2pPort := int64(6690) contractAddress := "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" diff --git a/core/scripts/keystone/src/88_gen_ocr3_config_test.go b/core/scripts/keystone/src/88_gen_ocr3_config_test.go index 10cdc07b204..da22397c1c6 100644 --- a/core/scripts/keystone/src/88_gen_ocr3_config_test.go +++ b/core/scripts/keystone/src/88_gen_ocr3_config_test.go @@ -10,7 +10,7 @@ import ( func TestGenerateOCR3Config(t *testing.T) { // Generate OCR3 config - config := generateOCR3Config(".cache/NodeList.txt", "./testdata/SampleConfig.json", 11155111, "./testdata/PublicKeys.json") + config := generateOCR3Config(".cache/NodeList.txt", "./testdata/SampleConfig.json", 1337, "./testdata/PublicKeys.json") matchOffchainConfig := match.Custom("OffchainConfig", func(s any) (any, error) { // coerce the value to a string diff --git a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap index 08b79a9f4f9..0da6693fb2f 100755 --- a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap @@ -8,12 +8,12 @@ helm: image: ${runtime.images.app} overridesToml: |- [[EVM]] - ChainID = '11155111' + ChainID = '1337' node2: image: ${runtime.images.app} overridesToml: |- [[EVM]] - ChainID = '11155111' + ChainID = '1337' [EVM.Workflow] FromAddress = '0x8B60FDcc9CAC8ea476b31d17011CB204471431d9' ForwarderAddress = '0x1234567890abcdef' @@ -21,7 +21,7 @@ helm: image: ${runtime.images.app} overridesToml: |- [[EVM]] - ChainID = '11155111' + ChainID = '1337' [EVM.Workflow] FromAddress = '0x6620F516F29979B214e2451498a057FDd3a0A85d' ForwarderAddress = '0x1234567890abcdef' @@ -29,7 +29,7 @@ helm: image: ${runtime.images.app} overridesToml: |- [[EVM]] - ChainID = '11155111' + ChainID = '1337' [EVM.Workflow] FromAddress = '0xFeB61E22FCf4F9740c9D96b05199F195bd61A7c2' ForwarderAddress = '0x1234567890abcdef' @@ -37,7 +37,7 @@ helm: image: ${runtime.images.app} overridesToml: |- [[EVM]] - ChainID = '11155111' + ChainID = '1337' [EVM.Workflow] FromAddress = '0x882Fd04D78A7e7D386Dd5b550f19479E5494B0B2' ForwarderAddress = '0x1234567890abcdef' diff --git a/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap b/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap index c0c7c7d7e67..91cb8c6786b 100755 --- a/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap +++ b/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap @@ -9,7 +9,7 @@ contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" relay = "evm" [relayConfig] -chainID = "11155111" +chainID = "1337" providerType = "ocr3-capability" Oracles: @@ -28,7 +28,7 @@ pluginType = "plugin" transmitterID = "0x8B60FDcc9CAC8ea476b31d17011CB204471431d9" [relayConfig] -chainID = "11155111" +chainID = "1337" [pluginConfig] command = "chainlink-ocr3-capability" @@ -59,7 +59,7 @@ pluginType = "plugin" transmitterID = "0x6620F516F29979B214e2451498a057FDd3a0A85d" [relayConfig] -chainID = "11155111" +chainID = "1337" [pluginConfig] command = "chainlink-ocr3-capability" @@ -90,7 +90,7 @@ pluginType = "plugin" transmitterID = "0xFeB61E22FCf4F9740c9D96b05199F195bd61A7c2" [relayConfig] -chainID = "11155111" +chainID = "1337" [pluginConfig] command = "chainlink-ocr3-capability" @@ -121,7 +121,7 @@ pluginType = "plugin" transmitterID = "0x882Fd04D78A7e7D386Dd5b550f19479E5494B0B2" [relayConfig] -chainID = "11155111" +chainID = "1337" [pluginConfig] command = "chainlink-ocr3-capability" diff --git a/core/scripts/keystone/templates/crib-overrides.yaml b/core/scripts/keystone/templates/crib-overrides.yaml index baeaa5fa1d9..758433bbc91 100644 --- a/core/scripts/keystone/templates/crib-overrides.yaml +++ b/core/scripts/keystone/templates/crib-overrides.yaml @@ -6,12 +6,12 @@ helm: image: ${runtime.images.app} overridesToml: |- [[EVM]] - ChainID = '11155111' + ChainID = '1337' node2: image: ${runtime.images.app} overridesToml: |- [[EVM]] - ChainID = '11155111' + ChainID = '1337' [EVM.Workflow] FromAddress = '{{ node_2_address }}' ForwarderAddress = '{{ forwarder_address }}' @@ -19,7 +19,7 @@ helm: image: ${runtime.images.app} overridesToml: |- [[EVM]] - ChainID = '11155111' + ChainID = '1337' [EVM.Workflow] FromAddress = '{{ node_3_address }}' ForwarderAddress = '{{ forwarder_address }}' @@ -27,7 +27,7 @@ helm: image: ${runtime.images.app} overridesToml: |- [[EVM]] - ChainID = '11155111' + ChainID = '1337' [EVM.Workflow] FromAddress = '{{ node_4_address }}' ForwarderAddress = '{{ forwarder_address }}' @@ -35,7 +35,7 @@ helm: image: ${runtime.images.app} overridesToml: |- [[EVM]] - ChainID = '11155111' + ChainID = '1337' [EVM.Workflow] FromAddress = '{{ node_5_address }}' ForwarderAddress = '{{ forwarder_address }}' From bb138d2d87557be942fea894b081d903f66cd88c Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Sun, 15 Sep 2024 18:29:47 -0700 Subject: [PATCH 009/117] Add nil check for balances --- core/scripts/keystone/src/99_fetch_keys.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index 8899da95b11..9f81caa18e1 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -246,7 +246,7 @@ func findOCR2Bundle(ocr2Bundles []ocr2Bundle, chainType string) int { func findFirstGoodEthKeyAddress(chainID int64, ethKeys []presenters.ETHKeyResource) (string, error) { for _, ethKey := range ethKeys { if ethKey.EVMChainID.Equal(ubig.NewI(chainID)) && !ethKey.Disabled { - if ethKey.EthBalance.IsZero() { + if ethKey.EthBalance == nil || ethKey.EthBalance.IsZero() { fmt.Println("WARN: selected ETH address has zero balance", ethKey.Address) } return ethKey.Address, nil From 7b4319945c076e5cf5e26e967b67645a9c7565de Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Sun, 15 Sep 2024 18:30:15 -0700 Subject: [PATCH 010/117] Add ability to skip tls verification for local dev --- core/scripts/common/helpers.go | 16 ++++++++++++---- .../keystone/src/01_deploy_contracts_cmd.go | 2 +- ...05_deploy_initialize_capabilities_registry.go | 1 + .../src/06_provision_capabilities_registry.go | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/core/scripts/common/helpers.go b/core/scripts/common/helpers.go index 57c8c15e405..97ca2dd4929 100644 --- a/core/scripts/common/helpers.go +++ b/core/scripts/common/helpers.go @@ -3,10 +3,12 @@ package common import ( "context" "crypto/ecdsa" + "crypto/tls" "encoding/hex" "flag" "fmt" "math/big" + "net/http" "os" "strconv" "strings" @@ -69,11 +71,17 @@ func SetupEnv(overrideNonce bool) Environment { panic("need account key") } - ec, err := ethclient.Dial(ethURL) - PanicErr(err) - - jsonRPCClient, err := rpc.Dial(ethURL) + insecureSkipVerify := os.Getenv("INSECURE_SKIP_VERIFY") == "true" + tr := &http.Transport{ + // User enables this at their own risk! + // #nosec G402 + TLSClientConfig: &tls.Config{InsecureSkipVerify: insecureSkipVerify}, + } + httpClient := &http.Client{Transport: tr} + rpcConfig := rpc.WithHTTPClient(httpClient) + jsonRPCClient, err := rpc.DialOptions(context.Background(), ethURL, rpcConfig) PanicErr(err) + ec := ethclient.NewClient(jsonRPCClient) chainID, err := strconv.ParseInt(chainIDEnv, 10, 64) PanicErr(err) diff --git a/core/scripts/keystone/src/01_deploy_contracts_cmd.go b/core/scripts/keystone/src/01_deploy_contracts_cmd.go index 2cdeb9dc06b..38f36ed2a11 100644 --- a/core/scripts/keystone/src/01_deploy_contracts_cmd.go +++ b/core/scripts/keystone/src/01_deploy_contracts_cmd.go @@ -82,7 +82,7 @@ func (g *deployContracts) Run(args []string) { os.Setenv("ETH_URL", *ethUrl) os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) os.Setenv("ACCOUNT_KEY", *accountKey) - + os.Setenv("INSECURE_SKIP_VERIFY", "true") deploy(*nodeList, *publicKeys, *ocrConfigFile, *skipFunding, *dryRun, *onlySetConfig, *artefactsDir) } diff --git a/core/scripts/keystone/src/05_deploy_initialize_capabilities_registry.go b/core/scripts/keystone/src/05_deploy_initialize_capabilities_registry.go index c960686aeba..01552135af5 100644 --- a/core/scripts/keystone/src/05_deploy_initialize_capabilities_registry.go +++ b/core/scripts/keystone/src/05_deploy_initialize_capabilities_registry.go @@ -211,6 +211,7 @@ func (c *deployAndInitializeCapabilitiesRegistryCommand) Run(args []string) { os.Setenv("ETH_URL", *ethUrl) os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) os.Setenv("ACCOUNT_KEY", *accountKey) + os.Setenv("INSECURE_SKIP_VERIFY", "true") env := helpers.SetupEnv(false) diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go index 2ab53031152..3e725b6169d 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -55,6 +55,7 @@ func (c *provisionCR) Run(args []string) { os.Setenv("ETH_URL", *ethUrl) os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) os.Setenv("ACCOUNT_KEY", *accountKey) + os.Setenv("INSECURE_SKIP_VERIFY", "true") env := helpers.SetupEnv(false) From 09874a58b0239632d206ce2cc9cb980dd483eebc Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Sun, 15 Sep 2024 18:30:53 -0700 Subject: [PATCH 011/117] Gently fail on not loading contracts for ocr job deletion --- core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go b/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go index 136691962dd..ac7668ae57a 100644 --- a/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go +++ b/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go @@ -61,7 +61,10 @@ func (g *deleteJobs) Run(args []string) { } deployedContracts, err := LoadDeployedContracts(*artefactsDir) - helpers.PanicErr(err) + if err != nil { + fmt.Println("Error loading deployed contracts, skipping:", err) + return + } nodes := downloadNodeAPICredentials(*nodeList) for _, node := range nodes { From 2172e069b1f8b6449839d5bce9d5a4b34cd21ed4 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Sun, 15 Sep 2024 19:03:31 -0700 Subject: [PATCH 012/117] fixup! Change default chainid to be 1337 --- core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go | 2 +- core/scripts/keystone/src/06_provision_capabilities_registry.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 9175e6cb415..e0b0783057d 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -40,7 +40,7 @@ func (g *deployStreamsTrigger) Name() string { func (g *deployStreamsTrigger) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) - chainID := fs.Int64("chainid", 11155111, "chain id") + chainID := fs.Int64("chainid", 1337, "chain id") templatesLocation := fs.String("templates", "", "Custom templates location") feedID := fs.String("feedid", "", "Feed ID") linkFeedID := fs.String("linkfeedid", "", "Link Feed ID") diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go index 3e725b6169d..fc64b87c990 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -27,7 +27,7 @@ func (c *provisionCR) Run(args []string) { // create flags for all of the env vars then set the env vars to normalize the interface // this is a bit of a hack but it's the easiest way to make this work ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") - chainID := fs.Int64("chainid", 11155111, "chain ID of the Ethereum network to deploy to") + chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") accountKey := fs.String("accountkey", "", "private key of the account to deploy from") publicKeys := fs.String("publickeys", "", "Custom public keys json location") nodeList := fs.String("nodes", "", "Custom node list location") From 620cb3900ddacc8007b1c0300e6c904d19fb1f9d Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Tue, 17 Sep 2024 16:35:32 -0700 Subject: [PATCH 013/117] Formatting --- core/scripts/keystone/src/06_provision_capabilities_registry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go index fc64b87c990..eef45e1f4fe 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -35,8 +35,8 @@ func (c *provisionCR) Run(args []string) { err := fs.Parse(args) if err != nil || - *ethUrl == "" || ethUrl == nil || *chainID == 0 || chainID == nil || + *ethUrl == "" || ethUrl == nil || *accountKey == "" || accountKey == nil { fs.Usage() os.Exit(1) From 76278296136594df16d06150d6f0c23737c2107d Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Tue, 17 Sep 2024 16:36:11 -0700 Subject: [PATCH 014/117] Change ocr file flag default --- core/scripts/keystone/src/01_deploy_contracts_cmd.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/01_deploy_contracts_cmd.go b/core/scripts/keystone/src/01_deploy_contracts_cmd.go index 38f36ed2a11..c38dc82a903 100644 --- a/core/scripts/keystone/src/01_deploy_contracts_cmd.go +++ b/core/scripts/keystone/src/01_deploy_contracts_cmd.go @@ -45,7 +45,7 @@ func (g *deployContracts) Name() string { // 5. Funds the transmitters func (g *deployContracts) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) - ocrConfigFile := fs.String("ocrfile", "config_example.json", "path to OCR config file") + ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") // create flags for all of the env vars then set the env vars to normalize the interface // this is a bit of a hack but it's the easiest way to make this work ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") @@ -107,6 +107,7 @@ func deploy( configFile, env.ChainID, publicKeys, + OnChainTransmitter, ) if dryRun { From b959698e077c0e435814abc5f78a5f6c52e2745a Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Tue, 17 Sep 2024 16:38:47 -0700 Subject: [PATCH 015/117] Allow for multiple OCR2KB selection in key fetching --- core/scripts/keystone/src/99_fetch_keys.go | 250 +++++++++++---------- 1 file changed, 132 insertions(+), 118 deletions(-) diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index 9f81caa18e1..881e0a1c7ac 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/json" "errors" - "flag" "fmt" "os" "sort" @@ -19,17 +18,17 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/web/presenters" ) -func downloadNodePubKeys(nodeList string, chainID int64, pubKeysPath string) []ksdeploy.NodeKeys { - // Check if file exists already, and if so, return the keys +func downloadAllNodeKeys(nodeList string, chainID int64, pubKeysPath string) []AllNodeKeys { if _, err := os.Stat(pubKeysPath); err == nil { fmt.Println("Loading existing public keys at:", pubKeysPath) - return mustParseJSON[[]ksdeploy.NodeKeys](pubKeysPath) + allKeys := mustParseJSON[[]AllNodeKeys](pubKeysPath) + return allKeys } nodes := downloadNodeAPICredentials(nodeList) - nodesKeys := mustFetchNodesKeys(chainID, nodes) + allKeys := mustFetchAllNodeKeys(chainID, nodes) - marshalledNodeKeys, err := json.MarshalIndent(nodesKeys, "", " ") + marshalledNodeKeys, err := json.MarshalIndent(allKeys, "", " ") if err != nil { panic(err) } @@ -39,7 +38,18 @@ func downloadNodePubKeys(nodeList string, chainID int64, pubKeysPath string) []k } fmt.Println("Keystone OCR2 public keys have been saved to:", pubKeysPath) - return nodesKeys + return allKeys +} + +func downloadNodePubKeys(nodeList string, chainID int64, pubKeysPath string, index ...int) []NodeKeys { + keys := []NodeKeys{} + allKeys := downloadAllNodeKeys(nodeList, chainID, pubKeysPath) + + for _, k := range allKeys { + keys = append(keys, k.toNodeKeys(index...)) + } + + return keys } // downloadNodeAPICredentials downloads the node API credentials, or loads them from disk if they already exist @@ -89,41 +99,60 @@ func clNodesWithCredsToNodes(clNodesWithCreds []CLNodeCredentials) []*node { return nodes } -type ocr2Bundle struct { - ID string `json:"id"` - ChainType string `json:"chainType"` - OnchainPublicKey string `json:"onchainPublicKey"` - OffchainPublicKey string `json:"offchainPublicKey"` - ConfigPublicKey string `json:"configPublicKey"` +func trimmedOCR2KB(ocr2Bndl cmd.OCR2KeyBundlePresenter) OCR2KBTrimmed { + return OCR2KBTrimmed{ + OCR2BundleID: ocr2Bndl.ID, + OCR2ConfigPublicKey: strings.TrimPrefix(ocr2Bndl.ConfigPublicKey, "ocr2cfg_evm_"), + OCR2OnchainPublicKey: strings.TrimPrefix(ocr2Bndl.OnchainPublicKey, "ocr2on_evm_"), + OCR2OffchainPublicKey: strings.TrimPrefix(ocr2Bndl.OffChainPublicKey, "ocr2off_evm_"), + } } -func mustFetchNodesKeys(chainID int64, nodes []*node) (nca []ksdeploy.NodeKeys) { - for _, n := range nodes { - output := &bytes.Buffer{} - client, app := newApp(n, output) +type AllNodeKeys struct { + EthAddress string + P2PPeerID string // p2p_ + OCR2KBs []OCR2KBTrimmed + CSAPublicKey string +} - fmt.Println("Logging in:", n.url) - loginFs := flag.NewFlagSet("test", flag.ContinueOnError) - loginFs.Bool("bypass-version-check", true, "") - loginCtx := cli.NewContext(app, loginFs, nil) - err := client.RemoteLogin(loginCtx) - helpers.PanicErr(err) - output.Reset() +func (a AllNodeKeys) toNodeKeys(index ...int) NodeKeys { + i := 0 + if len(index) > 0 { + i = index[0] + } + if i >= len(a.OCR2KBs) { + panic("index out of range") + } - err = client.ListETHKeys(&cli.Context{ - App: app, - }) - helpers.PanicErr(err) - var ethKeys []presenters.ETHKeyResource - helpers.PanicErr(json.Unmarshal(output.Bytes(), ðKeys)) - ethAddress, err := findFirstGoodEthKeyAddress(chainID, ethKeys) + return NodeKeys{ + OCR2KBTrimmed: OCR2KBTrimmed{ + OCR2BundleID: a.OCR2KBs[i].OCR2BundleID, + OCR2ConfigPublicKey: a.OCR2KBs[i].OCR2ConfigPublicKey, + OCR2OnchainPublicKey: a.OCR2KBs[i].OCR2OnchainPublicKey, + OCR2OffchainPublicKey: a.OCR2KBs[i].OCR2OffchainPublicKey, + }, + EthAddress: a.EthAddress, + P2PPeerID: a.P2PPeerID, + CSAPublicKey: a.CSAPublicKey, + } +} + +func mustFetchAllNodeKeys(chainId int64, nodes []*node) []AllNodeKeys { + allNodeKeys := []AllNodeKeys{} + + for _, n := range nodes { + api := newNodeAPI(n) + + // Get eth key + eKey := api.mustExec(api.methods.ListETHKeys) + ethKeys := mustJSON[[]presenters.ETHKeyResource](eKey) + ethAddress, err := findFirstGoodEthKeyAddress(chainId, *ethKeys) helpers.PanicErr(err) - output.Reset() - keysClient := cmd.NewAptosKeysClient(client) - err = keysClient.ListKeys(&cli.Context{ - App: app, - }) + // Get aptos account key + output := &bytes.Buffer{} + aKeysClient := cmd.NewAptosKeysClient(api.methods) + err = aKeysClient.ListKeys(&cli.Context{App: api.app}) helpers.PanicErr(err) var aptosKeys []presenters.AptosKeyResource helpers.PanicErr(json.Unmarshal(output.Bytes(), &aptosKeys)) @@ -133,98 +162,63 @@ func mustFetchNodesKeys(chainID int64, nodes []*node) (nca []ksdeploy.NodeKeys) aptosAccount := aptosKeys[0].Account output.Reset() - err = client.ListP2PKeys(&cli.Context{ - App: app, - }) - helpers.PanicErr(err) - var p2pKeys []presenters.P2PKeyResource - helpers.PanicErr(json.Unmarshal(output.Bytes(), &p2pKeys)) - if len(p2pKeys) != 1 { + // Get p2p key + p2pKeys := api.mustExec(api.methods.ListP2PKeys) + p2pKey := mustJSON[[]presenters.P2PKeyResource](p2pKeys) + if len(*p2pKey) != 1 { helpers.PanicErr(errors.New("node must have single p2p key")) } - peerID := strings.TrimPrefix(p2pKeys[0].PeerID, "p2p_") - output.Reset() - - chainType := "evm" - - var ocr2Bundles []ocr2Bundle - err = client.ListOCR2KeyBundles(&cli.Context{ - App: app, - }) - helpers.PanicErr(err) - helpers.PanicErr(json.Unmarshal(output.Bytes(), &ocr2Bundles)) - ocr2BundleIndex := findOCR2Bundle(ocr2Bundles, chainType) - output.Reset() - if ocr2BundleIndex == -1 { - fmt.Println("WARN: node does not have EVM OCR2 bundle, creating one") - fs := flag.NewFlagSet("test", flag.ContinueOnError) - err = fs.Parse([]string{chainType}) - helpers.PanicErr(err) - ocr2CreateBundleCtx := cli.NewContext(app, fs, nil) - err = client.CreateOCR2KeyBundle(ocr2CreateBundleCtx) - helpers.PanicErr(err) - output.Reset() - - err = client.ListOCR2KeyBundles(&cli.Context{ - App: app, - }) - helpers.PanicErr(err) - helpers.PanicErr(json.Unmarshal(output.Bytes(), &ocr2Bundles)) - ocr2BundleIndex = findOCR2Bundle(ocr2Bundles, chainType) - output.Reset() + peerID := strings.TrimPrefix((*p2pKey)[0].PeerID, "p2p_") + + + bundles := api.mustExec(api.methods.ListOCR2KeyBundles) + ocr2Bundles := mustJSON[cmd.OCR2KeyBundlePresenters](bundles) + + // evm key bundles + ocr2EvmBundles := getTrimmedEVMOCR2KBs(*ocr2Bundles) + evmBundleLen := len(ocr2EvmBundles) + if evmBundleLen < 2 { + fmt.Printf("WARN: node has %d EVM OCR2 bundles when it should have at least 2, creating bundles...\n", evmBundleLen) + for i := evmBundleLen; i < 2; i++ { + cBundle := api.withArg("evm").mustExec(api.methods.CreateOCR2KeyBundle) + fmt.Println("Created OCR2 bundle", string(cBundle)) + createdBundle := mustJSON[cmd.OCR2KeyBundlePresenter](cBundle) + fmt.Printf("Created bundle %s\n", createdBundle.ID) + ocr2EvmBundles = append(ocr2EvmBundles, trimmedOCR2KB(*createdBundle)) + } } - ocr2Bndl := ocr2Bundles[ocr2BundleIndex] - - aptosBundleIndex := findOCR2Bundle(ocr2Bundles, "aptos") - if aptosBundleIndex == -1 { - chainType2 := "aptos" - fmt.Println("WARN: node does not have Aptos OCR2 bundle, creating one") - fs := flag.NewFlagSet("test", flag.ContinueOnError) - err = fs.Parse([]string{chainType2}) - helpers.PanicErr(err) - ocr2CreateBundleCtx := cli.NewContext(app, fs, nil) - err = client.CreateOCR2KeyBundle(ocr2CreateBundleCtx) - helpers.PanicErr(err) - output.Reset() - - err = client.ListOCR2KeyBundles(&cli.Context{ - App: app, - }) - helpers.PanicErr(err) - helpers.PanicErr(json.Unmarshal(output.Bytes(), &ocr2Bundles)) - aptosBundleIndex = findOCR2Bundle(ocr2Bundles, chainType2) - output.Reset() + // aptos key bundles + ocr2AptosBundles := getTrimmedAptosOCR2KBs(*ocr2Bundles) + aptosBundleLen := len(ocr2AptosBundles) + if aptosBundleLen < 2 { + fmt.Printf("WARN: node has %d Aptos OCR2 bundles when it should have at least 2, creating bundles...\n", aptosBundleLen) + for i := aptosBundleLen; i < 2; i++ { + cBundle := api.withArg("aptos").mustExec(api.methods.CreateOCR2KeyBundle) + fmt.Println("Created OCR2 bundle", string(cBundle)) + createdBundle := mustJSON[cmd.OCR2KeyBundlePresenter](cBundle) + fmt.Printf("Created bundle %s\n", createdBundle.ID) + ocr2AptosBundles = append(ocr2AptosBundles, trimmedOCR2KB(*createdBundle)) + } } - aptosBundle := ocr2Bundles[aptosBundleIndex] - - err = client.ListCSAKeys(&cli.Context{ - App: app, - }) - helpers.PanicErr(err) - var csaKeys []presenters.CSAKeyResource - helpers.PanicErr(json.Unmarshal(output.Bytes(), &csaKeys)) - csaPubKey, err := findFirstCSAPublicKey(csaKeys) + csaKeys := api.mustExec(api.methods.ListCSAKeys) + csaKeyResources := mustJSON[[]presenters.CSAKeyResource](csaKeys) + csaPubKey, err := findFirstCSAPublicKey(*csaKeyResources) helpers.PanicErr(err) - output.Reset() - nc := ksdeploy.NodeKeys{ - EthAddress: ethAddress, - AptosAccount: aptosAccount, - P2PPeerID: peerID, - AptosBundleID: aptosBundle.ID, - AptosOnchainPublicKey: strings.TrimPrefix(aptosBundle.OnchainPublicKey, fmt.Sprintf("ocr2on_%s_", "aptos")), - OCR2BundleID: ocr2Bndl.ID, - OCR2ConfigPublicKey: strings.TrimPrefix(ocr2Bndl.ConfigPublicKey, fmt.Sprintf("ocr2cfg_%s_", chainType)), - OCR2OnchainPublicKey: strings.TrimPrefix(ocr2Bndl.OnchainPublicKey, fmt.Sprintf("ocr2on_%s_", chainType)), - OCR2OffchainPublicKey: strings.TrimPrefix(ocr2Bndl.OffchainPublicKey, fmt.Sprintf("ocr2off_%s_", chainType)), - CSAPublicKey: csaPubKey, + nodeKeys := AllNodeKeys{ + EthAddress: ethAddress, + AptosAccount: aptosAccount, + P2PPeerID: peerID, + OCR2KBs: ocr2EvmBundles, + CSAPublicKey: strings.TrimPrefix(csaPubKey, "csa_"), } - nca = append(nca, nc) + allNodeKeys = append(allNodeKeys, nodeKeys) } - return + + return allNodeKeys } func findFirstCSAPublicKey(csaKeyResources []presenters.CSAKeyResource) (string, error) { @@ -234,7 +228,7 @@ func findFirstCSAPublicKey(csaKeyResources []presenters.CSAKeyResource) (string, return "", errors.New("did not find any CSA Key Resources") } -func findOCR2Bundle(ocr2Bundles []ocr2Bundle, chainType string) int { +func findEvmOCR2Bundle(ocr2Bundles cmd.OCR2KeyBundlePresenters) int { for i, b := range ocr2Bundles { if b.ChainType == chainType { return i @@ -243,6 +237,26 @@ func findOCR2Bundle(ocr2Bundles []ocr2Bundle, chainType string) int { return -1 } +func getTrimmedAptosOCR2KBs(ocr2Bundles cmd.OCR2KeyBundlePresenters) []OCR2KBTrimmed { + aptosBundles := []OCR2KBTrimmed{} + for _, b := range ocr2Bundles { + if b.ChainType == "aptos" { + aptosBundles = append(aptosBundles, trimmedOCR2KB(b)) + } + } + return aptosBundles +} + +func getTrimmedEVMOCR2KBs(ocr2Bundles cmd.OCR2KeyBundlePresenters) []OCR2KBTrimmed { + evmBundles := []OCR2KBTrimmed{} + for _, b := range ocr2Bundles { + if b.ChainType == "evm" { + evmBundles = append(evmBundles, trimmedOCR2KB(b)) + } + } + return evmBundles +} + func findFirstGoodEthKeyAddress(chainID int64, ethKeys []presenters.ETHKeyResource) (string, error) { for _, ethKey := range ethKeys { if ethKey.EVMChainID.Equal(ubig.NewI(chainID)) && !ethKey.Disabled { From 32f48cf84dd541bb750e6fe241da207907112fe7 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Tue, 17 Sep 2024 16:39:20 -0700 Subject: [PATCH 016/117] Support on/offchain transmitter OCR3 config generation --- .../keystone/src/88_gen_ocr3_config_test.go | 2 +- .../88_gen_ocr3_config_test.snap | 10 +- .../keystone/src/testdata/PublicKeys.json | 132 ++++++++++++------ 3 files changed, 92 insertions(+), 52 deletions(-) diff --git a/core/scripts/keystone/src/88_gen_ocr3_config_test.go b/core/scripts/keystone/src/88_gen_ocr3_config_test.go index da22397c1c6..19c6bc50a05 100644 --- a/core/scripts/keystone/src/88_gen_ocr3_config_test.go +++ b/core/scripts/keystone/src/88_gen_ocr3_config_test.go @@ -10,7 +10,7 @@ import ( func TestGenerateOCR3Config(t *testing.T) { // Generate OCR3 config - config := generateOCR3Config(".cache/NodeList.txt", "./testdata/SampleConfig.json", 1337, "./testdata/PublicKeys.json") + config := generateOCR3Config(".cache/NodeList.txt", "./testdata/SampleConfig.json", 1337, "./testdata/PublicKeys.json", OnChainTransmitter) matchOffchainConfig := match.Custom("OffchainConfig", func(s any) (any, error) { // coerce the value to a string diff --git a/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap b/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap index eac3cdaff4c..8aa8776237d 100755 --- a/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap +++ b/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap @@ -13,11 +13,11 @@ "011400a0b67dc5345a71d02b396147ae2cb75dda63cbe9052000ea551e503b93a1c9ae26262b4db8f66db4cbe5ddcb6039e29d2665a634d48e4e" ], "Transmitters": [ - "0xF4e7e516146c8567F8E8be0ED1f1A92798628d35", - "0x8B60FDcc9CAC8ea476b31d17011CB204471431d9", - "0x6620F516F29979B214e2451498a057FDd3a0A85d", - "0xFeB61E22FCf4F9740c9D96b05199F195bd61A7c2", - "0x882Fd04D78A7e7D386Dd5b550f19479E5494B0B2" + "0x9DfB1E962Fc6363087fB60A131aba2b7884dAD97", + "0x367764B5640E691bbeB99Ff14dEc4EA02421fFd9", + "0x4CC725F1b7a23BC42658cce5c40A0ec3C7f3c925", + "0x5323547CdBb450725c59626A1A6C5608C5c1Ea07", + "0x16d9BbC5e927053697771AF7d7a003FE7b60B61E" ] } --- diff --git a/core/scripts/keystone/src/testdata/PublicKeys.json b/core/scripts/keystone/src/testdata/PublicKeys.json index b29e8290895..fdd5b40c9c2 100644 --- a/core/scripts/keystone/src/testdata/PublicKeys.json +++ b/core/scripts/keystone/src/testdata/PublicKeys.json @@ -1,57 +1,97 @@ [ { - "AptosBundleID": "9bebfa953e7a7522746f72b4023308de36db626f3e0bcb9033407b8a183e8bfa", - "AptosOnchainPublicKey": "ea551e503b93a1c9ae26262b4db8f66db4cbe5ddcb6039e29d2665a634d48e4a", - "EthAddress": "0xF4e7e516146c8567F8E8be0ED1f1A92798628d35", - "P2PPeerID": "12D3KooWNmhKZL1XW4Vv3rNjLXzJ6mqcVerihdijjGYuexPrFUFZ", - "OCR2BundleID": "2f92c96da20fbe39c89e59516e3a7473254523316887394e406527c72071d3db", - "OCR2OnchainPublicKey": "a2402db8e549f094ea31e1c0edd77623f4ca5b12", - "OCR2OffchainPublicKey": "3ca9918cd2787de8f9aff91f220f30a5cc54c394f73e173b12c93368bd7072ad", - "OCR2ConfigPublicKey": "19904debd03994fe9ea411cda7a6b2f01f20a3fe803df0fed67aaf00cc99113f", - "CSAPublicKey": "csa_dbae6965bad0b0fa95ecc34a602eee1c0c570ddc29b56502e400d18574b8c3df" + "EthAddress": "0x9DfB1E962Fc6363087fB60A131aba2b7884dAD97", + "P2PPeerID": "12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL", + "OCR2KBs": [ + { + "OCR2BundleID": "05ff3c1c2cba85f8761362221afbc0c44a8fce52467c9feb59271479b5f4cc79", + "OCR2OnchainPublicKey": "bb9da64fefbae323b45ec98970863279824cf08d", + "OCR2OffchainPublicKey": "d90d1fcec7c7f52766fcf9f78733f5c963003f1098e4db274481120baa661c23", + "OCR2ConfigPublicKey": "7a5350a05a0c1a76f1dfb2777a9cc4fb96fccafc00cd145c88e038e4376aed1e" + }, + { + "OCR2BundleID": "acfa03eed948b1cde5067161ce27a88ce5bc98905128e678cf1987aa41022119", + "OCR2OnchainPublicKey": "6ff800e9d0b0c0087286b833049a166dfe269f49", + "OCR2OffchainPublicKey": "66edb100a254e4ae3f4856bf3c5c9933908cc893c1733e7df0a2553a44d4dc2a", + "OCR2ConfigPublicKey": "b4b3d403748daf54f56e684b30fcecabad3ab59ac4e59c41fbf6ce5b9efae74d" + } + ], + "CSAPublicKey": "53940b5245216eaae8a87fb777902bf898432820bfc3c97778fd7325e0f4d1f3" }, { - "AptosBundleID": "9bebfa953e7a7522746f72b4023308de36db626f3e0bcb9033407b8a183e8bfb", - "AptosOnchainPublicKey": "ea551e503b93a1c9ae26262b4db8f66db4cbe5ddcb6039e29d2665a634d48e4b", - "EthAddress": "0x8B60FDcc9CAC8ea476b31d17011CB204471431d9", - "P2PPeerID": "12D3KooWFUjV73ZYkAMhS2cVwte3kXDWD8Ybyx3u9CEDHNoeEhBH", - "OCR2BundleID": "b3df4d8748b67731a1112e8b45a764941974f5590c93672eebbc4f3504dd10ed", - "OCR2OnchainPublicKey": "4af19c802b244d1d085492c3946391c965e10519", - "OCR2OffchainPublicKey": "365b9e1c3c945fc3f51afb25772f0a5a1f1547935a4b5dc89c012f590709fefe", - "OCR2ConfigPublicKey": "15ff12569d11b8ff9f17f8999ea928d03a439f3fb116661cbc4669a0a3192775", - "CSAPublicKey": "csa_c5cc655a9c19b69626519c4a72c44a94a3675daeba9c16cc23e010a7a6dac1be" + "EthAddress": "0x367764B5640E691bbeB99Ff14dEc4EA02421fFd9", + "P2PPeerID": "12D3KooWJWcdKb5BATxkuApEZufpEsXgu3UAG4fPtvuavHe2NHQi", + "OCR2KBs": [ + { + "OCR2BundleID": "2e302a95ada6b2d8b8fffce6ffd0926a129a11fb59bc9088ac0c8f01f43ba355", + "OCR2OnchainPublicKey": "26f04f488f6383cd4099b7aef16c0dc2e553adda", + "OCR2OffchainPublicKey": "d721c5ec7a62e81b9c8f1b7a2fd6d193b135c7cea207d16af74ab71fc92fdbdc", + "OCR2ConfigPublicKey": "c09ea54fa542f02e459b9a749a3306b4b6cc613812f4bfef17412883bcb9d87b" + }, + { + "OCR2BundleID": "f550286c0e74d894e95ec5e55e06fc980420d30cf2c6565b148f7423922f6b4d", + "OCR2OnchainPublicKey": "ca60dc5200e49b345808ce40b68b4d9d480762fb", + "OCR2OffchainPublicKey": "d8f7d6e9f358bbf69e8a26d7e65ddfd98ecc9758dac131a983a5100216e72b9c", + "OCR2ConfigPublicKey": "72ab5516dea0304fcb3a16a2c1a314b0ccd844aba4cdbe2f8d7944924c990405" + } + ], + "CSAPublicKey": "bb4a327ef258e09fd6192443ad007b0a2fdd5d0fb0a42aeb1c05252ba1c71bb7" }, { - "AptosBundleID": "9bebfa953e7a7522746f72b4023308de36db626f3e0bcb9033407b8a183e8bfc", - "AptosOnchainPublicKey": "ea551e503b93a1c9ae26262b4db8f66db4cbe5ddcb6039e29d2665a634d48e4c", - "EthAddress": "0x6620F516F29979B214e2451498a057FDd3a0A85d", - "P2PPeerID": "12D3KooWRTtH2WWrztD87Do1kXePSmGjyU4r7mZVWThmqTGgdbUC", - "OCR2BundleID": "38459ae37f29f2c1fde0f25972a973322be8cada82acf43f464756836725be97", - "OCR2OnchainPublicKey": "61925685d2b80b121537341d063c4e57b2f9323c", - "OCR2OffchainPublicKey": "7fe2dbd9f9fb96f7dbbe0410e32d435ad67dae6c91410189fe5664cf3057ef10", - "OCR2ConfigPublicKey": "2f02fd80b362e1c7acf91680fd48c062718233acd595a6ae7cbe434e118e6a4f", - "CSAPublicKey": "csa_7407fc90c70895c0fb2bdf385e2e4918364bec1f7a74bad7fdf696bffafbcab8" + "EthAddress": "0x4CC725F1b7a23BC42658cce5c40A0ec3C7f3c925", + "P2PPeerID": "12D3KooWR1xT9MRh469Fh21CRK1t1xbveqUCnbgG53UFktU1DrRw", + "OCR2KBs": [ + { + "OCR2BundleID": "3cdac381db901a657fe9416724d69efb46473652c6d8192a67d1f8dcefcc96f7", + "OCR2OnchainPublicKey": "d754a628c5b34d027e4ccd8d90b54b9403a9b5f2", + "OCR2OffchainPublicKey": "db6582f9a70f48b886963cea7facbef92ead0de7c0ac0954e7765a526bab454e", + "OCR2ConfigPublicKey": "f53ccfe1fc347988bc7b7151458517ed985283e6e4ae093f6591f015c1d7762a" + }, + { + "OCR2BundleID": "dceccf3e8451d9d43c6d975f106c192b8581554d18c254a6e9539022bced08f9", + "OCR2OnchainPublicKey": "3cc49cd664c836824f1f77283668b7fe139c8090", + "OCR2OffchainPublicKey": "c5daa1235dd866ec912bfd6aceadf7e3ced29443b570ed826d97e4a4ae3b60a2", + "OCR2ConfigPublicKey": "690e03fc2565fbaed75b8b1516f67e8dd97ff9f02962196830f121f571ba7948" + } + ], + "CSAPublicKey": "2861e869bbc7035b2be949d9c8d06189d4af9f962ecb0dbe8a443c7425cfe688" }, { - "AptosBundleID": "9bebfa953e7a7522746f72b4023308de36db626f3e0bcb9033407b8a183e8bfd", - "AptosOnchainPublicKey": "ea551e503b93a1c9ae26262b4db8f66db4cbe5ddcb6039e29d2665a634d48e4d", - "EthAddress": "0xFeB61E22FCf4F9740c9D96b05199F195bd61A7c2", - "P2PPeerID": "12D3KooWMTZnZtcVK4EJsjkKsV9qXNoNRSjT62CZi3tKkXGaCsGh", - "OCR2BundleID": "b5dbc4c9da983cddde2e3226b85807eb7beaf818694a22576af4d80f352702ed", - "OCR2OnchainPublicKey": "fd97efd53fc20acc098fcd746c04d8d7540d97e0", - "OCR2OffchainPublicKey": "91b393bb5e6bd6fd9de23845bcd0e0d9b0dd28a1d65d3cfb1fce9f91bd3d8c19", - "OCR2ConfigPublicKey": "09eb53924ff8b33a08b4eae2f3819015314ce6e8864ac4f86e97caafd4181506", - "CSAPublicKey": "csa_ef55caf17eefc2a9d547b5a3978d396bd237c73af99cd849a4758701122e3cba" + "EthAddress": "0x5323547CdBb450725c59626A1A6C5608C5c1Ea07", + "P2PPeerID": "12D3KooWNeovZBgc4kJWGBi8U8C3rsoyQqZECPqwvgb5E7yBBnzu", + "OCR2KBs": [ + { + "OCR2BundleID": "872bc4c78dc3c751ef100afcd60fa81c7f1744a9a10be1e86f6689455132041e", + "OCR2OnchainPublicKey": "e366aed6fe28f47cc2c463cda40d4bb8573e15d4", + "OCR2OffchainPublicKey": "126d991638b02eadfb614ee011970a1e22ac8838012be58f72eca3cd99326ba9", + "OCR2ConfigPublicKey": "168153f44e3be99df292082ff79eaf6d4972e905c9519c3cc719e416fa9a1e63" + }, + { + "OCR2BundleID": "e63799347d9d0a64e9a7f9715239f640f4df785bee9689898965d83911db3ccb", + "OCR2OnchainPublicKey": "fea23a235be5e3160e88a7a463df0f74f4e035fa", + "OCR2OffchainPublicKey": "93e965f15a1913dd11341b1f829220cda4b3d96b4634fac91183276eed890f52", + "OCR2ConfigPublicKey": "c33577067dffc7af126f654b52d6e176cd0b359024dfdf0bc1dbf381af46ae00" + } + ], + "CSAPublicKey": "05a0b0a1d7c58129ade44a28fc982fe43532160d6367829853da003fbecdc456" }, { - "AptosBundleID": "9bebfa953e7a7522746f72b4023308de36db626f3e0bcb9033407b8a183e8bfe", - "AptosOnchainPublicKey": "ea551e503b93a1c9ae26262b4db8f66db4cbe5ddcb6039e29d2665a634d48e4e", - "EthAddress": "0x882Fd04D78A7e7D386Dd5b550f19479E5494B0B2", - "P2PPeerID": "12D3KooWRsM9yordRQDhLgbErH8WMMGz1bC1J4hR5gAGvMWu8goN", - "OCR2BundleID": "260d5c1a618cdf5324509d7db95f5a117511864ebb9e1f709e8969339eb225af", - "OCR2OnchainPublicKey": "a0b67dc5345a71d02b396147ae2cb75dda63cbe9", - "OCR2OffchainPublicKey": "4f42ef42e5cc351dbbd79c29ef33af25c0250cac84837c1ff997bc111199d07e", - "OCR2ConfigPublicKey": "3b90249731beb9e4f598371f0b96c3babf47bcc62121ebc9c195e3c33e4fd708", - "CSAPublicKey": "csa_1b874ac2d54b966cec5a8358678ca6f030261aabf3372ce9dbea2d4eb9cdab3d" + "EthAddress": "0x16d9BbC5e927053697771AF7d7a003FE7b60B61E", + "P2PPeerID": "12D3KooWSCGxPeUVjLTYcUxd8A53k8Ww1pRbJDb553Rury3UfRpq", + "OCR2KBs": [ + { + "OCR2BundleID": "0fb531b570483b6a02bf245d8854f60c4831550e965cf7d16a80badbb907f9ee", + "OCR2OnchainPublicKey": "405aeb4fa9359a7338217bfc4fdc77c886a6a6ee", + "OCR2OffchainPublicKey": "9f57204194c84d7fb97b67427282684dddd85014497340296ea9f144ed8a4e6e", + "OCR2ConfigPublicKey": "9e5d20fd7a5378c8c4d8baf454b0516da864e3a0cc3393e7e1cf2e909b0bcb3f" + }, + { + "OCR2BundleID": "93ecd598651424647332fba6557e60887c2bffb187e7a0bdbbc955dc0276e792", + "OCR2OnchainPublicKey": "7fee2c4f130decaf2dd6041d4c874e98554a1079", + "OCR2OffchainPublicKey": "bb56dd698595251f6640b3e3235c0611a1d189cb2c243002d2c6a791957f7185", + "OCR2ConfigPublicKey": "493850ef7b53443f0763b5ad4fefbcdd512123cae465d7d56cb9d7c488ed8525" + } + ], + "CSAPublicKey": "aaad908b939c7dbd4aec24add746ec35d4510efebe2d090fdac69dde39babfec" } -] \ No newline at end of file +] From 13e73962def8bd8c9dac98a6e5330ab1aabc7e91 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Tue, 17 Sep 2024 16:39:38 -0700 Subject: [PATCH 017/117] Properly reset clientmethod on each invocation --- core/scripts/keystone/src/99_app.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/99_app.go b/core/scripts/keystone/src/99_app.go index e736c021652..afdbbdb97d5 100644 --- a/core/scripts/keystone/src/99_app.go +++ b/core/scripts/keystone/src/99_app.go @@ -99,7 +99,10 @@ func (c *nodeAPI) exec(clientMethod ...func(*cli.Context) error) ([]byte, error) c.output.Reset() defer c.output.Reset() - defer func() { c.fs = flag.NewFlagSet("test", flag.ContinueOnError) }() + defer func() { + c.fs = flag.NewFlagSet("test", flag.ContinueOnError) + c.clientMethod = nil + }() if c.clientMethod == nil { c.clientMethod = clientMethod[0] From 637e8ea48c433038db4c9bc7a536c087180c00ab Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Tue, 17 Sep 2024 16:40:09 -0700 Subject: [PATCH 018/117] Add mercury contract deployment feature --- .../src/03_deploy_streams_trigger_cmd.go | 430 ++++++++++++------ .../src/03_deploy_streams_trigger_cmd_test.go | 59 +-- .../03_deploy_streams_trigger_cmd_test.snap | 403 +++------------- 3 files changed, 376 insertions(+), 516 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index e0b0783057d..d1ebf842b92 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -10,24 +10,69 @@ package src // See integration workflow here: https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/capabilities/integration_tests/workflow.go#L15 // ^ setup.go provides good insight too import ( + "context" + "encoding/binary" "encoding/json" - "errors" "flag" "fmt" + "math/big" "os" - "path/filepath" - "strconv" - "strings" "net/url" + "github.com/ethereum/go-ethereum/common" + + "github.com/ethereum/go-ethereum/core/types" + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "github.com/smartcontractkit/chainlink/v2/core/bridges" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" + + // "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/fee_manager" + // "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/reward_manager" + verifierContract "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier_proxy" "github.com/smartcontractkit/chainlink/v2/core/store/models" "github.com/smartcontractkit/chainlink/v2/core/web/presenters" ) +type feed struct { + id [32]byte + name string + + // we create a bridge for each feed + bridgeName string + bridgeUrl string +} + +func v3FeedID(id [32]byte) [32]byte { + + binary.BigEndian.PutUint16(id[:2], 3) + return id +} + +var feeds = []feed{ + { + v3FeedID([32]byte{5: 1}), + "BTC/USD", + "mock-bridge-btc", + "http://localhost:4000", + }, + { + v3FeedID([32]byte{5: 2}), + "LINK/USD", + "mock-bridge-link", + "http://localhost:4001", + }, + { + v3FeedID([32]byte{5: 3}), + "NATIVE/USD", + "mock-bridge-native", + "http://localhost:4002", + }, +} + type deployStreamsTrigger struct{} func NewDeployStreamsTriggerCommand() *deployStreamsTrigger { @@ -41,25 +86,20 @@ func (g *deployStreamsTrigger) Name() string { func (g *deployStreamsTrigger) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) chainID := fs.Int64("chainid", 1337, "chain id") - templatesLocation := fs.String("templates", "", "Custom templates location") - feedID := fs.String("feedid", "", "Feed ID") - linkFeedID := fs.String("linkfeedid", "", "Link Feed ID") - nativeFeedID := fs.String("nativefeedid", "", "Native Feed ID") - fromBlock := fs.Int64("fromblock", 0, "From block") + ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") nodeList := fs.String("nodes", "", "Custom node list location") publicKeys := fs.String("publickeys", "", "Custom public keys json location") - verifierContractAddress := fs.String("verifiercontractaddress", "", "Verifier contract address") - verifierProxyContractAddress := fs.String("verifierproxycontractaddress", "", "Verifier proxy contract address") - dryrun := fs.Bool("dryrun", false, "Dry run") + force := fs.Bool("force", false, "Force deployment") + + ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") + accountKey := fs.String("accountkey", "", "private key of the account to deploy from") err := fs.Parse(args) - if err != nil || chainID == nil || *chainID == 0 || - feedID == nil || *feedID == "" || - linkFeedID == nil || *linkFeedID == "" || - nativeFeedID == nil || *nativeFeedID == "" || - fromBlock == nil || *fromBlock == 0 || - verifierContractAddress == nil || *verifierContractAddress == "" || - verifierProxyContractAddress == nil || *verifierProxyContractAddress == "" { + if err != nil || + *ocrConfigFile == "" || ocrConfigFile == nil || + chainID == nil || *chainID == 0 || + *ethUrl == "" || ethUrl == nil || + *accountKey == "" || accountKey == nil { fs.Usage() os.Exit(1) } @@ -70,60 +110,260 @@ func (g *deployStreamsTrigger) Run(args []string) { if *nodeList == "" { *nodeList = defaultNodeList } - if *templatesLocation == "" { - *templatesLocation = "templates" - } - nodes := downloadNodeAPICredentials(*nodeList) + os.Setenv("ETH_URL", *ethUrl) + os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) + os.Setenv("ACCOUNT_KEY", *accountKey) + os.Setenv("INSECURE_SKIP_VERIFY", "true") - jobspecs := genStreamsTriggerJobSpecs( - *publicKeys, + env := helpers.SetupEnv(false) + + setupMercuryV03( + env, *nodeList, - *templatesLocation, + *ocrConfigFile, + *chainID, + *publicKeys, + *force, + ) +} - *feedID, - *linkFeedID, - *nativeFeedID, +// See /core/services/ocr2/plugins/mercury/integration_test.go +func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFilePath string, chainId int64, pubKeysPath string, force bool) { + fmt.Printf("Deploying streams trigger for chain %d\n", chainId) + fmt.Printf("Using OCR config file: %s\n", ocrConfigFilePath) + fmt.Printf("Using node list: %s\n", nodeListPath) + fmt.Printf("Using public keys: %s\n", pubKeysPath) + fmt.Printf("Force: %t\n\n", force) + + fmt.Printf("Deploying Mercury V0.3 contracts\n") + _, _, _, verifier := deployMercuryV03Contracts(env) + // the 0th index is for the OCR3 capability + // where the 1st index is for the mercury OCR2 instance + kbIndex := 1 + nca := downloadNodePubKeys(nodeListPath, chainId, pubKeysPath, kbIndex) + nodes := downloadNodeAPICredentials(nodeListPath) - *chainID, - *fromBlock, + fmt.Printf("Generating OCR3 config\n") + ocrConfig := generateOCR3Config(nodeListPath, ocrConfigFilePath, chainId, pubKeysPath, OffChainTransmitter, kbIndex) + + for _, feed := range feeds { + fmt.Println("Configuring feeds...") + fmt.Printf("FeedID: %x\n", feed.id) + fmt.Printf("FeedName: %s\n", feed.name) + fmt.Printf("BridgeName: %s\n", feed.bridgeName) + fmt.Printf("BridgeURL: %s\n", feed.bridgeUrl) + + fmt.Printf("Setting verifier config\n") + verifier.SetConfig(env.Owner, + feed.id, + ocrConfig.Signers, + ocrConfig.OffChainTransmitters, + ocrConfig.F, + ocrConfig.OnchainConfig, + ocrConfig.OffchainConfigVersion, + ocrConfig.OffchainConfig, + nil, + ) - *verifierContractAddress, - *verifierProxyContractAddress, - ) + fmt.Printf("Deploying OCR2 job specs for feed %s\n", feed.name) + deployOCR2JobSpecsForFeed(nca, nodes, verifier, feed, chainId, force) + } +} - // sanity check arr lengths - if len(nodes) != len(jobspecs) { - PanicErr(errors.New("Mismatched node and job spec lengths")) +func deployMercuryV03Contracts(env helpers.Environment) (linkToken *link_token_interface.LinkToken, nativeToken *link_token_interface.LinkToken, verifierProxy *verifier_proxy.VerifierProxy, verifier *verifierContract.Verifier) { + var confirmDeploy = func(tx *types.Transaction, err error) { + helpers.ConfirmContractDeployed(context.Background(), env.Ec, tx, env.ChainID) + PanicErr(err) + } + var confirmTx = func(tx *types.Transaction, err error) { + helpers.ConfirmTXMined(context.Background(), env.Ec, tx, env.ChainID) + PanicErr(err) } - for i, n := range nodes { - api := newNodeAPI(n) + _, tx, linkToken, err := link_token_interface.DeployLinkToken(env.Owner, env.Ec) + confirmDeploy(tx, err) - specToDeploy := strings.Join(jobspecs[i], "\n") - specFragment := jobspecs[i][0:2] - if *dryrun { - fmt.Println("Dry run, skipping job deployment and bridge setup") - fmt.Printf("Deploying jobspec: %s\n... \n", specToDeploy) - continue + // Not sure if we actually need to have tokens + tx, err = linkToken.Transfer(env.Owner, env.Owner.From, big.NewInt(1000)) + confirmTx(tx, err) + + // We reuse the link token for the native token + _, tx, nativeToken, err = link_token_interface.DeployLinkToken(env.Owner, env.Ec) + confirmDeploy(tx, err) + + // Not sure if we actually need to have tokens + tx, err = nativeToken.Transfer(env.Owner, env.Owner.From, big.NewInt(1000)) + confirmTx(tx, err) + + verifierProxyAddr, tx, verifierProxy, err := verifier_proxy.DeployVerifierProxy(env.Owner, env.Ec, common.Address{}) // zero address for access controller disables access control + confirmDeploy(tx, err) + + verifierAddress, tx, verifier, err := verifierContract.DeployVerifier(env.Owner, env.Ec, verifierProxyAddr) + confirmDeploy(tx, err) + + tx, err = verifierProxy.InitializeVerifier(env.Owner, verifierAddress) + confirmTx(tx, err) + // rewardManagerAddr, _, rewardManager, err := reward_manager.DeployRewardManager(env.Owner, env.Ec, linkTokenAddress) + // PanicErr(err) + // feeManagerAddr, _, _, err := fee_manager.DeployFeeManager(env.Owner, env.Ec, linkTokenAddress, nativeTokenAddress, verifierProxyAddr, rewardManagerAddr) + // PanicErr(err) + // _, err = verifierProxy.SetFeeManager(env.Owner, feeManagerAddr) + // PanicErr(err) + // _, err = rewardManager.SetFeeManager(env.Owner, feeManagerAddr) + // PanicErr(err) + + return +} + +func deployOCR2JobSpecsForFeed(nca []NodeKeys, nodes []*node, verifier *verifierContract.Verifier, feed feed, chainId int64, force bool) { + // we assign the first node as the bootstrap node + for i, n := range nca { + // parallel arrays + api := newNodeAPI(nodes[i]) + jobSpecName := "" + jobSpecStr := "" + + createBridgeIfDoesNotExist(api, feed.bridgeName, feed.bridgeUrl) + if i == 0 { + jobSpecName, jobSpecStr = createMercuryV3BootstrapJob( + verifier.Address(), + feed.name, + feed.id, + chainId, + ) } else { - fmt.Printf("Deploying jobspec: %s\n... \n", specFragment) + jobSpecName, jobSpecStr = createMercuryV3Job( + n.OCR2BundleID, + verifier.Address(), + feed.bridgeName, + n.CSAPublicKey, + fmt.Sprintf("feed-%s", feed.name), + feed.id, + feeds[1].id, + feeds[2].id, + chainId, + ) } - _, err := api.withArg(specToDeploy).exec(api.methods.CreateJob) + jobsResp := api.mustExec(api.methods.ListJobs) + jobs := mustJSON[[]JobSpec](jobsResp) + shouldSkip := false + for _, job := range *jobs { + if job.Name == jobSpecName { + if force { + fmt.Printf("Job already exists: %s, replacing..\n", jobSpecName) + api.withArg(job.Id).mustExec(api.methods.DeleteJob) + fmt.Printf("Deleted job: %s\n", jobSpecName) + } else { + fmt.Printf("Job already exists: %s, skipping..\n", jobSpecName) + shouldSkip = true + } + } + } + + if shouldSkip { + continue + } + fmt.Printf("Deploying jobspec: %s\n... \n", jobSpecStr) + _, err := api.withArg(jobSpecStr).exec(api.methods.CreateJob) if err != nil { - fmt.Println("Failed to deploy job spec:", specFragment, "Error:", err) + panic(fmt.Sprintf("Failed to deploy job spec: %s Error: %s", jobSpecStr, err)) } + } +} - // hard coded bridges for now - createBridgeIfDoesNotExist(api, "bridge-coinmetrics", "http://localhost:4001") - createBridgeIfDoesNotExist(api, "bridge-tiingo", "http://localhost:4002") - createBridgeIfDoesNotExist(api, "bridge-ncfx", "http://localhost:4003") +func createMercuryV3BootstrapJob( + verifierAddress common.Address, + feedName string, + feedID [32]byte, + chainID int64, +) (name string, jobSpecStr string) { + name = fmt.Sprintf("boot-%s", feedName) + fmt.Printf("Creating bootstrap job (%s):\nverifier address: %s\nfeed name: %s\nfeed ID: %x\nchain ID: %d\n", name, verifierAddress, feedName, feedID, chainID) + jobSpecStr = fmt.Sprintf(` +type = "bootstrap" +relay = "evm" +schemaVersion = 1 +name = "%s" +contractID = "%s" +feedID = "0x%x" +contractConfigTrackerPollInterval = "1s" + +[relayConfig] +chainID = %d +enableTriggerCapabillity = true + `, name, verifierAddress, feedID, chainID) - } + return +} + +func createMercuryV3Job( + ocrKeyBundleID string, + verifierAddress common.Address, + bridge string, + nodeCSAKey string, + feedName string, + feedID [32]byte, + linkFeedID [32]byte, + nativeFeedID [32]byte, + chainID int64, +) (name string, jobSpecStr string) { + name = fmt.Sprintf("mercury-%s", feedName) + fmt.Printf("Creating ocr2 job(%s):\nOCR key bundle ID: %s\nverifier address: %s\nbridge: %s\nnodeCSAKey: %s\nfeed name: %s\nfeed ID: %x\nlink feed ID: %x\nnative feed ID: %x\nchain ID: %d\n", name, ocrKeyBundleID, verifierAddress, bridge, nodeCSAKey, feedName, feedID, linkFeedID, nativeFeedID, chainID) + + jobSpecStr = fmt.Sprintf(` +type = "offchainreporting2" +schemaVersion = 1 +name = "mercury-%[1]s" +forwardingAllowed = false +maxTaskDuration = "1s" +contractID = "%[2]s" +feedID = "0x%[3]x" +contractConfigTrackerPollInterval = "1s" +ocrKeyBundleID = "%[4]s" +relay = "evm" +pluginType = "mercury" +transmitterID = "%[5]s" +observationSource = """ + price [type=bridge name="%[6]s" timeout="50ms" requestData=""]; + + benchmark_price [type=jsonparse path="result,mid" index=0]; + price -> benchmark_price; + + bid_price [type=jsonparse path="result,bid" index=1]; + price -> bid_price; + + ask_price [type=jsonparse path="result,ask" index=2]; + price -> ask_price; +""" + +[pluginConfig] +# Dummy pub key +serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" +linkFeedID = "0x%[7]x" +nativeFeedID = "0x%[8]x" +serverURL = "wss://unknown" + +[relayConfig] +enableTriggerCapabillity = true +chainID = "%[9]d" + `, + feedName, + verifierAddress, + feedID, + ocrKeyBundleID, + nodeCSAKey, + bridge, + linkFeedID, + nativeFeedID, + chainID, + ) + return } func createBridgeIfDoesNotExist(api *nodeAPI, name string, eaURL string) { + fmt.Printf("Creating bridge (%s): %s\n", name, eaURL) if doesBridgeExist(api, name) { fmt.Println("Bridge", name, "already exists, skipping creation") return @@ -155,87 +395,3 @@ func doesBridgeExist(api *nodeAPI, name string) bool { fmt.Printf("Found bridge: %s with URL: %s\n", b.Name, b.URL) return true } - -func genStreamsTriggerJobSpecs( - pubkeysPath string, - nodeListPath string, - templatesDir string, - - feedID string, - linkFeedID string, - nativeFeedID string, - - chainID int64, - fromBlock int64, - - verifierContractAddress string, - verifierProxyContractAddress string, -) (output [][]string) { - nodes := downloadNodeAPICredentials(nodeListPath) - nca := downloadNodePubKeys(nodeListPath, chainID, pubkeysPath) - lines, err := readLines(filepath.Join(templatesDir, streamsTriggerSpecTemplate)) - if err != nil { - PanicErr(err) - } - - for i := 0; i < len(nodes); i++ { - n := nca[i] - specLines := renderStreamsTriggerJobSpec( - lines, - - feedID, - linkFeedID, - nativeFeedID, - - chainID, - fromBlock, - - verifierContractAddress, - verifierProxyContractAddress, - - n, - ) - output = append(output, specLines) - } - - return output -} - -func renderStreamsTriggerJobSpec( - lines []string, - - feedID string, - linkFeedID string, - nativeFeedID string, - - chainID int64, - fromBlock int64, - - verifierContractAddress string, - verifierProxyContractAddress string, - - node NodeKeys, -) (output []string) { - chainIDStr := strconv.FormatInt(chainID, 10) - fromBlockStr := strconv.FormatInt(fromBlock, 10) - for _, l := range lines { - l = strings.Replace(l, "{{ feed_id }}", feedID, 1) - l = strings.Replace(l, "{{ link_feed_id }}", linkFeedID, 1) - l = strings.Replace(l, "{{ native_feed_id }}", nativeFeedID, 1) - - l = strings.Replace(l, "{{ chain_id }}", chainIDStr, 1) - l = strings.Replace(l, "{{ from_block }}", fromBlockStr, 1) - - // Verifier contract https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/ocr2/plugins/mercury/integration_test.go#L111 - l = strings.Replace(l, "{{ contract_id }}", verifierContractAddress, 1) - // Ends up just being part of the name as documentation, it's the proxy to the verifier contract - l = strings.Replace(l, "{{ verifier_proxy_id }}", verifierProxyContractAddress, 1) - - // TransmitterID is the CSA key of the node since it's offchain - // https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/ocr2/plugins/mercury/helpers_test.go#L219 - // https://github.com/smartcontractkit/chainlink-common/blob/9ee1e8cc8b9774c8f3eb92a722af5269469f46f4/pkg/types/mercury/types.go#L39 - l = strings.Replace(l, "{{ transmitter_id }}", node.CSAPublicKey, 1) - output = append(output, l) - } - return -} diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go index ea5ed744d29..4bb8aa275b6 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go @@ -1,44 +1,47 @@ package src import ( - "strings" "testing" "github.com/gkampitakis/go-snaps/snaps" ) -func TestGenStreamsTriggerJobSpecs(t *testing.T) { - pubkeysPath := "./testdata/PublicKeys.json" - nodeListPath := "./testdata/NodeList.txt" - templatesDir := "../templates" - - feedID := "feed123" - linkFeedID := "linkfeed123" - nativeFeedID := "nativefeed123" - - chainID := int64(123456) - fromBlock := int64(10) - - verifierContractAddress := "verifier_contract_address" - verifierProxyContractAddress := "verifier_proxy_contract_address" +var ( + chainID = int64(123456) + feedID = [32]byte{0: 1} + feedName = "BTC/USD" + verifierAddress = [20]byte{0: 7} +) - output := genStreamsTriggerJobSpecs( - pubkeysPath, - nodeListPath, - templatesDir, +func TestCreateMercuryV3Job(t *testing.T) { + ocrKeyBundleID := "ocr_key_bundle_id" + nodeCSAKey := "node_csa_key" + bridgeName := "bridge_name" + linkFeedID := [32]byte{0: 2} + nativeFeedID := [32]byte{0: 3} + + _, output := createMercuryV3Job( + ocrKeyBundleID, + verifierAddress, + bridgeName, + nodeCSAKey, + feedName, feedID, linkFeedID, nativeFeedID, chainID, - fromBlock, - verifierContractAddress, - verifierProxyContractAddress, ) - prettyOutputs := []string{} - for _, o := range output { - prettyOutputs = append(prettyOutputs, strings.Join(o, "\n")) - } - testOutput := strings.Join(prettyOutputs, "\n\n-------------------------------------------------\n\n") - snaps.MatchSnapshot(t, testOutput) + snaps.MatchSnapshot(t, output) +} + +func TestCreateMercuryBootstrapJob(t *testing.T) { + _, output := createMercuryV3BootstrapJob( + verifierAddress, + feedName, + feedID, + chainID, + ) + + snaps.MatchSnapshot(t, output) } diff --git a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap index 40a5062b54b..caecccb3aed 100755 --- a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap @@ -1,395 +1,96 @@ [TestGenStreamsTriggerJobSpecs - 1] -name = "MATIC/USD-RefPrice-DFstaging-Premium-ArbitrumSepolia-001 | feed123 | verifier_proxy verifier_proxy_contract_address" -type = "offchainreporting2" -schemaVersion = 1 -forwardingAllowed = false -maxTaskDuration = "0s" -contractID = "verifier_contract_address" -relay = "evm" -pluginType = "mercury" -feedID = "feed123" -transmitterID = "csa_dbae6965bad0b0fa95ecc34a602eee1c0c570ddc29b56502e400d18574b8c3df" -observationSource = """ -// data source 1 -// https://docs.chain.link/data-streams/concepts/liquidity-weighted-prices -// https://github.com/smartcontractkit/ea-framework-js/blob/272846061bd0871da41d844672509aa7b7784d62/src/adapter/lwba.ts#L62 -ds1_payload [type=bridge name="bridge-coinmetrics" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds1_benchmark [type=jsonparse path="data,mid"]; -ds1_bid [type=jsonparse path="data,bid"]; -ds1_ask [type=jsonparse path="data,ask"]; - -ds1_benchmark_multiply [type=multiply times=1000000000000000000]; -ds1_bid_multiply [type=multiply times=1000000000000000000]; -ds1_ask_multiply [type=multiply times=1000000000000000000]; -// data source 2 -ds2_payload [type=bridge name="bridge-tiingo" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds2_benchmark [type=jsonparse path="data,mid"]; -ds2_bid [type=jsonparse path="data,bid"]; -ds2_ask [type=jsonparse path="data,ask"]; - -ds2_benchmark_multiply [type=multiply times=1000000000000000000]; -ds2_bid_multiply [type=multiply times=1000000000000000000]; -ds2_ask_multiply [type=multiply times=1000000000000000000]; -// data source 3 -ds3_payload [type=bridge name="bridge-ncfx" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds3_benchmark [type=jsonparse path="data,mid"]; -ds3_bid [type=jsonparse path="data,bid"]; -ds3_ask [type=jsonparse path="data,ask"]; - -ds3_benchmark_multiply [type=multiply times=1000000000000000000]; -ds3_bid_multiply [type=multiply times=1000000000000000000]; -ds3_ask_multiply [type=multiply times=1000000000000000000]; -// benchmark -ds1_payload -> ds1_benchmark -> ds1_benchmark_multiply -> benchmark_price; -ds2_payload -> ds2_benchmark -> ds2_benchmark_multiply -> benchmark_price; -ds3_payload -> ds3_benchmark -> ds3_benchmark_multiply -> benchmark_price; -// The index is what determines how fields get assigned in a mercury report -// benchmark is always index 0 -// bid is always index 1 -// ask is always index 2 -// See https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/relay/evm/mercury/v3/data_source.go#L225 for more info -benchmark_price [type=median allowedFaults=2 index=0]; -// bid -ds1_payload -> ds1_bid -> ds1_bid_multiply -> bid_price; -ds2_payload -> ds2_bid -> ds2_bid_multiply -> bid_price; -ds3_payload -> ds3_bid -> ds3_bid_multiply -> bid_price; -bid_price [type=median allowedFaults=2 index=1]; - -// ask -ds1_payload -> ds1_ask -> ds1_ask_multiply -> ask_price; -ds2_payload -> ds2_ask -> ds2_ask_multiply -> ask_price; -ds3_payload -> ds3_ask -> ds3_ask_multiply -> ask_price; -ask_price [type=median allowedFaults=2 index=2]; -""" - -[relayConfig] -chainID = "123456" -enableTriggerCapability = true -fromBlock = "10" - -[pluginConfig] -linkFeedID = "linkfeed123" -nativeFeedID = "nativefeed123" -# Dummy pub key -serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" -# We don't need to specify a mercury server URL here since we're using this as a trigger instead -serverURL = "wss://unknown" - -------------------------------------------------- - -name = "MATIC/USD-RefPrice-DFstaging-Premium-ArbitrumSepolia-001 | feed123 | verifier_proxy verifier_proxy_contract_address" type = "offchainreporting2" schemaVersion = 1 +name = "mercury-BTC/USD" forwardingAllowed = false -maxTaskDuration = "0s" -contractID = "verifier_contract_address" +maxTaskDuration = "1s" +contractID = "0x0700000000000000000000000000000000000000" +feedID = "0x0100000000000000000000000000000000000000000000000000000000000000" +contractConfigTrackerPollInterval = "1s" +ocrKeyBundleID = "ocr_key_bundle_id" relay = "evm" pluginType = "mercury" -feedID = "feed123" -transmitterID = "csa_c5cc655a9c19b69626519c4a72c44a94a3675daeba9c16cc23e010a7a6dac1be" +transmitterID = "0400000000000000000000000000000000000000000000000000000000000004" observationSource = """ -// data source 1 -// https://docs.chain.link/data-streams/concepts/liquidity-weighted-prices -// https://github.com/smartcontractkit/ea-framework-js/blob/272846061bd0871da41d844672509aa7b7784d62/src/adapter/lwba.ts#L62 -ds1_payload [type=bridge name="bridge-coinmetrics" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds1_benchmark [type=jsonparse path="data,mid"]; -ds1_bid [type=jsonparse path="data,bid"]; -ds1_ask [type=jsonparse path="data,ask"]; - -ds1_benchmark_multiply [type=multiply times=1000000000000000000]; -ds1_bid_multiply [type=multiply times=1000000000000000000]; -ds1_ask_multiply [type=multiply times=1000000000000000000]; -// data source 2 -ds2_payload [type=bridge name="bridge-tiingo" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds2_benchmark [type=jsonparse path="data,mid"]; -ds2_bid [type=jsonparse path="data,bid"]; -ds2_ask [type=jsonparse path="data,ask"]; + price [type=bridge name="bridge_name" timeout="50ms" requestData=""]; -ds2_benchmark_multiply [type=multiply times=1000000000000000000]; -ds2_bid_multiply [type=multiply times=1000000000000000000]; -ds2_ask_multiply [type=multiply times=1000000000000000000]; -// data source 3 -ds3_payload [type=bridge name="bridge-ncfx" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds3_benchmark [type=jsonparse path="data,mid"]; -ds3_bid [type=jsonparse path="data,bid"]; -ds3_ask [type=jsonparse path="data,ask"]; + benchmark_price [type=jsonparse path="result,mid" index=0]; + price -> benchmark_price; -ds3_benchmark_multiply [type=multiply times=1000000000000000000]; -ds3_bid_multiply [type=multiply times=1000000000000000000]; -ds3_ask_multiply [type=multiply times=1000000000000000000]; -// benchmark -ds1_payload -> ds1_benchmark -> ds1_benchmark_multiply -> benchmark_price; -ds2_payload -> ds2_benchmark -> ds2_benchmark_multiply -> benchmark_price; -ds3_payload -> ds3_benchmark -> ds3_benchmark_multiply -> benchmark_price; -// The index is what determines how fields get assigned in a mercury report -// benchmark is always index 0 -// bid is always index 1 -// ask is always index 2 -// See https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/relay/evm/mercury/v3/data_source.go#L225 for more info -benchmark_price [type=median allowedFaults=2 index=0]; + bid_price [type=jsonparse path="result,bid" index=1]; + price -> bid_price; -// bid -ds1_payload -> ds1_bid -> ds1_bid_multiply -> bid_price; -ds2_payload -> ds2_bid -> ds2_bid_multiply -> bid_price; -ds3_payload -> ds3_bid -> ds3_bid_multiply -> bid_price; -bid_price [type=median allowedFaults=2 index=1]; - -// ask -ds1_payload -> ds1_ask -> ds1_ask_multiply -> ask_price; -ds2_payload -> ds2_ask -> ds2_ask_multiply -> ask_price; -ds3_payload -> ds3_ask -> ds3_ask_multiply -> ask_price; -ask_price [type=median allowedFaults=2 index=2]; + ask_price [type=jsonparse path="result,ask" index=2]; + price -> ask_price; """ -[relayConfig] -chainID = "123456" -enableTriggerCapability = true -fromBlock = "10" - [pluginConfig] -linkFeedID = "linkfeed123" -nativeFeedID = "nativefeed123" # Dummy pub key serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" -# We don't need to specify a mercury server URL here since we're using this as a trigger instead +linkFeedID = "0x0200000000000000000000000000000000000000000000000000000000000000" +nativeFeedID = "0x0300000000000000000000000000000000000000000000000000000000000000" serverURL = "wss://unknown" -------------------------------------------------- - -name = "MATIC/USD-RefPrice-DFstaging-Premium-ArbitrumSepolia-001 | feed123 | verifier_proxy verifier_proxy_contract_address" -type = "offchainreporting2" -schemaVersion = 1 -forwardingAllowed = false -maxTaskDuration = "0s" -contractID = "verifier_contract_address" -relay = "evm" -pluginType = "mercury" -feedID = "feed123" -transmitterID = "csa_7407fc90c70895c0fb2bdf385e2e4918364bec1f7a74bad7fdf696bffafbcab8" -observationSource = """ -// data source 1 -// https://docs.chain.link/data-streams/concepts/liquidity-weighted-prices -// https://github.com/smartcontractkit/ea-framework-js/blob/272846061bd0871da41d844672509aa7b7784d62/src/adapter/lwba.ts#L62 -ds1_payload [type=bridge name="bridge-coinmetrics" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds1_benchmark [type=jsonparse path="data,mid"]; -ds1_bid [type=jsonparse path="data,bid"]; -ds1_ask [type=jsonparse path="data,ask"]; - -ds1_benchmark_multiply [type=multiply times=1000000000000000000]; -ds1_bid_multiply [type=multiply times=1000000000000000000]; -ds1_ask_multiply [type=multiply times=1000000000000000000]; -// data source 2 -ds2_payload [type=bridge name="bridge-tiingo" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds2_benchmark [type=jsonparse path="data,mid"]; -ds2_bid [type=jsonparse path="data,bid"]; -ds2_ask [type=jsonparse path="data,ask"]; - -ds2_benchmark_multiply [type=multiply times=1000000000000000000]; -ds2_bid_multiply [type=multiply times=1000000000000000000]; -ds2_ask_multiply [type=multiply times=1000000000000000000]; -// data source 3 -ds3_payload [type=bridge name="bridge-ncfx" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds3_benchmark [type=jsonparse path="data,mid"]; -ds3_bid [type=jsonparse path="data,bid"]; -ds3_ask [type=jsonparse path="data,ask"]; - -ds3_benchmark_multiply [type=multiply times=1000000000000000000]; -ds3_bid_multiply [type=multiply times=1000000000000000000]; -ds3_ask_multiply [type=multiply times=1000000000000000000]; -// benchmark -ds1_payload -> ds1_benchmark -> ds1_benchmark_multiply -> benchmark_price; -ds2_payload -> ds2_benchmark -> ds2_benchmark_multiply -> benchmark_price; -ds3_payload -> ds3_benchmark -> ds3_benchmark_multiply -> benchmark_price; -// The index is what determines how fields get assigned in a mercury report -// benchmark is always index 0 -// bid is always index 1 -// ask is always index 2 -// See https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/relay/evm/mercury/v3/data_source.go#L225 for more info -benchmark_price [type=median allowedFaults=2 index=0]; +[relayConfig] +enableTriggerCapabillity = true +chainID = "123456" + +--- -// bid -ds1_payload -> ds1_bid -> ds1_bid_multiply -> bid_price; -ds2_payload -> ds2_bid -> ds2_bid_multiply -> bid_price; -ds3_payload -> ds3_bid -> ds3_bid_multiply -> bid_price; -bid_price [type=median allowedFaults=2 index=1]; +[TestCreateMercuryBootstrapJob - 1] -// ask -ds1_payload -> ds1_ask -> ds1_ask_multiply -> ask_price; -ds2_payload -> ds2_ask -> ds2_ask_multiply -> ask_price; -ds3_payload -> ds3_ask -> ds3_ask_multiply -> ask_price; -ask_price [type=median allowedFaults=2 index=2]; -""" +type = "bootstrap" +relay = "evm" +schemaVersion = 1 +name = "boot-BTC/USD" +contractID = "0x0700000000000000000000000000000000000000" +feedID = "0x0100000000000000000000000000000000000000000000000000000000000000" +contractConfigTrackerPollInterval = "1s" [relayConfig] -chainID = "123456" -enableTriggerCapability = true -fromBlock = "10" +chainID = 123456 +enableTriggerCapabillity = true -[pluginConfig] -linkFeedID = "linkfeed123" -nativeFeedID = "nativefeed123" -# Dummy pub key -serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" -# We don't need to specify a mercury server URL here since we're using this as a trigger instead -serverURL = "wss://unknown" +--- -------------------------------------------------- +[TestCreateMercuryV3Job - 1] -name = "MATIC/USD-RefPrice-DFstaging-Premium-ArbitrumSepolia-001 | feed123 | verifier_proxy verifier_proxy_contract_address" type = "offchainreporting2" schemaVersion = 1 +name = "mercury-BTC/USD" forwardingAllowed = false -maxTaskDuration = "0s" -contractID = "verifier_contract_address" +maxTaskDuration = "1s" +contractID = "0x0700000000000000000000000000000000000000" +feedID = "0x0100000000000000000000000000000000000000000000000000000000000000" +contractConfigTrackerPollInterval = "1s" +ocrKeyBundleID = "ocr_key_bundle_id" relay = "evm" pluginType = "mercury" -feedID = "feed123" -transmitterID = "csa_ef55caf17eefc2a9d547b5a3978d396bd237c73af99cd849a4758701122e3cba" +transmitterID = "node_csa_key" observationSource = """ -// data source 1 -// https://docs.chain.link/data-streams/concepts/liquidity-weighted-prices -// https://github.com/smartcontractkit/ea-framework-js/blob/272846061bd0871da41d844672509aa7b7784d62/src/adapter/lwba.ts#L62 -ds1_payload [type=bridge name="bridge-coinmetrics" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds1_benchmark [type=jsonparse path="data,mid"]; -ds1_bid [type=jsonparse path="data,bid"]; -ds1_ask [type=jsonparse path="data,ask"]; - -ds1_benchmark_multiply [type=multiply times=1000000000000000000]; -ds1_bid_multiply [type=multiply times=1000000000000000000]; -ds1_ask_multiply [type=multiply times=1000000000000000000]; -// data source 2 -ds2_payload [type=bridge name="bridge-tiingo" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds2_benchmark [type=jsonparse path="data,mid"]; -ds2_bid [type=jsonparse path="data,bid"]; -ds2_ask [type=jsonparse path="data,ask"]; + price [type=bridge name="bridge_name" timeout="50ms" requestData=""]; -ds2_benchmark_multiply [type=multiply times=1000000000000000000]; -ds2_bid_multiply [type=multiply times=1000000000000000000]; -ds2_ask_multiply [type=multiply times=1000000000000000000]; -// data source 3 -ds3_payload [type=bridge name="bridge-ncfx" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds3_benchmark [type=jsonparse path="data,mid"]; -ds3_bid [type=jsonparse path="data,bid"]; -ds3_ask [type=jsonparse path="data,ask"]; + benchmark_price [type=jsonparse path="result,mid" index=0]; + price -> benchmark_price; -ds3_benchmark_multiply [type=multiply times=1000000000000000000]; -ds3_bid_multiply [type=multiply times=1000000000000000000]; -ds3_ask_multiply [type=multiply times=1000000000000000000]; -// benchmark -ds1_payload -> ds1_benchmark -> ds1_benchmark_multiply -> benchmark_price; -ds2_payload -> ds2_benchmark -> ds2_benchmark_multiply -> benchmark_price; -ds3_payload -> ds3_benchmark -> ds3_benchmark_multiply -> benchmark_price; -// The index is what determines how fields get assigned in a mercury report -// benchmark is always index 0 -// bid is always index 1 -// ask is always index 2 -// See https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/relay/evm/mercury/v3/data_source.go#L225 for more info -benchmark_price [type=median allowedFaults=2 index=0]; + bid_price [type=jsonparse path="result,bid" index=1]; + price -> bid_price; -// bid -ds1_payload -> ds1_bid -> ds1_bid_multiply -> bid_price; -ds2_payload -> ds2_bid -> ds2_bid_multiply -> bid_price; -ds3_payload -> ds3_bid -> ds3_bid_multiply -> bid_price; -bid_price [type=median allowedFaults=2 index=1]; - -// ask -ds1_payload -> ds1_ask -> ds1_ask_multiply -> ask_price; -ds2_payload -> ds2_ask -> ds2_ask_multiply -> ask_price; -ds3_payload -> ds3_ask -> ds3_ask_multiply -> ask_price; -ask_price [type=median allowedFaults=2 index=2]; + ask_price [type=jsonparse path="result,ask" index=2]; + price -> ask_price; """ -[relayConfig] -chainID = "123456" -enableTriggerCapability = true -fromBlock = "10" - [pluginConfig] -linkFeedID = "linkfeed123" -nativeFeedID = "nativefeed123" # Dummy pub key serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" -# We don't need to specify a mercury server URL here since we're using this as a trigger instead +linkFeedID = "0x0200000000000000000000000000000000000000000000000000000000000000" +nativeFeedID = "0x0300000000000000000000000000000000000000000000000000000000000000" serverURL = "wss://unknown" -------------------------------------------------- - -name = "MATIC/USD-RefPrice-DFstaging-Premium-ArbitrumSepolia-001 | feed123 | verifier_proxy verifier_proxy_contract_address" -type = "offchainreporting2" -schemaVersion = 1 -forwardingAllowed = false -maxTaskDuration = "0s" -contractID = "verifier_contract_address" -relay = "evm" -pluginType = "mercury" -feedID = "feed123" -transmitterID = "csa_1b874ac2d54b966cec5a8358678ca6f030261aabf3372ce9dbea2d4eb9cdab3d" -observationSource = """ -// data source 1 -// https://docs.chain.link/data-streams/concepts/liquidity-weighted-prices -// https://github.com/smartcontractkit/ea-framework-js/blob/272846061bd0871da41d844672509aa7b7784d62/src/adapter/lwba.ts#L62 -ds1_payload [type=bridge name="bridge-coinmetrics" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds1_benchmark [type=jsonparse path="data,mid"]; -ds1_bid [type=jsonparse path="data,bid"]; -ds1_ask [type=jsonparse path="data,ask"]; - -ds1_benchmark_multiply [type=multiply times=1000000000000000000]; -ds1_bid_multiply [type=multiply times=1000000000000000000]; -ds1_ask_multiply [type=multiply times=1000000000000000000]; -// data source 2 -ds2_payload [type=bridge name="bridge-tiingo" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds2_benchmark [type=jsonparse path="data,mid"]; -ds2_bid [type=jsonparse path="data,bid"]; -ds2_ask [type=jsonparse path="data,ask"]; - -ds2_benchmark_multiply [type=multiply times=1000000000000000000]; -ds2_bid_multiply [type=multiply times=1000000000000000000]; -ds2_ask_multiply [type=multiply times=1000000000000000000]; -// data source 3 -ds3_payload [type=bridge name="bridge-ncfx" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds3_benchmark [type=jsonparse path="data,mid"]; -ds3_bid [type=jsonparse path="data,bid"]; -ds3_ask [type=jsonparse path="data,ask"]; - -ds3_benchmark_multiply [type=multiply times=1000000000000000000]; -ds3_bid_multiply [type=multiply times=1000000000000000000]; -ds3_ask_multiply [type=multiply times=1000000000000000000]; -// benchmark -ds1_payload -> ds1_benchmark -> ds1_benchmark_multiply -> benchmark_price; -ds2_payload -> ds2_benchmark -> ds2_benchmark_multiply -> benchmark_price; -ds3_payload -> ds3_benchmark -> ds3_benchmark_multiply -> benchmark_price; -// The index is what determines how fields get assigned in a mercury report -// benchmark is always index 0 -// bid is always index 1 -// ask is always index 2 -// See https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/relay/evm/mercury/v3/data_source.go#L225 for more info -benchmark_price [type=median allowedFaults=2 index=0]; - -// bid -ds1_payload -> ds1_bid -> ds1_bid_multiply -> bid_price; -ds2_payload -> ds2_bid -> ds2_bid_multiply -> bid_price; -ds3_payload -> ds3_bid -> ds3_bid_multiply -> bid_price; -bid_price [type=median allowedFaults=2 index=1]; - -// ask -ds1_payload -> ds1_ask -> ds1_ask_multiply -> ask_price; -ds2_payload -> ds2_ask -> ds2_ask_multiply -> ask_price; -ds3_payload -> ds3_ask -> ds3_ask_multiply -> ask_price; -ask_price [type=median allowedFaults=2 index=2]; -""" - [relayConfig] -chainID = "123456" -enableTriggerCapability = true -fromBlock = "10" - -[pluginConfig] -linkFeedID = "linkfeed123" -nativeFeedID = "nativefeed123" -# Dummy pub key -serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" -# We don't need to specify a mercury server URL here since we're using this as a trigger instead -serverURL = "wss://unknown" +enableTriggerCapabillity = true +chainID = "123456" + --- From 41f0e72e0a56aebb7a8e2b5476e73efa8ab61da8 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:15:05 -0700 Subject: [PATCH 019/117] Get oracles to successfully connect to each other --- .../src/03_deploy_streams_trigger_cmd.go | 134 ++++++++++++++++-- .../src/03_deploy_streams_trigger_cmd_test.go | 8 +- .../03_deploy_streams_trigger_cmd_test.snap | 1 + 3 files changed, 131 insertions(+), 12 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index d1ebf842b92..c9576b2f652 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -15,18 +15,30 @@ import ( "encoding/json" "flag" "fmt" + "math" "math/big" "os" + "time" "net/url" "github.com/ethereum/go-ethereum/common" + "github.com/shopspring/decimal" "github.com/ethereum/go-ethereum/core/types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" + "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3confighelper" + + ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + + mercurytypes "github.com/smartcontractkit/chainlink-common/pkg/types/mercury" + datastreamsmercury "github.com/smartcontractkit/chainlink-data-streams/mercury" + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" // "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/fee_manager" // "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/reward_manager" @@ -145,7 +157,7 @@ func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFile nodes := downloadNodeAPICredentials(nodeListPath) fmt.Printf("Generating OCR3 config\n") - ocrConfig := generateOCR3Config(nodeListPath, ocrConfigFilePath, chainId, pubKeysPath, OffChainTransmitter, kbIndex) + ocrConfig := generateMercuryOCR2Config(nca) for _, feed := range feeds { fmt.Println("Configuring feeds...") @@ -155,10 +167,11 @@ func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFile fmt.Printf("BridgeURL: %s\n", feed.bridgeUrl) fmt.Printf("Setting verifier config\n") - verifier.SetConfig(env.Owner, + verifier.SetConfig( + env.Owner, feed.id, ocrConfig.Signers, - ocrConfig.OffChainTransmitters, + ocrConfig.Transmitters, ocrConfig.F, ocrConfig.OnchainConfig, ocrConfig.OffchainConfigVersion, @@ -235,6 +248,7 @@ func deployOCR2JobSpecsForFeed(nca []NodeKeys, nodes []*node, verifier *verifier } else { jobSpecName, jobSpecStr = createMercuryV3Job( n.OCR2BundleID, + fmt.Sprintf("%s@%s:%s", nca[0].P2PPeerID, "app-node1", "6690"), verifier.Address(), feed.bridgeName, n.CSAPublicKey, @@ -300,6 +314,7 @@ enableTriggerCapabillity = true func createMercuryV3Job( ocrKeyBundleID string, + bootstrapHost string, verifierAddress common.Address, bridge string, nodeCSAKey string, @@ -316,17 +331,18 @@ func createMercuryV3Job( type = "offchainreporting2" schemaVersion = 1 name = "mercury-%[1]s" +p2pv2Bootstrappers = ["%[2]s"] forwardingAllowed = false maxTaskDuration = "1s" -contractID = "%[2]s" -feedID = "0x%[3]x" +contractID = "%[3]s" +feedID = "0x%[4]x" contractConfigTrackerPollInterval = "1s" -ocrKeyBundleID = "%[4]s" +ocrKeyBundleID = "%[5]s" relay = "evm" pluginType = "mercury" -transmitterID = "%[5]s" +transmitterID = "%[6]s" observationSource = """ - price [type=bridge name="%[6]s" timeout="50ms" requestData=""]; + price [type=bridge name="%[7]s" timeout="50ms" requestData=""]; benchmark_price [type=jsonparse path="result,mid" index=0]; price -> benchmark_price; @@ -341,15 +357,16 @@ observationSource = """ [pluginConfig] # Dummy pub key serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" -linkFeedID = "0x%[7]x" -nativeFeedID = "0x%[8]x" +linkFeedID = "0x%[8]x" +nativeFeedID = "0x%[9]x" serverURL = "wss://unknown" [relayConfig] enableTriggerCapabillity = true -chainID = "%[9]d" +chainID = "%[10]d" `, feedName, + bootstrapHost, verifierAddress, feedID, ocrKeyBundleID, @@ -395,3 +412,98 @@ func doesBridgeExist(api *nodeAPI, name string) bool { fmt.Printf("Found bridge: %s with URL: %s\n", b.Name, b.URL) return true } + +func generateMercuryOCR2Config(nca []NodeKeys) MercuryOCR2Config { + f := uint8(1) + rawOnchainConfig := mercurytypes.OnchainConfig{ + Min: big.NewInt(0), + Max: big.NewInt(math.MaxInt64), + } + rawReportingPluginConfig := datastreamsmercury.OffchainConfig{ + ExpirationWindow: 1, + BaseUSDFee: decimal.NewFromInt(100), + } + + onchainConfig, err := (datastreamsmercury.StandardOnchainConfigCodec{}).Encode(rawOnchainConfig) + helpers.PanicErr(err) + reportingPluginConfig, err := json.Marshal(rawReportingPluginConfig) + helpers.PanicErr(err) + + onchainPubKeys := []common.Address{} + for _, n := range nca { + onchainPubKeys = append(onchainPubKeys, common.HexToAddress(n.OCR2OnchainPublicKey)) + } + + offchainPubKeysBytes := []ocrtypes.OffchainPublicKey{} + for _, n := range nca { + + pkBytesFixed := strToBytes32(n.OCR2OffchainPublicKey) + offchainPubKeysBytes = append(offchainPubKeysBytes, ocrtypes.OffchainPublicKey(pkBytesFixed)) + } + + configPubKeysBytes := []ocrtypes.ConfigEncryptionPublicKey{} + for _, n := range nca { + pkBytesFixed := strToBytes32(n.OCR2ConfigPublicKey) + configPubKeysBytes = append(configPubKeysBytes, ocrtypes.ConfigEncryptionPublicKey(pkBytesFixed)) + } + + identities := []confighelper.OracleIdentityExtra{} + for index := range nca { + transmitterAccount := ocrtypes.Account(fmt.Sprintf("%x", nca[index].CSAPublicKey[:])) + + identities = append(identities, confighelper.OracleIdentityExtra{ + OracleIdentity: confighelper.OracleIdentity{ + OnchainPublicKey: onchainPubKeys[index][:], + OffchainPublicKey: offchainPubKeysBytes[index], + PeerID: nca[index].P2PPeerID, + TransmitAccount: transmitterAccount, + }, + ConfigEncryptionPublicKey: configPubKeysBytes[index], + }) + } + + signers, _, _, onchainConfig, offchainConfigVersion, offchainConfig, err := ocr3confighelper.ContractSetConfigArgsForTestsMercuryV02( + 2*time.Second, // DeltaProgress + 20*time.Second, // DeltaResend + 400*time.Millisecond, // DeltaInitial + 100*time.Millisecond, // DeltaRound + 0, // DeltaGrace + 300*time.Millisecond, // DeltaCertifiedCommitRequest + 1*time.Minute, // DeltaStage + 100, // rMax + []int{len(identities)}, // S + identities, + reportingPluginConfig, // reportingPluginConfig []byte, + 250*time.Millisecond, // Max duration observation + int(f), // f + onchainConfig, + ) + signerAddresses, err := evm.OnchainPublicKeyToAddress(signers) + PanicErr(err) + + var offChainTransmitters [][32]byte + for _, n := range nca { + fmt.Println("CSAPublicKey", n.CSAPublicKey) + offChainTransmitters = append(offChainTransmitters, strToBytes32(n.CSAPublicKey)) + } + + config := MercuryOCR2Config{ + Signers: signerAddresses, + Transmitters: offChainTransmitters, + F: f, + OnchainConfig: onchainConfig, + OffchainConfigVersion: offchainConfigVersion, + OffchainConfig: offchainConfig, + } + + return config +} + +type MercuryOCR2Config struct { + Signers []common.Address + Transmitters [][32]byte + F uint8 + OnchainConfig []byte + OffchainConfigVersion uint64 + OffchainConfig []byte +} diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go index 4bb8aa275b6..5606789fc50 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go @@ -1,6 +1,7 @@ package src import ( + "net/url" "testing" "github.com/gkampitakis/go-snaps/snaps" @@ -15,13 +16,18 @@ var ( func TestCreateMercuryV3Job(t *testing.T) { ocrKeyBundleID := "ocr_key_bundle_id" - nodeCSAKey := "node_csa_key" + nodeCSAKey := "node_csa_key" bridgeName := "bridge_name" linkFeedID := [32]byte{0: 2} nativeFeedID := [32]byte{0: 3} + u, err := url.Parse("https://crib-henry-keystone-node1.main.stage.cldev.sh") + if err != nil { + t.Fatal(err) + } _, output := createMercuryV3Job( ocrKeyBundleID, + u.Hostname(), verifierAddress, bridgeName, nodeCSAKey, diff --git a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap index caecccb3aed..bc6caa0d69d 100755 --- a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap @@ -60,6 +60,7 @@ enableTriggerCapabillity = true type = "offchainreporting2" schemaVersion = 1 name = "mercury-BTC/USD" +p2pv2Bootstrappers = ["crib-henry-keystone-node1.main.stage.cldev.sh"] forwardingAllowed = false maxTaskDuration = "1s" contractID = "0x0700000000000000000000000000000000000000" From 7a2ce4fbf9647b8178bf3a13be37e72109fb764d Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 18 Sep 2024 16:59:03 -0700 Subject: [PATCH 020/117] Keep OCR3 and OCR2 config separate --- .../keystone/src/01_deploy_contracts_cmd.go | 1 - .../keystone/src/88_gen_ocr3_config_test.go | 2 +- core/scripts/keystone/src/99_fetch_keys.go | 27 +++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/core/scripts/keystone/src/01_deploy_contracts_cmd.go b/core/scripts/keystone/src/01_deploy_contracts_cmd.go index c38dc82a903..33e627c9e8c 100644 --- a/core/scripts/keystone/src/01_deploy_contracts_cmd.go +++ b/core/scripts/keystone/src/01_deploy_contracts_cmd.go @@ -107,7 +107,6 @@ func deploy( configFile, env.ChainID, publicKeys, - OnChainTransmitter, ) if dryRun { diff --git a/core/scripts/keystone/src/88_gen_ocr3_config_test.go b/core/scripts/keystone/src/88_gen_ocr3_config_test.go index 19c6bc50a05..da22397c1c6 100644 --- a/core/scripts/keystone/src/88_gen_ocr3_config_test.go +++ b/core/scripts/keystone/src/88_gen_ocr3_config_test.go @@ -10,7 +10,7 @@ import ( func TestGenerateOCR3Config(t *testing.T) { // Generate OCR3 config - config := generateOCR3Config(".cache/NodeList.txt", "./testdata/SampleConfig.json", 1337, "./testdata/PublicKeys.json", OnChainTransmitter) + config := generateOCR3Config(".cache/NodeList.txt", "./testdata/SampleConfig.json", 1337, "./testdata/PublicKeys.json") matchOffchainConfig := match.Custom("OffchainConfig", func(s any) (any, error) { // coerce the value to a string diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index 881e0a1c7ac..41dfcfd583e 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -137,6 +137,33 @@ func (a AllNodeKeys) toNodeKeys(index ...int) NodeKeys { } } +// This is an OCR key bundle with the prefixes on each respective key +// trimmed off +type OCR2KBTrimmed struct { + OCR2BundleID string // used only in job spec + OCR2OnchainPublicKey string // ocr2on_evm_ + OCR2OffchainPublicKey string // ocr2off_evm_ + OCR2ConfigPublicKey string // ocr2cfg_evm_ +} + +// This is an Aptos key bundle with the prefixes on each respective key +// trimmed off +type OCR2AptosKBTrimmed struct { + AptosBundleID string `json:"AptosBundleID"` + AptosOnchainPublicKey string `json:"AptosOnchainPublicKey"` // ocr2on_aptos_ +} + +type NodeKeys struct { + EthAddress string + OCR2KBTrimmed + AptosAccount string `json:"AptosAccount"` + OCR2AptosKBTrimmed + P2PPeerID string // p2p_ + CSAPublicKey string +} + + + func mustFetchAllNodeKeys(chainId int64, nodes []*node) []AllNodeKeys { allNodeKeys := []AllNodeKeys{} From e56d3143dcbb7c5545e276a8cf1f6601ee92ba2c Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 18 Sep 2024 22:42:25 -0700 Subject: [PATCH 021/117] Add goreleaser setup for mock ea --- .../src/external-adapter/.goreleaser.yaml | 20 +++++++ .../external-adapter/99_external_adapter.go | 52 ++++++++++++++++--- .../keystone/src/external-adapter/Dockerfile | 5 ++ 3 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 core/scripts/keystone/src/external-adapter/.goreleaser.yaml create mode 100644 core/scripts/keystone/src/external-adapter/Dockerfile diff --git a/core/scripts/keystone/src/external-adapter/.goreleaser.yaml b/core/scripts/keystone/src/external-adapter/.goreleaser.yaml new file mode 100644 index 00000000000..5c2141dd926 --- /dev/null +++ b/core/scripts/keystone/src/external-adapter/.goreleaser.yaml @@ -0,0 +1,20 @@ +project_name: kiab-mock-external-adapter +version: 2 + +builds: + - id: linux-amd64 + goos: + - linux + goarch: + - amd64 + +dockers: + - id: linux-amd64 + use: buildx + goos: linux + goarch: amd64 + image_templates: + - "{{ .Env.IMAGE }}" + +snapshot: + version_template: "{{ .ProjectName }}-{{ .ShortCommit }}" diff --git a/core/scripts/keystone/src/external-adapter/99_external_adapter.go b/core/scripts/keystone/src/external-adapter/99_external_adapter.go index 4c768ce4ccd..5335bbaf1d9 100644 --- a/core/scripts/keystone/src/external-adapter/99_external_adapter.go +++ b/core/scripts/keystone/src/external-adapter/99_external_adapter.go @@ -3,27 +3,65 @@ package main // Taken from https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/ocr2/plugins/mercury/integration_test.go#L1055 import ( "fmt" + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "math/rand" "net" "net/http" "net/http/httptest" + "os" + "strconv" ) func main() { - // Simulating MATIC/USD - initialValue := 0.4 - pctBounds := 0.3 + // get initial value from env + btcUsdInitialValue := 0.0 + btcUsdInitialValueEnv := os.Getenv("BTCUSD_INITIAL_VALUE") + linkInitialValue := 0.0 + linkInitialValueEnv := os.Getenv("LINK_INITIAL_VALUE") + nativeInitialValue := 0.0 + nativeInitialValueEnv := os.Getenv("NATIVE_INITIAL_VALUE") + + if btcUsdInitialValueEnv == "" { + fmt.Println("INITIAL_VALUE not set, using default value") + btcUsdInitialValue = 1000 + } else { + fmt.Println("INITIAL_VALUE set to ", btcUsdInitialValueEnv) + val, err := strconv.ParseFloat(btcUsdInitialValueEnv, 64) + helpers.PanicErr(err) + btcUsdInitialValue = val + } + + if linkInitialValueEnv == "" { + fmt.Println("LINK_INITIAL_VALUE not set, using default value") + linkInitialValue = 11.0 + } else { + fmt.Println("LINK_INITIAL_VALUE set to ", linkInitialValueEnv) + val, err := strconv.ParseFloat(linkInitialValueEnv, 64) + helpers.PanicErr(err) + linkInitialValue = val + } + + if nativeInitialValueEnv == "" { + fmt.Println("NATIVE_INITIAL_VALUE not set, using default value") + nativeInitialValue = 2400.0 + } else { + fmt.Println("NATIVE_INITIAL_VALUE set to ", nativeInitialValueEnv) + val, err := strconv.ParseFloat(nativeInitialValueEnv, 64) + helpers.PanicErr(err) + nativeInitialValue = val + } - externalAdapter(initialValue, "4001", pctBounds) - externalAdapter(initialValue, "4002", pctBounds) - externalAdapter(initialValue, "4003", pctBounds) + pctBounds := 0.3 + externalAdapter(btcUsdInitialValue, "4001", pctBounds) + externalAdapter(linkInitialValue, "4002", pctBounds) + externalAdapter(nativeInitialValue, "4003", pctBounds) select {} } func externalAdapter(initialValue float64, port string, pctBounds float64) *httptest.Server { // Create a custom listener on the specified port - listener, err := net.Listen("tcp", "localhost:"+port) + listener, err := net.Listen("tcp", "0.0.0.0:"+port) if err != nil { panic(err) } diff --git a/core/scripts/keystone/src/external-adapter/Dockerfile b/core/scripts/keystone/src/external-adapter/Dockerfile new file mode 100644 index 00000000000..9242528f465 --- /dev/null +++ b/core/scripts/keystone/src/external-adapter/Dockerfile @@ -0,0 +1,5 @@ +FROM scratch + +ENTRYPOINT ["/kiab-mock-external-adapter"] + +COPY kiab-mock-external-adapter / From d369298b33eb2793106086de76e69d874358fba3 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 18 Sep 2024 22:42:45 -0700 Subject: [PATCH 022/117] Add support for updating bridges --- .../src/03_deploy_streams_trigger_cmd.go | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index c9576b2f652..1e3c251a928 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -69,19 +69,19 @@ var feeds = []feed{ v3FeedID([32]byte{5: 1}), "BTC/USD", "mock-bridge-btc", - "http://localhost:4000", + "http://external-adapter:4001", }, { v3FeedID([32]byte{5: 2}), "LINK/USD", "mock-bridge-link", - "http://localhost:4001", + "http://external-adapter:4002", }, { v3FeedID([32]byte{5: 3}), "NATIVE/USD", "mock-bridge-native", - "http://localhost:4002", + "http://external-adapter:4003", }, } @@ -237,7 +237,7 @@ func deployOCR2JobSpecsForFeed(nca []NodeKeys, nodes []*node, verifier *verifier jobSpecName := "" jobSpecStr := "" - createBridgeIfDoesNotExist(api, feed.bridgeName, feed.bridgeUrl) + createBridgeIfDoesNotExist(api, feed.bridgeName, feed.bridgeUrl, force) if i == 0 { jobSpecName, jobSpecStr = createMercuryV3BootstrapJob( verifier.Address(), @@ -379,13 +379,7 @@ chainID = "%[10]d" return } -func createBridgeIfDoesNotExist(api *nodeAPI, name string, eaURL string) { - fmt.Printf("Creating bridge (%s): %s\n", name, eaURL) - if doesBridgeExist(api, name) { - fmt.Println("Bridge", name, "already exists, skipping creation") - return - } - +func createBridgeIfDoesNotExist(api *nodeAPI, name string, eaURL string, force bool) { u, err := url.Parse(eaURL) url := models.WebURL(*u) // Confirmations and MinimumContractPayment are not used, so we can leave them as 0 @@ -393,12 +387,25 @@ func createBridgeIfDoesNotExist(api *nodeAPI, name string, eaURL string) { Name: bridges.MustParseBridgeName(name), URL: url, } - payload, err := json.Marshal(b) + payloadb, err := json.Marshal(b) helpers.PanicErr(err) + payload := string(payloadb) - resp := api.withArg(string(payload)).mustExec(api.methods.CreateBridge) - resource := mustJSON[presenters.BridgeResource](resp) - fmt.Printf("Created bridge: %s %s\n", resource.Name, resource.URL) + fmt.Printf("Creating bridge (%s): %s\n", name, eaURL) + if doesBridgeExist(api, name) { + if force { + fmt.Println("Force flag is set, updating existing bridge") + api.withArgs(name, payload).mustExec(api.methods.UpdateBridge) + fmt.Println("Updated bridge", name) + } else { + fmt.Println("Bridge", name, "already exists, skipping creation") + return + } + } else { + resp := api.withArg(payload).mustExec(api.methods.CreateBridge) + resource := mustJSON[presenters.BridgeResource](resp) + fmt.Printf("Created bridge: %s %s\n", resource.Name, resource.URL) + } } func doesBridgeExist(api *nodeAPI, name string) bool { From 9208daee371a9e98c96ecd14b77739483d3ad07f Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 19 Sep 2024 13:43:14 -0700 Subject: [PATCH 023/117] Add UpdateBridge CLI command --- core/cmd/bridge_commands.go | 23 +++++++++++++++++ core/cmd/bridge_commands_test.go | 42 ++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/core/cmd/bridge_commands.go b/core/cmd/bridge_commands.go index 398d466c43a..cd314b23218 100644 --- a/core/cmd/bridge_commands.go +++ b/core/cmd/bridge_commands.go @@ -128,6 +128,29 @@ func (s *Shell) CreateBridge(c *cli.Context) (err error) { return s.renderAPIResponse(resp, &BridgePresenter{}) } +func (s *Shell) UpdateBridge(c *cli.Context) (err error) { + if !c.Args().Present() { + return s.errorOut(errors.New("must pass the name of the bridge to be updated")) + } + bridgeName := c.Args().First() + buf, err := getBufferFromJSON(c.Args().Get(1)) + if err != nil { + return s.errorOut(err) + } + + resp, err := s.HTTP.Patch(s.ctx(), "/v2/bridge_types/"+bridgeName, buf) + if err != nil { + return s.errorOut(err) + } + defer func() { + if cerr := resp.Body.Close(); cerr != nil { + err = multierr.Append(err, cerr) + } + }() + + return s.renderAPIResponse(resp, &BridgePresenter{}) +} + // RemoveBridge removes a specific Bridge by name. func (s *Shell) RemoveBridge(c *cli.Context) (err error) { if !c.Args().Present() { diff --git a/core/cmd/bridge_commands_test.go b/core/cmd/bridge_commands_test.go index f05aac52cd9..04352b0d5d1 100644 --- a/core/cmd/bridge_commands_test.go +++ b/core/cmd/bridge_commands_test.go @@ -3,6 +3,7 @@ package cmd_test import ( "bytes" "flag" + "fmt" "testing" "time" @@ -191,3 +192,44 @@ func TestShell_RemoveBridge(t *testing.T) { assert.Equal(t, bt.URL.String(), p.URL) assert.Equal(t, bt.Confirmations, p.Confirmations) } +func TestShell_UpdateBridge(t *testing.T) { + t.Parallel() + + app := startNewApplicationV2(t, nil) + client, _ := app.NewShellAndRenderer() + name := testutils.RandomizeName("updatebridge") + + bt := &bridges.BridgeType{ + Name: bridges.MustParseBridgeName(name), + URL: cltest.WebURL(t, "https://testing.com/bridges"), + Confirmations: 0, + } + require.NoError(t, app.BridgeORM().CreateBridgeType(testutils.Context(t), bt)) + tests := []struct { + name string + args []string + errored bool + }{ + {"NoArgs", []string{}, true}, + {"OnlyName", []string{name}, true}, + {"ValidUpdate", []string{name, fmt.Sprintf(`{ "name": "%s", "url": "http://localhost:3000/updated" }`, name)}, false}, + {"InvalidJSON", []string{name, `{ "url": "http://localhost:3000/updated"`}, true}, + } + + for _, tt := range tests { + test := tt + t.Run(test.name, func(t *testing.T) { + set := flag.NewFlagSet("bridge", 0) + flagSetApplyFromAction(client.UpdateBridge, set, "") + + require.NoError(t, set.Parse(test.args)) + + c := cli.NewContext(nil, set, nil) + if test.errored { + assert.Error(t, client.UpdateBridge(c)) + } else { + assert.Nil(t, client.UpdateBridge(c)) + } + }) + } +} From 8db8f4696e88c914432deb81ab0b07e91c7bd36e Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 19 Sep 2024 21:44:13 -0700 Subject: [PATCH 024/117] Cleanup comments --- .../keystone/src/03_deploy_streams_trigger_cmd.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 1e3c251a928..ea5909b32fa 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -40,8 +40,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" - // "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/fee_manager" - // "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/reward_manager" verifierContract "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier_proxy" @@ -217,14 +215,6 @@ func deployMercuryV03Contracts(env helpers.Environment) (linkToken *link_token_i tx, err = verifierProxy.InitializeVerifier(env.Owner, verifierAddress) confirmTx(tx, err) - // rewardManagerAddr, _, rewardManager, err := reward_manager.DeployRewardManager(env.Owner, env.Ec, linkTokenAddress) - // PanicErr(err) - // feeManagerAddr, _, _, err := fee_manager.DeployFeeManager(env.Owner, env.Ec, linkTokenAddress, nativeTokenAddress, verifierProxyAddr, rewardManagerAddr) - // PanicErr(err) - // _, err = verifierProxy.SetFeeManager(env.Owner, feeManagerAddr) - // PanicErr(err) - // _, err = rewardManager.SetFeeManager(env.Owner, feeManagerAddr) - // PanicErr(err) return } @@ -490,7 +480,6 @@ func generateMercuryOCR2Config(nca []NodeKeys) MercuryOCR2Config { var offChainTransmitters [][32]byte for _, n := range nca { - fmt.Println("CSAPublicKey", n.CSAPublicKey) offChainTransmitters = append(offChainTransmitters, strToBytes32(n.CSAPublicKey)) } From 0540f1bd6a54d3fc7859db7c3fb053c9aecc30dd Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 19 Sep 2024 22:21:26 -0700 Subject: [PATCH 025/117] Fix typo --- core/scripts/keystone/src/01_deploy_contracts_cmd.go | 2 +- .../keystone/src/06_provision_capabilities_registry.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/scripts/keystone/src/01_deploy_contracts_cmd.go b/core/scripts/keystone/src/01_deploy_contracts_cmd.go index 33e627c9e8c..a9ab9ade33c 100644 --- a/core/scripts/keystone/src/01_deploy_contracts_cmd.go +++ b/core/scripts/keystone/src/01_deploy_contracts_cmd.go @@ -20,7 +20,7 @@ import ( type deployedContracts struct { OCRContract common.Address `json:"ocrContract"` ForwarderContract common.Address `json:"forwarderContract"` - CapabilityRegsitry common.Address `json:"capabilityRegistry"` + CapabilityRegistry common.Address `json:"capabilityRegistry"` // The block number of the transaction that set the config on the OCR3 contract. We use this to replay blocks from this point on // when we load the OCR3 job specs on the nodes. SetConfigTxBlock uint64 `json:"setConfigTxBlock"` diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go index eef45e1f4fe..9bc91be92f5 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -102,18 +102,18 @@ func getOrDeployCapabilitiesRegistry(ctx context.Context, artefactsDir string, e panic(err) } - if contracts.CapabilityRegsitry.String() == "0x" { + if contracts.CapabilityRegistry.String() == (common.Address{}).String() { _, tx, capabilitiesRegistry, innerErr := kcr.DeployCapabilitiesRegistry(env.Owner, env.Ec) if innerErr != nil { panic(innerErr) } helpers.ConfirmContractDeployed(ctx, env.Ec, tx, env.ChainID) - contracts.CapabilityRegsitry = capabilitiesRegistry.Address() + contracts.CapabilityRegistry = capabilitiesRegistry.Address() WriteDeployedContracts(contracts, artefactsDir) return capabilitiesRegistry } else { - capabilitiesRegistry, innerErr := kcr.NewCapabilitiesRegistry(contracts.CapabilityRegsitry, env.Ec) + capabilitiesRegistry, innerErr := kcr.NewCapabilitiesRegistry(contracts.CapabilityRegistry, env.Ec) if innerErr != nil { panic(innerErr) } From 21a10de88e8ca1e60c4e3ddc4b7b785175c4021d Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 19 Sep 2024 22:23:28 -0700 Subject: [PATCH 026/117] Add revert detection and revert reason extraction --- .../keystone/src/88_capabilities_registry.go | 55 ++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/core/scripts/keystone/src/88_capabilities_registry.go b/core/scripts/keystone/src/88_capabilities_registry.go index 17b0513ac03..2c0b82d7593 100644 --- a/core/scripts/keystone/src/88_capabilities_registry.go +++ b/core/scripts/keystone/src/88_capabilities_registry.go @@ -31,8 +31,59 @@ type CapabilityRegistryProvisioner struct { env helpers.Environment } -func NewCapabilityRegistryProvisioner(reg *kcr.CapabilitiesRegistry) *CapabilityRegistryProvisioner { - return &CapabilityRegistryProvisioner{reg: reg} + +func extractRevertReason(errData string, a abi.ABI) (string, string, error) { + data, err := hex.DecodeString(errData[2:]) + if err != nil { + return "", "", err + } + + for errName, abiError := range a.Errors { + if bytes.Equal(data[:4], abiError.ID.Bytes()[:4]) { + // Found a matching error + v, err := abiError.Unpack(data) + if err != nil { + return "", "", err + } + b, err := json.Marshal(v) + if err != nil { + return "", "", err + } + return errName, string(b), nil + } + } + return "", "", fmt.Errorf("revert Reason could not be found for given abistring") +} + +func (c *CapabilityRegistryProvisioner) testCallContract(method string, args ...interface{}) { + abi := evmtypes.MustGetABI(kcr.CapabilitiesRegistryABI) + data, err := abi.Pack(method, args...) + helpers.PanicErr(err) + cAddress := c.reg.Address() + gasPrice, err := c.env.Ec.SuggestGasPrice(context.Background()) + helpers.PanicErr(err) + + msg := ethereum.CallMsg{ + From: c.env.Owner.From, + To: &cAddress, + Data: data, + Gas: 10_000_000, + GasPrice: gasPrice, + } + _, err = c.env.Ec.CallContract(context.Background(), msg, nil) + if err != nil { + if err.Error() == "execution reverted" { + rpcError, ierr := evmclient.ExtractRPCError(err) + helpers.PanicErr(ierr) + reason, abiErr, ierr := extractRevertReason(rpcError.Data.(string), abi) + helpers.PanicErr(ierr) + + e := fmt.Errorf("failed to call %s: reason: %s reasonargs: %s", method, reason, abiErr) + helpers.PanicErr(e) + } + helpers.PanicErr(err) + } + } // AddCapabilities takes a capability set and provisions it in the registry. From 2dbd69cb065c17ef1d8264827b293638070dc1d1 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 19 Sep 2024 22:24:25 -0700 Subject: [PATCH 027/117] Add missing env field to CR struct --- .../keystone/src/06_provision_capabilities_registry.go | 7 +++++-- core/scripts/keystone/src/88_capabilities_registry.go | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go index 9bc91be92f5..73748f6dfa0 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -6,6 +6,8 @@ import ( "fmt" "os" + "github.com/ethereum/go-ethereum/common" + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" ) @@ -67,7 +69,7 @@ func (c *provisionCR) Run(args []string) { *chainID, *nodeList, ) - crProvisioner := NewCapabilityRegistryProvisioner(reg) + crProvisioner := NewCapabilityRegistryProvisioner(reg, env) // We're using the default capability set for now capSet := NewCapabilitySet() crProvisioner.AddCapabilities(ctx, capSet) @@ -99,7 +101,8 @@ func loadDON(publicKeys string, chainID int64, nodeList string) []peer { func getOrDeployCapabilitiesRegistry(ctx context.Context, artefactsDir string, env helpers.Environment) *kcr.CapabilitiesRegistry { contracts, err := LoadDeployedContracts(artefactsDir) if err != nil { - panic(err) + fmt.Println("Could not load deployed contracts, deploying new ones") + // panic(err) } if contracts.CapabilityRegistry.String() == (common.Address{}).String() { diff --git a/core/scripts/keystone/src/88_capabilities_registry.go b/core/scripts/keystone/src/88_capabilities_registry.go index 2c0b82d7593..a12eed67af8 100644 --- a/core/scripts/keystone/src/88_capabilities_registry.go +++ b/core/scripts/keystone/src/88_capabilities_registry.go @@ -31,6 +31,9 @@ type CapabilityRegistryProvisioner struct { env helpers.Environment } +func NewCapabilityRegistryProvisioner(reg *kcr.CapabilitiesRegistry, env helpers.Environment) *CapabilityRegistryProvisioner { + return &CapabilityRegistryProvisioner{reg: reg, env: env} +} func extractRevertReason(errData string, a abi.ABI) (string, string, error) { data, err := hex.DecodeString(errData[2:]) From 780f9864cfa18bb7a8727e4616cc3c5970725aad Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 19 Sep 2024 22:24:52 -0700 Subject: [PATCH 028/117] Fix CR deployment bugs --- .../keystone/src/88_capabilities_registry.go | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/core/scripts/keystone/src/88_capabilities_registry.go b/core/scripts/keystone/src/88_capabilities_registry.go index a12eed67af8..f4abfd4027a 100644 --- a/core/scripts/keystone/src/88_capabilities_registry.go +++ b/core/scripts/keystone/src/88_capabilities_registry.go @@ -91,11 +91,10 @@ func (c *CapabilityRegistryProvisioner) testCallContract(method string, args ... // AddCapabilities takes a capability set and provisions it in the registry. func (c *CapabilityRegistryProvisioner) AddCapabilities(ctx context.Context, capSet CapabilitySet) { - tx, err := c.reg.AddCapabilities(c.env.Owner, capSet.Capabilities()) - if err != nil { - log.Printf("failed to call AddCapabilities: %s", err) - } + c.testCallContract("addCapabilities", capSet.Capabilities()) + tx, err := c.reg.AddCapabilities(c.env.Owner, capSet.Capabilities()) + helpers.PanicErr(err) helpers.ConfirmTXMined(ctx, c.env.Ec, tx, c.env.ChainID) } @@ -109,8 +108,9 @@ func (c *CapabilityRegistryProvisioner) AddCapabilities(ctx context.Context, cap // The node operator is then added to the registry, and the registry will issue an ID for the node operator. // The ID is then used when adding nodes to the registry such that the registry knows which nodes belong to which // node operator. -func (c *CapabilityRegistryProvisioner) AddNodeOperator(ctx context.Context, nop NodeOperator) { +func (c *CapabilityRegistryProvisioner) AddNodeOperator(ctx context.Context, nop *NodeOperator) { nop.BindToRegistry(c.reg) + tx, err := c.reg.AddNodeOperators(c.env.Owner, []kcr.CapabilitiesRegistryNodeOperator{ { Admin: nop.Admin, @@ -134,11 +134,11 @@ func (c *CapabilityRegistryProvisioner) AddNodeOperator(ctx context.Context, nop // node operators to the same capability set. This is not yet implemented here. // // Note that the registry must already have the capability set added via `AddCapabilities`, you cannot -// add capabilites that the registry is not yet aware of. +// add capabilities that the registry is not yet aware of. // // Note that in terms of the provisioning process, this is not the last step. A capability is only active once // there is a DON servicing yet. This is done via `AddDON`. -func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop NodeOperator, capSet CapabilitySet) { +func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop *NodeOperator, capSet CapabilitySet) { params := []kcr.CapabilitiesRegistryNodeParams{} for _, peer := range nop.DON { node, innerErr := peerToNode(nop.id, peer) @@ -148,12 +148,14 @@ func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop NodeOp // Technically we could be more flexible here, // where we can have different capset assignment for each node - node.HashedCapabilityIds = capSet.CapabilityIDs() + node.HashedCapabilityIds = capSet.CapabilityIDs(c.reg) params = append(params, node) } + c.testCallContract("addNodes", params) tx, err := c.reg.AddNodes(c.env.Owner, params) + if err != nil { log.Printf("failed to AddNodes: %s", err) } @@ -181,13 +183,15 @@ func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop NodeOp // If you want to add a DON that services both capabilities and workflows, you should set both `acceptsWorkflows` and `isPublic` to true. // // Another important distinction is that DON can comprise of nodes from different node operators, but for now, we're keeping it simple and restricting it to a single node operator. We also hard code F to 1. -func (c *CapabilityRegistryProvisioner) AddDON(ctx context.Context, nop NodeOperator, capSet CapabilitySet, isPublic bool, acceptsWorkflows bool) { +func (c *CapabilityRegistryProvisioner) AddDON(ctx context.Context, nop *NodeOperator, capSet CapabilitySet, isPublic bool, acceptsWorkflows bool) { configs := capSet.Configs(c.reg) // Note: Technically we could be more flexible here, // where we can have multiple DONs with different capability configurations - // and have a non-hardcoded number for F - tx, err := c.reg.AddDON(c.env.Owner, nop.MustGetPeerIDs(), configs, isPublic, acceptsWorkflows, 1) + // and have a non-hardcoded number for F + var f uint8 = 1 + c.testCallContract("addDON", nop.MustGetPeerIDs(), configs, isPublic, acceptsWorkflows, f) + tx, err := c.reg.AddDON(c.env.Owner, nop.MustGetPeerIDs(), configs, isPublic, acceptsWorkflows, f) if err != nil { log.Printf("failed to AddDON: %s", err) } @@ -250,6 +254,7 @@ func (b *baseCapability) Capability() kcr.CapabilitiesRegistryCapability { type ConsensusCapability struct { baseCapability } + var _ CapabillityProvisioner = &ConsensusCapability{} func (c *ConsensusCapability) Config() kcr.CapabilitiesRegistryCapabilityConfiguration { @@ -262,7 +267,7 @@ func (c *ConsensusCapability) Config() kcr.CapabilitiesRegistryCapabilityConfigu return c.config(config) } -// NewOCR3V1ConsensusCapability returns a new ConsensusCapability for OCR3 +// NewOCR3V1ConsensusCapability returns a new ConsensusCapability for OCR3 func NewOCR3V1ConsensusCapability() *ConsensusCapability { return &ConsensusCapability{ baseCapability{ @@ -278,6 +283,7 @@ func NewOCR3V1ConsensusCapability() *ConsensusCapability { type TargetCapability struct { baseCapability } + var _ CapabillityProvisioner = &TargetCapability{} func (t *TargetCapability) Config() kcr.CapabilitiesRegistryCapabilityConfiguration { @@ -381,9 +387,10 @@ func (c *CapabilitySet) Capabilities() []kcr.CapabilitiesRegistryCapability { return definitions } -func (c *CapabilitySet) CapabilityIDs() [][32]byte { +func (c *CapabilitySet) CapabilityIDs(reg *kcr.CapabilitiesRegistry) [][32]byte { var ids [][32]byte for _, cap := range *c { + cap.BindToRegistry(reg) ids = append(ids, cap.GetHashedCID()) } @@ -421,8 +428,8 @@ type NodeOperator struct { id uint32 } -func NewNodeOperator(admin gethCommon.Address, name string, don []peer) NodeOperator { - return NodeOperator{ +func NewNodeOperator(admin gethCommon.Address, name string, don []peer) *NodeOperator { + return &NodeOperator{ Admin: admin, Name: name, DON: don, From 1d274cc24ec943b93b7caf79e39d060f0ba379e7 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:16:00 -0700 Subject: [PATCH 029/117] Fix trigger capability typo --- core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go | 4 ++-- .../__snapshots__/03_deploy_streams_trigger_cmd_test.snap | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index ea5909b32fa..baeaf6cc149 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -296,7 +296,7 @@ contractConfigTrackerPollInterval = "1s" [relayConfig] chainID = %d -enableTriggerCapabillity = true +enableTriggerCapability = true `, name, verifierAddress, feedID, chainID) return @@ -352,7 +352,7 @@ nativeFeedID = "0x%[9]x" serverURL = "wss://unknown" [relayConfig] -enableTriggerCapabillity = true +enableTriggerCapability = true chainID = "%[10]d" `, feedName, diff --git a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap index bc6caa0d69d..f0c4d407365 100755 --- a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap @@ -34,7 +34,7 @@ nativeFeedID = "0x03000000000000000000000000000000000000000000000000000000000000 serverURL = "wss://unknown" [relayConfig] -enableTriggerCapabillity = true +enableTriggerCapability = true chainID = "123456" --- @@ -51,7 +51,7 @@ contractConfigTrackerPollInterval = "1s" [relayConfig] chainID = 123456 -enableTriggerCapabillity = true +enableTriggerCapability = true --- @@ -91,7 +91,7 @@ nativeFeedID = "0x03000000000000000000000000000000000000000000000000000000000000 serverURL = "wss://unknown" [relayConfig] -enableTriggerCapabillity = true +enableTriggerCapability = true chainID = "123456" --- From 5410d20efcbe64e1462574eb8de3c81ede4d6a42 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:17:37 -0700 Subject: [PATCH 030/117] Add external registry and capability p2p config gen --- .../src/03_gen_crib_cluster_overrides_cmd.go | 12 +++- .../03_gen_crib_cluster_overrides_cmd_test.go | 3 +- .../keystone/templates/crib-overrides.yaml | 59 +++++++++++++++++++ 3 files changed, 70 insertions(+), 4 deletions(-) diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go index b731d66cb93..149e7fafe71 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go @@ -2,6 +2,7 @@ package src import ( "flag" + "fmt" "os" "path/filepath" "strings" @@ -47,16 +48,17 @@ func (g *generateCribClusterOverrides) Run(args []string) { deployedContracts, err := LoadDeployedContracts(*artefactsDir) helpers.PanicErr(err) - lines := generateCribConfig(*nodeList, *publicKeys, chainID, templatesDir, deployedContracts.ForwarderContract.Hex()) + lines := generateCribConfig(*nodeList, *publicKeys, chainID, templatesDir, deployedContracts.ForwarderContract.Hex(), deployedContracts.CapabilityRegistry.Hex()) cribOverridesStr := strings.Join(lines, "\n") err = os.WriteFile(filepath.Join(*outputPath, "crib-cluster-overrides.yaml"), []byte(cribOverridesStr), 0600) helpers.PanicErr(err) } -func generateCribConfig(nodeList string, pubKeysPath string, chainID *int64, templatesDir string, forwarderAddress string) []string { +func generateCribConfig(nodeList string, pubKeysPath string, chainID *int64, templatesDir string, forwarderAddress string, externalRegistryAddress string) []string { nca := downloadNodePubKeys(nodeList, *chainID, pubKeysPath) nodeAddresses := []string{} + capabilitiesBootstrapper := fmt.Sprintf("%s@%s:%s", nca[0].P2PPeerID, "app-node1", "6691") for _, node := range nca[1:] { nodeAddresses = append(nodeAddresses, node.EthAddress) @@ -64,7 +66,7 @@ func generateCribConfig(nodeList string, pubKeysPath string, chainID *int64, tem lines, err := readLines(filepath.Join(templatesDir, cribOverrideTemplate)) helpers.PanicErr(err) - lines = replaceCribPlaceholders(lines, forwarderAddress, nodeAddresses) + lines = replaceCribPlaceholders(lines, forwarderAddress, nodeAddresses, externalRegistryAddress, capabilitiesBootstrapper) return lines } @@ -72,6 +74,8 @@ func replaceCribPlaceholders( lines []string, forwarderAddress string, nodeFromAddresses []string, + externalRegistryAddress string, + capabilitiesBootstrapper string, ) (output []string) { for _, l := range lines { l = strings.Replace(l, "{{ forwarder_address }}", forwarderAddress, 1) @@ -79,6 +83,8 @@ func replaceCribPlaceholders( l = strings.Replace(l, "{{ node_3_address }}", nodeFromAddresses[1], 1) l = strings.Replace(l, "{{ node_4_address }}", nodeFromAddresses[2], 1) l = strings.Replace(l, "{{ node_5_address }}", nodeFromAddresses[3], 1) + l = strings.Replace(l, "{{ external_registry_address }}", externalRegistryAddress, 1) + l = strings.Replace(l, "{{ capabilities_bootstrapper }}", capabilitiesBootstrapper, 1) output = append(output, l) } diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go index ae420282615..5ab1ee4975d 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go @@ -11,9 +11,10 @@ func TestGenerateCribConfig(t *testing.T) { chainID := int64(1337) templatesDir := "../templates" forwarderAddress := "0x1234567890abcdef" + externalRegistryAddress := "0xabcdef1234567890" publicKeysPath := "./testdata/PublicKeys.json" - lines := generateCribConfig(defaultNodeList, publicKeysPath, &chainID, templatesDir, forwarderAddress) + lines := generateCribConfig(defaultNodeList, publicKeysPath, &chainID, templatesDir, forwarderAddress, externalRegistryAddress) snaps.MatchSnapshot(t, strings.Join(lines, "\n")) } diff --git a/core/scripts/keystone/templates/crib-overrides.yaml b/core/scripts/keystone/templates/crib-overrides.yaml index 758433bbc91..34355edd3c6 100644 --- a/core/scripts/keystone/templates/crib-overrides.yaml +++ b/core/scripts/keystone/templates/crib-overrides.yaml @@ -7,6 +7,17 @@ helm: overridesToml: |- [[EVM]] ChainID = '1337' + + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '{{ external_registry_address }}' + NetworkID = 'evm' + ChainID = '1337' node2: image: ${runtime.images.app} overridesToml: |- @@ -15,6 +26,18 @@ helm: [EVM.Workflow] FromAddress = '{{ node_2_address }}' ForwarderAddress = '{{ forwarder_address }}' + + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['{{ capabilities_bootstrapper }}'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '{{ external_registry_address }}' + NetworkID = 'evm' + ChainID = '1337' node3: image: ${runtime.images.app} overridesToml: |- @@ -23,6 +46,18 @@ helm: [EVM.Workflow] FromAddress = '{{ node_3_address }}' ForwarderAddress = '{{ forwarder_address }}' + + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['{{ capabilities_bootstrapper }}'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '{{ external_registry_address }}' + NetworkID = 'evm' + ChainID = '1337' node4: image: ${runtime.images.app} overridesToml: |- @@ -31,6 +66,18 @@ helm: [EVM.Workflow] FromAddress = '{{ node_4_address }}' ForwarderAddress = '{{ forwarder_address }}' + + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['{{ capabilities_bootstrapper }}'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '{{ external_registry_address }}' + NetworkID = 'evm' + ChainID = '1337' node5: image: ${runtime.images.app} overridesToml: |- @@ -39,3 +86,15 @@ helm: [EVM.Workflow] FromAddress = '{{ node_5_address }}' ForwarderAddress = '{{ forwarder_address }}' + + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['{{ capabilities_bootstrapper }}'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '{{ external_registry_address }}' + NetworkID = 'evm' + ChainID = '1337' From b0b182b22b3e9688b34d8393aefecc5aa85bb327 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:18:07 -0700 Subject: [PATCH 031/117] Add redial support for logging in --- core/scripts/keystone/src/99_app.go | 36 +++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/core/scripts/keystone/src/99_app.go b/core/scripts/keystone/src/99_app.go index afdbbdb97d5..93b519603f7 100644 --- a/core/scripts/keystone/src/99_app.go +++ b/core/scripts/keystone/src/99_app.go @@ -6,18 +6,30 @@ import ( "errors" "flag" "fmt" - "github.com/urfave/cli" "io" "reflect" "runtime" "strings" + "time" - "github.com/smartcontractkit/chainlink/v2/core/cmd" + "github.com/jpillora/backoff" + "github.com/urfave/cli" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + "github.com/smartcontractkit/chainlink/v2/core/cmd" clcmd "github.com/smartcontractkit/chainlink/v2/core/cmd" ) +// NewRedialBackoff is a standard backoff to use for redialling or reconnecting to +// unreachable network endpoints +func NewRedialBackoff() backoff.Backoff { + return backoff.Backoff{ + Min: 1 * time.Second, + Max: 15 * time.Second, + Jitter: true, + } +} + func newApp(n *node, writer io.Writer) (*clcmd.Shell, *cli.App) { client := &clcmd.Shell{ Renderer: clcmd.RendererJSON{Writer: writer}, @@ -62,8 +74,24 @@ func newNodeAPI(n *node) *nodeAPI { loginFs := flag.NewFlagSet("test", flag.ContinueOnError) loginFs.Bool("bypass-version-check", true, "") loginCtx := cli.NewContext(app, loginFs, nil) - err := methods.RemoteLogin(loginCtx) - helpers.PanicErr(err) + + redial := NewRedialBackoff() + + for { + err := methods.RemoteLogin(loginCtx) + if err == nil { + break + } + + fmt.Println("Error logging in:", err) + if strings.Contains(err.Error(), "invalid character '<' looking for beginning of value") { + fmt.Println("Likely a transient network error, retrying...") + } else { + helpers.PanicErr(err) + } + + time.Sleep(redial.Duration()) + } output.Reset() return api From 9972924400a0be488a88378d0d5ead9ad5e04739 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:18:40 -0700 Subject: [PATCH 032/117] Fix capability registration --- .../keystone/src/88_capabilities_registry.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/scripts/keystone/src/88_capabilities_registry.go b/core/scripts/keystone/src/88_capabilities_registry.go index f4abfd4027a..87ee02bf662 100644 --- a/core/scripts/keystone/src/88_capabilities_registry.go +++ b/core/scripts/keystone/src/88_capabilities_registry.go @@ -205,10 +205,10 @@ func (c *CapabilityRegistryProvisioner) AddDON(ctx context.Context, nop *NodeOpe * */ const ( // Taken from https://github.com/smartcontractkit/chainlink/blob/29117850e9be1be1993dbf8f21cf13cbb6af9d24/core/capabilities/integration_tests/keystone_contracts_setup.go#L43 - CapabilityTypeTrigger = 0 - CapabilityTypeAction = 1 - CapabilityTypeConsensus = 2 - CapabilityTypeTarget = 3 + CapabilityTypeTrigger = uint8(0) + CapabilityTypeAction = uint8(1) + CapabilityTypeConsensus = uint8(2) + CapabilityTypeTarget = uint8(3) ) type CapabillityProvisioner interface { @@ -301,11 +301,11 @@ func (t *TargetCapability) Config() kcr.CapabilitiesRegistryCapabilityConfigurat return t.config(config) } -func NewEthereumSepoliaWriteTargetV1Capability() *TargetCapability { +func NewEthereumGethTestnetV1WriteCapability() *TargetCapability { return &TargetCapability{ baseCapability{ capability: kcr.CapabilitiesRegistryCapability{ - LabelledName: "write_ethereum-testnet_sepolia", + LabelledName: "write_geth-testnet", Version: "1.0.0", CapabilityType: CapabilityTypeTarget, }, @@ -367,10 +367,10 @@ type CapabilitySet []CapabillityProvisioner func NewCapabilitySet(capabilities ...CapabillityProvisioner) CapabilitySet { if len(capabilities) == 0 { - log.Println("No capabilities provided, using default capabillity set") + log.Println("No capabilities provided, using default capability set") return []CapabillityProvisioner{ NewStreamsTriggerV1Capability(), - NewEthereumSepoliaWriteTargetV1Capability(), + NewEthereumGethTestnetV1WriteCapability(), NewOCR3V1ConsensusCapability(), } } From 7dfa9d6c79adcec28ce129a30c555dbbf0b4ab51 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:52:12 -0700 Subject: [PATCH 033/117] HACK: Add keystone workflow deployment to streams trigger cmd --- .../src/03_deploy_streams_trigger_cmd.go | 303 +++++++++++++----- .../src/03_deploy_streams_trigger_cmd_test.go | 62 ++-- .../03_deploy_streams_trigger_cmd_test.snap | 56 +++- 3 files changed, 314 insertions(+), 107 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index baeaf6cc149..26bd5bd6fcf 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -10,11 +10,13 @@ package src // See integration workflow here: https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/capabilities/integration_tests/workflow.go#L15 // ^ setup.go provides good insight too import ( + "bytes" "context" "encoding/binary" "encoding/json" "flag" "fmt" + "html/template" "math" "math/big" "os" @@ -165,7 +167,7 @@ func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFile fmt.Printf("BridgeURL: %s\n", feed.bridgeUrl) fmt.Printf("Setting verifier config\n") - verifier.SetConfig( + tx, err := verifier.SetConfig( env.Owner, feed.id, ocrConfig.Signers, @@ -176,10 +178,36 @@ func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFile ocrConfig.OffchainConfig, nil, ) + helpers.ConfirmTXMined(context.Background(), env.Ec, tx, env.ChainID) + PanicErr(err) fmt.Printf("Deploying OCR2 job specs for feed %s\n", feed.name) deployOCR2JobSpecsForFeed(nca, nodes, verifier, feed, chainId, force) } + + fmt.Println("Finished deploying streams trigger") + + fmt.Println("Deploying Keystone workflow job") + + feedIds := []string{} + for _, feed := range feeds { + feedIds = append(feedIds, fmt.Sprintf("0x%x", feed.id)) + } + writeTarget := NewEthereumGethTestnetV1WriteCapability().baseCapability.capability + writeTargetID := fmt.Sprintf("%s@%s", writeTarget.LabelledName, writeTarget.Version) + workflowConfig := WorkflowJobSpecConfig{ + JobSpecName: "keystone_workflow", + WorkflowOwnerAddress: "0x1234567890abcdef1234567890abcdef12345678", + FeedIDs: feedIds, + TargetID: writeTargetID, + TargetAddress: "0x1234567890abcdef1234567890abcdef12345678", + } + jobSpecStr := createKeystoneWorkflowJob(workflowConfig) + for _, n := range nodes { + api := newNodeAPI(n) + + upsertJob(api, workflowConfig.JobSpecName, jobSpecStr, force) + } } func deployMercuryV03Contracts(env helpers.Environment) (linkToken *link_token_interface.LinkToken, nativeToken *link_token_interface.LinkToken, verifierProxy *verifier_proxy.VerifierProxy, verifier *verifierContract.Verifier) { @@ -228,111 +256,167 @@ func deployOCR2JobSpecsForFeed(nca []NodeKeys, nodes []*node, verifier *verifier jobSpecStr := "" createBridgeIfDoesNotExist(api, feed.bridgeName, feed.bridgeUrl, force) + if i == 0 { - jobSpecName, jobSpecStr = createMercuryV3BootstrapJob( - verifier.Address(), - feed.name, - feed.id, - chainId, - ) + // Prepare data for Bootstrap Job + bootstrapData := MercuryV3BootstrapJobSpecData{ + FeedName: feed.name, + VerifierAddress: verifier.Address().Hex(), + FeedID: fmt.Sprintf("%x", feed.id), + ChainID: chainId, + } + + // Create Bootstrap Job + jobSpecName, jobSpecStr = createMercuryV3BootstrapJob(bootstrapData) } else { - jobSpecName, jobSpecStr = createMercuryV3Job( - n.OCR2BundleID, - fmt.Sprintf("%s@%s:%s", nca[0].P2PPeerID, "app-node1", "6690"), - verifier.Address(), - feed.bridgeName, - n.CSAPublicKey, - fmt.Sprintf("feed-%s", feed.name), - feed.id, - feeds[1].id, - feeds[2].id, - chainId, - ) + // Prepare data for Mercury V3 Job + mercuryData := MercuryV3JobSpecData{ + FeedName: fmt.Sprintf("feed-%s", feed.name), + BootstrapHost: fmt.Sprintf("%s@%s:%s", nca[0].P2PPeerID, "app-node1", "6690"), + VerifierAddress: verifier.Address().Hex(), + Bridge: feed.bridgeName, + NodeCSAKey: n.CSAPublicKey, + FeedID: fmt.Sprintf("%x", feed.id), + LinkFeedID: fmt.Sprintf("%x", feeds[1].id), + NativeFeedID: fmt.Sprintf("%x", feeds[2].id), + OCRKeyBundleID: n.OCR2BundleID, + ChainID: chainId, + } + + // Create Mercury V3 Job + jobSpecName, jobSpecStr = createMercuryV3Job(mercuryData) } + upsertJob(api, jobSpecName, jobSpecStr, force) + } +} + +func upsertJob(api *nodeAPI, jobSpecName string, jobSpecStr string, upsert bool) { jobsResp := api.mustExec(api.methods.ListJobs) jobs := mustJSON[[]JobSpec](jobsResp) - shouldSkip := false for _, job := range *jobs { if job.Name == jobSpecName { - if force { + if !upsert { + fmt.Printf("Job already exists: %s, skipping..\n", jobSpecName) + return + } + fmt.Printf("Job already exists: %s, replacing..\n", jobSpecName) api.withArg(job.Id).mustExec(api.methods.DeleteJob) fmt.Printf("Deleted job: %s\n", jobSpecName) - } else { - fmt.Printf("Job already exists: %s, skipping..\n", jobSpecName) - shouldSkip = true - } + break } } - if shouldSkip { - continue - } fmt.Printf("Deploying jobspec: %s\n... \n", jobSpecStr) _, err := api.withArg(jobSpecStr).exec(api.methods.CreateJob) if err != nil { panic(fmt.Sprintf("Failed to deploy job spec: %s Error: %s", jobSpecStr, err)) } } + +type WorkflowJobSpecConfig struct { + JobSpecName string + WorkflowOwnerAddress string + FeedIDs []string + TargetID string + TargetAddress string +} + +func createKeystoneWorkflowJob(workflowConfig WorkflowJobSpecConfig) string { + const keystoneWorkflowTemplate = ` +type = "workflow" +schemaVersion = 1 +name = "{{ .JobSpecName }}" +workflow = """ +name: "ccip_kiab" +owner: '{{ .WorkflowOwnerAddress }}' +triggers: + - id: streams-trigger@1.0.0 + config: + maxFrequencyMs: 10000 + feedIds: +{{- range .FeedIDs }} + - '{{ . }}' +{{- end }} + +consensus: + - id: offchain_reporting@1.0.0 + ref: ccip_feeds + inputs: + observations: + - $(trigger.outputs) + config: + report_id: '0001' + aggregation_method: data_feeds + aggregation_config: +{{- range .FeedIDs }} + '{{ . }}': + deviation: '0.05' + heartbeat: 1800 +{{- end }} + encoder: EVM + encoder_config: + abi: (bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports + +targets: + - id: {{ .TargetID }} + inputs: + signed_report: $(ccip_feeds.outputs) + config: + address: '{{ .TargetAddress }}' + deltaStage: 5s + schedule: oneAtATime + +""" +workflowOwner = "{{ .WorkflowOwnerAddress }}" +` + + tmpl, err := template.New("workflow").Parse(keystoneWorkflowTemplate) + + if err != nil { + panic(err) + } + var renderedTemplate bytes.Buffer + err = tmpl.Execute(&renderedTemplate, workflowConfig) + if err != nil { + panic(err) + } + + return renderedTemplate.String() } -func createMercuryV3BootstrapJob( - verifierAddress common.Address, - feedName string, - feedID [32]byte, - chainID int64, -) (name string, jobSpecStr string) { - name = fmt.Sprintf("boot-%s", feedName) - fmt.Printf("Creating bootstrap job (%s):\nverifier address: %s\nfeed name: %s\nfeed ID: %x\nchain ID: %d\n", name, verifierAddress, feedName, feedID, chainID) - jobSpecStr = fmt.Sprintf(` +// Template definitions +const bootstrapJobTemplate = ` type = "bootstrap" relay = "evm" schemaVersion = 1 -name = "%s" -contractID = "%s" -feedID = "0x%x" +name = "{{ .Name }}" +contractID = "{{ .VerifierAddress }}" +feedID = "0x{{ .FeedID }}" contractConfigTrackerPollInterval = "1s" [relayConfig] -chainID = %d +chainID = {{ .ChainID }} enableTriggerCapability = true - `, name, verifierAddress, feedID, chainID) - - return -} +` -func createMercuryV3Job( - ocrKeyBundleID string, - bootstrapHost string, - verifierAddress common.Address, - bridge string, - nodeCSAKey string, - feedName string, - feedID [32]byte, - linkFeedID [32]byte, - nativeFeedID [32]byte, - chainID int64, -) (name string, jobSpecStr string) { - name = fmt.Sprintf("mercury-%s", feedName) - fmt.Printf("Creating ocr2 job(%s):\nOCR key bundle ID: %s\nverifier address: %s\nbridge: %s\nnodeCSAKey: %s\nfeed name: %s\nfeed ID: %x\nlink feed ID: %x\nnative feed ID: %x\nchain ID: %d\n", name, ocrKeyBundleID, verifierAddress, bridge, nodeCSAKey, feedName, feedID, linkFeedID, nativeFeedID, chainID) - - jobSpecStr = fmt.Sprintf(` +const mercuryV3JobTemplate = ` type = "offchainreporting2" schemaVersion = 1 -name = "mercury-%[1]s" -p2pv2Bootstrappers = ["%[2]s"] +name = "{{ .Name }}" +p2pv2Bootstrappers = ["{{ .BootstrapHost }}"] forwardingAllowed = false maxTaskDuration = "1s" -contractID = "%[3]s" -feedID = "0x%[4]x" +contractID = "{{ .VerifierAddress }}" +feedID = "0x{{ .FeedID }}" contractConfigTrackerPollInterval = "1s" -ocrKeyBundleID = "%[5]s" +ocrKeyBundleID = "{{ .OCRKeyBundleID }}" relay = "evm" pluginType = "mercury" -transmitterID = "%[6]s" +transmitterID = "{{ .NodeCSAKey }}" observationSource = """ - price [type=bridge name="%[7]s" timeout="50ms" requestData=""]; + price [type=bridge name="{{ .Bridge }}" timeout="50ms" requestData=""]; benchmark_price [type=jsonparse path="result,mid" index=0]; price -> benchmark_price; @@ -347,26 +431,77 @@ observationSource = """ [pluginConfig] # Dummy pub key serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" -linkFeedID = "0x%[8]x" -nativeFeedID = "0x%[9]x" +linkFeedID = "0x{{ .LinkFeedID }}" +nativeFeedID = "0x{{ .NativeFeedID }}" serverURL = "wss://unknown" [relayConfig] enableTriggerCapability = true -chainID = "%[10]d" - `, - feedName, - bootstrapHost, - verifierAddress, - feedID, - ocrKeyBundleID, - nodeCSAKey, - bridge, - linkFeedID, - nativeFeedID, - chainID, - ) - return +chainID = "{{ .ChainID }}" +` + +// Data structures +type MercuryV3BootstrapJobSpecData struct { + FeedName string + // Automatically generated from FeedName + Name string + VerifierAddress string + FeedID string + ChainID int64 +} + +type MercuryV3JobSpecData struct { + FeedName string + // Automatically generated from FeedName + Name string + BootstrapHost string + VerifierAddress string + Bridge string + NodeCSAKey string + FeedID string + LinkFeedID string + NativeFeedID string + OCRKeyBundleID string + ChainID int64 +} + +// createMercuryV3BootstrapJob creates a bootstrap job specification using the provided data. +func createMercuryV3BootstrapJob(data MercuryV3BootstrapJobSpecData) (name string, jobSpecStr string) { + name = fmt.Sprintf("boot-%s", data.FeedName) + data.Name = name + + fmt.Printf("Creating bootstrap job (%s):\nverifier address: %s\nfeed name: %s\nfeed ID: %s\nchain ID: %d\n", + name, data.VerifierAddress, data.FeedName, data.FeedID, data.ChainID) + + tmpl, err := template.New("bootstrapJob").Parse(bootstrapJobTemplate) + PanicErr(err) + + var buf bytes.Buffer + err = tmpl.Execute(&buf, data) + PanicErr(err) + + jobSpecStr = buf.String() + + return name, jobSpecStr +} + +// createMercuryV3Job creates a Mercury V3 job specification using the provided data. +func createMercuryV3Job(data MercuryV3JobSpecData) (name string, jobSpecStr string) { + name = fmt.Sprintf("mercury-%s", data.FeedName) + data.Name = name + fmt.Printf("Creating ocr2 job(%s):\nOCR key bundle ID: %s\nverifier address: %s\nbridge: %s\nnodeCSAKey: %s\nfeed name: %s\nfeed ID: %s\nlink feed ID: %s\nnative feed ID: %s\nchain ID: %d\n", + data.Name, data.OCRKeyBundleID, data.VerifierAddress, data.Bridge, data.NodeCSAKey, data.FeedName, data.FeedID, data.LinkFeedID, data.NativeFeedID, data.ChainID) + + tmpl, err := template.New("mercuryV3Job").Parse(mercuryV3JobTemplate) + PanicErr(err) + + var buf bytes.Buffer + err = tmpl.Execute(&buf, data) + PanicErr(err) + + jobSpecStr = buf.String() + + return data.Name, jobSpecStr } func createBridgeIfDoesNotExist(api *nodeAPI, name string, eaURL string, force bool) { diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go index 5606789fc50..8f804a3ebf3 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go @@ -1,6 +1,7 @@ package src import ( + "fmt" "net/url" "testing" @@ -9,45 +10,62 @@ import ( var ( chainID = int64(123456) - feedID = [32]byte{0: 1} + feedID = fmt.Sprintf("%x", [32]byte{0: 1}) feedName = "BTC/USD" - verifierAddress = [20]byte{0: 7} + verifierAddress = fmt.Sprintf("0x%x", [20]byte{0: 7}) ) func TestCreateMercuryV3Job(t *testing.T) { ocrKeyBundleID := "ocr_key_bundle_id" nodeCSAKey := "node_csa_key" bridgeName := "bridge_name" - linkFeedID := [32]byte{0: 2} - nativeFeedID := [32]byte{0: 3} + linkFeedID := fmt.Sprintf("%x", [32]byte{0: 2}) + nativeFeedID := fmt.Sprintf("%x", [32]byte{0: 3}) u, err := url.Parse("https://crib-henry-keystone-node1.main.stage.cldev.sh") if err != nil { t.Fatal(err) } - _, output := createMercuryV3Job( - ocrKeyBundleID, - u.Hostname(), - verifierAddress, - bridgeName, - nodeCSAKey, - feedName, - feedID, - linkFeedID, - nativeFeedID, - chainID, - ) + jobConfigData := MercuryV3JobSpecData{ + BootstrapHost: u.Hostname(), + VerifierAddress: verifierAddress, + OCRKeyBundleID: ocrKeyBundleID, + NodeCSAKey: nodeCSAKey, + Bridge: bridgeName, + FeedName: feedName, + FeedID: feedID, + LinkFeedID: linkFeedID, + NativeFeedID: nativeFeedID, + ChainID: chainID, + } + _, output := createMercuryV3Job(jobConfigData) snaps.MatchSnapshot(t, output) } func TestCreateMercuryBootstrapJob(t *testing.T) { - _, output := createMercuryV3BootstrapJob( - verifierAddress, - feedName, - feedID, - chainID, - ) + jobConfigData := MercuryV3BootstrapJobSpecData{ + FeedName: feedName, + FeedID: feedID, + ChainID: chainID, + VerifierAddress: verifierAddress, + } + + _, output := createMercuryV3BootstrapJob(jobConfigData) snaps.MatchSnapshot(t, output) } +func TestCreateKeystoneWorkflowJob(t *testing.T) { + workflowConfig := WorkflowJobSpecConfig{ + JobSpecName: "keystone_workflow", + WorkflowOwnerAddress: "0x1234567890abcdef1234567890abcdef12345678", + FeedIDs: []string{"feed1", "feed2", "feed3"}, + TargetID: "target_id", + TargetAddress: "0xabcdefabcdefabcdefabcdefabcdefabcdef", + } + + output := createKeystoneWorkflowJob(workflowConfig) + + snaps.MatchSnapshot(t, output) +} + diff --git a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap index f0c4d407365..5d4a79c65a2 100755 --- a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap @@ -93,5 +93,59 @@ serverURL = "wss://unknown" [relayConfig] enableTriggerCapability = true chainID = "123456" - + +--- + +[TestCreateKeystoneWorkflowJob - 1] + +type = "workflow" +schemaVersion = 1 +name = "keystone_workflow" +workflow = """ +name: "keystone_ccip_kiab_workflow" +owner: '0x1234567890abcdef1234567890abcdef12345678' +triggers: + - id: streams-trigger@1.0.0 + config: + maxFrequencyMs: 10000 + feedIds: + - 'feed1' + - 'feed2' + - 'feed3' + +consensus: + - id: offchain_reporting@1.0.0 + ref: ccip_feeds + inputs: + observations: + - $(trigger.outputs) + config: + report_id: '0001' + aggregation_method: data_feeds + aggregation_config: + 'feed1': + deviation: '0.05' + heartbeat: 1800 + 'feed2': + deviation: '0.05' + heartbeat: 1800 + 'feed3': + deviation: '0.05' + heartbeat: 1800 + encoder: EVM + encoder_config: + abi: (bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports + +targets: + - id: target_id + inputs: + signed_report: $(ccip_feeds.outputs) + config: + address: '0xabcdefabcdefabcdefabcdefabcdefabcdef' + deltaStage: 5s + schedule: oneAtATime + +""" +workflowOwner = "0x1234567890abcdef1234567890abcdef12345678" + --- From 3295aaadf92ec7117a2fa6169b15f4238ae9a754 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:52:20 -0700 Subject: [PATCH 034/117] Typo --- core/scripts/keystone/src/88_capabilities_registry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/88_capabilities_registry.go b/core/scripts/keystone/src/88_capabilities_registry.go index 87ee02bf662..aeb129ff7a1 100644 --- a/core/scripts/keystone/src/88_capabilities_registry.go +++ b/core/scripts/keystone/src/88_capabilities_registry.go @@ -137,7 +137,7 @@ func (c *CapabilityRegistryProvisioner) AddNodeOperator(ctx context.Context, nop // add capabilities that the registry is not yet aware of. // // Note that in terms of the provisioning process, this is not the last step. A capability is only active once -// there is a DON servicing yet. This is done via `AddDON`. +// there is a DON servicing it. This is done via `AddDON`. func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop *NodeOperator, capSet CapabilitySet) { params := []kcr.CapabilitiesRegistryNodeParams{} for _, peer := range nop.DON { From ce5687fde0ab62bc942de027e895f2b7b8f363b9 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:52:37 -0700 Subject: [PATCH 035/117] Log ocr3 config more extensively --- core/scripts/keystone/src/01_deploy_contracts_cmd.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/01_deploy_contracts_cmd.go b/core/scripts/keystone/src/01_deploy_contracts_cmd.go index a9ab9ade33c..0d3f89f4637 100644 --- a/core/scripts/keystone/src/01_deploy_contracts_cmd.go +++ b/core/scripts/keystone/src/01_deploy_contracts_cmd.go @@ -163,6 +163,12 @@ func setOCR3Config( ocrContract, err := ocr3_capability.NewOCR3Capability(loadedContracts.OCRContract, env.Ec) PanicErr(err) fmt.Println("Setting OCR3 contract config...") + fmt.Printf("Signers: %v\n", ocrConfig.Signers) + fmt.Printf("Transmitters: %v\n", ocrConfig.Transmitters) + fmt.Printf("F: %v\n", ocrConfig.F) + fmt.Printf("OnchainConfig: %v\n", ocrConfig.OnchainConfig) + fmt.Printf("OffchainConfigVersion: %v\n", ocrConfig.OffchainConfigVersion) + fmt.Printf("OffchainConfig: %v\n", ocrConfig.OffchainConfig) tx, err := ocrContract.SetConfig(env.Owner, ocrConfig.Signers, ocrConfig.Transmitters, @@ -173,7 +179,6 @@ func setOCR3Config( ) PanicErr(err) receipt := helpers.ConfirmTXMined(context.Background(), env.Ec, tx, env.ChainID) - // Write blocknumber of the transaction to the deployed contracts file loadedContracts.SetConfigTxBlock = receipt.BlockNumber.Uint64() WriteDeployedContracts(loadedContracts, artefacts) From 086f0a03a58ead0f80038e09920430e694040519 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:53:05 -0700 Subject: [PATCH 036/117] Set isPublic to false for all-in-one DON --- core/scripts/keystone/src/06_provision_capabilities_registry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go index 73748f6dfa0..f33445aa8cf 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -81,7 +81,7 @@ func (c *provisionCR) Run(args []string) { // // See the method documentation for more details crProvisioner.AddNodes(ctx, nodeOperator, capSet) - crProvisioner.AddDON(ctx, nodeOperator, capSet, true, true) + crProvisioner.AddDON(ctx, nodeOperator, capSet, false, true) } func loadDON(publicKeys string, chainID int64, nodeList string) []peer { From c55811fd47e57577d8ed25a3acb0c2f8be8f884f Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 25 Sep 2024 14:40:06 -0700 Subject: [PATCH 037/117] Use nodeapi for deleting ocr3 jobs --- .../keystone/src/04_delete_ocr3_jobs_cmd.go | 29 +++---------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go b/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go index ac7668ae57a..7b8b3b6abb1 100644 --- a/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go +++ b/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go @@ -1,14 +1,11 @@ package src import ( - "bytes" "encoding/json" "flag" "fmt" "os" - "github.com/urfave/cli" - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" ) @@ -68,37 +65,19 @@ func (g *deleteJobs) Run(args []string) { nodes := downloadNodeAPICredentials(*nodeList) for _, node := range nodes { - output := &bytes.Buffer{} - client, app := newApp(node, output) - - fmt.Println("Logging in:", node.url) - loginFs := flag.NewFlagSet("test", flag.ContinueOnError) - loginFs.Bool("bypass-version-check", true, "") - loginCtx := cli.NewContext(app, loginFs, nil) - err := client.RemoteLogin(loginCtx) - helpers.PanicErr(err) - output.Reset() - - fileFs := flag.NewFlagSet("test", flag.ExitOnError) - err = client.ListJobs(cli.NewContext(app, fileFs, nil)) - helpers.PanicErr(err) + api := newNodeAPI(node) + jobsb := api.mustExec(api.methods.ListJobs) var parsed []JobSpec - err = json.Unmarshal(output.Bytes(), &parsed) + err = json.Unmarshal(jobsb, &parsed) helpers.PanicErr(err) for _, jobSpec := range parsed { if jobSpec.BootstrapSpec.ContractID == deployedContracts.OCRContract.String() || jobSpec.OffChainReporting2OracleSpec.ContractID == deployedContracts.OCRContract.String() { fmt.Println("Deleting OCR3 job ID:", jobSpec.Id, "name:", jobSpec.Name) - set := flag.NewFlagSet("test", flag.ExitOnError) - err = set.Parse([]string{jobSpec.Id}) - helpers.PanicErr(err) - err = client.DeleteJob(cli.NewContext(app, set, nil)) - helpers.PanicErr(err) + api.withArg(jobSpec.Id).mustExec(api.methods.DeleteJob) } } - - output.Reset() } } From 487b2f03d93085bef6e319042178262725b3ddd2 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 25 Sep 2024 14:40:45 -0700 Subject: [PATCH 038/117] Have mock EA return consistent prices every 10 sec --- .../external-adapter/99_external_adapter.go | 135 ++++++++++-------- 1 file changed, 79 insertions(+), 56 deletions(-) diff --git a/core/scripts/keystone/src/external-adapter/99_external_adapter.go b/core/scripts/keystone/src/external-adapter/99_external_adapter.go index 5335bbaf1d9..2c498f48ac5 100644 --- a/core/scripts/keystone/src/external-adapter/99_external_adapter.go +++ b/core/scripts/keystone/src/external-adapter/99_external_adapter.go @@ -1,64 +1,75 @@ package main -// Taken from https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/ocr2/plugins/mercury/integration_test.go#L1055 import ( "fmt" - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "math/rand" "net" "net/http" "net/http/httptest" "os" "strconv" + "sync" + "time" + + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" ) -func main() { - // get initial value from env - btcUsdInitialValue := 0.0 - btcUsdInitialValueEnv := os.Getenv("BTCUSD_INITIAL_VALUE") - linkInitialValue := 0.0 - linkInitialValueEnv := os.Getenv("LINK_INITIAL_VALUE") - nativeInitialValue := 0.0 - nativeInitialValueEnv := os.Getenv("NATIVE_INITIAL_VALUE") - - if btcUsdInitialValueEnv == "" { - fmt.Println("INITIAL_VALUE not set, using default value") - btcUsdInitialValue = 1000 - } else { - fmt.Println("INITIAL_VALUE set to ", btcUsdInitialValueEnv) - val, err := strconv.ParseFloat(btcUsdInitialValueEnv, 64) - helpers.PanicErr(err) - btcUsdInitialValue = val - } +// Price struct encapsulates bid, mid, ask values along with a mutex for synchronization +type Price struct { + mu sync.RWMutex + Bid float64 + Mid float64 + Ask float64 +} - if linkInitialValueEnv == "" { - fmt.Println("LINK_INITIAL_VALUE not set, using default value") - linkInitialValue = 11.0 - } else { - fmt.Println("LINK_INITIAL_VALUE set to ", linkInitialValueEnv) - val, err := strconv.ParseFloat(linkInitialValueEnv, 64) - helpers.PanicErr(err) - linkInitialValue = val - } +// Update safely updates the price values within the specified bounds +func (p *Price) Update(step, floor, ceiling float64) { + p.mu.Lock() + defer p.mu.Unlock() - if nativeInitialValueEnv == "" { - fmt.Println("NATIVE_INITIAL_VALUE not set, using default value") - nativeInitialValue = 2400.0 - } else { - fmt.Println("NATIVE_INITIAL_VALUE set to ", nativeInitialValueEnv) - val, err := strconv.ParseFloat(nativeInitialValueEnv, 64) - helpers.PanicErr(err) - nativeInitialValue = val - } + p.Mid = adjustValue(p.Mid, step, floor, ceiling) + p.Bid = adjustValue(p.Mid, step, floor, p.Mid) + p.Ask = adjustValue(p.Mid, step, p.Mid, ceiling) +} + +// GetSnapshot safely retrieves a copy of the current price values +func (p *Price) GetSnapshot() (bid, mid, ask float64) { + p.mu.RLock() + defer p.mu.RUnlock() + return p.Bid, p.Mid, p.Ask +} + +func main() { + // Get initial values from environment variables or use defaults + btcUsdInitialValue := getInitialValue("BTCUSD_INITIAL_VALUE", 1000.0) + linkInitialValue := getInitialValue("LINK_INITIAL_VALUE", 11.0) + nativeInitialValue := getInitialValue("NATIVE_INITIAL_VALUE", 2400.0) pctBounds := 0.3 + + // Start external adapters on different ports externalAdapter(btcUsdInitialValue, "4001", pctBounds) externalAdapter(linkInitialValue, "4002", pctBounds) externalAdapter(nativeInitialValue, "4003", pctBounds) + // Block main goroutine indefinitely select {} } +// getInitialValue retrieves the initial value from the environment or returns a default +func getInitialValue(envVar string, defaultValue float64) float64 { + valueEnv := os.Getenv(envVar) + if valueEnv == "" { + fmt.Printf("%s not set, using default value: %.4f\n", envVar, defaultValue) + return defaultValue + } + fmt.Printf("%s set to %s\n", envVar, valueEnv) + val, err := strconv.ParseFloat(valueEnv, 64) + helpers.PanicErr(err) + return val +} + +// externalAdapter sets up a mock external adapter server for a specific asset func externalAdapter(initialValue float64, port string, pctBounds float64) *httptest.Server { // Create a custom listener on the specified port listener, err := net.Listen("tcp", "0.0.0.0:"+port) @@ -66,37 +77,49 @@ func externalAdapter(initialValue float64, port string, pctBounds float64) *http panic(err) } - mid := initialValue - // we make step a tenth of the pctBounds to give ample room for the value to move - step := mid * pctBounds / 10 - bid := mid - step - ask := mid + step - // Calculate the floor and ceiling based on percentages of the initial value - ceiling := float64(initialValue) * (1 + pctBounds) - floor := float64(initialValue) * (1 - pctBounds) + // Initialize the Price struct + price := &Price{ + Bid: initialValue, + Mid: initialValue, + Ask: initialValue, + } + + step := initialValue * pctBounds / 10 + ceiling := initialValue * (1 + pctBounds) + floor := initialValue * (1 - pctBounds) + + // Perform initial adjustment to set bid and ask + price.Update(step, floor, ceiling) + + // Start a goroutine to periodically update the price + go func() { + ticker := time.NewTicker(10 * time.Second) + defer ticker.Stop() + for range ticker.C { + price.Update(step, floor, ceiling) + fmt.Printf("Updated prices on port %s: bid=%.4f, mid=%.4f, ask=%.4f\n", port, price.Bid, price.Mid, price.Ask) + } + }() handler := http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - res.WriteHeader(http.StatusOK) - // [floor <= bid <= mid <= ask <= ceiling] - mid = adjustValue(mid, step, floor, ceiling) - bid = adjustValue(mid, step, floor, mid) - ask = adjustValue(mid, step, mid, ceiling) + bid, mid, ask := price.GetSnapshot() + res.Header().Set("Content-Type", "application/json") + res.WriteHeader(http.StatusOK) resp := fmt.Sprintf(`{"result": {"bid": %.4f, "mid": %.4f, "ask": %.4f}}`, bid, mid, ask) - - _, herr := res.Write([]byte(resp)) - if herr != nil { - fmt.Printf("failed to write response: %v", herr) + if _, err := res.Write([]byte(resp)); err != nil { + fmt.Printf("failed to write response: %v\n", err) } }) + // Create and start the test server ea := &httptest.Server{ Listener: listener, Config: &http.Server{Handler: handler}, } ea.Start() - fmt.Print("Mock external adapter started at ", ea.URL, "\n") + fmt.Printf("Mock external adapter started at %s\n", ea.URL) fmt.Printf("Initial value: %.4f, Floor: %.4f, Ceiling: %.4f\n", initialValue, floor, ceiling) return ea } From d1dc8b73f13a2908d5d86b99696aa8f7c76c5025 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 25 Sep 2024 14:41:10 -0700 Subject: [PATCH 039/117] Remove pluginconfig to properly enable trigger --- core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 26bd5bd6fcf..764514b21ff 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -428,13 +428,6 @@ observationSource = """ price -> ask_price; """ -[pluginConfig] -# Dummy pub key -serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" -linkFeedID = "0x{{ .LinkFeedID }}" -nativeFeedID = "0x{{ .NativeFeedID }}" -serverURL = "wss://unknown" - [relayConfig] enableTriggerCapability = true chainID = "{{ .ChainID }}" From 55b2dd7c323cc2184aa431ed07c6a4fd8f9c4360 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 25 Sep 2024 14:41:19 -0700 Subject: [PATCH 040/117] Add additional logging --- core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 764514b21ff..67ad11c3a51 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -167,6 +167,10 @@ func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFile fmt.Printf("BridgeURL: %s\n", feed.bridgeUrl) fmt.Printf("Setting verifier config\n") + fmt.Printf("Signers: %v\n", ocrConfig.Signers) + fmt.Printf("Transmitters: %v\n", ocrConfig.Transmitters) + fmt.Printf("F: %d\n", ocrConfig.F) + tx, err := verifier.SetConfig( env.Owner, feed.id, From dc1f8741e09e329d125c9cdbfac7662d2aa579db Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 9 Oct 2024 15:05:20 -0700 Subject: [PATCH 041/117] Fix rebase errors --- core/scripts/keystone/src/99_fetch_keys.go | 72 ++++++++++--------- .../03_deploy_streams_trigger_cmd_test.snap | 9 +-- ...3_gen_crib_cluster_overrides_cmd_test.snap | 67 +++++++++++++++-- .../__snapshots__/88_gen_jobspecs_test.snap | 40 +++++------ 4 files changed, 121 insertions(+), 67 deletions(-) diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index 41dfcfd583e..6e6180af965 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -108,11 +108,20 @@ func trimmedOCR2KB(ocr2Bndl cmd.OCR2KeyBundlePresenter) OCR2KBTrimmed { } } +func trimmedAptosOCR2KB(ocr2Bndl cmd.OCR2KeyBundlePresenter) OCR2AptosKBTrimmed { + return OCR2AptosKBTrimmed{ + AptosBundleID: ocr2Bndl.ID, + AptosOnchainPublicKey: strings.TrimPrefix(ocr2Bndl.OnchainPublicKey, "ocr2on_aptos_"), + } +} + type AllNodeKeys struct { - EthAddress string - P2PPeerID string // p2p_ - OCR2KBs []OCR2KBTrimmed - CSAPublicKey string + AptosAccount string `json:"AptosAccount"` + OCR2AptosKBs []OCR2AptosKBTrimmed `json:"OCR2AptosKBs"` + EthAddress string `json:"EthAddress"` + P2PPeerID string `json:"P2PPeerID"` // p2p_ + OCR2KBs []OCR2KBTrimmed `json:"OCR2KBs"` + CSAPublicKey string `json:"CSAPublicKey"` } func (a AllNodeKeys) toNodeKeys(index ...int) NodeKeys { @@ -140,10 +149,10 @@ func (a AllNodeKeys) toNodeKeys(index ...int) NodeKeys { // This is an OCR key bundle with the prefixes on each respective key // trimmed off type OCR2KBTrimmed struct { - OCR2BundleID string // used only in job spec - OCR2OnchainPublicKey string // ocr2on_evm_ - OCR2OffchainPublicKey string // ocr2off_evm_ - OCR2ConfigPublicKey string // ocr2cfg_evm_ + OCR2BundleID string `json:"OCR2BundleID"` // used only in job spec + OCR2OnchainPublicKey string `json:"OCR2OnchainPublicKey"` // ocr2on_evm_ + OCR2OffchainPublicKey string `json:"OCR2OffchainPublicKey"` // ocr2off_evm_ + OCR2ConfigPublicKey string `json:"OCR2ConfigPublicKey"` // ocr2cfg_evm_ } // This is an Aptos key bundle with the prefixes on each respective key @@ -154,16 +163,14 @@ type OCR2AptosKBTrimmed struct { } type NodeKeys struct { - EthAddress string + EthAddress string `json:"EthAddress"` OCR2KBTrimmed AptosAccount string `json:"AptosAccount"` OCR2AptosKBTrimmed - P2PPeerID string // p2p_ - CSAPublicKey string + P2PPeerID string `json:"P2PPeerID"` + CSAPublicKey string `json:"CSAPublicKey"` } - - func mustFetchAllNodeKeys(chainId int64, nodes []*node) []AllNodeKeys { allNodeKeys := []AllNodeKeys{} @@ -197,20 +204,24 @@ func mustFetchAllNodeKeys(chainId int64, nodes []*node) []AllNodeKeys { } peerID := strings.TrimPrefix((*p2pKey)[0].PeerID, "p2p_") - + // Get OCR2 key bundles for both EVM and Aptos chains bundles := api.mustExec(api.methods.ListOCR2KeyBundles) ocr2Bundles := mustJSON[cmd.OCR2KeyBundlePresenters](bundles) + // We use the same bundle length for each chain since + // we marhshall them together into a single multichain key + // via ocrcommon.MarshalMultichainPublicKey + expectedBundleLen := 2 + // evm key bundles ocr2EvmBundles := getTrimmedEVMOCR2KBs(*ocr2Bundles) evmBundleLen := len(ocr2EvmBundles) - if evmBundleLen < 2 { + if evmBundleLen < expectedBundleLen { fmt.Printf("WARN: node has %d EVM OCR2 bundles when it should have at least 2, creating bundles...\n", evmBundleLen) - for i := evmBundleLen; i < 2; i++ { + for i := evmBundleLen; i < expectedBundleLen; i++ { cBundle := api.withArg("evm").mustExec(api.methods.CreateOCR2KeyBundle) - fmt.Println("Created OCR2 bundle", string(cBundle)) createdBundle := mustJSON[cmd.OCR2KeyBundlePresenter](cBundle) - fmt.Printf("Created bundle %s\n", createdBundle.ID) + fmt.Printf("Created OCR2 EVM key bundle %s\n", string(cBundle)) ocr2EvmBundles = append(ocr2EvmBundles, trimmedOCR2KB(*createdBundle)) } } @@ -218,14 +229,13 @@ func mustFetchAllNodeKeys(chainId int64, nodes []*node) []AllNodeKeys { // aptos key bundles ocr2AptosBundles := getTrimmedAptosOCR2KBs(*ocr2Bundles) aptosBundleLen := len(ocr2AptosBundles) - if aptosBundleLen < 2 { + if aptosBundleLen < expectedBundleLen { fmt.Printf("WARN: node has %d Aptos OCR2 bundles when it should have at least 2, creating bundles...\n", aptosBundleLen) - for i := aptosBundleLen; i < 2; i++ { + for i := aptosBundleLen; i < expectedBundleLen; i++ { cBundle := api.withArg("aptos").mustExec(api.methods.CreateOCR2KeyBundle) - fmt.Println("Created OCR2 bundle", string(cBundle)) createdBundle := mustJSON[cmd.OCR2KeyBundlePresenter](cBundle) - fmt.Printf("Created bundle %s\n", createdBundle.ID) - ocr2AptosBundles = append(ocr2AptosBundles, trimmedOCR2KB(*createdBundle)) + fmt.Println("Created OCR2 EVM key bundle", string(cBundle)) + ocr2AptosBundles = append(ocr2AptosBundles, trimmedAptosOCR2KB(*createdBundle)) } } @@ -239,6 +249,7 @@ func mustFetchAllNodeKeys(chainId int64, nodes []*node) []AllNodeKeys { AptosAccount: aptosAccount, P2PPeerID: peerID, OCR2KBs: ocr2EvmBundles, + OCR2AptosKBs: ocr2AptosBundles, CSAPublicKey: strings.TrimPrefix(csaPubKey, "csa_"), } @@ -255,20 +266,11 @@ func findFirstCSAPublicKey(csaKeyResources []presenters.CSAKeyResource) (string, return "", errors.New("did not find any CSA Key Resources") } -func findEvmOCR2Bundle(ocr2Bundles cmd.OCR2KeyBundlePresenters) int { - for i, b := range ocr2Bundles { - if b.ChainType == chainType { - return i - } - } - return -1 -} - -func getTrimmedAptosOCR2KBs(ocr2Bundles cmd.OCR2KeyBundlePresenters) []OCR2KBTrimmed { - aptosBundles := []OCR2KBTrimmed{} +func getTrimmedAptosOCR2KBs(ocr2Bundles cmd.OCR2KeyBundlePresenters) []OCR2AptosKBTrimmed { + aptosBundles := []OCR2AptosKBTrimmed{} for _, b := range ocr2Bundles { if b.ChainType == "aptos" { - aptosBundles = append(aptosBundles, trimmedOCR2KB(b)) + aptosBundles = append(aptosBundles, trimmedAptosOCR2KB(b)) } } return aptosBundles diff --git a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap index 5d4a79c65a2..5811e2e1876 100755 --- a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap @@ -83,13 +83,6 @@ observationSource = """ price -> ask_price; """ -[pluginConfig] -# Dummy pub key -serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" -linkFeedID = "0x0200000000000000000000000000000000000000000000000000000000000000" -nativeFeedID = "0x0300000000000000000000000000000000000000000000000000000000000000" -serverURL = "wss://unknown" - [relayConfig] enableTriggerCapability = true chainID = "123456" @@ -102,7 +95,7 @@ type = "workflow" schemaVersion = 1 name = "keystone_workflow" workflow = """ -name: "keystone_ccip_kiab_workflow" +name: "ccip_kiab" owner: '0x1234567890abcdef1234567890abcdef12345678' triggers: - id: streams-trigger@1.0.0 diff --git a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap index 0da6693fb2f..7250f7105dc 100755 --- a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap @@ -9,36 +9,95 @@ helm: overridesToml: |- [[EVM]] ChainID = '1337' + + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0xabcdef1234567890' + NetworkID = 'evm' + ChainID = '1337' node2: image: ${runtime.images.app} overridesToml: |- [[EVM]] ChainID = '1337' [EVM.Workflow] - FromAddress = '0x8B60FDcc9CAC8ea476b31d17011CB204471431d9' + FromAddress = '0x367764B5640E691bbeB99Ff14dEc4EA02421fFd9' ForwarderAddress = '0x1234567890abcdef' + + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@app-node1:6691'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0xabcdef1234567890' + NetworkID = 'evm' + ChainID = '1337' node3: image: ${runtime.images.app} overridesToml: |- [[EVM]] ChainID = '1337' [EVM.Workflow] - FromAddress = '0x6620F516F29979B214e2451498a057FDd3a0A85d' + FromAddress = '0x4CC725F1b7a23BC42658cce5c40A0ec3C7f3c925' ForwarderAddress = '0x1234567890abcdef' + + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@app-node1:6691'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0xabcdef1234567890' + NetworkID = 'evm' + ChainID = '1337' node4: image: ${runtime.images.app} overridesToml: |- [[EVM]] ChainID = '1337' [EVM.Workflow] - FromAddress = '0xFeB61E22FCf4F9740c9D96b05199F195bd61A7c2' + FromAddress = '0x5323547CdBb450725c59626A1A6C5608C5c1Ea07' ForwarderAddress = '0x1234567890abcdef' + + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@app-node1:6691'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0xabcdef1234567890' + NetworkID = 'evm' + ChainID = '1337' node5: image: ${runtime.images.app} overridesToml: |- [[EVM]] ChainID = '1337' [EVM.Workflow] - FromAddress = '0x882Fd04D78A7e7D386Dd5b550f19479E5494B0B2' + FromAddress = '0x16d9BbC5e927053697771AF7d7a003FE7b60B61E' ForwarderAddress = '0x1234567890abcdef' + + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@app-node1:6691'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0xabcdef1234567890' + NetworkID = 'evm' + ChainID = '1337' --- diff --git a/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap b/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap index 91cb8c6786b..73b521d7111 100755 --- a/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap +++ b/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap @@ -19,13 +19,13 @@ type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "b3df4d8748b67731a1112e8b45a764941974f5590c93672eebbc4f3504dd10ed" +ocrKeyBundleID = "2e302a95ada6b2d8b8fffce6ffd0926a129a11fb59bc9088ac0c8f01f43ba355" p2pv2Bootstrappers = [ - "12D3KooWNmhKZL1XW4Vv3rNjLXzJ6mqcVerihdijjGYuexPrFUFZ@crib-henry-keystone-node1.main.stage.cldev.sh:6690", + "12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@crib-henry-keystone-node1.main.stage.cldev.sh:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0x8B60FDcc9CAC8ea476b31d17011CB204471431d9" +transmitterID = "0x367764B5640E691bbeB99Ff14dEc4EA02421fFd9" [relayConfig] chainID = "1337" @@ -40,8 +40,8 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "b3df4d8748b67731a1112e8b45a764941974f5590c93672eebbc4f3504dd10ed" -aptos = "9bebfa953e7a7522746f72b4023308de36db626f3e0bcb9033407b8a183e8bfb" +evm = "2e302a95ada6b2d8b8fffce6ffd0926a129a11fb59bc9088ac0c8f01f43ba355" +aptos = "" -------------------------------- Oracle 1: @@ -50,13 +50,13 @@ type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "38459ae37f29f2c1fde0f25972a973322be8cada82acf43f464756836725be97" +ocrKeyBundleID = "3cdac381db901a657fe9416724d69efb46473652c6d8192a67d1f8dcefcc96f7" p2pv2Bootstrappers = [ - "12D3KooWNmhKZL1XW4Vv3rNjLXzJ6mqcVerihdijjGYuexPrFUFZ@crib-henry-keystone-node1.main.stage.cldev.sh:6690", + "12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@crib-henry-keystone-node1.main.stage.cldev.sh:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0x6620F516F29979B214e2451498a057FDd3a0A85d" +transmitterID = "0x4CC725F1b7a23BC42658cce5c40A0ec3C7f3c925" [relayConfig] chainID = "1337" @@ -71,8 +71,8 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "38459ae37f29f2c1fde0f25972a973322be8cada82acf43f464756836725be97" -aptos = "9bebfa953e7a7522746f72b4023308de36db626f3e0bcb9033407b8a183e8bfc" +evm = "3cdac381db901a657fe9416724d69efb46473652c6d8192a67d1f8dcefcc96f7" +aptos = "" -------------------------------- Oracle 2: @@ -81,13 +81,13 @@ type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "b5dbc4c9da983cddde2e3226b85807eb7beaf818694a22576af4d80f352702ed" +ocrKeyBundleID = "872bc4c78dc3c751ef100afcd60fa81c7f1744a9a10be1e86f6689455132041e" p2pv2Bootstrappers = [ - "12D3KooWNmhKZL1XW4Vv3rNjLXzJ6mqcVerihdijjGYuexPrFUFZ@crib-henry-keystone-node1.main.stage.cldev.sh:6690", + "12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@crib-henry-keystone-node1.main.stage.cldev.sh:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0xFeB61E22FCf4F9740c9D96b05199F195bd61A7c2" +transmitterID = "0x5323547CdBb450725c59626A1A6C5608C5c1Ea07" [relayConfig] chainID = "1337" @@ -102,8 +102,8 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "b5dbc4c9da983cddde2e3226b85807eb7beaf818694a22576af4d80f352702ed" -aptos = "9bebfa953e7a7522746f72b4023308de36db626f3e0bcb9033407b8a183e8bfd" +evm = "872bc4c78dc3c751ef100afcd60fa81c7f1744a9a10be1e86f6689455132041e" +aptos = "" -------------------------------- Oracle 3: @@ -112,13 +112,13 @@ type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "260d5c1a618cdf5324509d7db95f5a117511864ebb9e1f709e8969339eb225af" +ocrKeyBundleID = "0fb531b570483b6a02bf245d8854f60c4831550e965cf7d16a80badbb907f9ee" p2pv2Bootstrappers = [ - "12D3KooWNmhKZL1XW4Vv3rNjLXzJ6mqcVerihdijjGYuexPrFUFZ@crib-henry-keystone-node1.main.stage.cldev.sh:6690", + "12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@crib-henry-keystone-node1.main.stage.cldev.sh:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0x882Fd04D78A7e7D386Dd5b550f19479E5494B0B2" +transmitterID = "0x16d9BbC5e927053697771AF7d7a003FE7b60B61E" [relayConfig] chainID = "1337" @@ -133,8 +133,8 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "260d5c1a618cdf5324509d7db95f5a117511864ebb9e1f709e8969339eb225af" -aptos = "9bebfa953e7a7522746f72b4023308de36db626f3e0bcb9033407b8a183e8bfe" +evm = "0fb531b570483b6a02bf245d8854f60c4831550e965cf7d16a80badbb907f9ee" +aptos = "" --- From 502903ba06a7f7b4bec83e65e02bf574bd43d112 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:56:31 -0700 Subject: [PATCH 042/117] Shim ksdeploy types --- .../src/03_deploy_streams_trigger_cmd.go | 15 +++++++++++++ core/scripts/keystone/src/88_gen_jobspecs.go | 3 ++- .../keystone/src/88_gen_ocr3_config.go | 21 ++++++++++++++++++- core/scripts/keystone/src/99_fetch_keys.go | 1 - .../88_gen_ocr3_config_test.snap | 10 ++++----- 5 files changed, 42 insertions(+), 8 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 67ad11c3a51..997aae79ce0 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -12,7 +12,9 @@ package src import ( "bytes" "context" + "crypto/ed25519" "encoding/binary" + "encoding/hex" "encoding/json" "flag" "fmt" @@ -501,6 +503,19 @@ func createMercuryV3Job(data MercuryV3JobSpecData) (name string, jobSpecStr stri return data.Name, jobSpecStr } +func strToBytes32(str string) [32]byte { + pkBytes, err := hex.DecodeString(str) + helpers.PanicErr(err) + + pkBytesFixed := [ed25519.PublicKeySize]byte{} + n := copy(pkBytesFixed[:], pkBytes) + if n != ed25519.PublicKeySize { + fmt.Printf("wrong num elements copied (%s): %d != 32\n", str, n) + panic("wrong num elements copied") + } + return pkBytesFixed +} + func createBridgeIfDoesNotExist(api *nodeAPI, name string, eaURL string, force bool) { u, err := url.Parse(eaURL) url := models.WebURL(*u) diff --git a/core/scripts/keystone/src/88_gen_jobspecs.go b/core/scripts/keystone/src/88_gen_jobspecs.go index 4f59a89be2d..3dfebfcb158 100644 --- a/core/scripts/keystone/src/88_gen_jobspecs.go +++ b/core/scripts/keystone/src/88_gen_jobspecs.go @@ -33,9 +33,10 @@ func genSpecs( chainID int64, p2pPort int64, ocrConfigContractAddress string, + ) donHostSpec { nodes := downloadNodeAPICredentials(nodeListPath) - nca := downloadNodePubKeys(nodeListPath, chainID, pubkeysPath) + nca := nodeKeysToKsDeployNodeKeys(downloadNodePubKeys(nodeListPath, chainID, pubkeysPath)) bootstrapNode := nca[0] bootstrapSpecLines, err := readLines(filepath.Join(templatesDir, bootstrapSpecTemplate)) diff --git a/core/scripts/keystone/src/88_gen_ocr3_config.go b/core/scripts/keystone/src/88_gen_ocr3_config.go index a437410346a..8ff37cda28a 100644 --- a/core/scripts/keystone/src/88_gen_ocr3_config.go +++ b/core/scripts/keystone/src/88_gen_ocr3_config.go @@ -15,7 +15,26 @@ func generateOCR3Config(nodeList string, configFile string, chainID int64, pubKe cfg := topLevelCfg.OracleConfig cfg.OCRSecrets = deployment.XXXGenerateTestOCRSecrets() nca := downloadNodePubKeys(nodeList, chainID, pubKeysPath) - c, err := ksdeploy.GenerateOCR3Config(cfg, nca) + c, err := ksdeploy.GenerateOCR3Config(cfg, nodeKeysToKsDeployNodeKeys(nca)) helpers.PanicErr(err) return c } + +func nodeKeysToKsDeployNodeKeys(nks []NodeKeys) []ksdeploy.NodeKeys { + keys := []ksdeploy.NodeKeys{} + for _, nk := range nks { + keys = append(keys, ksdeploy.NodeKeys{ + EthAddress: nk.EthAddress, + AptosAccount: nk.AptosAccount, + AptosBundleID: nk.AptosBundleID, + AptosOnchainPublicKey: nk.AptosOnchainPublicKey, + P2PPeerID: nk.P2PPeerID, + OCR2BundleID: nk.OCR2BundleID, + OCR2OnchainPublicKey: nk.OCR2OnchainPublicKey, + OCR2OffchainPublicKey: nk.OCR2OffchainPublicKey, + OCR2ConfigPublicKey: nk.OCR2ConfigPublicKey, + CSAPublicKey: nk.CSAPublicKey, + }) + } + return keys +} diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index 6e6180af965..9a17285aa6e 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -12,7 +12,6 @@ import ( "github.com/urfave/cli" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/cmd" "github.com/smartcontractkit/chainlink/v2/core/web/presenters" diff --git a/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap b/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap index 8aa8776237d..295daf4f9ce 100755 --- a/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap +++ b/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap @@ -6,11 +6,11 @@ "OffchainConfigVersion": 30, "OnchainConfig": "0x", "Signers": [ - "011400a2402db8e549f094ea31e1c0edd77623f4ca5b12052000ea551e503b93a1c9ae26262b4db8f66db4cbe5ddcb6039e29d2665a634d48e4a", - "0114004af19c802b244d1d085492c3946391c965e10519052000ea551e503b93a1c9ae26262b4db8f66db4cbe5ddcb6039e29d2665a634d48e4b", - "01140061925685d2b80b121537341d063c4e57b2f9323c052000ea551e503b93a1c9ae26262b4db8f66db4cbe5ddcb6039e29d2665a634d48e4c", - "011400fd97efd53fc20acc098fcd746c04d8d7540d97e0052000ea551e503b93a1c9ae26262b4db8f66db4cbe5ddcb6039e29d2665a634d48e4d", - "011400a0b67dc5345a71d02b396147ae2cb75dda63cbe9052000ea551e503b93a1c9ae26262b4db8f66db4cbe5ddcb6039e29d2665a634d48e4e" + "011400bb9da64fefbae323b45ec98970863279824cf08d", + "01140026f04f488f6383cd4099b7aef16c0dc2e553adda", + "011400d754a628c5b34d027e4ccd8d90b54b9403a9b5f2", + "011400e366aed6fe28f47cc2c463cda40d4bb8573e15d4", + "011400405aeb4fa9359a7338217bfc4fdc77c886a6a6ee" ], "Transmitters": [ "0x9DfB1E962Fc6363087fB60A131aba2b7884dAD97", From 844477ece81ad68cfcd16345dd52295e2dd8a353 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 9 Oct 2024 18:51:29 -0700 Subject: [PATCH 043/117] Fix goreleaser config for mock ea --- .../src/external-adapter/.goreleaser.yaml | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/core/scripts/keystone/src/external-adapter/.goreleaser.yaml b/core/scripts/keystone/src/external-adapter/.goreleaser.yaml index 5c2141dd926..a1d0ef457ed 100644 --- a/core/scripts/keystone/src/external-adapter/.goreleaser.yaml +++ b/core/scripts/keystone/src/external-adapter/.goreleaser.yaml @@ -2,19 +2,36 @@ project_name: kiab-mock-external-adapter version: 2 builds: - - id: linux-amd64 - goos: - - linux - goarch: - - amd64 + - targets: + - go_first_class dockers: + - id: linux-arm64 + use: buildx + goos: linux + goarch: arm64 + image_templates: + - "{{ .Env.IMAGE }}" + - id: linux-amd64 use: buildx goos: linux goarch: amd64 image_templates: - "{{ .Env.IMAGE }}" +archives: + - format: binary + +release: + disable: true +changelog: + disable: true + +nightly: + version_template: "{{ .ProjectName }}-{{ .ShortCommit }}" snapshot: version_template: "{{ .ProjectName }}-{{ .ShortCommit }}" + +partial: + by: target From 14b1e7465670629d1f6cadc0490cffa276b7816b Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 10 Oct 2024 16:40:29 -0700 Subject: [PATCH 044/117] Dont depend on cgo for mock EA --- .../keystone/src/external-adapter/.goreleaser.yaml | 12 ++++++++++++ .../src/external-adapter/99_external_adapter.go | 10 +++++++--- .../scripts/keystone/src/external-adapter/Dockerfile | 4 ++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/core/scripts/keystone/src/external-adapter/.goreleaser.yaml b/core/scripts/keystone/src/external-adapter/.goreleaser.yaml index a1d0ef457ed..524be367e09 100644 --- a/core/scripts/keystone/src/external-adapter/.goreleaser.yaml +++ b/core/scripts/keystone/src/external-adapter/.goreleaser.yaml @@ -4,6 +4,10 @@ version: 2 builds: - targets: - go_first_class + no_unique_dist_dir: true + binary: kiab-mock-external-adapter + env: + - CGO_ENABLED=0 dockers: - id: linux-arm64 @@ -12,6 +16,8 @@ dockers: goarch: arm64 image_templates: - "{{ .Env.IMAGE }}" + build_flag_templates: + - --platform=linux/arm64 - id: linux-amd64 use: buildx @@ -19,6 +25,12 @@ dockers: goarch: amd64 image_templates: - "{{ .Env.IMAGE }}" + build_flag_templates: + - --platform=linux/amd64 +docker_manifests: + - name_template: '{{ .Env.IMAGE }}' + image_templates: + - '{{ .Env.IMAGE }}' archives: - format: binary diff --git a/core/scripts/keystone/src/external-adapter/99_external_adapter.go b/core/scripts/keystone/src/external-adapter/99_external_adapter.go index 2c498f48ac5..537091bb1ac 100644 --- a/core/scripts/keystone/src/external-adapter/99_external_adapter.go +++ b/core/scripts/keystone/src/external-adapter/99_external_adapter.go @@ -10,10 +10,14 @@ import ( "strconv" "sync" "time" - - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" ) +func PanicErr(err error) { + if err != nil { + panic(err) + } +} + // Price struct encapsulates bid, mid, ask values along with a mutex for synchronization type Price struct { mu sync.RWMutex @@ -65,7 +69,7 @@ func getInitialValue(envVar string, defaultValue float64) float64 { } fmt.Printf("%s set to %s\n", envVar, valueEnv) val, err := strconv.ParseFloat(valueEnv, 64) - helpers.PanicErr(err) + PanicErr(err) return val } diff --git a/core/scripts/keystone/src/external-adapter/Dockerfile b/core/scripts/keystone/src/external-adapter/Dockerfile index 9242528f465..714d9397c34 100644 --- a/core/scripts/keystone/src/external-adapter/Dockerfile +++ b/core/scripts/keystone/src/external-adapter/Dockerfile @@ -1,5 +1,5 @@ FROM scratch -ENTRYPOINT ["/kiab-mock-external-adapter"] +COPY ./kiab-mock-external-adapter / -COPY kiab-mock-external-adapter / +ENTRYPOINT ["/kiab-mock-external-adapter"] From f01c2529445219dabd4573755fb3579f3434a2c0 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 10 Oct 2024 16:42:24 -0700 Subject: [PATCH 045/117] Handle aptos key creation --- core/scripts/keystone/src/99_fetch_keys.go | 30 +++- core/scripts/keystone/src/99_nodes.go | 2 +- ...3_gen_crib_cluster_overrides_cmd_test.snap | 16 +- .../__snapshots__/88_gen_jobspecs_test.snap | 40 ++--- .../88_gen_ocr3_config_test.snap | 20 +-- .../keystone/src/testdata/PublicKeys.json | 165 ++++++++++++------ 6 files changed, 173 insertions(+), 100 deletions(-) diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index 9a17285aa6e..598d7527619 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -1,7 +1,6 @@ package src import ( - "bytes" "encoding/json" "errors" "fmt" @@ -133,6 +132,11 @@ func (a AllNodeKeys) toNodeKeys(index ...int) NodeKeys { } return NodeKeys{ + AptosAccount: a.AptosAccount, + OCR2AptosKBTrimmed: OCR2AptosKBTrimmed{ + AptosBundleID: a.OCR2AptosKBs[i].AptosBundleID, + AptosOnchainPublicKey: a.OCR2AptosKBs[i].AptosOnchainPublicKey, + }, OCR2KBTrimmed: OCR2KBTrimmed{ OCR2BundleID: a.OCR2KBs[i].OCR2BundleID, OCR2ConfigPublicKey: a.OCR2KBs[i].OCR2ConfigPublicKey, @@ -183,17 +187,31 @@ func mustFetchAllNodeKeys(chainId int64, nodes []*node) []AllNodeKeys { helpers.PanicErr(err) // Get aptos account key - output := &bytes.Buffer{} + api.output.Reset() aKeysClient := cmd.NewAptosKeysClient(api.methods) err = aKeysClient.ListKeys(&cli.Context{App: api.app}) helpers.PanicErr(err) var aptosKeys []presenters.AptosKeyResource - helpers.PanicErr(json.Unmarshal(output.Bytes(), &aptosKeys)) + helpers.PanicErr(json.Unmarshal(api.output.Bytes(), &aptosKeys)) + if len(aptosKeys) == 0 { + api.output.Reset() + fmt.Printf("WARN: node has no aptos keys, creating one...\n") + err = aKeysClient.CreateKey(&cli.Context{App: api.app}) + helpers.PanicErr(err) + api.output.Reset() + err = aKeysClient.ListKeys(&cli.Context{App: api.app}) + helpers.PanicErr(err) + helpers.PanicErr(json.Unmarshal(api.output.Bytes(), &aptosKeys)) + api.output.Reset() + } if len(aptosKeys) != 1 { - helpers.PanicErr(errors.New("node must have single aptos key")) + // list number of keys + fmt.Printf("Node has %d aptos keys\n", len(aptosKeys)) + PanicErr(errors.New("node must have single aptos key")) } + fmt.Printf("Node has aptos account %s\n", aptosKeys[0].Account) aptosAccount := aptosKeys[0].Account - output.Reset() + api.output.Reset() // Get p2p key p2pKeys := api.mustExec(api.methods.ListP2PKeys) @@ -233,7 +251,7 @@ func mustFetchAllNodeKeys(chainId int64, nodes []*node) []AllNodeKeys { for i := aptosBundleLen; i < expectedBundleLen; i++ { cBundle := api.withArg("aptos").mustExec(api.methods.CreateOCR2KeyBundle) createdBundle := mustJSON[cmd.OCR2KeyBundlePresenter](cBundle) - fmt.Println("Created OCR2 EVM key bundle", string(cBundle)) + fmt.Println("Created OCR2 Aptos key bundle", string(cBundle)) ocr2AptosBundles = append(ocr2AptosBundles, trimmedAptosOCR2KB(*createdBundle)) } } diff --git a/core/scripts/keystone/src/99_nodes.go b/core/scripts/keystone/src/99_nodes.go index 68d3621ce63..83c5b1e84f5 100644 --- a/core/scripts/keystone/src/99_nodes.go +++ b/core/scripts/keystone/src/99_nodes.go @@ -32,7 +32,7 @@ func writeNodesList(path string, nodes []*node) error { fmt.Println("Writing nodes list to", path) var lines []string for _, n := range nodes { - lines = append(lines, fmt.Sprintf("%s %s %s", n.url.String(), n.login, n.password)) + lines = append(lines, fmt.Sprintf("%s %s %s %s", n.url.String(), n.url.String(), n.login, n.password)) } return writeLines(lines, path) diff --git a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap index 7250f7105dc..fa2e0ad8488 100755 --- a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap @@ -26,14 +26,14 @@ helm: [[EVM]] ChainID = '1337' [EVM.Workflow] - FromAddress = '0x367764B5640E691bbeB99Ff14dEc4EA02421fFd9' + FromAddress = '0x7848602Cb94A5c2F443886540f03e831f916eC84' ForwarderAddress = '0x1234567890abcdef' [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@app-node1:6691'] + DefaultBootstrappers = ['12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -46,14 +46,14 @@ helm: [[EVM]] ChainID = '1337' [EVM.Workflow] - FromAddress = '0x4CC725F1b7a23BC42658cce5c40A0ec3C7f3c925' + FromAddress = '0x920ed6548FD46729d89a57Afe382F14Fa553FE47' ForwarderAddress = '0x1234567890abcdef' [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@app-node1:6691'] + DefaultBootstrappers = ['12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -66,14 +66,14 @@ helm: [[EVM]] ChainID = '1337' [EVM.Workflow] - FromAddress = '0x5323547CdBb450725c59626A1A6C5608C5c1Ea07' + FromAddress = '0x385aCC980734af138774451811d7A4eC5057EC2E' ForwarderAddress = '0x1234567890abcdef' [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@app-node1:6691'] + DefaultBootstrappers = ['12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -86,14 +86,14 @@ helm: [[EVM]] ChainID = '1337' [EVM.Workflow] - FromAddress = '0x16d9BbC5e927053697771AF7d7a003FE7b60B61E' + FromAddress = '0x8A7172a8197e18071C452ca538085Ff4Adcc6b4d' ForwarderAddress = '0x1234567890abcdef' [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@app-node1:6691'] + DefaultBootstrappers = ['12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] diff --git a/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap b/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap index 73b521d7111..bf59eee1c36 100755 --- a/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap +++ b/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap @@ -19,13 +19,13 @@ type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "2e302a95ada6b2d8b8fffce6ffd0926a129a11fb59bc9088ac0c8f01f43ba355" +ocrKeyBundleID = "0332308cdef793a3892f5fa70b1c3d42efe69054b6da2bb77e6b696e5fa351cd" p2pv2Bootstrappers = [ - "12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@crib-henry-keystone-node1.main.stage.cldev.sh:6690", + "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@crib-henry-keystone-node1.main.stage.cldev.sh:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0x367764B5640E691bbeB99Ff14dEc4EA02421fFd9" +transmitterID = "0x7848602Cb94A5c2F443886540f03e831f916eC84" [relayConfig] chainID = "1337" @@ -40,8 +40,8 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "2e302a95ada6b2d8b8fffce6ffd0926a129a11fb59bc9088ac0c8f01f43ba355" -aptos = "" +evm = "0332308cdef793a3892f5fa70b1c3d42efe69054b6da2bb77e6b696e5fa351cd" +aptos = "a8991d329d512dd97fc7ebc94e92fb6f4407285b8235a469efbf3d9df8de5544" -------------------------------- Oracle 1: @@ -50,13 +50,13 @@ type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "3cdac381db901a657fe9416724d69efb46473652c6d8192a67d1f8dcefcc96f7" +ocrKeyBundleID = "18b264b12430cf7f706b95e6323b10abc5225cac0ebceb60d1312dae3359b4c9" p2pv2Bootstrappers = [ - "12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@crib-henry-keystone-node1.main.stage.cldev.sh:6690", + "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@crib-henry-keystone-node1.main.stage.cldev.sh:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0x4CC725F1b7a23BC42658cce5c40A0ec3C7f3c925" +transmitterID = "0x920ed6548FD46729d89a57Afe382F14Fa553FE47" [relayConfig] chainID = "1337" @@ -71,8 +71,8 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "3cdac381db901a657fe9416724d69efb46473652c6d8192a67d1f8dcefcc96f7" -aptos = "" +evm = "18b264b12430cf7f706b95e6323b10abc5225cac0ebceb60d1312dae3359b4c9" +aptos = "378e3e6cc29171c29a98f977ff3d3b1cd0e7175a9d855f8106143bc23a577b19" -------------------------------- Oracle 2: @@ -81,13 +81,13 @@ type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "872bc4c78dc3c751ef100afcd60fa81c7f1744a9a10be1e86f6689455132041e" +ocrKeyBundleID = "6cee0022d1a0b307f73b3eac9a1d69b23db1deba30bfc8f53ab293523bbd6400" p2pv2Bootstrappers = [ - "12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@crib-henry-keystone-node1.main.stage.cldev.sh:6690", + "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@crib-henry-keystone-node1.main.stage.cldev.sh:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0x5323547CdBb450725c59626A1A6C5608C5c1Ea07" +transmitterID = "0x385aCC980734af138774451811d7A4eC5057EC2E" [relayConfig] chainID = "1337" @@ -102,8 +102,8 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "872bc4c78dc3c751ef100afcd60fa81c7f1744a9a10be1e86f6689455132041e" -aptos = "" +evm = "6cee0022d1a0b307f73b3eac9a1d69b23db1deba30bfc8f53ab293523bbd6400" +aptos = "8c8257b4838193409bd96bf9168c60ecc1e217363af9312d5c0db26b181f9e6f" -------------------------------- Oracle 3: @@ -112,13 +112,13 @@ type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "0fb531b570483b6a02bf245d8854f60c4831550e965cf7d16a80badbb907f9ee" +ocrKeyBundleID = "0a7aecb6b694fbcd71cbd1932238d5fd9442fd3477916cdb0519ab2408d21b2b" p2pv2Bootstrappers = [ - "12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL@crib-henry-keystone-node1.main.stage.cldev.sh:6690", + "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@crib-henry-keystone-node1.main.stage.cldev.sh:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0x16d9BbC5e927053697771AF7d7a003FE7b60B61E" +transmitterID = "0x8A7172a8197e18071C452ca538085Ff4Adcc6b4d" [relayConfig] chainID = "1337" @@ -133,8 +133,8 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "0fb531b570483b6a02bf245d8854f60c4831550e965cf7d16a80badbb907f9ee" -aptos = "" +evm = "0a7aecb6b694fbcd71cbd1932238d5fd9442fd3477916cdb0519ab2408d21b2b" +aptos = "34d1a1886cb41418eb174de45498a0dc9ffa6edbc219c24021acc7bdfbd6cf28" --- diff --git a/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap b/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap index 295daf4f9ce..8ba7ad24438 100755 --- a/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap +++ b/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap @@ -6,18 +6,18 @@ "OffchainConfigVersion": 30, "OnchainConfig": "0x", "Signers": [ - "011400bb9da64fefbae323b45ec98970863279824cf08d", - "01140026f04f488f6383cd4099b7aef16c0dc2e553adda", - "011400d754a628c5b34d027e4ccd8d90b54b9403a9b5f2", - "011400e366aed6fe28f47cc2c463cda40d4bb8573e15d4", - "011400405aeb4fa9359a7338217bfc4fdc77c886a6a6ee" + "011400f118b71c49bfa24fcf9aa177bb1a8ca43da9bcb905200038f58b8b3762d5a7949ab3ea8caae7103b93d3ab9f1475fe2419a61ffe3721c3", + "011400ff13a76b8f95705bce6f9fd1722814102964782605200024278247322fc734ad036c32e63d1a088204948eb1a08c2b9b2a2e13b9db39af", + "0114005b7e53d88cf57f415a463f9dcac1a19eea332ee6052000c5ae8795aef0b0f01947343b3b48c052ba1a695e31401ce7b1cb8f2e74d201ce", + "011400689d45e7e7b3b2bfcddb2714bf4b296767794727052000ea21c61bcb7768010c997b84fbb34f84010216da3b1fb93f0a78c09969314917", + "0114003fbcb609d650f95d62412475845bc95bf3aee54a052000fcabe4de5a7016fa9f791a2fb3f1587a40bdcee5bd008ce2399338dd12bfed25" ], "Transmitters": [ - "0x9DfB1E962Fc6363087fB60A131aba2b7884dAD97", - "0x367764B5640E691bbeB99Ff14dEc4EA02421fFd9", - "0x4CC725F1b7a23BC42658cce5c40A0ec3C7f3c925", - "0x5323547CdBb450725c59626A1A6C5608C5c1Ea07", - "0x16d9BbC5e927053697771AF7d7a003FE7b60B61E" + "0xAB61281B74DadFcCccF06Fb0F8406018683a39E5", + "0x7848602Cb94A5c2F443886540f03e831f916eC84", + "0x920ed6548FD46729d89a57Afe382F14Fa553FE47", + "0x385aCC980734af138774451811d7A4eC5057EC2E", + "0x8A7172a8197e18071C452ca538085Ff4Adcc6b4d" ] } --- diff --git a/core/scripts/keystone/src/testdata/PublicKeys.json b/core/scripts/keystone/src/testdata/PublicKeys.json index fdd5b40c9c2..93249b670d9 100644 --- a/core/scripts/keystone/src/testdata/PublicKeys.json +++ b/core/scripts/keystone/src/testdata/PublicKeys.json @@ -1,97 +1,152 @@ [ { - "EthAddress": "0x9DfB1E962Fc6363087fB60A131aba2b7884dAD97", - "P2PPeerID": "12D3KooWFwZTEkR3dM8smBeWZTzzXPWAwEBQiGUYNo8gqskS2DcL", + "AptosAccount": "81e6d6cdce9d9f64706682f533c34c6ae15ef2e126eb3effcfbe2566785c7e5a", + "OCR2AptosKBs": [ + { + "AptosBundleID": "c79161e50c63b1da010a31729c25b35e87efa48bc87222713378a985194cfdf8", + "AptosOnchainPublicKey": "38f58b8b3762d5a7949ab3ea8caae7103b93d3ab9f1475fe2419a61ffe3721c3" + }, + { + "AptosBundleID": "ddf9c2e55f9b09883ffc04b387544b9879dd409c0721d95bc3bcd698669f12ba", + "AptosOnchainPublicKey": "848795fd7d821853b6e9fab24afd4d0bcced29cf33065daaab2a0e6e52b4e603" + } + ], + "EthAddress": "0xAB61281B74DadFcCccF06Fb0F8406018683a39E5", + "P2PPeerID": "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2", "OCR2KBs": [ { - "OCR2BundleID": "05ff3c1c2cba85f8761362221afbc0c44a8fce52467c9feb59271479b5f4cc79", - "OCR2OnchainPublicKey": "bb9da64fefbae323b45ec98970863279824cf08d", - "OCR2OffchainPublicKey": "d90d1fcec7c7f52766fcf9f78733f5c963003f1098e4db274481120baa661c23", - "OCR2ConfigPublicKey": "7a5350a05a0c1a76f1dfb2777a9cc4fb96fccafc00cd145c88e038e4376aed1e" + "OCR2BundleID": "3be44dce84b19c41fdb2ed4733d655b723fb8568a84e9ddef2e626fff8ac1cc2", + "OCR2OnchainPublicKey": "f118b71c49bfa24fcf9aa177bb1a8ca43da9bcb9", + "OCR2OffchainPublicKey": "1a6da481ad10a56e400c40c48102a5bdb158cde6e559c985f85e8fc8a89f8904", + "OCR2ConfigPublicKey": "29b7e7093599191eced88eb594f6740ad3100a049a5b0f749106c9162a8d5832" }, { - "OCR2BundleID": "acfa03eed948b1cde5067161ce27a88ce5bc98905128e678cf1987aa41022119", - "OCR2OnchainPublicKey": "6ff800e9d0b0c0087286b833049a166dfe269f49", - "OCR2OffchainPublicKey": "66edb100a254e4ae3f4856bf3c5c9933908cc893c1733e7df0a2553a44d4dc2a", - "OCR2ConfigPublicKey": "b4b3d403748daf54f56e684b30fcecabad3ab59ac4e59c41fbf6ce5b9efae74d" + "OCR2BundleID": "90ff45c6e06bfa2d7a2f139d7a2ff61d42631e4c3b4dbbee776905a3e0cfbc62", + "OCR2OnchainPublicKey": "9b590ac6673f7f79d41154166f66eccf89d2fbe8", + "OCR2OffchainPublicKey": "780b3f3f28c6a1fde982b897f23b38ccb3560b176c8fae23461bbc24e5cd1d7e", + "OCR2ConfigPublicKey": "e0ef149d67b9a248be74039ecd8f20c2026250d6789c419ff070585504bdad7e" } ], - "CSAPublicKey": "53940b5245216eaae8a87fb777902bf898432820bfc3c97778fd7325e0f4d1f3" + "CSAPublicKey": "ed64533c9a0df4e81f6679a986df602630118e0410b616f18eff05596a9b8b47" }, { - "EthAddress": "0x367764B5640E691bbeB99Ff14dEc4EA02421fFd9", - "P2PPeerID": "12D3KooWJWcdKb5BATxkuApEZufpEsXgu3UAG4fPtvuavHe2NHQi", + "AptosAccount": "7a052a94f8ba19fc193f45bb258e25133df6e0787201752d95e89e24ecb4c0e0", + "OCR2AptosKBs": [ + { + "AptosBundleID": "a8991d329d512dd97fc7ebc94e92fb6f4407285b8235a469efbf3d9df8de5544", + "AptosOnchainPublicKey": "24278247322fc734ad036c32e63d1a088204948eb1a08c2b9b2a2e13b9db39af" + }, + { + "AptosBundleID": "d79fe54b6150c918b71f93578b3dda9ae8fa0b3285d79e3b863a4e017af03b91", + "AptosOnchainPublicKey": "635155a5d260a6b6781f99f34e8da2cf86b88f97ca9f3c84bf8075050386bb2d" + } + ], + "EthAddress": "0x7848602Cb94A5c2F443886540f03e831f916eC84", + "P2PPeerID": "12D3KooWALUE9rJzRSGifjCZCefE2FGDmoByTpoaVf2FYHzkTWk8", "OCR2KBs": [ { - "OCR2BundleID": "2e302a95ada6b2d8b8fffce6ffd0926a129a11fb59bc9088ac0c8f01f43ba355", - "OCR2OnchainPublicKey": "26f04f488f6383cd4099b7aef16c0dc2e553adda", - "OCR2OffchainPublicKey": "d721c5ec7a62e81b9c8f1b7a2fd6d193b135c7cea207d16af74ab71fc92fdbdc", - "OCR2ConfigPublicKey": "c09ea54fa542f02e459b9a749a3306b4b6cc613812f4bfef17412883bcb9d87b" + "OCR2BundleID": "0332308cdef793a3892f5fa70b1c3d42efe69054b6da2bb77e6b696e5fa351cd", + "OCR2OnchainPublicKey": "ff13a76b8f95705bce6f9fd17228141029647826", + "OCR2OffchainPublicKey": "538bc68bbd90e2ca661b3b422aec2f45febf376329e53ecac1b8e2900884d506", + "OCR2ConfigPublicKey": "47c95793608477f02d8e1654ae64b0bab4ecb4d46aded42708250895eedbec00" }, { - "OCR2BundleID": "f550286c0e74d894e95ec5e55e06fc980420d30cf2c6565b148f7423922f6b4d", - "OCR2OnchainPublicKey": "ca60dc5200e49b345808ce40b68b4d9d480762fb", - "OCR2OffchainPublicKey": "d8f7d6e9f358bbf69e8a26d7e65ddfd98ecc9758dac131a983a5100216e72b9c", - "OCR2ConfigPublicKey": "72ab5516dea0304fcb3a16a2c1a314b0ccd844aba4cdbe2f8d7944924c990405" + "OCR2BundleID": "79db2ae001d5cbe9617b1e3e4e32ef27df4adf25b19df7ef4840902967f983bb", + "OCR2OnchainPublicKey": "9b3622c73264ac991af3e57e562d2cda4cc077a6", + "OCR2OffchainPublicKey": "8d9c29a7d07933d55dd0d2810ab206e523270456de4100a7e81b044f6abe31a7", + "OCR2ConfigPublicKey": "f5047ffcb9de176f8d4330132db45cb28c2d722abfe59e863503267d1ced0a26" } ], - "CSAPublicKey": "bb4a327ef258e09fd6192443ad007b0a2fdd5d0fb0a42aeb1c05252ba1c71bb7" + "CSAPublicKey": "2afdb4f88ea737514e6d3e706db59fb26e4ee40296402e89a76105faaee1b122" }, { - "EthAddress": "0x4CC725F1b7a23BC42658cce5c40A0ec3C7f3c925", - "P2PPeerID": "12D3KooWR1xT9MRh469Fh21CRK1t1xbveqUCnbgG53UFktU1DrRw", + "AptosAccount": "7de165e74144a112e30ae53fabc841889214ea35a9a0decb834b62362d916215", + "OCR2AptosKBs": [ + { + "AptosBundleID": "378e3e6cc29171c29a98f977ff3d3b1cd0e7175a9d855f8106143bc23a577b19", + "AptosOnchainPublicKey": "c5ae8795aef0b0f01947343b3b48c052ba1a695e31401ce7b1cb8f2e74d201ce" + }, + { + "AptosBundleID": "d7c0567ef89ee8d96be2b9b8c66164a94420a66030223d098fc30a44f5411350", + "AptosOnchainPublicKey": "863c5f1bc60f605e0150f84dc5f9de5037834848be9f1980fc22fc0a78f41583" + } + ], + "EthAddress": "0x920ed6548FD46729d89a57Afe382F14Fa553FE47", + "P2PPeerID": "12D3KooWRw2ZgUCXP6LigiVxvSmWeL2h7ZB5bJ9AE9vCAQ1EK8q9", "OCR2KBs": [ { - "OCR2BundleID": "3cdac381db901a657fe9416724d69efb46473652c6d8192a67d1f8dcefcc96f7", - "OCR2OnchainPublicKey": "d754a628c5b34d027e4ccd8d90b54b9403a9b5f2", - "OCR2OffchainPublicKey": "db6582f9a70f48b886963cea7facbef92ead0de7c0ac0954e7765a526bab454e", - "OCR2ConfigPublicKey": "f53ccfe1fc347988bc7b7151458517ed985283e6e4ae093f6591f015c1d7762a" + "OCR2BundleID": "18b264b12430cf7f706b95e6323b10abc5225cac0ebceb60d1312dae3359b4c9", + "OCR2OnchainPublicKey": "5b7e53d88cf57f415a463f9dcac1a19eea332ee6", + "OCR2OffchainPublicKey": "4a0d9d39ba9ed6a22ab5527aea99939d8a639f407576ab940870ed6c44ef95c6", + "OCR2ConfigPublicKey": "30da13f8306ddf064951a0f423b42ad725593d089edf13a975138a5947d7d030" }, { - "OCR2BundleID": "dceccf3e8451d9d43c6d975f106c192b8581554d18c254a6e9539022bced08f9", - "OCR2OnchainPublicKey": "3cc49cd664c836824f1f77283668b7fe139c8090", - "OCR2OffchainPublicKey": "c5daa1235dd866ec912bfd6aceadf7e3ced29443b570ed826d97e4a4ae3b60a2", - "OCR2ConfigPublicKey": "690e03fc2565fbaed75b8b1516f67e8dd97ff9f02962196830f121f571ba7948" + "OCR2BundleID": "fa6e8e8b8747b35468e1a1b556f67288451ee8cca01e6c9d5d5a9b98e123bb28", + "OCR2OnchainPublicKey": "285ab1f6180fa6d9c435f5dd05751551e550f05d", + "OCR2OffchainPublicKey": "78f67a09bcc37dba146dd03188613d6352f608369c8e1788f56f7bacb182d185", + "OCR2ConfigPublicKey": "b23e0f95effa71308a9d266f4cce360b991f199b612e4e345260e54006097503" } ], - "CSAPublicKey": "2861e869bbc7035b2be949d9c8d06189d4af9f962ecb0dbe8a443c7425cfe688" + "CSAPublicKey": "365375704fa92c39f18c45be962d51721c3be24eb18ec99921a66981298c7399" }, { - "EthAddress": "0x5323547CdBb450725c59626A1A6C5608C5c1Ea07", - "P2PPeerID": "12D3KooWNeovZBgc4kJWGBi8U8C3rsoyQqZECPqwvgb5E7yBBnzu", + "AptosAccount": "b27df683db460c79b20737a9755126508dde1aaae9188e2e8b89d8c374b8bc66", + "OCR2AptosKBs": [ + { + "AptosBundleID": "8c8257b4838193409bd96bf9168c60ecc1e217363af9312d5c0db26b181f9e6f", + "AptosOnchainPublicKey": "ea21c61bcb7768010c997b84fbb34f84010216da3b1fb93f0a78c09969314917" + }, + { + "AptosBundleID": "9c8027fe870e824ee825b06f5889395832d566c309b8352a9b3257aed8859230", + "AptosOnchainPublicKey": "58d08047986f60dd968aa256f7679f0847bb71ac3676550b89ab1fcb78dc7cb2" + } + ], + "EthAddress": "0x385aCC980734af138774451811d7A4eC5057EC2E", + "P2PPeerID": "12D3KooWBb6BQXSQ9YZBzQnH8dhgz2ksdXpU5cNwUUZ99GDfgkwC", "OCR2KBs": [ { - "OCR2BundleID": "872bc4c78dc3c751ef100afcd60fa81c7f1744a9a10be1e86f6689455132041e", - "OCR2OnchainPublicKey": "e366aed6fe28f47cc2c463cda40d4bb8573e15d4", - "OCR2OffchainPublicKey": "126d991638b02eadfb614ee011970a1e22ac8838012be58f72eca3cd99326ba9", - "OCR2ConfigPublicKey": "168153f44e3be99df292082ff79eaf6d4972e905c9519c3cc719e416fa9a1e63" + "OCR2BundleID": "6cee0022d1a0b307f73b3eac9a1d69b23db1deba30bfc8f53ab293523bbd6400", + "OCR2OnchainPublicKey": "689d45e7e7b3b2bfcddb2714bf4b296767794727", + "OCR2OffchainPublicKey": "4ab1fe3630b58d62b46501b121f92d8a8c81b325472b8ace6dfef3c4bb0f00f3", + "OCR2ConfigPublicKey": "b377b0a623e4de968a125ab362de22f7bb899872400ab13a15ea5d5987504a75" }, { - "OCR2BundleID": "e63799347d9d0a64e9a7f9715239f640f4df785bee9689898965d83911db3ccb", - "OCR2OnchainPublicKey": "fea23a235be5e3160e88a7a463df0f74f4e035fa", - "OCR2OffchainPublicKey": "93e965f15a1913dd11341b1f829220cda4b3d96b4634fac91183276eed890f52", - "OCR2ConfigPublicKey": "c33577067dffc7af126f654b52d6e176cd0b359024dfdf0bc1dbf381af46ae00" + "OCR2BundleID": "eecc7a727df2ed10e304f4f3cd03290a809ac1ad19b656f256221ac9808d901c", + "OCR2OnchainPublicKey": "a5c84182a049ed7a7982a3912dba038b7af27ab7", + "OCR2OffchainPublicKey": "19e5357b4f73c0e332b080bf2834934ba2c598ed9d70518af66bd246d639998d", + "OCR2ConfigPublicKey": "ecc96cc82e2c2cd8ba6fc4028545c4568d092683a2f11821d7b41081db17f006" } ], - "CSAPublicKey": "05a0b0a1d7c58129ade44a28fc982fe43532160d6367829853da003fbecdc456" + "CSAPublicKey": "1b5c2edbc13a78d14c27d449a3d2e23f70a0fd2ff5b90b8fb97a5c5eae48b9d7" }, { - "EthAddress": "0x16d9BbC5e927053697771AF7d7a003FE7b60B61E", - "P2PPeerID": "12D3KooWSCGxPeUVjLTYcUxd8A53k8Ww1pRbJDb553Rury3UfRpq", + "AptosAccount": "1f7cb7e4d5f3b5c8e776581aea0230533f133add9c83afc5244e51145eb88a3b", + "OCR2AptosKBs": [ + { + "AptosBundleID": "34d1a1886cb41418eb174de45498a0dc9ffa6edbc219c24021acc7bdfbd6cf28", + "AptosOnchainPublicKey": "fcabe4de5a7016fa9f791a2fb3f1587a40bdcee5bd008ce2399338dd12bfed25" + }, + { + "AptosBundleID": "73e363d055b649a4646cd1deccc4398c1836201e63b0e4fb984f95576da74ecb", + "AptosOnchainPublicKey": "b32030b5e2af57ec7cd19899d6db271891ac39696b08865a48deff483caed187" + } + ], + "EthAddress": "0x8A7172a8197e18071C452ca538085Ff4Adcc6b4d", + "P2PPeerID": "12D3KooWLMFnmdZPS5zfkBsRVMrsKr3zTaFeuM48bskp5Mxnkdms", "OCR2KBs": [ { - "OCR2BundleID": "0fb531b570483b6a02bf245d8854f60c4831550e965cf7d16a80badbb907f9ee", - "OCR2OnchainPublicKey": "405aeb4fa9359a7338217bfc4fdc77c886a6a6ee", - "OCR2OffchainPublicKey": "9f57204194c84d7fb97b67427282684dddd85014497340296ea9f144ed8a4e6e", - "OCR2ConfigPublicKey": "9e5d20fd7a5378c8c4d8baf454b0516da864e3a0cc3393e7e1cf2e909b0bcb3f" + "OCR2BundleID": "0a7aecb6b694fbcd71cbd1932238d5fd9442fd3477916cdb0519ab2408d21b2b", + "OCR2OnchainPublicKey": "3fbcb609d650f95d62412475845bc95bf3aee54a", + "OCR2OffchainPublicKey": "222542dd828ec343d4c28410897f8a2a0d10a7c8a582ddbd1c15cdf3aa4ec067", + "OCR2ConfigPublicKey": "bf9b3d1d72f29d40a20d88dabee331db5347ed775c2ea0d06272762dcc1bf627" }, { - "OCR2BundleID": "93ecd598651424647332fba6557e60887c2bffb187e7a0bdbbc955dc0276e792", - "OCR2OnchainPublicKey": "7fee2c4f130decaf2dd6041d4c874e98554a1079", - "OCR2OffchainPublicKey": "bb56dd698595251f6640b3e3235c0611a1d189cb2c243002d2c6a791957f7185", - "OCR2ConfigPublicKey": "493850ef7b53443f0763b5ad4fefbcdd512123cae465d7d56cb9d7c488ed8525" + "OCR2BundleID": "32de5360efbf37a436ecbd918c9c1135c80a8d5a6e0c87343cee28f6e72a6590", + "OCR2OnchainPublicKey": "92655fa128ce5c996565fdf8477d6402faf2c11e", + "OCR2OffchainPublicKey": "0f0e3930b8a8f51550ed885354c0316583e0ac2e3d4cb3cc8638f35c4ec99c93", + "OCR2ConfigPublicKey": "972bbcf5d5144f881fddbdeffe61f4ce1cc7765ba38080798ba2f5d8d69b3b3c" } ], - "CSAPublicKey": "aaad908b939c7dbd4aec24add746ec35d4510efebe2d090fdac69dde39babfec" + "CSAPublicKey": "1b761b910db435a879edddce790cb07225c4ff8e7d836936b480835535c1a63c" } ] From 6bd18c0b0d1b7b4d5d972573c55090480141ab91 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Fri, 11 Oct 2024 17:59:35 -0700 Subject: [PATCH 046/117] Tune mercury OCR rounds to be less freq --- .../src/03_deploy_streams_trigger_cmd.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 997aae79ce0..266c11e90f8 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -563,9 +563,11 @@ func generateMercuryOCR2Config(nca []NodeKeys) MercuryOCR2Config { Min: big.NewInt(0), Max: big.NewInt(math.MaxInt64), } + + // Values were taken from Data Streams 250ms feeds, given by @austinborn rawReportingPluginConfig := datastreamsmercury.OffchainConfig{ - ExpirationWindow: 1, - BaseUSDFee: decimal.NewFromInt(100), + ExpirationWindow: 86400, + BaseUSDFee: decimal.NewFromInt(0), } onchainConfig, err := (datastreamsmercury.StandardOnchainConfigCodec{}).Encode(rawOnchainConfig) @@ -606,15 +608,16 @@ func generateMercuryOCR2Config(nca []NodeKeys) MercuryOCR2Config { }) } + // Values were taken from Data Streams 250ms feeds, given by @austinborn signers, _, _, onchainConfig, offchainConfigVersion, offchainConfig, err := ocr3confighelper.ContractSetConfigArgsForTestsMercuryV02( - 2*time.Second, // DeltaProgress - 20*time.Second, // DeltaResend + 10*time.Second, // DeltaProgress + 10*time.Second, // DeltaResend 400*time.Millisecond, // DeltaInitial - 100*time.Millisecond, // DeltaRound + 5*time.Second, // DeltaRound 0, // DeltaGrace - 300*time.Millisecond, // DeltaCertifiedCommitRequest - 1*time.Minute, // DeltaStage - 100, // rMax + 1*time.Second, // DeltaCertifiedCommitRequest + 0, // DeltaStage + 25, // rMax []int{len(identities)}, // S identities, reportingPluginConfig, // reportingPluginConfig []byte, From 95d69bd17f47787afb323deba350f116fda51c4b Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Fri, 11 Oct 2024 18:00:14 -0700 Subject: [PATCH 047/117] Use deployments rather than pods --- .../src/03_deploy_streams_trigger_cmd.go | 30 ++++---- core/scripts/keystone/src/88_gen_jobspecs.go | 2 +- core/scripts/keystone/src/99_crib_client.go | 33 ++++----- core/scripts/keystone/src/99_fetch_keys.go | 9 ++- core/scripts/keystone/src/99_k8s_client.go | 69 +++++++++---------- core/scripts/keystone/src/99_nodes.go | 10 +-- 6 files changed, 78 insertions(+), 75 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 266c11e90f8..d9080266aab 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -172,7 +172,7 @@ func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFile fmt.Printf("Signers: %v\n", ocrConfig.Signers) fmt.Printf("Transmitters: %v\n", ocrConfig.Transmitters) fmt.Printf("F: %d\n", ocrConfig.F) - + tx, err := verifier.SetConfig( env.Owner, feed.id, @@ -278,7 +278,7 @@ func deployOCR2JobSpecsForFeed(nca []NodeKeys, nodes []*node, verifier *verifier // Prepare data for Mercury V3 Job mercuryData := MercuryV3JobSpecData{ FeedName: fmt.Sprintf("feed-%s", feed.name), - BootstrapHost: fmt.Sprintf("%s@%s:%s", nca[0].P2PPeerID, "app-node1", "6690"), + BootstrapHost: fmt.Sprintf("%s@%s:%s", nca[0].P2PPeerID, nodes[0].serviceName, "6690"), VerifierAddress: verifier.Address().Hex(), Bridge: feed.bridgeName, NodeCSAKey: n.CSAPublicKey, @@ -298,28 +298,28 @@ func deployOCR2JobSpecsForFeed(nca []NodeKeys, nodes []*node, verifier *verifier } func upsertJob(api *nodeAPI, jobSpecName string, jobSpecStr string, upsert bool) { - jobsResp := api.mustExec(api.methods.ListJobs) - jobs := mustJSON[[]JobSpec](jobsResp) - for _, job := range *jobs { - if job.Name == jobSpecName { + jobsResp := api.mustExec(api.methods.ListJobs) + jobs := mustJSON[[]JobSpec](jobsResp) + for _, job := range *jobs { + if job.Name == jobSpecName { if !upsert { fmt.Printf("Job already exists: %s, skipping..\n", jobSpecName) return } - fmt.Printf("Job already exists: %s, replacing..\n", jobSpecName) - api.withArg(job.Id).mustExec(api.methods.DeleteJob) - fmt.Printf("Deleted job: %s\n", jobSpecName) + fmt.Printf("Job already exists: %s, replacing..\n", jobSpecName) + api.withArg(job.Id).mustExec(api.methods.DeleteJob) + fmt.Printf("Deleted job: %s\n", jobSpecName) break - } } + } - fmt.Printf("Deploying jobspec: %s\n... \n", jobSpecStr) - _, err := api.withArg(jobSpecStr).exec(api.methods.CreateJob) - if err != nil { - panic(fmt.Sprintf("Failed to deploy job spec: %s Error: %s", jobSpecStr, err)) - } + fmt.Printf("Deploying jobspec: %s\n... \n", jobSpecStr) + _, err := api.withArg(jobSpecStr).exec(api.methods.CreateJob) + if err != nil { + panic(fmt.Sprintf("Failed to deploy job spec: %s Error: %s", jobSpecStr, err)) } +} type WorkflowJobSpecConfig struct { JobSpecName string diff --git a/core/scripts/keystone/src/88_gen_jobspecs.go b/core/scripts/keystone/src/88_gen_jobspecs.go index 3dfebfcb158..e043e053b87 100644 --- a/core/scripts/keystone/src/88_gen_jobspecs.go +++ b/core/scripts/keystone/src/88_gen_jobspecs.go @@ -41,7 +41,7 @@ func genSpecs( bootstrapSpecLines, err := readLines(filepath.Join(templatesDir, bootstrapSpecTemplate)) helpers.PanicErr(err) - bootHost := nodes[0].remoteURL.Hostname() + bootHost := nodes[0].serviceName bootstrapSpecLines = replacePlaceholders( bootstrapSpecLines, chainID, p2pPort, diff --git a/core/scripts/keystone/src/99_crib_client.go b/core/scripts/keystone/src/99_crib_client.go index ebf9f9ee955..bf5e6a73bf8 100644 --- a/core/scripts/keystone/src/99_crib_client.go +++ b/core/scripts/keystone/src/99_crib_client.go @@ -13,11 +13,12 @@ type CribClient struct { } type CLNodeCredentials struct { - URL *url.URL - PodName string - Username string - Password string - NodePassword string + URL *url.URL + DeploymentName string + ServiceName string + Username string + Password string + NodePassword string } func NewCribClient() *CribClient { @@ -28,30 +29,30 @@ func NewCribClient() *CribClient { } func (m *CribClient) GetCLNodeCredentials() ([]CLNodeCredentials, error) { - fmt.Println("Getting CL node pods with config maps...") - pods, err := m.k8sClient.GetPodsWithConfigMap() + fmt.Println("Getting CL node deployments with config maps...") + deployments, err := m.k8sClient.GetDeploymentsWithConfigMap() if err != nil { return nil, err } clNodeCredentials := []CLNodeCredentials{} - for _, pod := range pods { - apiCredentials := pod.ConfigMap.Data["apicredentials"] + for _, deployment := range deployments { + apiCredentials := deployment.ConfigMap.Data["apicredentials"] splitCreds := strings.Split(strings.TrimSpace(apiCredentials), "\n") username := splitCreds[0] password := splitCreds[1] - nodePassword := pod.ConfigMap.Data["node-password"] - url, err := url.Parse("https://" + pod.Host) + nodePassword := deployment.ConfigMap.Data["node-password"] + url, err := url.Parse("https://" + deployment.Host) if err != nil { return nil, err } clNodeCredential := CLNodeCredentials{ - URL: url, - PodName: pod.Name, - Username: username, - Password: password, - NodePassword: nodePassword, + URL: url, + DeploymentName: deployment.Name, + Username: username, + Password: password, + NodePassword: nodePassword, } clNodeCredentials = append(clNodeCredentials, clNodeCredential) diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index 598d7527619..762b12716e8 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -83,9 +83,12 @@ func clNodesWithCredsToNodes(clNodesWithCreds []CLNodeCredentials) []*node { nodes := []*node{} for _, cl := range clNodesWithCreds { n := node{ - url: cl.URL, - password: cl.Password, - login: cl.Username, + url: cl.URL, + remoteURL: cl.URL, + serviceName: cl.ServiceName, + deploymentName: cl.DeploymentName, + password: cl.Password, + login: cl.Username, } nodes = append(nodes, &n) } diff --git a/core/scripts/keystone/src/99_k8s_client.go b/core/scripts/keystone/src/99_k8s_client.go index 55a0ac82bcb..00eed2ef0b7 100644 --- a/core/scripts/keystone/src/99_k8s_client.go +++ b/core/scripts/keystone/src/99_k8s_client.go @@ -7,6 +7,7 @@ import ( "sort" "strings" + apps "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" networkingV1 "k8s.io/api/networking/v1" metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -63,32 +64,33 @@ func MustNewK8sClient() *K8sClient { } } -type PodWithConfigMap struct { - v1.Pod +type DeploymentWithConfigMap struct { + apps.Deployment + ServiceName string ConfigMap v1.ConfigMap Host string } -func (m *K8sClient) GetPodsWithConfigMap() ([]PodWithConfigMap, error) { - pods, err := m.ListPods("app=app") +func (m *K8sClient) GetDeploymentsWithConfigMap() ([]DeploymentWithConfigMap, error) { + deployments, err := m.ListDeployments("app=app") if err != nil { return nil, err } - if len(pods.Items) == 0 { - return nil, fmt.Errorf("no chainlink node crib pods found, is your crib cluster deployed?") + if len(deployments.Items) == 0 { + return nil, fmt.Errorf("no deployments found, is your cluster deployed?") } - podsWithConfigMaps := []PodWithConfigMap{} + deploymentsWithConfigMaps := []DeploymentWithConfigMap{} ingressList, err := m.ListIngresses() if err != nil { return nil, err } if len(ingressList.Items) == 0 { - return nil, fmt.Errorf("no ingress found, is your crib cluster deployed?") + return nil, fmt.Errorf("no ingress found, is your cluster deployed?") } - for _, pod := range pods.Items { - for _, v := range pod.Spec.Volumes { + for _, deployment := range deployments.Items { + for _, v := range deployment.Spec.Template.Spec.Volumes { if v.ConfigMap == nil { continue } @@ -96,53 +98,48 @@ func (m *K8sClient) GetPodsWithConfigMap() ([]PodWithConfigMap, error) { if err != nil { return nil, err } - // - host: crib-henry-keystone-node2.main.stage.cldev.sh - // http: - // paths: - // - backend: - // service: - // name: app-node-2 - // port: - // number: 6688 - // path: /* - // pathType: ImplementationSpecific - instance := pod.Labels["instance"] + instance := deployment.Labels["instance"] var host string + var serviceName string for _, ingress := range ingressList.Items { for _, rule := range ingress.Spec.Rules { for _, path := range rule.HTTP.Paths { if strings.Contains(path.Backend.Service.Name, instance) { host = rule.Host + serviceName = path.Backend.Service.Name } } } } if host == "" { - return nil, fmt.Errorf("could not find host for pod %s", pod.Name) + return nil, fmt.Errorf("could not find host for deployment %s", deployment.Name) } - podWithConfigMap := PodWithConfigMap{ - Host: host, - Pod: pod, - ConfigMap: *cm, + deploymentWithConfigMap := DeploymentWithConfigMap{ + Host: host, + ServiceName: serviceName, + Deployment: deployment, + ConfigMap: *cm, } - podsWithConfigMaps = append(podsWithConfigMaps, podWithConfigMap) + deploymentsWithConfigMaps = append(deploymentsWithConfigMaps, deploymentWithConfigMap) } } - fmt.Printf("Found %d chainlink node crib pods\n", len(podsWithConfigMaps)) - return podsWithConfigMaps, nil + fmt.Printf("Found %d deployments with config maps\n", len(deploymentsWithConfigMaps)) + return deploymentsWithConfigMaps, nil } -// ListPods lists pods for a namespace and selector -func (m *K8sClient) ListPods(selector string) (*v1.PodList, error) { - pods, err := m.ClientSet.CoreV1().Pods(m.namespace).List(context.Background(), metaV1.ListOptions{LabelSelector: selector}) - sort.Slice(pods.Items, func(i, j int) bool { - return pods.Items[i].CreationTimestamp.Before(pods.Items[j].CreationTimestamp.DeepCopy()) +// ListDeployments lists deployments for a namespace +func (m *K8sClient) ListDeployments(selector string) (*apps.DeploymentList, error) { + deployments, err := m.ClientSet.AppsV1().Deployments(m.namespace).List(context.Background(), metaV1.ListOptions{LabelSelector: selector}) + if err != nil { + return nil, err + } + sort.Slice(deployments.Items, func(i, j int) bool { + return deployments.Items[i].CreationTimestamp.Before(deployments.Items[j].CreationTimestamp.DeepCopy()) }) - - return pods.DeepCopy(), err + return deployments.DeepCopy(), nil } // Get a config map diff --git a/core/scripts/keystone/src/99_nodes.go b/core/scripts/keystone/src/99_nodes.go index 83c5b1e84f5..234562280f1 100644 --- a/core/scripts/keystone/src/99_nodes.go +++ b/core/scripts/keystone/src/99_nodes.go @@ -10,10 +10,12 @@ import ( ) type node struct { - url *url.URL - remoteURL *url.URL - login string - password string + url *url.URL + remoteURL *url.URL + serviceName string + deploymentName string + login string + password string } func (n node) IsTerminal() bool { From e315b962737ed5c996cf516fc2ba0b7ec83193f2 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 16 Oct 2024 23:15:10 -0700 Subject: [PATCH 048/117] Overhaul node host + url handling --- .../keystone/src/06_deploy_workflows_cmd.go | 2 +- .../keystone/src/07_delete_workflows_cmd.go | 2 +- core/scripts/keystone/src/99_app.go | 4 +-- core/scripts/keystone/src/99_crib_client.go | 1 + core/scripts/keystone/src/99_fetch_keys.go | 4 +++ core/scripts/keystone/src/99_nodes.go | 34 +++++++++++++------ .../__snapshots__/88_gen_jobspecs_test.snap | 18 +++++----- .../keystone/src/testdata/NodeList.txt | 10 +++--- 8 files changed, 47 insertions(+), 28 deletions(-) diff --git a/core/scripts/keystone/src/06_deploy_workflows_cmd.go b/core/scripts/keystone/src/06_deploy_workflows_cmd.go index 0ca8e5d4a7b..5312d305b5c 100644 --- a/core/scripts/keystone/src/06_deploy_workflows_cmd.go +++ b/core/scripts/keystone/src/06_deploy_workflows_cmd.go @@ -49,7 +49,7 @@ func (g *deployWorkflows) Run(args []string) { } output := &bytes.Buffer{} client, app := newApp(n, output) - fmt.Println("Logging in:", n.url) + fmt.Println("Logging in:", n.remoteURL) loginFs := flag.NewFlagSet("test", flag.ContinueOnError) loginFs.Bool("bypass-version-check", true, "") loginCtx := cli.NewContext(app, loginFs, nil) diff --git a/core/scripts/keystone/src/07_delete_workflows_cmd.go b/core/scripts/keystone/src/07_delete_workflows_cmd.go index cccedaf9e70..2f5c639ad36 100644 --- a/core/scripts/keystone/src/07_delete_workflows_cmd.go +++ b/core/scripts/keystone/src/07_delete_workflows_cmd.go @@ -42,7 +42,7 @@ func (g *deleteWorkflows) Run(args []string) { output := &bytes.Buffer{} client, app := newApp(node, output) - fmt.Println("Logging in:", node.url) + fmt.Println("Logging in:", node.remoteURL) loginFs := flag.NewFlagSet("test", flag.ContinueOnError) loginFs.Bool("bypass-version-check", true, "") loginCtx := cli.NewContext(app, loginFs, nil) diff --git a/core/scripts/keystone/src/99_app.go b/core/scripts/keystone/src/99_app.go index 93b519603f7..40a36b732b4 100644 --- a/core/scripts/keystone/src/99_app.go +++ b/core/scripts/keystone/src/99_app.go @@ -43,7 +43,7 @@ func newApp(n *node, writer io.Writer) (*clcmd.Shell, *cli.App) { } app := clcmd.NewApp(client) fs := flag.NewFlagSet("blah", flag.ContinueOnError) - fs.String("remote-node-url", n.url.String(), "") + fs.String("remote-node-url", n.remoteURL.String(), "") fs.Bool("insecure-skip-verify", true, "") helpers.PanicErr(app.Before(cli.NewContext(nil, fs, nil))) // overwrite renderer since it's set to stdout after Before() is called @@ -70,7 +70,7 @@ func newNodeAPI(n *node) *nodeAPI { fs: flag.NewFlagSet("test", flag.ContinueOnError), } - fmt.Println("Logging in:", n.url) + fmt.Println("Logging in:", n.remoteURL) loginFs := flag.NewFlagSet("test", flag.ContinueOnError) loginFs.Bool("bypass-version-check", true, "") loginCtx := cli.NewContext(app, loginFs, nil) diff --git a/core/scripts/keystone/src/99_crib_client.go b/core/scripts/keystone/src/99_crib_client.go index bf5e6a73bf8..fbaadb7487d 100644 --- a/core/scripts/keystone/src/99_crib_client.go +++ b/core/scripts/keystone/src/99_crib_client.go @@ -49,6 +49,7 @@ func (m *CribClient) GetCLNodeCredentials() ([]CLNodeCredentials, error) { clNodeCredential := CLNodeCredentials{ URL: url, + ServiceName: deployment.ServiceName, DeploymentName: deployment.Name, Username: username, Password: password, diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index 762b12716e8..eef8d49192c 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -83,6 +83,10 @@ func clNodesWithCredsToNodes(clNodesWithCreds []CLNodeCredentials) []*node { nodes := []*node{} for _, cl := range clNodesWithCreds { n := node{ + // Both url and remoteURL are the same for crib + // since we're executing this script from outside of the crib ingress. + // We'd want to set these differently if this script has to be running either + // inside crib or outside crib. url: cl.URL, remoteURL: cl.URL, serviceName: cl.ServiceName, diff --git a/core/scripts/keystone/src/99_nodes.go b/core/scripts/keystone/src/99_nodes.go index 234562280f1..e74987d5519 100644 --- a/core/scripts/keystone/src/99_nodes.go +++ b/core/scripts/keystone/src/99_nodes.go @@ -34,7 +34,16 @@ func writeNodesList(path string, nodes []*node) error { fmt.Println("Writing nodes list to", path) var lines []string for _, n := range nodes { - lines = append(lines, fmt.Sprintf("%s %s %s %s", n.url.String(), n.url.String(), n.login, n.password)) + line := fmt.Sprintf( + "%s %s %s %s %s %s", + n.url.String(), + n.remoteURL.String(), + n.serviceName, + n.deploymentName, + n.login, + n.password, + ) + lines = append(lines, line) } return writeLines(lines, path) @@ -53,21 +62,26 @@ func mustReadNodesList(path string) []*node { continue } s := strings.Split(rr, " ") - if len(s) != 4 { - helpers.PanicErr(errors.New("wrong nodes list format")) + if len(s) != 6 { + helpers.PanicErr(errors.New("wrong nodes list format: expected 6 fields per line")) } if strings.Contains(s[0], "boot") && hasBoot { helpers.PanicErr(errors.New("the single boot node must come first")) } - hasBoot = true - url, err := url.Parse(s[0]) - remoteURL, err := url.Parse(s[1]) + if strings.Contains(s[0], "boot") { + hasBoot = true + } + parsedURL, err := url.Parse(s[0]) + helpers.PanicErr(err) + parsedRemoteURL, err := url.Parse(s[1]) helpers.PanicErr(err) nodes = append(nodes, &node{ - url: url, - remoteURL: remoteURL, - login: s[2], - password: s[3], + url: parsedURL, + remoteURL: parsedRemoteURL, + serviceName: s[2], + deploymentName: s[3], + login: s[4], + password: s[5], }) } return nodes diff --git a/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap b/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap index bf59eee1c36..d4ebf2fd227 100755 --- a/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap +++ b/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap @@ -1,7 +1,7 @@ [TestGenSpecs - 1] Bootstrap: -Host: crib-henry-keystone-node1.main.stage.cldev.sh +Host: app-node1 type = "bootstrap" schemaVersion = 1 name = "Keystone boot" @@ -14,14 +14,14 @@ providerType = "ocr3-capability" Oracles: Oracle 0: -Host: crib-henry-keystone-node2.main.stage.cldev.sh +Host: crib-local-node2.local type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" ocrKeyBundleID = "0332308cdef793a3892f5fa70b1c3d42efe69054b6da2bb77e6b696e5fa351cd" p2pv2Bootstrappers = [ - "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@crib-henry-keystone-node1.main.stage.cldev.sh:6690", + "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6690", ] relay = "evm" pluginType = "plugin" @@ -45,14 +45,14 @@ aptos = "a8991d329d512dd97fc7ebc94e92fb6f4407285b8235a469efbf3d9df8de5544" -------------------------------- Oracle 1: -Host: crib-henry-keystone-node3.main.stage.cldev.sh +Host: crib-local-node3.local type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" ocrKeyBundleID = "18b264b12430cf7f706b95e6323b10abc5225cac0ebceb60d1312dae3359b4c9" p2pv2Bootstrappers = [ - "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@crib-henry-keystone-node1.main.stage.cldev.sh:6690", + "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6690", ] relay = "evm" pluginType = "plugin" @@ -76,14 +76,14 @@ aptos = "378e3e6cc29171c29a98f977ff3d3b1cd0e7175a9d855f8106143bc23a577b19" -------------------------------- Oracle 2: -Host: crib-henry-keystone-node4.main.stage.cldev.sh +Host: crib-local-node4.local type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" ocrKeyBundleID = "6cee0022d1a0b307f73b3eac9a1d69b23db1deba30bfc8f53ab293523bbd6400" p2pv2Bootstrappers = [ - "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@crib-henry-keystone-node1.main.stage.cldev.sh:6690", + "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6690", ] relay = "evm" pluginType = "plugin" @@ -107,14 +107,14 @@ aptos = "8c8257b4838193409bd96bf9168c60ecc1e217363af9312d5c0db26b181f9e6f" -------------------------------- Oracle 3: -Host: crib-henry-keystone-node5.main.stage.cldev.sh +Host: crib-local-node5.local type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" ocrKeyBundleID = "0a7aecb6b694fbcd71cbd1932238d5fd9442fd3477916cdb0519ab2408d21b2b" p2pv2Bootstrappers = [ - "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@crib-henry-keystone-node1.main.stage.cldev.sh:6690", + "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6690", ] relay = "evm" pluginType = "plugin" diff --git a/core/scripts/keystone/src/testdata/NodeList.txt b/core/scripts/keystone/src/testdata/NodeList.txt index 6fb65dded69..7fffff4f506 100644 --- a/core/scripts/keystone/src/testdata/NodeList.txt +++ b/core/scripts/keystone/src/testdata/NodeList.txt @@ -1,5 +1,5 @@ -https://local-node1 https://crib-henry-keystone-node1.main.stage.cldev.sh notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://local-node2 https://crib-henry-keystone-node2.main.stage.cldev.sh notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://local-node3 https://crib-henry-keystone-node3.main.stage.cldev.sh notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://local-node4 https://crib-henry-keystone-node4.main.stage.cldev.sh notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://local-node5 https://crib-henry-keystone-node5.main.stage.cldev.sh notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-node1.local https://crib-local-node1.local app-node1 app-node1-bootstrap notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-node2.local https://crib-local-node2.local app-node2 app-node2 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-node3.local https://crib-local-node3.local app-node3 app-node3 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-node4.local https://crib-local-node4.local app-node4 app-node4 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-node5.local https://crib-local-node5.local app-node5 app-node5 notreal@fakeemail.ch fj293fbBnlQ!f9vNs From 171a95309c2215e349773ffa1746164ef2aead71 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 16 Oct 2024 23:21:19 -0700 Subject: [PATCH 049/117] Add dummy encryption public key to nodes --- core/scripts/keystone/src/88_capabilities_registry.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/scripts/keystone/src/88_capabilities_registry.go b/core/scripts/keystone/src/88_capabilities_registry.go index aeb129ff7a1..5e4aeb6bc4f 100644 --- a/core/scripts/keystone/src/88_capabilities_registry.go +++ b/core/scripts/keystone/src/88_capabilities_registry.go @@ -140,7 +140,7 @@ func (c *CapabilityRegistryProvisioner) AddNodeOperator(ctx context.Context, nop // there is a DON servicing it. This is done via `AddDON`. func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop *NodeOperator, capSet CapabilitySet) { params := []kcr.CapabilitiesRegistryNodeParams{} - for _, peer := range nop.DON { + for i, peer := range nop.DON { node, innerErr := peerToNode(nop.id, peer) if innerErr != nil { panic(innerErr) @@ -149,7 +149,7 @@ func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop *NodeO // Technically we could be more flexible here, // where we can have different capset assignment for each node node.HashedCapabilityIds = capSet.CapabilityIDs(c.reg) - + node.EncryptionPublicKey = [32]byte{2: byte(i + 1)} params = append(params, node) } @@ -510,7 +510,6 @@ func peerToNode(nopID uint32, p peer) (kcr.CapabilitiesRegistryNodeParams, error }, nil } - // newCapabilityConfig returns a new capability config with the default config set as empty. // Override the empty default config with functional options. func newCapabilityConfig(opts ...func(*values.Map)) *capabilitiespb.CapabilityConfig { From 20a1c7e3bd0b0fbcf2e1ee1e65e79f914981666c Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 16 Oct 2024 23:21:33 -0700 Subject: [PATCH 050/117] Add missing ctx --- .../scripts/keystone/src/03_deploy_streams_trigger_cmd.go | 8 +++++--- core/services/relay/evm/mercury/transmitter.go | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index d9080266aab..28dfbe6d859 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -558,6 +558,7 @@ func doesBridgeExist(api *nodeAPI, name string) bool { } func generateMercuryOCR2Config(nca []NodeKeys) MercuryOCR2Config { + ctx := context.Background() f := uint8(1) rawOnchainConfig := mercurytypes.OnchainConfig{ Min: big.NewInt(0), @@ -570,7 +571,7 @@ func generateMercuryOCR2Config(nca []NodeKeys) MercuryOCR2Config { BaseUSDFee: decimal.NewFromInt(0), } - onchainConfig, err := (datastreamsmercury.StandardOnchainConfigCodec{}).Encode(rawOnchainConfig) + onchainConfig, err := (datastreamsmercury.StandardOnchainConfigCodec{}).Encode(ctx, rawOnchainConfig) helpers.PanicErr(err) reportingPluginConfig, err := json.Marshal(rawReportingPluginConfig) helpers.PanicErr(err) @@ -621,8 +622,9 @@ func generateMercuryOCR2Config(nca []NodeKeys) MercuryOCR2Config { []int{len(identities)}, // S identities, reportingPluginConfig, // reportingPluginConfig []byte, - 250*time.Millisecond, // Max duration observation - int(f), // f + nil, + 250*time.Millisecond, // Max duration observation + int(f), // f onchainConfig, ) signerAddresses, err := evm.OnchainPublicKeyToAddress(signers) diff --git a/core/services/relay/evm/mercury/transmitter.go b/core/services/relay/evm/mercury/transmitter.go index 4e57a3d07cf..f5318fa91c1 100644 --- a/core/services/relay/evm/mercury/transmitter.go +++ b/core/services/relay/evm/mercury/transmitter.go @@ -394,7 +394,7 @@ func (mt *mercuryTransmitter) HealthReport() map[string]error { return report } -func (mt *mercuryTransmitter) sendToTrigger(report ocrtypes.Report, rawReportCtx [3][32]byte, signatures []ocrtypes.AttributedOnchainSignature) error { +func (mt *mercuryTransmitter) sendToTrigger(ctx context.Context, report ocrtypes.Report, rawReportCtx [3][32]byte, signatures []ocrtypes.AttributedOnchainSignature) error { rawSignatures := [][]byte{} for _, sig := range signatures { rawSignatures = append(rawSignatures, sig.Signature) @@ -421,7 +421,7 @@ func (mt *mercuryTransmitter) Transmit(ctx context.Context, reportCtx ocrtypes.R rawReportCtx := evmutil.RawReportContext(reportCtx) if mt.triggerCapability != nil { // Acting as a Capability - send report to trigger service and exit. - return mt.sendToTrigger(report, rawReportCtx, signatures) + return mt.sendToTrigger(ctx, report, rawReportCtx, signatures) } var rs [][32]byte From 1fd4abd175e23d9170fd46aa165c0975de1fbada Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Fri, 18 Oct 2024 13:32:39 -0700 Subject: [PATCH 051/117] Initial multidon support --- core/scripts/keystone/main.go | 3 +- .../keystone/src/01_deploy_contracts_cmd.go | 5 +- .../keystone/src/02_deploy_jobspecs_cmd.go | 5 +- .../src/03_deploy_streams_trigger_cmd.go | 17 +- .../src/03_gen_crib_cluster_overrides_cmd.go | 329 +++++++++++++++--- .../03_gen_crib_cluster_overrides_cmd_test.go | 41 ++- .../keystone/src/04_delete_ocr3_jobs_cmd.go | 3 +- .../keystone/src/06_deploy_workflows_cmd.go | 6 +- .../src/06_provision_capabilities_registry.go | 66 ++-- .../keystone/src/07_delete_workflows_cmd.go | 3 +- .../keystone/src/88_capabilities_registry.go | 112 +++--- core/scripts/keystone/src/88_gen_jobspecs.go | 11 +- .../keystone/src/88_gen_jobspecs_test.go | 2 +- .../keystone/src/88_gen_ocr3_config.go | 6 +- .../keystone/src/88_gen_ocr3_config_test.go | 2 +- core/scripts/keystone/src/99_fetch_keys.go | 214 +++++++++--- core/scripts/keystone/src/99_k8s_client.go | 4 +- ...3_gen_crib_cluster_overrides_cmd_test.snap | 237 ++++++++----- .../keystone/src/testdata/NodeList.txt | 11 +- .../keystone/src/testdata/PublicKeys.json | 30 ++ .../keystone/templates/crib-overrides.yaml | 100 ------ 21 files changed, 807 insertions(+), 400 deletions(-) delete mode 100644 core/scripts/keystone/templates/crib-overrides.yaml diff --git a/core/scripts/keystone/main.go b/core/scripts/keystone/main.go index 2d56494a325..0ff26859171 100644 --- a/core/scripts/keystone/main.go +++ b/core/scripts/keystone/main.go @@ -17,7 +17,8 @@ func main() { commands := []command{ src.NewDeployContractsCommand(), src.NewDeployJobSpecsCommand(), - src.NewGenerateCribClusterOverridesCommand(), + src.NewGenerateCribClusterOverridesPreprovisionCommand(), + src.NewGenerateCribClusterOverridesPostprovisionCommand(), src.NewDeleteJobsCommand(), src.NewDeployAndInitializeCapabilitiesRegistryCommand(), src.NewDeployWorkflowsCommand(), diff --git a/core/scripts/keystone/src/01_deploy_contracts_cmd.go b/core/scripts/keystone/src/01_deploy_contracts_cmd.go index 0d3f89f4637..fdfa263cdfe 100644 --- a/core/scripts/keystone/src/01_deploy_contracts_cmd.go +++ b/core/scripts/keystone/src/01_deploy_contracts_cmd.go @@ -57,6 +57,7 @@ func (g *deployContracts) Run(args []string) { publicKeys := fs.String("publickeys", "", "Custom public keys json location") nodeList := fs.String("nodes", "", "Custom node list location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") + nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") err := fs.Parse(args) @@ -83,7 +84,7 @@ func (g *deployContracts) Run(args []string) { os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) os.Setenv("ACCOUNT_KEY", *accountKey) os.Setenv("INSECURE_SKIP_VERIFY", "true") - deploy(*nodeList, *publicKeys, *ocrConfigFile, *skipFunding, *dryRun, *onlySetConfig, *artefactsDir) + deploy(*nodeList, *publicKeys, *ocrConfigFile, *skipFunding, *dryRun, *onlySetConfig, *artefactsDir, *nodeSetSize) } // deploy does the following: @@ -100,6 +101,7 @@ func deploy( dryRun bool, onlySetConfig bool, artefacts string, + nodeSetSize int, ) { env := helpers.SetupEnv(false) ocrConfig := generateOCR3Config( @@ -107,6 +109,7 @@ func deploy( configFile, env.ChainID, publicKeys, + nodeSetSize, ) if dryRun { diff --git a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go index 76298dc1932..6cdf00614f0 100644 --- a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go +++ b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go @@ -8,6 +8,7 @@ import ( helpers "github.com/smartcontractkit/chainlink/core/scripts/common" ) + // Could be useful https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/scripts/chaincli/handler/scrape_node_config.go#L102 type deployJobSpecs struct{} @@ -28,6 +29,7 @@ func (g *deployJobSpecs) Run(args []string) { nodeList := fs.String("nodes", "", "Custom node list location") publicKeys := fs.String("publickeys", "", "Custom public keys json location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") + nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") err := fs.Parse(args) if err != nil || chainID == nil || *chainID == 0 || p2pPort == nil || *p2pPort == 0 || onlyReplay == nil { @@ -53,7 +55,7 @@ func (g *deployJobSpecs) Run(args []string) { *templatesLocation = "templates" } - nodes := downloadNodeAPICredentials(*nodeList) + nodes := downloadKeylessNodeSets(*nodeList, *nodeSetSize).Workflow.Nodes deployedContracts, err := LoadDeployedContracts(*artefactsDir) PanicErr(err) @@ -62,6 +64,7 @@ func (g *deployJobSpecs) Run(args []string) { *nodeList, *templatesLocation, *chainID, *p2pPort, deployedContracts.OCRContract.Hex(), + *nodeSetSize, ) flattenedSpecs := []hostSpec{jobspecs.bootstrap} flattenedSpecs = append(flattenedSpecs, jobspecs.oracles...) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 28dfbe6d859..4db448019d4 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -104,6 +104,7 @@ func (g *deployStreamsTrigger) Run(args []string) { nodeList := fs.String("nodes", "", "Custom node list location") publicKeys := fs.String("publickeys", "", "Custom public keys json location") force := fs.Bool("force", false, "Force deployment") + nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") accountKey := fs.String("accountkey", "", "private key of the account to deploy from") @@ -138,12 +139,13 @@ func (g *deployStreamsTrigger) Run(args []string) { *ocrConfigFile, *chainID, *publicKeys, + *nodeSetSize, *force, ) } // See /core/services/ocr2/plugins/mercury/integration_test.go -func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFilePath string, chainId int64, pubKeysPath string, force bool) { +func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFilePath string, chainId int64, pubKeysPath string, nodeSetSize int, force bool) { fmt.Printf("Deploying streams trigger for chain %d\n", chainId) fmt.Printf("Using OCR config file: %s\n", ocrConfigFilePath) fmt.Printf("Using node list: %s\n", nodeListPath) @@ -152,14 +154,11 @@ func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFile fmt.Printf("Deploying Mercury V0.3 contracts\n") _, _, _, verifier := deployMercuryV03Contracts(env) - // the 0th index is for the OCR3 capability - // where the 1st index is for the mercury OCR2 instance - kbIndex := 1 - nca := downloadNodePubKeys(nodeListPath, chainId, pubKeysPath, kbIndex) - nodes := downloadNodeAPICredentials(nodeListPath) + + nodeSets := downloadNodeSets(nodeListPath, chainId, pubKeysPath, nodeSetSize) fmt.Printf("Generating OCR3 config\n") - ocrConfig := generateMercuryOCR2Config(nca) + ocrConfig := generateMercuryOCR2Config(nodeSets.StreamsTrigger.NodeKeys) for _, feed := range feeds { fmt.Println("Configuring feeds...") @@ -188,7 +187,7 @@ func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFile PanicErr(err) fmt.Printf("Deploying OCR2 job specs for feed %s\n", feed.name) - deployOCR2JobSpecsForFeed(nca, nodes, verifier, feed, chainId, force) + deployOCR2JobSpecsForFeed(nodeSets.StreamsTrigger.NodeKeys, nodeSets.StreamsTrigger.Nodes, verifier, feed, chainId, force) } fmt.Println("Finished deploying streams trigger") @@ -209,7 +208,7 @@ func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFile TargetAddress: "0x1234567890abcdef1234567890abcdef12345678", } jobSpecStr := createKeystoneWorkflowJob(workflowConfig) - for _, n := range nodes { + for _, n := range nodeSets.StreamsTrigger.Nodes { api := newNodeAPI(n) upsertJob(api, workflowConfig.JobSpecName, jobSpecStr, force) diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go index 149e7fafe71..196a3189132 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go @@ -5,30 +5,199 @@ import ( "fmt" "os" "path/filepath" - "strings" + + ocrcommontypes "github.com/smartcontractkit/libocr/commontypes" + "gopkg.in/yaml.v3" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" + "github.com/smartcontractkit/chainlink/v2/core/config/toml" + "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" ) -type generateCribClusterOverrides struct{} +type generateCribClusterOverridesPreprovision struct{} +type generateCribClusterOverridesPostprovision struct{} + +func NewGenerateCribClusterOverridesPreprovisionCommand() *generateCribClusterOverridesPreprovision { + return &generateCribClusterOverridesPreprovision{} +} + +func NewGenerateCribClusterOverridesPostprovisionCommand() *generateCribClusterOverridesPostprovision { + return &generateCribClusterOverridesPostprovision{} +} + +type Helm struct { + Helm Chart `yaml:"helm"` +} + +type Chart struct { + HelmValues HelmValues `yaml:"values"` +} + +type HelmValues struct { + Chainlink Chainlink `yaml:"chainlink,omitempty"` + Ingress Ingress `yaml:"ingress,omitempty"` +} + +type Ingress struct { + Hosts []Host `yaml:"hosts,omitempty"` +} + +type Host struct { + Host string `yaml:"host,omitempty"` + HTTP HTTP `yaml:"http,omitempty"` +} + +type HTTP struct { + Paths []Path `yaml:"paths,omitempty"` +} + +type Path struct { + Path string `yaml:"path,omitempty"` + Backend Backend `yaml:"backend,omitempty"` +} + +type Backend struct { + Service Service `yaml:"service,omitempty"` +} + +type Service struct { + Name string `yaml:"name,omitempty"` + Port Port `yaml:"port,omitempty"` +} + +type Port struct { + Number int `yaml:"number,omitempty"` +} + +type Chainlink struct { + Nodes map[string]Node `yaml:"nodes,omitempty"` +} + +type Node struct { + Image string `yaml:"image,omitempty"` + OverridesToml string `yaml:"overridesToml,omitempty"` +} + +func (g *generateCribClusterOverridesPreprovision) Name() string { + return "crib-config-preprovision" +} + +func (g *generateCribClusterOverridesPreprovision) Run(args []string) { + fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) + nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") + outputPath := fs.String("outpath", "-", "the path to output the generated overrides (use '-' for stdout)") + + err := fs.Parse(args) + if err != nil || outputPath == nil || *outputPath == "" { + fs.Usage() + os.Exit(1) + } + + chart := generatePreprovisionConfig(*nodeSetSize) + + yamlData, err := yaml.Marshal(chart) + helpers.PanicErr(err) + + if *outputPath == "-" { + _, err = os.Stdout.Write(yamlData) + helpers.PanicErr(err) + } else { + err = os.WriteFile(filepath.Join(*outputPath, "crib-preprovision.yaml"), yamlData, 0600) + helpers.PanicErr(err) + } +} + +func generatePreprovisionConfig(nodeSetSize int) Helm { + nodeSets := []string{"ks-wf-", "ks-str-trig-"} + nodes := make(map[string]Node) + var hosts []Host -func NewGenerateCribClusterOverridesCommand() *generateCribClusterOverrides { - return &generateCribClusterOverrides{} + for _, prefix := range nodeSets { + // Bootstrap node + btNodeName := fmt.Sprintf("%sbt-node1", prefix) + nodes[btNodeName] = Node{ + Image: "${runtime.images.app}", + } + host := Host{ + Host: fmt.Sprintf("${DEVSPACE_NAMESPACE}-%s.${DEVSPACE_INGRESS_BASE_DOMAIN}", btNodeName), + HTTP: HTTP{ + Paths: []Path{ + { + Path: "/", + Backend: Backend{ + Service: Service{ + Name: fmt.Sprintf("app-%s", btNodeName), + Port: Port{ + Number: 6688, + }, + }, + }, + }, + }, + }, + } + hosts = append(hosts, host) + + // Other nodes + for i := 2; i <= nodeSetSize; i++ { + nodeName := fmt.Sprintf("%snode%d", prefix, i) + nodes[nodeName] = Node{ + Image: "${runtime.images.app}", + } + host := Host{ + Host: fmt.Sprintf("${DEVSPACE_NAMESPACE}-%s.${DEVSPACE_INGRESS_BASE_DOMAIN}", nodeName), + HTTP: HTTP{ + Paths: []Path{ + { + Path: "/", + Backend: Backend{ + Service: Service{ + Name: fmt.Sprintf("app-%s", nodeName), + Port: Port{ + Number: 6688, + }, + }, + }, + }, + }, + }, + } + hosts = append(hosts, host) + } + } + + helm := Helm{ + Chart{ + HelmValues: HelmValues{ + Chainlink: Chainlink{ + Nodes: nodes, + }, + Ingress: Ingress{ + Hosts: hosts, + }, + }, + }, + } + + return helm } -func (g *generateCribClusterOverrides) Name() string { - return "generate-crib" +func (g *generateCribClusterOverridesPostprovision) Name() string { + return "crib-config-postprovision" } -func (g *generateCribClusterOverrides) Run(args []string) { +func (g *generateCribClusterOverridesPostprovision) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) chainID := fs.Int64("chainid", 1337, "chain id") - outputPath := fs.String("outpath", "../crib", "the path to output the generated overrides") + outputPath := fs.String("outpath", "-", "the path to output the generated overrides (use '-' for stdout)") + nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") publicKeys := fs.String("publickeys", "", "Custom public keys json location") nodeList := fs.String("nodes", "", "Custom node list location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") - templatesDir := "templates" err := fs.Parse(args) if err != nil || outputPath == nil || *outputPath == "" || chainID == nil || *chainID == 0 { fs.Usage() @@ -45,48 +214,130 @@ func (g *generateCribClusterOverrides) Run(args []string) { *nodeList = defaultNodeList } - deployedContracts, err := LoadDeployedContracts(*artefactsDir) + contracts, err := LoadDeployedContracts(*artefactsDir) helpers.PanicErr(err) - lines := generateCribConfig(*nodeList, *publicKeys, chainID, templatesDir, deployedContracts.ForwarderContract.Hex(), deployedContracts.CapabilityRegistry.Hex()) + chart := generatePostprovisionConfig(nodeList, chainID, publicKeys, contracts, *nodeSetSize) - cribOverridesStr := strings.Join(lines, "\n") - err = os.WriteFile(filepath.Join(*outputPath, "crib-cluster-overrides.yaml"), []byte(cribOverridesStr), 0600) + yamlData, err := yaml.Marshal(chart) helpers.PanicErr(err) + + if *outputPath == "-" { + _, err = os.Stdout.Write(yamlData) + helpers.PanicErr(err) + } else { + err = os.WriteFile(filepath.Join(*outputPath, "crib-postprovision.yaml"), yamlData, 0600) + helpers.PanicErr(err) + } } -func generateCribConfig(nodeList string, pubKeysPath string, chainID *int64, templatesDir string, forwarderAddress string, externalRegistryAddress string) []string { - nca := downloadNodePubKeys(nodeList, *chainID, pubKeysPath) - nodeAddresses := []string{} - capabilitiesBootstrapper := fmt.Sprintf("%s@%s:%s", nca[0].P2PPeerID, "app-node1", "6691") +func generatePostprovisionConfig(nodeList *string, chainID *int64, publicKeys *string, contracts deployedContracts, nodeSetSize int) Helm { + nodeSets := downloadNodeSets(*nodeList, *chainID, *publicKeys, nodeSetSize) - for _, node := range nca[1:] { - nodeAddresses = append(nodeAddresses, node.EthAddress) - } + // Prepare to build the chart + nodes := make(map[string]Node) - lines, err := readLines(filepath.Join(templatesDir, cribOverrideTemplate)) + // Prepare the bootstrapper locator from the workflow NodeSet + workflowBtNodeName := fmt.Sprintf("%sbt-node1", nodeSets.Workflow.Prefix) + workflowBtNodeKey := nodeSets.Workflow.NodeKeys[0] // First node key as bootstrapper + wfBt, err := ocrcommontypes.NewBootstrapperLocator(workflowBtNodeKey.P2PPeerID, []string{fmt.Sprintf("%s:6691", workflowBtNodeName)}) helpers.PanicErr(err) - lines = replaceCribPlaceholders(lines, forwarderAddress, nodeAddresses, externalRegistryAddress, capabilitiesBootstrapper) - return lines + + // Build nodes for each NodeSet + for _, nodeSet := range []NodeSet{nodeSets.Workflow, nodeSets.StreamsTrigger} { + // Bootstrap node + btNodeName := fmt.Sprintf("%sbt-node1", nodeSet.Prefix) + overridesToml := generateOverridesToml( + *chainID, + contracts.CapabilityRegistry.Hex(), + "", + "", + nil, + ) + nodes[btNodeName] = Node{ + Image: "${runtime.images.app}", + OverridesToml: overridesToml, + } + + // Other nodes + for i, nodeKey := range nodeSet.NodeKeys[1:] { // Start from second key + nodeName := fmt.Sprintf("%snode%d", nodeSet.Prefix, i+2) // +2 because numbering starts from 2 + + // Use the workflow bootstrapper locator for all nodes + overridesToml := generateOverridesToml( + *chainID, + contracts.CapabilityRegistry.Hex(), + nodeKey.EthAddress, + contracts.ForwarderContract.Hex(), + wfBt, + ) + nodes[nodeName] = Node{ + Image: "${runtime.images.app}", + OverridesToml: overridesToml, + } + } + } + + helm := Helm{ + Chart{ + HelmValues: HelmValues{ + Chainlink: Chainlink{ + Nodes: nodes, + }, + }, + }, + } + + return helm } -func replaceCribPlaceholders( - lines []string, - forwarderAddress string, - nodeFromAddresses []string, +func generateOverridesToml( + chainID int64, externalRegistryAddress string, - capabilitiesBootstrapper string, -) (output []string) { - for _, l := range lines { - l = strings.Replace(l, "{{ forwarder_address }}", forwarderAddress, 1) - l = strings.Replace(l, "{{ node_2_address }}", nodeFromAddresses[0], 1) - l = strings.Replace(l, "{{ node_3_address }}", nodeFromAddresses[1], 1) - l = strings.Replace(l, "{{ node_4_address }}", nodeFromAddresses[2], 1) - l = strings.Replace(l, "{{ node_5_address }}", nodeFromAddresses[3], 1) - l = strings.Replace(l, "{{ external_registry_address }}", externalRegistryAddress, 1) - l = strings.Replace(l, "{{ capabilities_bootstrapper }}", capabilitiesBootstrapper, 1) - output = append(output, l) + fromAddress string, + forwarderAddress string, + capabilitiesBootstrapper *ocrcommontypes.BootstrapperLocator, +) string { + evmConfig := &evmcfg.EVMConfig{ + ChainID: big.NewI(chainID), + Nodes: nil, // We have the rpc nodes set globally + } + + conf := chainlink.Config{ + Core: toml.Core{ + Capabilities: toml.Capabilities{ + ExternalRegistry: toml.ExternalRegistry{ + Address: ptr(externalRegistryAddress), + NetworkID: ptr("evm"), + ChainID: ptr(fmt.Sprintf("%d", chainID)), + }, + Peering: toml.P2P{ + V2: toml.P2PV2{ + Enabled: ptr(true), + ListenAddresses: ptr([]string{"0.0.0.0:6691"}), + }, + }, + }, + }, } - return output + if capabilitiesBootstrapper != nil { + conf.Core.Capabilities.Peering.V2.DefaultBootstrappers = ptr([]ocrcommontypes.BootstrapperLocator{*capabilitiesBootstrapper}) + + evmConfig.Workflow = evmcfg.Workflow{ + FromAddress: ptr(evmtypes.MustEIP55Address(fromAddress)), + ForwarderAddress: ptr(evmtypes.MustEIP55Address(forwarderAddress)), + } + } + + conf.EVM = evmcfg.EVMConfigs{ + evmConfig, + } + + confStr, err := conf.TOMLString() + helpers.PanicErr(err) + + return confStr } + +func ptr[T any](t T) *T { return &t } diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go index 5ab1ee4975d..3155eb38230 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go @@ -5,16 +5,45 @@ import ( "testing" "github.com/gkampitakis/go-snaps/snaps" + "gopkg.in/yaml.v3" ) -func TestGenerateCribConfig(t *testing.T) { +func TestGeneratePostprovisionConfig(t *testing.T) { chainID := int64(1337) - templatesDir := "../templates" - forwarderAddress := "0x1234567890abcdef" - externalRegistryAddress := "0xabcdef1234567890" publicKeysPath := "./testdata/PublicKeys.json" - lines := generateCribConfig(defaultNodeList, publicKeysPath, &chainID, templatesDir, forwarderAddress, externalRegistryAddress) + defaultNodeListStr := defaultNodeList + publicKeysPathStr := publicKeysPath + contracts := deployedContracts{ + OCRContract: [20]byte{0: 1}, + ForwarderContract: [20]byte{0: 2}, + CapabilityRegistry: [20]byte{0: 3}, + SetConfigTxBlock: 0, + } - snaps.MatchSnapshot(t, strings.Join(lines, "\n")) + nodeSetSize := 2 + + chart := generatePostprovisionConfig(&defaultNodeListStr, &chainID, &publicKeysPathStr, contracts, nodeSetSize) + + yamlData, err := yaml.Marshal(chart) + if err != nil { + t.Fatalf("Failed to marshal chart: %v", err) + } + + linesStr := strings.Split(string(yamlData), "\n") + snaps.MatchSnapshot(t, strings.Join(linesStr, "\n")) +} + +func TestGeneratePreprovisionConfig(t *testing.T) { + nodeSetSize := 2 + + chart := generatePreprovisionConfig(nodeSetSize) + + yamlData, err := yaml.Marshal(chart) + if err != nil { + t.Fatalf("Failed to marshal chart: %v", err) + } + + linesStr := strings.Split(string(yamlData), "\n") + snaps.MatchSnapshot(t, strings.Join(linesStr, "\n")) } diff --git a/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go b/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go index 7b8b3b6abb1..e74081d3a77 100644 --- a/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go +++ b/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go @@ -43,6 +43,7 @@ func (g *deleteJobs) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) nodeList := fs.String("nodes", "", "Custom node list location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") + nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") err := fs.Parse(args) if err != nil { @@ -62,7 +63,7 @@ func (g *deleteJobs) Run(args []string) { fmt.Println("Error loading deployed contracts, skipping:", err) return } - nodes := downloadNodeAPICredentials(*nodeList) + nodes := downloadKeylessNodeSets(*nodeList, *nodeSetSize).Workflow.Nodes for _, node := range nodes { api := newNodeAPI(node) diff --git a/core/scripts/keystone/src/06_deploy_workflows_cmd.go b/core/scripts/keystone/src/06_deploy_workflows_cmd.go index 5312d305b5c..6581d5a4e73 100644 --- a/core/scripts/keystone/src/06_deploy_workflows_cmd.go +++ b/core/scripts/keystone/src/06_deploy_workflows_cmd.go @@ -26,8 +26,9 @@ func (g *deployWorkflows) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) workflowFile := fs.String("workflow", "workflow.yml", "path to workflow file") nodeList := fs.String("nodes", "", "Custom node list location") + nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") err := fs.Parse(args) - if err != nil || workflowFile == nil || *workflowFile == "" { + if err != nil || workflowFile == nil || *workflowFile == "" || nodeSetSize == nil || *nodeSetSize == 0 { fs.Usage() os.Exit(1) } @@ -36,8 +37,7 @@ func (g *deployWorkflows) Run(args []string) { } fmt.Println("Deploying workflows") - // use a separate list - nodes := downloadNodeAPICredentials(*nodeList) + nodes := downloadKeylessNodeSets(*nodeList, *nodeSetSize).Workflow.Nodes if _, err = os.Stat(*workflowFile); err != nil { PanicErr(errors.New("toml file does not exist")) diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go index f33445aa8cf..714329b3a1e 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -26,14 +26,13 @@ func (c *provisionCR) Run(args []string) { ctx := context.Background() fs := flag.NewFlagSet(c.Name(), flag.ExitOnError) - // create flags for all of the env vars then set the env vars to normalize the interface - // this is a bit of a hack but it's the easiest way to make this work ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") - chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") - accountKey := fs.String("accountkey", "", "private key of the account to deploy from") - publicKeys := fs.String("publickeys", "", "Custom public keys json location") + chainID := fs.Int64("chainid", 1337, "Chain ID of the Ethereum network to deploy to") + accountKey := fs.String("accountkey", "", "Private key of the account to deploy from") + publicKeys := fs.String("publickeys", "", "Custom public keys JSON location") nodeList := fs.String("nodes", "", "Custom node list location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") + nodeSetSize := fs.Int("nodeSetSize", 4, "Number of nodes in a nodeset") err := fs.Parse(args) if err != nil || @@ -63,46 +62,65 @@ func (c *provisionCR) Run(args []string) { reg := getOrDeployCapabilitiesRegistry(ctx, *artefactsDir, env) - // For now, trigger, target, and workflow DONs are the same node sets, and same don instance - workflowDON := loadDON( + nodeSets := downloadNodeSets( *publicKeys, *chainID, *nodeList, + *nodeSetSize, ) + crProvisioner := NewCapabilityRegistryProvisioner(reg, env) - // We're using the default capability set for now - capSet := NewCapabilitySet() - crProvisioner.AddCapabilities(ctx, capSet) - nodeOperator := NewNodeOperator(env.Owner.From, "MY_NODE_OPERATOR", workflowDON) + streamsTriggerCapSet := NewCapabilitySet( + NewStreamsTriggerV1Capability(), + ) + workflowCapSet := NewCapabilitySet( + NewOCR3V1ConsensusCapability(), + NewEthereumGethTestnetV1WriteCapability(), + ) + crProvisioner.AddCapabilities(ctx, streamsTriggerCapSet) + crProvisioner.AddCapabilities(ctx, workflowCapSet) + + workflowDON := nodeKeysToDON(nodeSets.Workflow.Name, nodeSets.Workflow.NodeKeys, workflowCapSet) + streamsTriggerDON := nodeKeysToDON(nodeSets.StreamsTrigger.Name, nodeSets.StreamsTrigger.NodeKeys, streamsTriggerCapSet) + + dons := map[string]DON{ + workflowDON.Name: workflowDON, + streamsTriggerDON.Name: streamsTriggerDON, + } + + nodeOperator := NewNodeOperator(env.Owner.From, "MY_NODE_OPERATOR", dons) crProvisioner.AddNodeOperator(ctx, nodeOperator) - // Note that both of these calls are simplified versions of the actual calls - // - // See the method documentation for more details - crProvisioner.AddNodes(ctx, nodeOperator, capSet) - crProvisioner.AddDON(ctx, nodeOperator, capSet, false, true) -} + // technically we could do a single addnodes call here if we merged all the nodes together + crProvisioner.AddNodes(ctx, nodeOperator, nodeSets.Workflow.Name) + crProvisioner.AddNodes(ctx, nodeOperator, nodeSets.StreamsTrigger.Name) -func loadDON(publicKeys string, chainID int64, nodeList string) []peer { - nca := downloadNodePubKeys(nodeList, chainID, publicKeys) - workflowDON := []peer{} - for _, n := range nca { + crProvisioner.AddDON(ctx, nodeOperator, nodeSets.Workflow.Name, false, true) + crProvisioner.AddDON(ctx, nodeOperator, nodeSets.StreamsTrigger.Name, true, false) +} +// nodeKeysToDON converts a slice of NodeKeys into a DON struct with the given name and CapabilitySet. +func nodeKeysToDON(donName string, nodeKeys []NodeKeys, capSet CapabilitySet) DON { + peers := []peer{} + for _, n := range nodeKeys { p := peer{ PeerID: n.P2PPeerID, Signer: n.OCR2OnchainPublicKey, } - workflowDON = append(workflowDON, p) + peers = append(peers, p) + } + return DON{ + Name: donName, + Peers: peers, + CapabilitySet: capSet, } - return workflowDON } func getOrDeployCapabilitiesRegistry(ctx context.Context, artefactsDir string, env helpers.Environment) *kcr.CapabilitiesRegistry { contracts, err := LoadDeployedContracts(artefactsDir) if err != nil { fmt.Println("Could not load deployed contracts, deploying new ones") - // panic(err) } if contracts.CapabilityRegistry.String() == (common.Address{}).String() { diff --git a/core/scripts/keystone/src/07_delete_workflows_cmd.go b/core/scripts/keystone/src/07_delete_workflows_cmd.go index 2f5c639ad36..5b5b5c3ff60 100644 --- a/core/scripts/keystone/src/07_delete_workflows_cmd.go +++ b/core/scripts/keystone/src/07_delete_workflows_cmd.go @@ -25,6 +25,7 @@ func (g *deleteWorkflows) Name() string { func (g *deleteWorkflows) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) nodeList := fs.String("nodes", "", "Custom node list location") + nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") err := fs.Parse(args) if err != nil { @@ -36,7 +37,7 @@ func (g *deleteWorkflows) Run(args []string) { *nodeList = defaultNodeList } - nodes := downloadNodeAPICredentials(*nodeList) + nodes := downloadKeylessNodeSets(*nodeList, *nodeSetSize).Workflow.Nodes for _, node := range nodes { output := &bytes.Buffer{} diff --git a/core/scripts/keystone/src/88_capabilities_registry.go b/core/scripts/keystone/src/88_capabilities_registry.go index 5e4aeb6bc4f..9ad594beff1 100644 --- a/core/scripts/keystone/src/88_capabilities_registry.go +++ b/core/scripts/keystone/src/88_capabilities_registry.go @@ -1,28 +1,29 @@ package src import ( + "bytes" "context" + "encoding/hex" + "encoding/json" "fmt" "log" - "time" - "strings" + "time" - "encoding/hex" - + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + gethCommon "github.com/ethereum/go-ethereum/common" + gethTypes "github.com/ethereum/go-ethereum/core/types" ragetypes "github.com/smartcontractkit/libocr/ragep2p/types" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/durationpb" - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - capabilitiespb "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb" "github.com/smartcontractkit/chainlink-common/pkg/values" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - gethCommon "github.com/ethereum/go-ethereum/common" - gethTypes "github.com/ethereum/go-ethereum/core/types" - + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" ) @@ -138,16 +139,22 @@ func (c *CapabilityRegistryProvisioner) AddNodeOperator(ctx context.Context, nop // // Note that in terms of the provisioning process, this is not the last step. A capability is only active once // there is a DON servicing it. This is done via `AddDON`. -func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop *NodeOperator, capSet CapabilitySet) { +func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop *NodeOperator, donName string) { + don, exists := nop.DONs[donName] + if !exists { + log.Fatalf("DON with name %s does not exist in NodeOperator %s", donName, nop.Name) + } + + capSet := don.CapabilitySet + params := []kcr.CapabilitiesRegistryNodeParams{} - for i, peer := range nop.DON { + for i, peer := range don.Peers { node, innerErr := peerToNode(nop.id, peer) if innerErr != nil { panic(innerErr) } - // Technically we could be more flexible here, - // where we can have different capset assignment for each node + // Use the capability set attached to the DON node.HashedCapabilityIds = capSet.CapabilityIDs(c.reg) node.EncryptionPublicKey = [32]byte{2: byte(i + 1)} params = append(params, node) @@ -162,7 +169,7 @@ func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop *NodeO helpers.ConfirmTXMined(ctx, c.env.Ec, tx, c.env.ChainID) } -// AddDON takes a node operator, a capability set, and provisions a DON with the given capabilities. +// AddDON takes a node operator then provisions a DON with the given capabilities. // // A DON is a group of nodes that all support the same capability set. This set can be a subset of the // capabilities that the nodes support. In other words, each node within the node set can support @@ -183,15 +190,16 @@ func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop *NodeO // If you want to add a DON that services both capabilities and workflows, you should set both `acceptsWorkflows` and `isPublic` to true. // // Another important distinction is that DON can comprise of nodes from different node operators, but for now, we're keeping it simple and restricting it to a single node operator. We also hard code F to 1. -func (c *CapabilityRegistryProvisioner) AddDON(ctx context.Context, nop *NodeOperator, capSet CapabilitySet, isPublic bool, acceptsWorkflows bool) { - configs := capSet.Configs(c.reg) - - // Note: Technically we could be more flexible here, - // where we can have multiple DONs with different capability configurations - // and have a non-hardcoded number for F - var f uint8 = 1 - c.testCallContract("addDON", nop.MustGetPeerIDs(), configs, isPublic, acceptsWorkflows, f) - tx, err := c.reg.AddDON(c.env.Owner, nop.MustGetPeerIDs(), configs, isPublic, acceptsWorkflows, f) +func (c *CapabilityRegistryProvisioner) AddDON(ctx context.Context, nop *NodeOperator, donName string, isPublic bool, acceptsWorkflows bool) { + don, exists := nop.DONs[donName] + if !exists { + log.Fatalf("DON with name %s does not exist in NodeOperator %s", donName, nop.Name) + } + + configs := don.CapabilitySet.Configs(c.reg) + + c.testCallContract("addDON", don.MustGetPeerIDs(), configs, isPublic, acceptsWorkflows, don.F) + tx, err := c.reg.AddDON(c.env.Owner, don.MustGetPeerIDs(), configs, isPublic, acceptsWorkflows, don.F) if err != nil { log.Printf("failed to AddDON: %s", err) } @@ -326,10 +334,9 @@ func (t *TriggerCapability) Config() kcr.CapabilitiesRegistryCapabilityConfigura DefaultConfig: values.Proto(values.EmptyMap()).GetMapValue(), RemoteConfig: &capabilitiespb.CapabilityConfig_RemoteTriggerConfig{ RemoteTriggerConfig: &capabilitiespb.RemoteTriggerConfig{ - RegistrationRefresh: durationpb.New(20 * time.Second), - RegistrationExpiry: durationpb.New(60 * time.Second), - // We've hardcoded F + 1 here - MinResponsesToAggregate: uint32(1) + 1, + RegistrationRefresh: durationpb.New(20 * time.Second), + RegistrationExpiry: durationpb.New(60 * time.Second), + MinResponsesToAggregate: uint32(1) + 1, // We've hardcoded F + 1 here }, }, } @@ -359,7 +366,7 @@ func mustHashCapabilityID(reg *kcr.CapabilitiesRegistry, capability kcr.Capabili /* * - * Capabililty Sets + * Capability Sets * * */ @@ -367,12 +374,7 @@ type CapabilitySet []CapabillityProvisioner func NewCapabilitySet(capabilities ...CapabillityProvisioner) CapabilitySet { if len(capabilities) == 0 { - log.Println("No capabilities provided, using default capability set") - return []CapabillityProvisioner{ - NewStreamsTriggerV1Capability(), - NewEthereumGethTestnetV1WriteCapability(), - NewOCR3V1ConsensusCapability(), - } + log.Fatalf("No capabilities provided to NewCapabilitySet") } return capabilities @@ -414,25 +416,40 @@ func (c *CapabilitySet) Configs(reg *kcr.CapabilitiesRegistry) []kcr.Capabilitie * */ +// DON represents a Decentralized Oracle Network with a name, peers, and associated capabilities. +type DON struct { + F uint8 + Name string + Peers []peer + CapabilitySet CapabilitySet +} + +// MustGetPeerIDs retrieves the peer IDs for the DON. It panics if any error occurs. +func (d *DON) MustGetPeerIDs() [][32]byte { + ps, err := peers(d.Peers) + if err != nil { + panic(fmt.Errorf("failed to get peer IDs for DON %s: %w", d.Name, err)) + } + return ps +} + +// NodeOperator represents a node operator with administrative details and multiple DONs. type NodeOperator struct { Admin gethCommon.Address Name string - // This is a really simplified mapping - // We dont handle multichain, multi don, etc - // Take a look at https://github.com/smartcontractkit/chainlink/pull/14334/files#diff-9cd09c4e7efeae20108eea3eeeb1119bb923eecce51e98d9066ea0cee19af09c for a more complete version - // but we'll integrate with them in the future - DON []peer + DONs map[string]DON reg *kcr.CapabilitiesRegistry // This ID is generated by the registry when the NodeOperator is added id uint32 } -func NewNodeOperator(admin gethCommon.Address, name string, don []peer) *NodeOperator { +// NewNodeOperator creates a new NodeOperator with the provided admin address, name, and DONs. +func NewNodeOperator(admin gethCommon.Address, name string, dons map[string]DON) *NodeOperator { return &NodeOperator{ Admin: admin, Name: name, - DON: don, + DONs: dons, } } @@ -455,15 +472,6 @@ func (n *NodeOperator) SetCapabilityRegistryIssuedID(receipt *gethTypes.Receipt) return n.id } -func (n *NodeOperator) MustGetPeerIDs() [][32]byte { - ps, err := peers(n.DON) - if err != nil { - panic(err) - } - - return ps -} - func peerIDToB(peerID string) ([32]byte, error) { var peerIDB ragetypes.PeerID err := peerIDB.UnmarshalText([]byte(peerID)) diff --git a/core/scripts/keystone/src/88_gen_jobspecs.go b/core/scripts/keystone/src/88_gen_jobspecs.go index e043e053b87..15f8c63b014 100644 --- a/core/scripts/keystone/src/88_gen_jobspecs.go +++ b/core/scripts/keystone/src/88_gen_jobspecs.go @@ -33,11 +33,12 @@ func genSpecs( chainID int64, p2pPort int64, ocrConfigContractAddress string, - + nodeSetSize int, ) donHostSpec { - nodes := downloadNodeAPICredentials(nodeListPath) - nca := nodeKeysToKsDeployNodeKeys(downloadNodePubKeys(nodeListPath, chainID, pubkeysPath)) - bootstrapNode := nca[0] + workflowNodes := downloadNodeSets(nodeListPath, chainID, pubkeysPath, nodeSetSize).Workflow + workflowNodeKeys := nodeKeysToKsDeployNodeKeys(workflowNodes.NodeKeys) + nodes := workflowNodes.Nodes + bootstrapNode := workflowNodeKeys[0] bootstrapSpecLines, err := readLines(filepath.Join(templatesDir, bootstrapSpecTemplate)) helpers.PanicErr(err) @@ -59,7 +60,7 @@ func genSpecs( oracleSpecLines, chainID, p2pPort, ocrConfigContractAddress, bootHost, - bootstrapNode, nca[i], + bootstrapNode, workflowNodeKeys[i], ) oracles = append(oracles, hostSpec{oracleSpecLines, nodes[i].remoteURL.Host}) } diff --git a/core/scripts/keystone/src/88_gen_jobspecs_test.go b/core/scripts/keystone/src/88_gen_jobspecs_test.go index 8e021bb5005..94c0b009312 100644 --- a/core/scripts/keystone/src/88_gen_jobspecs_test.go +++ b/core/scripts/keystone/src/88_gen_jobspecs_test.go @@ -32,6 +32,6 @@ func TestGenSpecs(t *testing.T) { p2pPort := int64(6690) contractAddress := "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" - specs := genSpecs(pubkeysPath, nodeListPath, "../templates", chainID, p2pPort, contractAddress) + specs := genSpecs(pubkeysPath, nodeListPath, "../templates", chainID, p2pPort, contractAddress, 4) snaps.MatchSnapshot(t, specs.ToString()) } diff --git a/core/scripts/keystone/src/88_gen_ocr3_config.go b/core/scripts/keystone/src/88_gen_ocr3_config.go index 8ff37cda28a..724545f30c2 100644 --- a/core/scripts/keystone/src/88_gen_ocr3_config.go +++ b/core/scripts/keystone/src/88_gen_ocr3_config.go @@ -10,12 +10,12 @@ func mustReadConfig(fileName string) (output ksdeploy.TopLevelConfigSource) { return mustParseJSON[ksdeploy.TopLevelConfigSource](fileName) } -func generateOCR3Config(nodeList string, configFile string, chainID int64, pubKeysPath string) ksdeploy.Orc2drOracleConfig { +func generateOCR3Config(nodeList string, configFile string, chainID int64, pubKeysPath string, nodeSetSize int) ksdeploy.Orc2drOracleConfig { topLevelCfg := mustReadConfig(configFile) cfg := topLevelCfg.OracleConfig cfg.OCRSecrets = deployment.XXXGenerateTestOCRSecrets() - nca := downloadNodePubKeys(nodeList, chainID, pubKeysPath) - c, err := ksdeploy.GenerateOCR3Config(cfg, nodeKeysToKsDeployNodeKeys(nca)) + nodeSets := downloadNodeSets(nodeList, chainID, pubKeysPath, nodeSetSize) + c, err := ksdeploy.GenerateOCR3Config(cfg, nodeKeysToKsDeployNodeKeys(nodeSets.Workflow.NodeKeys)) helpers.PanicErr(err) return c } diff --git a/core/scripts/keystone/src/88_gen_ocr3_config_test.go b/core/scripts/keystone/src/88_gen_ocr3_config_test.go index da22397c1c6..dd3a3eadaec 100644 --- a/core/scripts/keystone/src/88_gen_ocr3_config_test.go +++ b/core/scripts/keystone/src/88_gen_ocr3_config_test.go @@ -10,7 +10,7 @@ import ( func TestGenerateOCR3Config(t *testing.T) { // Generate OCR3 config - config := generateOCR3Config(".cache/NodeList.txt", "./testdata/SampleConfig.json", 1337, "./testdata/PublicKeys.json") + config := generateOCR3Config(".cache/NodeList.txt", "./testdata/SampleConfig.json", 1337, "./testdata/PublicKeys.json", 4) matchOffchainConfig := match.Custom("OffchainConfig", func(s any) (any, error) { // coerce the value to a string diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index eef8d49192c..7d4e4302dc0 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -16,16 +16,82 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/web/presenters" ) -func downloadAllNodeKeys(nodeList string, chainID int64, pubKeysPath string) []AllNodeKeys { +// KeylessNodeSet represents a set of nodes without NodeKeys. +type KeylessNodeSet struct { + Name string + Prefix string + Nodes []*node +} + +// NodeSet represents a set of nodes with associated metadata. +// It embeds KeylessNodeSet and includes NodeKeys. +type NodeSet struct { + KeylessNodeSet + NodeKeys []NodeKeys // Store NodeKeys if needed +} + +// NodeSets holds the two NodeSets: Workflow and StreamsTrigger. +type NodeSets struct { + Workflow NodeSet + StreamsTrigger NodeSet +} + +// downloadKeylessNodeSets downloads the node API credentials or loads them from disk if they already exist. +// It returns a NodeSets struct without NodeKeys. +func downloadKeylessNodeSets(nodeListPath string, nodeSetSize int) NodeSets { + if _, err := os.Stat(nodeListPath); err == nil { + fmt.Println("Loading existing node host list at:", nodeListPath) + nodesList := mustReadNodesList(nodeListPath) + keylessNodeSets, err := splitNodesIntoNodeSets(nodesList, nodeSetSize) + PanicErr(err) + + return keylessNodeSets + } + + fmt.Println("Connecting to Kubernetes to fetch node credentials...") + crib := NewCribClient() + clNodesWithCreds, err := crib.GetCLNodeCredentials() + PanicErr(err) + + nodesList := clNodesWithCredsToNodes(clNodesWithCreds) + err = writeNodesList(nodeListPath, nodesList) + PanicErr(err) + + if len(nodesList) == 0 { + panic("no nodes found") + } + + keylessNodeSets, err := splitNodesIntoNodeSets(nodesList, nodeSetSize) + PanicErr(err) + return keylessNodeSets +} + +func downloadNodeSets(nodeList string, chainID int64, pubKeysPath string, nodeSetSize int) NodeSets { + // Always load or fetch the node list to ensure Nodes slices are populated + nodeSetsWithoutKeys := downloadKeylessNodeSets(nodeList, nodeSetSize) + if _, err := os.Stat(pubKeysPath); err == nil { fmt.Println("Loading existing public keys at:", pubKeysPath) allKeys := mustParseJSON[[]AllNodeKeys](pubKeysPath) - return allKeys - } - nodes := downloadNodeAPICredentials(nodeList) - allKeys := mustFetchAllNodeKeys(chainID, nodes) + // Ensure there are enough keys to populate both NodeSets + if len(allKeys) < 2*nodeSetSize { + panic(fmt.Sprintf("not enough keys to populate both nodeSets: required %d, got %d", 2*nodeSetSize, len(allKeys))) + } + + // Assign NodeKeys to Workflow NodeSet + nodeSetsWithoutKeys.Workflow.NodeKeys = convertAllKeysToNodeKeys(allKeys[:nodeSetSize]) + + // Assign NodeKeys to StreamsTrigger NodeSet + nodeSetsWithoutKeys.StreamsTrigger.NodeKeys = convertAllKeysToNodeKeys(allKeys[nodeSetSize : 2*nodeSetSize]) + + return nodeSetsWithoutKeys + } + // If pubKeysPath does not exist, populate NodeKeys + nodeSets := populateNodeKeys(chainID, nodeSetsWithoutKeys) + allKeys := gatherAllNodeKeys(nodeSets) + // Gather all NodeKeys to save them marshalledNodeKeys, err := json.MarshalIndent(allKeys, "", " ") if err != nil { panic(err) @@ -36,57 +102,81 @@ func downloadAllNodeKeys(nodeList string, chainID int64, pubKeysPath string) []A } fmt.Println("Keystone OCR2 public keys have been saved to:", pubKeysPath) - return allKeys + return nodeSets } -func downloadNodePubKeys(nodeList string, chainID int64, pubKeysPath string, index ...int) []NodeKeys { - keys := []NodeKeys{} - allKeys := downloadAllNodeKeys(nodeList, chainID, pubKeysPath) - - for _, k := range allKeys { - keys = append(keys, k.toNodeKeys(index...)) +// splitNodesIntoNodeSets splits the nodes into NodeSets for 'workflow' and 'streams-trigger' nodeSets. +func splitNodesIntoNodeSets(nodes []*node, nodeSetSize int) (NodeSets, error) { + totalNodes := len(nodes) + requiredNodes := nodeSetSize * 2 + if totalNodes < requiredNodes { + return NodeSets{}, fmt.Errorf("not enough nodes to populate both nodeSets: required %d, got %d", requiredNodes, totalNodes) } - return keys + return NodeSets{ + Workflow: NodeSet{ + KeylessNodeSet: KeylessNodeSet{ + Name: "workflow", + Prefix: "ks-wf-", + Nodes: nodes[:nodeSetSize], + }, + // NodeKeys will be populated later + }, + StreamsTrigger: NodeSet{ + KeylessNodeSet: KeylessNodeSet{ + Name: "streams-trigger", + Prefix: "ks-str-trig-", + Nodes: nodes[nodeSetSize : nodeSetSize*2], + }, + // NodeKeys will be populated later + }, + }, nil } -// downloadNodeAPICredentials downloads the node API credentials, or loads them from disk if they already exist -// -// The nodes are sorted by URL. In the case of crib, the bootstrap node is the first node in the list. -func downloadNodeAPICredentials(nodeListPath string) []*node { - if _, err := os.Stat(nodeListPath); err == nil { - fmt.Println("Loading existing node host list at:", nodeListPath) - nodesList := mustReadNodesList(nodeListPath) - return nodesList - } +// populateNodeKeys fetches and assigns NodeKeys to each NodeSet in NodeSets. +func populateNodeKeys(chainID int64, nodeSetsWithoutKeys NodeSets) NodeSets { + var nodeSets NodeSets - fmt.Println("Connecting to Kubernetes to fetch node credentials...") - crib := NewCribClient() - clNodesWithCreds, err := crib.GetCLNodeCredentials() + nodeSets.Workflow = NodeSet{ + KeylessNodeSet: nodeSetsWithoutKeys.Workflow.KeylessNodeSet, + } + workflowKeys := mustFetchAllNodeKeys(chainID, nodeSets.Workflow.Nodes) + nodeSets.Workflow.NodeKeys = convertAllKeysToNodeKeys(workflowKeys) - if err != nil { - panic(err) + nodeSets.StreamsTrigger = NodeSet{ + KeylessNodeSet: nodeSetsWithoutKeys.StreamsTrigger.KeylessNodeSet, } + streamsTriggerKeys := mustFetchAllNodeKeys(chainID, nodeSets.StreamsTrigger.Nodes) + nodeSets.StreamsTrigger.NodeKeys = convertAllKeysToNodeKeys(streamsTriggerKeys) - nodesList := clNodesWithCredsToNodes(clNodesWithCreds) - err = writeNodesList(nodeListPath, nodesList) - if err != nil { - panic(err) + return nodeSets +} + +// gatherAllNodeKeys aggregates all NodeKeys from NodeSets. +func gatherAllNodeKeys(nodeSets NodeSets) []AllNodeKeys { + var allKeys []AllNodeKeys + for _, nodeSet := range []NodeSet{nodeSets.Workflow, nodeSets.StreamsTrigger} { + for _, key := range nodeSet.NodeKeys { + allKeys = append(allKeys, key.toAllNodeKeys()) + } } - if len(nodesList) == 0 { - panic("No nodes found") + return allKeys +} + +// convertAllKeysToNodeKeys converts AllNodeKeys to NodeKeys. +func convertAllKeysToNodeKeys(allKeys []AllNodeKeys) []NodeKeys { + nodeKeys := []NodeKeys{} + for _, k := range allKeys { + nodeKeys = append(nodeKeys, k.toNodeKeys()) } - return nodesList + return nodeKeys } +// clNodesWithCredsToNodes converts CLNodeCredentials to a slice of nodes. func clNodesWithCredsToNodes(clNodesWithCreds []CLNodeCredentials) []*node { nodes := []*node{} for _, cl := range clNodesWithCreds { n := node{ - // Both url and remoteURL are the same for crib - // since we're executing this script from outside of the crib ingress. - // We'd want to set these differently if this script has to be running either - // inside crib or outside crib. url: cl.URL, remoteURL: cl.URL, serviceName: cl.ServiceName, @@ -97,7 +187,7 @@ func clNodesWithCredsToNodes(clNodesWithCreds []CLNodeCredentials) []*node { nodes = append(nodes, &n) } - // sort nodes by URL + // Sort nodes by URL sort.Slice(nodes, func(i, j int) bool { return nodes[i].url.String() < nodes[j].url.String() }) @@ -129,26 +219,18 @@ type AllNodeKeys struct { CSAPublicKey string `json:"CSAPublicKey"` } -func (a AllNodeKeys) toNodeKeys(index ...int) NodeKeys { - i := 0 - if len(index) > 0 { - i = index[0] - } - if i >= len(a.OCR2KBs) { - panic("index out of range") - } - +func (a AllNodeKeys) toNodeKeys() NodeKeys { return NodeKeys{ AptosAccount: a.AptosAccount, OCR2AptosKBTrimmed: OCR2AptosKBTrimmed{ - AptosBundleID: a.OCR2AptosKBs[i].AptosBundleID, - AptosOnchainPublicKey: a.OCR2AptosKBs[i].AptosOnchainPublicKey, + AptosBundleID: a.OCR2AptosKBs[0].AptosBundleID, + AptosOnchainPublicKey: a.OCR2AptosKBs[0].AptosOnchainPublicKey, }, OCR2KBTrimmed: OCR2KBTrimmed{ - OCR2BundleID: a.OCR2KBs[i].OCR2BundleID, - OCR2ConfigPublicKey: a.OCR2KBs[i].OCR2ConfigPublicKey, - OCR2OnchainPublicKey: a.OCR2KBs[i].OCR2OnchainPublicKey, - OCR2OffchainPublicKey: a.OCR2KBs[i].OCR2OffchainPublicKey, + OCR2BundleID: a.OCR2KBs[0].OCR2BundleID, + OCR2ConfigPublicKey: a.OCR2KBs[0].OCR2ConfigPublicKey, + OCR2OnchainPublicKey: a.OCR2KBs[0].OCR2OnchainPublicKey, + OCR2OffchainPublicKey: a.OCR2KBs[0].OCR2OffchainPublicKey, }, EthAddress: a.EthAddress, P2PPeerID: a.P2PPeerID, @@ -181,12 +263,34 @@ type NodeKeys struct { CSAPublicKey string `json:"CSAPublicKey"` } +func (n NodeKeys) toAllNodeKeys() AllNodeKeys { + return AllNodeKeys{ + EthAddress: n.EthAddress, + AptosAccount: n.AptosAccount, + P2PPeerID: n.P2PPeerID, + OCR2KBs: []OCR2KBTrimmed{ + { + OCR2BundleID: n.OCR2BundleID, + OCR2ConfigPublicKey: n.OCR2ConfigPublicKey, + OCR2OnchainPublicKey: n.OCR2OnchainPublicKey, + OCR2OffchainPublicKey: n.OCR2OffchainPublicKey, + }, + }, + OCR2AptosKBs: []OCR2AptosKBTrimmed{ + { + AptosBundleID: n.AptosBundleID, + AptosOnchainPublicKey: n.AptosOnchainPublicKey, + }, + }, + CSAPublicKey: n.CSAPublicKey, + } +} + func mustFetchAllNodeKeys(chainId int64, nodes []*node) []AllNodeKeys { allNodeKeys := []AllNodeKeys{} for _, n := range nodes { api := newNodeAPI(n) - // Get eth key eKey := api.mustExec(api.methods.ListETHKeys) ethKeys := mustJSON[[]presenters.ETHKeyResource](eKey) diff --git a/core/scripts/keystone/src/99_k8s_client.go b/core/scripts/keystone/src/99_k8s_client.go index 00eed2ef0b7..518d15abb67 100644 --- a/core/scripts/keystone/src/99_k8s_client.go +++ b/core/scripts/keystone/src/99_k8s_client.go @@ -77,7 +77,7 @@ func (m *K8sClient) GetDeploymentsWithConfigMap() ([]DeploymentWithConfigMap, er return nil, err } if len(deployments.Items) == 0 { - return nil, fmt.Errorf("no deployments found, is your cluster deployed?") + return nil, fmt.Errorf("no deployments found, is your nodeset deployed?") } deploymentsWithConfigMaps := []DeploymentWithConfigMap{} @@ -86,7 +86,7 @@ func (m *K8sClient) GetDeploymentsWithConfigMap() ([]DeploymentWithConfigMap, er return nil, err } if len(ingressList.Items) == 0 { - return nil, fmt.Errorf("no ingress found, is your cluster deployed?") + return nil, fmt.Errorf("no ingress found, is your nodeset deployed?") } for _, deployment := range deployments.Items { diff --git a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap index fa2e0ad8488..c806b295cdf 100755 --- a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap @@ -1,103 +1,160 @@ -[TestGenerateCribConfig - 1] -helm: - values: +[TestGeneratePostprovisionConfig - 1] +values: chainlink: - nodes: - node1: - image: ${runtime.images.app} - overridesToml: |- - [[EVM]] - ChainID = '1337' + nodes: + ks-str-trig-bt-node1: + image: ${runtime.images.app} + overridesToml: | + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + ListenAddresses = ['0.0.0.0:6691'] - [Capabilities] - [Capabilities.Peering] - [Capabilities.Peering.V2] - Enabled = true - ListenAddresses = ['0.0.0.0:6691'] + [Capabilities.ExternalRegistry] + Address = '0x0300000000000000000000000000000000000000' + NetworkID = 'evm' + ChainID = '1337' - [Capabilities.ExternalRegistry] - Address = '0xabcdef1234567890' - NetworkID = 'evm' - ChainID = '1337' - node2: - image: ${runtime.images.app} - overridesToml: |- - [[EVM]] - ChainID = '1337' - [EVM.Workflow] - FromAddress = '0x7848602Cb94A5c2F443886540f03e831f916eC84' - ForwarderAddress = '0x1234567890abcdef' + [[EVM]] + ChainID = '1337' + Nodes = [] + ks-str-trig-node2: + image: ${runtime.images.app} + overridesToml: | + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@ks-wf-bt-node1:6691'] + ListenAddresses = ['0.0.0.0:6691'] - [Capabilities] - [Capabilities.Peering] - [Capabilities.Peering.V2] - Enabled = true - DefaultBootstrappers = ['12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6691'] - ListenAddresses = ['0.0.0.0:6691'] + [Capabilities.ExternalRegistry] + Address = '0x0300000000000000000000000000000000000000' + NetworkID = 'evm' + ChainID = '1337' - [Capabilities.ExternalRegistry] - Address = '0xabcdef1234567890' - NetworkID = 'evm' - ChainID = '1337' - node3: - image: ${runtime.images.app} - overridesToml: |- - [[EVM]] - ChainID = '1337' - [EVM.Workflow] - FromAddress = '0x920ed6548FD46729d89a57Afe382F14Fa553FE47' - ForwarderAddress = '0x1234567890abcdef' + [[EVM]] + ChainID = '1337' + Nodes = [] - [Capabilities] - [Capabilities.Peering] - [Capabilities.Peering.V2] - Enabled = true - DefaultBootstrappers = ['12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6691'] - ListenAddresses = ['0.0.0.0:6691'] + [EVM.Workflow] + FromAddress = '0x385aCC980734af138774451811d7A4eC5057EC2E' + ForwarderAddress = '0x0200000000000000000000000000000000000000' + ks-wf-bt-node1: + image: ${runtime.images.app} + overridesToml: | + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + ListenAddresses = ['0.0.0.0:6691'] - [Capabilities.ExternalRegistry] - Address = '0xabcdef1234567890' - NetworkID = 'evm' - ChainID = '1337' - node4: - image: ${runtime.images.app} - overridesToml: |- - [[EVM]] - ChainID = '1337' - [EVM.Workflow] - FromAddress = '0x385aCC980734af138774451811d7A4eC5057EC2E' - ForwarderAddress = '0x1234567890abcdef' + [Capabilities.ExternalRegistry] + Address = '0x0300000000000000000000000000000000000000' + NetworkID = 'evm' + ChainID = '1337' - [Capabilities] - [Capabilities.Peering] - [Capabilities.Peering.V2] - Enabled = true - DefaultBootstrappers = ['12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6691'] - ListenAddresses = ['0.0.0.0:6691'] + [[EVM]] + ChainID = '1337' + Nodes = [] + ks-wf-node2: + image: ${runtime.images.app} + overridesToml: | + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@ks-wf-bt-node1:6691'] + ListenAddresses = ['0.0.0.0:6691'] - [Capabilities.ExternalRegistry] - Address = '0xabcdef1234567890' - NetworkID = 'evm' - ChainID = '1337' - node5: - image: ${runtime.images.app} - overridesToml: |- - [[EVM]] - ChainID = '1337' - [EVM.Workflow] - FromAddress = '0x8A7172a8197e18071C452ca538085Ff4Adcc6b4d' - ForwarderAddress = '0x1234567890abcdef' + [Capabilities.ExternalRegistry] + Address = '0x0300000000000000000000000000000000000000' + NetworkID = 'evm' + ChainID = '1337' - [Capabilities] - [Capabilities.Peering] - [Capabilities.Peering.V2] - Enabled = true - DefaultBootstrappers = ['12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6691'] - ListenAddresses = ['0.0.0.0:6691'] + [[EVM]] + ChainID = '1337' + Nodes = [] + + [EVM.Workflow] + FromAddress = '0x7848602Cb94A5c2F443886540f03e831f916eC84' + ForwarderAddress = '0x0200000000000000000000000000000000000000' + +--- + +[TestGeneratePreprovisionConfig - 1] +values: + chainlink: + nodes: + ks-str-trig-bt-node1: + image: ${runtime.images.app} + ks-str-trig-node2: + image: ${runtime.images.app} + ks-str-trig-node3: + image: ${runtime.images.app} + ks-wf-bt-node1: + image: ${runtime.images.app} + ks-wf-node2: + image: ${runtime.images.app} + ks-wf-node3: + image: ${runtime.images.app} + ingress: + hosts: + - host: ${DEVSPACE_NAMESPACE}-ks-wf-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-wf-bt-node1 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-wf-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-wf-node2 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-wf-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-wf-node3 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-str-trig-bt-node1 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-str-trig-node2 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-str-trig-node3 + port: + number: 6688 - [Capabilities.ExternalRegistry] - Address = '0xabcdef1234567890' - NetworkID = 'evm' - ChainID = '1337' --- diff --git a/core/scripts/keystone/src/testdata/NodeList.txt b/core/scripts/keystone/src/testdata/NodeList.txt index 7fffff4f506..77017829c8c 100644 --- a/core/scripts/keystone/src/testdata/NodeList.txt +++ b/core/scripts/keystone/src/testdata/NodeList.txt @@ -1,5 +1,6 @@ -https://crib-local-node1.local https://crib-local-node1.local app-node1 app-node1-bootstrap notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-node2.local https://crib-local-node2.local app-node2 app-node2 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-node3.local https://crib-local-node3.local app-node3 app-node3 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-node4.local https://crib-local-node4.local app-node4 app-node4 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-node5.local https://crib-local-node5.local app-node5 app-node5 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-ks-wf-bt-node1.local https://crib-local-ks-wf-bt-node1.local app-ks-wf-bt-node1 app-ks-wf-bt-node1-bootstrap notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-ks-wf-node2.local https://crib-local-ks-wf-node2.local app-ks-wf-node2 app-ks-wf-node2 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-ks-wf-node3.local https://crib-local-ks-wf-node3.local app-ks-wf-node3 app-ks-wf-node3 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-ks-str-trig-bt-node1.local https://crib-local-ks-str-trig-bt-node1.local app-ks-str-trig-bt-node1 app-ks-str-trig-bt-node1-bootstrap notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-ks-str-trig-node2.local https://crib-local-ks-str-trig-node2.local app-ks-str-trig-node2 app-ks-str-trig-node2 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-ks-str-trig-node3.local https://crib-local-ks-str-trig-node3.local app-ks-str-trig-node3 app-ks-str-trig-node3 notreal@fakeemail.ch fj293fbBnlQ!f9vNs diff --git a/core/scripts/keystone/src/testdata/PublicKeys.json b/core/scripts/keystone/src/testdata/PublicKeys.json index 93249b670d9..fc4c1d92e84 100644 --- a/core/scripts/keystone/src/testdata/PublicKeys.json +++ b/core/scripts/keystone/src/testdata/PublicKeys.json @@ -148,5 +148,35 @@ } ], "CSAPublicKey": "1b761b910db435a879edddce790cb07225c4ff8e7d836936b480835535c1a63c" + }, +{ + "AptosAccount": "1f7cb7e4d5f3b5c8e776581aea0230533f133add9c83afc5244e51145eb88a3b", + "OCR2AptosKBs": [ + { + "AptosBundleID": "34d1a1886cb41418eb174de45498a0dc9ffa6edbc219c24021acc7bdfbd6cf28", + "AptosOnchainPublicKey": "fcabe4de5a7016fa9f791a2fb3f1587a40bdcee5bd008ce2399338dd12bfed25" + }, + { + "AptosBundleID": "73e363d055b649a4646cd1deccc4398c1836201e63b0e4fb984f95576da74ecb", + "AptosOnchainPublicKey": "b32030b5e2af57ec7cd19899d6db271891ac39696b08865a48deff483caed187" + } + ], + "EthAddress": "0x8A7172a8197e18071C452ca538085Ff4Adcc6b4d", + "P2PPeerID": "12D3KooWLMFnmdZPS5zfkBsRVMrsKr3zTaFeuM48bskp5Mxnkdms", + "OCR2KBs": [ + { + "OCR2BundleID": "0a7aecb6b694fbcd71cbd1932238d5fd9442fd3477916cdb0519ab2408d21b2b", + "OCR2OnchainPublicKey": "3fbcb609d650f95d62412475845bc95bf3aee54a", + "OCR2OffchainPublicKey": "222542dd828ec343d4c28410897f8a2a0d10a7c8a582ddbd1c15cdf3aa4ec067", + "OCR2ConfigPublicKey": "bf9b3d1d72f29d40a20d88dabee331db5347ed775c2ea0d06272762dcc1bf627" + }, + { + "OCR2BundleID": "32de5360efbf37a436ecbd918c9c1135c80a8d5a6e0c87343cee28f6e72a6590", + "OCR2OnchainPublicKey": "92655fa128ce5c996565fdf8477d6402faf2c11e", + "OCR2OffchainPublicKey": "0f0e3930b8a8f51550ed885354c0316583e0ac2e3d4cb3cc8638f35c4ec99c93", + "OCR2ConfigPublicKey": "972bbcf5d5144f881fddbdeffe61f4ce1cc7765ba38080798ba2f5d8d69b3b3c" + } + ], + "CSAPublicKey": "1b761b910db435a879edddce790cb07225c4ff8e7d836936b480835535c1a63c" } ] diff --git a/core/scripts/keystone/templates/crib-overrides.yaml b/core/scripts/keystone/templates/crib-overrides.yaml deleted file mode 100644 index 34355edd3c6..00000000000 --- a/core/scripts/keystone/templates/crib-overrides.yaml +++ /dev/null @@ -1,100 +0,0 @@ -helm: - values: - chainlink: - nodes: - node1: - image: ${runtime.images.app} - overridesToml: |- - [[EVM]] - ChainID = '1337' - - [Capabilities] - [Capabilities.Peering] - [Capabilities.Peering.V2] - Enabled = true - ListenAddresses = ['0.0.0.0:6691'] - - [Capabilities.ExternalRegistry] - Address = '{{ external_registry_address }}' - NetworkID = 'evm' - ChainID = '1337' - node2: - image: ${runtime.images.app} - overridesToml: |- - [[EVM]] - ChainID = '1337' - [EVM.Workflow] - FromAddress = '{{ node_2_address }}' - ForwarderAddress = '{{ forwarder_address }}' - - [Capabilities] - [Capabilities.Peering] - [Capabilities.Peering.V2] - Enabled = true - DefaultBootstrappers = ['{{ capabilities_bootstrapper }}'] - ListenAddresses = ['0.0.0.0:6691'] - - [Capabilities.ExternalRegistry] - Address = '{{ external_registry_address }}' - NetworkID = 'evm' - ChainID = '1337' - node3: - image: ${runtime.images.app} - overridesToml: |- - [[EVM]] - ChainID = '1337' - [EVM.Workflow] - FromAddress = '{{ node_3_address }}' - ForwarderAddress = '{{ forwarder_address }}' - - [Capabilities] - [Capabilities.Peering] - [Capabilities.Peering.V2] - Enabled = true - DefaultBootstrappers = ['{{ capabilities_bootstrapper }}'] - ListenAddresses = ['0.0.0.0:6691'] - - [Capabilities.ExternalRegistry] - Address = '{{ external_registry_address }}' - NetworkID = 'evm' - ChainID = '1337' - node4: - image: ${runtime.images.app} - overridesToml: |- - [[EVM]] - ChainID = '1337' - [EVM.Workflow] - FromAddress = '{{ node_4_address }}' - ForwarderAddress = '{{ forwarder_address }}' - - [Capabilities] - [Capabilities.Peering] - [Capabilities.Peering.V2] - Enabled = true - DefaultBootstrappers = ['{{ capabilities_bootstrapper }}'] - ListenAddresses = ['0.0.0.0:6691'] - - [Capabilities.ExternalRegistry] - Address = '{{ external_registry_address }}' - NetworkID = 'evm' - ChainID = '1337' - node5: - image: ${runtime.images.app} - overridesToml: |- - [[EVM]] - ChainID = '1337' - [EVM.Workflow] - FromAddress = '{{ node_5_address }}' - ForwarderAddress = '{{ forwarder_address }}' - - [Capabilities] - [Capabilities.Peering] - [Capabilities.Peering.V2] - Enabled = true - DefaultBootstrappers = ['{{ capabilities_bootstrapper }}'] - ListenAddresses = ['0.0.0.0:6691'] - - [Capabilities.ExternalRegistry] - Address = '{{ external_registry_address }}' - NetworkID = 'evm' - ChainID = '1337' From 987197d7ebe594308ed9286ca49f774c7b38d069 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Sat, 19 Oct 2024 17:26:49 -0700 Subject: [PATCH 052/117] Fix ingress generation for postprevision --- .../src/03_gen_crib_cluster_overrides_cmd.go | 104 ++-- .../03_gen_crib_cluster_overrides_cmd_test.go | 11 +- ...3_gen_crib_cluster_overrides_cmd_test.snap | 490 ++++++++++++------ .../keystone/src/testdata/NodeList.txt | 8 +- .../keystone/src/testdata/PublicKeys.json | 220 ++++---- 5 files changed, 510 insertions(+), 323 deletions(-) diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go index 196a3189132..060cc544a75 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go @@ -113,7 +113,7 @@ func (g *generateCribClusterOverridesPreprovision) Run(args []string) { func generatePreprovisionConfig(nodeSetSize int) Helm { nodeSets := []string{"ks-wf-", "ks-str-trig-"} nodes := make(map[string]Node) - var hosts []Host + ingress := generateIngress(nodeSets, nodeSetSize) for _, prefix := range nodeSets { // Bootstrap node @@ -121,25 +121,6 @@ func generatePreprovisionConfig(nodeSetSize int) Helm { nodes[btNodeName] = Node{ Image: "${runtime.images.app}", } - host := Host{ - Host: fmt.Sprintf("${DEVSPACE_NAMESPACE}-%s.${DEVSPACE_INGRESS_BASE_DOMAIN}", btNodeName), - HTTP: HTTP{ - Paths: []Path{ - { - Path: "/", - Backend: Backend{ - Service: Service{ - Name: fmt.Sprintf("app-%s", btNodeName), - Port: Port{ - Number: 6688, - }, - }, - }, - }, - }, - }, - } - hosts = append(hosts, host) // Other nodes for i := 2; i <= nodeSetSize; i++ { @@ -147,25 +128,6 @@ func generatePreprovisionConfig(nodeSetSize int) Helm { nodes[nodeName] = Node{ Image: "${runtime.images.app}", } - host := Host{ - Host: fmt.Sprintf("${DEVSPACE_NAMESPACE}-%s.${DEVSPACE_INGRESS_BASE_DOMAIN}", nodeName), - HTTP: HTTP{ - Paths: []Path{ - { - Path: "/", - Backend: Backend{ - Service: Service{ - Name: fmt.Sprintf("app-%s", nodeName), - Port: Port{ - Number: 6688, - }, - }, - }, - }, - }, - }, - } - hosts = append(hosts, host) } } @@ -175,9 +137,7 @@ func generatePreprovisionConfig(nodeSetSize int) Helm { Chainlink: Chainlink{ Nodes: nodes, }, - Ingress: Ingress{ - Hosts: hosts, - }, + Ingress: ingress, }, }, } @@ -278,12 +238,15 @@ func generatePostprovisionConfig(nodeList *string, chainID *int64, publicKeys *s } } + ingress := generateIngress([]string{nodeSets.Workflow.Prefix, nodeSets.StreamsTrigger.Prefix}, nodeSetSize) + helm := Helm{ Chart{ HelmValues: HelmValues{ Chainlink: Chainlink{ Nodes: nodes, }, + Ingress: ingress, }, }, } @@ -340,4 +303,61 @@ func generateOverridesToml( return confStr } +// New function to generate Ingress +func generateIngress(nodeSetPrefixes []string, nodeSetSize int) Ingress { + var hosts []Host + + for _, prefix := range nodeSetPrefixes { + // Bootstrap node + btNodeName := fmt.Sprintf("%sbt-node1", prefix) + host := Host{ + Host: fmt.Sprintf("${DEVSPACE_NAMESPACE}-%s.${DEVSPACE_INGRESS_BASE_DOMAIN}", btNodeName), + HTTP: HTTP{ + Paths: []Path{ + { + Path: "/", + Backend: Backend{ + Service: Service{ + Name: fmt.Sprintf("app-%s", btNodeName), + Port: Port{ + Number: 6688, // Ensure consistency if port was intended to be same + }, + }, + }, + }, + }, + }, + } + hosts = append(hosts, host) + + // Other nodes + for i := 2; i <= nodeSetSize; i++ { + nodeName := fmt.Sprintf("%snode%d", prefix, i) + host := Host{ + Host: fmt.Sprintf("${DEVSPACE_NAMESPACE}-%s.${DEVSPACE_INGRESS_BASE_DOMAIN}", nodeName), + HTTP: HTTP{ + Paths: []Path{ + { + Path: "/", + Backend: Backend{ + Service: Service{ + Name: fmt.Sprintf("app-%s", nodeName), + Port: Port{ + Number: 6688, // Ensure consistency if port was intended to be same + }, + }, + }, + }, + }, + }, + } + hosts = append(hosts, host) + } + } + + return Ingress{ + Hosts: hosts, + } +} + func ptr[T any](t T) *T { return &t } diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go index 3155eb38230..719b6908bdf 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go @@ -11,9 +11,8 @@ import ( func TestGeneratePostprovisionConfig(t *testing.T) { chainID := int64(1337) publicKeysPath := "./testdata/PublicKeys.json" - - defaultNodeListStr := defaultNodeList - publicKeysPathStr := publicKeysPath + nodeListPath := "./testdata/NodeList.txt" + contracts := deployedContracts{ OCRContract: [20]byte{0: 1}, ForwarderContract: [20]byte{0: 2}, @@ -21,9 +20,9 @@ func TestGeneratePostprovisionConfig(t *testing.T) { SetConfigTxBlock: 0, } - nodeSetSize := 2 + nodeSetSize := 4 - chart := generatePostprovisionConfig(&defaultNodeListStr, &chainID, &publicKeysPathStr, contracts, nodeSetSize) + chart := generatePostprovisionConfig(&nodeListPath, &chainID, &publicKeysPath, contracts, nodeSetSize) yamlData, err := yaml.Marshal(chart) if err != nil { @@ -35,7 +34,7 @@ func TestGeneratePostprovisionConfig(t *testing.T) { } func TestGeneratePreprovisionConfig(t *testing.T) { - nodeSetSize := 2 + nodeSetSize := 4 chart := generatePreprovisionConfig(nodeSetSize) diff --git a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap index c806b295cdf..99b603637c4 100755 --- a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap @@ -1,160 +1,346 @@ [TestGeneratePostprovisionConfig - 1] -values: - chainlink: - nodes: - ks-str-trig-bt-node1: - image: ${runtime.images.app} - overridesToml: | - [Capabilities] - [Capabilities.Peering] - [Capabilities.Peering.V2] - Enabled = true - ListenAddresses = ['0.0.0.0:6691'] - - [Capabilities.ExternalRegistry] - Address = '0x0300000000000000000000000000000000000000' - NetworkID = 'evm' - ChainID = '1337' - - [[EVM]] - ChainID = '1337' - Nodes = [] - ks-str-trig-node2: - image: ${runtime.images.app} - overridesToml: | - [Capabilities] - [Capabilities.Peering] - [Capabilities.Peering.V2] - Enabled = true - DefaultBootstrappers = ['12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@ks-wf-bt-node1:6691'] - ListenAddresses = ['0.0.0.0:6691'] - - [Capabilities.ExternalRegistry] - Address = '0x0300000000000000000000000000000000000000' - NetworkID = 'evm' - ChainID = '1337' - - [[EVM]] - ChainID = '1337' - Nodes = [] - - [EVM.Workflow] - FromAddress = '0x385aCC980734af138774451811d7A4eC5057EC2E' - ForwarderAddress = '0x0200000000000000000000000000000000000000' - ks-wf-bt-node1: - image: ${runtime.images.app} - overridesToml: | - [Capabilities] - [Capabilities.Peering] - [Capabilities.Peering.V2] - Enabled = true - ListenAddresses = ['0.0.0.0:6691'] - - [Capabilities.ExternalRegistry] - Address = '0x0300000000000000000000000000000000000000' - NetworkID = 'evm' - ChainID = '1337' - - [[EVM]] - ChainID = '1337' - Nodes = [] - ks-wf-node2: - image: ${runtime.images.app} - overridesToml: | - [Capabilities] - [Capabilities.Peering] - [Capabilities.Peering.V2] - Enabled = true - DefaultBootstrappers = ['12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@ks-wf-bt-node1:6691'] - ListenAddresses = ['0.0.0.0:6691'] - - [Capabilities.ExternalRegistry] - Address = '0x0300000000000000000000000000000000000000' - NetworkID = 'evm' - ChainID = '1337' - - [[EVM]] - ChainID = '1337' - Nodes = [] - - [EVM.Workflow] - FromAddress = '0x7848602Cb94A5c2F443886540f03e831f916eC84' - ForwarderAddress = '0x0200000000000000000000000000000000000000' +helm: + values: + chainlink: + nodes: + ks-str-trig-bt-node1: + image: ${runtime.images.app} + overridesToml: | + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0x0300000000000000000000000000000000000000' + NetworkID = 'evm' + ChainID = '1337' + + [[EVM]] + ChainID = '1337' + Nodes = [] + ks-str-trig-node2: + image: ${runtime.images.app} + overridesToml: | + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@ks-wf-bt-node1:6691'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0x0300000000000000000000000000000000000000' + NetworkID = 'evm' + ChainID = '1337' + + [[EVM]] + ChainID = '1337' + Nodes = [] + + [EVM.Workflow] + FromAddress = '0x567c3f356e8FE74466c548A31E7949B00c893692' + ForwarderAddress = '0x0200000000000000000000000000000000000000' + ks-str-trig-node3: + image: ${runtime.images.app} + overridesToml: | + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@ks-wf-bt-node1:6691'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0x0300000000000000000000000000000000000000' + NetworkID = 'evm' + ChainID = '1337' + + [[EVM]] + ChainID = '1337' + Nodes = [] + + [EVM.Workflow] + FromAddress = '0x047cd317652D0009b098740D53dEf9d166F43b6D' + ForwarderAddress = '0x0200000000000000000000000000000000000000' + ks-str-trig-node4: + image: ${runtime.images.app} + overridesToml: | + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@ks-wf-bt-node1:6691'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0x0300000000000000000000000000000000000000' + NetworkID = 'evm' + ChainID = '1337' + + [[EVM]] + ChainID = '1337' + Nodes = [] + + [EVM.Workflow] + FromAddress = '0x4E717194f6c10089A814240c368222b60e4eA769' + ForwarderAddress = '0x0200000000000000000000000000000000000000' + ks-wf-bt-node1: + image: ${runtime.images.app} + overridesToml: | + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0x0300000000000000000000000000000000000000' + NetworkID = 'evm' + ChainID = '1337' + + [[EVM]] + ChainID = '1337' + Nodes = [] + ks-wf-node2: + image: ${runtime.images.app} + overridesToml: | + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@ks-wf-bt-node1:6691'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0x0300000000000000000000000000000000000000' + NetworkID = 'evm' + ChainID = '1337' + + [[EVM]] + ChainID = '1337' + Nodes = [] + + [EVM.Workflow] + FromAddress = '0x3C2060Fc4D49E531d740705Afe1ddD653599002b' + ForwarderAddress = '0x0200000000000000000000000000000000000000' + ks-wf-node3: + image: ${runtime.images.app} + overridesToml: | + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@ks-wf-bt-node1:6691'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0x0300000000000000000000000000000000000000' + NetworkID = 'evm' + ChainID = '1337' + + [[EVM]] + ChainID = '1337' + Nodes = [] + + [EVM.Workflow] + FromAddress = '0x95274E049b640C718E967E8282D69b218752F965' + ForwarderAddress = '0x0200000000000000000000000000000000000000' + ks-wf-node4: + image: ${runtime.images.app} + overridesToml: | + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@ks-wf-bt-node1:6691'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0x0300000000000000000000000000000000000000' + NetworkID = 'evm' + ChainID = '1337' + + [[EVM]] + ChainID = '1337' + Nodes = [] + + [EVM.Workflow] + FromAddress = '0x9953FC232a47fbDB56df36F57712910629304761' + ForwarderAddress = '0x0200000000000000000000000000000000000000' + ingress: + hosts: + - host: ${DEVSPACE_NAMESPACE}-ks-wf-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-wf-bt-node1 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-wf-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-wf-node2 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-wf-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-wf-node3 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-wf-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-wf-node4 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-str-trig-bt-node1 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-str-trig-node2 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-str-trig-node3 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-str-trig-node4 + port: + number: 6688 --- [TestGeneratePreprovisionConfig - 1] -values: - chainlink: - nodes: - ks-str-trig-bt-node1: - image: ${runtime.images.app} - ks-str-trig-node2: - image: ${runtime.images.app} - ks-str-trig-node3: - image: ${runtime.images.app} - ks-wf-bt-node1: - image: ${runtime.images.app} - ks-wf-node2: - image: ${runtime.images.app} - ks-wf-node3: - image: ${runtime.images.app} - ingress: - hosts: - - host: ${DEVSPACE_NAMESPACE}-ks-wf-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} - http: - paths: - - path: / - backend: - service: - name: app-ks-wf-bt-node1 - port: - number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-wf-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} - http: - paths: - - path: / - backend: - service: - name: app-ks-wf-node2 - port: - number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-wf-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} - http: - paths: - - path: / - backend: - service: - name: app-ks-wf-node3 - port: - number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} - http: - paths: - - path: / - backend: - service: - name: app-ks-str-trig-bt-node1 - port: - number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} - http: - paths: - - path: / - backend: - service: - name: app-ks-str-trig-node2 - port: - number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} - http: - paths: - - path: / - backend: - service: - name: app-ks-str-trig-node3 - port: - number: 6688 +helm: + values: + chainlink: + nodes: + ks-str-trig-bt-node1: + image: ${runtime.images.app} + ks-str-trig-node2: + image: ${runtime.images.app} + ks-str-trig-node3: + image: ${runtime.images.app} + ks-str-trig-node4: + image: ${runtime.images.app} + ks-wf-bt-node1: + image: ${runtime.images.app} + ks-wf-node2: + image: ${runtime.images.app} + ks-wf-node3: + image: ${runtime.images.app} + ks-wf-node4: + image: ${runtime.images.app} + ingress: + hosts: + - host: ${DEVSPACE_NAMESPACE}-ks-wf-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-wf-bt-node1 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-wf-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-wf-node2 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-wf-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-wf-node3 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-wf-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-wf-node4 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-str-trig-bt-node1 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-str-trig-node2 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-str-trig-node3 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-ks-str-trig-node4 + port: + number: 6688 --- diff --git a/core/scripts/keystone/src/testdata/NodeList.txt b/core/scripts/keystone/src/testdata/NodeList.txt index 77017829c8c..6bb0332bcd6 100644 --- a/core/scripts/keystone/src/testdata/NodeList.txt +++ b/core/scripts/keystone/src/testdata/NodeList.txt @@ -1,6 +1,8 @@ -https://crib-local-ks-wf-bt-node1.local https://crib-local-ks-wf-bt-node1.local app-ks-wf-bt-node1 app-ks-wf-bt-node1-bootstrap notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-ks-wf-node2.local https://crib-local-ks-wf-node2.local app-ks-wf-node2 app-ks-wf-node2 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-ks-wf-node3.local https://crib-local-ks-wf-node3.local app-ks-wf-node3 app-ks-wf-node3 notreal@fakeemail.ch fj293fbBnlQ!f9vNs https://crib-local-ks-str-trig-bt-node1.local https://crib-local-ks-str-trig-bt-node1.local app-ks-str-trig-bt-node1 app-ks-str-trig-bt-node1-bootstrap notreal@fakeemail.ch fj293fbBnlQ!f9vNs https://crib-local-ks-str-trig-node2.local https://crib-local-ks-str-trig-node2.local app-ks-str-trig-node2 app-ks-str-trig-node2 notreal@fakeemail.ch fj293fbBnlQ!f9vNs https://crib-local-ks-str-trig-node3.local https://crib-local-ks-str-trig-node3.local app-ks-str-trig-node3 app-ks-str-trig-node3 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-ks-str-trig-node4.local https://crib-local-ks-str-trig-node4.local app-ks-str-trig-node4 app-ks-str-trig-node4 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-ks-wf-bt-node1.local https://crib-local-ks-wf-bt-node1.local app-ks-wf-bt-node1 app-ks-wf-bt-node1 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-ks-wf-node2.local https://crib-local-ks-wf-node2.local app-ks-wf-node2 app-ks-wf-node2 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-ks-wf-node3.local https://crib-local-ks-wf-node3.local app-ks-wf-node3 app-ks-wf-node3 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-ks-wf-node4.local https://crib-local-ks-wf-node4.local app-ks-wf-node4 app-ks-wf-node4 notreal@fakeemail.ch fj293fbBnlQ!f9vNs diff --git a/core/scripts/keystone/src/testdata/PublicKeys.json b/core/scripts/keystone/src/testdata/PublicKeys.json index fc4c1d92e84..73201dcd641 100644 --- a/core/scripts/keystone/src/testdata/PublicKeys.json +++ b/core/scripts/keystone/src/testdata/PublicKeys.json @@ -1,182 +1,162 @@ [ { - "AptosAccount": "81e6d6cdce9d9f64706682f533c34c6ae15ef2e126eb3effcfbe2566785c7e5a", + "AptosAccount": "c3183a0dd656aaf1d1384f4c378755267a1d9a4667f018003c78298b66f266dd", "OCR2AptosKBs": [ { - "AptosBundleID": "c79161e50c63b1da010a31729c25b35e87efa48bc87222713378a985194cfdf8", - "AptosOnchainPublicKey": "38f58b8b3762d5a7949ab3ea8caae7103b93d3ab9f1475fe2419a61ffe3721c3" - }, - { - "AptosBundleID": "ddf9c2e55f9b09883ffc04b387544b9879dd409c0721d95bc3bcd698669f12ba", - "AptosOnchainPublicKey": "848795fd7d821853b6e9fab24afd4d0bcced29cf33065daaab2a0e6e52b4e603" + "AptosBundleID": "21f089fc574e6f5ca51521a3df069720d7046212f64dcf2926b335f53ce49e8b", + "AptosOnchainPublicKey": "4e370df5708449a502bf6582ca4228765247a2127b050ca4135aabbe7ffd787a" } ], - "EthAddress": "0xAB61281B74DadFcCccF06Fb0F8406018683a39E5", - "P2PPeerID": "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2", + "EthAddress": "0xC497BDE6a610C115c56cfAbb8111D071079BB88E", + "P2PPeerID": "12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ", "OCR2KBs": [ { - "OCR2BundleID": "3be44dce84b19c41fdb2ed4733d655b723fb8568a84e9ddef2e626fff8ac1cc2", - "OCR2OnchainPublicKey": "f118b71c49bfa24fcf9aa177bb1a8ca43da9bcb9", - "OCR2OffchainPublicKey": "1a6da481ad10a56e400c40c48102a5bdb158cde6e559c985f85e8fc8a89f8904", - "OCR2ConfigPublicKey": "29b7e7093599191eced88eb594f6740ad3100a049a5b0f749106c9162a8d5832" - }, - { - "OCR2BundleID": "90ff45c6e06bfa2d7a2f139d7a2ff61d42631e4c3b4dbbee776905a3e0cfbc62", - "OCR2OnchainPublicKey": "9b590ac6673f7f79d41154166f66eccf89d2fbe8", - "OCR2OffchainPublicKey": "780b3f3f28c6a1fde982b897f23b38ccb3560b176c8fae23461bbc24e5cd1d7e", - "OCR2ConfigPublicKey": "e0ef149d67b9a248be74039ecd8f20c2026250d6789c419ff070585504bdad7e" + "OCR2BundleID": "2806ea5622db94c18915ab748b401f6c37a7748cec4f59453b5f13c91f77fb4f", + "OCR2OnchainPublicKey": "192b5904f3f3770d7ec4cd05a03d9091730ebba6", + "OCR2OffchainPublicKey": "f04eda1c1887858af92da5886fa342b8685e34434f98f5e52f919e0a704dba82", + "OCR2ConfigPublicKey": "a7a573ab65aa4f748f6f777904a0570a48f233eccaf0f8ad074b06ca8279d17f" } ], - "CSAPublicKey": "ed64533c9a0df4e81f6679a986df602630118e0410b616f18eff05596a9b8b47" + "CSAPublicKey": "17e957ba4d4e655d2599734935f489833cc9f827d0d06656d7b6dd4231907aeb" }, { - "AptosAccount": "7a052a94f8ba19fc193f45bb258e25133df6e0787201752d95e89e24ecb4c0e0", + "AptosAccount": "b832659ef74b9e0eb2696f6575a3999c13d5485ee5f375c0c08be57a93b1a4a3", "OCR2AptosKBs": [ { - "AptosBundleID": "a8991d329d512dd97fc7ebc94e92fb6f4407285b8235a469efbf3d9df8de5544", - "AptosOnchainPublicKey": "24278247322fc734ad036c32e63d1a088204948eb1a08c2b9b2a2e13b9db39af" - }, - { - "AptosBundleID": "d79fe54b6150c918b71f93578b3dda9ae8fa0b3285d79e3b863a4e017af03b91", - "AptosOnchainPublicKey": "635155a5d260a6b6781f99f34e8da2cf86b88f97ca9f3c84bf8075050386bb2d" + "AptosBundleID": "4d0e1765eaafb83c9792758c7708a87eb80e79ac6c91c600d1bc6187448e5635", + "AptosOnchainPublicKey": "06b05974974fc9234137ef4a2faf8a53eda788a11edad35dff5879b829151c21" } ], - "EthAddress": "0x7848602Cb94A5c2F443886540f03e831f916eC84", - "P2PPeerID": "12D3KooWALUE9rJzRSGifjCZCefE2FGDmoByTpoaVf2FYHzkTWk8", + "EthAddress": "0x3C2060Fc4D49E531d740705Afe1ddD653599002b", + "P2PPeerID": "12D3KooWBgjEUKQgRPWri6L3StAm7CwWLat14FuZ7pFMwLcsJTa2", "OCR2KBs": [ { - "OCR2BundleID": "0332308cdef793a3892f5fa70b1c3d42efe69054b6da2bb77e6b696e5fa351cd", - "OCR2OnchainPublicKey": "ff13a76b8f95705bce6f9fd17228141029647826", - "OCR2OffchainPublicKey": "538bc68bbd90e2ca661b3b422aec2f45febf376329e53ecac1b8e2900884d506", - "OCR2ConfigPublicKey": "47c95793608477f02d8e1654ae64b0bab4ecb4d46aded42708250895eedbec00" - }, - { - "OCR2BundleID": "79db2ae001d5cbe9617b1e3e4e32ef27df4adf25b19df7ef4840902967f983bb", - "OCR2OnchainPublicKey": "9b3622c73264ac991af3e57e562d2cda4cc077a6", - "OCR2OffchainPublicKey": "8d9c29a7d07933d55dd0d2810ab206e523270456de4100a7e81b044f6abe31a7", - "OCR2ConfigPublicKey": "f5047ffcb9de176f8d4330132db45cb28c2d722abfe59e863503267d1ced0a26" + "OCR2BundleID": "01b238f52458eb17adfc94cebf3f0c05080b761b0289bb6aa7ddb9455d58828a", + "OCR2OnchainPublicKey": "595c321303e3a11762229d322b6018db5eb9162a", + "OCR2OffchainPublicKey": "0f18a019f9868afcf82fb69b4d3384518e6688bcd8cac81c660e470f9d672806", + "OCR2ConfigPublicKey": "ac00546bf873d37235db69b3ee5aba9eb867bf44402281d498acdade08ad6a19" } ], - "CSAPublicKey": "2afdb4f88ea737514e6d3e706db59fb26e4ee40296402e89a76105faaee1b122" + "CSAPublicKey": "1cd166e055f44bf63670e6d391b3efc53b59da785e70fd7cd652e1df69b3ea4a" }, { - "AptosAccount": "7de165e74144a112e30ae53fabc841889214ea35a9a0decb834b62362d916215", + "AptosAccount": "34212f58aa3f19db42a7ee24d27483d9d52f450d66bb7d2927518cb2cec71200", "OCR2AptosKBs": [ { - "AptosBundleID": "378e3e6cc29171c29a98f977ff3d3b1cd0e7175a9d855f8106143bc23a577b19", - "AptosOnchainPublicKey": "c5ae8795aef0b0f01947343b3b48c052ba1a695e31401ce7b1cb8f2e74d201ce" - }, - { - "AptosBundleID": "d7c0567ef89ee8d96be2b9b8c66164a94420a66030223d098fc30a44f5411350", - "AptosOnchainPublicKey": "863c5f1bc60f605e0150f84dc5f9de5037834848be9f1980fc22fc0a78f41583" + "AptosBundleID": "3c0763dec63113f472b781c63bb01f833bda89ee579eda13c11cf90f7874b9b1", + "AptosOnchainPublicKey": "86d4ff9e1fa3dffa1225a734a13bc48d80e2295a41aa1ddfc07da7a3e85dfe60" } ], - "EthAddress": "0x920ed6548FD46729d89a57Afe382F14Fa553FE47", - "P2PPeerID": "12D3KooWRw2ZgUCXP6LigiVxvSmWeL2h7ZB5bJ9AE9vCAQ1EK8q9", + "EthAddress": "0x95274E049b640C718E967E8282D69b218752F965", + "P2PPeerID": "12D3KooWFWvP8WwjTdVxts2ZyqMSNXqWp7Dh3C42h2YE27H41C4E", "OCR2KBs": [ { - "OCR2BundleID": "18b264b12430cf7f706b95e6323b10abc5225cac0ebceb60d1312dae3359b4c9", - "OCR2OnchainPublicKey": "5b7e53d88cf57f415a463f9dcac1a19eea332ee6", - "OCR2OffchainPublicKey": "4a0d9d39ba9ed6a22ab5527aea99939d8a639f407576ab940870ed6c44ef95c6", - "OCR2ConfigPublicKey": "30da13f8306ddf064951a0f423b42ad725593d089edf13a975138a5947d7d030" - }, - { - "OCR2BundleID": "fa6e8e8b8747b35468e1a1b556f67288451ee8cca01e6c9d5d5a9b98e123bb28", - "OCR2OnchainPublicKey": "285ab1f6180fa6d9c435f5dd05751551e550f05d", - "OCR2OffchainPublicKey": "78f67a09bcc37dba146dd03188613d6352f608369c8e1788f56f7bacb182d185", - "OCR2ConfigPublicKey": "b23e0f95effa71308a9d266f4cce360b991f199b612e4e345260e54006097503" + "OCR2BundleID": "3cc4b91efa9064fe3d851022733b5de64aeca1703f85ef1a3d52106ba7b7abd8", + "OCR2OnchainPublicKey": "dcb7e121b95b7f001453826f15bf1982216c9019", + "OCR2OffchainPublicKey": "ef75aa16e1f27b8fb8c36a9896fed4a1c37d4cb30e337526de1e14e012d94369", + "OCR2ConfigPublicKey": "b5673d96fc94d04f3a4f09eb7f61dc53a6d01adaed2a39488b0aedbbd70a7160" } ], - "CSAPublicKey": "365375704fa92c39f18c45be962d51721c3be24eb18ec99921a66981298c7399" + "CSAPublicKey": "d562c752999c0a401fec8870ec9fd132edcb35a5726cad80c814097f94223a4f" }, { - "AptosAccount": "b27df683db460c79b20737a9755126508dde1aaae9188e2e8b89d8c374b8bc66", + "AptosAccount": "0377ff0a32e08ec9ccc8cb41c9ec98a80d068f9dbb982315262f30f7576cc1bd", "OCR2AptosKBs": [ { - "AptosBundleID": "8c8257b4838193409bd96bf9168c60ecc1e217363af9312d5c0db26b181f9e6f", - "AptosOnchainPublicKey": "ea21c61bcb7768010c997b84fbb34f84010216da3b1fb93f0a78c09969314917" - }, - { - "AptosBundleID": "9c8027fe870e824ee825b06f5889395832d566c309b8352a9b3257aed8859230", - "AptosOnchainPublicKey": "58d08047986f60dd968aa256f7679f0847bb71ac3676550b89ab1fcb78dc7cb2" + "AptosBundleID": "400e8fbd800dba3ba7c8a472cb477ebf0218d6a8c94bd069c6e6d76cbcbb6c01", + "AptosOnchainPublicKey": "f064e76c629d3676c3f14e7d8088fc335d9a8715a810cefb86e4d76167897e93" } ], - "EthAddress": "0x385aCC980734af138774451811d7A4eC5057EC2E", - "P2PPeerID": "12D3KooWBb6BQXSQ9YZBzQnH8dhgz2ksdXpU5cNwUUZ99GDfgkwC", + "EthAddress": "0x9953FC232a47fbDB56df36F57712910629304761", + "P2PPeerID": "12D3KooWRjJ8fVnQt9nMgWD8mMtfvFX4zVWR78qVcV6TKXoBXnGT", "OCR2KBs": [ { - "OCR2BundleID": "6cee0022d1a0b307f73b3eac9a1d69b23db1deba30bfc8f53ab293523bbd6400", - "OCR2OnchainPublicKey": "689d45e7e7b3b2bfcddb2714bf4b296767794727", - "OCR2OffchainPublicKey": "4ab1fe3630b58d62b46501b121f92d8a8c81b325472b8ace6dfef3c4bb0f00f3", - "OCR2ConfigPublicKey": "b377b0a623e4de968a125ab362de22f7bb899872400ab13a15ea5d5987504a75" - }, - { - "OCR2BundleID": "eecc7a727df2ed10e304f4f3cd03290a809ac1ad19b656f256221ac9808d901c", - "OCR2OnchainPublicKey": "a5c84182a049ed7a7982a3912dba038b7af27ab7", - "OCR2OffchainPublicKey": "19e5357b4f73c0e332b080bf2834934ba2c598ed9d70518af66bd246d639998d", - "OCR2ConfigPublicKey": "ecc96cc82e2c2cd8ba6fc4028545c4568d092683a2f11821d7b41081db17f006" + "OCR2BundleID": "60a3e266ec12dfcea1aabd6e0f4587cf25b93068abacf0ef9ad2c9cafd252be3", + "OCR2OnchainPublicKey": "471664efd99f139d2803a7f39716b83aa365e58b", + "OCR2OffchainPublicKey": "71b5c032e6b15ffd11e734d434ba5f6de9297d0625894bf2ca551ddff00030fa", + "OCR2ConfigPublicKey": "ff7a86f2a43a1d6582cb286e0b8b924ccdd3efea4bf0dfb5c9853e9ab74e7779" } ], - "CSAPublicKey": "1b5c2edbc13a78d14c27d449a3d2e23f70a0fd2ff5b90b8fb97a5c5eae48b9d7" + "CSAPublicKey": "333d58563565b8fdbba3a8a85acca3242c003cb67699a3f2dca249812e3a3fde" }, { - "AptosAccount": "1f7cb7e4d5f3b5c8e776581aea0230533f133add9c83afc5244e51145eb88a3b", + "AptosAccount": "982ad8643032b9b70e75454c4a5323c470eda277d1257a666235dc1718a7ac8d", "OCR2AptosKBs": [ { - "AptosBundleID": "34d1a1886cb41418eb174de45498a0dc9ffa6edbc219c24021acc7bdfbd6cf28", - "AptosOnchainPublicKey": "fcabe4de5a7016fa9f791a2fb3f1587a40bdcee5bd008ce2399338dd12bfed25" - }, - { - "AptosBundleID": "73e363d055b649a4646cd1deccc4398c1836201e63b0e4fb984f95576da74ecb", - "AptosOnchainPublicKey": "b32030b5e2af57ec7cd19899d6db271891ac39696b08865a48deff483caed187" + "AptosBundleID": "06a4749a5c8c6f1b6d9d8e33b14e5ef2dc9cdbe6cb0d849634ca724f252be97c", + "AptosOnchainPublicKey": "747f1c41063d2ea2dc3ae4899994b63571fcc86bc76d93da320ca94b1676c779" } ], - "EthAddress": "0x8A7172a8197e18071C452ca538085Ff4Adcc6b4d", - "P2PPeerID": "12D3KooWLMFnmdZPS5zfkBsRVMrsKr3zTaFeuM48bskp5Mxnkdms", + "EthAddress": "0x04227536B548EcD5732Bb7BF72aADD9B790A84D3", + "P2PPeerID": "12D3KooWRV2RYW7mL6Ws5RdGvLVXbDnebGmS3Jy24trpU7NpHeeJ", "OCR2KBs": [ { - "OCR2BundleID": "0a7aecb6b694fbcd71cbd1932238d5fd9442fd3477916cdb0519ab2408d21b2b", - "OCR2OnchainPublicKey": "3fbcb609d650f95d62412475845bc95bf3aee54a", - "OCR2OffchainPublicKey": "222542dd828ec343d4c28410897f8a2a0d10a7c8a582ddbd1c15cdf3aa4ec067", - "OCR2ConfigPublicKey": "bf9b3d1d72f29d40a20d88dabee331db5347ed775c2ea0d06272762dcc1bf627" - }, - { - "OCR2BundleID": "32de5360efbf37a436ecbd918c9c1135c80a8d5a6e0c87343cee28f6e72a6590", - "OCR2OnchainPublicKey": "92655fa128ce5c996565fdf8477d6402faf2c11e", - "OCR2OffchainPublicKey": "0f0e3930b8a8f51550ed885354c0316583e0ac2e3d4cb3cc8638f35c4ec99c93", - "OCR2ConfigPublicKey": "972bbcf5d5144f881fddbdeffe61f4ce1cc7765ba38080798ba2f5d8d69b3b3c" + "OCR2BundleID": "55ada5113c624774c9ae9c8d319b19f9d8bdc8f71cd30f6fc303e5b5b73b4cd9", + "OCR2OnchainPublicKey": "abbed45ff9f40fffae3bebc167fb3a13a9a2118f", + "OCR2OffchainPublicKey": "ba1e42fa7146a90d6722176102bfdf224e9274e4c3282a69aef93d4313193940", + "OCR2ConfigPublicKey": "0147532bbcd485ea03d5f73d2cd24e13aa7737aaf2cfb18e76bc193619df4704" } ], - "CSAPublicKey": "1b761b910db435a879edddce790cb07225c4ff8e7d836936b480835535c1a63c" + "CSAPublicKey": "2db5ca7d498237f9069de019273d0edb4fdca613462cb8c8abf0f27770bb24b9" }, -{ - "AptosAccount": "1f7cb7e4d5f3b5c8e776581aea0230533f133add9c83afc5244e51145eb88a3b", + { + "AptosAccount": "a377f9ea7e036f4c9744279885161e554287565b8b80186a27d9e99ee6744a66", "OCR2AptosKBs": [ { - "AptosBundleID": "34d1a1886cb41418eb174de45498a0dc9ffa6edbc219c24021acc7bdfbd6cf28", - "AptosOnchainPublicKey": "fcabe4de5a7016fa9f791a2fb3f1587a40bdcee5bd008ce2399338dd12bfed25" - }, + "AptosBundleID": "c7f09c289070cb964a00dab0477d4823cdf7f7e1a280e0e397b1950add08328c", + "AptosOnchainPublicKey": "f989888a04fc41c759ee55affaac375a47a7828ac99a07f0370627a09b764e0a" + } + ], + "EthAddress": "0x567c3f356e8FE74466c548A31E7949B00c893692", + "P2PPeerID": "12D3KooWKoMmr1ABs6bhdfFS8CbiyyXsGGANucXv7UdFsWSjLcTa", + "OCR2KBs": [ { - "AptosBundleID": "73e363d055b649a4646cd1deccc4398c1836201e63b0e4fb984f95576da74ecb", - "AptosOnchainPublicKey": "b32030b5e2af57ec7cd19899d6db271891ac39696b08865a48deff483caed187" + "OCR2BundleID": "3b973173b54f51933b247b8fdf2def91251a58406aeee9c17fa3440e9ff7abf2", + "OCR2OnchainPublicKey": "fedd4acf95da74eccc1cea21a65600504fa0ccdd", + "OCR2OffchainPublicKey": "8b30b87f92cd2abe6c71b4aac9c14f720849f20d210cc17b3e99471d046bfb00", + "OCR2ConfigPublicKey": "b30ca90d285d5591e1ad8f7d8bcc1e8ca9c38951181bae28437346f9d0bfeb52" } ], - "EthAddress": "0x8A7172a8197e18071C452ca538085Ff4Adcc6b4d", - "P2PPeerID": "12D3KooWLMFnmdZPS5zfkBsRVMrsKr3zTaFeuM48bskp5Mxnkdms", + "CSAPublicKey": "94bf3754f1ecc19aaadc30d9f8c02d240e8c3fc901b899d49cf012ad23bab703" + }, + { + "AptosAccount": "5dcc44204a042b0387c65dd4a04903baad85c9a3495a22d33aaa16126e004938", + "OCR2AptosKBs": [ + { + "AptosBundleID": "8b512baedf25ad2a9b70d7c80aa163f1b5beae4e5c3eb2d17868d4a363df1122", + "AptosOnchainPublicKey": "62806ad0f350dbdafbb7ef2637f574ad584dc8a25101cd95b892ee96c10c91b9" + } + ], + "EthAddress": "0x047cd317652D0009b098740D53dEf9d166F43b6D", + "P2PPeerID": "12D3KooWBQEwEgKBXK1ENTxWY2Zrmb8xd8FkbuEUcQmfkXK69e9Z", "OCR2KBs": [ { - "OCR2BundleID": "0a7aecb6b694fbcd71cbd1932238d5fd9442fd3477916cdb0519ab2408d21b2b", - "OCR2OnchainPublicKey": "3fbcb609d650f95d62412475845bc95bf3aee54a", - "OCR2OffchainPublicKey": "222542dd828ec343d4c28410897f8a2a0d10a7c8a582ddbd1c15cdf3aa4ec067", - "OCR2ConfigPublicKey": "bf9b3d1d72f29d40a20d88dabee331db5347ed775c2ea0d06272762dcc1bf627" - }, + "OCR2BundleID": "33ba5b856c96d0ea544a0569566ff0d235ca351d4512df4e6b46feb96e1af5ce", + "OCR2OnchainPublicKey": "406f74c12df78ae220ff7eac86cd4c1a83abc96d", + "OCR2OffchainPublicKey": "ef58ac00a77c4ea583f390935ed21845c53204976e24a3d8ee33c4fd1954338a", + "OCR2ConfigPublicKey": "bb4cafa371eab8c32347d60b20f0dec91afc63628f1e553d89e3831c6c06730d" + } + ], + "CSAPublicKey": "89c75af7a6adfaa4c280ea93e63d899012b491bc8aee1f43f784e5b4a6a43ff3" + }, + { + "AptosAccount": "983737dc44ae77a346547bad41f4cee682ff3e695ddc7f0aec19a86aea1cd46e", + "OCR2AptosKBs": [ + { + "AptosBundleID": "63df29dffc814d7e6308bf9b56d54a8f006a8eed60632373dd738731a62df0fb", + "AptosOnchainPublicKey": "8432c15ff780d16babca19d2189ce95bd95a0e77cb302c5ed708d387bbf44871" + } + ], + "EthAddress": "0x4E717194f6c10089A814240c368222b60e4eA769", + "P2PPeerID": "12D3KooWMoSuKuEhwtUhYqfNbuiGGhGpHQswypYcaR6Zfk3boSpn", + "OCR2KBs": [ { - "OCR2BundleID": "32de5360efbf37a436ecbd918c9c1135c80a8d5a6e0c87343cee28f6e72a6590", - "OCR2OnchainPublicKey": "92655fa128ce5c996565fdf8477d6402faf2c11e", - "OCR2OffchainPublicKey": "0f0e3930b8a8f51550ed885354c0316583e0ac2e3d4cb3cc8638f35c4ec99c93", - "OCR2ConfigPublicKey": "972bbcf5d5144f881fddbdeffe61f4ce1cc7765ba38080798ba2f5d8d69b3b3c" + "OCR2BundleID": "0d807754b94dc781a6ebf7a10b512752986f7dac56a7f42e3938fc47715c552e", + "OCR2OnchainPublicKey": "d349911cbaacabdc55bd7d8dba32d0deee6c7152", + "OCR2OffchainPublicKey": "74da150c3cc743fa507598409b913101460f512375cf4c2505c5b20cf43ea190", + "OCR2ConfigPublicKey": "1cf7cdfcfe0a2a8c089b16d31766d6df3b70a5ae59fb4528358f9904f3dc585d" } ], - "CSAPublicKey": "1b761b910db435a879edddce790cb07225c4ff8e7d836936b480835535c1a63c" + "CSAPublicKey": "59c4e298c91198fd094ffaf079df695960d33d3366b60131149d18a14aa1d8c9" } -] +] \ No newline at end of file From a104e3d3072f626d02e22af8ce925db58e9224e0 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Sat, 19 Oct 2024 17:33:51 -0700 Subject: [PATCH 053/117] Fix argument ordering --- .../keystone/src/06_provision_capabilities_registry.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go index 714329b3a1e..8274eefaa52 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -63,9 +63,9 @@ func (c *provisionCR) Run(args []string) { reg := getOrDeployCapabilitiesRegistry(ctx, *artefactsDir, env) nodeSets := downloadNodeSets( - *publicKeys, - *chainID, *nodeList, + *chainID, + *publicKeys, *nodeSetSize, ) @@ -111,6 +111,7 @@ func nodeKeysToDON(donName string, nodeKeys []NodeKeys, capSet CapabilitySet) DO peers = append(peers, p) } return DON{ + F: 1, Name: donName, Peers: peers, CapabilitySet: capSet, From 77ea1d094605fd61c6aa9a496070bfd07d69ea43 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Sat, 19 Oct 2024 17:34:18 -0700 Subject: [PATCH 054/117] Fix nodelist sorting and evmconfig.workflow configuration --- .../src/03_gen_crib_cluster_overrides_cmd.go | 78 +++++----- ...3_gen_crib_cluster_overrides_cmd_test.snap | 141 +++++++++--------- 2 files changed, 103 insertions(+), 116 deletions(-) diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go index 060cc544a75..59ad049be33 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go @@ -113,24 +113,30 @@ func (g *generateCribClusterOverridesPreprovision) Run(args []string) { func generatePreprovisionConfig(nodeSetSize int) Helm { nodeSets := []string{"ks-wf-", "ks-str-trig-"} nodes := make(map[string]Node) - ingress := generateIngress(nodeSets, nodeSetSize) + nodeNames := []string{} + globalIndex := 0 for _, prefix := range nodeSets { // Bootstrap node - btNodeName := fmt.Sprintf("%sbt-node1", prefix) + btNodeName := fmt.Sprintf("%d-%sbt-node1", globalIndex, prefix) + nodeNames = append(nodeNames, btNodeName) nodes[btNodeName] = Node{ Image: "${runtime.images.app}", } // Other nodes for i := 2; i <= nodeSetSize; i++ { - nodeName := fmt.Sprintf("%snode%d", prefix, i) + globalIndex++ + nodeName := fmt.Sprintf("%d-%snode%d", globalIndex, prefix, i) + nodeNames = append(nodeNames, nodeName) nodes[nodeName] = Node{ Image: "${runtime.images.app}", } } } + ingress := generateIngress(nodeNames) + helm := Helm{ Chart{ HelmValues: HelmValues{ @@ -194,11 +200,14 @@ func (g *generateCribClusterOverridesPostprovision) Run(args []string) { func generatePostprovisionConfig(nodeList *string, chainID *int64, publicKeys *string, contracts deployedContracts, nodeSetSize int) Helm { nodeSets := downloadNodeSets(*nodeList, *chainID, *publicKeys, nodeSetSize) - // Prepare to build the chart nodes := make(map[string]Node) + nodeNames := []string{} + // FIXME: Ideally we just save the node list as a map and don't need to sort + globalIndex := 0 // Prepare the bootstrapper locator from the workflow NodeSet - workflowBtNodeName := fmt.Sprintf("%sbt-node1", nodeSets.Workflow.Prefix) + workflowBtNodeName := fmt.Sprintf("%d-%sbt-node1", globalIndex, nodeSets.Workflow.Prefix) + nodeNames = append(nodeNames, workflowBtNodeName) workflowBtNodeKey := nodeSets.Workflow.NodeKeys[0] // First node key as bootstrapper wfBt, err := ocrcommontypes.NewBootstrapperLocator(workflowBtNodeKey.P2PPeerID, []string{fmt.Sprintf("%s:6691", workflowBtNodeName)}) helpers.PanicErr(err) @@ -206,13 +215,15 @@ func generatePostprovisionConfig(nodeList *string, chainID *int64, publicKeys *s // Build nodes for each NodeSet for _, nodeSet := range []NodeSet{nodeSets.Workflow, nodeSets.StreamsTrigger} { // Bootstrap node - btNodeName := fmt.Sprintf("%sbt-node1", nodeSet.Prefix) + btNodeName := fmt.Sprintf("%d-%sbt-node1", globalIndex, nodeSet.Prefix) + nodeNames = append(nodeNames, btNodeName) overridesToml := generateOverridesToml( *chainID, contracts.CapabilityRegistry.Hex(), "", "", nil, + nodeSet.Name, ) nodes[btNodeName] = Node{ Image: "${runtime.images.app}", @@ -221,15 +232,16 @@ func generatePostprovisionConfig(nodeList *string, chainID *int64, publicKeys *s // Other nodes for i, nodeKey := range nodeSet.NodeKeys[1:] { // Start from second key - nodeName := fmt.Sprintf("%snode%d", nodeSet.Prefix, i+2) // +2 because numbering starts from 2 - - // Use the workflow bootstrapper locator for all nodes + globalIndex++ + nodeName := fmt.Sprintf("%d-%snode%d", globalIndex, nodeSet.Prefix, i+2) + nodeNames = append(nodeNames, nodeName) overridesToml := generateOverridesToml( *chainID, contracts.CapabilityRegistry.Hex(), nodeKey.EthAddress, contracts.ForwarderContract.Hex(), wfBt, + nodeSet.Name, ) nodes[nodeName] = Node{ Image: "${runtime.images.app}", @@ -238,7 +250,7 @@ func generatePostprovisionConfig(nodeList *string, chainID *int64, publicKeys *s } } - ingress := generateIngress([]string{nodeSets.Workflow.Prefix, nodeSets.StreamsTrigger.Prefix}, nodeSetSize) + ingress := generateIngress(nodeNames) helm := Helm{ Chart{ @@ -260,6 +272,7 @@ func generateOverridesToml( fromAddress string, forwarderAddress string, capabilitiesBootstrapper *ocrcommontypes.BootstrapperLocator, + nodeSetName string, ) string { evmConfig := &evmcfg.EVMConfig{ ChainID: big.NewI(chainID), @@ -287,9 +300,12 @@ func generateOverridesToml( if capabilitiesBootstrapper != nil { conf.Core.Capabilities.Peering.V2.DefaultBootstrappers = ptr([]ocrcommontypes.BootstrapperLocator{*capabilitiesBootstrapper}) - evmConfig.Workflow = evmcfg.Workflow{ - FromAddress: ptr(evmtypes.MustEIP55Address(fromAddress)), - ForwarderAddress: ptr(evmtypes.MustEIP55Address(forwarderAddress)), + // FIXME: Use const for names + if nodeSetName == "workflow" { + evmConfig.Workflow = evmcfg.Workflow{ + FromAddress: ptr(evmtypes.MustEIP55Address(fromAddress)), + ForwarderAddress: ptr(evmtypes.MustEIP55Address(forwarderAddress)), + } } } @@ -304,23 +320,21 @@ func generateOverridesToml( } // New function to generate Ingress -func generateIngress(nodeSetPrefixes []string, nodeSetSize int) Ingress { +func generateIngress(nodeNames []string) Ingress { var hosts []Host - for _, prefix := range nodeSetPrefixes { - // Bootstrap node - btNodeName := fmt.Sprintf("%sbt-node1", prefix) + for _, nodeName := range nodeNames { host := Host{ - Host: fmt.Sprintf("${DEVSPACE_NAMESPACE}-%s.${DEVSPACE_INGRESS_BASE_DOMAIN}", btNodeName), + Host: fmt.Sprintf("${DEVSPACE_NAMESPACE}-%s.${DEVSPACE_INGRESS_BASE_DOMAIN}", nodeName), HTTP: HTTP{ Paths: []Path{ { Path: "/", Backend: Backend{ Service: Service{ - Name: fmt.Sprintf("app-%s", btNodeName), + Name: fmt.Sprintf("app-%s", nodeName), Port: Port{ - Number: 6688, // Ensure consistency if port was intended to be same + Number: 6688, }, }, }, @@ -329,30 +343,6 @@ func generateIngress(nodeSetPrefixes []string, nodeSetSize int) Ingress { }, } hosts = append(hosts, host) - - // Other nodes - for i := 2; i <= nodeSetSize; i++ { - nodeName := fmt.Sprintf("%snode%d", prefix, i) - host := Host{ - Host: fmt.Sprintf("${DEVSPACE_NAMESPACE}-%s.${DEVSPACE_INGRESS_BASE_DOMAIN}", nodeName), - HTTP: HTTP{ - Paths: []Path{ - { - Path: "/", - Backend: Backend{ - Service: Service{ - Name: fmt.Sprintf("app-%s", nodeName), - Port: Port{ - Number: 6688, // Ensure consistency if port was intended to be same - }, - }, - }, - }, - }, - }, - } - hosts = append(hosts, host) - } } return Ingress{ diff --git a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap index 99b603637c4..3fea83ec22e 100755 --- a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap @@ -4,7 +4,7 @@ helm: values: chainlink: nodes: - ks-str-trig-bt-node1: + 0-ks-wf-bt-node1: image: ${runtime.images.app} overridesToml: | [Capabilities] @@ -21,14 +21,14 @@ helm: [[EVM]] ChainID = '1337' Nodes = [] - ks-str-trig-node2: + 1-ks-wf-node2: image: ${runtime.images.app} overridesToml: | [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -41,16 +41,16 @@ helm: Nodes = [] [EVM.Workflow] - FromAddress = '0x567c3f356e8FE74466c548A31E7949B00c893692' + FromAddress = '0x3C2060Fc4D49E531d740705Afe1ddD653599002b' ForwarderAddress = '0x0200000000000000000000000000000000000000' - ks-str-trig-node3: + 2-ks-wf-node3: image: ${runtime.images.app} overridesToml: | [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -63,16 +63,15 @@ helm: Nodes = [] [EVM.Workflow] - FromAddress = '0x047cd317652D0009b098740D53dEf9d166F43b6D' + FromAddress = '0x95274E049b640C718E967E8282D69b218752F965' ForwarderAddress = '0x0200000000000000000000000000000000000000' - ks-str-trig-node4: + 3-ks-str-trig-bt-node1: image: ${runtime.images.app} overridesToml: | [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -83,17 +82,14 @@ helm: [[EVM]] ChainID = '1337' Nodes = [] - - [EVM.Workflow] - FromAddress = '0x4E717194f6c10089A814240c368222b60e4eA769' - ForwarderAddress = '0x0200000000000000000000000000000000000000' - ks-wf-bt-node1: + 3-ks-wf-node4: image: ${runtime.images.app} overridesToml: | [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true + DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -104,14 +100,18 @@ helm: [[EVM]] ChainID = '1337' Nodes = [] - ks-wf-node2: + + [EVM.Workflow] + FromAddress = '0x9953FC232a47fbDB56df36F57712910629304761' + ForwarderAddress = '0x0200000000000000000000000000000000000000' + 4-ks-str-trig-node2: image: ${runtime.images.app} overridesToml: | [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -122,18 +122,14 @@ helm: [[EVM]] ChainID = '1337' Nodes = [] - - [EVM.Workflow] - FromAddress = '0x3C2060Fc4D49E531d740705Afe1ddD653599002b' - ForwarderAddress = '0x0200000000000000000000000000000000000000' - ks-wf-node3: + 5-ks-str-trig-node3: image: ${runtime.images.app} overridesToml: | [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -144,18 +140,14 @@ helm: [[EVM]] ChainID = '1337' Nodes = [] - - [EVM.Workflow] - FromAddress = '0x95274E049b640C718E967E8282D69b218752F965' - ForwarderAddress = '0x0200000000000000000000000000000000000000' - ks-wf-node4: + 6-ks-str-trig-node4: image: ${runtime.images.app} overridesToml: | [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -166,82 +158,87 @@ helm: [[EVM]] ChainID = '1337' Nodes = [] - - [EVM.Workflow] - FromAddress = '0x9953FC232a47fbDB56df36F57712910629304761' - ForwarderAddress = '0x0200000000000000000000000000000000000000' ingress: hosts: - - host: ${DEVSPACE_NAMESPACE}-ks-wf-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-0-ks-wf-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-0-ks-wf-bt-node1 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-0-ks-wf-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-wf-bt-node1 + name: app-0-ks-wf-bt-node1 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-wf-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-1-ks-wf-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-wf-node2 + name: app-1-ks-wf-node2 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-wf-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-2-ks-wf-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-wf-node3 + name: app-2-ks-wf-node3 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-wf-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-3-ks-wf-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-wf-node4 + name: app-3-ks-wf-node4 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-3-ks-str-trig-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-str-trig-bt-node1 + name: app-3-ks-str-trig-bt-node1 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-4-ks-str-trig-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-str-trig-node2 + name: app-4-ks-str-trig-node2 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-5-ks-str-trig-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-str-trig-node3 + name: app-5-ks-str-trig-node3 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-6-ks-str-trig-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-str-trig-node4 + name: app-6-ks-str-trig-node4 port: number: 6688 @@ -252,94 +249,94 @@ helm: values: chainlink: nodes: - ks-str-trig-bt-node1: + 0-ks-wf-bt-node1: image: ${runtime.images.app} - ks-str-trig-node2: + 2-ks-wf-node2: image: ${runtime.images.app} - ks-str-trig-node3: + 3-ks-wf-node3: image: ${runtime.images.app} - ks-str-trig-node4: + 4-ks-str-trig-bt-node1: image: ${runtime.images.app} - ks-wf-bt-node1: + 4-ks-wf-node4: image: ${runtime.images.app} - ks-wf-node2: + 6-ks-str-trig-node2: image: ${runtime.images.app} - ks-wf-node3: + 7-ks-str-trig-node3: image: ${runtime.images.app} - ks-wf-node4: + 8-ks-str-trig-node4: image: ${runtime.images.app} ingress: hosts: - - host: ${DEVSPACE_NAMESPACE}-ks-wf-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-0-ks-wf-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-wf-bt-node1 + name: app-0-ks-wf-bt-node1 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-wf-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-2-ks-wf-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-wf-node2 + name: app-2-ks-wf-node2 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-wf-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-3-ks-wf-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-wf-node3 + name: app-3-ks-wf-node3 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-wf-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-4-ks-wf-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-wf-node4 + name: app-4-ks-wf-node4 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-4-ks-str-trig-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-str-trig-bt-node1 + name: app-4-ks-str-trig-bt-node1 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-6-ks-str-trig-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-str-trig-node2 + name: app-6-ks-str-trig-node2 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-7-ks-str-trig-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-str-trig-node3 + name: app-7-ks-str-trig-node3 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-ks-str-trig-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-8-ks-str-trig-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-ks-str-trig-node4 + name: app-8-ks-str-trig-node4 port: number: 6688 From d9d25bcd48d51c802377dc9151009a342abed487 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 21 Oct 2024 18:14:44 -0700 Subject: [PATCH 055/117] Update tests --- ...3_gen_crib_cluster_overrides_cmd_test.snap | 69 ++++---- .../keystone/src/testdata/NodeList.txt | 16 +- .../keystone/src/testdata/PublicKeys.json | 160 +++++++++--------- 3 files changed, 118 insertions(+), 127 deletions(-) diff --git a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap index 3fea83ec22e..f12b168fbc5 100755 --- a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap @@ -28,7 +28,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFuJXoLEQrNxCUvkorfeJ21QDB7KDpzUqMhaXz81myztq@0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -41,7 +41,7 @@ helm: Nodes = [] [EVM.Workflow] - FromAddress = '0x3C2060Fc4D49E531d740705Afe1ddD653599002b' + FromAddress = '0x3EBb0963af707384d37c848B02D8151EB914a92d' ForwarderAddress = '0x0200000000000000000000000000000000000000' 2-ks-wf-node3: image: ${runtime.images.app} @@ -50,7 +50,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFuJXoLEQrNxCUvkorfeJ21QDB7KDpzUqMhaXz81myztq@0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -63,7 +63,7 @@ helm: Nodes = [] [EVM.Workflow] - FromAddress = '0x95274E049b640C718E967E8282D69b218752F965' + FromAddress = '0x2d40cD3f33a0aF56BD00a1a99fe1145f1dFBE5f9' ForwarderAddress = '0x0200000000000000000000000000000000000000' 3-ks-str-trig-bt-node1: image: ${runtime.images.app} @@ -89,7 +89,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFuJXoLEQrNxCUvkorfeJ21QDB7KDpzUqMhaXz81myztq@0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -102,7 +102,7 @@ helm: Nodes = [] [EVM.Workflow] - FromAddress = '0x9953FC232a47fbDB56df36F57712910629304761' + FromAddress = '0xeCbCF40dC6D0FDD2aE33FfD0e8D5aA76dFe41759' ForwarderAddress = '0x0200000000000000000000000000000000000000' 4-ks-str-trig-node2: image: ${runtime.images.app} @@ -111,7 +111,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFuJXoLEQrNxCUvkorfeJ21QDB7KDpzUqMhaXz81myztq@0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -129,7 +129,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFuJXoLEQrNxCUvkorfeJ21QDB7KDpzUqMhaXz81myztq@0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -147,7 +147,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ@0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFuJXoLEQrNxCUvkorfeJ21QDB7KDpzUqMhaXz81myztq@0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -160,15 +160,6 @@ helm: Nodes = [] ingress: hosts: - - host: ${DEVSPACE_NAMESPACE}-0-ks-wf-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} - http: - paths: - - path: / - backend: - service: - name: app-0-ks-wf-bt-node1 - port: - number: 6688 - host: ${DEVSPACE_NAMESPACE}-0-ks-wf-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: @@ -251,19 +242,19 @@ helm: nodes: 0-ks-wf-bt-node1: image: ${runtime.images.app} - 2-ks-wf-node2: + 1-ks-wf-node2: image: ${runtime.images.app} - 3-ks-wf-node3: + 2-ks-wf-node3: image: ${runtime.images.app} - 4-ks-str-trig-bt-node1: + 3-ks-str-trig-bt-node1: image: ${runtime.images.app} - 4-ks-wf-node4: + 3-ks-wf-node4: image: ${runtime.images.app} - 6-ks-str-trig-node2: + 4-ks-str-trig-node2: image: ${runtime.images.app} - 7-ks-str-trig-node3: + 5-ks-str-trig-node3: image: ${runtime.images.app} - 8-ks-str-trig-node4: + 6-ks-str-trig-node4: image: ${runtime.images.app} ingress: hosts: @@ -276,67 +267,67 @@ helm: name: app-0-ks-wf-bt-node1 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-2-ks-wf-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-1-ks-wf-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-2-ks-wf-node2 + name: app-1-ks-wf-node2 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-3-ks-wf-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-2-ks-wf-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-3-ks-wf-node3 + name: app-2-ks-wf-node3 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-4-ks-wf-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-3-ks-wf-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-4-ks-wf-node4 + name: app-3-ks-wf-node4 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-4-ks-str-trig-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-3-ks-str-trig-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-4-ks-str-trig-bt-node1 + name: app-3-ks-str-trig-bt-node1 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-6-ks-str-trig-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-4-ks-str-trig-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-6-ks-str-trig-node2 + name: app-4-ks-str-trig-node2 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-7-ks-str-trig-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-5-ks-str-trig-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-7-ks-str-trig-node3 + name: app-5-ks-str-trig-node3 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-8-ks-str-trig-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-6-ks-str-trig-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-8-ks-str-trig-node4 + name: app-6-ks-str-trig-node4 port: number: 6688 diff --git a/core/scripts/keystone/src/testdata/NodeList.txt b/core/scripts/keystone/src/testdata/NodeList.txt index 6bb0332bcd6..5e40ba2ffef 100644 --- a/core/scripts/keystone/src/testdata/NodeList.txt +++ b/core/scripts/keystone/src/testdata/NodeList.txt @@ -1,8 +1,8 @@ -https://crib-local-ks-str-trig-bt-node1.local https://crib-local-ks-str-trig-bt-node1.local app-ks-str-trig-bt-node1 app-ks-str-trig-bt-node1-bootstrap notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-ks-str-trig-node2.local https://crib-local-ks-str-trig-node2.local app-ks-str-trig-node2 app-ks-str-trig-node2 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-ks-str-trig-node3.local https://crib-local-ks-str-trig-node3.local app-ks-str-trig-node3 app-ks-str-trig-node3 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-ks-str-trig-node4.local https://crib-local-ks-str-trig-node4.local app-ks-str-trig-node4 app-ks-str-trig-node4 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-ks-wf-bt-node1.local https://crib-local-ks-wf-bt-node1.local app-ks-wf-bt-node1 app-ks-wf-bt-node1 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-ks-wf-node2.local https://crib-local-ks-wf-node2.local app-ks-wf-node2 app-ks-wf-node2 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-ks-wf-node3.local https://crib-local-ks-wf-node3.local app-ks-wf-node3 app-ks-wf-node3 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-ks-wf-node4.local https://crib-local-ks-wf-node4.local app-ks-wf-node4 app-ks-wf-node4 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-0-ks-wf-bt-node1.local https://crib-local-0-ks-wf-bt-node1.local app-0-ks-wf-bt-node1 app-0-ks-wf-bt-node1-bootstrap notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-1-ks-wf-node2.local https://crib-local-1-ks-wf-node2.local app-1-ks-wf-node2 app-1-ks-wf-node2 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-2-ks-wf-node3.local https://crib-local-2-ks-wf-node3.local app-2-ks-wf-node3 app-2-ks-wf-node3 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-3-ks-str-trig-bt-node1.local https://crib-local-3-ks-str-trig-bt-node1.local app-3-ks-str-trig-bt-node1 app-3-ks-str-trig-bt-node1 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-3-ks-wf-node4.local https://crib-local-3-ks-wf-node4.local app-3-ks-wf-node4 app-3-ks-wf-node4 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-4-ks-str-trig-node2.local https://crib-local-4-ks-str-trig-node2.local app-4-ks-str-trig-node2 app-4-ks-str-trig-node2 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-5-ks-str-trig-node3.local https://crib-local-5-ks-str-trig-node3.local app-5-ks-str-trig-node3 app-5-ks-str-trig-node3 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +https://crib-local-6-ks-str-trig-node4.local https://crib-local-6-ks-str-trig-node4.local app-6-ks-str-trig-node4 app-6-ks-str-trig-node4 notreal@fakeemail.ch fj293fbBnlQ!f9vNs diff --git a/core/scripts/keystone/src/testdata/PublicKeys.json b/core/scripts/keystone/src/testdata/PublicKeys.json index 73201dcd641..fc1a3da467b 100644 --- a/core/scripts/keystone/src/testdata/PublicKeys.json +++ b/core/scripts/keystone/src/testdata/PublicKeys.json @@ -1,162 +1,162 @@ [ { - "AptosAccount": "c3183a0dd656aaf1d1384f4c378755267a1d9a4667f018003c78298b66f266dd", + "AptosAccount": "955c9c0f6c91fc510d41019c795ae47744bb08cf33ca1ec8b785d680ce8afb63", "OCR2AptosKBs": [ { - "AptosBundleID": "21f089fc574e6f5ca51521a3df069720d7046212f64dcf2926b335f53ce49e8b", - "AptosOnchainPublicKey": "4e370df5708449a502bf6582ca4228765247a2127b050ca4135aabbe7ffd787a" + "AptosBundleID": "4650f3efb6b16abe65c75d11cf374098b44c693b442f035c94460108621d5be9", + "AptosOnchainPublicKey": "759fd0592eaf07a8d8f520aa6f5e2dabee2c3f1d85c3260e39a7ae2b65faca6e" } ], - "EthAddress": "0xC497BDE6a610C115c56cfAbb8111D071079BB88E", - "P2PPeerID": "12D3KooWPh3oNcnhBB4x6Bf8FD5Dpj5oAudvkEWWhBpMAu2NK5PZ", + "EthAddress": "0x93117f000f894D681f52650dD4B5167E6ED89af9", + "P2PPeerID": "12D3KooWFuJXoLEQrNxCUvkorfeJ21QDB7KDpzUqMhaXz81myztq", "OCR2KBs": [ { - "OCR2BundleID": "2806ea5622db94c18915ab748b401f6c37a7748cec4f59453b5f13c91f77fb4f", - "OCR2OnchainPublicKey": "192b5904f3f3770d7ec4cd05a03d9091730ebba6", - "OCR2OffchainPublicKey": "f04eda1c1887858af92da5886fa342b8685e34434f98f5e52f919e0a704dba82", - "OCR2ConfigPublicKey": "a7a573ab65aa4f748f6f777904a0570a48f233eccaf0f8ad074b06ca8279d17f" + "OCR2BundleID": "47575a9ad197157186e66036ff55159f27e2ac77f9f63d39a6489be5fc44cc7b", + "OCR2OnchainPublicKey": "cb16ed86f96ef92557b7f360f4e8dba016541674", + "OCR2OffchainPublicKey": "8d890ca92ba60bf93f008c359c05c00b811d7f6b79bc5a2805dd07a97d35a4b6", + "OCR2ConfigPublicKey": "e8b70d48899a74a6ee6e15e4557849c6f3667c6bec861574ea18900f1cff8506" } ], - "CSAPublicKey": "17e957ba4d4e655d2599734935f489833cc9f827d0d06656d7b6dd4231907aeb" + "CSAPublicKey": "a8eb022d1ff1285a3dda5714fc4bac3727dddb7fc9b08d1448dc0ebd2d1e982b" }, { - "AptosAccount": "b832659ef74b9e0eb2696f6575a3999c13d5485ee5f375c0c08be57a93b1a4a3", + "AptosAccount": "eb76f2e261bf4e7f9306dd4dcc5ea3c44eea550b2de75766e65c2020b7aaf731", "OCR2AptosKBs": [ { - "AptosBundleID": "4d0e1765eaafb83c9792758c7708a87eb80e79ac6c91c600d1bc6187448e5635", - "AptosOnchainPublicKey": "06b05974974fc9234137ef4a2faf8a53eda788a11edad35dff5879b829151c21" + "AptosBundleID": "84600682fae528361faa7f390f2ff0ebabe4304e5d9a94958ed4f6f3e8c74f58", + "AptosOnchainPublicKey": "77bc0aea7d0480d4c6984776a6d4506b7951b06a0a6072451362ac4f7bf46f6e" } ], - "EthAddress": "0x3C2060Fc4D49E531d740705Afe1ddD653599002b", - "P2PPeerID": "12D3KooWBgjEUKQgRPWri6L3StAm7CwWLat14FuZ7pFMwLcsJTa2", + "EthAddress": "0x3EBb0963af707384d37c848B02D8151EB914a92d", + "P2PPeerID": "12D3KooWGngHAjcFv56Zoyhc7BH58E6mEDqT6Aiik4oFyGKeHxsk", "OCR2KBs": [ { - "OCR2BundleID": "01b238f52458eb17adfc94cebf3f0c05080b761b0289bb6aa7ddb9455d58828a", - "OCR2OnchainPublicKey": "595c321303e3a11762229d322b6018db5eb9162a", - "OCR2OffchainPublicKey": "0f18a019f9868afcf82fb69b4d3384518e6688bcd8cac81c660e470f9d672806", - "OCR2ConfigPublicKey": "ac00546bf873d37235db69b3ee5aba9eb867bf44402281d498acdade08ad6a19" + "OCR2BundleID": "22e5e3d50fdacd39215c59cc2ac0ceae22b232362179af6176377bd2a8d896c2", + "OCR2OnchainPublicKey": "2cfe8756bfad119a58b288f35538789db29155ce", + "OCR2OffchainPublicKey": "5fc4a6ea149fd540f536b62b3693ab4ecd273ee34df838996a86462de69d597d", + "OCR2ConfigPublicKey": "44c5e538ccf178947a2419af596293f1d8b2b0628d3347885034716e2295cc7d" } ], - "CSAPublicKey": "1cd166e055f44bf63670e6d391b3efc53b59da785e70fd7cd652e1df69b3ea4a" + "CSAPublicKey": "bb17e915a251cbf5bb89c55f5f49eca52c0563b582661b9744a29e4595e5894f" }, { - "AptosAccount": "34212f58aa3f19db42a7ee24d27483d9d52f450d66bb7d2927518cb2cec71200", + "AptosAccount": "868a1cc0efdfd64dd589e234206eee4491fea43ca076c5510ceb88f534d772b3", "OCR2AptosKBs": [ { - "AptosBundleID": "3c0763dec63113f472b781c63bb01f833bda89ee579eda13c11cf90f7874b9b1", - "AptosOnchainPublicKey": "86d4ff9e1fa3dffa1225a734a13bc48d80e2295a41aa1ddfc07da7a3e85dfe60" + "AptosBundleID": "66a311d5785dc2a36bc4e164547bd4a591420e7ec97db2ca8368e859e09d1bc4", + "AptosOnchainPublicKey": "bf7f9d102ed5029b58d0d99c7396b47bc6eb1f041dc8ffa44386c630020e5758" } ], - "EthAddress": "0x95274E049b640C718E967E8282D69b218752F965", - "P2PPeerID": "12D3KooWFWvP8WwjTdVxts2ZyqMSNXqWp7Dh3C42h2YE27H41C4E", + "EthAddress": "0x2d40cD3f33a0aF56BD00a1a99fe1145f1dFBE5f9", + "P2PPeerID": "12D3KooWEm3AqVYys5L8KvctcdCQFaS6c92EdcPTYrjChXLAa4Zs", "OCR2KBs": [ { - "OCR2BundleID": "3cc4b91efa9064fe3d851022733b5de64aeca1703f85ef1a3d52106ba7b7abd8", - "OCR2OnchainPublicKey": "dcb7e121b95b7f001453826f15bf1982216c9019", - "OCR2OffchainPublicKey": "ef75aa16e1f27b8fb8c36a9896fed4a1c37d4cb30e337526de1e14e012d94369", - "OCR2ConfigPublicKey": "b5673d96fc94d04f3a4f09eb7f61dc53a6d01adaed2a39488b0aedbbd70a7160" + "OCR2BundleID": "25fbcfa5ca275c730c09a6ea6db90d1a4d721e6403aa5a3016d7afe3cd0f7f89", + "OCR2OnchainPublicKey": "a3d1863c77d7360da8d0fdf87c16030f5feea479", + "OCR2OffchainPublicKey": "5796653d522bb5a2fc31edcf5b002dac372fb0f367c549ceea640e544abae173", + "OCR2ConfigPublicKey": "0729c53713441fa9a03d54bf83090b5e4a143ecc95f508dd87c12776e47d1b34" } ], - "CSAPublicKey": "d562c752999c0a401fec8870ec9fd132edcb35a5726cad80c814097f94223a4f" + "CSAPublicKey": "3497fc093fb9b4fd8ae36fb4975d9d76cb302a011cf29c249e7ebefacd996fc0" }, { - "AptosAccount": "0377ff0a32e08ec9ccc8cb41c9ec98a80d068f9dbb982315262f30f7576cc1bd", + "AptosAccount": "ee7461cfd07f1c8d10683b4a3b157e0cd07cee227e05740d45174e573691b074", "OCR2AptosKBs": [ { - "AptosBundleID": "400e8fbd800dba3ba7c8a472cb477ebf0218d6a8c94bd069c6e6d76cbcbb6c01", - "AptosOnchainPublicKey": "f064e76c629d3676c3f14e7d8088fc335d9a8715a810cefb86e4d76167897e93" + "AptosBundleID": "66eaa3988791a33a1ebb0b28a7aa23ec840357ca5eaa9b18d1f67b60bf1c63e3", + "AptosOnchainPublicKey": "9a4e1f1ee06edc781c004b482fbcd7857b7f04a60ad0fc1c33beff979d0226eb" } ], - "EthAddress": "0x9953FC232a47fbDB56df36F57712910629304761", - "P2PPeerID": "12D3KooWRjJ8fVnQt9nMgWD8mMtfvFX4zVWR78qVcV6TKXoBXnGT", + "EthAddress": "0xeCbCF40dC6D0FDD2aE33FfD0e8D5aA76dFe41759", + "P2PPeerID": "12D3KooWCfJJKgi9DcuTfGRUpf2m8NpurRCmez5nMpswWvSHkRKR", "OCR2KBs": [ { - "OCR2BundleID": "60a3e266ec12dfcea1aabd6e0f4587cf25b93068abacf0ef9ad2c9cafd252be3", - "OCR2OnchainPublicKey": "471664efd99f139d2803a7f39716b83aa365e58b", - "OCR2OffchainPublicKey": "71b5c032e6b15ffd11e734d434ba5f6de9297d0625894bf2ca551ddff00030fa", - "OCR2ConfigPublicKey": "ff7a86f2a43a1d6582cb286e0b8b924ccdd3efea4bf0dfb5c9853e9ab74e7779" + "OCR2BundleID": "152e9c9cd093b9f507b47e62649a768fec79c3a6bd82f855b05f93702bc6e788", + "OCR2OnchainPublicKey": "88d1fa553e15612b70229fd691183b9d77a4667c", + "OCR2OffchainPublicKey": "05e235c2f898ffbbe56792f52314a3f94de483f55d7399264fec0188c42275d9", + "OCR2ConfigPublicKey": "e29aaeabc27ecfbb8318f7c78c1c66e6ebc0d0eb63cd2e8768fdf64020385666" } ], - "CSAPublicKey": "333d58563565b8fdbba3a8a85acca3242c003cb67699a3f2dca249812e3a3fde" + "CSAPublicKey": "a86ec009018bb8af75334136a41c3245a8393cdb98c553946c892a1df5499e95" }, { - "AptosAccount": "982ad8643032b9b70e75454c4a5323c470eda277d1257a666235dc1718a7ac8d", + "AptosAccount": "a97af95aa7c3c681607df04fb5caa45cd2e0590d05c37077aaad050cb33305c6", "OCR2AptosKBs": [ { - "AptosBundleID": "06a4749a5c8c6f1b6d9d8e33b14e5ef2dc9cdbe6cb0d849634ca724f252be97c", - "AptosOnchainPublicKey": "747f1c41063d2ea2dc3ae4899994b63571fcc86bc76d93da320ca94b1676c779" + "AptosBundleID": "7397b14cd4fa8d4e5d07a201a2fcc70004bc63606250525e9839365da35ae5fb", + "AptosOnchainPublicKey": "967069ff93527fe7a65ff45c8fccd824241c35a40fd89d1c292f33bd3475667e" } ], - "EthAddress": "0x04227536B548EcD5732Bb7BF72aADD9B790A84D3", - "P2PPeerID": "12D3KooWRV2RYW7mL6Ws5RdGvLVXbDnebGmS3Jy24trpU7NpHeeJ", + "EthAddress": "0x27C54b54E1B81c3ddF95336EBf40b1F261cfEb76", + "P2PPeerID": "12D3KooWDURuT5EYKxp9rJR7HHXyXMMoc5H3KsCEb3CAEtu1Jk9k", "OCR2KBs": [ { - "OCR2BundleID": "55ada5113c624774c9ae9c8d319b19f9d8bdc8f71cd30f6fc303e5b5b73b4cd9", - "OCR2OnchainPublicKey": "abbed45ff9f40fffae3bebc167fb3a13a9a2118f", - "OCR2OffchainPublicKey": "ba1e42fa7146a90d6722176102bfdf224e9274e4c3282a69aef93d4313193940", - "OCR2ConfigPublicKey": "0147532bbcd485ea03d5f73d2cd24e13aa7737aaf2cfb18e76bc193619df4704" + "OCR2BundleID": "37b2b099d6863795e9a4cb5f9f1d4068806950930d708b302254ff13e8b4f0de", + "OCR2OnchainPublicKey": "5192d2e6cdfa2e96f40195de253e1eda8ce9a319", + "OCR2OffchainPublicKey": "7c6b7bafa5e26575dd53f90d779f67552b6dc113ca81d91a425322c8a82e1553", + "OCR2ConfigPublicKey": "b06692ad6a2b713d01c116bcaa2ade15d8f00bb7206430f69db0b2db29824d67" } ], - "CSAPublicKey": "2db5ca7d498237f9069de019273d0edb4fdca613462cb8c8abf0f27770bb24b9" + "CSAPublicKey": "1fde312f3cd645e2fb2b1feea701e24eb43b44a66d6796a7f0f66177d00a0bf5" }, { - "AptosAccount": "a377f9ea7e036f4c9744279885161e554287565b8b80186a27d9e99ee6744a66", + "AptosAccount": "5d6c83043aa243d24bb2e72cd61d54ae48144077ad21d6c7bf6a2332b45592f2", "OCR2AptosKBs": [ { - "AptosBundleID": "c7f09c289070cb964a00dab0477d4823cdf7f7e1a280e0e397b1950add08328c", - "AptosOnchainPublicKey": "f989888a04fc41c759ee55affaac375a47a7828ac99a07f0370627a09b764e0a" + "AptosBundleID": "a4961b6029cb9d60f9ac25679a2b49e67fb7ed0e3561f6a60f1e1ffcbd57fa12", + "AptosOnchainPublicKey": "e7c0e318e399e3277fa4f290275fb46c980674b33cfea8ff83129b765abb2e65" } ], - "EthAddress": "0x567c3f356e8FE74466c548A31E7949B00c893692", - "P2PPeerID": "12D3KooWKoMmr1ABs6bhdfFS8CbiyyXsGGANucXv7UdFsWSjLcTa", + "EthAddress": "0xDE04983c19413ef97Fe610e031eB8Da2663b4009", + "P2PPeerID": "12D3KooWShysZ3eKei8xUg1QF8AKSFnaxkr9oHgG9p1udypHDYNy", "OCR2KBs": [ { - "OCR2BundleID": "3b973173b54f51933b247b8fdf2def91251a58406aeee9c17fa3440e9ff7abf2", - "OCR2OnchainPublicKey": "fedd4acf95da74eccc1cea21a65600504fa0ccdd", - "OCR2OffchainPublicKey": "8b30b87f92cd2abe6c71b4aac9c14f720849f20d210cc17b3e99471d046bfb00", - "OCR2ConfigPublicKey": "b30ca90d285d5591e1ad8f7d8bcc1e8ca9c38951181bae28437346f9d0bfeb52" + "OCR2BundleID": "a642e1e73b50376186962a0e15469774e8781549ab1363b7015f1bf81716bc4b", + "OCR2OnchainPublicKey": "ead5b0aedd9b54f4f7c222531bc2bb742dc1f58b", + "OCR2OffchainPublicKey": "b41e852af840c8a3d6d07db51db3833f60ed27a4d5a6af76f7b640042240250b", + "OCR2ConfigPublicKey": "db055363d3e0be891a3675174e34cdb5517e9f205e0186ff390a1ec1a5160013" } ], - "CSAPublicKey": "94bf3754f1ecc19aaadc30d9f8c02d240e8c3fc901b899d49cf012ad23bab703" + "CSAPublicKey": "8b343c68808f91548c1093fdb7de55eb95795a7da22a3468c190d9d445005c44" }, { - "AptosAccount": "5dcc44204a042b0387c65dd4a04903baad85c9a3495a22d33aaa16126e004938", + "AptosAccount": "8b1daf432f3198311302119b2aa0459e6b1ec5d69d59ef995c6bac9dde141de2", "OCR2AptosKBs": [ { - "AptosBundleID": "8b512baedf25ad2a9b70d7c80aa163f1b5beae4e5c3eb2d17868d4a363df1122", - "AptosOnchainPublicKey": "62806ad0f350dbdafbb7ef2637f574ad584dc8a25101cd95b892ee96c10c91b9" + "AptosBundleID": "4294b7e421ac4fc37503fe38b6558984d52e279935e5a07e8b1ead98a0baa85c", + "AptosOnchainPublicKey": "73c82ddc84658b949b6b65489a4732d7450152d7e3c0465a6cc832d517f4047d" } ], - "EthAddress": "0x047cd317652D0009b098740D53dEf9d166F43b6D", - "P2PPeerID": "12D3KooWBQEwEgKBXK1ENTxWY2Zrmb8xd8FkbuEUcQmfkXK69e9Z", + "EthAddress": "0xa9FA782006E5d49C4F61F77E0885D123a07d97eD", + "P2PPeerID": "12D3KooWESEgwto9jwZzoxFRUAXSynuxbd8Q9ZZskonapRW7eZJu", "OCR2KBs": [ { - "OCR2BundleID": "33ba5b856c96d0ea544a0569566ff0d235ca351d4512df4e6b46feb96e1af5ce", - "OCR2OnchainPublicKey": "406f74c12df78ae220ff7eac86cd4c1a83abc96d", - "OCR2OffchainPublicKey": "ef58ac00a77c4ea583f390935ed21845c53204976e24a3d8ee33c4fd1954338a", - "OCR2ConfigPublicKey": "bb4cafa371eab8c32347d60b20f0dec91afc63628f1e553d89e3831c6c06730d" + "OCR2BundleID": "7aca1cfcc0cff3efc73225183d8ee2ab6c6707c9ae0fe94da3c0c1bee29a52b2", + "OCR2OnchainPublicKey": "a696cd279810d5c23683b86e6ea00780a7eedc34", + "OCR2OffchainPublicKey": "8c0e5b3d158969f4f0342685df77e83f04b6309d08e555e531ced1558ccc0ad2", + "OCR2ConfigPublicKey": "c1caa2f07acd31ec1b0463ae3d080a06f2007e54282d70460be504c2c800ca51" } ], - "CSAPublicKey": "89c75af7a6adfaa4c280ea93e63d899012b491bc8aee1f43f784e5b4a6a43ff3" + "CSAPublicKey": "472348574d2de406589913fbbc691e282dde38a579d92e1076549b628b11bef5" }, { - "AptosAccount": "983737dc44ae77a346547bad41f4cee682ff3e695ddc7f0aec19a86aea1cd46e", + "AptosAccount": "4b89f4a763f4b90de59067c9d10611494da295d2faf79bbdfb9b3b801c527811", "OCR2AptosKBs": [ { - "AptosBundleID": "63df29dffc814d7e6308bf9b56d54a8f006a8eed60632373dd738731a62df0fb", - "AptosOnchainPublicKey": "8432c15ff780d16babca19d2189ce95bd95a0e77cb302c5ed708d387bbf44871" + "AptosBundleID": "36ea4de5498cce1afa6c22cf4fc01bde5a6961dda6462f73580c66aa499a6ccd", + "AptosOnchainPublicKey": "410299c65c8ab320f9b2d1c63cc0b0d445e0425aff94ec265661ebd59bf2145d" } ], - "EthAddress": "0x4E717194f6c10089A814240c368222b60e4eA769", - "P2PPeerID": "12D3KooWMoSuKuEhwtUhYqfNbuiGGhGpHQswypYcaR6Zfk3boSpn", + "EthAddress": "0xad27e34c2b86e58360766A565063Ab7F2f596a9D", + "P2PPeerID": "12D3KooWCyFyg1axsbWvU8K3sqSVYQsnSQ9KrrSYNwGR1pkJASag", "OCR2KBs": [ { - "OCR2BundleID": "0d807754b94dc781a6ebf7a10b512752986f7dac56a7f42e3938fc47715c552e", - "OCR2OnchainPublicKey": "d349911cbaacabdc55bd7d8dba32d0deee6c7152", - "OCR2OffchainPublicKey": "74da150c3cc743fa507598409b913101460f512375cf4c2505c5b20cf43ea190", - "OCR2ConfigPublicKey": "1cf7cdfcfe0a2a8c089b16d31766d6df3b70a5ae59fb4528358f9904f3dc585d" + "OCR2BundleID": "901ce496a554b3adea30c7a63b4a91e319d99831335ffe12e2cf0702e7dc08c5", + "OCR2OnchainPublicKey": "6fe16a2917d87f5d4bc727235d5c0ab32fe31e23", + "OCR2OffchainPublicKey": "fc786546985f07ef0f4c389af9dc91edcafffa51bb29b6dd71750c783ac82e3c", + "OCR2ConfigPublicKey": "2641b71c27f93fe5e4e7328e3e48dff8c1372ce432ea80c47de4b7a244eb7172" } ], - "CSAPublicKey": "59c4e298c91198fd094ffaf079df695960d33d3366b60131149d18a14aa1d8c9" + "CSAPublicKey": "a1072d02d297cfa2098367bcde4c74bbc158863707feae06a397190bcf668570" } ] \ No newline at end of file From 88448afebb28861363b5e143abd27074eb349660 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 21 Oct 2024 18:15:03 -0700 Subject: [PATCH 056/117] Assign keystone workflows to workflow nodes --- core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 4db448019d4..82fda9eeb5a 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -208,7 +208,7 @@ func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFile TargetAddress: "0x1234567890abcdef1234567890abcdef12345678", } jobSpecStr := createKeystoneWorkflowJob(workflowConfig) - for _, n := range nodeSets.StreamsTrigger.Nodes { + for _, n := range nodeSets.Workflow.Nodes { api := newNodeAPI(n) upsertJob(api, workflowConfig.JobSpecName, jobSpecStr, force) From 7138e939f90f8cb57803da1177995368faadc56e Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 21 Oct 2024 20:19:38 -0700 Subject: [PATCH 057/117] Expose capabilities on WorkflowDON --- core/scripts/keystone/src/06_provision_capabilities_registry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go index 8274eefaa52..64f6bac4d05 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -96,7 +96,7 @@ func (c *provisionCR) Run(args []string) { crProvisioner.AddNodes(ctx, nodeOperator, nodeSets.Workflow.Name) crProvisioner.AddNodes(ctx, nodeOperator, nodeSets.StreamsTrigger.Name) - crProvisioner.AddDON(ctx, nodeOperator, nodeSets.Workflow.Name, false, true) + crProvisioner.AddDON(ctx, nodeOperator, nodeSets.Workflow.Name, true, true) crProvisioner.AddDON(ctx, nodeOperator, nodeSets.StreamsTrigger.Name, true, false) } From 7f2768e247ff188b263e687c404eccde56038916 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 21 Oct 2024 20:20:36 -0700 Subject: [PATCH 058/117] Skip bootstrap node for keystone workflows --- core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 82fda9eeb5a..017c9c8a072 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -208,9 +208,8 @@ func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFile TargetAddress: "0x1234567890abcdef1234567890abcdef12345678", } jobSpecStr := createKeystoneWorkflowJob(workflowConfig) - for _, n := range nodeSets.Workflow.Nodes { + for _, n := range nodeSets.Workflow.Nodes[1:] { // skip the bootstrap node api := newNodeAPI(n) - upsertJob(api, workflowConfig.JobSpecName, jobSpecStr, force) } } From 6e6375b64b8a63bf915e62deca6490656075364b Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 21 Oct 2024 20:23:08 -0700 Subject: [PATCH 059/117] Refactor nodelists + pubkeys -> nodesets --- .../keystone/src/01_deploy_contracts_cmd.go | 22 ++-- .../keystone/src/02_deploy_jobspecs_cmd.go | 18 +-- .../src/03_deploy_streams_trigger_cmd.go | 28 ++--- .../src/03_gen_crib_cluster_overrides_cmd.go | 61 +++++----- .../03_gen_crib_cluster_overrides_cmd_test.go | 8 +- .../keystone/src/04_delete_ocr3_jobs_cmd.go | 8 +- .../keystone/src/06_deploy_workflows_cmd.go | 10 +- .../src/06_provision_capabilities_registry.go | 16 +-- .../keystone/src/07_delete_workflows_cmd.go | 10 +- core/scripts/keystone/src/88_gen_jobspecs.go | 10 +- .../keystone/src/88_gen_jobspecs_test.go | 6 +- .../keystone/src/88_gen_ocr3_config.go | 8 +- .../keystone/src/88_gen_ocr3_config_test.go | 2 +- core/scripts/keystone/src/99_app.go | 8 +- core/scripts/keystone/src/99_fetch_keys.go | 106 ++++++------------ core/scripts/keystone/src/99_files.go | 35 ++++-- core/scripts/keystone/src/99_nodes.go | 99 +++++----------- 17 files changed, 192 insertions(+), 263 deletions(-) diff --git a/core/scripts/keystone/src/01_deploy_contracts_cmd.go b/core/scripts/keystone/src/01_deploy_contracts_cmd.go index fdfa263cdfe..ad5b97fd0ce 100644 --- a/core/scripts/keystone/src/01_deploy_contracts_cmd.go +++ b/core/scripts/keystone/src/01_deploy_contracts_cmd.go @@ -54,8 +54,8 @@ func (g *deployContracts) Run(args []string) { skipFunding := fs.Bool("skipfunding", false, "skip funding the transmitters") onlySetConfig := fs.Bool("onlysetconfig", false, "set the config on the OCR3 contract without deploying the contracts or funding transmitters") dryRun := fs.Bool("dryrun", false, "dry run, don't actually deploy the contracts and do not fund transmitters") - publicKeys := fs.String("publickeys", "", "Custom public keys json location") - nodeList := fs.String("nodes", "", "Custom node list location") + nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") + keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") @@ -73,18 +73,18 @@ func (g *deployContracts) Run(args []string) { if *artefactsDir == "" { *artefactsDir = defaultArtefactsDir } - if *publicKeys == "" { - *publicKeys = defaultPublicKeys + if *nodeSetsPath == "" { + *nodeSetsPath = defaultNodeSetsPath } - if *nodeList == "" { - *nodeList = defaultNodeList + if *keylessNodeSetsPath == "" { + *keylessNodeSetsPath = defaultKeylessNodeSetsPath } os.Setenv("ETH_URL", *ethUrl) os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) os.Setenv("ACCOUNT_KEY", *accountKey) os.Setenv("INSECURE_SKIP_VERIFY", "true") - deploy(*nodeList, *publicKeys, *ocrConfigFile, *skipFunding, *dryRun, *onlySetConfig, *artefactsDir, *nodeSetSize) + deploy(*keylessNodeSetsPath, *nodeSetsPath, *ocrConfigFile, *skipFunding, *dryRun, *onlySetConfig, *artefactsDir, *nodeSetSize) } // deploy does the following: @@ -94,8 +94,8 @@ func (g *deployContracts) Run(args []string) { // 4. Writes the deployed contract addresses to a file // 5. Funds the transmitters func deploy( - nodeList string, - publicKeys string, + keylessNodeSetsPath string, + nodeSetsPath string, configFile string, skipFunding bool, dryRun bool, @@ -105,10 +105,10 @@ func deploy( ) { env := helpers.SetupEnv(false) ocrConfig := generateOCR3Config( - nodeList, + keylessNodeSetsPath, configFile, env.ChainID, - publicKeys, + nodeSetsPath, nodeSetSize, ) diff --git a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go index 6cdf00614f0..413dffccc47 100644 --- a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go +++ b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go @@ -26,8 +26,8 @@ func (g *deployJobSpecs) Run(args []string) { p2pPort := fs.Int64("p2pport", 6690, "p2p port") onlyReplay := fs.Bool("onlyreplay", false, "only replay the block from the OCR3 contract setConfig transaction") templatesLocation := fs.String("templates", "", "Custom templates location") - nodeList := fs.String("nodes", "", "Custom node list location") - publicKeys := fs.String("publickeys", "", "Custom public keys json location") + keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") + nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") @@ -45,23 +45,23 @@ func (g *deployJobSpecs) Run(args []string) { if *artefactsDir == "" { *artefactsDir = defaultArtefactsDir } - if *publicKeys == "" { - *publicKeys = defaultPublicKeys + if *nodeSetsPath == "" { + *nodeSetsPath = defaultNodeSetsPath } - if *nodeList == "" { - *nodeList = defaultNodeList + if *keylessNodeSetsPath == "" { + *keylessNodeSetsPath = defaultKeylessNodeSetsPath } if *templatesLocation == "" { *templatesLocation = "templates" } - nodes := downloadKeylessNodeSets(*nodeList, *nodeSetSize).Workflow.Nodes + nodes := downloadKeylessNodeSets(*keylessNodeSetsPath, *nodeSetSize).Workflow.Nodes deployedContracts, err := LoadDeployedContracts(*artefactsDir) PanicErr(err) jobspecs := genSpecs( - *publicKeys, - *nodeList, + *nodeSetsPath, + *keylessNodeSetsPath, *templatesLocation, *chainID, *p2pPort, deployedContracts.OCRContract.Hex(), *nodeSetSize, diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 017c9c8a072..dc6fe8ff82c 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -101,8 +101,8 @@ func (g *deployStreamsTrigger) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) chainID := fs.Int64("chainid", 1337, "chain id") ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") - nodeList := fs.String("nodes", "", "Custom node list location") - publicKeys := fs.String("publickeys", "", "Custom public keys json location") + keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") + nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") force := fs.Bool("force", false, "Force deployment") nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") @@ -119,11 +119,11 @@ func (g *deployStreamsTrigger) Run(args []string) { os.Exit(1) } - if *publicKeys == "" { - *publicKeys = defaultPublicKeys + if *nodeSetsPath == "" { + *nodeSetsPath = defaultNodeSetsPath } - if *nodeList == "" { - *nodeList = defaultNodeList + if *keylessNodeSetsPath == "" { + *keylessNodeSetsPath = defaultKeylessNodeSetsPath } os.Setenv("ETH_URL", *ethUrl) @@ -135,27 +135,27 @@ func (g *deployStreamsTrigger) Run(args []string) { setupMercuryV03( env, - *nodeList, + *keylessNodeSetsPath, *ocrConfigFile, *chainID, - *publicKeys, + *nodeSetsPath, *nodeSetSize, *force, ) } // See /core/services/ocr2/plugins/mercury/integration_test.go -func setupMercuryV03(env helpers.Environment, nodeListPath string, ocrConfigFilePath string, chainId int64, pubKeysPath string, nodeSetSize int, force bool) { +func setupMercuryV03(env helpers.Environment, keylessNodeSetsPath string, ocrConfigFilePath string, chainId int64, nodeSetsPath string, nodeSetSize int, force bool) { fmt.Printf("Deploying streams trigger for chain %d\n", chainId) fmt.Printf("Using OCR config file: %s\n", ocrConfigFilePath) - fmt.Printf("Using node list: %s\n", nodeListPath) - fmt.Printf("Using public keys: %s\n", pubKeysPath) + fmt.Printf("Using keyless node sets: %s\n", keylessNodeSetsPath) + fmt.Printf("Using public keys: %s\n", nodeSetsPath) fmt.Printf("Force: %t\n\n", force) fmt.Printf("Deploying Mercury V0.3 contracts\n") _, _, _, verifier := deployMercuryV03Contracts(env) - nodeSets := downloadNodeSets(nodeListPath, chainId, pubKeysPath, nodeSetSize) + nodeSets := downloadNodeSets(keylessNodeSetsPath, chainId, nodeSetsPath, nodeSetSize) fmt.Printf("Generating OCR3 config\n") ocrConfig := generateMercuryOCR2Config(nodeSets.StreamsTrigger.NodeKeys) @@ -251,7 +251,7 @@ func deployMercuryV03Contracts(env helpers.Environment) (linkToken *link_token_i return } -func deployOCR2JobSpecsForFeed(nca []NodeKeys, nodes []*node, verifier *verifierContract.Verifier, feed feed, chainId int64, force bool) { +func deployOCR2JobSpecsForFeed(nca []NodeKeys, nodes []*NodeWthCreds, verifier *verifierContract.Verifier, feed feed, chainId int64, force bool) { // we assign the first node as the bootstrap node for i, n := range nca { // parallel arrays @@ -276,7 +276,7 @@ func deployOCR2JobSpecsForFeed(nca []NodeKeys, nodes []*node, verifier *verifier // Prepare data for Mercury V3 Job mercuryData := MercuryV3JobSpecData{ FeedName: fmt.Sprintf("feed-%s", feed.name), - BootstrapHost: fmt.Sprintf("%s@%s:%s", nca[0].P2PPeerID, nodes[0].serviceName, "6690"), + BootstrapHost: fmt.Sprintf("%s@%s:%s", nca[0].P2PPeerID, nodes[0].DeploymentName, "6690"), VerifierAddress: verifier.Address().Hex(), Bridge: feed.bridgeName, NodeCSAKey: n.CSAPublicKey, diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go index 59ad049be33..bbaf6b5f47e 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go @@ -114,11 +114,10 @@ func generatePreprovisionConfig(nodeSetSize int) Helm { nodeSets := []string{"ks-wf-", "ks-str-trig-"} nodes := make(map[string]Node) nodeNames := []string{} - globalIndex := 0 - for _, prefix := range nodeSets { + for nodeSetIndex, prefix := range nodeSets { // Bootstrap node - btNodeName := fmt.Sprintf("%d-%sbt-node1", globalIndex, prefix) + btNodeName := fmt.Sprintf("%d-%sbt-node1", nodeSetIndex, prefix) nodeNames = append(nodeNames, btNodeName) nodes[btNodeName] = Node{ Image: "${runtime.images.app}", @@ -126,8 +125,7 @@ func generatePreprovisionConfig(nodeSetSize int) Helm { // Other nodes for i := 2; i <= nodeSetSize; i++ { - globalIndex++ - nodeName := fmt.Sprintf("%d-%snode%d", globalIndex, prefix, i) + nodeName := fmt.Sprintf("%d-%snode%d", nodeSetIndex, prefix, i) nodeNames = append(nodeNames, nodeName) nodes[nodeName] = Node{ Image: "${runtime.images.app}", @@ -160,8 +158,8 @@ func (g *generateCribClusterOverridesPostprovision) Run(args []string) { chainID := fs.Int64("chainid", 1337, "chain id") outputPath := fs.String("outpath", "-", "the path to output the generated overrides (use '-' for stdout)") nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") - publicKeys := fs.String("publickeys", "", "Custom public keys json location") - nodeList := fs.String("nodes", "", "Custom node list location") + nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") + keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") err := fs.Parse(args) @@ -173,17 +171,17 @@ func (g *generateCribClusterOverridesPostprovision) Run(args []string) { if *artefactsDir == "" { *artefactsDir = defaultArtefactsDir } - if *publicKeys == "" { - *publicKeys = defaultPublicKeys + if *nodeSetsPath == "" { + *nodeSetsPath = defaultNodeSetsPath } - if *nodeList == "" { - *nodeList = defaultNodeList + if *keylessNodeSetsPath == "" { + *keylessNodeSetsPath = defaultKeylessNodeSetsPath } contracts, err := LoadDeployedContracts(*artefactsDir) helpers.PanicErr(err) - chart := generatePostprovisionConfig(nodeList, chainID, publicKeys, contracts, *nodeSetSize) + chart := generatePostprovisionConfig(keylessNodeSetsPath, chainID, nodeSetsPath, contracts, *nodeSetSize) yamlData, err := yaml.Marshal(chart) helpers.PanicErr(err) @@ -197,50 +195,50 @@ func (g *generateCribClusterOverridesPostprovision) Run(args []string) { } } -func generatePostprovisionConfig(nodeList *string, chainID *int64, publicKeys *string, contracts deployedContracts, nodeSetSize int) Helm { - nodeSets := downloadNodeSets(*nodeList, *chainID, *publicKeys, nodeSetSize) +func generatePostprovisionConfig(keylessNodeSetsPath *string, chainID *int64, nodeSetsPath *string, contracts deployedContracts, nodeSetSize int) Helm { + nodeSets := downloadNodeSets(*keylessNodeSetsPath, *chainID, *nodeSetsPath, nodeSetSize) nodes := make(map[string]Node) nodeNames := []string{} - // FIXME: Ideally we just save the node list as a map and don't need to sort - globalIndex := 0 - - // Prepare the bootstrapper locator from the workflow NodeSet - workflowBtNodeName := fmt.Sprintf("%d-%sbt-node1", globalIndex, nodeSets.Workflow.Prefix) - nodeNames = append(nodeNames, workflowBtNodeName) - workflowBtNodeKey := nodeSets.Workflow.NodeKeys[0] // First node key as bootstrapper - wfBt, err := ocrcommontypes.NewBootstrapperLocator(workflowBtNodeKey.P2PPeerID, []string{fmt.Sprintf("%s:6691", workflowBtNodeName)}) - helpers.PanicErr(err) + var capabilitiesBootstrapper *ocrcommontypes.BootstrapperLocator // Build nodes for each NodeSet - for _, nodeSet := range []NodeSet{nodeSets.Workflow, nodeSets.StreamsTrigger} { + for nodeSetIndex, nodeSet := range []NodeSet{nodeSets.Workflow, nodeSets.StreamsTrigger} { // Bootstrap node - btNodeName := fmt.Sprintf("%d-%sbt-node1", globalIndex, nodeSet.Prefix) - nodeNames = append(nodeNames, btNodeName) + btNodeName := fmt.Sprintf("%d-%sbt-node1", nodeSetIndex, nodeSet.Prefix) + // Note this line ordering is important, + // we assign capabilitiesBootstrapper after we generate overrides so that + // we do not include the bootstrapper config to itself overridesToml := generateOverridesToml( *chainID, contracts.CapabilityRegistry.Hex(), "", "", - nil, + capabilitiesBootstrapper, nodeSet.Name, ) nodes[btNodeName] = Node{ Image: "${runtime.images.app}", OverridesToml: overridesToml, } + if nodeSet.Name == WorkflowNodeSetName { + workflowBtNodeKey := nodeSets.Workflow.NodeKeys[0] // First node key as bootstrapper + wfBt, err := ocrcommontypes.NewBootstrapperLocator(workflowBtNodeKey.P2PPeerID, []string{fmt.Sprintf("%s:6691", btNodeName)}) + helpers.PanicErr(err) + capabilitiesBootstrapper = wfBt + } + nodeNames = append(nodeNames, btNodeName) // Other nodes for i, nodeKey := range nodeSet.NodeKeys[1:] { // Start from second key - globalIndex++ - nodeName := fmt.Sprintf("%d-%snode%d", globalIndex, nodeSet.Prefix, i+2) + nodeName := fmt.Sprintf("%d-%snode%d", nodeSetIndex, nodeSet.Prefix, i+2) nodeNames = append(nodeNames, nodeName) overridesToml := generateOverridesToml( *chainID, contracts.CapabilityRegistry.Hex(), nodeKey.EthAddress, contracts.ForwarderContract.Hex(), - wfBt, + capabilitiesBootstrapper, nodeSet.Name, ) nodes[nodeName] = Node{ @@ -300,8 +298,7 @@ func generateOverridesToml( if capabilitiesBootstrapper != nil { conf.Core.Capabilities.Peering.V2.DefaultBootstrappers = ptr([]ocrcommontypes.BootstrapperLocator{*capabilitiesBootstrapper}) - // FIXME: Use const for names - if nodeSetName == "workflow" { + if nodeSetName == WorkflowNodeSetName { evmConfig.Workflow = evmcfg.Workflow{ FromAddress: ptr(evmtypes.MustEIP55Address(fromAddress)), ForwarderAddress: ptr(evmtypes.MustEIP55Address(forwarderAddress)), diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go index 719b6908bdf..583c4d71cd3 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go @@ -10,9 +10,9 @@ import ( func TestGeneratePostprovisionConfig(t *testing.T) { chainID := int64(1337) - publicKeysPath := "./testdata/PublicKeys.json" - nodeListPath := "./testdata/NodeList.txt" - + nodeSetsPath := "./testdata/node_sets.json" + keylessNodeSetsPath := "./testdata/keyless_node_sets.json" + contracts := deployedContracts{ OCRContract: [20]byte{0: 1}, ForwarderContract: [20]byte{0: 2}, @@ -22,7 +22,7 @@ func TestGeneratePostprovisionConfig(t *testing.T) { nodeSetSize := 4 - chart := generatePostprovisionConfig(&nodeListPath, &chainID, &publicKeysPath, contracts, nodeSetSize) + chart := generatePostprovisionConfig(&keylessNodeSetsPath, &chainID, &nodeSetsPath, contracts, nodeSetSize) yamlData, err := yaml.Marshal(chart) if err != nil { diff --git a/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go b/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go index e74081d3a77..590c3586ed0 100644 --- a/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go +++ b/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go @@ -41,7 +41,7 @@ func (g *deleteJobs) Name() string { func (g *deleteJobs) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) - nodeList := fs.String("nodes", "", "Custom node list location") + keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") @@ -54,8 +54,8 @@ func (g *deleteJobs) Run(args []string) { if *artefactsDir == "" { *artefactsDir = defaultArtefactsDir } - if *nodeList == "" { - *nodeList = defaultNodeList + if *keylessNodeSetsPath == "" { + *keylessNodeSetsPath = defaultKeylessNodeSetsPath } deployedContracts, err := LoadDeployedContracts(*artefactsDir) @@ -63,7 +63,7 @@ func (g *deleteJobs) Run(args []string) { fmt.Println("Error loading deployed contracts, skipping:", err) return } - nodes := downloadKeylessNodeSets(*nodeList, *nodeSetSize).Workflow.Nodes + nodes := downloadKeylessNodeSets(*keylessNodeSetsPath, *nodeSetSize).Workflow.Nodes for _, node := range nodes { api := newNodeAPI(node) diff --git a/core/scripts/keystone/src/06_deploy_workflows_cmd.go b/core/scripts/keystone/src/06_deploy_workflows_cmd.go index 6581d5a4e73..26abb28a17a 100644 --- a/core/scripts/keystone/src/06_deploy_workflows_cmd.go +++ b/core/scripts/keystone/src/06_deploy_workflows_cmd.go @@ -25,19 +25,19 @@ func (g *deployWorkflows) Name() string { func (g *deployWorkflows) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) workflowFile := fs.String("workflow", "workflow.yml", "path to workflow file") - nodeList := fs.String("nodes", "", "Custom node list location") + keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") err := fs.Parse(args) if err != nil || workflowFile == nil || *workflowFile == "" || nodeSetSize == nil || *nodeSetSize == 0 { fs.Usage() os.Exit(1) } - if *nodeList == "" { - *nodeList = defaultNodeList + if *keylessNodeSetsPath == "" { + *keylessNodeSetsPath = defaultKeylessNodeSetsPath } fmt.Println("Deploying workflows") - nodes := downloadKeylessNodeSets(*nodeList, *nodeSetSize).Workflow.Nodes + nodes := downloadKeylessNodeSets(*keylessNodeSetsPath, *nodeSetSize).Workflow.Nodes if _, err = os.Stat(*workflowFile); err != nil { PanicErr(errors.New("toml file does not exist")) @@ -49,7 +49,7 @@ func (g *deployWorkflows) Run(args []string) { } output := &bytes.Buffer{} client, app := newApp(n, output) - fmt.Println("Logging in:", n.remoteURL) + fmt.Println("Logging in:", n.RemoteURL) loginFs := flag.NewFlagSet("test", flag.ContinueOnError) loginFs.Bool("bypass-version-check", true, "") loginCtx := cli.NewContext(app, loginFs, nil) diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go index 64f6bac4d05..35c528c81ed 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -29,8 +29,8 @@ func (c *provisionCR) Run(args []string) { ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") chainID := fs.Int64("chainid", 1337, "Chain ID of the Ethereum network to deploy to") accountKey := fs.String("accountkey", "", "Private key of the account to deploy from") - publicKeys := fs.String("publickeys", "", "Custom public keys JSON location") - nodeList := fs.String("nodes", "", "Custom node list location") + nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") + keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") nodeSetSize := fs.Int("nodeSetSize", 4, "Number of nodes in a nodeset") @@ -46,11 +46,11 @@ func (c *provisionCR) Run(args []string) { if *artefactsDir == "" { *artefactsDir = defaultArtefactsDir } - if *publicKeys == "" { - *publicKeys = defaultPublicKeys + if *nodeSetsPath == "" { + *nodeSetsPath = defaultNodeSetsPath } - if *nodeList == "" { - *nodeList = defaultNodeList + if *keylessNodeSetsPath == "" { + *keylessNodeSetsPath = defaultKeylessNodeSetsPath } os.Setenv("ETH_URL", *ethUrl) @@ -63,9 +63,9 @@ func (c *provisionCR) Run(args []string) { reg := getOrDeployCapabilitiesRegistry(ctx, *artefactsDir, env) nodeSets := downloadNodeSets( - *nodeList, + *keylessNodeSetsPath, *chainID, - *publicKeys, + *nodeSetsPath, *nodeSetSize, ) diff --git a/core/scripts/keystone/src/07_delete_workflows_cmd.go b/core/scripts/keystone/src/07_delete_workflows_cmd.go index 5b5b5c3ff60..0b1260cde92 100644 --- a/core/scripts/keystone/src/07_delete_workflows_cmd.go +++ b/core/scripts/keystone/src/07_delete_workflows_cmd.go @@ -24,7 +24,7 @@ func (g *deleteWorkflows) Name() string { func (g *deleteWorkflows) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) - nodeList := fs.String("nodes", "", "Custom node list location") + keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") err := fs.Parse(args) @@ -33,17 +33,17 @@ func (g *deleteWorkflows) Run(args []string) { os.Exit(1) } - if *nodeList == "" { - *nodeList = defaultNodeList + if *keylessNodeSetsPath == "" { + *keylessNodeSetsPath = defaultKeylessNodeSetsPath } - nodes := downloadKeylessNodeSets(*nodeList, *nodeSetSize).Workflow.Nodes + nodes := downloadKeylessNodeSets(*keylessNodeSetsPath, *nodeSetSize).Workflow.Nodes for _, node := range nodes { output := &bytes.Buffer{} client, app := newApp(node, output) - fmt.Println("Logging in:", node.remoteURL) + fmt.Println("Logging in:", node.RemoteURL) loginFs := flag.NewFlagSet("test", flag.ContinueOnError) loginFs.Bool("bypass-version-check", true, "") loginCtx := cli.NewContext(app, loginFs, nil) diff --git a/core/scripts/keystone/src/88_gen_jobspecs.go b/core/scripts/keystone/src/88_gen_jobspecs.go index 15f8c63b014..b2109cbd569 100644 --- a/core/scripts/keystone/src/88_gen_jobspecs.go +++ b/core/scripts/keystone/src/88_gen_jobspecs.go @@ -27,22 +27,22 @@ type donHostSpec struct { } func genSpecs( - pubkeysPath string, - nodeListPath string, + nodeSetsPath string, + keylessNodeSetsPath string, templatesDir string, chainID int64, p2pPort int64, ocrConfigContractAddress string, nodeSetSize int, ) donHostSpec { - workflowNodes := downloadNodeSets(nodeListPath, chainID, pubkeysPath, nodeSetSize).Workflow + workflowNodes := downloadNodeSets(keylessNodeSetsPath, chainID, nodeSetsPath, nodeSetSize).Workflow workflowNodeKeys := nodeKeysToKsDeployNodeKeys(workflowNodes.NodeKeys) nodes := workflowNodes.Nodes bootstrapNode := workflowNodeKeys[0] bootstrapSpecLines, err := readLines(filepath.Join(templatesDir, bootstrapSpecTemplate)) helpers.PanicErr(err) - bootHost := nodes[0].serviceName + bootHost := nodes[0].DeploymentName bootstrapSpecLines = replacePlaceholders( bootstrapSpecLines, chainID, p2pPort, @@ -62,7 +62,7 @@ func genSpecs( ocrConfigContractAddress, bootHost, bootstrapNode, workflowNodeKeys[i], ) - oracles = append(oracles, hostSpec{oracleSpecLines, nodes[i].remoteURL.Host}) + oracles = append(oracles, hostSpec{oracleSpecLines, nodes[i].RemoteURL.Host}) } return donHostSpec{ diff --git a/core/scripts/keystone/src/88_gen_jobspecs_test.go b/core/scripts/keystone/src/88_gen_jobspecs_test.go index 94c0b009312..e632f34bff8 100644 --- a/core/scripts/keystone/src/88_gen_jobspecs_test.go +++ b/core/scripts/keystone/src/88_gen_jobspecs_test.go @@ -26,12 +26,12 @@ func (d *donHostSpec) ToString() string { } func TestGenSpecs(t *testing.T) { - pubkeysPath := "./testdata/PublicKeys.json" - nodeListPath := "./testdata/NodeList.txt" + nodeSetsPath := "./testdata/node_sets.json" + keylessNodeSetsPath := "./testdata/keyless_node_sets.json" chainID := int64(1337) p2pPort := int64(6690) contractAddress := "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" - specs := genSpecs(pubkeysPath, nodeListPath, "../templates", chainID, p2pPort, contractAddress, 4) + specs := genSpecs(nodeSetsPath, keylessNodeSetsPath, "../templates", chainID, p2pPort, contractAddress, 4) snaps.MatchSnapshot(t, specs.ToString()) } diff --git a/core/scripts/keystone/src/88_gen_ocr3_config.go b/core/scripts/keystone/src/88_gen_ocr3_config.go index 724545f30c2..eb3f7135ac1 100644 --- a/core/scripts/keystone/src/88_gen_ocr3_config.go +++ b/core/scripts/keystone/src/88_gen_ocr3_config.go @@ -7,15 +7,15 @@ import ( ) func mustReadConfig(fileName string) (output ksdeploy.TopLevelConfigSource) { - return mustParseJSON[ksdeploy.TopLevelConfigSource](fileName) + return mustReadJSON[ksdeploy.TopLevelConfigSource](fileName) } -func generateOCR3Config(nodeList string, configFile string, chainID int64, pubKeysPath string, nodeSetSize int) ksdeploy.Orc2drOracleConfig { +func generateOCR3Config(keylessNodeSetsPath string, configFile string, chainID int64, nodeSetsPath string, nodeSetSize int) ksdeploy.Orc2drOracleConfig { topLevelCfg := mustReadConfig(configFile) cfg := topLevelCfg.OracleConfig cfg.OCRSecrets = deployment.XXXGenerateTestOCRSecrets() - nodeSets := downloadNodeSets(nodeList, chainID, pubKeysPath, nodeSetSize) - c, err := ksdeploy.GenerateOCR3Config(cfg, nodeKeysToKsDeployNodeKeys(nodeSets.Workflow.NodeKeys)) + nodeSets := downloadNodeSets(keylessNodeSetsPath, chainID, nodeSetsPath, nodeSetSize) + c, err := ksdeploy.GenerateOCR3Config(cfg, nodeKeysToKsDeployNodeKeys(nodeSets.Workflow.NodeKeys[1:])) helpers.PanicErr(err) return c } diff --git a/core/scripts/keystone/src/88_gen_ocr3_config_test.go b/core/scripts/keystone/src/88_gen_ocr3_config_test.go index dd3a3eadaec..fee9f2a4953 100644 --- a/core/scripts/keystone/src/88_gen_ocr3_config_test.go +++ b/core/scripts/keystone/src/88_gen_ocr3_config_test.go @@ -10,7 +10,7 @@ import ( func TestGenerateOCR3Config(t *testing.T) { // Generate OCR3 config - config := generateOCR3Config(".cache/NodeList.txt", "./testdata/SampleConfig.json", 1337, "./testdata/PublicKeys.json", 4) + config := generateOCR3Config("./testdata/keyless_node_sets.json", "./testdata/SampleConfig.json", 1337, "./testdata/node_sets.json", 4) matchOffchainConfig := match.Custom("OffchainConfig", func(s any) (any, error) { // coerce the value to a string diff --git a/core/scripts/keystone/src/99_app.go b/core/scripts/keystone/src/99_app.go index 40a36b732b4..adca4d43887 100644 --- a/core/scripts/keystone/src/99_app.go +++ b/core/scripts/keystone/src/99_app.go @@ -30,7 +30,7 @@ func NewRedialBackoff() backoff.Backoff { } } -func newApp(n *node, writer io.Writer) (*clcmd.Shell, *cli.App) { +func newApp(n *NodeWthCreds, writer io.Writer) (*clcmd.Shell, *cli.App) { client := &clcmd.Shell{ Renderer: clcmd.RendererJSON{Writer: writer}, AppFactory: clcmd.ChainlinkAppFactory{}, @@ -43,7 +43,7 @@ func newApp(n *node, writer io.Writer) (*clcmd.Shell, *cli.App) { } app := clcmd.NewApp(client) fs := flag.NewFlagSet("blah", flag.ContinueOnError) - fs.String("remote-node-url", n.remoteURL.String(), "") + fs.String("remote-node-url", n.RemoteURL.String(), "") fs.Bool("insecure-skip-verify", true, "") helpers.PanicErr(app.Before(cli.NewContext(nil, fs, nil))) // overwrite renderer since it's set to stdout after Before() is called @@ -59,7 +59,7 @@ type nodeAPI struct { clientMethod func(*cli.Context) error } -func newNodeAPI(n *node) *nodeAPI { +func newNodeAPI(n *NodeWthCreds) *nodeAPI { output := &bytes.Buffer{} methods, app := newApp(n, output) @@ -70,7 +70,7 @@ func newNodeAPI(n *node) *nodeAPI { fs: flag.NewFlagSet("test", flag.ContinueOnError), } - fmt.Println("Logging in:", n.remoteURL) + fmt.Println("Logging in:", n.RemoteURL) loginFs := flag.NewFlagSet("test", flag.ContinueOnError) loginFs.Bool("bypass-version-check", true, "") loginCtx := cli.NewContext(app, loginFs, nil) diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index 7d4e4302dc0..f1033981e74 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "os" - "sort" "strings" "github.com/urfave/cli" @@ -20,16 +19,24 @@ import ( type KeylessNodeSet struct { Name string Prefix string - Nodes []*node + Nodes []*NodeWthCreds } // NodeSet represents a set of nodes with associated metadata. // It embeds KeylessNodeSet and includes NodeKeys. +// NodeKeys are indexed by the same order as Nodes. type NodeSet struct { KeylessNodeSet - NodeKeys []NodeKeys // Store NodeKeys if needed + NodeKeys []NodeKeys } +var ( + WorkflowNodeSetName = "workflow" + WorkflowNodeSetPrefix = "ks-wf-" + StreamsTriggerNodeSetName = "streams-trigger" + StreamsTriggerNodeSetPrefix = "ks-str-trig-" +) + // NodeSets holds the two NodeSets: Workflow and StreamsTrigger. type NodeSets struct { Workflow NodeSet @@ -38,14 +45,12 @@ type NodeSets struct { // downloadKeylessNodeSets downloads the node API credentials or loads them from disk if they already exist. // It returns a NodeSets struct without NodeKeys. -func downloadKeylessNodeSets(nodeListPath string, nodeSetSize int) NodeSets { - if _, err := os.Stat(nodeListPath); err == nil { - fmt.Println("Loading existing node host list at:", nodeListPath) - nodesList := mustReadNodesList(nodeListPath) - keylessNodeSets, err := splitNodesIntoNodeSets(nodesList, nodeSetSize) - PanicErr(err) - - return keylessNodeSets +func downloadKeylessNodeSets(keylessNodeSetPath string, nodeSetSize int) NodeSets { + if _, err := os.Stat(keylessNodeSetPath); err == nil { + fmt.Println("Loading existing keyless nodesets at:", keylessNodeSetPath) + nodeSets := mustReadJSON[NodeSets](keylessNodeSetPath) + + return nodeSets } fmt.Println("Connecting to Kubernetes to fetch node credentials...") @@ -54,59 +59,34 @@ func downloadKeylessNodeSets(nodeListPath string, nodeSetSize int) NodeSets { PanicErr(err) nodesList := clNodesWithCredsToNodes(clNodesWithCreds) - err = writeNodesList(nodeListPath, nodesList) - PanicErr(err) - if len(nodesList) == 0 { panic("no nodes found") } - keylessNodeSets, err := splitNodesIntoNodeSets(nodesList, nodeSetSize) PanicErr(err) - return keylessNodeSets -} - -func downloadNodeSets(nodeList string, chainID int64, pubKeysPath string, nodeSetSize int) NodeSets { - // Always load or fetch the node list to ensure Nodes slices are populated - nodeSetsWithoutKeys := downloadKeylessNodeSets(nodeList, nodeSetSize) - - if _, err := os.Stat(pubKeysPath); err == nil { - fmt.Println("Loading existing public keys at:", pubKeysPath) - allKeys := mustParseJSON[[]AllNodeKeys](pubKeysPath) - // Ensure there are enough keys to populate both NodeSets - if len(allKeys) < 2*nodeSetSize { - panic(fmt.Sprintf("not enough keys to populate both nodeSets: required %d, got %d", 2*nodeSetSize, len(allKeys))) - } + mustWriteJSON(keylessNodeSetPath, keylessNodeSets) - // Assign NodeKeys to Workflow NodeSet - nodeSetsWithoutKeys.Workflow.NodeKeys = convertAllKeysToNodeKeys(allKeys[:nodeSetSize]) + return keylessNodeSets +} - // Assign NodeKeys to StreamsTrigger NodeSet - nodeSetsWithoutKeys.StreamsTrigger.NodeKeys = convertAllKeysToNodeKeys(allKeys[nodeSetSize : 2*nodeSetSize]) +func downloadNodeSets(keylessNodeSetsPath string, chainID int64, nodeSetPath string, nodeSetSize int) NodeSets { + if _, err := os.Stat(nodeSetPath); err == nil { + fmt.Println("Loading existing nodesets at", nodeSetPath) + nodeSets := mustReadJSON[NodeSets](nodeSetPath) - return nodeSetsWithoutKeys + return nodeSets } - // If pubKeysPath does not exist, populate NodeKeys + nodeSetsWithoutKeys := downloadKeylessNodeSets(keylessNodeSetsPath, nodeSetSize) nodeSets := populateNodeKeys(chainID, nodeSetsWithoutKeys) - allKeys := gatherAllNodeKeys(nodeSets) - // Gather all NodeKeys to save them - marshalledNodeKeys, err := json.MarshalIndent(allKeys, "", " ") - if err != nil { - panic(err) - } - err = os.WriteFile(pubKeysPath, marshalledNodeKeys, 0600) - if err != nil { - panic(err) - } - fmt.Println("Keystone OCR2 public keys have been saved to:", pubKeysPath) + mustWriteJSON(nodeSetPath, nodeSets) return nodeSets } // splitNodesIntoNodeSets splits the nodes into NodeSets for 'workflow' and 'streams-trigger' nodeSets. -func splitNodesIntoNodeSets(nodes []*node, nodeSetSize int) (NodeSets, error) { +func splitNodesIntoNodeSets(nodes []*NodeWthCreds, nodeSetSize int) (NodeSets, error) { totalNodes := len(nodes) requiredNodes := nodeSetSize * 2 if totalNodes < requiredNodes { @@ -116,16 +96,16 @@ func splitNodesIntoNodeSets(nodes []*node, nodeSetSize int) (NodeSets, error) { return NodeSets{ Workflow: NodeSet{ KeylessNodeSet: KeylessNodeSet{ - Name: "workflow", - Prefix: "ks-wf-", + Name: WorkflowNodeSetName, + Prefix: WorkflowNodeSetPrefix, Nodes: nodes[:nodeSetSize], }, // NodeKeys will be populated later }, StreamsTrigger: NodeSet{ KeylessNodeSet: KeylessNodeSet{ - Name: "streams-trigger", - Prefix: "ks-str-trig-", + Name: StreamsTriggerNodeSetName, + Prefix: StreamsTriggerNodeSetPrefix, Nodes: nodes[nodeSetSize : nodeSetSize*2], }, // NodeKeys will be populated later @@ -172,28 +152,6 @@ func convertAllKeysToNodeKeys(allKeys []AllNodeKeys) []NodeKeys { return nodeKeys } -// clNodesWithCredsToNodes converts CLNodeCredentials to a slice of nodes. -func clNodesWithCredsToNodes(clNodesWithCreds []CLNodeCredentials) []*node { - nodes := []*node{} - for _, cl := range clNodesWithCreds { - n := node{ - url: cl.URL, - remoteURL: cl.URL, - serviceName: cl.ServiceName, - deploymentName: cl.DeploymentName, - password: cl.Password, - login: cl.Username, - } - nodes = append(nodes, &n) - } - - // Sort nodes by URL - sort.Slice(nodes, func(i, j int) bool { - return nodes[i].url.String() < nodes[j].url.String() - }) - return nodes -} - func trimmedOCR2KB(ocr2Bndl cmd.OCR2KeyBundlePresenter) OCR2KBTrimmed { return OCR2KBTrimmed{ OCR2BundleID: ocr2Bndl.ID, @@ -286,7 +244,7 @@ func (n NodeKeys) toAllNodeKeys() AllNodeKeys { } } -func mustFetchAllNodeKeys(chainId int64, nodes []*node) []AllNodeKeys { +func mustFetchAllNodeKeys(chainId int64, nodes []*NodeWthCreds) []AllNodeKeys { allNodeKeys := []AllNodeKeys{} for _, n := range nodes { diff --git a/core/scripts/keystone/src/99_files.go b/core/scripts/keystone/src/99_files.go index f1837d2379a..460e1f20f70 100644 --- a/core/scripts/keystone/src/99_files.go +++ b/core/scripts/keystone/src/99_files.go @@ -11,14 +11,13 @@ import ( ) const ( - defaultArtefactsDir = "artefacts" - defaultPublicKeys = ".cache/PublicKeys.json" - defaultNodeList = ".cache/NodeList.txt" - deployedContractsJSON = "deployed_contracts.json" - bootstrapSpecTemplate = "bootstrap.toml" + defaultArtefactsDir = "artefacts" + defaultNodeSetsPath = ".cache/node_sets.json" + defaultKeylessNodeSetsPath = ".cache/keyless_node_sets.json" + deployedContractsJSON = "deployed_contracts.json" + bootstrapSpecTemplate = "bootstrap.toml" streamsTriggerSpecTemplate = "streams_trigger.toml" - cribOverrideTemplate = "crib-overrides.yaml" - oracleSpecTemplate = "oracle.toml" + oracleSpecTemplate = "oracle.toml" ) func writeLines(lines []string, path string) error { @@ -54,19 +53,33 @@ func readLines(path string) ([]string, error) { return lines, scanner.Err() } -func mustParseJSON[T any](fileName string) (output T) { +func mustReadJSON[T any](fileName string) (output T) { jsonFile, err := os.Open(fileName) if err != nil { - panic(err) + panic(fmt.Sprintf("failed to open file at %s: %v", fileName, err)) } defer jsonFile.Close() bytes, err := io.ReadAll(jsonFile) if err != nil { - panic(err) + panic(fmt.Sprintf("failed to read file at %s: %v", fileName, err)) } err = json.Unmarshal(bytes, &output) if err != nil { - panic(err) + panic(fmt.Sprintf("failed to unmarshal data: %v", err)) } return } + +func mustWriteJSON[T any](fileName string, data T) { + jsonFile, err := os.Create(fileName) + if err != nil { + panic(fmt.Sprintf("failed to create file at %s: %v", fileName, err)) + } + defer jsonFile.Close() + encoder := json.NewEncoder(jsonFile) + encoder.SetIndent("", " ") + err = encoder.Encode(data) + if err != nil { + panic(fmt.Sprintf("failed to encode data: %v", err)) + } +} diff --git a/core/scripts/keystone/src/99_nodes.go b/core/scripts/keystone/src/99_nodes.go index e74987d5519..de21fe2cf0a 100644 --- a/core/scripts/keystone/src/99_nodes.go +++ b/core/scripts/keystone/src/99_nodes.go @@ -1,88 +1,49 @@ package src import ( - "errors" - "fmt" "net/url" - "strings" - - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + "sort" ) -type node struct { - url *url.URL - remoteURL *url.URL - serviceName string - deploymentName string - login string - password string +type NodeWthCreds struct { + URL *url.URL + RemoteURL *url.URL + ServiceName string + DeploymentName string + Login string + Password string } -func (n node) IsTerminal() bool { +func (n NodeWthCreds) IsTerminal() bool { return false } -func (n node) PasswordPrompt(p string) string { - return n.password -} - -func (n node) Prompt(p string) string { - return n.login +func (n NodeWthCreds) PasswordPrompt(p string) string { + return n.Password } -func writeNodesList(path string, nodes []*node) error { - fmt.Println("Writing nodes list to", path) - var lines []string - for _, n := range nodes { - line := fmt.Sprintf( - "%s %s %s %s %s %s", - n.url.String(), - n.remoteURL.String(), - n.serviceName, - n.deploymentName, - n.login, - n.password, - ) - lines = append(lines, line) - } - - return writeLines(lines, path) +func (n NodeWthCreds) Prompt(p string) string { + return n.Login } -func mustReadNodesList(path string) []*node { - fmt.Println("Reading nodes list from", path) - nodesList, err := readLines(path) - helpers.PanicErr(err) - - var nodes []*node - var hasBoot bool - for _, r := range nodesList { - rr := strings.TrimSpace(r) - if len(rr) == 0 { - continue - } - s := strings.Split(rr, " ") - if len(s) != 6 { - helpers.PanicErr(errors.New("wrong nodes list format: expected 6 fields per line")) - } - if strings.Contains(s[0], "boot") && hasBoot { - helpers.PanicErr(errors.New("the single boot node must come first")) +// clNodesWithCredsToNodes converts CLNodeCredentials to a slice of nodes. +func clNodesWithCredsToNodes(clNodesWithCreds []CLNodeCredentials) []*NodeWthCreds { + nodes := []*NodeWthCreds{} + for _, cl := range clNodesWithCreds { + n := NodeWthCreds{ + URL: cl.URL, + RemoteURL: cl.URL, + ServiceName: cl.ServiceName, + DeploymentName: cl.DeploymentName, + Password: cl.Password, + Login: cl.Username, } - if strings.Contains(s[0], "boot") { - hasBoot = true - } - parsedURL, err := url.Parse(s[0]) - helpers.PanicErr(err) - parsedRemoteURL, err := url.Parse(s[1]) - helpers.PanicErr(err) - nodes = append(nodes, &node{ - url: parsedURL, - remoteURL: parsedRemoteURL, - serviceName: s[2], - deploymentName: s[3], - login: s[4], - password: s[5], - }) + nodes = append(nodes, &n) } + + // Sort nodes by URL + sort.Slice(nodes, func(i, j int) bool { + return nodes[i].URL.String() < nodes[j].URL.String() + }) return nodes } From 57c89b0343fd5975fbc3acd038d4bdea3263ab27 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 21 Oct 2024 20:39:28 -0700 Subject: [PATCH 060/117] Skip adding bootstrap nodes to capability registry --- .../keystone/src/06_provision_capabilities_registry.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go index 35c528c81ed..8ad55115423 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -81,8 +81,9 @@ func (c *provisionCR) Run(args []string) { crProvisioner.AddCapabilities(ctx, streamsTriggerCapSet) crProvisioner.AddCapabilities(ctx, workflowCapSet) - workflowDON := nodeKeysToDON(nodeSets.Workflow.Name, nodeSets.Workflow.NodeKeys, workflowCapSet) - streamsTriggerDON := nodeKeysToDON(nodeSets.StreamsTrigger.Name, nodeSets.StreamsTrigger.NodeKeys, streamsTriggerCapSet) + // We skip the first node in the node set as it is the bootstrap node + workflowDON := nodeKeysToDON(nodeSets.Workflow.Name, nodeSets.Workflow.NodeKeys[1:], workflowCapSet) + streamsTriggerDON := nodeKeysToDON(nodeSets.StreamsTrigger.Name, nodeSets.StreamsTrigger.NodeKeys[1:], streamsTriggerCapSet) dons := map[string]DON{ workflowDON.Name: workflowDON, From 99655747d7a7b9febc5599befe899ea617717a5d Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 21 Oct 2024 20:44:10 -0700 Subject: [PATCH 061/117] Skip bootstrap node for mercury OCR config --- core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index dc6fe8ff82c..32b914269a6 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -158,7 +158,7 @@ func setupMercuryV03(env helpers.Environment, keylessNodeSetsPath string, ocrCon nodeSets := downloadNodeSets(keylessNodeSetsPath, chainId, nodeSetsPath, nodeSetSize) fmt.Printf("Generating OCR3 config\n") - ocrConfig := generateMercuryOCR2Config(nodeSets.StreamsTrigger.NodeKeys) + ocrConfig := generateMercuryOCR2Config(nodeSets.StreamsTrigger.NodeKeys[1:]) // skip the bootstrap node for _, feed := range feeds { fmt.Println("Configuring feeds...") From c7b9512c0a765a39b97c220538874d139062cdb5 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 21 Oct 2024 20:50:48 -0700 Subject: [PATCH 062/117] Formatting --- core/scripts/keystone/src/88_capabilities_registry.go | 1 - 1 file changed, 1 deletion(-) diff --git a/core/scripts/keystone/src/88_capabilities_registry.go b/core/scripts/keystone/src/88_capabilities_registry.go index 9ad594beff1..28597fa75dc 100644 --- a/core/scripts/keystone/src/88_capabilities_registry.go +++ b/core/scripts/keystone/src/88_capabilities_registry.go @@ -87,7 +87,6 @@ func (c *CapabilityRegistryProvisioner) testCallContract(method string, args ... } helpers.PanicErr(err) } - } // AddCapabilities takes a capability set and provisions it in the registry. From d77f14107d33d8bef66c076630e963298b304db7 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 21 Oct 2024 20:51:07 -0700 Subject: [PATCH 063/117] Fix stale print statement --- core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 32b914269a6..8c24bb7339e 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -149,7 +149,7 @@ func setupMercuryV03(env helpers.Environment, keylessNodeSetsPath string, ocrCon fmt.Printf("Deploying streams trigger for chain %d\n", chainId) fmt.Printf("Using OCR config file: %s\n", ocrConfigFilePath) fmt.Printf("Using keyless node sets: %s\n", keylessNodeSetsPath) - fmt.Printf("Using public keys: %s\n", nodeSetsPath) + fmt.Printf("Using node sets: %s\n", nodeSetsPath) fmt.Printf("Force: %t\n\n", force) fmt.Printf("Deploying Mercury V0.3 contracts\n") From 7e3c78f6ec473e287d91468d051e2d4bc4eefc0d Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 21 Oct 2024 22:11:34 -0700 Subject: [PATCH 064/117] Bump nodeset size to minimum 5 since > 2F+1 --- core/scripts/keystone/src/01_deploy_contracts_cmd.go | 2 +- core/scripts/keystone/src/02_deploy_jobspecs_cmd.go | 2 +- core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go | 2 +- .../scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go | 4 ++-- .../keystone/src/03_gen_crib_cluster_overrides_cmd_test.go | 4 ++-- core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go | 2 +- core/scripts/keystone/src/06_deploy_workflows_cmd.go | 2 +- .../keystone/src/06_provision_capabilities_registry.go | 2 +- core/scripts/keystone/src/07_delete_workflows_cmd.go | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/scripts/keystone/src/01_deploy_contracts_cmd.go b/core/scripts/keystone/src/01_deploy_contracts_cmd.go index ad5b97fd0ce..1957bd89cbd 100644 --- a/core/scripts/keystone/src/01_deploy_contracts_cmd.go +++ b/core/scripts/keystone/src/01_deploy_contracts_cmd.go @@ -57,7 +57,7 @@ func (g *deployContracts) Run(args []string) { nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") - nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") + nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") err := fs.Parse(args) diff --git a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go index 413dffccc47..75055803932 100644 --- a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go +++ b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go @@ -29,7 +29,7 @@ func (g *deployJobSpecs) Run(args []string) { keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") - nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") + nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") err := fs.Parse(args) if err != nil || chainID == nil || *chainID == 0 || p2pPort == nil || *p2pPort == 0 || onlyReplay == nil { diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 8c24bb7339e..5fb5c4371d2 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -104,7 +104,7 @@ func (g *deployStreamsTrigger) Run(args []string) { keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") force := fs.Bool("force", false, "Force deployment") - nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") + nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") accountKey := fs.String("accountkey", "", "private key of the account to deploy from") diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go index bbaf6b5f47e..bcc28395a79 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go @@ -87,7 +87,7 @@ func (g *generateCribClusterOverridesPreprovision) Name() string { func (g *generateCribClusterOverridesPreprovision) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) - nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") + nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") outputPath := fs.String("outpath", "-", "the path to output the generated overrides (use '-' for stdout)") err := fs.Parse(args) @@ -157,7 +157,7 @@ func (g *generateCribClusterOverridesPostprovision) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) chainID := fs.Int64("chainid", 1337, "chain id") outputPath := fs.String("outpath", "-", "the path to output the generated overrides (use '-' for stdout)") - nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") + nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go index 583c4d71cd3..ed822800f5a 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go @@ -20,7 +20,7 @@ func TestGeneratePostprovisionConfig(t *testing.T) { SetConfigTxBlock: 0, } - nodeSetSize := 4 + nodeSetSize := 5 chart := generatePostprovisionConfig(&keylessNodeSetsPath, &chainID, &nodeSetsPath, contracts, nodeSetSize) @@ -34,7 +34,7 @@ func TestGeneratePostprovisionConfig(t *testing.T) { } func TestGeneratePreprovisionConfig(t *testing.T) { - nodeSetSize := 4 + nodeSetSize := 5 chart := generatePreprovisionConfig(nodeSetSize) diff --git a/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go b/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go index 590c3586ed0..347d14a9f89 100644 --- a/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go +++ b/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go @@ -43,7 +43,7 @@ func (g *deleteJobs) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") - nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") + nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") err := fs.Parse(args) if err != nil { diff --git a/core/scripts/keystone/src/06_deploy_workflows_cmd.go b/core/scripts/keystone/src/06_deploy_workflows_cmd.go index 26abb28a17a..cdaacb308d1 100644 --- a/core/scripts/keystone/src/06_deploy_workflows_cmd.go +++ b/core/scripts/keystone/src/06_deploy_workflows_cmd.go @@ -26,7 +26,7 @@ func (g *deployWorkflows) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) workflowFile := fs.String("workflow", "workflow.yml", "path to workflow file") keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") - nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") + nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") err := fs.Parse(args) if err != nil || workflowFile == nil || *workflowFile == "" || nodeSetSize == nil || *nodeSetSize == 0 { fs.Usage() diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go index 8ad55115423..6ed1b8fa788 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -32,7 +32,7 @@ func (c *provisionCR) Run(args []string) { nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") - nodeSetSize := fs.Int("nodeSetSize", 4, "Number of nodes in a nodeset") + nodeSetSize := fs.Int("nodeSetSize", 5, "Number of nodes in a nodeset") err := fs.Parse(args) if err != nil || diff --git a/core/scripts/keystone/src/07_delete_workflows_cmd.go b/core/scripts/keystone/src/07_delete_workflows_cmd.go index 0b1260cde92..75d80e47fc8 100644 --- a/core/scripts/keystone/src/07_delete_workflows_cmd.go +++ b/core/scripts/keystone/src/07_delete_workflows_cmd.go @@ -25,7 +25,7 @@ func (g *deleteWorkflows) Name() string { func (g *deleteWorkflows) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") - nodeSetSize := fs.Int("nodeSetSize", 4, "number of nodes in a nodeset") + nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") err := fs.Parse(args) if err != nil { From dd1d920bc7c0e67148252258448843df4d0d2b15 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 21 Oct 2024 22:42:34 -0700 Subject: [PATCH 065/117] Use service name for DNS resolution --- core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go | 2 +- core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go | 2 +- core/scripts/keystone/src/88_gen_jobspecs.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 5fb5c4371d2..f3f62d680ac 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -276,7 +276,7 @@ func deployOCR2JobSpecsForFeed(nca []NodeKeys, nodes []*NodeWthCreds, verifier * // Prepare data for Mercury V3 Job mercuryData := MercuryV3JobSpecData{ FeedName: fmt.Sprintf("feed-%s", feed.name), - BootstrapHost: fmt.Sprintf("%s@%s:%s", nca[0].P2PPeerID, nodes[0].DeploymentName, "6690"), + BootstrapHost: fmt.Sprintf("%s@%s:%s", nca[0].P2PPeerID, nodes[0].ServiceName, "6690"), VerifierAddress: verifier.Address().Hex(), Bridge: feed.bridgeName, NodeCSAKey: n.CSAPublicKey, diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go index bcc28395a79..3d984ca9bc8 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go @@ -223,7 +223,7 @@ func generatePostprovisionConfig(keylessNodeSetsPath *string, chainID *int64, no } if nodeSet.Name == WorkflowNodeSetName { workflowBtNodeKey := nodeSets.Workflow.NodeKeys[0] // First node key as bootstrapper - wfBt, err := ocrcommontypes.NewBootstrapperLocator(workflowBtNodeKey.P2PPeerID, []string{fmt.Sprintf("%s:6691", btNodeName)}) + wfBt, err := ocrcommontypes.NewBootstrapperLocator(workflowBtNodeKey.P2PPeerID, []string{fmt.Sprintf("%s:6691", nodeSets.Workflow.Nodes[0].ServiceName)}) helpers.PanicErr(err) capabilitiesBootstrapper = wfBt } diff --git a/core/scripts/keystone/src/88_gen_jobspecs.go b/core/scripts/keystone/src/88_gen_jobspecs.go index b2109cbd569..a413033d7f2 100644 --- a/core/scripts/keystone/src/88_gen_jobspecs.go +++ b/core/scripts/keystone/src/88_gen_jobspecs.go @@ -42,7 +42,7 @@ func genSpecs( bootstrapSpecLines, err := readLines(filepath.Join(templatesDir, bootstrapSpecTemplate)) helpers.PanicErr(err) - bootHost := nodes[0].DeploymentName + bootHost := nodes[0].ServiceName bootstrapSpecLines = replacePlaceholders( bootstrapSpecLines, chainID, p2pPort, From f3f5d609896c835e269a6ebef7cd03a0b52af327 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:44:43 -0700 Subject: [PATCH 066/117] Update tests --- .../03_deploy_streams_trigger_cmd_test.snap | 23 +- ...3_gen_crib_cluster_overrides_cmd_test.snap | 183 +++++-- .../__snapshots__/88_gen_jobspecs_test.snap | 50 +- .../88_gen_ocr3_config_test.snap | 18 +- .../keystone/src/testdata/NodeList.txt | 8 - .../keystone/src/testdata/PublicKeys.json | 162 ------- .../src/testdata/keyless_node_sets.json | 336 +++++++++++++ .../keystone/src/testdata/node_sets.json | 458 ++++++++++++++++++ 8 files changed, 972 insertions(+), 266 deletions(-) delete mode 100644 core/scripts/keystone/src/testdata/NodeList.txt delete mode 100644 core/scripts/keystone/src/testdata/PublicKeys.json create mode 100644 core/scripts/keystone/src/testdata/keyless_node_sets.json create mode 100644 core/scripts/keystone/src/testdata/node_sets.json diff --git a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap index 5811e2e1876..f4fd2beede6 100755 --- a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap @@ -95,7 +95,7 @@ type = "workflow" schemaVersion = 1 name = "keystone_workflow" workflow = """ -name: "ccip_kiab" +name: "ccip_kiab1" owner: '0x1234567890abcdef1234567890abcdef12345678' triggers: - id: streams-trigger@1.0.0 @@ -114,19 +114,22 @@ consensus: - $(trigger.outputs) config: report_id: '0001' + key_id: 'evm' aggregation_method: data_feeds aggregation_config: - 'feed1': - deviation: '0.05' - heartbeat: 1800 - 'feed2': - deviation: '0.05' - heartbeat: 1800 - 'feed3': - deviation: '0.05' - heartbeat: 1800 + feeds: + 'feed1': + deviation: '0.05' + heartbeat: 1800 + 'feed2': + deviation: '0.05' + heartbeat: 1800 + 'feed3': + deviation: '0.05' + heartbeat: 1800 encoder: EVM encoder_config: + abi: "(bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports" abi: (bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports targets: diff --git a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap index f12b168fbc5..44460ebc373 100755 --- a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap @@ -21,14 +21,14 @@ helm: [[EVM]] ChainID = '1337' Nodes = [] - 1-ks-wf-node2: + 0-ks-wf-node2: image: ${runtime.images.app} overridesToml: | [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWFuJXoLEQrNxCUvkorfeJ21QDB7KDpzUqMhaXz81myztq@0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -41,16 +41,16 @@ helm: Nodes = [] [EVM.Workflow] - FromAddress = '0x3EBb0963af707384d37c848B02D8151EB914a92d' + FromAddress = '0xDA964d2Fe39E5aAE9C1226171F207e4C57c85a77' ForwarderAddress = '0x0200000000000000000000000000000000000000' - 2-ks-wf-node3: + 0-ks-wf-node3: image: ${runtime.images.app} overridesToml: | [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWFuJXoLEQrNxCUvkorfeJ21QDB7KDpzUqMhaXz81myztq@0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -63,15 +63,16 @@ helm: Nodes = [] [EVM.Workflow] - FromAddress = '0x2d40cD3f33a0aF56BD00a1a99fe1145f1dFBE5f9' + FromAddress = '0xc8Cf02aF00b435c5F2311B9F158D9b69226116C3' ForwarderAddress = '0x0200000000000000000000000000000000000000' - 3-ks-str-trig-bt-node1: + 0-ks-wf-node4: image: ${runtime.images.app} overridesToml: | [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true + DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -82,14 +83,18 @@ helm: [[EVM]] ChainID = '1337' Nodes = [] - 3-ks-wf-node4: + + [EVM.Workflow] + FromAddress = '0xAbACcde3e1e6916cE46AB2472AB788941f1ce088' + ForwarderAddress = '0x0200000000000000000000000000000000000000' + 0-ks-wf-node5: image: ${runtime.images.app} overridesToml: | [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWFuJXoLEQrNxCUvkorfeJ21QDB7KDpzUqMhaXz81myztq@0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -102,16 +107,16 @@ helm: Nodes = [] [EVM.Workflow] - FromAddress = '0xeCbCF40dC6D0FDD2aE33FfD0e8D5aA76dFe41759' + FromAddress = '0xB81D8e06Cf34347D22776D1Db67011aBD43ae07D' ForwarderAddress = '0x0200000000000000000000000000000000000000' - 4-ks-str-trig-node2: + 1-ks-str-trig-bt-node1: image: ${runtime.images.app} overridesToml: | [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWFuJXoLEQrNxCUvkorfeJ21QDB7KDpzUqMhaXz81myztq@0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -122,14 +127,14 @@ helm: [[EVM]] ChainID = '1337' Nodes = [] - 5-ks-str-trig-node3: + 1-ks-str-trig-node2: image: ${runtime.images.app} overridesToml: | [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWFuJXoLEQrNxCUvkorfeJ21QDB7KDpzUqMhaXz81myztq@0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -140,14 +145,50 @@ helm: [[EVM]] ChainID = '1337' Nodes = [] - 6-ks-str-trig-node4: + 1-ks-str-trig-node3: image: ${runtime.images.app} overridesToml: | [Capabilities] [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWFuJXoLEQrNxCUvkorfeJ21QDB7KDpzUqMhaXz81myztq@0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0x0300000000000000000000000000000000000000' + NetworkID = 'evm' + ChainID = '1337' + + [[EVM]] + ChainID = '1337' + Nodes = [] + 1-ks-str-trig-node4: + image: ${runtime.images.app} + overridesToml: | + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] + ListenAddresses = ['0.0.0.0:6691'] + + [Capabilities.ExternalRegistry] + Address = '0x0300000000000000000000000000000000000000' + NetworkID = 'evm' + ChainID = '1337' + + [[EVM]] + ChainID = '1337' + Nodes = [] + 1-ks-str-trig-node5: + image: ${runtime.images.app} + overridesToml: | + [Capabilities] + [Capabilities.Peering] + [Capabilities.Peering.V2] + Enabled = true + DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -169,67 +210,85 @@ helm: name: app-0-ks-wf-bt-node1 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-1-ks-wf-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-0-ks-wf-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-0-ks-wf-node2 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-0-ks-wf-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-0-ks-wf-node3 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-0-ks-wf-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-1-ks-wf-node2 + name: app-0-ks-wf-node4 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-2-ks-wf-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-0-ks-wf-node5.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-2-ks-wf-node3 + name: app-0-ks-wf-node5 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-3-ks-wf-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-1-ks-str-trig-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-3-ks-wf-node4 + name: app-1-ks-str-trig-bt-node1 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-3-ks-str-trig-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-1-ks-str-trig-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-3-ks-str-trig-bt-node1 + name: app-1-ks-str-trig-node2 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-4-ks-str-trig-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-1-ks-str-trig-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-4-ks-str-trig-node2 + name: app-1-ks-str-trig-node3 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-5-ks-str-trig-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-1-ks-str-trig-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-5-ks-str-trig-node3 + name: app-1-ks-str-trig-node4 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-6-ks-str-trig-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-1-ks-str-trig-node5.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-6-ks-str-trig-node4 + name: app-1-ks-str-trig-node5 port: number: 6688 @@ -242,19 +301,23 @@ helm: nodes: 0-ks-wf-bt-node1: image: ${runtime.images.app} - 1-ks-wf-node2: + 0-ks-wf-node2: image: ${runtime.images.app} - 2-ks-wf-node3: + 0-ks-wf-node3: image: ${runtime.images.app} - 3-ks-str-trig-bt-node1: + 0-ks-wf-node4: image: ${runtime.images.app} - 3-ks-wf-node4: + 0-ks-wf-node5: image: ${runtime.images.app} - 4-ks-str-trig-node2: + 1-ks-str-trig-bt-node1: image: ${runtime.images.app} - 5-ks-str-trig-node3: + 1-ks-str-trig-node2: image: ${runtime.images.app} - 6-ks-str-trig-node4: + 1-ks-str-trig-node3: + image: ${runtime.images.app} + 1-ks-str-trig-node4: + image: ${runtime.images.app} + 1-ks-str-trig-node5: image: ${runtime.images.app} ingress: hosts: @@ -267,67 +330,85 @@ helm: name: app-0-ks-wf-bt-node1 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-1-ks-wf-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-0-ks-wf-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-0-ks-wf-node2 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-0-ks-wf-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: app-0-ks-wf-node3 + port: + number: 6688 + - host: ${DEVSPACE_NAMESPACE}-0-ks-wf-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-1-ks-wf-node2 + name: app-0-ks-wf-node4 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-2-ks-wf-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-0-ks-wf-node5.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-2-ks-wf-node3 + name: app-0-ks-wf-node5 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-3-ks-wf-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-1-ks-str-trig-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-3-ks-wf-node4 + name: app-1-ks-str-trig-bt-node1 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-3-ks-str-trig-bt-node1.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-1-ks-str-trig-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-3-ks-str-trig-bt-node1 + name: app-1-ks-str-trig-node2 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-4-ks-str-trig-node2.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-1-ks-str-trig-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-4-ks-str-trig-node2 + name: app-1-ks-str-trig-node3 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-5-ks-str-trig-node3.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-1-ks-str-trig-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-5-ks-str-trig-node3 + name: app-1-ks-str-trig-node4 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-6-ks-str-trig-node4.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-1-ks-str-trig-node5.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: app-6-ks-str-trig-node4 + name: app-1-ks-str-trig-node5 port: number: 6688 diff --git a/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap b/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap index d4ebf2fd227..87b635876d4 100755 --- a/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap +++ b/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap @@ -1,7 +1,7 @@ [TestGenSpecs - 1] Bootstrap: -Host: app-node1 +Host: app-0-ks-wf-bt-node1 type = "bootstrap" schemaVersion = 1 name = "Keystone boot" @@ -14,18 +14,18 @@ providerType = "ocr3-capability" Oracles: Oracle 0: -Host: crib-local-node2.local +Host: crib-local-0-ks-wf-node2.local type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "0332308cdef793a3892f5fa70b1c3d42efe69054b6da2bb77e6b696e5fa351cd" +ocrKeyBundleID = "e5c943f6bccc202dfd94ac4727f3263d3fbf90a61210fb36bdab46b8868866bc" p2pv2Bootstrappers = [ - "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6690", + "12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0x7848602Cb94A5c2F443886540f03e831f916eC84" +transmitterID = "0xDA964d2Fe39E5aAE9C1226171F207e4C57c85a77" [relayConfig] chainID = "1337" @@ -40,23 +40,23 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "0332308cdef793a3892f5fa70b1c3d42efe69054b6da2bb77e6b696e5fa351cd" -aptos = "a8991d329d512dd97fc7ebc94e92fb6f4407285b8235a469efbf3d9df8de5544" +evm = "e5c943f6bccc202dfd94ac4727f3263d3fbf90a61210fb36bdab46b8868866bc" +aptos = "264ab5c3053ced6966e224ba928c2302749c428ddc4878ee3b3e84f812ba19d5" -------------------------------- Oracle 1: -Host: crib-local-node3.local +Host: crib-local-0-ks-wf-node3.local type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "18b264b12430cf7f706b95e6323b10abc5225cac0ebceb60d1312dae3359b4c9" +ocrKeyBundleID = "5682657c3c43cbe56e5b3b0134630987637d4815a0acac7e657c399f500756be" p2pv2Bootstrappers = [ - "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6690", + "12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0x920ed6548FD46729d89a57Afe382F14Fa553FE47" +transmitterID = "0xc8Cf02aF00b435c5F2311B9F158D9b69226116C3" [relayConfig] chainID = "1337" @@ -71,23 +71,23 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "18b264b12430cf7f706b95e6323b10abc5225cac0ebceb60d1312dae3359b4c9" -aptos = "378e3e6cc29171c29a98f977ff3d3b1cd0e7175a9d855f8106143bc23a577b19" +evm = "5682657c3c43cbe56e5b3b0134630987637d4815a0acac7e657c399f500756be" +aptos = "2b6d59d0957e9b6bf821be3fda1976c8d9944bebe6c66f0b0405bf5bf4cca40a" -------------------------------- Oracle 2: -Host: crib-local-node4.local +Host: crib-local-0-ks-wf-node4.local type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "6cee0022d1a0b307f73b3eac9a1d69b23db1deba30bfc8f53ab293523bbd6400" +ocrKeyBundleID = "ec1f8a0a941474ef0313e61cff67aa622d64cbb079c00abca93672c5caf9438e" p2pv2Bootstrappers = [ - "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6690", + "12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0x385aCC980734af138774451811d7A4eC5057EC2E" +transmitterID = "0xAbACcde3e1e6916cE46AB2472AB788941f1ce088" [relayConfig] chainID = "1337" @@ -102,23 +102,23 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "6cee0022d1a0b307f73b3eac9a1d69b23db1deba30bfc8f53ab293523bbd6400" -aptos = "8c8257b4838193409bd96bf9168c60ecc1e217363af9312d5c0db26b181f9e6f" +evm = "ec1f8a0a941474ef0313e61cff67aa622d64cbb079c00abca93672c5caf9438e" +aptos = "e506f4bc2a7a886534617018b77cccb9e9823545e07c14f3cab04028966c44e7" -------------------------------- Oracle 3: -Host: crib-local-node5.local +Host: crib-local-0-ks-wf-node5.local type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "0a7aecb6b694fbcd71cbd1932238d5fd9442fd3477916cdb0519ab2408d21b2b" +ocrKeyBundleID = "0bdb79dc47a775ff16ff11047505d409d0e83de4f078dca915a4361241a753b4" p2pv2Bootstrappers = [ - "12D3KooWD2zhEVZHuCPSrXyC1iRuN63NH9FW3tu3Fe9K97xu3DU2@app-node1:6690", + "12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0x8A7172a8197e18071C452ca538085Ff4Adcc6b4d" +transmitterID = "0xB81D8e06Cf34347D22776D1Db67011aBD43ae07D" [relayConfig] chainID = "1337" @@ -133,8 +133,8 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "0a7aecb6b694fbcd71cbd1932238d5fd9442fd3477916cdb0519ab2408d21b2b" -aptos = "34d1a1886cb41418eb174de45498a0dc9ffa6edbc219c24021acc7bdfbd6cf28" +evm = "0bdb79dc47a775ff16ff11047505d409d0e83de4f078dca915a4361241a753b4" +aptos = "54e51e786ad29fa4d5ea4e9215f7f09d5eb8625a2b9895ac4c1548beb1341e2a" --- diff --git a/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap b/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap index 8ba7ad24438..3e27f7d6397 100755 --- a/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap +++ b/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap @@ -6,18 +6,16 @@ "OffchainConfigVersion": 30, "OnchainConfig": "0x", "Signers": [ - "011400f118b71c49bfa24fcf9aa177bb1a8ca43da9bcb905200038f58b8b3762d5a7949ab3ea8caae7103b93d3ab9f1475fe2419a61ffe3721c3", - "011400ff13a76b8f95705bce6f9fd1722814102964782605200024278247322fc734ad036c32e63d1a088204948eb1a08c2b9b2a2e13b9db39af", - "0114005b7e53d88cf57f415a463f9dcac1a19eea332ee6052000c5ae8795aef0b0f01947343b3b48c052ba1a695e31401ce7b1cb8f2e74d201ce", - "011400689d45e7e7b3b2bfcddb2714bf4b296767794727052000ea21c61bcb7768010c997b84fbb34f84010216da3b1fb93f0a78c09969314917", - "0114003fbcb609d650f95d62412475845bc95bf3aee54a052000fcabe4de5a7016fa9f791a2fb3f1587a40bdcee5bd008ce2399338dd12bfed25" + "0114003a6096c5d2101a6e80831ab7f2487a134add5a6205200065523a44b882753ced0eb96aa34c73c5d43a1c47a59f0542a0cb37346f392f07", + "01140077c2410a03b29fe22171ba322637e1f3f0d6a9390520008e340cc57026d3c8ee171dc972f1ca9ea8f772672245ec8607c48636f0a8a381", + "011400390a4d631cd08f83eacf7a9e4475d2b2a9ccc1c7052000900890fb1e8b55f69699098567bdec761b068cd258d696d4fce60881546001b4", + "011400b19d0be1065fa4a87cc4b817da70bb63a75b2fb30520006e42e0650e3b11aca5c59d04f5f7f5ce0048604abdf09f78c1b91aaf543d90b7" ], "Transmitters": [ - "0xAB61281B74DadFcCccF06Fb0F8406018683a39E5", - "0x7848602Cb94A5c2F443886540f03e831f916eC84", - "0x920ed6548FD46729d89a57Afe382F14Fa553FE47", - "0x385aCC980734af138774451811d7A4eC5057EC2E", - "0x8A7172a8197e18071C452ca538085Ff4Adcc6b4d" + "0xDA964d2Fe39E5aAE9C1226171F207e4C57c85a77", + "0xc8Cf02aF00b435c5F2311B9F158D9b69226116C3", + "0xAbACcde3e1e6916cE46AB2472AB788941f1ce088", + "0xB81D8e06Cf34347D22776D1Db67011aBD43ae07D" ] } --- diff --git a/core/scripts/keystone/src/testdata/NodeList.txt b/core/scripts/keystone/src/testdata/NodeList.txt deleted file mode 100644 index 5e40ba2ffef..00000000000 --- a/core/scripts/keystone/src/testdata/NodeList.txt +++ /dev/null @@ -1,8 +0,0 @@ -https://crib-local-0-ks-wf-bt-node1.local https://crib-local-0-ks-wf-bt-node1.local app-0-ks-wf-bt-node1 app-0-ks-wf-bt-node1-bootstrap notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-1-ks-wf-node2.local https://crib-local-1-ks-wf-node2.local app-1-ks-wf-node2 app-1-ks-wf-node2 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-2-ks-wf-node3.local https://crib-local-2-ks-wf-node3.local app-2-ks-wf-node3 app-2-ks-wf-node3 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-3-ks-str-trig-bt-node1.local https://crib-local-3-ks-str-trig-bt-node1.local app-3-ks-str-trig-bt-node1 app-3-ks-str-trig-bt-node1 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-3-ks-wf-node4.local https://crib-local-3-ks-wf-node4.local app-3-ks-wf-node4 app-3-ks-wf-node4 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-4-ks-str-trig-node2.local https://crib-local-4-ks-str-trig-node2.local app-4-ks-str-trig-node2 app-4-ks-str-trig-node2 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-5-ks-str-trig-node3.local https://crib-local-5-ks-str-trig-node3.local app-5-ks-str-trig-node3 app-5-ks-str-trig-node3 notreal@fakeemail.ch fj293fbBnlQ!f9vNs -https://crib-local-6-ks-str-trig-node4.local https://crib-local-6-ks-str-trig-node4.local app-6-ks-str-trig-node4 app-6-ks-str-trig-node4 notreal@fakeemail.ch fj293fbBnlQ!f9vNs diff --git a/core/scripts/keystone/src/testdata/PublicKeys.json b/core/scripts/keystone/src/testdata/PublicKeys.json deleted file mode 100644 index fc1a3da467b..00000000000 --- a/core/scripts/keystone/src/testdata/PublicKeys.json +++ /dev/null @@ -1,162 +0,0 @@ -[ - { - "AptosAccount": "955c9c0f6c91fc510d41019c795ae47744bb08cf33ca1ec8b785d680ce8afb63", - "OCR2AptosKBs": [ - { - "AptosBundleID": "4650f3efb6b16abe65c75d11cf374098b44c693b442f035c94460108621d5be9", - "AptosOnchainPublicKey": "759fd0592eaf07a8d8f520aa6f5e2dabee2c3f1d85c3260e39a7ae2b65faca6e" - } - ], - "EthAddress": "0x93117f000f894D681f52650dD4B5167E6ED89af9", - "P2PPeerID": "12D3KooWFuJXoLEQrNxCUvkorfeJ21QDB7KDpzUqMhaXz81myztq", - "OCR2KBs": [ - { - "OCR2BundleID": "47575a9ad197157186e66036ff55159f27e2ac77f9f63d39a6489be5fc44cc7b", - "OCR2OnchainPublicKey": "cb16ed86f96ef92557b7f360f4e8dba016541674", - "OCR2OffchainPublicKey": "8d890ca92ba60bf93f008c359c05c00b811d7f6b79bc5a2805dd07a97d35a4b6", - "OCR2ConfigPublicKey": "e8b70d48899a74a6ee6e15e4557849c6f3667c6bec861574ea18900f1cff8506" - } - ], - "CSAPublicKey": "a8eb022d1ff1285a3dda5714fc4bac3727dddb7fc9b08d1448dc0ebd2d1e982b" - }, - { - "AptosAccount": "eb76f2e261bf4e7f9306dd4dcc5ea3c44eea550b2de75766e65c2020b7aaf731", - "OCR2AptosKBs": [ - { - "AptosBundleID": "84600682fae528361faa7f390f2ff0ebabe4304e5d9a94958ed4f6f3e8c74f58", - "AptosOnchainPublicKey": "77bc0aea7d0480d4c6984776a6d4506b7951b06a0a6072451362ac4f7bf46f6e" - } - ], - "EthAddress": "0x3EBb0963af707384d37c848B02D8151EB914a92d", - "P2PPeerID": "12D3KooWGngHAjcFv56Zoyhc7BH58E6mEDqT6Aiik4oFyGKeHxsk", - "OCR2KBs": [ - { - "OCR2BundleID": "22e5e3d50fdacd39215c59cc2ac0ceae22b232362179af6176377bd2a8d896c2", - "OCR2OnchainPublicKey": "2cfe8756bfad119a58b288f35538789db29155ce", - "OCR2OffchainPublicKey": "5fc4a6ea149fd540f536b62b3693ab4ecd273ee34df838996a86462de69d597d", - "OCR2ConfigPublicKey": "44c5e538ccf178947a2419af596293f1d8b2b0628d3347885034716e2295cc7d" - } - ], - "CSAPublicKey": "bb17e915a251cbf5bb89c55f5f49eca52c0563b582661b9744a29e4595e5894f" - }, - { - "AptosAccount": "868a1cc0efdfd64dd589e234206eee4491fea43ca076c5510ceb88f534d772b3", - "OCR2AptosKBs": [ - { - "AptosBundleID": "66a311d5785dc2a36bc4e164547bd4a591420e7ec97db2ca8368e859e09d1bc4", - "AptosOnchainPublicKey": "bf7f9d102ed5029b58d0d99c7396b47bc6eb1f041dc8ffa44386c630020e5758" - } - ], - "EthAddress": "0x2d40cD3f33a0aF56BD00a1a99fe1145f1dFBE5f9", - "P2PPeerID": "12D3KooWEm3AqVYys5L8KvctcdCQFaS6c92EdcPTYrjChXLAa4Zs", - "OCR2KBs": [ - { - "OCR2BundleID": "25fbcfa5ca275c730c09a6ea6db90d1a4d721e6403aa5a3016d7afe3cd0f7f89", - "OCR2OnchainPublicKey": "a3d1863c77d7360da8d0fdf87c16030f5feea479", - "OCR2OffchainPublicKey": "5796653d522bb5a2fc31edcf5b002dac372fb0f367c549ceea640e544abae173", - "OCR2ConfigPublicKey": "0729c53713441fa9a03d54bf83090b5e4a143ecc95f508dd87c12776e47d1b34" - } - ], - "CSAPublicKey": "3497fc093fb9b4fd8ae36fb4975d9d76cb302a011cf29c249e7ebefacd996fc0" - }, - { - "AptosAccount": "ee7461cfd07f1c8d10683b4a3b157e0cd07cee227e05740d45174e573691b074", - "OCR2AptosKBs": [ - { - "AptosBundleID": "66eaa3988791a33a1ebb0b28a7aa23ec840357ca5eaa9b18d1f67b60bf1c63e3", - "AptosOnchainPublicKey": "9a4e1f1ee06edc781c004b482fbcd7857b7f04a60ad0fc1c33beff979d0226eb" - } - ], - "EthAddress": "0xeCbCF40dC6D0FDD2aE33FfD0e8D5aA76dFe41759", - "P2PPeerID": "12D3KooWCfJJKgi9DcuTfGRUpf2m8NpurRCmez5nMpswWvSHkRKR", - "OCR2KBs": [ - { - "OCR2BundleID": "152e9c9cd093b9f507b47e62649a768fec79c3a6bd82f855b05f93702bc6e788", - "OCR2OnchainPublicKey": "88d1fa553e15612b70229fd691183b9d77a4667c", - "OCR2OffchainPublicKey": "05e235c2f898ffbbe56792f52314a3f94de483f55d7399264fec0188c42275d9", - "OCR2ConfigPublicKey": "e29aaeabc27ecfbb8318f7c78c1c66e6ebc0d0eb63cd2e8768fdf64020385666" - } - ], - "CSAPublicKey": "a86ec009018bb8af75334136a41c3245a8393cdb98c553946c892a1df5499e95" - }, - { - "AptosAccount": "a97af95aa7c3c681607df04fb5caa45cd2e0590d05c37077aaad050cb33305c6", - "OCR2AptosKBs": [ - { - "AptosBundleID": "7397b14cd4fa8d4e5d07a201a2fcc70004bc63606250525e9839365da35ae5fb", - "AptosOnchainPublicKey": "967069ff93527fe7a65ff45c8fccd824241c35a40fd89d1c292f33bd3475667e" - } - ], - "EthAddress": "0x27C54b54E1B81c3ddF95336EBf40b1F261cfEb76", - "P2PPeerID": "12D3KooWDURuT5EYKxp9rJR7HHXyXMMoc5H3KsCEb3CAEtu1Jk9k", - "OCR2KBs": [ - { - "OCR2BundleID": "37b2b099d6863795e9a4cb5f9f1d4068806950930d708b302254ff13e8b4f0de", - "OCR2OnchainPublicKey": "5192d2e6cdfa2e96f40195de253e1eda8ce9a319", - "OCR2OffchainPublicKey": "7c6b7bafa5e26575dd53f90d779f67552b6dc113ca81d91a425322c8a82e1553", - "OCR2ConfigPublicKey": "b06692ad6a2b713d01c116bcaa2ade15d8f00bb7206430f69db0b2db29824d67" - } - ], - "CSAPublicKey": "1fde312f3cd645e2fb2b1feea701e24eb43b44a66d6796a7f0f66177d00a0bf5" - }, - { - "AptosAccount": "5d6c83043aa243d24bb2e72cd61d54ae48144077ad21d6c7bf6a2332b45592f2", - "OCR2AptosKBs": [ - { - "AptosBundleID": "a4961b6029cb9d60f9ac25679a2b49e67fb7ed0e3561f6a60f1e1ffcbd57fa12", - "AptosOnchainPublicKey": "e7c0e318e399e3277fa4f290275fb46c980674b33cfea8ff83129b765abb2e65" - } - ], - "EthAddress": "0xDE04983c19413ef97Fe610e031eB8Da2663b4009", - "P2PPeerID": "12D3KooWShysZ3eKei8xUg1QF8AKSFnaxkr9oHgG9p1udypHDYNy", - "OCR2KBs": [ - { - "OCR2BundleID": "a642e1e73b50376186962a0e15469774e8781549ab1363b7015f1bf81716bc4b", - "OCR2OnchainPublicKey": "ead5b0aedd9b54f4f7c222531bc2bb742dc1f58b", - "OCR2OffchainPublicKey": "b41e852af840c8a3d6d07db51db3833f60ed27a4d5a6af76f7b640042240250b", - "OCR2ConfigPublicKey": "db055363d3e0be891a3675174e34cdb5517e9f205e0186ff390a1ec1a5160013" - } - ], - "CSAPublicKey": "8b343c68808f91548c1093fdb7de55eb95795a7da22a3468c190d9d445005c44" - }, - { - "AptosAccount": "8b1daf432f3198311302119b2aa0459e6b1ec5d69d59ef995c6bac9dde141de2", - "OCR2AptosKBs": [ - { - "AptosBundleID": "4294b7e421ac4fc37503fe38b6558984d52e279935e5a07e8b1ead98a0baa85c", - "AptosOnchainPublicKey": "73c82ddc84658b949b6b65489a4732d7450152d7e3c0465a6cc832d517f4047d" - } - ], - "EthAddress": "0xa9FA782006E5d49C4F61F77E0885D123a07d97eD", - "P2PPeerID": "12D3KooWESEgwto9jwZzoxFRUAXSynuxbd8Q9ZZskonapRW7eZJu", - "OCR2KBs": [ - { - "OCR2BundleID": "7aca1cfcc0cff3efc73225183d8ee2ab6c6707c9ae0fe94da3c0c1bee29a52b2", - "OCR2OnchainPublicKey": "a696cd279810d5c23683b86e6ea00780a7eedc34", - "OCR2OffchainPublicKey": "8c0e5b3d158969f4f0342685df77e83f04b6309d08e555e531ced1558ccc0ad2", - "OCR2ConfigPublicKey": "c1caa2f07acd31ec1b0463ae3d080a06f2007e54282d70460be504c2c800ca51" - } - ], - "CSAPublicKey": "472348574d2de406589913fbbc691e282dde38a579d92e1076549b628b11bef5" - }, - { - "AptosAccount": "4b89f4a763f4b90de59067c9d10611494da295d2faf79bbdfb9b3b801c527811", - "OCR2AptosKBs": [ - { - "AptosBundleID": "36ea4de5498cce1afa6c22cf4fc01bde5a6961dda6462f73580c66aa499a6ccd", - "AptosOnchainPublicKey": "410299c65c8ab320f9b2d1c63cc0b0d445e0425aff94ec265661ebd59bf2145d" - } - ], - "EthAddress": "0xad27e34c2b86e58360766A565063Ab7F2f596a9D", - "P2PPeerID": "12D3KooWCyFyg1axsbWvU8K3sqSVYQsnSQ9KrrSYNwGR1pkJASag", - "OCR2KBs": [ - { - "OCR2BundleID": "901ce496a554b3adea30c7a63b4a91e319d99831335ffe12e2cf0702e7dc08c5", - "OCR2OnchainPublicKey": "6fe16a2917d87f5d4bc727235d5c0ab32fe31e23", - "OCR2OffchainPublicKey": "fc786546985f07ef0f4c389af9dc91edcafffa51bb29b6dd71750c783ac82e3c", - "OCR2ConfigPublicKey": "2641b71c27f93fe5e4e7328e3e48dff8c1372ce432ea80c47de4b7a244eb7172" - } - ], - "CSAPublicKey": "a1072d02d297cfa2098367bcde4c74bbc158863707feae06a397190bcf668570" - } -] \ No newline at end of file diff --git a/core/scripts/keystone/src/testdata/keyless_node_sets.json b/core/scripts/keystone/src/testdata/keyless_node_sets.json new file mode 100644 index 00000000000..3e1ae60df03 --- /dev/null +++ b/core/scripts/keystone/src/testdata/keyless_node_sets.json @@ -0,0 +1,336 @@ +{ + "Workflow": { + "Name": "workflow", + "Prefix": "ks-wf-", + "Nodes": [ + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-bt-node1.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-bt-node1.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-0-ks-wf-bt-node1", + "DeploymentName": "app-0-ks-wf-bt-node1-bootstrap", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node2.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node2.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-0-ks-wf-node2", + "DeploymentName": "app-0-ks-wf-node2", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node3.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node3.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-0-ks-wf-node3", + "DeploymentName": "app-0-ks-wf-node3", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node4.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node4.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-0-ks-wf-node4", + "DeploymentName": "app-0-ks-wf-node4", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node5.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node5.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-0-ks-wf-node5", + "DeploymentName": "app-0-ks-wf-node5", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + } + ], + "NodeKeys": null + }, + "StreamsTrigger": { + "Name": "streams-trigger", + "Prefix": "ks-str-trig-", + "Nodes": [ + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-bt-node1.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-bt-node1.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-1-ks-str-trig-bt-node1", + "DeploymentName": "app-1-ks-str-trig-bt-node1", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node2.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node2.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-1-ks-str-trig-node2", + "DeploymentName": "app-1-ks-str-trig-node2", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node3.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node3.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-1-ks-str-trig-node3", + "DeploymentName": "app-1-ks-str-trig-node3", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node4.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node4.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-1-ks-str-trig-node4", + "DeploymentName": "app-1-ks-str-trig-node4", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node5.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node5.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-1-ks-str-trig-node5", + "DeploymentName": "app-1-ks-str-trig-node5", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + } + ], + "NodeKeys": null + } +} diff --git a/core/scripts/keystone/src/testdata/node_sets.json b/core/scripts/keystone/src/testdata/node_sets.json new file mode 100644 index 00000000000..e9f7be3f6f1 --- /dev/null +++ b/core/scripts/keystone/src/testdata/node_sets.json @@ -0,0 +1,458 @@ +{ + "Workflow": { + "Name": "workflow", + "Prefix": "ks-wf-", + "Nodes": [ + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-bt-node1.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-bt-node1.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-0-ks-wf-bt-node1", + "DeploymentName": "app-0-ks-wf-bt-node1-bootstrap", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node2.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node2.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-0-ks-wf-node2", + "DeploymentName": "app-0-ks-wf-node2", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node3.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node3.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-0-ks-wf-node3", + "DeploymentName": "app-0-ks-wf-node3", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node4.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node4.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-0-ks-wf-node4", + "DeploymentName": "app-0-ks-wf-node4", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node5.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-0-ks-wf-node5.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-0-ks-wf-node5", + "DeploymentName": "app-0-ks-wf-node5", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + } + ], + "NodeKeys": [ + { + "EthAddress": "0x4cdEf4eaD7C47d804e26dF56aCbf5f7F7E28f912", + "OCR2BundleID": "56f6587a9fd23fb62cedaeeab0fc302dc38c824aae4b7a5da46c850bee281f14", + "OCR2OnchainPublicKey": "59a4e23a84bc7b54179f1028eae1857a425370e1", + "OCR2OffchainPublicKey": "3ac4e8c462d6bef48ea5e19cc00c7510fdaf5f13ca1229092aba2389e8508136", + "OCR2ConfigPublicKey": "82965a3d5175e2643671623ac61eb135a79132586139506319a25608a08dde3d", + "AptosAccount": "1f7a3ac9556d3ee2e11e9700fa5b7e58ef329158bee1dd1e30231a37b6e75fd8", + "AptosBundleID": "728fcde3160c46b394c3612add0206229266f2346f8c802a07cbe4e7026166fb", + "AptosOnchainPublicKey": "83352d71acdd5cc7b65d84d92aa31cdd9d129a5ce49184bcc2d4c7e58114cc56", + "P2PPeerID": "12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW", + "CSAPublicKey": "a5024bd1f5ccd546a3c5086fb1544debe51c79a6c301a7c7ac001dbc7621b66f" + }, + { + "EthAddress": "0xDA964d2Fe39E5aAE9C1226171F207e4C57c85a77", + "OCR2BundleID": "e5c943f6bccc202dfd94ac4727f3263d3fbf90a61210fb36bdab46b8868866bc", + "OCR2OnchainPublicKey": "3a6096c5d2101a6e80831ab7f2487a134add5a62", + "OCR2OffchainPublicKey": "ae2af1cc9827047acaf7691aafc2dcfdf0135dcb2b7c01d6d20f91389c4bdbc7", + "OCR2ConfigPublicKey": "3bbb4ad2c4154e4db0d7c6700076780f0c758f55c39afb3c1588834d5278e20a", + "AptosAccount": "fcac44d068bf70bb7fe1949362437f20ddc4cab21d5c79fd7dbf8da67cc842c3", + "AptosBundleID": "264ab5c3053ced6966e224ba928c2302749c428ddc4878ee3b3e84f812ba19d5", + "AptosOnchainPublicKey": "65523a44b882753ced0eb96aa34c73c5d43a1c47a59f0542a0cb37346f392f07", + "P2PPeerID": "12D3KooWQ24qvZZxUyi2HVeEMtoKS59TXEp7HqDUeaQA9WSAq1kA", + "CSAPublicKey": "2963b236ac0e5d9f4ae610019c68e9be87cc2bb24f73aefedaae053dedae420e" + }, + { + "EthAddress": "0xc8Cf02aF00b435c5F2311B9F158D9b69226116C3", + "OCR2BundleID": "5682657c3c43cbe56e5b3b0134630987637d4815a0acac7e657c399f500756be", + "OCR2OnchainPublicKey": "77c2410a03b29fe22171ba322637e1f3f0d6a939", + "OCR2OffchainPublicKey": "384ace52c3bb03f245090582ad7b8c36c81510fdcb978e74edcdb7917e21cae8", + "OCR2ConfigPublicKey": "692e770af45d5261090143470cb7901e4174cd8e7e4f369c92fd6a1afd947f06", + "AptosAccount": "c96a208a0df76f0a6cf7ea7b046fb398db59c25e4f223165738058c607f90bbc", + "AptosBundleID": "2b6d59d0957e9b6bf821be3fda1976c8d9944bebe6c66f0b0405bf5bf4cca40a", + "AptosOnchainPublicKey": "8e340cc57026d3c8ee171dc972f1ca9ea8f772672245ec8607c48636f0a8a381", + "P2PPeerID": "12D3KooWN2rZhriFQUXK7dXma8VdE3cDBMk9Zs9nGHNUPwkX6g86", + "CSAPublicKey": "bea98fd6e29ad67fe2347a024cb66abde2d8494e1d25255288ae5a8ff7170b2d" + }, + { + "EthAddress": "0xAbACcde3e1e6916cE46AB2472AB788941f1ce088", + "OCR2BundleID": "ec1f8a0a941474ef0313e61cff67aa622d64cbb079c00abca93672c5caf9438e", + "OCR2OnchainPublicKey": "390a4d631cd08f83eacf7a9e4475d2b2a9ccc1c7", + "OCR2OffchainPublicKey": "301bcf56866ed58be7df4b9322178ae603ade07716147b952e72e93e03d911eb", + "OCR2ConfigPublicKey": "64723878d960ef35b299b38ea7637efe6c1af7fca1b08150784ceb9a3560ba66", + "AptosAccount": "57e11c444d4c5cf77263087b6fad83eab7fae648ddf4b702e59d95af0b995566", + "AptosBundleID": "e506f4bc2a7a886534617018b77cccb9e9823545e07c14f3cab04028966c44e7", + "AptosOnchainPublicKey": "900890fb1e8b55f69699098567bdec761b068cd258d696d4fce60881546001b4", + "P2PPeerID": "12D3KooWFQ2DRXc6om66PFvzXMsAPmgJdZ6ztgiLCsCHjXwPCcGH", + "CSAPublicKey": "acdada7a0cfde36ba81398b57c21c2f60825ddfa7cfb126ce6eb00d6aef87808" + }, + { + "EthAddress": "0xB81D8e06Cf34347D22776D1Db67011aBD43ae07D", + "OCR2BundleID": "0bdb79dc47a775ff16ff11047505d409d0e83de4f078dca915a4361241a753b4", + "OCR2OnchainPublicKey": "b19d0be1065fa4a87cc4b817da70bb63a75b2fb3", + "OCR2OffchainPublicKey": "4f72fdf1dfb6d6b006280d40801e337488f2b0edb1b1b3a3a6a3413250bb29cb", + "OCR2ConfigPublicKey": "e2425039ef3427d07092bd9cfe01db2294387f0cb288170e16b8103c9f7e696e", + "AptosAccount": "3c97423f29c1da05b8354f72e32cf6250dc3e5f5451fb5ceb1b53c16423c388c", + "AptosBundleID": "54e51e786ad29fa4d5ea4e9215f7f09d5eb8625a2b9895ac4c1548beb1341e2a", + "AptosOnchainPublicKey": "6e42e0650e3b11aca5c59d04f5f7f5ce0048604abdf09f78c1b91aaf543d90b7", + "P2PPeerID": "12D3KooWE57dneLdwCigi3oKrCMYhQoCPNKHHSr8Qe4n6hW28UT9", + "CSAPublicKey": "25b7d6cfa17de0524c583fa7b2b7aede4a6a761c2a0ddaa11d3118e72c46a8ea" + } + ] + }, + "StreamsTrigger": { + "Name": "streams-trigger", + "Prefix": "ks-str-trig-", + "Nodes": [ + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-bt-node1.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-bt-node1.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-1-ks-str-trig-bt-node1", + "DeploymentName": "app-1-ks-str-trig-bt-node1", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node2.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node2.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-1-ks-str-trig-node2", + "DeploymentName": "app-1-ks-str-trig-node2", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node3.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node3.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-1-ks-str-trig-node3", + "DeploymentName": "app-1-ks-str-trig-node3", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node4.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node4.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-1-ks-str-trig-node4", + "DeploymentName": "app-1-ks-str-trig-node4", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + }, + { + "URL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node5.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "RemoteURL": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "crib-local-1-ks-str-trig-node5.local", + "Path": "", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "ServiceName": "app-1-ks-str-trig-node5", + "DeploymentName": "app-1-ks-str-trig-node5", + "Login": "notreal@fakeemail.ch", + "Password": "fj293fbBnlQ!f9vNs" + } + ], + "NodeKeys": [ + { + "EthAddress": "0x61560C5b25E4745f0F633D84476c14390FA3DD84", + "OCR2BundleID": "aaca54f8ec36acfc6dafd746c37a4f558fee4c4360b67c9bdf93dda87f54b3b0", + "OCR2OnchainPublicKey": "e74920e7879d72aaef6218f4bae6ff7c8a6aa4ca", + "OCR2OffchainPublicKey": "5d1319480eaa15ff9852db3e39d683d97d6e0383f76c6a4e050da13bab099bf7", + "OCR2ConfigPublicKey": "86547b9f1a068bbe66a23395c2a96920391d460a090f7fa55b71b4584e1dca2d", + "AptosAccount": "8058a1f4fe8f7794db77e6f4a32f3c7e34ce828869b6c8201331398a09f535fc", + "AptosBundleID": "98d3f2c10bf93134cfcbfdb20c3362a19d92847d6a1904402557cadf2cda9e41", + "AptosOnchainPublicKey": "94d634b7a425348560563a8dd480e8014777a91891640098837f2f31429cd019", + "P2PPeerID": "12D3KooWHmKkBDnZQdQfXfseupkHVUExXSXgKMbsvowuWVvHXnET", + "CSAPublicKey": "3bc22ec8afe81fe971d7b997847c48c28387e515bd8b8d58dc66e1b6000d2eba" + }, + { + "EthAddress": "0xc924A1f5eb60e16e2A7eaEF8fF43B81279988507", + "OCR2BundleID": "dec4122398dcc1d168e5299d896bea43e3c2eb6b80b930d811769dbaa6fc5dc3", + "OCR2OnchainPublicKey": "4268941221e692700b811aa677f0109d6b043878", + "OCR2OffchainPublicKey": "038abda618e98e3f9248facbbf0f85aff1da758f667540ad86d4b551a0645d48", + "OCR2ConfigPublicKey": "df035550d38a35782814abe4d4547c9d19b4d531e52365ec98a4bf54e3c5ad50", + "AptosAccount": "aeaf55a2c6fdc03feb4ba267e472218217099906bcdfd060780215f7e403c8ac", + "AptosBundleID": "04f83eb14a0f1d12b9ad718adbad8d6e9a6f98d9038ddc4b0ead5553f46cddc8", + "AptosOnchainPublicKey": "a365d746dee16b72b76546a5d41968f66f3f75b5e50ead59c6de58d7dd18978f", + "P2PPeerID": "12D3KooWRHbaLm4WoyXEKkEdgPU4F3ksam4wfreC9H6eEehRDRzs", + "CSAPublicKey": "d02faacac929d6d73ede56026604ed0d9af6b66631d813c9bfe57f49879b6f66" + }, + { + "EthAddress": "0x3Ad163A3E6Ae03f93fAAD205833318F5111957f6", + "OCR2BundleID": "2cf78d5374a7c4c37ff899c7d4ec1f587d1c55e19e3f469bc060069d3aceb822", + "OCR2OnchainPublicKey": "5cdc6d251d437eec492abc599089f31b0796a2bf", + "OCR2OffchainPublicKey": "f6212f5e28a197083698137b8990366f2e795dd010ea8f30a4c7ae79dd4c24e8", + "OCR2ConfigPublicKey": "b89aa8ad44f52de2b9c0f5d24454cd851fcd7196e915ca8a881293f2a78f8c44", + "AptosAccount": "fcd7adc2ec9749dfdf2ac823bbd43399e492b98439804aff2bcd20a6ac0e325e", + "AptosBundleID": "ca1b4be024cc334b67abfed3afc3b76c20fb9c3c79ba562765b699e5b3ba6b7f", + "AptosOnchainPublicKey": "5e91147eb11af299ecfe976f2a67fa65cae98fea14c8e970f1bcf7c680d47af8", + "P2PPeerID": "12D3KooWFzdAipMFiMbM5nHu6WnTtnuv3Q9nan9JmQNiRRs4UYVJ", + "CSAPublicKey": "847b14f52f2a2334d865b04e9ded66ef5d93a71d0337c6e1b2aa5dd6ed8a31e9" + }, + { + "EthAddress": "0xe73b2eE90Bf397BbCf48Ff6bE0317F852bEAC62E", + "OCR2BundleID": "3c0408535b0fb8eb86377dc5457c92ca449cdc8f7f7c84102f48ad218777c5bd", + "OCR2OnchainPublicKey": "83f03cd5d5df6057d9fefbdd4566f9ac0af287c3", + "OCR2OffchainPublicKey": "2e8a4828976093301aefdbdd715307d1a5648589045cfb013cf72321821ea691", + "OCR2ConfigPublicKey": "255043622ed54159e827624e02e2c4ec1e9e037b38f54dc7e0ba4de98a3d7d74", + "AptosAccount": "e81914a84ff0c52fbb4afcd8662ada15f0a4b91037b4387767172e033668ca90", + "AptosBundleID": "7047c3f64890a8fcb2393c6b7ab2af11a3c5133812eec661e7616bdc0434a884", + "AptosOnchainPublicKey": "618fc2199f04828bcb935b2f72befa85c0205106d3a02b66049b079bb8d866a8", + "P2PPeerID": "12D3KooWCcDDxc4H5EeUTTN9qDjy78TRHXq6gNo59pPrAFAUkPvr", + "CSAPublicKey": "cc5fd0a2d2ad059df99011cbd23aeafbae369c9c3e6f30cfe64d37a591aafa63" + }, + { + "EthAddress": "0xA861049e4670Bd8b0E9C447F33b473145c5FC079", + "OCR2BundleID": "08cc4a28589a3fcc0c9bb1a67c09e49c92d1de184b60a11fa505e49ec8a87b00", + "OCR2OnchainPublicKey": "9ee47af6e91a6f55db31246ac3b706d3a3e6e060", + "OCR2OffchainPublicKey": "131f66e2120912ed45e54a752316d110968a78eb5efd9a3e3c1215631804617e", + "OCR2ConfigPublicKey": "dda24126a23ae8e36bbc2d9e37dd6ff9dcea3ec924d6753b066af09811352225", + "AptosAccount": "57eef8994e947c45a65e9e4593e1617c4278833db28d0d3fd007ff8695af5012", + "AptosBundleID": "e67964f9cc347ea16174de40ac1391de7b36963a65fba9e2d86ea586b4dd0eb8", + "AptosOnchainPublicKey": "2cfa138265a1c2a2dca31c5bc5a804a7543dd226d8c288bf6a4ec1c853870963", + "P2PPeerID": "12D3KooWP68a8W3eKN988APsGDNGBTQjZttg3qyAbvqkK6D3NZYu", + "CSAPublicKey": "bcd4c7abd729e6c6931e323796ff2a148991d1062cca18de765602d874de15f9" + } + ] + } +} From b1558bd84fd91a62f237f0aa391a22e1698634df Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 23 Oct 2024 14:06:18 -0700 Subject: [PATCH 067/117] Fix missing / incorrect fields for keystone workflow --- .../keystone/src/03_deploy_streams_trigger_cmd.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index f3f62d680ac..5d1d25252dc 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -333,7 +333,7 @@ type = "workflow" schemaVersion = 1 name = "{{ .JobSpecName }}" workflow = """ -name: "ccip_kiab" +name: "ccip_kiab1" owner: '{{ .WorkflowOwnerAddress }}' triggers: - id: streams-trigger@1.0.0 @@ -352,15 +352,18 @@ consensus: - $(trigger.outputs) config: report_id: '0001' + key_id: 'evm' aggregation_method: data_feeds aggregation_config: + feeds: {{- range .FeedIDs }} - '{{ . }}': - deviation: '0.05' - heartbeat: 1800 + '{{ . }}': + deviation: '0.05' + heartbeat: 1800 {{- end }} encoder: EVM encoder_config: + abi: "(bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports" abi: (bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports targets: From 0248f1051297a9f58c048027c6b01ae9e934d73a Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 23 Oct 2024 14:07:35 -0700 Subject: [PATCH 068/117] Update gomods --- core/scripts/go.mod | 8 ++++---- tools/goreleaser-config/go.mod | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 6fe84f15231..bb7fe46fe48 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -17,6 +17,7 @@ require ( github.com/jmoiron/sqlx v1.4.0 github.com/joho/godotenv v1.5.1 github.com/jonboulle/clockwork v0.4.0 + github.com/jpillora/backoff v1.0.0 github.com/manyminds/api2go v0.0.0-20171030193247-e7b693844a6f github.com/montanaflynn/stats v0.7.1 github.com/olekukonko/tablewriter v0.0.5 @@ -26,7 +27,8 @@ require ( github.com/smartcontractkit/chainlink-automation v0.8.1 github.com/smartcontractkit/chainlink-common v0.3.1-0.20241107134205-25e45ecd73ba github.com/smartcontractkit/chainlink/deployment v0.0.0-00010101000000-000000000000 - github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20241106193309-5560cd76211a + github.com/smartcontractkit/chainlink/integration-tests v0.0.0-00010101000000-000000000000 + github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 @@ -38,6 +40,7 @@ require ( k8s.io/api v0.31.1 k8s.io/apimachinery v0.31.1 k8s.io/client-go v0.31.1 + k8s.io/client-go v0.31.0 ) require ( @@ -224,7 +227,6 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/jpillora/backoff v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect @@ -290,7 +292,6 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.27 // indirect github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422 // indirect github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f // indirect - github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e // indirect github.com/smartcontractkit/chainlink-feeds v0.1.1 // indirect github.com/smartcontractkit/chainlink-protos/job-distributor v0.4.0 // indirect github.com/smartcontractkit/chainlink-protos/orchestrator v0.3.0 // indirect @@ -384,7 +385,6 @@ require ( gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240709000822-3c01b740850f // indirect k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect diff --git a/tools/goreleaser-config/go.mod b/tools/goreleaser-config/go.mod index f46423b660d..d0e66514869 100644 --- a/tools/goreleaser-config/go.mod +++ b/tools/goreleaser-config/go.mod @@ -1,6 +1,6 @@ module github.com/smartcontractkit/chainlink/tools/goreleaser-config -go 1.23.0 +go 1.22.8 require ( github.com/goreleaser/goreleaser-pro/v2 v2.3.2-pro From 499d27fb7433093277a765cdeac863a9293cfa38 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:08:00 -0700 Subject: [PATCH 069/117] Simplify node key handling --- .../keystone/src/01_deploy_contracts_cmd.go | 8 +- .../keystone/src/02_deploy_jobspecs_cmd.go | 7 +- .../src/03_deploy_streams_trigger_cmd.go | 20 +- .../src/03_gen_crib_cluster_overrides_cmd.go | 16 +- .../03_gen_crib_cluster_overrides_cmd_test.go | 3 +- .../keystone/src/04_delete_ocr3_jobs_cmd.go | 9 +- .../keystone/src/06_deploy_workflows_cmd.go | 9 +- .../src/06_provision_capabilities_registry.go | 5 - .../keystone/src/07_delete_workflows_cmd.go | 9 +- core/scripts/keystone/src/88_gen_jobspecs.go | 3 +- .../keystone/src/88_gen_jobspecs_test.go | 3 +- .../keystone/src/88_gen_ocr3_config.go | 6 +- .../keystone/src/88_gen_ocr3_config_test.go | 2 +- core/scripts/keystone/src/99_app.go | 4 +- core/scripts/keystone/src/99_crib_client.go | 77 ++- core/scripts/keystone/src/99_fetch_keys.go | 349 ++++------- core/scripts/keystone/src/99_files.go | 2 - core/scripts/keystone/src/99_nodes.go | 49 -- ...3_gen_crib_cluster_overrides_cmd_test.snap | 26 +- .../__snapshots__/88_gen_jobspecs_test.snap | 40 +- .../88_gen_ocr3_config_test.snap | 16 +- .../src/testdata/keyless_node_sets.json | 336 ----------- .../keystone/src/testdata/node_sets.json | 540 ++++++------------ .../keystone/templates/streams_trigger.toml | 76 --- 24 files changed, 448 insertions(+), 1167 deletions(-) delete mode 100644 core/scripts/keystone/src/99_nodes.go delete mode 100644 core/scripts/keystone/src/testdata/keyless_node_sets.json delete mode 100644 core/scripts/keystone/templates/streams_trigger.toml diff --git a/core/scripts/keystone/src/01_deploy_contracts_cmd.go b/core/scripts/keystone/src/01_deploy_contracts_cmd.go index 1957bd89cbd..0ef4f707090 100644 --- a/core/scripts/keystone/src/01_deploy_contracts_cmd.go +++ b/core/scripts/keystone/src/01_deploy_contracts_cmd.go @@ -55,7 +55,6 @@ func (g *deployContracts) Run(args []string) { onlySetConfig := fs.Bool("onlysetconfig", false, "set the config on the OCR3 contract without deploying the contracts or funding transmitters") dryRun := fs.Bool("dryrun", false, "dry run, don't actually deploy the contracts and do not fund transmitters") nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") - keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") @@ -76,15 +75,12 @@ func (g *deployContracts) Run(args []string) { if *nodeSetsPath == "" { *nodeSetsPath = defaultNodeSetsPath } - if *keylessNodeSetsPath == "" { - *keylessNodeSetsPath = defaultKeylessNodeSetsPath - } os.Setenv("ETH_URL", *ethUrl) os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) os.Setenv("ACCOUNT_KEY", *accountKey) os.Setenv("INSECURE_SKIP_VERIFY", "true") - deploy(*keylessNodeSetsPath, *nodeSetsPath, *ocrConfigFile, *skipFunding, *dryRun, *onlySetConfig, *artefactsDir, *nodeSetSize) + deploy( *nodeSetsPath, *ocrConfigFile, *skipFunding, *dryRun, *onlySetConfig, *artefactsDir, *nodeSetSize) } // deploy does the following: @@ -94,7 +90,6 @@ func (g *deployContracts) Run(args []string) { // 4. Writes the deployed contract addresses to a file // 5. Funds the transmitters func deploy( - keylessNodeSetsPath string, nodeSetsPath string, configFile string, skipFunding bool, @@ -105,7 +100,6 @@ func deploy( ) { env := helpers.SetupEnv(false) ocrConfig := generateOCR3Config( - keylessNodeSetsPath, configFile, env.ChainID, nodeSetsPath, diff --git a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go index 75055803932..688e4d073d3 100644 --- a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go +++ b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go @@ -26,7 +26,6 @@ func (g *deployJobSpecs) Run(args []string) { p2pPort := fs.Int64("p2pport", 6690, "p2p port") onlyReplay := fs.Bool("onlyreplay", false, "only replay the block from the OCR3 contract setConfig transaction") templatesLocation := fs.String("templates", "", "Custom templates location") - keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") @@ -48,20 +47,16 @@ func (g *deployJobSpecs) Run(args []string) { if *nodeSetsPath == "" { *nodeSetsPath = defaultNodeSetsPath } - if *keylessNodeSetsPath == "" { - *keylessNodeSetsPath = defaultKeylessNodeSetsPath - } if *templatesLocation == "" { *templatesLocation = "templates" } - nodes := downloadKeylessNodeSets(*keylessNodeSetsPath, *nodeSetSize).Workflow.Nodes + nodes := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize).Workflow.Nodes deployedContracts, err := LoadDeployedContracts(*artefactsDir) PanicErr(err) jobspecs := genSpecs( *nodeSetsPath, - *keylessNodeSetsPath, *templatesLocation, *chainID, *p2pPort, deployedContracts.OCRContract.Hex(), *nodeSetSize, diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go index 5d1d25252dc..6076ef9fe06 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go @@ -101,7 +101,6 @@ func (g *deployStreamsTrigger) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) chainID := fs.Int64("chainid", 1337, "chain id") ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") - keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") force := fs.Bool("force", false, "Force deployment") nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") @@ -122,9 +121,6 @@ func (g *deployStreamsTrigger) Run(args []string) { if *nodeSetsPath == "" { *nodeSetsPath = defaultNodeSetsPath } - if *keylessNodeSetsPath == "" { - *keylessNodeSetsPath = defaultKeylessNodeSetsPath - } os.Setenv("ETH_URL", *ethUrl) os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) @@ -135,7 +131,6 @@ func (g *deployStreamsTrigger) Run(args []string) { setupMercuryV03( env, - *keylessNodeSetsPath, *ocrConfigFile, *chainID, *nodeSetsPath, @@ -145,17 +140,16 @@ func (g *deployStreamsTrigger) Run(args []string) { } // See /core/services/ocr2/plugins/mercury/integration_test.go -func setupMercuryV03(env helpers.Environment, keylessNodeSetsPath string, ocrConfigFilePath string, chainId int64, nodeSetsPath string, nodeSetSize int, force bool) { +func setupMercuryV03(env helpers.Environment, ocrConfigFilePath string, chainId int64, nodeSetsPath string, nodeSetSize int, force bool) { fmt.Printf("Deploying streams trigger for chain %d\n", chainId) fmt.Printf("Using OCR config file: %s\n", ocrConfigFilePath) - fmt.Printf("Using keyless node sets: %s\n", keylessNodeSetsPath) fmt.Printf("Using node sets: %s\n", nodeSetsPath) fmt.Printf("Force: %t\n\n", force) fmt.Printf("Deploying Mercury V0.3 contracts\n") _, _, _, verifier := deployMercuryV03Contracts(env) - nodeSets := downloadNodeSets(keylessNodeSetsPath, chainId, nodeSetsPath, nodeSetSize) + nodeSets := downloadNodeSets(chainId, nodeSetsPath, nodeSetSize) fmt.Printf("Generating OCR3 config\n") ocrConfig := generateMercuryOCR2Config(nodeSets.StreamsTrigger.NodeKeys[1:]) // skip the bootstrap node @@ -187,7 +181,7 @@ func setupMercuryV03(env helpers.Environment, keylessNodeSetsPath string, ocrCon PanicErr(err) fmt.Printf("Deploying OCR2 job specs for feed %s\n", feed.name) - deployOCR2JobSpecsForFeed(nodeSets.StreamsTrigger.NodeKeys, nodeSets.StreamsTrigger.Nodes, verifier, feed, chainId, force) + deployOCR2JobSpecsForFeed(nodeSets.StreamsTrigger, verifier, feed, chainId, force) } fmt.Println("Finished deploying streams trigger") @@ -251,11 +245,11 @@ func deployMercuryV03Contracts(env helpers.Environment) (linkToken *link_token_i return } -func deployOCR2JobSpecsForFeed(nca []NodeKeys, nodes []*NodeWthCreds, verifier *verifierContract.Verifier, feed feed, chainId int64, force bool) { +func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier *verifierContract.Verifier, feed feed, chainId int64, force bool) { // we assign the first node as the bootstrap node - for i, n := range nca { + for i, n := range nodeSet.NodeKeys { // parallel arrays - api := newNodeAPI(nodes[i]) + api := newNodeAPI(nodeSet.Nodes[i]) jobSpecName := "" jobSpecStr := "" @@ -276,7 +270,7 @@ func deployOCR2JobSpecsForFeed(nca []NodeKeys, nodes []*NodeWthCreds, verifier * // Prepare data for Mercury V3 Job mercuryData := MercuryV3JobSpecData{ FeedName: fmt.Sprintf("feed-%s", feed.name), - BootstrapHost: fmt.Sprintf("%s@%s:%s", nca[0].P2PPeerID, nodes[0].ServiceName, "6690"), + BootstrapHost: fmt.Sprintf("%s@%s:%s", nodeSet.NodeKeys[0].P2PPeerID, nodeSet.Nodes[0].ServiceName, "6690"), VerifierAddress: verifier.Address().Hex(), Bridge: feed.bridgeName, NodeCSAKey: n.CSAPublicKey, diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go index 3d984ca9bc8..1159f66722a 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go @@ -157,9 +157,8 @@ func (g *generateCribClusterOverridesPostprovision) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) chainID := fs.Int64("chainid", 1337, "chain id") outputPath := fs.String("outpath", "-", "the path to output the generated overrides (use '-' for stdout)") - nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") + nodeSetSize := fs.Int("nodeSetSize", 5, "number of noes in a nodeset") nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") - keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") err := fs.Parse(args) @@ -174,14 +173,11 @@ func (g *generateCribClusterOverridesPostprovision) Run(args []string) { if *nodeSetsPath == "" { *nodeSetsPath = defaultNodeSetsPath } - if *keylessNodeSetsPath == "" { - *keylessNodeSetsPath = defaultKeylessNodeSetsPath - } contracts, err := LoadDeployedContracts(*artefactsDir) helpers.PanicErr(err) - chart := generatePostprovisionConfig(keylessNodeSetsPath, chainID, nodeSetsPath, contracts, *nodeSetSize) + chart := generatePostprovisionConfig(*chainID, *nodeSetsPath, *nodeSetSize, contracts) yamlData, err := yaml.Marshal(chart) helpers.PanicErr(err) @@ -195,8 +191,8 @@ func (g *generateCribClusterOverridesPostprovision) Run(args []string) { } } -func generatePostprovisionConfig(keylessNodeSetsPath *string, chainID *int64, nodeSetsPath *string, contracts deployedContracts, nodeSetSize int) Helm { - nodeSets := downloadNodeSets(*keylessNodeSetsPath, *chainID, *nodeSetsPath, nodeSetSize) +func generatePostprovisionConfig(chainID int64, nodeSetsPath string, nodeSetSize int, contracts deployedContracts) Helm { + nodeSets := downloadNodeSets(chainID, nodeSetsPath, nodeSetSize) nodes := make(map[string]Node) nodeNames := []string{} @@ -210,7 +206,7 @@ func generatePostprovisionConfig(keylessNodeSetsPath *string, chainID *int64, no // we assign capabilitiesBootstrapper after we generate overrides so that // we do not include the bootstrapper config to itself overridesToml := generateOverridesToml( - *chainID, + chainID, contracts.CapabilityRegistry.Hex(), "", "", @@ -234,7 +230,7 @@ func generatePostprovisionConfig(keylessNodeSetsPath *string, chainID *int64, no nodeName := fmt.Sprintf("%d-%snode%d", nodeSetIndex, nodeSet.Prefix, i+2) nodeNames = append(nodeNames, nodeName) overridesToml := generateOverridesToml( - *chainID, + chainID, contracts.CapabilityRegistry.Hex(), nodeKey.EthAddress, contracts.ForwarderContract.Hex(), diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go index ed822800f5a..85a5e44bd73 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go +++ b/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go @@ -11,7 +11,6 @@ import ( func TestGeneratePostprovisionConfig(t *testing.T) { chainID := int64(1337) nodeSetsPath := "./testdata/node_sets.json" - keylessNodeSetsPath := "./testdata/keyless_node_sets.json" contracts := deployedContracts{ OCRContract: [20]byte{0: 1}, @@ -22,7 +21,7 @@ func TestGeneratePostprovisionConfig(t *testing.T) { nodeSetSize := 5 - chart := generatePostprovisionConfig(&keylessNodeSetsPath, &chainID, &nodeSetsPath, contracts, nodeSetSize) + chart := generatePostprovisionConfig(chainID, nodeSetsPath, nodeSetSize, contracts) yamlData, err := yaml.Marshal(chart) if err != nil { diff --git a/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go b/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go index 347d14a9f89..15c04db30a8 100644 --- a/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go +++ b/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go @@ -41,7 +41,8 @@ func (g *deleteJobs) Name() string { func (g *deleteJobs) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) - keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") + chainID := fs.Int64("chainid", 1337, "chain id") + nodeSetsPath := fs.String("nodes", "", "Custom node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") @@ -54,8 +55,8 @@ func (g *deleteJobs) Run(args []string) { if *artefactsDir == "" { *artefactsDir = defaultArtefactsDir } - if *keylessNodeSetsPath == "" { - *keylessNodeSetsPath = defaultKeylessNodeSetsPath + if *nodeSetsPath == "" { + *nodeSetsPath = defaultNodeSetsPath } deployedContracts, err := LoadDeployedContracts(*artefactsDir) @@ -63,7 +64,7 @@ func (g *deleteJobs) Run(args []string) { fmt.Println("Error loading deployed contracts, skipping:", err) return } - nodes := downloadKeylessNodeSets(*keylessNodeSetsPath, *nodeSetSize).Workflow.Nodes + nodes := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize).Workflow.Nodes for _, node := range nodes { api := newNodeAPI(node) diff --git a/core/scripts/keystone/src/06_deploy_workflows_cmd.go b/core/scripts/keystone/src/06_deploy_workflows_cmd.go index cdaacb308d1..50b579cfcad 100644 --- a/core/scripts/keystone/src/06_deploy_workflows_cmd.go +++ b/core/scripts/keystone/src/06_deploy_workflows_cmd.go @@ -24,20 +24,21 @@ func (g *deployWorkflows) Name() string { func (g *deployWorkflows) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) + chainID := fs.Int64("chainid", 1337, "chain id") workflowFile := fs.String("workflow", "workflow.yml", "path to workflow file") - keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") + nodeSets := fs.String("nodes", "", "Custom node sets location") nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") err := fs.Parse(args) if err != nil || workflowFile == nil || *workflowFile == "" || nodeSetSize == nil || *nodeSetSize == 0 { fs.Usage() os.Exit(1) } - if *keylessNodeSetsPath == "" { - *keylessNodeSetsPath = defaultKeylessNodeSetsPath + if *nodeSets == "" { + *nodeSets = defaultNodeSetsPath } fmt.Println("Deploying workflows") - nodes := downloadKeylessNodeSets(*keylessNodeSetsPath, *nodeSetSize).Workflow.Nodes + nodes := downloadNodeSets(*chainID, *nodeSets, *nodeSetSize).Workflow.Nodes if _, err = os.Stat(*workflowFile); err != nil { PanicErr(errors.New("toml file does not exist")) diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/06_provision_capabilities_registry.go index 6ed1b8fa788..c6eaa49b829 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/06_provision_capabilities_registry.go @@ -30,7 +30,6 @@ func (c *provisionCR) Run(args []string) { chainID := fs.Int64("chainid", 1337, "Chain ID of the Ethereum network to deploy to") accountKey := fs.String("accountkey", "", "Private key of the account to deploy from") nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") - keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") nodeSetSize := fs.Int("nodeSetSize", 5, "Number of nodes in a nodeset") @@ -49,9 +48,6 @@ func (c *provisionCR) Run(args []string) { if *nodeSetsPath == "" { *nodeSetsPath = defaultNodeSetsPath } - if *keylessNodeSetsPath == "" { - *keylessNodeSetsPath = defaultKeylessNodeSetsPath - } os.Setenv("ETH_URL", *ethUrl) os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) @@ -63,7 +59,6 @@ func (c *provisionCR) Run(args []string) { reg := getOrDeployCapabilitiesRegistry(ctx, *artefactsDir, env) nodeSets := downloadNodeSets( - *keylessNodeSetsPath, *chainID, *nodeSetsPath, *nodeSetSize, diff --git a/core/scripts/keystone/src/07_delete_workflows_cmd.go b/core/scripts/keystone/src/07_delete_workflows_cmd.go index 75d80e47fc8..722e647d98e 100644 --- a/core/scripts/keystone/src/07_delete_workflows_cmd.go +++ b/core/scripts/keystone/src/07_delete_workflows_cmd.go @@ -24,7 +24,8 @@ func (g *deleteWorkflows) Name() string { func (g *deleteWorkflows) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) - keylessNodeSetsPath := fs.String("nodes", "", "Custom keyless node sets location") + chainID := fs.Int64("chainid", 1337, "chain id") + nodeSetsPath := fs.String("nodes", "", "Custom node sets location") nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") err := fs.Parse(args) @@ -33,11 +34,7 @@ func (g *deleteWorkflows) Run(args []string) { os.Exit(1) } - if *keylessNodeSetsPath == "" { - *keylessNodeSetsPath = defaultKeylessNodeSetsPath - } - - nodes := downloadKeylessNodeSets(*keylessNodeSetsPath, *nodeSetSize).Workflow.Nodes + nodes := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize).Workflow.Nodes for _, node := range nodes { output := &bytes.Buffer{} diff --git a/core/scripts/keystone/src/88_gen_jobspecs.go b/core/scripts/keystone/src/88_gen_jobspecs.go index a413033d7f2..e02c2477174 100644 --- a/core/scripts/keystone/src/88_gen_jobspecs.go +++ b/core/scripts/keystone/src/88_gen_jobspecs.go @@ -28,14 +28,13 @@ type donHostSpec struct { func genSpecs( nodeSetsPath string, - keylessNodeSetsPath string, templatesDir string, chainID int64, p2pPort int64, ocrConfigContractAddress string, nodeSetSize int, ) donHostSpec { - workflowNodes := downloadNodeSets(keylessNodeSetsPath, chainID, nodeSetsPath, nodeSetSize).Workflow + workflowNodes := downloadNodeSets(chainID, nodeSetsPath, nodeSetSize).Workflow workflowNodeKeys := nodeKeysToKsDeployNodeKeys(workflowNodes.NodeKeys) nodes := workflowNodes.Nodes bootstrapNode := workflowNodeKeys[0] diff --git a/core/scripts/keystone/src/88_gen_jobspecs_test.go b/core/scripts/keystone/src/88_gen_jobspecs_test.go index e632f34bff8..1f76e9692c7 100644 --- a/core/scripts/keystone/src/88_gen_jobspecs_test.go +++ b/core/scripts/keystone/src/88_gen_jobspecs_test.go @@ -27,11 +27,10 @@ func (d *donHostSpec) ToString() string { func TestGenSpecs(t *testing.T) { nodeSetsPath := "./testdata/node_sets.json" - keylessNodeSetsPath := "./testdata/keyless_node_sets.json" chainID := int64(1337) p2pPort := int64(6690) contractAddress := "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" - specs := genSpecs(nodeSetsPath, keylessNodeSetsPath, "../templates", chainID, p2pPort, contractAddress, 4) + specs := genSpecs(nodeSetsPath, "../templates", chainID, p2pPort, contractAddress, 4) snaps.MatchSnapshot(t, specs.ToString()) } diff --git a/core/scripts/keystone/src/88_gen_ocr3_config.go b/core/scripts/keystone/src/88_gen_ocr3_config.go index eb3f7135ac1..1a11c51f3ca 100644 --- a/core/scripts/keystone/src/88_gen_ocr3_config.go +++ b/core/scripts/keystone/src/88_gen_ocr3_config.go @@ -10,12 +10,12 @@ func mustReadConfig(fileName string) (output ksdeploy.TopLevelConfigSource) { return mustReadJSON[ksdeploy.TopLevelConfigSource](fileName) } -func generateOCR3Config(keylessNodeSetsPath string, configFile string, chainID int64, nodeSetsPath string, nodeSetSize int) ksdeploy.Orc2drOracleConfig { +func generateOCR3Config(configFile string, chainID int64, nodeSetsPath string, nodeSetSize int) ksdeploy.Orc2drOracleConfig { topLevelCfg := mustReadConfig(configFile) cfg := topLevelCfg.OracleConfig cfg.OCRSecrets = deployment.XXXGenerateTestOCRSecrets() - nodeSets := downloadNodeSets(keylessNodeSetsPath, chainID, nodeSetsPath, nodeSetSize) - c, err := ksdeploy.GenerateOCR3Config(cfg, nodeKeysToKsDeployNodeKeys(nodeSets.Workflow.NodeKeys[1:])) + nodeSets := downloadNodeSets(chainID, nodeSetsPath, nodeSetSize) + c, err := ksdeploy.GenerateOCR3Config(cfg, nodeKeysToKsDeployNodeKeys(nodeSets.Workflow.NodeKeys[1:])) // skip the bootstrap node helpers.PanicErr(err) return c } diff --git a/core/scripts/keystone/src/88_gen_ocr3_config_test.go b/core/scripts/keystone/src/88_gen_ocr3_config_test.go index fee9f2a4953..12f58e6fc87 100644 --- a/core/scripts/keystone/src/88_gen_ocr3_config_test.go +++ b/core/scripts/keystone/src/88_gen_ocr3_config_test.go @@ -10,7 +10,7 @@ import ( func TestGenerateOCR3Config(t *testing.T) { // Generate OCR3 config - config := generateOCR3Config("./testdata/keyless_node_sets.json", "./testdata/SampleConfig.json", 1337, "./testdata/node_sets.json", 4) + config := generateOCR3Config("./testdata/SampleConfig.json", 1337, "./testdata/node_sets.json", 4) matchOffchainConfig := match.Custom("OffchainConfig", func(s any) (any, error) { // coerce the value to a string diff --git a/core/scripts/keystone/src/99_app.go b/core/scripts/keystone/src/99_app.go index adca4d43887..93305c9462f 100644 --- a/core/scripts/keystone/src/99_app.go +++ b/core/scripts/keystone/src/99_app.go @@ -30,7 +30,7 @@ func NewRedialBackoff() backoff.Backoff { } } -func newApp(n *NodeWthCreds, writer io.Writer) (*clcmd.Shell, *cli.App) { +func newApp(n NodeWthCreds, writer io.Writer) (*clcmd.Shell, *cli.App) { client := &clcmd.Shell{ Renderer: clcmd.RendererJSON{Writer: writer}, AppFactory: clcmd.ChainlinkAppFactory{}, @@ -59,7 +59,7 @@ type nodeAPI struct { clientMethod func(*cli.Context) error } -func newNodeAPI(n *NodeWthCreds) *nodeAPI { +func newNodeAPI(n NodeWthCreds) *nodeAPI { output := &bytes.Buffer{} methods, app := newApp(n, output) diff --git a/core/scripts/keystone/src/99_crib_client.go b/core/scripts/keystone/src/99_crib_client.go index fbaadb7487d..0d946805904 100644 --- a/core/scripts/keystone/src/99_crib_client.go +++ b/core/scripts/keystone/src/99_crib_client.go @@ -4,7 +4,7 @@ package src import ( "fmt" - "net/url" + "sort" "strings" ) @@ -12,13 +12,24 @@ type CribClient struct { k8sClient *K8sClient } -type CLNodeCredentials struct { - URL *url.URL - DeploymentName string - ServiceName string - Username string - Password string - NodePassword string +// SimpleURL lets us marshal a URL with only the fields we need. +type SimpleURL struct { + Scheme string `json:"scheme"` + Host string `json:"host"` + Path string `json:"path"` +} + +func (s SimpleURL) String() string { + return fmt.Sprintf("%s://%s%s", s.Scheme, s.Host, s.Path) +} + +type NodeWthCreds struct { + URL SimpleURL + RemoteURL SimpleURL + ServiceName string + APILogin string + APIPassword string + KeystorePassword string } func NewCribClient() *CribClient { @@ -28,36 +39,60 @@ func NewCribClient() *CribClient { } } -func (m *CribClient) GetCLNodeCredentials() ([]CLNodeCredentials, error) { +func (m *CribClient) getCLNodes() ([]NodeWthCreds, error) { fmt.Println("Getting CL node deployments with config maps...") deployments, err := m.k8sClient.GetDeploymentsWithConfigMap() if err != nil { return nil, err } - clNodeCredentials := []CLNodeCredentials{} + nodes := []NodeWthCreds{} for _, deployment := range deployments { apiCredentials := deployment.ConfigMap.Data["apicredentials"] splitCreds := strings.Split(strings.TrimSpace(apiCredentials), "\n") username := splitCreds[0] password := splitCreds[1] - nodePassword := deployment.ConfigMap.Data["node-password"] - url, err := url.Parse("https://" + deployment.Host) + keystorePassword := deployment.ConfigMap.Data["node-password"] + url := SimpleURL{ + Scheme: "https", + Host: deployment.Host, + Path: "", + } if err != nil { return nil, err } - clNodeCredential := CLNodeCredentials{ - URL: url, - ServiceName: deployment.ServiceName, - DeploymentName: deployment.Name, - Username: username, - Password: password, - NodePassword: nodePassword, + node := NodeWthCreds{ + // We dont handle both in-cluster and out-of-cluster deployments + // Hence why both URL and RemoteURL are the same + URL: url, + RemoteURL: url, + ServiceName: deployment.ServiceName, + APILogin: username, + APIPassword: password, + KeystorePassword: keystorePassword, } - clNodeCredentials = append(clNodeCredentials, clNodeCredential) + nodes = append(nodes, node) } - return clNodeCredentials, nil + // Sort nodes by URL + sort.Slice(nodes, func(i, j int) bool { + return nodes[i].URL.Host < nodes[j].URL.Host + }) + + return nodes, nil +} + +// Implements Prompter interface +func (n NodeWthCreds) IsTerminal() bool { + return false +} + +func (n NodeWthCreds) PasswordPrompt(p string) string { + return n.APIPassword +} + +func (n NodeWthCreds) Prompt(p string) string { + return n.APILogin } diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index f1033981e74..732578a8dae 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -15,18 +15,12 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/web/presenters" ) -// KeylessNodeSet represents a set of nodes without NodeKeys. -type KeylessNodeSet struct { - Name string - Prefix string - Nodes []*NodeWthCreds -} - // NodeSet represents a set of nodes with associated metadata. -// It embeds KeylessNodeSet and includes NodeKeys. // NodeKeys are indexed by the same order as Nodes. type NodeSet struct { - KeylessNodeSet + Name string + Prefix string + Nodes []NodeWthCreds NodeKeys []NodeKeys } @@ -43,157 +37,55 @@ type NodeSets struct { StreamsTrigger NodeSet } -// downloadKeylessNodeSets downloads the node API credentials or loads them from disk if they already exist. -// It returns a NodeSets struct without NodeKeys. -func downloadKeylessNodeSets(keylessNodeSetPath string, nodeSetSize int) NodeSets { - if _, err := os.Stat(keylessNodeSetPath); err == nil { - fmt.Println("Loading existing keyless nodesets at:", keylessNodeSetPath) - nodeSets := mustReadJSON[NodeSets](keylessNodeSetPath) - +func downloadNodeSets(chainID int64, nodeSetPath string, nodeSetSize int) NodeSets { + if _, err := os.Stat(nodeSetPath); err == nil { + fmt.Println("Loading existing nodesets at:", nodeSetPath) + nodeSets := mustReadJSON[NodeSets](nodeSetPath) return nodeSets } fmt.Println("Connecting to Kubernetes to fetch node credentials...") crib := NewCribClient() - clNodesWithCreds, err := crib.GetCLNodeCredentials() + nodes, err := crib.getCLNodes() PanicErr(err) - nodesList := clNodesWithCredsToNodes(clNodesWithCreds) - if len(nodesList) == 0 { - panic("no nodes found") - } - keylessNodeSets, err := splitNodesIntoNodeSets(nodesList, nodeSetSize) - PanicErr(err) - - mustWriteJSON(keylessNodeSetPath, keylessNodeSets) - - return keylessNodeSets -} - -func downloadNodeSets(keylessNodeSetsPath string, chainID int64, nodeSetPath string, nodeSetSize int) NodeSets { - if _, err := os.Stat(nodeSetPath); err == nil { - fmt.Println("Loading existing nodesets at", nodeSetPath) - nodeSets := mustReadJSON[NodeSets](nodeSetPath) - - return nodeSets - } - - nodeSetsWithoutKeys := downloadKeylessNodeSets(keylessNodeSetsPath, nodeSetSize) - nodeSets := populateNodeKeys(chainID, nodeSetsWithoutKeys) - mustWriteJSON(nodeSetPath, nodeSets) - - return nodeSets -} - -// splitNodesIntoNodeSets splits the nodes into NodeSets for 'workflow' and 'streams-trigger' nodeSets. -func splitNodesIntoNodeSets(nodes []*NodeWthCreds, nodeSetSize int) (NodeSets, error) { totalNodes := len(nodes) + // Workflow and StreamsTrigger nodeSets should have the same number of nodes + // hence we need at least 2 * nodeSetSize nodes requiredNodes := nodeSetSize * 2 if totalNodes < requiredNodes { - return NodeSets{}, fmt.Errorf("not enough nodes to populate both nodeSets: required %d, got %d", requiredNodes, totalNodes) + panic(fmt.Errorf("not enough nodes to populate both nodeSets: required %d, got %d", requiredNodes, totalNodes)) } - return NodeSets{ + nodeSets := NodeSets{ Workflow: NodeSet{ - KeylessNodeSet: KeylessNodeSet{ - Name: WorkflowNodeSetName, - Prefix: WorkflowNodeSetPrefix, - Nodes: nodes[:nodeSetSize], - }, - // NodeKeys will be populated later + Name: WorkflowNodeSetName, + Prefix: WorkflowNodeSetPrefix, + Nodes: nodes[:nodeSetSize], }, StreamsTrigger: NodeSet{ - KeylessNodeSet: KeylessNodeSet{ - Name: StreamsTriggerNodeSetName, - Prefix: StreamsTriggerNodeSetPrefix, - Nodes: nodes[nodeSetSize : nodeSetSize*2], - }, - // NodeKeys will be populated later + Name: StreamsTriggerNodeSetName, + Prefix: StreamsTriggerNodeSetPrefix, + Nodes: nodes[nodeSetSize : nodeSetSize*2], }, - }, nil -} - -// populateNodeKeys fetches and assigns NodeKeys to each NodeSet in NodeSets. -func populateNodeKeys(chainID int64, nodeSetsWithoutKeys NodeSets) NodeSets { - var nodeSets NodeSets - - nodeSets.Workflow = NodeSet{ - KeylessNodeSet: nodeSetsWithoutKeys.Workflow.KeylessNodeSet, } - workflowKeys := mustFetchAllNodeKeys(chainID, nodeSets.Workflow.Nodes) - nodeSets.Workflow.NodeKeys = convertAllKeysToNodeKeys(workflowKeys) - nodeSets.StreamsTrigger = NodeSet{ - KeylessNodeSet: nodeSetsWithoutKeys.StreamsTrigger.KeylessNodeSet, - } - streamsTriggerKeys := mustFetchAllNodeKeys(chainID, nodeSets.StreamsTrigger.Nodes) - nodeSets.StreamsTrigger.NodeKeys = convertAllKeysToNodeKeys(streamsTriggerKeys) + nodeSets.Workflow.NodeKeys = mustFetchNodeKeys(chainID, nodeSets.Workflow.Nodes, true) + nodeSets.StreamsTrigger.NodeKeys = mustFetchNodeKeys(chainID, nodeSets.StreamsTrigger.Nodes, false) + mustWriteJSON(nodeSetPath, nodeSets) return nodeSets } -// gatherAllNodeKeys aggregates all NodeKeys from NodeSets. -func gatherAllNodeKeys(nodeSets NodeSets) []AllNodeKeys { - var allKeys []AllNodeKeys - for _, nodeSet := range []NodeSet{nodeSets.Workflow, nodeSets.StreamsTrigger} { - for _, key := range nodeSet.NodeKeys { - allKeys = append(allKeys, key.toAllNodeKeys()) - } - } - return allKeys -} - -// convertAllKeysToNodeKeys converts AllNodeKeys to NodeKeys. -func convertAllKeysToNodeKeys(allKeys []AllNodeKeys) []NodeKeys { - nodeKeys := []NodeKeys{} - for _, k := range allKeys { - nodeKeys = append(nodeKeys, k.toNodeKeys()) - } - return nodeKeys -} - -func trimmedOCR2KB(ocr2Bndl cmd.OCR2KeyBundlePresenter) OCR2KBTrimmed { - return OCR2KBTrimmed{ - OCR2BundleID: ocr2Bndl.ID, - OCR2ConfigPublicKey: strings.TrimPrefix(ocr2Bndl.ConfigPublicKey, "ocr2cfg_evm_"), - OCR2OnchainPublicKey: strings.TrimPrefix(ocr2Bndl.OnchainPublicKey, "ocr2on_evm_"), - OCR2OffchainPublicKey: strings.TrimPrefix(ocr2Bndl.OffChainPublicKey, "ocr2off_evm_"), - } -} - -func trimmedAptosOCR2KB(ocr2Bndl cmd.OCR2KeyBundlePresenter) OCR2AptosKBTrimmed { - return OCR2AptosKBTrimmed{ - AptosBundleID: ocr2Bndl.ID, - AptosOnchainPublicKey: strings.TrimPrefix(ocr2Bndl.OnchainPublicKey, "ocr2on_aptos_"), - } -} - -type AllNodeKeys struct { - AptosAccount string `json:"AptosAccount"` - OCR2AptosKBs []OCR2AptosKBTrimmed `json:"OCR2AptosKBs"` - EthAddress string `json:"EthAddress"` - P2PPeerID string `json:"P2PPeerID"` // p2p_ - OCR2KBs []OCR2KBTrimmed `json:"OCR2KBs"` - CSAPublicKey string `json:"CSAPublicKey"` -} - -func (a AllNodeKeys) toNodeKeys() NodeKeys { - return NodeKeys{ - AptosAccount: a.AptosAccount, - OCR2AptosKBTrimmed: OCR2AptosKBTrimmed{ - AptosBundleID: a.OCR2AptosKBs[0].AptosBundleID, - AptosOnchainPublicKey: a.OCR2AptosKBs[0].AptosOnchainPublicKey, - }, - OCR2KBTrimmed: OCR2KBTrimmed{ - OCR2BundleID: a.OCR2KBs[0].OCR2BundleID, - OCR2ConfigPublicKey: a.OCR2KBs[0].OCR2ConfigPublicKey, - OCR2OnchainPublicKey: a.OCR2KBs[0].OCR2OnchainPublicKey, - OCR2OffchainPublicKey: a.OCR2KBs[0].OCR2OffchainPublicKey, - }, - EthAddress: a.EthAddress, - P2PPeerID: a.P2PPeerID, - CSAPublicKey: a.CSAPublicKey, - } +// NodeKeys represents the keys for a single node. +// If there are multiple OCR2KBs or OCR2AptosKBs, only the first one is used. +type NodeKeys struct { + AptosAccount string `json:"AptosAccount"` + EthAddress string `json:"EthAddress"` + P2PPeerID string `json:"P2PPeerID"` + CSAPublicKey string `json:"CSAPublicKey"` + OCR2KBTrimmed + OCR2AptosKBTrimmed } // This is an OCR key bundle with the prefixes on each respective key @@ -212,40 +104,8 @@ type OCR2AptosKBTrimmed struct { AptosOnchainPublicKey string `json:"AptosOnchainPublicKey"` // ocr2on_aptos_ } -type NodeKeys struct { - EthAddress string `json:"EthAddress"` - OCR2KBTrimmed - AptosAccount string `json:"AptosAccount"` - OCR2AptosKBTrimmed - P2PPeerID string `json:"P2PPeerID"` - CSAPublicKey string `json:"CSAPublicKey"` -} - -func (n NodeKeys) toAllNodeKeys() AllNodeKeys { - return AllNodeKeys{ - EthAddress: n.EthAddress, - AptosAccount: n.AptosAccount, - P2PPeerID: n.P2PPeerID, - OCR2KBs: []OCR2KBTrimmed{ - { - OCR2BundleID: n.OCR2BundleID, - OCR2ConfigPublicKey: n.OCR2ConfigPublicKey, - OCR2OnchainPublicKey: n.OCR2OnchainPublicKey, - OCR2OffchainPublicKey: n.OCR2OffchainPublicKey, - }, - }, - OCR2AptosKBs: []OCR2AptosKBTrimmed{ - { - AptosBundleID: n.AptosBundleID, - AptosOnchainPublicKey: n.AptosOnchainPublicKey, - }, - }, - CSAPublicKey: n.CSAPublicKey, - } -} - -func mustFetchAllNodeKeys(chainId int64, nodes []*NodeWthCreds) []AllNodeKeys { - allNodeKeys := []AllNodeKeys{} +func mustFetchNodeKeys(chainId int64, nodes []NodeWthCreds, createAptosKeys bool) []NodeKeys { + nodeKeys := []NodeKeys{} for _, n := range nodes { api := newNodeAPI(n) @@ -255,32 +115,10 @@ func mustFetchAllNodeKeys(chainId int64, nodes []*NodeWthCreds) []AllNodeKeys { ethAddress, err := findFirstGoodEthKeyAddress(chainId, *ethKeys) helpers.PanicErr(err) - // Get aptos account key - api.output.Reset() - aKeysClient := cmd.NewAptosKeysClient(api.methods) - err = aKeysClient.ListKeys(&cli.Context{App: api.app}) - helpers.PanicErr(err) - var aptosKeys []presenters.AptosKeyResource - helpers.PanicErr(json.Unmarshal(api.output.Bytes(), &aptosKeys)) - if len(aptosKeys) == 0 { - api.output.Reset() - fmt.Printf("WARN: node has no aptos keys, creating one...\n") - err = aKeysClient.CreateKey(&cli.Context{App: api.app}) - helpers.PanicErr(err) - api.output.Reset() - err = aKeysClient.ListKeys(&cli.Context{App: api.app}) - helpers.PanicErr(err) - helpers.PanicErr(json.Unmarshal(api.output.Bytes(), &aptosKeys)) - api.output.Reset() - } - if len(aptosKeys) != 1 { - // list number of keys - fmt.Printf("Node has %d aptos keys\n", len(aptosKeys)) - PanicErr(errors.New("node must have single aptos key")) + var aptosAccount string + if createAptosKeys { + aptosAccount = getOrCreateAptosKey(api, err) } - fmt.Printf("Node has aptos account %s\n", aptosKeys[0].Account) - aptosAccount := aptosKeys[0].Account - api.output.Reset() // Get p2p key p2pKeys := api.mustExec(api.methods.ListP2PKeys) @@ -294,16 +132,13 @@ func mustFetchAllNodeKeys(chainId int64, nodes []*NodeWthCreds) []AllNodeKeys { bundles := api.mustExec(api.methods.ListOCR2KeyBundles) ocr2Bundles := mustJSON[cmd.OCR2KeyBundlePresenters](bundles) - // We use the same bundle length for each chain since - // we marhshall them together into a single multichain key - // via ocrcommon.MarshalMultichainPublicKey - expectedBundleLen := 2 + expectedBundleLen := 1 // evm key bundles ocr2EvmBundles := getTrimmedEVMOCR2KBs(*ocr2Bundles) evmBundleLen := len(ocr2EvmBundles) if evmBundleLen < expectedBundleLen { - fmt.Printf("WARN: node has %d EVM OCR2 bundles when it should have at least 2, creating bundles...\n", evmBundleLen) + fmt.Printf("WARN: node has %d EVM OCR2 bundles when it should have at least %d, creating bundles...\n", evmBundleLen, expectedBundleLen) for i := evmBundleLen; i < expectedBundleLen; i++ { cBundle := api.withArg("evm").mustExec(api.methods.CreateOCR2KeyBundle) createdBundle := mustJSON[cmd.OCR2KeyBundlePresenter](cBundle) @@ -313,16 +148,9 @@ func mustFetchAllNodeKeys(chainId int64, nodes []*NodeWthCreds) []AllNodeKeys { } // aptos key bundles - ocr2AptosBundles := getTrimmedAptosOCR2KBs(*ocr2Bundles) - aptosBundleLen := len(ocr2AptosBundles) - if aptosBundleLen < expectedBundleLen { - fmt.Printf("WARN: node has %d Aptos OCR2 bundles when it should have at least 2, creating bundles...\n", aptosBundleLen) - for i := aptosBundleLen; i < expectedBundleLen; i++ { - cBundle := api.withArg("aptos").mustExec(api.methods.CreateOCR2KeyBundle) - createdBundle := mustJSON[cmd.OCR2KeyBundlePresenter](cBundle) - fmt.Println("Created OCR2 Aptos key bundle", string(cBundle)) - ocr2AptosBundles = append(ocr2AptosBundles, trimmedAptosOCR2KB(*createdBundle)) - } + var ocr2AptosBundles []OCR2AptosKBTrimmed + if createAptosKeys { + ocr2AptosBundles = createAptosOCR2KB(ocr2Bundles, expectedBundleLen, api) } csaKeys := api.mustExec(api.methods.ListCSAKeys) @@ -330,26 +158,90 @@ func mustFetchAllNodeKeys(chainId int64, nodes []*NodeWthCreds) []AllNodeKeys { csaPubKey, err := findFirstCSAPublicKey(*csaKeyResources) helpers.PanicErr(err) - nodeKeys := AllNodeKeys{ - EthAddress: ethAddress, - AptosAccount: aptosAccount, - P2PPeerID: peerID, - OCR2KBs: ocr2EvmBundles, - OCR2AptosKBs: ocr2AptosBundles, - CSAPublicKey: strings.TrimPrefix(csaPubKey, "csa_"), + // We can handle multiple OCR bundles in the future + // but for now we only support a single bundle per node + keys := NodeKeys{ + OCR2KBTrimmed: ocr2EvmBundles[0], + EthAddress: ethAddress, + AptosAccount: aptosAccount, + P2PPeerID: peerID, + CSAPublicKey: strings.TrimPrefix(csaPubKey, "csa_"), + } + if createAptosKeys { + keys.OCR2AptosKBTrimmed = ocr2AptosBundles[0] } - allNodeKeys = append(allNodeKeys, nodeKeys) + nodeKeys = append(nodeKeys, keys) } - return allNodeKeys + return nodeKeys } -func findFirstCSAPublicKey(csaKeyResources []presenters.CSAKeyResource) (string, error) { - for _, r := range csaKeyResources { - return r.PubKey, nil +func trimmedOCR2KB(ocr2Bndl cmd.OCR2KeyBundlePresenter) OCR2KBTrimmed { + return OCR2KBTrimmed{ + OCR2BundleID: ocr2Bndl.ID, + OCR2ConfigPublicKey: strings.TrimPrefix(ocr2Bndl.ConfigPublicKey, "ocr2cfg_evm_"), + OCR2OnchainPublicKey: strings.TrimPrefix(ocr2Bndl.OnchainPublicKey, "ocr2on_evm_"), + OCR2OffchainPublicKey: strings.TrimPrefix(ocr2Bndl.OffChainPublicKey, "ocr2off_evm_"), } - return "", errors.New("did not find any CSA Key Resources") +} + +func trimmedAptosOCR2KB(ocr2Bndl cmd.OCR2KeyBundlePresenter) OCR2AptosKBTrimmed { + return OCR2AptosKBTrimmed{ + AptosBundleID: ocr2Bndl.ID, + AptosOnchainPublicKey: strings.TrimPrefix(ocr2Bndl.OnchainPublicKey, "ocr2on_aptos_"), + } +} + +func createAptosOCR2KB(ocr2Bundles *cmd.OCR2KeyBundlePresenters, expectedBundleLen int, api *nodeAPI) []OCR2AptosKBTrimmed { + ocr2AptosBundles := getTrimmedAptosOCR2KBs(*ocr2Bundles) + aptosBundleLen := len(ocr2AptosBundles) + + if aptosBundleLen < expectedBundleLen { + fmt.Printf("WARN: node has %d Aptos OCR2 bundles when it should have at least %d, creating bundles...\n", aptosBundleLen, expectedBundleLen) + for i := aptosBundleLen; i < expectedBundleLen; i++ { + cBundle := api.withArg("aptos").mustExec(api.methods.CreateOCR2KeyBundle) + createdBundle := mustJSON[cmd.OCR2KeyBundlePresenter](cBundle) + fmt.Println("Created OCR2 Aptos key bundle", string(cBundle)) + ocr2AptosBundles = append(ocr2AptosBundles, trimmedAptosOCR2KB(*createdBundle)) + } + } + + return ocr2AptosBundles +} + +// getOrCreateAptosKey returns the Aptos account of the node. +// +// If the node has no Aptos keys, it creates one and returns the account. +func getOrCreateAptosKey(api *nodeAPI, err error) string { + api.output.Reset() + aKeysClient := cmd.NewAptosKeysClient(api.methods) + err = aKeysClient.ListKeys(&cli.Context{App: api.app}) + helpers.PanicErr(err) + var aptosKeys []presenters.AptosKeyResource + helpers.PanicErr(json.Unmarshal(api.output.Bytes(), &aptosKeys)) + if len(aptosKeys) == 0 { + api.output.Reset() + fmt.Printf("WARN: node has no aptos keys, creating one...\n") + err = aKeysClient.CreateKey(&cli.Context{App: api.app}) + helpers.PanicErr(err) + api.output.Reset() + err = aKeysClient.ListKeys(&cli.Context{App: api.app}) + helpers.PanicErr(err) + helpers.PanicErr(json.Unmarshal(api.output.Bytes(), &aptosKeys)) + api.output.Reset() + } + + if len(aptosKeys) != 1 { + fmt.Printf("Node has %d aptos keys\n", len(aptosKeys)) + PanicErr(errors.New("node must have single aptos key")) + } + + fmt.Printf("Node has aptos account %s\n", aptosKeys[0].Account) + aptosAccount := aptosKeys[0].Account + api.output.Reset() + + return aptosAccount } func getTrimmedAptosOCR2KBs(ocr2Bundles cmd.OCR2KeyBundlePresenters) []OCR2AptosKBTrimmed { @@ -372,6 +264,13 @@ func getTrimmedEVMOCR2KBs(ocr2Bundles cmd.OCR2KeyBundlePresenters) []OCR2KBTrimm return evmBundles } +func findFirstCSAPublicKey(csaKeyResources []presenters.CSAKeyResource) (string, error) { + for _, r := range csaKeyResources { + return r.PubKey, nil + } + return "", errors.New("did not find any CSA Key Resources") +} + func findFirstGoodEthKeyAddress(chainID int64, ethKeys []presenters.ETHKeyResource) (string, error) { for _, ethKey := range ethKeys { if ethKey.EVMChainID.Equal(ubig.NewI(chainID)) && !ethKey.Disabled { diff --git a/core/scripts/keystone/src/99_files.go b/core/scripts/keystone/src/99_files.go index 460e1f20f70..8a0b4161c8e 100644 --- a/core/scripts/keystone/src/99_files.go +++ b/core/scripts/keystone/src/99_files.go @@ -13,10 +13,8 @@ import ( const ( defaultArtefactsDir = "artefacts" defaultNodeSetsPath = ".cache/node_sets.json" - defaultKeylessNodeSetsPath = ".cache/keyless_node_sets.json" deployedContractsJSON = "deployed_contracts.json" bootstrapSpecTemplate = "bootstrap.toml" - streamsTriggerSpecTemplate = "streams_trigger.toml" oracleSpecTemplate = "oracle.toml" ) diff --git a/core/scripts/keystone/src/99_nodes.go b/core/scripts/keystone/src/99_nodes.go deleted file mode 100644 index de21fe2cf0a..00000000000 --- a/core/scripts/keystone/src/99_nodes.go +++ /dev/null @@ -1,49 +0,0 @@ -package src - -import ( - "net/url" - "sort" -) - -type NodeWthCreds struct { - URL *url.URL - RemoteURL *url.URL - ServiceName string - DeploymentName string - Login string - Password string -} - -func (n NodeWthCreds) IsTerminal() bool { - return false -} - -func (n NodeWthCreds) PasswordPrompt(p string) string { - return n.Password -} - -func (n NodeWthCreds) Prompt(p string) string { - return n.Login -} - -// clNodesWithCredsToNodes converts CLNodeCredentials to a slice of nodes. -func clNodesWithCredsToNodes(clNodesWithCreds []CLNodeCredentials) []*NodeWthCreds { - nodes := []*NodeWthCreds{} - for _, cl := range clNodesWithCreds { - n := NodeWthCreds{ - URL: cl.URL, - RemoteURL: cl.URL, - ServiceName: cl.ServiceName, - DeploymentName: cl.DeploymentName, - Password: cl.Password, - Login: cl.Username, - } - nodes = append(nodes, &n) - } - - // Sort nodes by URL - sort.Slice(nodes, func(i, j int) bool { - return nodes[i].URL.String() < nodes[j].URL.String() - }) - return nodes -} diff --git a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap index 44460ebc373..55cb88a0930 100755 --- a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap @@ -28,7 +28,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -41,7 +41,7 @@ helm: Nodes = [] [EVM.Workflow] - FromAddress = '0xDA964d2Fe39E5aAE9C1226171F207e4C57c85a77' + FromAddress = '0x75cf1355cC4Eb358feaBb9e269a4DAEeB6721DBB' ForwarderAddress = '0x0200000000000000000000000000000000000000' 0-ks-wf-node3: image: ${runtime.images.app} @@ -50,7 +50,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -63,7 +63,7 @@ helm: Nodes = [] [EVM.Workflow] - FromAddress = '0xc8Cf02aF00b435c5F2311B9F158D9b69226116C3' + FromAddress = '0xc6dcE30f492CBD223b9946603192f22D86e783ca' ForwarderAddress = '0x0200000000000000000000000000000000000000' 0-ks-wf-node4: image: ${runtime.images.app} @@ -72,7 +72,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -85,7 +85,7 @@ helm: Nodes = [] [EVM.Workflow] - FromAddress = '0xAbACcde3e1e6916cE46AB2472AB788941f1ce088' + FromAddress = '0x1289d00A6565Afcd6437B09548F6019EF49696d0' ForwarderAddress = '0x0200000000000000000000000000000000000000' 0-ks-wf-node5: image: ${runtime.images.app} @@ -94,7 +94,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -107,7 +107,7 @@ helm: Nodes = [] [EVM.Workflow] - FromAddress = '0xB81D8e06Cf34347D22776D1Db67011aBD43ae07D' + FromAddress = '0x4b92B0aaC39932B7302676F48e78FA91852DC0EE' ForwarderAddress = '0x0200000000000000000000000000000000000000' 1-ks-str-trig-bt-node1: image: ${runtime.images.app} @@ -116,7 +116,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -134,7 +134,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -152,7 +152,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -170,7 +170,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] @@ -188,7 +188,7 @@ helm: [Capabilities.Peering] [Capabilities.Peering.V2] Enabled = true - DefaultBootstrappers = ['12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6691'] + DefaultBootstrappers = ['12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6691'] ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] diff --git a/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap b/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap index 87b635876d4..ab20fb10ae7 100755 --- a/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap +++ b/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap @@ -19,13 +19,13 @@ type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "e5c943f6bccc202dfd94ac4727f3263d3fbf90a61210fb36bdab46b8868866bc" +ocrKeyBundleID = "20ccdc97afdf467465590115e3da4e5eb591bf5f43808e81a5d0807cd889b3c7" p2pv2Bootstrappers = [ - "12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6690", + "12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0xDA964d2Fe39E5aAE9C1226171F207e4C57c85a77" +transmitterID = "0x75cf1355cC4Eb358feaBb9e269a4DAEeB6721DBB" [relayConfig] chainID = "1337" @@ -40,8 +40,8 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "e5c943f6bccc202dfd94ac4727f3263d3fbf90a61210fb36bdab46b8868866bc" -aptos = "264ab5c3053ced6966e224ba928c2302749c428ddc4878ee3b3e84f812ba19d5" +evm = "20ccdc97afdf467465590115e3da4e5eb591bf5f43808e81a5d0807cd889b3c7" +aptos = "ac364cec9fe7d9ea1035fc511e5b2f30900caa6e65ac0501168005d05129e088" -------------------------------- Oracle 1: @@ -50,13 +50,13 @@ type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "5682657c3c43cbe56e5b3b0134630987637d4815a0acac7e657c399f500756be" +ocrKeyBundleID = "c734a4bf01aabe8152b7d0df0b18111ce9b3fe1ef1bca1d6a580967c8e4afc2d" p2pv2Bootstrappers = [ - "12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6690", + "12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0xc8Cf02aF00b435c5F2311B9F158D9b69226116C3" +transmitterID = "0xc6dcE30f492CBD223b9946603192f22D86e783ca" [relayConfig] chainID = "1337" @@ -71,8 +71,8 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "5682657c3c43cbe56e5b3b0134630987637d4815a0acac7e657c399f500756be" -aptos = "2b6d59d0957e9b6bf821be3fda1976c8d9944bebe6c66f0b0405bf5bf4cca40a" +evm = "c734a4bf01aabe8152b7d0df0b18111ce9b3fe1ef1bca1d6a580967c8e4afc2d" +aptos = "f1dfc3d44ee349b4349f33ce4c0ec3716142e9be3ae3ba9276c616556f6430bb" -------------------------------- Oracle 2: @@ -81,13 +81,13 @@ type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "ec1f8a0a941474ef0313e61cff67aa622d64cbb079c00abca93672c5caf9438e" +ocrKeyBundleID = "129377e1aea4f628b2a3274e528a131175ace13e7cc062b048a34f5b4cf7b512" p2pv2Bootstrappers = [ - "12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6690", + "12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0xAbACcde3e1e6916cE46AB2472AB788941f1ce088" +transmitterID = "0x1289d00A6565Afcd6437B09548F6019EF49696d0" [relayConfig] chainID = "1337" @@ -102,8 +102,8 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "ec1f8a0a941474ef0313e61cff67aa622d64cbb079c00abca93672c5caf9438e" -aptos = "e506f4bc2a7a886534617018b77cccb9e9823545e07c14f3cab04028966c44e7" +evm = "129377e1aea4f628b2a3274e528a131175ace13e7cc062b048a34f5b4cf7b512" +aptos = "2e39d555ec0d1e8795167d72d2a53faa5c537762c144f8a569c601f6bcc95d1d" -------------------------------- Oracle 3: @@ -112,13 +112,13 @@ type = "offchainreporting2" schemaVersion = 1 name = "Keystone" contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "0bdb79dc47a775ff16ff11047505d409d0e83de4f078dca915a4361241a753b4" +ocrKeyBundleID = "053f21bfd2bbdb65261308af2d0be48593229d644d8b9e3e5dbe36f85399ae6c" p2pv2Bootstrappers = [ - "12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW@app-0-ks-wf-bt-node1:6690", + "12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6690", ] relay = "evm" pluginType = "plugin" -transmitterID = "0xB81D8e06Cf34347D22776D1Db67011aBD43ae07D" +transmitterID = "0x4b92B0aaC39932B7302676F48e78FA91852DC0EE" [relayConfig] chainID = "1337" @@ -133,8 +133,8 @@ telemetryType = "plugin" [onchainSigningStrategy] strategyName = 'multi-chain' [onchainSigningStrategy.config] -evm = "0bdb79dc47a775ff16ff11047505d409d0e83de4f078dca915a4361241a753b4" -aptos = "54e51e786ad29fa4d5ea4e9215f7f09d5eb8625a2b9895ac4c1548beb1341e2a" +evm = "053f21bfd2bbdb65261308af2d0be48593229d644d8b9e3e5dbe36f85399ae6c" +aptos = "3de7ab03a5b6b7fcfd196c6101d9302c5e6a5221ebd82b1fd9afa9a6bc9b0445" --- diff --git a/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap b/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap index 3e27f7d6397..76c7b8965d3 100755 --- a/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap +++ b/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap @@ -6,16 +6,16 @@ "OffchainConfigVersion": 30, "OnchainConfig": "0x", "Signers": [ - "0114003a6096c5d2101a6e80831ab7f2487a134add5a6205200065523a44b882753ced0eb96aa34c73c5d43a1c47a59f0542a0cb37346f392f07", - "01140077c2410a03b29fe22171ba322637e1f3f0d6a9390520008e340cc57026d3c8ee171dc972f1ca9ea8f772672245ec8607c48636f0a8a381", - "011400390a4d631cd08f83eacf7a9e4475d2b2a9ccc1c7052000900890fb1e8b55f69699098567bdec761b068cd258d696d4fce60881546001b4", - "011400b19d0be1065fa4a87cc4b817da70bb63a75b2fb30520006e42e0650e3b11aca5c59d04f5f7f5ce0048604abdf09f78c1b91aaf543d90b7" + "011400321bc7af41a634375526006365a31bf32b4cfa7c0520004ca789105da974eec967758ad32b575741d6cb36c1bb3bcfd87b235502cc1753", + "0114005192c43a68efb7a698c0459ff8591a115da128ee052000169008927a60e6c03e99aac6fa268dabaf4d00e117419861d87836211267361b", + "011400ed613636925af2df6ed8332d95028eabcbe95a3f052000ce86b34de67249f92058f69e47961907ebbf8a71c12123f1d2a7cab4874f6365", + "01140053b5bbc0efa2e2d2770029bab5d5a647a260a72b052000f2cb4932d3ce8c10bf67c60d35372a5ff1578255e25c2a119c2dea70e919567a" ], "Transmitters": [ - "0xDA964d2Fe39E5aAE9C1226171F207e4C57c85a77", - "0xc8Cf02aF00b435c5F2311B9F158D9b69226116C3", - "0xAbACcde3e1e6916cE46AB2472AB788941f1ce088", - "0xB81D8e06Cf34347D22776D1Db67011aBD43ae07D" + "0x75cf1355cC4Eb358feaBb9e269a4DAEeB6721DBB", + "0xc6dcE30f492CBD223b9946603192f22D86e783ca", + "0x1289d00A6565Afcd6437B09548F6019EF49696d0", + "0x4b92B0aaC39932B7302676F48e78FA91852DC0EE" ] } --- diff --git a/core/scripts/keystone/src/testdata/keyless_node_sets.json b/core/scripts/keystone/src/testdata/keyless_node_sets.json deleted file mode 100644 index 3e1ae60df03..00000000000 --- a/core/scripts/keystone/src/testdata/keyless_node_sets.json +++ /dev/null @@ -1,336 +0,0 @@ -{ - "Workflow": { - "Name": "workflow", - "Prefix": "ks-wf-", - "Nodes": [ - { - "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-bt-node1.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-bt-node1.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "ServiceName": "app-0-ks-wf-bt-node1", - "DeploymentName": "app-0-ks-wf-bt-node1-bootstrap", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" - }, - { - "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node2.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node2.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "ServiceName": "app-0-ks-wf-node2", - "DeploymentName": "app-0-ks-wf-node2", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" - }, - { - "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node3.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node3.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "ServiceName": "app-0-ks-wf-node3", - "DeploymentName": "app-0-ks-wf-node3", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" - }, - { - "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node4.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node4.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "ServiceName": "app-0-ks-wf-node4", - "DeploymentName": "app-0-ks-wf-node4", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" - }, - { - "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node5.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node5.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "ServiceName": "app-0-ks-wf-node5", - "DeploymentName": "app-0-ks-wf-node5", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" - } - ], - "NodeKeys": null - }, - "StreamsTrigger": { - "Name": "streams-trigger", - "Prefix": "ks-str-trig-", - "Nodes": [ - { - "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-bt-node1.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-bt-node1.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "ServiceName": "app-1-ks-str-trig-bt-node1", - "DeploymentName": "app-1-ks-str-trig-bt-node1", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" - }, - { - "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node2.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node2.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "ServiceName": "app-1-ks-str-trig-node2", - "DeploymentName": "app-1-ks-str-trig-node2", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" - }, - { - "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node3.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node3.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "ServiceName": "app-1-ks-str-trig-node3", - "DeploymentName": "app-1-ks-str-trig-node3", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" - }, - { - "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node4.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node4.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "ServiceName": "app-1-ks-str-trig-node4", - "DeploymentName": "app-1-ks-str-trig-node4", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" - }, - { - "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node5.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node5.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" - }, - "ServiceName": "app-1-ks-str-trig-node5", - "DeploymentName": "app-1-ks-str-trig-node5", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" - } - ], - "NodeKeys": null - } -} diff --git a/core/scripts/keystone/src/testdata/node_sets.json b/core/scripts/keystone/src/testdata/node_sets.json index e9f7be3f6f1..b5502a0ed53 100644 --- a/core/scripts/keystone/src/testdata/node_sets.json +++ b/core/scripts/keystone/src/testdata/node_sets.json @@ -5,225 +5,145 @@ "Nodes": [ { "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-bt-node1.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-0-ks-wf-bt-node1.local", + "path": "" }, "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-bt-node1.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-0-ks-wf-bt-node1.local", + "path": "" }, "ServiceName": "app-0-ks-wf-bt-node1", - "DeploymentName": "app-0-ks-wf-bt-node1-bootstrap", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" + "APILogin": "notreal@fakeemail.ch", + "APIPassword": "fj293fbBnlQ!f9vNs", + "KeystorePassword": "T.tLHkcmwePT/p,]sYuntjwHKAsrhm#4eRs4LuKHwvHejWYAC2JP4M8HimwgmbaZ" }, { "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node2.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-0-ks-wf-node2.local", + "path": "" }, "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node2.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-0-ks-wf-node2.local", + "path": "" }, "ServiceName": "app-0-ks-wf-node2", - "DeploymentName": "app-0-ks-wf-node2", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" + "APILogin": "notreal@fakeemail.ch", + "APIPassword": "fj293fbBnlQ!f9vNs", + "KeystorePassword": "T.tLHkcmwePT/p,]sYuntjwHKAsrhm#4eRs4LuKHwvHejWYAC2JP4M8HimwgmbaZ" }, { "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node3.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-0-ks-wf-node3.local", + "path": "" }, "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node3.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-0-ks-wf-node3.local", + "path": "" }, "ServiceName": "app-0-ks-wf-node3", - "DeploymentName": "app-0-ks-wf-node3", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" + "APILogin": "notreal@fakeemail.ch", + "APIPassword": "fj293fbBnlQ!f9vNs", + "KeystorePassword": "T.tLHkcmwePT/p,]sYuntjwHKAsrhm#4eRs4LuKHwvHejWYAC2JP4M8HimwgmbaZ" }, { "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node4.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-0-ks-wf-node4.local", + "path": "" }, "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node4.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-0-ks-wf-node4.local", + "path": "" }, "ServiceName": "app-0-ks-wf-node4", - "DeploymentName": "app-0-ks-wf-node4", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" + "APILogin": "notreal@fakeemail.ch", + "APIPassword": "fj293fbBnlQ!f9vNs", + "KeystorePassword": "T.tLHkcmwePT/p,]sYuntjwHKAsrhm#4eRs4LuKHwvHejWYAC2JP4M8HimwgmbaZ" }, { "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node5.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-0-ks-wf-node5.local", + "path": "" }, "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-0-ks-wf-node5.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-0-ks-wf-node5.local", + "path": "" }, "ServiceName": "app-0-ks-wf-node5", - "DeploymentName": "app-0-ks-wf-node5", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" + "APILogin": "notreal@fakeemail.ch", + "APIPassword": "fj293fbBnlQ!f9vNs", + "KeystorePassword": "T.tLHkcmwePT/p,]sYuntjwHKAsrhm#4eRs4LuKHwvHejWYAC2JP4M8HimwgmbaZ" } ], "NodeKeys": [ { - "EthAddress": "0x4cdEf4eaD7C47d804e26dF56aCbf5f7F7E28f912", - "OCR2BundleID": "56f6587a9fd23fb62cedaeeab0fc302dc38c824aae4b7a5da46c850bee281f14", - "OCR2OnchainPublicKey": "59a4e23a84bc7b54179f1028eae1857a425370e1", - "OCR2OffchainPublicKey": "3ac4e8c462d6bef48ea5e19cc00c7510fdaf5f13ca1229092aba2389e8508136", - "OCR2ConfigPublicKey": "82965a3d5175e2643671623ac61eb135a79132586139506319a25608a08dde3d", - "AptosAccount": "1f7a3ac9556d3ee2e11e9700fa5b7e58ef329158bee1dd1e30231a37b6e75fd8", - "AptosBundleID": "728fcde3160c46b394c3612add0206229266f2346f8c802a07cbe4e7026166fb", - "AptosOnchainPublicKey": "83352d71acdd5cc7b65d84d92aa31cdd9d129a5ce49184bcc2d4c7e58114cc56", - "P2PPeerID": "12D3KooWA7vvR9tG8n76xGXuipuXo2hE6Act1zcLxYyQm7ixBuvW", - "CSAPublicKey": "a5024bd1f5ccd546a3c5086fb1544debe51c79a6c301a7c7ac001dbc7621b66f" + "AptosAccount": "38476e214b5c60e642019b38db9f06ce6c5a9bcb987d2bfbbbe750195aa7e964", + "EthAddress": "0x568C859E34F210a23847acE0D4960dB74f359dC4", + "P2PPeerID": "12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq", + "CSAPublicKey": "981d781740ff79bb181a4c70390bd54e936f2d9211f5b20c708205b481a8efcc", + "OCR2BundleID": "782e4d14d0f53071ab7a45b9085eb99beed3350e7ab72d5edd4429169e5c87ef", + "OCR2OnchainPublicKey": "357ddc6c0fc6510ec67edbb9a63819dcb47f1506", + "OCR2OffchainPublicKey": "822488a7e4583eed41e5ab142dd6be721c2cc0f217ceee0912ff2db2a24e404c", + "OCR2ConfigPublicKey": "c92ae7ff9b1cef97bb875917456bc6b83df5f5a76ad00c914869c7068748f31a", + "AptosBundleID": "d4acd2c80860fd1e49363f08426e7e5efa7fcd57356a8aba408732e975d3e9a6", + "AptosOnchainPublicKey": "48b37d91fd2c2c784759021d421e7e6f98078b4343cf8cab378394aa357a49a2" }, { - "EthAddress": "0xDA964d2Fe39E5aAE9C1226171F207e4C57c85a77", - "OCR2BundleID": "e5c943f6bccc202dfd94ac4727f3263d3fbf90a61210fb36bdab46b8868866bc", - "OCR2OnchainPublicKey": "3a6096c5d2101a6e80831ab7f2487a134add5a62", - "OCR2OffchainPublicKey": "ae2af1cc9827047acaf7691aafc2dcfdf0135dcb2b7c01d6d20f91389c4bdbc7", - "OCR2ConfigPublicKey": "3bbb4ad2c4154e4db0d7c6700076780f0c758f55c39afb3c1588834d5278e20a", - "AptosAccount": "fcac44d068bf70bb7fe1949362437f20ddc4cab21d5c79fd7dbf8da67cc842c3", - "AptosBundleID": "264ab5c3053ced6966e224ba928c2302749c428ddc4878ee3b3e84f812ba19d5", - "AptosOnchainPublicKey": "65523a44b882753ced0eb96aa34c73c5d43a1c47a59f0542a0cb37346f392f07", - "P2PPeerID": "12D3KooWQ24qvZZxUyi2HVeEMtoKS59TXEp7HqDUeaQA9WSAq1kA", - "CSAPublicKey": "2963b236ac0e5d9f4ae610019c68e9be87cc2bb24f73aefedaae053dedae420e" + "AptosAccount": "bd4d7e53622621af04a0100db7720508c41f3dd5fe9e97dd57eb9673d82a385d", + "EthAddress": "0x75cf1355cC4Eb358feaBb9e269a4DAEeB6721DBB", + "P2PPeerID": "12D3KooWHhXyDmHB6D1UQosLXmhczw3zxB3DLYBuq9Unb4iCD4Sc", + "CSAPublicKey": "6a4723752c843c8d91e542af5373b3d123eca05b570a6e910f5d2f28737a26f6", + "OCR2BundleID": "20ccdc97afdf467465590115e3da4e5eb591bf5f43808e81a5d0807cd889b3c7", + "OCR2OnchainPublicKey": "321bc7af41a634375526006365a31bf32b4cfa7c", + "OCR2OffchainPublicKey": "a2b7f0b85be445e2c7317bdff74c41acd9c67b5a35cda94ae31da8a9ef886db2", + "OCR2ConfigPublicKey": "faa4cfefb226ae8e86480e019bd5bbd6405c26e22dcea40d2c6f01e583213e21", + "AptosBundleID": "ac364cec9fe7d9ea1035fc511e5b2f30900caa6e65ac0501168005d05129e088", + "AptosOnchainPublicKey": "4ca789105da974eec967758ad32b575741d6cb36c1bb3bcfd87b235502cc1753" }, { - "EthAddress": "0xc8Cf02aF00b435c5F2311B9F158D9b69226116C3", - "OCR2BundleID": "5682657c3c43cbe56e5b3b0134630987637d4815a0acac7e657c399f500756be", - "OCR2OnchainPublicKey": "77c2410a03b29fe22171ba322637e1f3f0d6a939", - "OCR2OffchainPublicKey": "384ace52c3bb03f245090582ad7b8c36c81510fdcb978e74edcdb7917e21cae8", - "OCR2ConfigPublicKey": "692e770af45d5261090143470cb7901e4174cd8e7e4f369c92fd6a1afd947f06", - "AptosAccount": "c96a208a0df76f0a6cf7ea7b046fb398db59c25e4f223165738058c607f90bbc", - "AptosBundleID": "2b6d59d0957e9b6bf821be3fda1976c8d9944bebe6c66f0b0405bf5bf4cca40a", - "AptosOnchainPublicKey": "8e340cc57026d3c8ee171dc972f1ca9ea8f772672245ec8607c48636f0a8a381", - "P2PPeerID": "12D3KooWN2rZhriFQUXK7dXma8VdE3cDBMk9Zs9nGHNUPwkX6g86", - "CSAPublicKey": "bea98fd6e29ad67fe2347a024cb66abde2d8494e1d25255288ae5a8ff7170b2d" + "AptosAccount": "9543634f4a73e4cfb284816b32d7ec6b7ac8d07b841f2c1f714750186cc28a5a", + "EthAddress": "0xc6dcE30f492CBD223b9946603192f22D86e783ca", + "P2PPeerID": "12D3KooWEWK8e627u6S5NuwXTgGLakGpn1vzQjyjp6Regu1pcpFC", + "CSAPublicKey": "a715467dd87ea210d685b82a32f30c781031df00c2c974dc5fad9159a7ba240c", + "OCR2BundleID": "c734a4bf01aabe8152b7d0df0b18111ce9b3fe1ef1bca1d6a580967c8e4afc2d", + "OCR2OnchainPublicKey": "5192c43a68efb7a698c0459ff8591a115da128ee", + "OCR2OffchainPublicKey": "5e68d07f82ea0bf7054560775c2919bc955dd7fa73b2a36391a4dc27cbb18fdb", + "OCR2ConfigPublicKey": "ebd66285a029f443277091bc4b191b13e21a9b806ce379584411277a265c8e5c", + "AptosBundleID": "f1dfc3d44ee349b4349f33ce4c0ec3716142e9be3ae3ba9276c616556f6430bb", + "AptosOnchainPublicKey": "169008927a60e6c03e99aac6fa268dabaf4d00e117419861d87836211267361b" }, { - "EthAddress": "0xAbACcde3e1e6916cE46AB2472AB788941f1ce088", - "OCR2BundleID": "ec1f8a0a941474ef0313e61cff67aa622d64cbb079c00abca93672c5caf9438e", - "OCR2OnchainPublicKey": "390a4d631cd08f83eacf7a9e4475d2b2a9ccc1c7", - "OCR2OffchainPublicKey": "301bcf56866ed58be7df4b9322178ae603ade07716147b952e72e93e03d911eb", - "OCR2ConfigPublicKey": "64723878d960ef35b299b38ea7637efe6c1af7fca1b08150784ceb9a3560ba66", - "AptosAccount": "57e11c444d4c5cf77263087b6fad83eab7fae648ddf4b702e59d95af0b995566", - "AptosBundleID": "e506f4bc2a7a886534617018b77cccb9e9823545e07c14f3cab04028966c44e7", - "AptosOnchainPublicKey": "900890fb1e8b55f69699098567bdec761b068cd258d696d4fce60881546001b4", - "P2PPeerID": "12D3KooWFQ2DRXc6om66PFvzXMsAPmgJdZ6ztgiLCsCHjXwPCcGH", - "CSAPublicKey": "acdada7a0cfde36ba81398b57c21c2f60825ddfa7cfb126ce6eb00d6aef87808" + "AptosAccount": "bcd6fdce3fdcd060fed58fe13be522dc3fb0cff138b0f4f4460392f5e6d88728", + "EthAddress": "0x1289d00A6565Afcd6437B09548F6019EF49696d0", + "P2PPeerID": "12D3KooW9uJ981ocDxTJrPVxMEzPcS14WTJSU1YWH5otcpZSqkUd", + "CSAPublicKey": "9db8641f2067bfdf476e375060a0bd97c21da46d9f54c6ff4f990c6aef882478", + "OCR2BundleID": "129377e1aea4f628b2a3274e528a131175ace13e7cc062b048a34f5b4cf7b512", + "OCR2OnchainPublicKey": "ed613636925af2df6ed8332d95028eabcbe95a3f", + "OCR2OffchainPublicKey": "4eb3e2f1d324804d0adf5169bc187425d3e665c29cddf13bd57ec40ee207ce75", + "OCR2ConfigPublicKey": "effd7d3535e1b6596068085b3e19f9577a536aeacbdeea318cbd870ec678334d", + "AptosBundleID": "2e39d555ec0d1e8795167d72d2a53faa5c537762c144f8a569c601f6bcc95d1d", + "AptosOnchainPublicKey": "ce86b34de67249f92058f69e47961907ebbf8a71c12123f1d2a7cab4874f6365" }, { - "EthAddress": "0xB81D8e06Cf34347D22776D1Db67011aBD43ae07D", - "OCR2BundleID": "0bdb79dc47a775ff16ff11047505d409d0e83de4f078dca915a4361241a753b4", - "OCR2OnchainPublicKey": "b19d0be1065fa4a87cc4b817da70bb63a75b2fb3", - "OCR2OffchainPublicKey": "4f72fdf1dfb6d6b006280d40801e337488f2b0edb1b1b3a3a6a3413250bb29cb", - "OCR2ConfigPublicKey": "e2425039ef3427d07092bd9cfe01db2294387f0cb288170e16b8103c9f7e696e", - "AptosAccount": "3c97423f29c1da05b8354f72e32cf6250dc3e5f5451fb5ceb1b53c16423c388c", - "AptosBundleID": "54e51e786ad29fa4d5ea4e9215f7f09d5eb8625a2b9895ac4c1548beb1341e2a", - "AptosOnchainPublicKey": "6e42e0650e3b11aca5c59d04f5f7f5ce0048604abdf09f78c1b91aaf543d90b7", - "P2PPeerID": "12D3KooWE57dneLdwCigi3oKrCMYhQoCPNKHHSr8Qe4n6hW28UT9", - "CSAPublicKey": "25b7d6cfa17de0524c583fa7b2b7aede4a6a761c2a0ddaa11d3118e72c46a8ea" + "AptosAccount": "6549063d427778024fc4230154753c1a30eac88a7a8eab1d36014a3db48c39b3", + "EthAddress": "0x4b92B0aaC39932B7302676F48e78FA91852DC0EE", + "P2PPeerID": "12D3KooWJJC2KgoP1oih7cky9B1wL12d5CBqWFKpdfQgfujmHGyz", + "CSAPublicKey": "8c8b473cc37664a21d548477cd268013256d1d70cd9a137bdfd99da7612a93e0", + "OCR2BundleID": "053f21bfd2bbdb65261308af2d0be48593229d644d8b9e3e5dbe36f85399ae6c", + "OCR2OnchainPublicKey": "53b5bbc0efa2e2d2770029bab5d5a647a260a72b", + "OCR2OffchainPublicKey": "eac02c66802acd9cd998b9b45c52b5b36837bfb829b2838cade040e0155c774a", + "OCR2ConfigPublicKey": "43b9d0c7cace05fd17426dad4386857025a71eb08205690dff5f76224e9c7f5c", + "AptosBundleID": "3de7ab03a5b6b7fcfd196c6101d9302c5e6a5221ebd82b1fd9afa9a6bc9b0445", + "AptosOnchainPublicKey": "f2cb4932d3ce8c10bf67c60d35372a5ff1578255e25c2a119c2dea70e919567a" } ] }, @@ -233,225 +153,145 @@ "Nodes": [ { "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-bt-node1.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-1-ks-str-trig-bt-node1.local", + "path": "" }, "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-bt-node1.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-1-ks-str-trig-bt-node1.local", + "path": "" }, "ServiceName": "app-1-ks-str-trig-bt-node1", - "DeploymentName": "app-1-ks-str-trig-bt-node1", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" + "APILogin": "notreal@fakeemail.ch", + "APIPassword": "fj293fbBnlQ!f9vNs", + "KeystorePassword": "T.tLHkcmwePT/p,]sYuntjwHKAsrhm#4eRs4LuKHwvHejWYAC2JP4M8HimwgmbaZ" }, { "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node2.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-1-ks-str-trig-node2.local", + "path": "" }, "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node2.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-1-ks-str-trig-node2.local", + "path": "" }, "ServiceName": "app-1-ks-str-trig-node2", - "DeploymentName": "app-1-ks-str-trig-node2", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" + "APILogin": "notreal@fakeemail.ch", + "APIPassword": "fj293fbBnlQ!f9vNs", + "KeystorePassword": "T.tLHkcmwePT/p,]sYuntjwHKAsrhm#4eRs4LuKHwvHejWYAC2JP4M8HimwgmbaZ" }, { "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node3.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-1-ks-str-trig-node3.local", + "path": "" }, "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node3.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-1-ks-str-trig-node3.local", + "path": "" }, "ServiceName": "app-1-ks-str-trig-node3", - "DeploymentName": "app-1-ks-str-trig-node3", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" + "APILogin": "notreal@fakeemail.ch", + "APIPassword": "fj293fbBnlQ!f9vNs", + "KeystorePassword": "T.tLHkcmwePT/p,]sYuntjwHKAsrhm#4eRs4LuKHwvHejWYAC2JP4M8HimwgmbaZ" }, { "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node4.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-1-ks-str-trig-node4.local", + "path": "" }, "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node4.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-1-ks-str-trig-node4.local", + "path": "" }, "ServiceName": "app-1-ks-str-trig-node4", - "DeploymentName": "app-1-ks-str-trig-node4", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" + "APILogin": "notreal@fakeemail.ch", + "APIPassword": "fj293fbBnlQ!f9vNs", + "KeystorePassword": "T.tLHkcmwePT/p,]sYuntjwHKAsrhm#4eRs4LuKHwvHejWYAC2JP4M8HimwgmbaZ" }, { "URL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node5.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-1-ks-str-trig-node5.local", + "path": "" }, "RemoteURL": { - "Scheme": "https", - "Opaque": "", - "User": null, - "Host": "crib-local-1-ks-str-trig-node5.local", - "Path": "", - "RawPath": "", - "OmitHost": false, - "ForceQuery": false, - "RawQuery": "", - "Fragment": "", - "RawFragment": "" + "scheme": "https", + "host": "crib-local-1-ks-str-trig-node5.local", + "path": "" }, "ServiceName": "app-1-ks-str-trig-node5", - "DeploymentName": "app-1-ks-str-trig-node5", - "Login": "notreal@fakeemail.ch", - "Password": "fj293fbBnlQ!f9vNs" + "APILogin": "notreal@fakeemail.ch", + "APIPassword": "fj293fbBnlQ!f9vNs", + "KeystorePassword": "T.tLHkcmwePT/p,]sYuntjwHKAsrhm#4eRs4LuKHwvHejWYAC2JP4M8HimwgmbaZ" } ], "NodeKeys": [ { - "EthAddress": "0x61560C5b25E4745f0F633D84476c14390FA3DD84", - "OCR2BundleID": "aaca54f8ec36acfc6dafd746c37a4f558fee4c4360b67c9bdf93dda87f54b3b0", - "OCR2OnchainPublicKey": "e74920e7879d72aaef6218f4bae6ff7c8a6aa4ca", - "OCR2OffchainPublicKey": "5d1319480eaa15ff9852db3e39d683d97d6e0383f76c6a4e050da13bab099bf7", - "OCR2ConfigPublicKey": "86547b9f1a068bbe66a23395c2a96920391d460a090f7fa55b71b4584e1dca2d", - "AptosAccount": "8058a1f4fe8f7794db77e6f4a32f3c7e34ce828869b6c8201331398a09f535fc", - "AptosBundleID": "98d3f2c10bf93134cfcbfdb20c3362a19d92847d6a1904402557cadf2cda9e41", - "AptosOnchainPublicKey": "94d634b7a425348560563a8dd480e8014777a91891640098837f2f31429cd019", - "P2PPeerID": "12D3KooWHmKkBDnZQdQfXfseupkHVUExXSXgKMbsvowuWVvHXnET", - "CSAPublicKey": "3bc22ec8afe81fe971d7b997847c48c28387e515bd8b8d58dc66e1b6000d2eba" + "AptosAccount": "", + "EthAddress": "0xCE59C33dc0807F194ba2566e093398dc5e459840", + "P2PPeerID": "12D3KooWGQkR76gPL7Qt1aYYHtPdU65zG4h36efLAERMwudHqGK3", + "CSAPublicKey": "b3dcb60fcf807453c95628a1e7970b077b5e2bbefb0b159841c28dc1776574de", + "OCR2BundleID": "ca2e13222b556f34ae5bc9cea72e6e7ce8221bf76e2d8b3d91505facdbbd71d3", + "OCR2OnchainPublicKey": "a4938b0552e830b45d481cca9893f319259d365c", + "OCR2OffchainPublicKey": "221fe1f972f01da727dbd6842daf4d322f7cab5a7e93816688be7a52f4088b86", + "OCR2ConfigPublicKey": "1af18519dfc5a22db640f1f8095bafaaeb987ab4e3e7ec366dfaa92df9a6ee7b", + "AptosBundleID": "", + "AptosOnchainPublicKey": "" }, { - "EthAddress": "0xc924A1f5eb60e16e2A7eaEF8fF43B81279988507", - "OCR2BundleID": "dec4122398dcc1d168e5299d896bea43e3c2eb6b80b930d811769dbaa6fc5dc3", - "OCR2OnchainPublicKey": "4268941221e692700b811aa677f0109d6b043878", - "OCR2OffchainPublicKey": "038abda618e98e3f9248facbbf0f85aff1da758f667540ad86d4b551a0645d48", - "OCR2ConfigPublicKey": "df035550d38a35782814abe4d4547c9d19b4d531e52365ec98a4bf54e3c5ad50", - "AptosAccount": "aeaf55a2c6fdc03feb4ba267e472218217099906bcdfd060780215f7e403c8ac", - "AptosBundleID": "04f83eb14a0f1d12b9ad718adbad8d6e9a6f98d9038ddc4b0ead5553f46cddc8", - "AptosOnchainPublicKey": "a365d746dee16b72b76546a5d41968f66f3f75b5e50ead59c6de58d7dd18978f", - "P2PPeerID": "12D3KooWRHbaLm4WoyXEKkEdgPU4F3ksam4wfreC9H6eEehRDRzs", - "CSAPublicKey": "d02faacac929d6d73ede56026604ed0d9af6b66631d813c9bfe57f49879b6f66" + "AptosAccount": "", + "EthAddress": "0x898D0206d3b3156b92bD499eDFBAfc476543A21F", + "P2PPeerID": "12D3KooWDN2jTmtrpZMpjFFuQdzxHyUecBE3zPLG4goaWG7H2iDa", + "CSAPublicKey": "bdf13ff3944d59a3e1ea5888f86c0bbfe5eb33e2140188516592bf245d080320", + "OCR2BundleID": "3b5d75124ef0f02efd46c08da4b67d36154eed680d7dafd360d976430fe11a7b", + "OCR2OnchainPublicKey": "3815f48818db64aa8d7b225e229a328826f3d1de", + "OCR2OffchainPublicKey": "ca6f4c20c00fb7af411060cfc226d61d11ce5e3532ebbd15786fe53c32244de3", + "OCR2ConfigPublicKey": "7b4e462c24d9076a8822bd4e2bdbd834fcc7898aabd9862dbcdb7df6686d2b41", + "AptosBundleID": "", + "AptosOnchainPublicKey": "" }, { - "EthAddress": "0x3Ad163A3E6Ae03f93fAAD205833318F5111957f6", - "OCR2BundleID": "2cf78d5374a7c4c37ff899c7d4ec1f587d1c55e19e3f469bc060069d3aceb822", - "OCR2OnchainPublicKey": "5cdc6d251d437eec492abc599089f31b0796a2bf", - "OCR2OffchainPublicKey": "f6212f5e28a197083698137b8990366f2e795dd010ea8f30a4c7ae79dd4c24e8", - "OCR2ConfigPublicKey": "b89aa8ad44f52de2b9c0f5d24454cd851fcd7196e915ca8a881293f2a78f8c44", - "AptosAccount": "fcd7adc2ec9749dfdf2ac823bbd43399e492b98439804aff2bcd20a6ac0e325e", - "AptosBundleID": "ca1b4be024cc334b67abfed3afc3b76c20fb9c3c79ba562765b699e5b3ba6b7f", - "AptosOnchainPublicKey": "5e91147eb11af299ecfe976f2a67fa65cae98fea14c8e970f1bcf7c680d47af8", - "P2PPeerID": "12D3KooWFzdAipMFiMbM5nHu6WnTtnuv3Q9nan9JmQNiRRs4UYVJ", - "CSAPublicKey": "847b14f52f2a2334d865b04e9ded66ef5d93a71d0337c6e1b2aa5dd6ed8a31e9" + "AptosAccount": "", + "EthAddress": "0xb26dD9CD1Fc4Df2F84170960E2a36ed4a5ac6bB7", + "P2PPeerID": "12D3KooWJTedkdgDmkAms4pEKDnXX7CXshkxwEcK6hWki519YEqF", + "CSAPublicKey": "e95ded4fc733eac43292dc24d8630101cf0c3f40c3764233a6321077eacd0b90", + "OCR2BundleID": "742b2a8a90e59aeb8bb35313d4078ef3f950a9e42a157b7ee9e9abd8c7d97d94", + "OCR2OnchainPublicKey": "57b41043e9a2b21329be48ccf72943af20b322ff", + "OCR2OffchainPublicKey": "0d90fc04c4c0439c184a06478ec1fed7cedfb799b303a6d68c046d90f077b5bd", + "OCR2ConfigPublicKey": "a73c070b60c9a175ac34cfd5c6c7884e73b5c8d43417be3f00bc43ac0fb67f39", + "AptosBundleID": "", + "AptosOnchainPublicKey": "" }, { - "EthAddress": "0xe73b2eE90Bf397BbCf48Ff6bE0317F852bEAC62E", - "OCR2BundleID": "3c0408535b0fb8eb86377dc5457c92ca449cdc8f7f7c84102f48ad218777c5bd", - "OCR2OnchainPublicKey": "83f03cd5d5df6057d9fefbdd4566f9ac0af287c3", - "OCR2OffchainPublicKey": "2e8a4828976093301aefdbdd715307d1a5648589045cfb013cf72321821ea691", - "OCR2ConfigPublicKey": "255043622ed54159e827624e02e2c4ec1e9e037b38f54dc7e0ba4de98a3d7d74", - "AptosAccount": "e81914a84ff0c52fbb4afcd8662ada15f0a4b91037b4387767172e033668ca90", - "AptosBundleID": "7047c3f64890a8fcb2393c6b7ab2af11a3c5133812eec661e7616bdc0434a884", - "AptosOnchainPublicKey": "618fc2199f04828bcb935b2f72befa85c0205106d3a02b66049b079bb8d866a8", - "P2PPeerID": "12D3KooWCcDDxc4H5EeUTTN9qDjy78TRHXq6gNo59pPrAFAUkPvr", - "CSAPublicKey": "cc5fd0a2d2ad059df99011cbd23aeafbae369c9c3e6f30cfe64d37a591aafa63" + "AptosAccount": "", + "EthAddress": "0x50b1bB407F0Ecd71416BfA8a1d703F6115112676", + "P2PPeerID": "12D3KooWS1i3x2r34vYCfYrz2ddWUVYtFGNaZvGNNxqzL4Rysd3V", + "CSAPublicKey": "46b50be4d72b03f1601ade056bc754f194d6418283065970d470f6f3243f0705", + "OCR2BundleID": "1232eb7cdb4145ec8b543b76f17fe59c69aa6df31c827a7553aea3a3d340c637", + "OCR2OnchainPublicKey": "dad1e5d6824d7b64df57e9ca3342e4caf66b2c91", + "OCR2OffchainPublicKey": "8a7e9833bf8a55435c82866dbe5f9a9bac63b9a93c8c55664dffe653ab4145a2", + "OCR2ConfigPublicKey": "48ce76ee5ddd8003ebbd10485a092f8bd237f0f855aca8aba5ccac78b593e62d", + "AptosBundleID": "", + "AptosOnchainPublicKey": "" }, { - "EthAddress": "0xA861049e4670Bd8b0E9C447F33b473145c5FC079", - "OCR2BundleID": "08cc4a28589a3fcc0c9bb1a67c09e49c92d1de184b60a11fa505e49ec8a87b00", - "OCR2OnchainPublicKey": "9ee47af6e91a6f55db31246ac3b706d3a3e6e060", - "OCR2OffchainPublicKey": "131f66e2120912ed45e54a752316d110968a78eb5efd9a3e3c1215631804617e", - "OCR2ConfigPublicKey": "dda24126a23ae8e36bbc2d9e37dd6ff9dcea3ec924d6753b066af09811352225", - "AptosAccount": "57eef8994e947c45a65e9e4593e1617c4278833db28d0d3fd007ff8695af5012", - "AptosBundleID": "e67964f9cc347ea16174de40ac1391de7b36963a65fba9e2d86ea586b4dd0eb8", - "AptosOnchainPublicKey": "2cfa138265a1c2a2dca31c5bc5a804a7543dd226d8c288bf6a4ec1c853870963", - "P2PPeerID": "12D3KooWP68a8W3eKN988APsGDNGBTQjZttg3qyAbvqkK6D3NZYu", - "CSAPublicKey": "bcd4c7abd729e6c6931e323796ff2a148991d1062cca18de765602d874de15f9" + "AptosAccount": "", + "EthAddress": "0xa2340108BE2c563bB89462b464aCF3f88cCd1584", + "P2PPeerID": "12D3KooWLZFWAhTejyR7WwwQndgNGGiW3XcGKK6nNtWbhdgCG1rC", + "CSAPublicKey": "0837cd5a8544664eaf04f68347bdba4cb7ac6af34488f0a26c65b03fe223d5af", + "OCR2BundleID": "2fcbac5dd48e995772d85c47d2744b0df7b74b71d17001f283318cae43b96add", + "OCR2OnchainPublicKey": "469d3c0c484c6846be1176920f1cbdc8abb6f638", + "OCR2OffchainPublicKey": "21aa97506b74e3bfcbe6eb87f2a6add07898fecbddbcec2447832dc343395499", + "OCR2ConfigPublicKey": "a6b7e8ca4faf6122165928d82354de3f9334cdb47af058f6a983d11473c21b5f", + "AptosBundleID": "", + "AptosOnchainPublicKey": "" } ] } diff --git a/core/scripts/keystone/templates/streams_trigger.toml b/core/scripts/keystone/templates/streams_trigger.toml deleted file mode 100644 index 370ed64e736..00000000000 --- a/core/scripts/keystone/templates/streams_trigger.toml +++ /dev/null @@ -1,76 +0,0 @@ -name = "MATIC/USD-RefPrice-DFstaging-Premium-ArbitrumSepolia-001 | {{ feed_id }} | verifier_proxy {{ verifier_proxy_id }}" -type = "offchainreporting2" -schemaVersion = 1 -forwardingAllowed = false -maxTaskDuration = "0s" -contractID = "{{ contract_id }}" -relay = "evm" -pluginType = "mercury" -feedID = "{{ feed_id }}" -transmitterID = "{{ transmitter_id }}" -observationSource = """ -// data source 1 -// https://docs.chain.link/data-streams/concepts/liquidity-weighted-prices -// https://github.com/smartcontractkit/ea-framework-js/blob/272846061bd0871da41d844672509aa7b7784d62/src/adapter/lwba.ts#L62 -ds1_payload [type=bridge name="bridge-coinmetrics" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds1_benchmark [type=jsonparse path="data,mid"]; -ds1_bid [type=jsonparse path="data,bid"]; -ds1_ask [type=jsonparse path="data,ask"]; - -ds1_benchmark_multiply [type=multiply times=1000000000000000000]; -ds1_bid_multiply [type=multiply times=1000000000000000000]; -ds1_ask_multiply [type=multiply times=1000000000000000000]; -// data source 2 -ds2_payload [type=bridge name="bridge-tiingo" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds2_benchmark [type=jsonparse path="data,mid"]; -ds2_bid [type=jsonparse path="data,bid"]; -ds2_ask [type=jsonparse path="data,ask"]; - -ds2_benchmark_multiply [type=multiply times=1000000000000000000]; -ds2_bid_multiply [type=multiply times=1000000000000000000]; -ds2_ask_multiply [type=multiply times=1000000000000000000]; -// data source 3 -ds3_payload [type=bridge name="bridge-ncfx" timeout="50s" requestData="{\\"data\\":{\\"from\\":\\"MATIC\\",\\"to\\":\\"USD\\"}}"]; -ds3_benchmark [type=jsonparse path="data,mid"]; -ds3_bid [type=jsonparse path="data,bid"]; -ds3_ask [type=jsonparse path="data,ask"]; - -ds3_benchmark_multiply [type=multiply times=1000000000000000000]; -ds3_bid_multiply [type=multiply times=1000000000000000000]; -ds3_ask_multiply [type=multiply times=1000000000000000000]; -// benchmark -ds1_payload -> ds1_benchmark -> ds1_benchmark_multiply -> benchmark_price; -ds2_payload -> ds2_benchmark -> ds2_benchmark_multiply -> benchmark_price; -ds3_payload -> ds3_benchmark -> ds3_benchmark_multiply -> benchmark_price; -// The index is what determines how fields get assigned in a mercury report -// benchmark is always index 0 -// bid is always index 1 -// ask is always index 2 -// See https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/relay/evm/mercury/v3/data_source.go#L225 for more info -benchmark_price [type=median allowedFaults=2 index=0]; - -// bid -ds1_payload -> ds1_bid -> ds1_bid_multiply -> bid_price; -ds2_payload -> ds2_bid -> ds2_bid_multiply -> bid_price; -ds3_payload -> ds3_bid -> ds3_bid_multiply -> bid_price; -bid_price [type=median allowedFaults=2 index=1]; - -// ask -ds1_payload -> ds1_ask -> ds1_ask_multiply -> ask_price; -ds2_payload -> ds2_ask -> ds2_ask_multiply -> ask_price; -ds3_payload -> ds3_ask -> ds3_ask_multiply -> ask_price; -ask_price [type=median allowedFaults=2 index=2]; -""" - -[relayConfig] -chainID = "{{ chain_id }}" -enableTriggerCapability = true -fromBlock = "{{ from_block }}" - -[pluginConfig] -linkFeedID = "{{ link_feed_id }}" -nativeFeedID = "{{ native_feed_id }}" -# Dummy pub key -serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" -# We don't need to specify a mercury server URL here since we're using this as a trigger instead -serverURL = "wss://unknown" From 1bb56058b23cbbbdb5cd8ea398117e0dca2db800 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Fri, 25 Oct 2024 09:27:28 -0700 Subject: [PATCH 070/117] Formatting --- core/scripts/keystone/src/01_deploy_contracts_cmd.go | 2 +- core/scripts/keystone/src/02_deploy_jobspecs_cmd.go | 2 +- .../src/03_deploy_streams_trigger_cmd_test.go | 3 +-- core/scripts/keystone/src/88_gen_jobspecs.go | 2 +- core/scripts/keystone/src/88_gen_jobspecs_test.go | 2 +- core/scripts/keystone/src/99_files.go | 10 +++++----- core/scripts/keystone/src/99_k8s_client.go | 12 ++++++------ 7 files changed, 16 insertions(+), 17 deletions(-) diff --git a/core/scripts/keystone/src/01_deploy_contracts_cmd.go b/core/scripts/keystone/src/01_deploy_contracts_cmd.go index 0ef4f707090..ccc1ab7d95e 100644 --- a/core/scripts/keystone/src/01_deploy_contracts_cmd.go +++ b/core/scripts/keystone/src/01_deploy_contracts_cmd.go @@ -80,7 +80,7 @@ func (g *deployContracts) Run(args []string) { os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) os.Setenv("ACCOUNT_KEY", *accountKey) os.Setenv("INSECURE_SKIP_VERIFY", "true") - deploy( *nodeSetsPath, *ocrConfigFile, *skipFunding, *dryRun, *onlySetConfig, *artefactsDir, *nodeSetSize) + deploy(*nodeSetsPath, *ocrConfigFile, *skipFunding, *dryRun, *onlySetConfig, *artefactsDir, *nodeSetSize) } // deploy does the following: diff --git a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go index 688e4d073d3..cfa71f0022f 100644 --- a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go +++ b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go @@ -55,7 +55,7 @@ func (g *deployJobSpecs) Run(args []string) { deployedContracts, err := LoadDeployedContracts(*artefactsDir) PanicErr(err) - jobspecs := genSpecs( + jobspecs := generateOCR3JobSpecs( *nodeSetsPath, *templatesLocation, *chainID, *p2pPort, deployedContracts.OCRContract.Hex(), diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go index 8f804a3ebf3..7aa9970971d 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go +++ b/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go @@ -45,7 +45,7 @@ func TestCreateMercuryV3Job(t *testing.T) { func TestCreateMercuryBootstrapJob(t *testing.T) { jobConfigData := MercuryV3BootstrapJobSpecData{ - FeedName: feedName, + FeedName: feedName, FeedID: feedID, ChainID: chainID, VerifierAddress: verifierAddress, @@ -68,4 +68,3 @@ func TestCreateKeystoneWorkflowJob(t *testing.T) { snaps.MatchSnapshot(t, output) } - diff --git a/core/scripts/keystone/src/88_gen_jobspecs.go b/core/scripts/keystone/src/88_gen_jobspecs.go index e02c2477174..86f53812ec2 100644 --- a/core/scripts/keystone/src/88_gen_jobspecs.go +++ b/core/scripts/keystone/src/88_gen_jobspecs.go @@ -26,7 +26,7 @@ type donHostSpec struct { oracles []hostSpec } -func genSpecs( +func generateOCR3JobSpecs( nodeSetsPath string, templatesDir string, chainID int64, diff --git a/core/scripts/keystone/src/88_gen_jobspecs_test.go b/core/scripts/keystone/src/88_gen_jobspecs_test.go index 1f76e9692c7..a4524e98f48 100644 --- a/core/scripts/keystone/src/88_gen_jobspecs_test.go +++ b/core/scripts/keystone/src/88_gen_jobspecs_test.go @@ -31,6 +31,6 @@ func TestGenSpecs(t *testing.T) { p2pPort := int64(6690) contractAddress := "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" - specs := genSpecs(nodeSetsPath, "../templates", chainID, p2pPort, contractAddress, 4) + specs := generateOCR3JobSpecs(nodeSetsPath, "../templates", chainID, p2pPort, contractAddress, 4) snaps.MatchSnapshot(t, specs.ToString()) } diff --git a/core/scripts/keystone/src/99_files.go b/core/scripts/keystone/src/99_files.go index 8a0b4161c8e..b9d8f0387fb 100644 --- a/core/scripts/keystone/src/99_files.go +++ b/core/scripts/keystone/src/99_files.go @@ -11,11 +11,11 @@ import ( ) const ( - defaultArtefactsDir = "artefacts" - defaultNodeSetsPath = ".cache/node_sets.json" - deployedContractsJSON = "deployed_contracts.json" - bootstrapSpecTemplate = "bootstrap.toml" - oracleSpecTemplate = "oracle.toml" + defaultArtefactsDir = "artefacts" + defaultNodeSetsPath = ".cache/node_sets.json" + deployedContractsJSON = "deployed_contracts.json" + bootstrapSpecTemplate = "bootstrap.toml" + oracleSpecTemplate = "oracle.toml" ) func writeLines(lines []string, path string) error { diff --git a/core/scripts/keystone/src/99_k8s_client.go b/core/scripts/keystone/src/99_k8s_client.go index 518d15abb67..4844b88edba 100644 --- a/core/scripts/keystone/src/99_k8s_client.go +++ b/core/scripts/keystone/src/99_k8s_client.go @@ -66,9 +66,9 @@ func MustNewK8sClient() *K8sClient { type DeploymentWithConfigMap struct { apps.Deployment - ServiceName string - ConfigMap v1.ConfigMap - Host string + ServiceName string + ConfigMap v1.ConfigMap + Host string } func (m *K8sClient) GetDeploymentsWithConfigMap() ([]DeploymentWithConfigMap, error) { @@ -117,10 +117,10 @@ func (m *K8sClient) GetDeploymentsWithConfigMap() ([]DeploymentWithConfigMap, er } deploymentWithConfigMap := DeploymentWithConfigMap{ - Host: host, + Host: host, ServiceName: serviceName, - Deployment: deployment, - ConfigMap: *cm, + Deployment: deployment, + ConfigMap: *cm, } deploymentsWithConfigMaps = append(deploymentsWithConfigMaps, deploymentWithConfigMap) } From 3d694000328cd3fc8e4c7550686f4f08187ddac5 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 28 Oct 2024 22:42:03 -0700 Subject: [PATCH 071/117] Add test mocks --- .mockery.yaml | 23 +- .../mocks/capabilities_registry_interface.go | 3752 +++++++++++++++++ .../keystone/mocks/forwarder_interface.go | 2056 +++++++++ .../mocks/ocr3_capability_interface.go | 1316 ++++++ 4 files changed, 7146 insertions(+), 1 deletion(-) create mode 100644 core/gethwrappers/keystone/mocks/capabilities_registry_interface.go create mode 100644 core/gethwrappers/keystone/mocks/forwarder_interface.go create mode 100644 core/gethwrappers/keystone/mocks/ocr3_capability_interface.go diff --git a/.mockery.yaml b/.mockery.yaml index 711d70f59e9..5b680a77c8f 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -348,6 +348,27 @@ packages: config: dir: core/services/relay/evm/mocks ChainWriter: + github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry: + config: + dir: core/gethwrappers/keystone/mocks/ + filename: capabilities_registry_interface.go + outpkg: mock_contracts + interfaces: + CapabilitiesRegistryInterface: + github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder: + config: + dir: core/gethwrappers/keystone/mocks/ + filename: forwarder_interface.go + outpkg: mock_contracts + interfaces: + KeystoneForwarderInterface: + github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability: + config: + dir: core/gethwrappers/keystone/mocks/ + filename: ocr3_capability_interface.go + outpkg: mock_contracts + interfaces: + OCR3CapabilityInterface: github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/evm_2_evm_onramp: config: dir: core/gethwrappers/ccip/mocks/ @@ -581,4 +602,4 @@ packages: ORM: github.com/smartcontractkit/chainlink/v2/core/capabilities/targets: interfaces: - ContractValueGetter: \ No newline at end of file + ContractValueGetter: diff --git a/core/gethwrappers/keystone/mocks/capabilities_registry_interface.go b/core/gethwrappers/keystone/mocks/capabilities_registry_interface.go new file mode 100644 index 00000000000..2bcb9f20ae9 --- /dev/null +++ b/core/gethwrappers/keystone/mocks/capabilities_registry_interface.go @@ -0,0 +1,3752 @@ +// Code generated by mockery v2.45.0. DO NOT EDIT. + +package mock_contracts + +import ( + bind "github.com/ethereum/go-ethereum/accounts/abi/bind" + common "github.com/ethereum/go-ethereum/common" + capabilities_registry "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" + + event "github.com/ethereum/go-ethereum/event" + + generated "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" + + mock "github.com/stretchr/testify/mock" + + types "github.com/ethereum/go-ethereum/core/types" +) + +// CapabilitiesRegistryInterface is an autogenerated mock type for the CapabilitiesRegistryInterface type +type CapabilitiesRegistryInterface struct { + mock.Mock +} + +type CapabilitiesRegistryInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *CapabilitiesRegistryInterface) EXPECT() *CapabilitiesRegistryInterface_Expecter { + return &CapabilitiesRegistryInterface_Expecter{mock: &_m.Mock} +} + +// AcceptOwnership provides a mock function with given fields: opts +func (_m *CapabilitiesRegistryInterface) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for AcceptOwnership") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts) (*types.Transaction, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts) *types.Transaction); ok { + r0 = rf(opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_AcceptOwnership_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AcceptOwnership' +type CapabilitiesRegistryInterface_AcceptOwnership_Call struct { + *mock.Call +} + +// AcceptOwnership is a helper method to define mock.On call +// - opts *bind.TransactOpts +func (_e *CapabilitiesRegistryInterface_Expecter) AcceptOwnership(opts interface{}) *CapabilitiesRegistryInterface_AcceptOwnership_Call { + return &CapabilitiesRegistryInterface_AcceptOwnership_Call{Call: _e.mock.On("AcceptOwnership", opts)} +} + +func (_c *CapabilitiesRegistryInterface_AcceptOwnership_Call) Run(run func(opts *bind.TransactOpts)) *CapabilitiesRegistryInterface_AcceptOwnership_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_AcceptOwnership_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_AcceptOwnership_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_AcceptOwnership_Call) RunAndReturn(run func(*bind.TransactOpts) (*types.Transaction, error)) *CapabilitiesRegistryInterface_AcceptOwnership_Call { + _c.Call.Return(run) + return _c +} + +// AddCapabilities provides a mock function with given fields: opts, capabilities +func (_m *CapabilitiesRegistryInterface) AddCapabilities(opts *bind.TransactOpts, capabilities []capabilities_registry.CapabilitiesRegistryCapability) (*types.Transaction, error) { + ret := _m.Called(opts, capabilities) + + if len(ret) == 0 { + panic("no return value specified for AddCapabilities") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryCapability) (*types.Transaction, error)); ok { + return rf(opts, capabilities) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryCapability) *types.Transaction); ok { + r0 = rf(opts, capabilities) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryCapability) error); ok { + r1 = rf(opts, capabilities) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_AddCapabilities_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddCapabilities' +type CapabilitiesRegistryInterface_AddCapabilities_Call struct { + *mock.Call +} + +// AddCapabilities is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - capabilities []capabilities_registry.CapabilitiesRegistryCapability +func (_e *CapabilitiesRegistryInterface_Expecter) AddCapabilities(opts interface{}, capabilities interface{}) *CapabilitiesRegistryInterface_AddCapabilities_Call { + return &CapabilitiesRegistryInterface_AddCapabilities_Call{Call: _e.mock.On("AddCapabilities", opts, capabilities)} +} + +func (_c *CapabilitiesRegistryInterface_AddCapabilities_Call) Run(run func(opts *bind.TransactOpts, capabilities []capabilities_registry.CapabilitiesRegistryCapability)) *CapabilitiesRegistryInterface_AddCapabilities_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].([]capabilities_registry.CapabilitiesRegistryCapability)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_AddCapabilities_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_AddCapabilities_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_AddCapabilities_Call) RunAndReturn(run func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryCapability) (*types.Transaction, error)) *CapabilitiesRegistryInterface_AddCapabilities_Call { + _c.Call.Return(run) + return _c +} + +// AddDON provides a mock function with given fields: opts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f +func (_m *CapabilitiesRegistryInterface) AddDON(opts *bind.TransactOpts, nodes [][32]byte, capabilityConfigurations []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) { + ret := _m.Called(opts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) + + if len(ret) == 0 { + panic("no return value specified for AddDON") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, bool, uint8) (*types.Transaction, error)); ok { + return rf(opts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, bool, uint8) *types.Transaction); ok { + r0 = rf(opts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, bool, uint8) error); ok { + r1 = rf(opts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_AddDON_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddDON' +type CapabilitiesRegistryInterface_AddDON_Call struct { + *mock.Call +} + +// AddDON is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - nodes [][32]byte +// - capabilityConfigurations []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration +// - isPublic bool +// - acceptsWorkflows bool +// - f uint8 +func (_e *CapabilitiesRegistryInterface_Expecter) AddDON(opts interface{}, nodes interface{}, capabilityConfigurations interface{}, isPublic interface{}, acceptsWorkflows interface{}, f interface{}) *CapabilitiesRegistryInterface_AddDON_Call { + return &CapabilitiesRegistryInterface_AddDON_Call{Call: _e.mock.On("AddDON", opts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f)} +} + +func (_c *CapabilitiesRegistryInterface_AddDON_Call) Run(run func(opts *bind.TransactOpts, nodes [][32]byte, capabilityConfigurations []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8)) *CapabilitiesRegistryInterface_AddDON_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].([][32]byte), args[2].([]capabilities_registry.CapabilitiesRegistryCapabilityConfiguration), args[3].(bool), args[4].(bool), args[5].(uint8)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_AddDON_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_AddDON_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_AddDON_Call) RunAndReturn(run func(*bind.TransactOpts, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, bool, uint8) (*types.Transaction, error)) *CapabilitiesRegistryInterface_AddDON_Call { + _c.Call.Return(run) + return _c +} + +// AddNodeOperators provides a mock function with given fields: opts, nodeOperators +func (_m *CapabilitiesRegistryInterface) AddNodeOperators(opts *bind.TransactOpts, nodeOperators []capabilities_registry.CapabilitiesRegistryNodeOperator) (*types.Transaction, error) { + ret := _m.Called(opts, nodeOperators) + + if len(ret) == 0 { + panic("no return value specified for AddNodeOperators") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeOperator) (*types.Transaction, error)); ok { + return rf(opts, nodeOperators) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeOperator) *types.Transaction); ok { + r0 = rf(opts, nodeOperators) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeOperator) error); ok { + r1 = rf(opts, nodeOperators) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_AddNodeOperators_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddNodeOperators' +type CapabilitiesRegistryInterface_AddNodeOperators_Call struct { + *mock.Call +} + +// AddNodeOperators is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - nodeOperators []capabilities_registry.CapabilitiesRegistryNodeOperator +func (_e *CapabilitiesRegistryInterface_Expecter) AddNodeOperators(opts interface{}, nodeOperators interface{}) *CapabilitiesRegistryInterface_AddNodeOperators_Call { + return &CapabilitiesRegistryInterface_AddNodeOperators_Call{Call: _e.mock.On("AddNodeOperators", opts, nodeOperators)} +} + +func (_c *CapabilitiesRegistryInterface_AddNodeOperators_Call) Run(run func(opts *bind.TransactOpts, nodeOperators []capabilities_registry.CapabilitiesRegistryNodeOperator)) *CapabilitiesRegistryInterface_AddNodeOperators_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].([]capabilities_registry.CapabilitiesRegistryNodeOperator)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_AddNodeOperators_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_AddNodeOperators_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_AddNodeOperators_Call) RunAndReturn(run func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeOperator) (*types.Transaction, error)) *CapabilitiesRegistryInterface_AddNodeOperators_Call { + _c.Call.Return(run) + return _c +} + +// AddNodes provides a mock function with given fields: opts, nodes +func (_m *CapabilitiesRegistryInterface) AddNodes(opts *bind.TransactOpts, nodes []capabilities_registry.CapabilitiesRegistryNodeParams) (*types.Transaction, error) { + ret := _m.Called(opts, nodes) + + if len(ret) == 0 { + panic("no return value specified for AddNodes") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) (*types.Transaction, error)); ok { + return rf(opts, nodes) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) *types.Transaction); ok { + r0 = rf(opts, nodes) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) error); ok { + r1 = rf(opts, nodes) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_AddNodes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddNodes' +type CapabilitiesRegistryInterface_AddNodes_Call struct { + *mock.Call +} + +// AddNodes is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - nodes []capabilities_registry.CapabilitiesRegistryNodeParams +func (_e *CapabilitiesRegistryInterface_Expecter) AddNodes(opts interface{}, nodes interface{}) *CapabilitiesRegistryInterface_AddNodes_Call { + return &CapabilitiesRegistryInterface_AddNodes_Call{Call: _e.mock.On("AddNodes", opts, nodes)} +} + +func (_c *CapabilitiesRegistryInterface_AddNodes_Call) Run(run func(opts *bind.TransactOpts, nodes []capabilities_registry.CapabilitiesRegistryNodeParams)) *CapabilitiesRegistryInterface_AddNodes_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].([]capabilities_registry.CapabilitiesRegistryNodeParams)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_AddNodes_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_AddNodes_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_AddNodes_Call) RunAndReturn(run func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) (*types.Transaction, error)) *CapabilitiesRegistryInterface_AddNodes_Call { + _c.Call.Return(run) + return _c +} + +// Address provides a mock function with given fields: +func (_m *CapabilitiesRegistryInterface) Address() common.Address { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Address") + } + + var r0 common.Address + if rf, ok := ret.Get(0).(func() common.Address); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(common.Address) + } + } + + return r0 +} + +// CapabilitiesRegistryInterface_Address_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Address' +type CapabilitiesRegistryInterface_Address_Call struct { + *mock.Call +} + +// Address is a helper method to define mock.On call +func (_e *CapabilitiesRegistryInterface_Expecter) Address() *CapabilitiesRegistryInterface_Address_Call { + return &CapabilitiesRegistryInterface_Address_Call{Call: _e.mock.On("Address")} +} + +func (_c *CapabilitiesRegistryInterface_Address_Call) Run(run func()) *CapabilitiesRegistryInterface_Address_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_Address_Call) Return(_a0 common.Address) *CapabilitiesRegistryInterface_Address_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CapabilitiesRegistryInterface_Address_Call) RunAndReturn(run func() common.Address) *CapabilitiesRegistryInterface_Address_Call { + _c.Call.Return(run) + return _c +} + +// DeprecateCapabilities provides a mock function with given fields: opts, hashedCapabilityIds +func (_m *CapabilitiesRegistryInterface) DeprecateCapabilities(opts *bind.TransactOpts, hashedCapabilityIds [][32]byte) (*types.Transaction, error) { + ret := _m.Called(opts, hashedCapabilityIds) + + if len(ret) == 0 { + panic("no return value specified for DeprecateCapabilities") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][32]byte) (*types.Transaction, error)); ok { + return rf(opts, hashedCapabilityIds) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][32]byte) *types.Transaction); ok { + r0 = rf(opts, hashedCapabilityIds) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, [][32]byte) error); ok { + r1 = rf(opts, hashedCapabilityIds) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_DeprecateCapabilities_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeprecateCapabilities' +type CapabilitiesRegistryInterface_DeprecateCapabilities_Call struct { + *mock.Call +} + +// DeprecateCapabilities is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - hashedCapabilityIds [][32]byte +func (_e *CapabilitiesRegistryInterface_Expecter) DeprecateCapabilities(opts interface{}, hashedCapabilityIds interface{}) *CapabilitiesRegistryInterface_DeprecateCapabilities_Call { + return &CapabilitiesRegistryInterface_DeprecateCapabilities_Call{Call: _e.mock.On("DeprecateCapabilities", opts, hashedCapabilityIds)} +} + +func (_c *CapabilitiesRegistryInterface_DeprecateCapabilities_Call) Run(run func(opts *bind.TransactOpts, hashedCapabilityIds [][32]byte)) *CapabilitiesRegistryInterface_DeprecateCapabilities_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].([][32]byte)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_DeprecateCapabilities_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_DeprecateCapabilities_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_DeprecateCapabilities_Call) RunAndReturn(run func(*bind.TransactOpts, [][32]byte) (*types.Transaction, error)) *CapabilitiesRegistryInterface_DeprecateCapabilities_Call { + _c.Call.Return(run) + return _c +} + +// FilterCapabilityConfigured provides a mock function with given fields: opts, hashedCapabilityId +func (_m *CapabilitiesRegistryInterface) FilterCapabilityConfigured(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*capabilities_registry.CapabilitiesRegistryCapabilityConfiguredIterator, error) { + ret := _m.Called(opts, hashedCapabilityId) + + if len(ret) == 0 { + panic("no return value specified for FilterCapabilityConfigured") + } + + var r0 *capabilities_registry.CapabilitiesRegistryCapabilityConfiguredIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, [][32]byte) (*capabilities_registry.CapabilitiesRegistryCapabilityConfiguredIterator, error)); ok { + return rf(opts, hashedCapabilityId) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, [][32]byte) *capabilities_registry.CapabilitiesRegistryCapabilityConfiguredIterator); ok { + r0 = rf(opts, hashedCapabilityId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryCapabilityConfiguredIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, [][32]byte) error); ok { + r1 = rf(opts, hashedCapabilityId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterCapabilityConfigured' +type CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call struct { + *mock.Call +} + +// FilterCapabilityConfigured is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - hashedCapabilityId [][32]byte +func (_e *CapabilitiesRegistryInterface_Expecter) FilterCapabilityConfigured(opts interface{}, hashedCapabilityId interface{}) *CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call { + return &CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call{Call: _e.mock.On("FilterCapabilityConfigured", opts, hashedCapabilityId)} +} + +func (_c *CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call) Run(run func(opts *bind.FilterOpts, hashedCapabilityId [][32]byte)) *CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([][32]byte)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryCapabilityConfiguredIterator, _a1 error) *CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call) RunAndReturn(run func(*bind.FilterOpts, [][32]byte) (*capabilities_registry.CapabilitiesRegistryCapabilityConfiguredIterator, error)) *CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call { + _c.Call.Return(run) + return _c +} + +// FilterCapabilityDeprecated provides a mock function with given fields: opts, hashedCapabilityId +func (_m *CapabilitiesRegistryInterface) FilterCapabilityDeprecated(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*capabilities_registry.CapabilitiesRegistryCapabilityDeprecatedIterator, error) { + ret := _m.Called(opts, hashedCapabilityId) + + if len(ret) == 0 { + panic("no return value specified for FilterCapabilityDeprecated") + } + + var r0 *capabilities_registry.CapabilitiesRegistryCapabilityDeprecatedIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, [][32]byte) (*capabilities_registry.CapabilitiesRegistryCapabilityDeprecatedIterator, error)); ok { + return rf(opts, hashedCapabilityId) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, [][32]byte) *capabilities_registry.CapabilitiesRegistryCapabilityDeprecatedIterator); ok { + r0 = rf(opts, hashedCapabilityId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryCapabilityDeprecatedIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, [][32]byte) error); ok { + r1 = rf(opts, hashedCapabilityId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterCapabilityDeprecated' +type CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call struct { + *mock.Call +} + +// FilterCapabilityDeprecated is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - hashedCapabilityId [][32]byte +func (_e *CapabilitiesRegistryInterface_Expecter) FilterCapabilityDeprecated(opts interface{}, hashedCapabilityId interface{}) *CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call { + return &CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call{Call: _e.mock.On("FilterCapabilityDeprecated", opts, hashedCapabilityId)} +} + +func (_c *CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call) Run(run func(opts *bind.FilterOpts, hashedCapabilityId [][32]byte)) *CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([][32]byte)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryCapabilityDeprecatedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call) RunAndReturn(run func(*bind.FilterOpts, [][32]byte) (*capabilities_registry.CapabilitiesRegistryCapabilityDeprecatedIterator, error)) *CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call { + _c.Call.Return(run) + return _c +} + +// FilterConfigSet provides a mock function with given fields: opts, donId +func (_m *CapabilitiesRegistryInterface) FilterConfigSet(opts *bind.FilterOpts, donId []uint32) (*capabilities_registry.CapabilitiesRegistryConfigSetIterator, error) { + ret := _m.Called(opts, donId) + + if len(ret) == 0 { + panic("no return value specified for FilterConfigSet") + } + + var r0 *capabilities_registry.CapabilitiesRegistryConfigSetIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryConfigSetIterator, error)); ok { + return rf(opts, donId) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) *capabilities_registry.CapabilitiesRegistryConfigSetIterator); ok { + r0 = rf(opts, donId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryConfigSetIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint32) error); ok { + r1 = rf(opts, donId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_FilterConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterConfigSet' +type CapabilitiesRegistryInterface_FilterConfigSet_Call struct { + *mock.Call +} + +// FilterConfigSet is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - donId []uint32 +func (_e *CapabilitiesRegistryInterface_Expecter) FilterConfigSet(opts interface{}, donId interface{}) *CapabilitiesRegistryInterface_FilterConfigSet_Call { + return &CapabilitiesRegistryInterface_FilterConfigSet_Call{Call: _e.mock.On("FilterConfigSet", opts, donId)} +} + +func (_c *CapabilitiesRegistryInterface_FilterConfigSet_Call) Run(run func(opts *bind.FilterOpts, donId []uint32)) *CapabilitiesRegistryInterface_FilterConfigSet_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]uint32)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterConfigSet_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryConfigSetIterator, _a1 error) *CapabilitiesRegistryInterface_FilterConfigSet_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterConfigSet_Call) RunAndReturn(run func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryConfigSetIterator, error)) *CapabilitiesRegistryInterface_FilterConfigSet_Call { + _c.Call.Return(run) + return _c +} + +// FilterNodeAdded provides a mock function with given fields: opts, nodeOperatorId +func (_m *CapabilitiesRegistryInterface) FilterNodeAdded(opts *bind.FilterOpts, nodeOperatorId []uint32) (*capabilities_registry.CapabilitiesRegistryNodeAddedIterator, error) { + ret := _m.Called(opts, nodeOperatorId) + + if len(ret) == 0 { + panic("no return value specified for FilterNodeAdded") + } + + var r0 *capabilities_registry.CapabilitiesRegistryNodeAddedIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryNodeAddedIterator, error)); ok { + return rf(opts, nodeOperatorId) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) *capabilities_registry.CapabilitiesRegistryNodeAddedIterator); ok { + r0 = rf(opts, nodeOperatorId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeAddedIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint32) error); ok { + r1 = rf(opts, nodeOperatorId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_FilterNodeAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterNodeAdded' +type CapabilitiesRegistryInterface_FilterNodeAdded_Call struct { + *mock.Call +} + +// FilterNodeAdded is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - nodeOperatorId []uint32 +func (_e *CapabilitiesRegistryInterface_Expecter) FilterNodeAdded(opts interface{}, nodeOperatorId interface{}) *CapabilitiesRegistryInterface_FilterNodeAdded_Call { + return &CapabilitiesRegistryInterface_FilterNodeAdded_Call{Call: _e.mock.On("FilterNodeAdded", opts, nodeOperatorId)} +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeAdded_Call) Run(run func(opts *bind.FilterOpts, nodeOperatorId []uint32)) *CapabilitiesRegistryInterface_FilterNodeAdded_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]uint32)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeAdded_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeAddedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterNodeAdded_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeAdded_Call) RunAndReturn(run func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryNodeAddedIterator, error)) *CapabilitiesRegistryInterface_FilterNodeAdded_Call { + _c.Call.Return(run) + return _c +} + +// FilterNodeOperatorAdded provides a mock function with given fields: opts, nodeOperatorId, admin +func (_m *CapabilitiesRegistryInterface) FilterNodeOperatorAdded(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address) (*capabilities_registry.CapabilitiesRegistryNodeOperatorAddedIterator, error) { + ret := _m.Called(opts, nodeOperatorId, admin) + + if len(ret) == 0 { + panic("no return value specified for FilterNodeOperatorAdded") + } + + var r0 *capabilities_registry.CapabilitiesRegistryNodeOperatorAddedIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32, []common.Address) (*capabilities_registry.CapabilitiesRegistryNodeOperatorAddedIterator, error)); ok { + return rf(opts, nodeOperatorId, admin) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32, []common.Address) *capabilities_registry.CapabilitiesRegistryNodeOperatorAddedIterator); ok { + r0 = rf(opts, nodeOperatorId, admin) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeOperatorAddedIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint32, []common.Address) error); ok { + r1 = rf(opts, nodeOperatorId, admin) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterNodeOperatorAdded' +type CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call struct { + *mock.Call +} + +// FilterNodeOperatorAdded is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - nodeOperatorId []uint32 +// - admin []common.Address +func (_e *CapabilitiesRegistryInterface_Expecter) FilterNodeOperatorAdded(opts interface{}, nodeOperatorId interface{}, admin interface{}) *CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call { + return &CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call{Call: _e.mock.On("FilterNodeOperatorAdded", opts, nodeOperatorId, admin)} +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call) Run(run func(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address)) *CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]uint32), args[2].([]common.Address)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeOperatorAddedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call) RunAndReturn(run func(*bind.FilterOpts, []uint32, []common.Address) (*capabilities_registry.CapabilitiesRegistryNodeOperatorAddedIterator, error)) *CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call { + _c.Call.Return(run) + return _c +} + +// FilterNodeOperatorRemoved provides a mock function with given fields: opts, nodeOperatorId +func (_m *CapabilitiesRegistryInterface) FilterNodeOperatorRemoved(opts *bind.FilterOpts, nodeOperatorId []uint32) (*capabilities_registry.CapabilitiesRegistryNodeOperatorRemovedIterator, error) { + ret := _m.Called(opts, nodeOperatorId) + + if len(ret) == 0 { + panic("no return value specified for FilterNodeOperatorRemoved") + } + + var r0 *capabilities_registry.CapabilitiesRegistryNodeOperatorRemovedIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryNodeOperatorRemovedIterator, error)); ok { + return rf(opts, nodeOperatorId) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) *capabilities_registry.CapabilitiesRegistryNodeOperatorRemovedIterator); ok { + r0 = rf(opts, nodeOperatorId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeOperatorRemovedIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint32) error); ok { + r1 = rf(opts, nodeOperatorId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterNodeOperatorRemoved' +type CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call struct { + *mock.Call +} + +// FilterNodeOperatorRemoved is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - nodeOperatorId []uint32 +func (_e *CapabilitiesRegistryInterface_Expecter) FilterNodeOperatorRemoved(opts interface{}, nodeOperatorId interface{}) *CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call { + return &CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call{Call: _e.mock.On("FilterNodeOperatorRemoved", opts, nodeOperatorId)} +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call) Run(run func(opts *bind.FilterOpts, nodeOperatorId []uint32)) *CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]uint32)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeOperatorRemovedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call) RunAndReturn(run func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryNodeOperatorRemovedIterator, error)) *CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call { + _c.Call.Return(run) + return _c +} + +// FilterNodeOperatorUpdated provides a mock function with given fields: opts, nodeOperatorId, admin +func (_m *CapabilitiesRegistryInterface) FilterNodeOperatorUpdated(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address) (*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdatedIterator, error) { + ret := _m.Called(opts, nodeOperatorId, admin) + + if len(ret) == 0 { + panic("no return value specified for FilterNodeOperatorUpdated") + } + + var r0 *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdatedIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32, []common.Address) (*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdatedIterator, error)); ok { + return rf(opts, nodeOperatorId, admin) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32, []common.Address) *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdatedIterator); ok { + r0 = rf(opts, nodeOperatorId, admin) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdatedIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint32, []common.Address) error); ok { + r1 = rf(opts, nodeOperatorId, admin) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterNodeOperatorUpdated' +type CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call struct { + *mock.Call +} + +// FilterNodeOperatorUpdated is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - nodeOperatorId []uint32 +// - admin []common.Address +func (_e *CapabilitiesRegistryInterface_Expecter) FilterNodeOperatorUpdated(opts interface{}, nodeOperatorId interface{}, admin interface{}) *CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call { + return &CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call{Call: _e.mock.On("FilterNodeOperatorUpdated", opts, nodeOperatorId, admin)} +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call) Run(run func(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address)) *CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]uint32), args[2].([]common.Address)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdatedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call) RunAndReturn(run func(*bind.FilterOpts, []uint32, []common.Address) (*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdatedIterator, error)) *CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call { + _c.Call.Return(run) + return _c +} + +// FilterNodeRemoved provides a mock function with given fields: opts +func (_m *CapabilitiesRegistryInterface) FilterNodeRemoved(opts *bind.FilterOpts) (*capabilities_registry.CapabilitiesRegistryNodeRemovedIterator, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for FilterNodeRemoved") + } + + var r0 *capabilities_registry.CapabilitiesRegistryNodeRemovedIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*capabilities_registry.CapabilitiesRegistryNodeRemovedIterator, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *capabilities_registry.CapabilitiesRegistryNodeRemovedIterator); ok { + r0 = rf(opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeRemovedIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_FilterNodeRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterNodeRemoved' +type CapabilitiesRegistryInterface_FilterNodeRemoved_Call struct { + *mock.Call +} + +// FilterNodeRemoved is a helper method to define mock.On call +// - opts *bind.FilterOpts +func (_e *CapabilitiesRegistryInterface_Expecter) FilterNodeRemoved(opts interface{}) *CapabilitiesRegistryInterface_FilterNodeRemoved_Call { + return &CapabilitiesRegistryInterface_FilterNodeRemoved_Call{Call: _e.mock.On("FilterNodeRemoved", opts)} +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeRemoved_Call) Run(run func(opts *bind.FilterOpts)) *CapabilitiesRegistryInterface_FilterNodeRemoved_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeRemoved_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeRemovedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterNodeRemoved_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeRemoved_Call) RunAndReturn(run func(*bind.FilterOpts) (*capabilities_registry.CapabilitiesRegistryNodeRemovedIterator, error)) *CapabilitiesRegistryInterface_FilterNodeRemoved_Call { + _c.Call.Return(run) + return _c +} + +// FilterNodeUpdated provides a mock function with given fields: opts, nodeOperatorId +func (_m *CapabilitiesRegistryInterface) FilterNodeUpdated(opts *bind.FilterOpts, nodeOperatorId []uint32) (*capabilities_registry.CapabilitiesRegistryNodeUpdatedIterator, error) { + ret := _m.Called(opts, nodeOperatorId) + + if len(ret) == 0 { + panic("no return value specified for FilterNodeUpdated") + } + + var r0 *capabilities_registry.CapabilitiesRegistryNodeUpdatedIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryNodeUpdatedIterator, error)); ok { + return rf(opts, nodeOperatorId) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) *capabilities_registry.CapabilitiesRegistryNodeUpdatedIterator); ok { + r0 = rf(opts, nodeOperatorId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeUpdatedIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint32) error); ok { + r1 = rf(opts, nodeOperatorId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_FilterNodeUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterNodeUpdated' +type CapabilitiesRegistryInterface_FilterNodeUpdated_Call struct { + *mock.Call +} + +// FilterNodeUpdated is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - nodeOperatorId []uint32 +func (_e *CapabilitiesRegistryInterface_Expecter) FilterNodeUpdated(opts interface{}, nodeOperatorId interface{}) *CapabilitiesRegistryInterface_FilterNodeUpdated_Call { + return &CapabilitiesRegistryInterface_FilterNodeUpdated_Call{Call: _e.mock.On("FilterNodeUpdated", opts, nodeOperatorId)} +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeUpdated_Call) Run(run func(opts *bind.FilterOpts, nodeOperatorId []uint32)) *CapabilitiesRegistryInterface_FilterNodeUpdated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]uint32)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeUpdated_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeUpdatedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterNodeUpdated_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterNodeUpdated_Call) RunAndReturn(run func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryNodeUpdatedIterator, error)) *CapabilitiesRegistryInterface_FilterNodeUpdated_Call { + _c.Call.Return(run) + return _c +} + +// FilterOwnershipTransferRequested provides a mock function with given fields: opts, from, to +func (_m *CapabilitiesRegistryInterface) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequestedIterator, error) { + ret := _m.Called(opts, from, to) + + if len(ret) == 0 { + panic("no return value specified for FilterOwnershipTransferRequested") + } + + var r0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequestedIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequestedIterator, error)); ok { + return rf(opts, from, to) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequestedIterator); ok { + r0 = rf(opts, from, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequestedIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { + r1 = rf(opts, from, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterOwnershipTransferRequested' +type CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call struct { + *mock.Call +} + +// FilterOwnershipTransferRequested is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - from []common.Address +// - to []common.Address +func (_e *CapabilitiesRegistryInterface_Expecter) FilterOwnershipTransferRequested(opts interface{}, from interface{}, to interface{}) *CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call { + return &CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call{Call: _e.mock.On("FilterOwnershipTransferRequested", opts, from, to)} +} + +func (_c *CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call) Run(run func(opts *bind.FilterOpts, from []common.Address, to []common.Address)) *CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]common.Address), args[2].([]common.Address)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequestedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address, []common.Address) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequestedIterator, error)) *CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call { + _c.Call.Return(run) + return _c +} + +// FilterOwnershipTransferred provides a mock function with given fields: opts, from, to +func (_m *CapabilitiesRegistryInterface) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferredIterator, error) { + ret := _m.Called(opts, from, to) + + if len(ret) == 0 { + panic("no return value specified for FilterOwnershipTransferred") + } + + var r0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferredIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferredIterator, error)); ok { + return rf(opts, from, to) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *capabilities_registry.CapabilitiesRegistryOwnershipTransferredIterator); ok { + r0 = rf(opts, from, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryOwnershipTransferredIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { + r1 = rf(opts, from, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterOwnershipTransferred' +type CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call struct { + *mock.Call +} + +// FilterOwnershipTransferred is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - from []common.Address +// - to []common.Address +func (_e *CapabilitiesRegistryInterface_Expecter) FilterOwnershipTransferred(opts interface{}, from interface{}, to interface{}) *CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call { + return &CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call{Call: _e.mock.On("FilterOwnershipTransferred", opts, from, to)} +} + +func (_c *CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call) Run(run func(opts *bind.FilterOpts, from []common.Address, to []common.Address)) *CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]common.Address), args[2].([]common.Address)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferredIterator, _a1 error) *CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address, []common.Address) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferredIterator, error)) *CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call { + _c.Call.Return(run) + return _c +} + +// GetCapabilities provides a mock function with given fields: opts +func (_m *CapabilitiesRegistryInterface) GetCapabilities(opts *bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryCapabilityInfo, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for GetCapabilities") + } + + var r0 []capabilities_registry.CapabilitiesRegistryCapabilityInfo + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryCapabilityInfo, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts) []capabilities_registry.CapabilitiesRegistryCapabilityInfo); ok { + r0 = rf(opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]capabilities_registry.CapabilitiesRegistryCapabilityInfo) + } + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_GetCapabilities_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCapabilities' +type CapabilitiesRegistryInterface_GetCapabilities_Call struct { + *mock.Call +} + +// GetCapabilities is a helper method to define mock.On call +// - opts *bind.CallOpts +func (_e *CapabilitiesRegistryInterface_Expecter) GetCapabilities(opts interface{}) *CapabilitiesRegistryInterface_GetCapabilities_Call { + return &CapabilitiesRegistryInterface_GetCapabilities_Call{Call: _e.mock.On("GetCapabilities", opts)} +} + +func (_c *CapabilitiesRegistryInterface_GetCapabilities_Call) Run(run func(opts *bind.CallOpts)) *CapabilitiesRegistryInterface_GetCapabilities_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetCapabilities_Call) Return(_a0 []capabilities_registry.CapabilitiesRegistryCapabilityInfo, _a1 error) *CapabilitiesRegistryInterface_GetCapabilities_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetCapabilities_Call) RunAndReturn(run func(*bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryCapabilityInfo, error)) *CapabilitiesRegistryInterface_GetCapabilities_Call { + _c.Call.Return(run) + return _c +} + +// GetCapability provides a mock function with given fields: opts, hashedId +func (_m *CapabilitiesRegistryInterface) GetCapability(opts *bind.CallOpts, hashedId [32]byte) (capabilities_registry.CapabilitiesRegistryCapabilityInfo, error) { + ret := _m.Called(opts, hashedId) + + if len(ret) == 0 { + panic("no return value specified for GetCapability") + } + + var r0 capabilities_registry.CapabilitiesRegistryCapabilityInfo + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts, [32]byte) (capabilities_registry.CapabilitiesRegistryCapabilityInfo, error)); ok { + return rf(opts, hashedId) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts, [32]byte) capabilities_registry.CapabilitiesRegistryCapabilityInfo); ok { + r0 = rf(opts, hashedId) + } else { + r0 = ret.Get(0).(capabilities_registry.CapabilitiesRegistryCapabilityInfo) + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts, [32]byte) error); ok { + r1 = rf(opts, hashedId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_GetCapability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCapability' +type CapabilitiesRegistryInterface_GetCapability_Call struct { + *mock.Call +} + +// GetCapability is a helper method to define mock.On call +// - opts *bind.CallOpts +// - hashedId [32]byte +func (_e *CapabilitiesRegistryInterface_Expecter) GetCapability(opts interface{}, hashedId interface{}) *CapabilitiesRegistryInterface_GetCapability_Call { + return &CapabilitiesRegistryInterface_GetCapability_Call{Call: _e.mock.On("GetCapability", opts, hashedId)} +} + +func (_c *CapabilitiesRegistryInterface_GetCapability_Call) Run(run func(opts *bind.CallOpts, hashedId [32]byte)) *CapabilitiesRegistryInterface_GetCapability_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts), args[1].([32]byte)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetCapability_Call) Return(_a0 capabilities_registry.CapabilitiesRegistryCapabilityInfo, _a1 error) *CapabilitiesRegistryInterface_GetCapability_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetCapability_Call) RunAndReturn(run func(*bind.CallOpts, [32]byte) (capabilities_registry.CapabilitiesRegistryCapabilityInfo, error)) *CapabilitiesRegistryInterface_GetCapability_Call { + _c.Call.Return(run) + return _c +} + +// GetCapabilityConfigs provides a mock function with given fields: opts, donId, capabilityId +func (_m *CapabilitiesRegistryInterface) GetCapabilityConfigs(opts *bind.CallOpts, donId uint32, capabilityId [32]byte) ([]byte, []byte, error) { + ret := _m.Called(opts, donId, capabilityId) + + if len(ret) == 0 { + panic("no return value specified for GetCapabilityConfigs") + } + + var r0 []byte + var r1 []byte + var r2 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts, uint32, [32]byte) ([]byte, []byte, error)); ok { + return rf(opts, donId, capabilityId) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts, uint32, [32]byte) []byte); ok { + r0 = rf(opts, donId, capabilityId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts, uint32, [32]byte) []byte); ok { + r1 = rf(opts, donId, capabilityId) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).([]byte) + } + } + + if rf, ok := ret.Get(2).(func(*bind.CallOpts, uint32, [32]byte) error); ok { + r2 = rf(opts, donId, capabilityId) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// CapabilitiesRegistryInterface_GetCapabilityConfigs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCapabilityConfigs' +type CapabilitiesRegistryInterface_GetCapabilityConfigs_Call struct { + *mock.Call +} + +// GetCapabilityConfigs is a helper method to define mock.On call +// - opts *bind.CallOpts +// - donId uint32 +// - capabilityId [32]byte +func (_e *CapabilitiesRegistryInterface_Expecter) GetCapabilityConfigs(opts interface{}, donId interface{}, capabilityId interface{}) *CapabilitiesRegistryInterface_GetCapabilityConfigs_Call { + return &CapabilitiesRegistryInterface_GetCapabilityConfigs_Call{Call: _e.mock.On("GetCapabilityConfigs", opts, donId, capabilityId)} +} + +func (_c *CapabilitiesRegistryInterface_GetCapabilityConfigs_Call) Run(run func(opts *bind.CallOpts, donId uint32, capabilityId [32]byte)) *CapabilitiesRegistryInterface_GetCapabilityConfigs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts), args[1].(uint32), args[2].([32]byte)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetCapabilityConfigs_Call) Return(_a0 []byte, _a1 []byte, _a2 error) *CapabilitiesRegistryInterface_GetCapabilityConfigs_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetCapabilityConfigs_Call) RunAndReturn(run func(*bind.CallOpts, uint32, [32]byte) ([]byte, []byte, error)) *CapabilitiesRegistryInterface_GetCapabilityConfigs_Call { + _c.Call.Return(run) + return _c +} + +// GetDON provides a mock function with given fields: opts, donId +func (_m *CapabilitiesRegistryInterface) GetDON(opts *bind.CallOpts, donId uint32) (capabilities_registry.CapabilitiesRegistryDONInfo, error) { + ret := _m.Called(opts, donId) + + if len(ret) == 0 { + panic("no return value specified for GetDON") + } + + var r0 capabilities_registry.CapabilitiesRegistryDONInfo + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts, uint32) (capabilities_registry.CapabilitiesRegistryDONInfo, error)); ok { + return rf(opts, donId) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts, uint32) capabilities_registry.CapabilitiesRegistryDONInfo); ok { + r0 = rf(opts, donId) + } else { + r0 = ret.Get(0).(capabilities_registry.CapabilitiesRegistryDONInfo) + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts, uint32) error); ok { + r1 = rf(opts, donId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_GetDON_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDON' +type CapabilitiesRegistryInterface_GetDON_Call struct { + *mock.Call +} + +// GetDON is a helper method to define mock.On call +// - opts *bind.CallOpts +// - donId uint32 +func (_e *CapabilitiesRegistryInterface_Expecter) GetDON(opts interface{}, donId interface{}) *CapabilitiesRegistryInterface_GetDON_Call { + return &CapabilitiesRegistryInterface_GetDON_Call{Call: _e.mock.On("GetDON", opts, donId)} +} + +func (_c *CapabilitiesRegistryInterface_GetDON_Call) Run(run func(opts *bind.CallOpts, donId uint32)) *CapabilitiesRegistryInterface_GetDON_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts), args[1].(uint32)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetDON_Call) Return(_a0 capabilities_registry.CapabilitiesRegistryDONInfo, _a1 error) *CapabilitiesRegistryInterface_GetDON_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetDON_Call) RunAndReturn(run func(*bind.CallOpts, uint32) (capabilities_registry.CapabilitiesRegistryDONInfo, error)) *CapabilitiesRegistryInterface_GetDON_Call { + _c.Call.Return(run) + return _c +} + +// GetDONs provides a mock function with given fields: opts +func (_m *CapabilitiesRegistryInterface) GetDONs(opts *bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryDONInfo, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for GetDONs") + } + + var r0 []capabilities_registry.CapabilitiesRegistryDONInfo + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryDONInfo, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts) []capabilities_registry.CapabilitiesRegistryDONInfo); ok { + r0 = rf(opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]capabilities_registry.CapabilitiesRegistryDONInfo) + } + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_GetDONs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDONs' +type CapabilitiesRegistryInterface_GetDONs_Call struct { + *mock.Call +} + +// GetDONs is a helper method to define mock.On call +// - opts *bind.CallOpts +func (_e *CapabilitiesRegistryInterface_Expecter) GetDONs(opts interface{}) *CapabilitiesRegistryInterface_GetDONs_Call { + return &CapabilitiesRegistryInterface_GetDONs_Call{Call: _e.mock.On("GetDONs", opts)} +} + +func (_c *CapabilitiesRegistryInterface_GetDONs_Call) Run(run func(opts *bind.CallOpts)) *CapabilitiesRegistryInterface_GetDONs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetDONs_Call) Return(_a0 []capabilities_registry.CapabilitiesRegistryDONInfo, _a1 error) *CapabilitiesRegistryInterface_GetDONs_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetDONs_Call) RunAndReturn(run func(*bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryDONInfo, error)) *CapabilitiesRegistryInterface_GetDONs_Call { + _c.Call.Return(run) + return _c +} + +// GetHashedCapabilityId provides a mock function with given fields: opts, labelledName, version +func (_m *CapabilitiesRegistryInterface) GetHashedCapabilityId(opts *bind.CallOpts, labelledName string, version string) ([32]byte, error) { + ret := _m.Called(opts, labelledName, version) + + if len(ret) == 0 { + panic("no return value specified for GetHashedCapabilityId") + } + + var r0 [32]byte + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts, string, string) ([32]byte, error)); ok { + return rf(opts, labelledName, version) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts, string, string) [32]byte); ok { + r0 = rf(opts, labelledName, version) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([32]byte) + } + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts, string, string) error); ok { + r1 = rf(opts, labelledName, version) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_GetHashedCapabilityId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetHashedCapabilityId' +type CapabilitiesRegistryInterface_GetHashedCapabilityId_Call struct { + *mock.Call +} + +// GetHashedCapabilityId is a helper method to define mock.On call +// - opts *bind.CallOpts +// - labelledName string +// - version string +func (_e *CapabilitiesRegistryInterface_Expecter) GetHashedCapabilityId(opts interface{}, labelledName interface{}, version interface{}) *CapabilitiesRegistryInterface_GetHashedCapabilityId_Call { + return &CapabilitiesRegistryInterface_GetHashedCapabilityId_Call{Call: _e.mock.On("GetHashedCapabilityId", opts, labelledName, version)} +} + +func (_c *CapabilitiesRegistryInterface_GetHashedCapabilityId_Call) Run(run func(opts *bind.CallOpts, labelledName string, version string)) *CapabilitiesRegistryInterface_GetHashedCapabilityId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetHashedCapabilityId_Call) Return(_a0 [32]byte, _a1 error) *CapabilitiesRegistryInterface_GetHashedCapabilityId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetHashedCapabilityId_Call) RunAndReturn(run func(*bind.CallOpts, string, string) ([32]byte, error)) *CapabilitiesRegistryInterface_GetHashedCapabilityId_Call { + _c.Call.Return(run) + return _c +} + +// GetNextDONId provides a mock function with given fields: opts +func (_m *CapabilitiesRegistryInterface) GetNextDONId(opts *bind.CallOpts) (uint32, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for GetNextDONId") + } + + var r0 uint32 + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts) (uint32, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts) uint32); ok { + r0 = rf(opts) + } else { + r0 = ret.Get(0).(uint32) + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_GetNextDONId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNextDONId' +type CapabilitiesRegistryInterface_GetNextDONId_Call struct { + *mock.Call +} + +// GetNextDONId is a helper method to define mock.On call +// - opts *bind.CallOpts +func (_e *CapabilitiesRegistryInterface_Expecter) GetNextDONId(opts interface{}) *CapabilitiesRegistryInterface_GetNextDONId_Call { + return &CapabilitiesRegistryInterface_GetNextDONId_Call{Call: _e.mock.On("GetNextDONId", opts)} +} + +func (_c *CapabilitiesRegistryInterface_GetNextDONId_Call) Run(run func(opts *bind.CallOpts)) *CapabilitiesRegistryInterface_GetNextDONId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetNextDONId_Call) Return(_a0 uint32, _a1 error) *CapabilitiesRegistryInterface_GetNextDONId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetNextDONId_Call) RunAndReturn(run func(*bind.CallOpts) (uint32, error)) *CapabilitiesRegistryInterface_GetNextDONId_Call { + _c.Call.Return(run) + return _c +} + +// GetNode provides a mock function with given fields: opts, p2pId +func (_m *CapabilitiesRegistryInterface) GetNode(opts *bind.CallOpts, p2pId [32]byte) (capabilities_registry.INodeInfoProviderNodeInfo, error) { + ret := _m.Called(opts, p2pId) + + if len(ret) == 0 { + panic("no return value specified for GetNode") + } + + var r0 capabilities_registry.INodeInfoProviderNodeInfo + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts, [32]byte) (capabilities_registry.INodeInfoProviderNodeInfo, error)); ok { + return rf(opts, p2pId) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts, [32]byte) capabilities_registry.INodeInfoProviderNodeInfo); ok { + r0 = rf(opts, p2pId) + } else { + r0 = ret.Get(0).(capabilities_registry.INodeInfoProviderNodeInfo) + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts, [32]byte) error); ok { + r1 = rf(opts, p2pId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_GetNode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNode' +type CapabilitiesRegistryInterface_GetNode_Call struct { + *mock.Call +} + +// GetNode is a helper method to define mock.On call +// - opts *bind.CallOpts +// - p2pId [32]byte +func (_e *CapabilitiesRegistryInterface_Expecter) GetNode(opts interface{}, p2pId interface{}) *CapabilitiesRegistryInterface_GetNode_Call { + return &CapabilitiesRegistryInterface_GetNode_Call{Call: _e.mock.On("GetNode", opts, p2pId)} +} + +func (_c *CapabilitiesRegistryInterface_GetNode_Call) Run(run func(opts *bind.CallOpts, p2pId [32]byte)) *CapabilitiesRegistryInterface_GetNode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts), args[1].([32]byte)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetNode_Call) Return(_a0 capabilities_registry.INodeInfoProviderNodeInfo, _a1 error) *CapabilitiesRegistryInterface_GetNode_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetNode_Call) RunAndReturn(run func(*bind.CallOpts, [32]byte) (capabilities_registry.INodeInfoProviderNodeInfo, error)) *CapabilitiesRegistryInterface_GetNode_Call { + _c.Call.Return(run) + return _c +} + +// GetNodeOperator provides a mock function with given fields: opts, nodeOperatorId +func (_m *CapabilitiesRegistryInterface) GetNodeOperator(opts *bind.CallOpts, nodeOperatorId uint32) (capabilities_registry.CapabilitiesRegistryNodeOperator, error) { + ret := _m.Called(opts, nodeOperatorId) + + if len(ret) == 0 { + panic("no return value specified for GetNodeOperator") + } + + var r0 capabilities_registry.CapabilitiesRegistryNodeOperator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts, uint32) (capabilities_registry.CapabilitiesRegistryNodeOperator, error)); ok { + return rf(opts, nodeOperatorId) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts, uint32) capabilities_registry.CapabilitiesRegistryNodeOperator); ok { + r0 = rf(opts, nodeOperatorId) + } else { + r0 = ret.Get(0).(capabilities_registry.CapabilitiesRegistryNodeOperator) + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts, uint32) error); ok { + r1 = rf(opts, nodeOperatorId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_GetNodeOperator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNodeOperator' +type CapabilitiesRegistryInterface_GetNodeOperator_Call struct { + *mock.Call +} + +// GetNodeOperator is a helper method to define mock.On call +// - opts *bind.CallOpts +// - nodeOperatorId uint32 +func (_e *CapabilitiesRegistryInterface_Expecter) GetNodeOperator(opts interface{}, nodeOperatorId interface{}) *CapabilitiesRegistryInterface_GetNodeOperator_Call { + return &CapabilitiesRegistryInterface_GetNodeOperator_Call{Call: _e.mock.On("GetNodeOperator", opts, nodeOperatorId)} +} + +func (_c *CapabilitiesRegistryInterface_GetNodeOperator_Call) Run(run func(opts *bind.CallOpts, nodeOperatorId uint32)) *CapabilitiesRegistryInterface_GetNodeOperator_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts), args[1].(uint32)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetNodeOperator_Call) Return(_a0 capabilities_registry.CapabilitiesRegistryNodeOperator, _a1 error) *CapabilitiesRegistryInterface_GetNodeOperator_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetNodeOperator_Call) RunAndReturn(run func(*bind.CallOpts, uint32) (capabilities_registry.CapabilitiesRegistryNodeOperator, error)) *CapabilitiesRegistryInterface_GetNodeOperator_Call { + _c.Call.Return(run) + return _c +} + +// GetNodeOperators provides a mock function with given fields: opts +func (_m *CapabilitiesRegistryInterface) GetNodeOperators(opts *bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryNodeOperator, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for GetNodeOperators") + } + + var r0 []capabilities_registry.CapabilitiesRegistryNodeOperator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryNodeOperator, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts) []capabilities_registry.CapabilitiesRegistryNodeOperator); ok { + r0 = rf(opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]capabilities_registry.CapabilitiesRegistryNodeOperator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_GetNodeOperators_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNodeOperators' +type CapabilitiesRegistryInterface_GetNodeOperators_Call struct { + *mock.Call +} + +// GetNodeOperators is a helper method to define mock.On call +// - opts *bind.CallOpts +func (_e *CapabilitiesRegistryInterface_Expecter) GetNodeOperators(opts interface{}) *CapabilitiesRegistryInterface_GetNodeOperators_Call { + return &CapabilitiesRegistryInterface_GetNodeOperators_Call{Call: _e.mock.On("GetNodeOperators", opts)} +} + +func (_c *CapabilitiesRegistryInterface_GetNodeOperators_Call) Run(run func(opts *bind.CallOpts)) *CapabilitiesRegistryInterface_GetNodeOperators_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetNodeOperators_Call) Return(_a0 []capabilities_registry.CapabilitiesRegistryNodeOperator, _a1 error) *CapabilitiesRegistryInterface_GetNodeOperators_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetNodeOperators_Call) RunAndReturn(run func(*bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryNodeOperator, error)) *CapabilitiesRegistryInterface_GetNodeOperators_Call { + _c.Call.Return(run) + return _c +} + +// GetNodes provides a mock function with given fields: opts +func (_m *CapabilitiesRegistryInterface) GetNodes(opts *bind.CallOpts) ([]capabilities_registry.INodeInfoProviderNodeInfo, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for GetNodes") + } + + var r0 []capabilities_registry.INodeInfoProviderNodeInfo + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts) ([]capabilities_registry.INodeInfoProviderNodeInfo, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts) []capabilities_registry.INodeInfoProviderNodeInfo); ok { + r0 = rf(opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]capabilities_registry.INodeInfoProviderNodeInfo) + } + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_GetNodes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNodes' +type CapabilitiesRegistryInterface_GetNodes_Call struct { + *mock.Call +} + +// GetNodes is a helper method to define mock.On call +// - opts *bind.CallOpts +func (_e *CapabilitiesRegistryInterface_Expecter) GetNodes(opts interface{}) *CapabilitiesRegistryInterface_GetNodes_Call { + return &CapabilitiesRegistryInterface_GetNodes_Call{Call: _e.mock.On("GetNodes", opts)} +} + +func (_c *CapabilitiesRegistryInterface_GetNodes_Call) Run(run func(opts *bind.CallOpts)) *CapabilitiesRegistryInterface_GetNodes_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetNodes_Call) Return(_a0 []capabilities_registry.INodeInfoProviderNodeInfo, _a1 error) *CapabilitiesRegistryInterface_GetNodes_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetNodes_Call) RunAndReturn(run func(*bind.CallOpts) ([]capabilities_registry.INodeInfoProviderNodeInfo, error)) *CapabilitiesRegistryInterface_GetNodes_Call { + _c.Call.Return(run) + return _c +} + +// GetNodesByP2PIds provides a mock function with given fields: opts, p2pIds +func (_m *CapabilitiesRegistryInterface) GetNodesByP2PIds(opts *bind.CallOpts, p2pIds [][32]byte) ([]capabilities_registry.INodeInfoProviderNodeInfo, error) { + ret := _m.Called(opts, p2pIds) + + if len(ret) == 0 { + panic("no return value specified for GetNodesByP2PIds") + } + + var r0 []capabilities_registry.INodeInfoProviderNodeInfo + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts, [][32]byte) ([]capabilities_registry.INodeInfoProviderNodeInfo, error)); ok { + return rf(opts, p2pIds) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts, [][32]byte) []capabilities_registry.INodeInfoProviderNodeInfo); ok { + r0 = rf(opts, p2pIds) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]capabilities_registry.INodeInfoProviderNodeInfo) + } + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts, [][32]byte) error); ok { + r1 = rf(opts, p2pIds) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_GetNodesByP2PIds_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNodesByP2PIds' +type CapabilitiesRegistryInterface_GetNodesByP2PIds_Call struct { + *mock.Call +} + +// GetNodesByP2PIds is a helper method to define mock.On call +// - opts *bind.CallOpts +// - p2pIds [][32]byte +func (_e *CapabilitiesRegistryInterface_Expecter) GetNodesByP2PIds(opts interface{}, p2pIds interface{}) *CapabilitiesRegistryInterface_GetNodesByP2PIds_Call { + return &CapabilitiesRegistryInterface_GetNodesByP2PIds_Call{Call: _e.mock.On("GetNodesByP2PIds", opts, p2pIds)} +} + +func (_c *CapabilitiesRegistryInterface_GetNodesByP2PIds_Call) Run(run func(opts *bind.CallOpts, p2pIds [][32]byte)) *CapabilitiesRegistryInterface_GetNodesByP2PIds_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts), args[1].([][32]byte)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetNodesByP2PIds_Call) Return(_a0 []capabilities_registry.INodeInfoProviderNodeInfo, _a1 error) *CapabilitiesRegistryInterface_GetNodesByP2PIds_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_GetNodesByP2PIds_Call) RunAndReturn(run func(*bind.CallOpts, [][32]byte) ([]capabilities_registry.INodeInfoProviderNodeInfo, error)) *CapabilitiesRegistryInterface_GetNodesByP2PIds_Call { + _c.Call.Return(run) + return _c +} + +// IsCapabilityDeprecated provides a mock function with given fields: opts, hashedCapabilityId +func (_m *CapabilitiesRegistryInterface) IsCapabilityDeprecated(opts *bind.CallOpts, hashedCapabilityId [32]byte) (bool, error) { + ret := _m.Called(opts, hashedCapabilityId) + + if len(ret) == 0 { + panic("no return value specified for IsCapabilityDeprecated") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts, [32]byte) (bool, error)); ok { + return rf(opts, hashedCapabilityId) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts, [32]byte) bool); ok { + r0 = rf(opts, hashedCapabilityId) + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts, [32]byte) error); ok { + r1 = rf(opts, hashedCapabilityId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsCapabilityDeprecated' +type CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call struct { + *mock.Call +} + +// IsCapabilityDeprecated is a helper method to define mock.On call +// - opts *bind.CallOpts +// - hashedCapabilityId [32]byte +func (_e *CapabilitiesRegistryInterface_Expecter) IsCapabilityDeprecated(opts interface{}, hashedCapabilityId interface{}) *CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call { + return &CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call{Call: _e.mock.On("IsCapabilityDeprecated", opts, hashedCapabilityId)} +} + +func (_c *CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call) Run(run func(opts *bind.CallOpts, hashedCapabilityId [32]byte)) *CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts), args[1].([32]byte)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call) Return(_a0 bool, _a1 error) *CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call) RunAndReturn(run func(*bind.CallOpts, [32]byte) (bool, error)) *CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call { + _c.Call.Return(run) + return _c +} + +// Owner provides a mock function with given fields: opts +func (_m *CapabilitiesRegistryInterface) Owner(opts *bind.CallOpts) (common.Address, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for Owner") + } + + var r0 common.Address + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts) (common.Address, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts) common.Address); ok { + r0 = rf(opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(common.Address) + } + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_Owner_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Owner' +type CapabilitiesRegistryInterface_Owner_Call struct { + *mock.Call +} + +// Owner is a helper method to define mock.On call +// - opts *bind.CallOpts +func (_e *CapabilitiesRegistryInterface_Expecter) Owner(opts interface{}) *CapabilitiesRegistryInterface_Owner_Call { + return &CapabilitiesRegistryInterface_Owner_Call{Call: _e.mock.On("Owner", opts)} +} + +func (_c *CapabilitiesRegistryInterface_Owner_Call) Run(run func(opts *bind.CallOpts)) *CapabilitiesRegistryInterface_Owner_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_Owner_Call) Return(_a0 common.Address, _a1 error) *CapabilitiesRegistryInterface_Owner_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_Owner_Call) RunAndReturn(run func(*bind.CallOpts) (common.Address, error)) *CapabilitiesRegistryInterface_Owner_Call { + _c.Call.Return(run) + return _c +} + +// ParseCapabilityConfigured provides a mock function with given fields: log +func (_m *CapabilitiesRegistryInterface) ParseCapabilityConfigured(log types.Log) (*capabilities_registry.CapabilitiesRegistryCapabilityConfigured, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseCapabilityConfigured") + } + + var r0 *capabilities_registry.CapabilitiesRegistryCapabilityConfigured + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryCapabilityConfigured, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryCapabilityConfigured); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryCapabilityConfigured) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseCapabilityConfigured' +type CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call struct { + *mock.Call +} + +// ParseCapabilityConfigured is a helper method to define mock.On call +// - log types.Log +func (_e *CapabilitiesRegistryInterface_Expecter) ParseCapabilityConfigured(log interface{}) *CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call { + return &CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call{Call: _e.mock.On("ParseCapabilityConfigured", log)} +} + +func (_c *CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryCapabilityConfigured, _a1 error) *CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryCapabilityConfigured, error)) *CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call { + _c.Call.Return(run) + return _c +} + +// ParseCapabilityDeprecated provides a mock function with given fields: log +func (_m *CapabilitiesRegistryInterface) ParseCapabilityDeprecated(log types.Log) (*capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseCapabilityDeprecated") + } + + var r0 *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryCapabilityDeprecated) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseCapabilityDeprecated' +type CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call struct { + *mock.Call +} + +// ParseCapabilityDeprecated is a helper method to define mock.On call +// - log types.Log +func (_e *CapabilitiesRegistryInterface_Expecter) ParseCapabilityDeprecated(log interface{}) *CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call { + return &CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call{Call: _e.mock.On("ParseCapabilityDeprecated", log)} +} + +func (_c *CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, _a1 error) *CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, error)) *CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call { + _c.Call.Return(run) + return _c +} + +// ParseConfigSet provides a mock function with given fields: log +func (_m *CapabilitiesRegistryInterface) ParseConfigSet(log types.Log) (*capabilities_registry.CapabilitiesRegistryConfigSet, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseConfigSet") + } + + var r0 *capabilities_registry.CapabilitiesRegistryConfigSet + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryConfigSet, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryConfigSet); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryConfigSet) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_ParseConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseConfigSet' +type CapabilitiesRegistryInterface_ParseConfigSet_Call struct { + *mock.Call +} + +// ParseConfigSet is a helper method to define mock.On call +// - log types.Log +func (_e *CapabilitiesRegistryInterface_Expecter) ParseConfigSet(log interface{}) *CapabilitiesRegistryInterface_ParseConfigSet_Call { + return &CapabilitiesRegistryInterface_ParseConfigSet_Call{Call: _e.mock.On("ParseConfigSet", log)} +} + +func (_c *CapabilitiesRegistryInterface_ParseConfigSet_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseConfigSet_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseConfigSet_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryConfigSet, _a1 error) *CapabilitiesRegistryInterface_ParseConfigSet_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseConfigSet_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryConfigSet, error)) *CapabilitiesRegistryInterface_ParseConfigSet_Call { + _c.Call.Return(run) + return _c +} + +// ParseLog provides a mock function with given fields: log +func (_m *CapabilitiesRegistryInterface) ParseLog(log types.Log) (generated.AbigenLog, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseLog") + } + + var r0 generated.AbigenLog + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (generated.AbigenLog, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) generated.AbigenLog); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(generated.AbigenLog) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_ParseLog_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseLog' +type CapabilitiesRegistryInterface_ParseLog_Call struct { + *mock.Call +} + +// ParseLog is a helper method to define mock.On call +// - log types.Log +func (_e *CapabilitiesRegistryInterface_Expecter) ParseLog(log interface{}) *CapabilitiesRegistryInterface_ParseLog_Call { + return &CapabilitiesRegistryInterface_ParseLog_Call{Call: _e.mock.On("ParseLog", log)} +} + +func (_c *CapabilitiesRegistryInterface_ParseLog_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseLog_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseLog_Call) Return(_a0 generated.AbigenLog, _a1 error) *CapabilitiesRegistryInterface_ParseLog_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseLog_Call) RunAndReturn(run func(types.Log) (generated.AbigenLog, error)) *CapabilitiesRegistryInterface_ParseLog_Call { + _c.Call.Return(run) + return _c +} + +// ParseNodeAdded provides a mock function with given fields: log +func (_m *CapabilitiesRegistryInterface) ParseNodeAdded(log types.Log) (*capabilities_registry.CapabilitiesRegistryNodeAdded, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseNodeAdded") + } + + var r0 *capabilities_registry.CapabilitiesRegistryNodeAdded + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeAdded, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryNodeAdded); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeAdded) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_ParseNodeAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseNodeAdded' +type CapabilitiesRegistryInterface_ParseNodeAdded_Call struct { + *mock.Call +} + +// ParseNodeAdded is a helper method to define mock.On call +// - log types.Log +func (_e *CapabilitiesRegistryInterface_Expecter) ParseNodeAdded(log interface{}) *CapabilitiesRegistryInterface_ParseNodeAdded_Call { + return &CapabilitiesRegistryInterface_ParseNodeAdded_Call{Call: _e.mock.On("ParseNodeAdded", log)} +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeAdded_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseNodeAdded_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeAdded_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeAdded, _a1 error) *CapabilitiesRegistryInterface_ParseNodeAdded_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeAdded_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeAdded, error)) *CapabilitiesRegistryInterface_ParseNodeAdded_Call { + _c.Call.Return(run) + return _c +} + +// ParseNodeOperatorAdded provides a mock function with given fields: log +func (_m *CapabilitiesRegistryInterface) ParseNodeOperatorAdded(log types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseNodeOperatorAdded") + } + + var r0 *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeOperatorAdded) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseNodeOperatorAdded' +type CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call struct { + *mock.Call +} + +// ParseNodeOperatorAdded is a helper method to define mock.On call +// - log types.Log +func (_e *CapabilitiesRegistryInterface_Expecter) ParseNodeOperatorAdded(log interface{}) *CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call { + return &CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call{Call: _e.mock.On("ParseNodeOperatorAdded", log)} +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, _a1 error) *CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, error)) *CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call { + _c.Call.Return(run) + return _c +} + +// ParseNodeOperatorRemoved provides a mock function with given fields: log +func (_m *CapabilitiesRegistryInterface) ParseNodeOperatorRemoved(log types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseNodeOperatorRemoved") + } + + var r0 *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseNodeOperatorRemoved' +type CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call struct { + *mock.Call +} + +// ParseNodeOperatorRemoved is a helper method to define mock.On call +// - log types.Log +func (_e *CapabilitiesRegistryInterface_Expecter) ParseNodeOperatorRemoved(log interface{}) *CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call { + return &CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call{Call: _e.mock.On("ParseNodeOperatorRemoved", log)} +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, _a1 error) *CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, error)) *CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call { + _c.Call.Return(run) + return _c +} + +// ParseNodeOperatorUpdated provides a mock function with given fields: log +func (_m *CapabilitiesRegistryInterface) ParseNodeOperatorUpdated(log types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseNodeOperatorUpdated") + } + + var r0 *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseNodeOperatorUpdated' +type CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call struct { + *mock.Call +} + +// ParseNodeOperatorUpdated is a helper method to define mock.On call +// - log types.Log +func (_e *CapabilitiesRegistryInterface_Expecter) ParseNodeOperatorUpdated(log interface{}) *CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call { + return &CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call{Call: _e.mock.On("ParseNodeOperatorUpdated", log)} +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, _a1 error) *CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, error)) *CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call { + _c.Call.Return(run) + return _c +} + +// ParseNodeRemoved provides a mock function with given fields: log +func (_m *CapabilitiesRegistryInterface) ParseNodeRemoved(log types.Log) (*capabilities_registry.CapabilitiesRegistryNodeRemoved, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseNodeRemoved") + } + + var r0 *capabilities_registry.CapabilitiesRegistryNodeRemoved + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeRemoved, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryNodeRemoved); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeRemoved) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_ParseNodeRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseNodeRemoved' +type CapabilitiesRegistryInterface_ParseNodeRemoved_Call struct { + *mock.Call +} + +// ParseNodeRemoved is a helper method to define mock.On call +// - log types.Log +func (_e *CapabilitiesRegistryInterface_Expecter) ParseNodeRemoved(log interface{}) *CapabilitiesRegistryInterface_ParseNodeRemoved_Call { + return &CapabilitiesRegistryInterface_ParseNodeRemoved_Call{Call: _e.mock.On("ParseNodeRemoved", log)} +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeRemoved_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseNodeRemoved_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeRemoved_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeRemoved, _a1 error) *CapabilitiesRegistryInterface_ParseNodeRemoved_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeRemoved_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeRemoved, error)) *CapabilitiesRegistryInterface_ParseNodeRemoved_Call { + _c.Call.Return(run) + return _c +} + +// ParseNodeUpdated provides a mock function with given fields: log +func (_m *CapabilitiesRegistryInterface) ParseNodeUpdated(log types.Log) (*capabilities_registry.CapabilitiesRegistryNodeUpdated, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseNodeUpdated") + } + + var r0 *capabilities_registry.CapabilitiesRegistryNodeUpdated + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeUpdated, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryNodeUpdated); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeUpdated) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_ParseNodeUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseNodeUpdated' +type CapabilitiesRegistryInterface_ParseNodeUpdated_Call struct { + *mock.Call +} + +// ParseNodeUpdated is a helper method to define mock.On call +// - log types.Log +func (_e *CapabilitiesRegistryInterface_Expecter) ParseNodeUpdated(log interface{}) *CapabilitiesRegistryInterface_ParseNodeUpdated_Call { + return &CapabilitiesRegistryInterface_ParseNodeUpdated_Call{Call: _e.mock.On("ParseNodeUpdated", log)} +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeUpdated_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseNodeUpdated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeUpdated_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeUpdated, _a1 error) *CapabilitiesRegistryInterface_ParseNodeUpdated_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseNodeUpdated_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeUpdated, error)) *CapabilitiesRegistryInterface_ParseNodeUpdated_Call { + _c.Call.Return(run) + return _c +} + +// ParseOwnershipTransferRequested provides a mock function with given fields: log +func (_m *CapabilitiesRegistryInterface) ParseOwnershipTransferRequested(log types.Log) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseOwnershipTransferRequested") + } + + var r0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseOwnershipTransferRequested' +type CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call struct { + *mock.Call +} + +// ParseOwnershipTransferRequested is a helper method to define mock.On call +// - log types.Log +func (_e *CapabilitiesRegistryInterface_Expecter) ParseOwnershipTransferRequested(log interface{}) *CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call { + return &CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call{Call: _e.mock.On("ParseOwnershipTransferRequested", log)} +} + +func (_c *CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, _a1 error) *CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, error)) *CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call { + _c.Call.Return(run) + return _c +} + +// ParseOwnershipTransferred provides a mock function with given fields: log +func (_m *CapabilitiesRegistryInterface) ParseOwnershipTransferred(log types.Log) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferred, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseOwnershipTransferred") + } + + var r0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferred + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferred, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryOwnershipTransferred); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryOwnershipTransferred) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseOwnershipTransferred' +type CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call struct { + *mock.Call +} + +// ParseOwnershipTransferred is a helper method to define mock.On call +// - log types.Log +func (_e *CapabilitiesRegistryInterface_Expecter) ParseOwnershipTransferred(log interface{}) *CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call { + return &CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call{Call: _e.mock.On("ParseOwnershipTransferred", log)} +} + +func (_c *CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferred, _a1 error) *CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferred, error)) *CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call { + _c.Call.Return(run) + return _c +} + +// RemoveDONs provides a mock function with given fields: opts, donIds +func (_m *CapabilitiesRegistryInterface) RemoveDONs(opts *bind.TransactOpts, donIds []uint32) (*types.Transaction, error) { + ret := _m.Called(opts, donIds) + + if len(ret) == 0 { + panic("no return value specified for RemoveDONs") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []uint32) (*types.Transaction, error)); ok { + return rf(opts, donIds) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []uint32) *types.Transaction); ok { + r0 = rf(opts, donIds) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []uint32) error); ok { + r1 = rf(opts, donIds) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_RemoveDONs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveDONs' +type CapabilitiesRegistryInterface_RemoveDONs_Call struct { + *mock.Call +} + +// RemoveDONs is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - donIds []uint32 +func (_e *CapabilitiesRegistryInterface_Expecter) RemoveDONs(opts interface{}, donIds interface{}) *CapabilitiesRegistryInterface_RemoveDONs_Call { + return &CapabilitiesRegistryInterface_RemoveDONs_Call{Call: _e.mock.On("RemoveDONs", opts, donIds)} +} + +func (_c *CapabilitiesRegistryInterface_RemoveDONs_Call) Run(run func(opts *bind.TransactOpts, donIds []uint32)) *CapabilitiesRegistryInterface_RemoveDONs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].([]uint32)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_RemoveDONs_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_RemoveDONs_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_RemoveDONs_Call) RunAndReturn(run func(*bind.TransactOpts, []uint32) (*types.Transaction, error)) *CapabilitiesRegistryInterface_RemoveDONs_Call { + _c.Call.Return(run) + return _c +} + +// RemoveNodeOperators provides a mock function with given fields: opts, nodeOperatorIds +func (_m *CapabilitiesRegistryInterface) RemoveNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []uint32) (*types.Transaction, error) { + ret := _m.Called(opts, nodeOperatorIds) + + if len(ret) == 0 { + panic("no return value specified for RemoveNodeOperators") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []uint32) (*types.Transaction, error)); ok { + return rf(opts, nodeOperatorIds) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []uint32) *types.Transaction); ok { + r0 = rf(opts, nodeOperatorIds) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []uint32) error); ok { + r1 = rf(opts, nodeOperatorIds) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_RemoveNodeOperators_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveNodeOperators' +type CapabilitiesRegistryInterface_RemoveNodeOperators_Call struct { + *mock.Call +} + +// RemoveNodeOperators is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - nodeOperatorIds []uint32 +func (_e *CapabilitiesRegistryInterface_Expecter) RemoveNodeOperators(opts interface{}, nodeOperatorIds interface{}) *CapabilitiesRegistryInterface_RemoveNodeOperators_Call { + return &CapabilitiesRegistryInterface_RemoveNodeOperators_Call{Call: _e.mock.On("RemoveNodeOperators", opts, nodeOperatorIds)} +} + +func (_c *CapabilitiesRegistryInterface_RemoveNodeOperators_Call) Run(run func(opts *bind.TransactOpts, nodeOperatorIds []uint32)) *CapabilitiesRegistryInterface_RemoveNodeOperators_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].([]uint32)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_RemoveNodeOperators_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_RemoveNodeOperators_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_RemoveNodeOperators_Call) RunAndReturn(run func(*bind.TransactOpts, []uint32) (*types.Transaction, error)) *CapabilitiesRegistryInterface_RemoveNodeOperators_Call { + _c.Call.Return(run) + return _c +} + +// RemoveNodes provides a mock function with given fields: opts, removedNodeP2PIds +func (_m *CapabilitiesRegistryInterface) RemoveNodes(opts *bind.TransactOpts, removedNodeP2PIds [][32]byte) (*types.Transaction, error) { + ret := _m.Called(opts, removedNodeP2PIds) + + if len(ret) == 0 { + panic("no return value specified for RemoveNodes") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][32]byte) (*types.Transaction, error)); ok { + return rf(opts, removedNodeP2PIds) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][32]byte) *types.Transaction); ok { + r0 = rf(opts, removedNodeP2PIds) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, [][32]byte) error); ok { + r1 = rf(opts, removedNodeP2PIds) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_RemoveNodes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveNodes' +type CapabilitiesRegistryInterface_RemoveNodes_Call struct { + *mock.Call +} + +// RemoveNodes is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - removedNodeP2PIds [][32]byte +func (_e *CapabilitiesRegistryInterface_Expecter) RemoveNodes(opts interface{}, removedNodeP2PIds interface{}) *CapabilitiesRegistryInterface_RemoveNodes_Call { + return &CapabilitiesRegistryInterface_RemoveNodes_Call{Call: _e.mock.On("RemoveNodes", opts, removedNodeP2PIds)} +} + +func (_c *CapabilitiesRegistryInterface_RemoveNodes_Call) Run(run func(opts *bind.TransactOpts, removedNodeP2PIds [][32]byte)) *CapabilitiesRegistryInterface_RemoveNodes_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].([][32]byte)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_RemoveNodes_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_RemoveNodes_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_RemoveNodes_Call) RunAndReturn(run func(*bind.TransactOpts, [][32]byte) (*types.Transaction, error)) *CapabilitiesRegistryInterface_RemoveNodes_Call { + _c.Call.Return(run) + return _c +} + +// TransferOwnership provides a mock function with given fields: opts, to +func (_m *CapabilitiesRegistryInterface) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { + ret := _m.Called(opts, to) + + if len(ret) == 0 { + panic("no return value specified for TransferOwnership") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { + return rf(opts, to) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { + r0 = rf(opts, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { + r1 = rf(opts, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_TransferOwnership_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransferOwnership' +type CapabilitiesRegistryInterface_TransferOwnership_Call struct { + *mock.Call +} + +// TransferOwnership is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - to common.Address +func (_e *CapabilitiesRegistryInterface_Expecter) TransferOwnership(opts interface{}, to interface{}) *CapabilitiesRegistryInterface_TransferOwnership_Call { + return &CapabilitiesRegistryInterface_TransferOwnership_Call{Call: _e.mock.On("TransferOwnership", opts, to)} +} + +func (_c *CapabilitiesRegistryInterface_TransferOwnership_Call) Run(run func(opts *bind.TransactOpts, to common.Address)) *CapabilitiesRegistryInterface_TransferOwnership_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].(common.Address)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_TransferOwnership_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_TransferOwnership_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_TransferOwnership_Call) RunAndReturn(run func(*bind.TransactOpts, common.Address) (*types.Transaction, error)) *CapabilitiesRegistryInterface_TransferOwnership_Call { + _c.Call.Return(run) + return _c +} + +// TypeAndVersion provides a mock function with given fields: opts +func (_m *CapabilitiesRegistryInterface) TypeAndVersion(opts *bind.CallOpts) (string, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for TypeAndVersion") + } + + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts) (string, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts) string); ok { + r0 = rf(opts) + } else { + r0 = ret.Get(0).(string) + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_TypeAndVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeAndVersion' +type CapabilitiesRegistryInterface_TypeAndVersion_Call struct { + *mock.Call +} + +// TypeAndVersion is a helper method to define mock.On call +// - opts *bind.CallOpts +func (_e *CapabilitiesRegistryInterface_Expecter) TypeAndVersion(opts interface{}) *CapabilitiesRegistryInterface_TypeAndVersion_Call { + return &CapabilitiesRegistryInterface_TypeAndVersion_Call{Call: _e.mock.On("TypeAndVersion", opts)} +} + +func (_c *CapabilitiesRegistryInterface_TypeAndVersion_Call) Run(run func(opts *bind.CallOpts)) *CapabilitiesRegistryInterface_TypeAndVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_TypeAndVersion_Call) Return(_a0 string, _a1 error) *CapabilitiesRegistryInterface_TypeAndVersion_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_TypeAndVersion_Call) RunAndReturn(run func(*bind.CallOpts) (string, error)) *CapabilitiesRegistryInterface_TypeAndVersion_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDON provides a mock function with given fields: opts, donId, nodes, capabilityConfigurations, isPublic, f +func (_m *CapabilitiesRegistryInterface) UpdateDON(opts *bind.TransactOpts, donId uint32, nodes [][32]byte, capabilityConfigurations []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, isPublic bool, f uint8) (*types.Transaction, error) { + ret := _m.Called(opts, donId, nodes, capabilityConfigurations, isPublic, f) + + if len(ret) == 0 { + panic("no return value specified for UpdateDON") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, uint32, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, uint8) (*types.Transaction, error)); ok { + return rf(opts, donId, nodes, capabilityConfigurations, isPublic, f) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, uint32, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, uint8) *types.Transaction); ok { + r0 = rf(opts, donId, nodes, capabilityConfigurations, isPublic, f) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, uint32, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, uint8) error); ok { + r1 = rf(opts, donId, nodes, capabilityConfigurations, isPublic, f) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_UpdateDON_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDON' +type CapabilitiesRegistryInterface_UpdateDON_Call struct { + *mock.Call +} + +// UpdateDON is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - donId uint32 +// - nodes [][32]byte +// - capabilityConfigurations []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration +// - isPublic bool +// - f uint8 +func (_e *CapabilitiesRegistryInterface_Expecter) UpdateDON(opts interface{}, donId interface{}, nodes interface{}, capabilityConfigurations interface{}, isPublic interface{}, f interface{}) *CapabilitiesRegistryInterface_UpdateDON_Call { + return &CapabilitiesRegistryInterface_UpdateDON_Call{Call: _e.mock.On("UpdateDON", opts, donId, nodes, capabilityConfigurations, isPublic, f)} +} + +func (_c *CapabilitiesRegistryInterface_UpdateDON_Call) Run(run func(opts *bind.TransactOpts, donId uint32, nodes [][32]byte, capabilityConfigurations []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, isPublic bool, f uint8)) *CapabilitiesRegistryInterface_UpdateDON_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].(uint32), args[2].([][32]byte), args[3].([]capabilities_registry.CapabilitiesRegistryCapabilityConfiguration), args[4].(bool), args[5].(uint8)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_UpdateDON_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_UpdateDON_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_UpdateDON_Call) RunAndReturn(run func(*bind.TransactOpts, uint32, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, uint8) (*types.Transaction, error)) *CapabilitiesRegistryInterface_UpdateDON_Call { + _c.Call.Return(run) + return _c +} + +// UpdateNodeOperators provides a mock function with given fields: opts, nodeOperatorIds, nodeOperators +func (_m *CapabilitiesRegistryInterface) UpdateNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []uint32, nodeOperators []capabilities_registry.CapabilitiesRegistryNodeOperator) (*types.Transaction, error) { + ret := _m.Called(opts, nodeOperatorIds, nodeOperators) + + if len(ret) == 0 { + panic("no return value specified for UpdateNodeOperators") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []uint32, []capabilities_registry.CapabilitiesRegistryNodeOperator) (*types.Transaction, error)); ok { + return rf(opts, nodeOperatorIds, nodeOperators) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []uint32, []capabilities_registry.CapabilitiesRegistryNodeOperator) *types.Transaction); ok { + r0 = rf(opts, nodeOperatorIds, nodeOperators) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []uint32, []capabilities_registry.CapabilitiesRegistryNodeOperator) error); ok { + r1 = rf(opts, nodeOperatorIds, nodeOperators) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_UpdateNodeOperators_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateNodeOperators' +type CapabilitiesRegistryInterface_UpdateNodeOperators_Call struct { + *mock.Call +} + +// UpdateNodeOperators is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - nodeOperatorIds []uint32 +// - nodeOperators []capabilities_registry.CapabilitiesRegistryNodeOperator +func (_e *CapabilitiesRegistryInterface_Expecter) UpdateNodeOperators(opts interface{}, nodeOperatorIds interface{}, nodeOperators interface{}) *CapabilitiesRegistryInterface_UpdateNodeOperators_Call { + return &CapabilitiesRegistryInterface_UpdateNodeOperators_Call{Call: _e.mock.On("UpdateNodeOperators", opts, nodeOperatorIds, nodeOperators)} +} + +func (_c *CapabilitiesRegistryInterface_UpdateNodeOperators_Call) Run(run func(opts *bind.TransactOpts, nodeOperatorIds []uint32, nodeOperators []capabilities_registry.CapabilitiesRegistryNodeOperator)) *CapabilitiesRegistryInterface_UpdateNodeOperators_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].([]uint32), args[2].([]capabilities_registry.CapabilitiesRegistryNodeOperator)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_UpdateNodeOperators_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_UpdateNodeOperators_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_UpdateNodeOperators_Call) RunAndReturn(run func(*bind.TransactOpts, []uint32, []capabilities_registry.CapabilitiesRegistryNodeOperator) (*types.Transaction, error)) *CapabilitiesRegistryInterface_UpdateNodeOperators_Call { + _c.Call.Return(run) + return _c +} + +// UpdateNodes provides a mock function with given fields: opts, nodes +func (_m *CapabilitiesRegistryInterface) UpdateNodes(opts *bind.TransactOpts, nodes []capabilities_registry.CapabilitiesRegistryNodeParams) (*types.Transaction, error) { + ret := _m.Called(opts, nodes) + + if len(ret) == 0 { + panic("no return value specified for UpdateNodes") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) (*types.Transaction, error)); ok { + return rf(opts, nodes) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) *types.Transaction); ok { + r0 = rf(opts, nodes) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) error); ok { + r1 = rf(opts, nodes) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_UpdateNodes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateNodes' +type CapabilitiesRegistryInterface_UpdateNodes_Call struct { + *mock.Call +} + +// UpdateNodes is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - nodes []capabilities_registry.CapabilitiesRegistryNodeParams +func (_e *CapabilitiesRegistryInterface_Expecter) UpdateNodes(opts interface{}, nodes interface{}) *CapabilitiesRegistryInterface_UpdateNodes_Call { + return &CapabilitiesRegistryInterface_UpdateNodes_Call{Call: _e.mock.On("UpdateNodes", opts, nodes)} +} + +func (_c *CapabilitiesRegistryInterface_UpdateNodes_Call) Run(run func(opts *bind.TransactOpts, nodes []capabilities_registry.CapabilitiesRegistryNodeParams)) *CapabilitiesRegistryInterface_UpdateNodes_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].([]capabilities_registry.CapabilitiesRegistryNodeParams)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_UpdateNodes_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_UpdateNodes_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_UpdateNodes_Call) RunAndReturn(run func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) (*types.Transaction, error)) *CapabilitiesRegistryInterface_UpdateNodes_Call { + _c.Call.Return(run) + return _c +} + +// WatchCapabilityConfigured provides a mock function with given fields: opts, sink, hashedCapabilityId +func (_m *CapabilitiesRegistryInterface) WatchCapabilityConfigured(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured, hashedCapabilityId [][32]byte) (event.Subscription, error) { + ret := _m.Called(opts, sink, hashedCapabilityId) + + if len(ret) == 0 { + panic("no return value specified for WatchCapabilityConfigured") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured, [][32]byte) (event.Subscription, error)); ok { + return rf(opts, sink, hashedCapabilityId) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured, [][32]byte) event.Subscription); ok { + r0 = rf(opts, sink, hashedCapabilityId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured, [][32]byte) error); ok { + r1 = rf(opts, sink, hashedCapabilityId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchCapabilityConfigured' +type CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call struct { + *mock.Call +} + +// WatchCapabilityConfigured is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured +// - hashedCapabilityId [][32]byte +func (_e *CapabilitiesRegistryInterface_Expecter) WatchCapabilityConfigured(opts interface{}, sink interface{}, hashedCapabilityId interface{}) *CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call { + return &CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call{Call: _e.mock.On("WatchCapabilityConfigured", opts, sink, hashedCapabilityId)} +} + +func (_c *CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured, hashedCapabilityId [][32]byte)) *CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured), args[2].([][32]byte)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured, [][32]byte) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call { + _c.Call.Return(run) + return _c +} + +// WatchCapabilityDeprecated provides a mock function with given fields: opts, sink, hashedCapabilityId +func (_m *CapabilitiesRegistryInterface) WatchCapabilityDeprecated(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, hashedCapabilityId [][32]byte) (event.Subscription, error) { + ret := _m.Called(opts, sink, hashedCapabilityId) + + if len(ret) == 0 { + panic("no return value specified for WatchCapabilityDeprecated") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, [][32]byte) (event.Subscription, error)); ok { + return rf(opts, sink, hashedCapabilityId) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, [][32]byte) event.Subscription); ok { + r0 = rf(opts, sink, hashedCapabilityId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, [][32]byte) error); ok { + r1 = rf(opts, sink, hashedCapabilityId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchCapabilityDeprecated' +type CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call struct { + *mock.Call +} + +// WatchCapabilityDeprecated is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated +// - hashedCapabilityId [][32]byte +func (_e *CapabilitiesRegistryInterface_Expecter) WatchCapabilityDeprecated(opts interface{}, sink interface{}, hashedCapabilityId interface{}) *CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call { + return &CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call{Call: _e.mock.On("WatchCapabilityDeprecated", opts, sink, hashedCapabilityId)} +} + +func (_c *CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, hashedCapabilityId [][32]byte)) *CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated), args[2].([][32]byte)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, [][32]byte) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call { + _c.Call.Return(run) + return _c +} + +// WatchConfigSet provides a mock function with given fields: opts, sink, donId +func (_m *CapabilitiesRegistryInterface) WatchConfigSet(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryConfigSet, donId []uint32) (event.Subscription, error) { + ret := _m.Called(opts, sink, donId) + + if len(ret) == 0 { + panic("no return value specified for WatchConfigSet") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryConfigSet, []uint32) (event.Subscription, error)); ok { + return rf(opts, sink, donId) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryConfigSet, []uint32) event.Subscription); ok { + r0 = rf(opts, sink, donId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryConfigSet, []uint32) error); ok { + r1 = rf(opts, sink, donId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_WatchConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchConfigSet' +type CapabilitiesRegistryInterface_WatchConfigSet_Call struct { + *mock.Call +} + +// WatchConfigSet is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *capabilities_registry.CapabilitiesRegistryConfigSet +// - donId []uint32 +func (_e *CapabilitiesRegistryInterface_Expecter) WatchConfigSet(opts interface{}, sink interface{}, donId interface{}) *CapabilitiesRegistryInterface_WatchConfigSet_Call { + return &CapabilitiesRegistryInterface_WatchConfigSet_Call{Call: _e.mock.On("WatchConfigSet", opts, sink, donId)} +} + +func (_c *CapabilitiesRegistryInterface_WatchConfigSet_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryConfigSet, donId []uint32)) *CapabilitiesRegistryInterface_WatchConfigSet_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryConfigSet), args[2].([]uint32)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchConfigSet_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchConfigSet_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchConfigSet_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryConfigSet, []uint32) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchConfigSet_Call { + _c.Call.Return(run) + return _c +} + +// WatchNodeAdded provides a mock function with given fields: opts, sink, nodeOperatorId +func (_m *CapabilitiesRegistryInterface) WatchNodeAdded(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded, nodeOperatorId []uint32) (event.Subscription, error) { + ret := _m.Called(opts, sink, nodeOperatorId) + + if len(ret) == 0 { + panic("no return value specified for WatchNodeAdded") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded, []uint32) (event.Subscription, error)); ok { + return rf(opts, sink, nodeOperatorId) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded, []uint32) event.Subscription); ok { + r0 = rf(opts, sink, nodeOperatorId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded, []uint32) error); ok { + r1 = rf(opts, sink, nodeOperatorId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_WatchNodeAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchNodeAdded' +type CapabilitiesRegistryInterface_WatchNodeAdded_Call struct { + *mock.Call +} + +// WatchNodeAdded is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded +// - nodeOperatorId []uint32 +func (_e *CapabilitiesRegistryInterface_Expecter) WatchNodeAdded(opts interface{}, sink interface{}, nodeOperatorId interface{}) *CapabilitiesRegistryInterface_WatchNodeAdded_Call { + return &CapabilitiesRegistryInterface_WatchNodeAdded_Call{Call: _e.mock.On("WatchNodeAdded", opts, sink, nodeOperatorId)} +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeAdded_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded, nodeOperatorId []uint32)) *CapabilitiesRegistryInterface_WatchNodeAdded_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded), args[2].([]uint32)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeAdded_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchNodeAdded_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeAdded_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded, []uint32) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchNodeAdded_Call { + _c.Call.Return(run) + return _c +} + +// WatchNodeOperatorAdded provides a mock function with given fields: opts, sink, nodeOperatorId, admin +func (_m *CapabilitiesRegistryInterface) WatchNodeOperatorAdded(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, nodeOperatorId []uint32, admin []common.Address) (event.Subscription, error) { + ret := _m.Called(opts, sink, nodeOperatorId, admin) + + if len(ret) == 0 { + panic("no return value specified for WatchNodeOperatorAdded") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, []uint32, []common.Address) (event.Subscription, error)); ok { + return rf(opts, sink, nodeOperatorId, admin) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, []uint32, []common.Address) event.Subscription); ok { + r0 = rf(opts, sink, nodeOperatorId, admin) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, []uint32, []common.Address) error); ok { + r1 = rf(opts, sink, nodeOperatorId, admin) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchNodeOperatorAdded' +type CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call struct { + *mock.Call +} + +// WatchNodeOperatorAdded is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded +// - nodeOperatorId []uint32 +// - admin []common.Address +func (_e *CapabilitiesRegistryInterface_Expecter) WatchNodeOperatorAdded(opts interface{}, sink interface{}, nodeOperatorId interface{}, admin interface{}) *CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call { + return &CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call{Call: _e.mock.On("WatchNodeOperatorAdded", opts, sink, nodeOperatorId, admin)} +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, nodeOperatorId []uint32, admin []common.Address)) *CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded), args[2].([]uint32), args[3].([]common.Address)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, []uint32, []common.Address) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call { + _c.Call.Return(run) + return _c +} + +// WatchNodeOperatorRemoved provides a mock function with given fields: opts, sink, nodeOperatorId +func (_m *CapabilitiesRegistryInterface) WatchNodeOperatorRemoved(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, nodeOperatorId []uint32) (event.Subscription, error) { + ret := _m.Called(opts, sink, nodeOperatorId) + + if len(ret) == 0 { + panic("no return value specified for WatchNodeOperatorRemoved") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, []uint32) (event.Subscription, error)); ok { + return rf(opts, sink, nodeOperatorId) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, []uint32) event.Subscription); ok { + r0 = rf(opts, sink, nodeOperatorId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, []uint32) error); ok { + r1 = rf(opts, sink, nodeOperatorId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchNodeOperatorRemoved' +type CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call struct { + *mock.Call +} + +// WatchNodeOperatorRemoved is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved +// - nodeOperatorId []uint32 +func (_e *CapabilitiesRegistryInterface_Expecter) WatchNodeOperatorRemoved(opts interface{}, sink interface{}, nodeOperatorId interface{}) *CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call { + return &CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call{Call: _e.mock.On("WatchNodeOperatorRemoved", opts, sink, nodeOperatorId)} +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, nodeOperatorId []uint32)) *CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved), args[2].([]uint32)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, []uint32) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call { + _c.Call.Return(run) + return _c +} + +// WatchNodeOperatorUpdated provides a mock function with given fields: opts, sink, nodeOperatorId, admin +func (_m *CapabilitiesRegistryInterface) WatchNodeOperatorUpdated(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, nodeOperatorId []uint32, admin []common.Address) (event.Subscription, error) { + ret := _m.Called(opts, sink, nodeOperatorId, admin) + + if len(ret) == 0 { + panic("no return value specified for WatchNodeOperatorUpdated") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, []uint32, []common.Address) (event.Subscription, error)); ok { + return rf(opts, sink, nodeOperatorId, admin) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, []uint32, []common.Address) event.Subscription); ok { + r0 = rf(opts, sink, nodeOperatorId, admin) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, []uint32, []common.Address) error); ok { + r1 = rf(opts, sink, nodeOperatorId, admin) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchNodeOperatorUpdated' +type CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call struct { + *mock.Call +} + +// WatchNodeOperatorUpdated is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated +// - nodeOperatorId []uint32 +// - admin []common.Address +func (_e *CapabilitiesRegistryInterface_Expecter) WatchNodeOperatorUpdated(opts interface{}, sink interface{}, nodeOperatorId interface{}, admin interface{}) *CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call { + return &CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call{Call: _e.mock.On("WatchNodeOperatorUpdated", opts, sink, nodeOperatorId, admin)} +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, nodeOperatorId []uint32, admin []common.Address)) *CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated), args[2].([]uint32), args[3].([]common.Address)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, []uint32, []common.Address) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call { + _c.Call.Return(run) + return _c +} + +// WatchNodeRemoved provides a mock function with given fields: opts, sink +func (_m *CapabilitiesRegistryInterface) WatchNodeRemoved(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved) (event.Subscription, error) { + ret := _m.Called(opts, sink) + + if len(ret) == 0 { + panic("no return value specified for WatchNodeRemoved") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved) (event.Subscription, error)); ok { + return rf(opts, sink) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved) event.Subscription); ok { + r0 = rf(opts, sink) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved) error); ok { + r1 = rf(opts, sink) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_WatchNodeRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchNodeRemoved' +type CapabilitiesRegistryInterface_WatchNodeRemoved_Call struct { + *mock.Call +} + +// WatchNodeRemoved is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved +func (_e *CapabilitiesRegistryInterface_Expecter) WatchNodeRemoved(opts interface{}, sink interface{}) *CapabilitiesRegistryInterface_WatchNodeRemoved_Call { + return &CapabilitiesRegistryInterface_WatchNodeRemoved_Call{Call: _e.mock.On("WatchNodeRemoved", opts, sink)} +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeRemoved_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved)) *CapabilitiesRegistryInterface_WatchNodeRemoved_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeRemoved_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchNodeRemoved_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeRemoved_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchNodeRemoved_Call { + _c.Call.Return(run) + return _c +} + +// WatchNodeUpdated provides a mock function with given fields: opts, sink, nodeOperatorId +func (_m *CapabilitiesRegistryInterface) WatchNodeUpdated(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated, nodeOperatorId []uint32) (event.Subscription, error) { + ret := _m.Called(opts, sink, nodeOperatorId) + + if len(ret) == 0 { + panic("no return value specified for WatchNodeUpdated") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated, []uint32) (event.Subscription, error)); ok { + return rf(opts, sink, nodeOperatorId) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated, []uint32) event.Subscription); ok { + r0 = rf(opts, sink, nodeOperatorId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated, []uint32) error); ok { + r1 = rf(opts, sink, nodeOperatorId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_WatchNodeUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchNodeUpdated' +type CapabilitiesRegistryInterface_WatchNodeUpdated_Call struct { + *mock.Call +} + +// WatchNodeUpdated is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated +// - nodeOperatorId []uint32 +func (_e *CapabilitiesRegistryInterface_Expecter) WatchNodeUpdated(opts interface{}, sink interface{}, nodeOperatorId interface{}) *CapabilitiesRegistryInterface_WatchNodeUpdated_Call { + return &CapabilitiesRegistryInterface_WatchNodeUpdated_Call{Call: _e.mock.On("WatchNodeUpdated", opts, sink, nodeOperatorId)} +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeUpdated_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated, nodeOperatorId []uint32)) *CapabilitiesRegistryInterface_WatchNodeUpdated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated), args[2].([]uint32)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeUpdated_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchNodeUpdated_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchNodeUpdated_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated, []uint32) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchNodeUpdated_Call { + _c.Call.Return(run) + return _c +} + +// WatchOwnershipTransferRequested provides a mock function with given fields: opts, sink, from, to +func (_m *CapabilitiesRegistryInterface) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) { + ret := _m.Called(opts, sink, from, to) + + if len(ret) == 0 { + panic("no return value specified for WatchOwnershipTransferRequested") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, []common.Address, []common.Address) (event.Subscription, error)); ok { + return rf(opts, sink, from, to) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, []common.Address, []common.Address) event.Subscription); ok { + r0 = rf(opts, sink, from, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, []common.Address, []common.Address) error); ok { + r1 = rf(opts, sink, from, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchOwnershipTransferRequested' +type CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call struct { + *mock.Call +} + +// WatchOwnershipTransferRequested is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested +// - from []common.Address +// - to []common.Address +func (_e *CapabilitiesRegistryInterface_Expecter) WatchOwnershipTransferRequested(opts interface{}, sink interface{}, from interface{}, to interface{}) *CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call { + return &CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call{Call: _e.mock.On("WatchOwnershipTransferRequested", opts, sink, from, to)} +} + +func (_c *CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, from []common.Address, to []common.Address)) *CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested), args[2].([]common.Address), args[3].([]common.Address)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, []common.Address, []common.Address) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call { + _c.Call.Return(run) + return _c +} + +// WatchOwnershipTransferred provides a mock function with given fields: opts, sink, from, to +func (_m *CapabilitiesRegistryInterface) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) { + ret := _m.Called(opts, sink, from, to) + + if len(ret) == 0 { + panic("no return value specified for WatchOwnershipTransferred") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred, []common.Address, []common.Address) (event.Subscription, error)); ok { + return rf(opts, sink, from, to) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred, []common.Address, []common.Address) event.Subscription); ok { + r0 = rf(opts, sink, from, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred, []common.Address, []common.Address) error); ok { + r1 = rf(opts, sink, from, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchOwnershipTransferred' +type CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call struct { + *mock.Call +} + +// WatchOwnershipTransferred is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred +// - from []common.Address +// - to []common.Address +func (_e *CapabilitiesRegistryInterface_Expecter) WatchOwnershipTransferred(opts interface{}, sink interface{}, from interface{}, to interface{}) *CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call { + return &CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call{Call: _e.mock.On("WatchOwnershipTransferred", opts, sink, from, to)} +} + +func (_c *CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred, from []common.Address, to []common.Address)) *CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred), args[2].([]common.Address), args[3].([]common.Address)) + }) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred, []common.Address, []common.Address) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call { + _c.Call.Return(run) + return _c +} + +// NewCapabilitiesRegistryInterface creates a new instance of CapabilitiesRegistryInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewCapabilitiesRegistryInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CapabilitiesRegistryInterface { + mock := &CapabilitiesRegistryInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/core/gethwrappers/keystone/mocks/forwarder_interface.go b/core/gethwrappers/keystone/mocks/forwarder_interface.go new file mode 100644 index 00000000000..3392ebc14b0 --- /dev/null +++ b/core/gethwrappers/keystone/mocks/forwarder_interface.go @@ -0,0 +1,2056 @@ +// Code generated by mockery v2.45.0. DO NOT EDIT. + +package mock_contracts + +import ( + bind "github.com/ethereum/go-ethereum/accounts/abi/bind" + common "github.com/ethereum/go-ethereum/common" + + event "github.com/ethereum/go-ethereum/event" + + forwarder "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder" + + generated "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" + + mock "github.com/stretchr/testify/mock" + + types "github.com/ethereum/go-ethereum/core/types" +) + +// KeystoneForwarderInterface is an autogenerated mock type for the KeystoneForwarderInterface type +type KeystoneForwarderInterface struct { + mock.Mock +} + +type KeystoneForwarderInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *KeystoneForwarderInterface) EXPECT() *KeystoneForwarderInterface_Expecter { + return &KeystoneForwarderInterface_Expecter{mock: &_m.Mock} +} + +// AcceptOwnership provides a mock function with given fields: opts +func (_m *KeystoneForwarderInterface) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for AcceptOwnership") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts) (*types.Transaction, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts) *types.Transaction); ok { + r0 = rf(opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_AcceptOwnership_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AcceptOwnership' +type KeystoneForwarderInterface_AcceptOwnership_Call struct { + *mock.Call +} + +// AcceptOwnership is a helper method to define mock.On call +// - opts *bind.TransactOpts +func (_e *KeystoneForwarderInterface_Expecter) AcceptOwnership(opts interface{}) *KeystoneForwarderInterface_AcceptOwnership_Call { + return &KeystoneForwarderInterface_AcceptOwnership_Call{Call: _e.mock.On("AcceptOwnership", opts)} +} + +func (_c *KeystoneForwarderInterface_AcceptOwnership_Call) Run(run func(opts *bind.TransactOpts)) *KeystoneForwarderInterface_AcceptOwnership_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_AcceptOwnership_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_AcceptOwnership_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_AcceptOwnership_Call) RunAndReturn(run func(*bind.TransactOpts) (*types.Transaction, error)) *KeystoneForwarderInterface_AcceptOwnership_Call { + _c.Call.Return(run) + return _c +} + +// AddForwarder provides a mock function with given fields: opts, _a1 +func (_m *KeystoneForwarderInterface) AddForwarder(opts *bind.TransactOpts, _a1 common.Address) (*types.Transaction, error) { + ret := _m.Called(opts, _a1) + + if len(ret) == 0 { + panic("no return value specified for AddForwarder") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { + return rf(opts, _a1) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { + r0 = rf(opts, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { + r1 = rf(opts, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_AddForwarder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddForwarder' +type KeystoneForwarderInterface_AddForwarder_Call struct { + *mock.Call +} + +// AddForwarder is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - _a1 common.Address +func (_e *KeystoneForwarderInterface_Expecter) AddForwarder(opts interface{}, _a1 interface{}) *KeystoneForwarderInterface_AddForwarder_Call { + return &KeystoneForwarderInterface_AddForwarder_Call{Call: _e.mock.On("AddForwarder", opts, _a1)} +} + +func (_c *KeystoneForwarderInterface_AddForwarder_Call) Run(run func(opts *bind.TransactOpts, _a1 common.Address)) *KeystoneForwarderInterface_AddForwarder_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].(common.Address)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_AddForwarder_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_AddForwarder_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_AddForwarder_Call) RunAndReturn(run func(*bind.TransactOpts, common.Address) (*types.Transaction, error)) *KeystoneForwarderInterface_AddForwarder_Call { + _c.Call.Return(run) + return _c +} + +// Address provides a mock function with given fields: +func (_m *KeystoneForwarderInterface) Address() common.Address { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Address") + } + + var r0 common.Address + if rf, ok := ret.Get(0).(func() common.Address); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(common.Address) + } + } + + return r0 +} + +// KeystoneForwarderInterface_Address_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Address' +type KeystoneForwarderInterface_Address_Call struct { + *mock.Call +} + +// Address is a helper method to define mock.On call +func (_e *KeystoneForwarderInterface_Expecter) Address() *KeystoneForwarderInterface_Address_Call { + return &KeystoneForwarderInterface_Address_Call{Call: _e.mock.On("Address")} +} + +func (_c *KeystoneForwarderInterface_Address_Call) Run(run func()) *KeystoneForwarderInterface_Address_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *KeystoneForwarderInterface_Address_Call) Return(_a0 common.Address) *KeystoneForwarderInterface_Address_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *KeystoneForwarderInterface_Address_Call) RunAndReturn(run func() common.Address) *KeystoneForwarderInterface_Address_Call { + _c.Call.Return(run) + return _c +} + +// ClearConfig provides a mock function with given fields: opts, donId, configVersion +func (_m *KeystoneForwarderInterface) ClearConfig(opts *bind.TransactOpts, donId uint32, configVersion uint32) (*types.Transaction, error) { + ret := _m.Called(opts, donId, configVersion) + + if len(ret) == 0 { + panic("no return value specified for ClearConfig") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, uint32, uint32) (*types.Transaction, error)); ok { + return rf(opts, donId, configVersion) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, uint32, uint32) *types.Transaction); ok { + r0 = rf(opts, donId, configVersion) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, uint32, uint32) error); ok { + r1 = rf(opts, donId, configVersion) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_ClearConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClearConfig' +type KeystoneForwarderInterface_ClearConfig_Call struct { + *mock.Call +} + +// ClearConfig is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - donId uint32 +// - configVersion uint32 +func (_e *KeystoneForwarderInterface_Expecter) ClearConfig(opts interface{}, donId interface{}, configVersion interface{}) *KeystoneForwarderInterface_ClearConfig_Call { + return &KeystoneForwarderInterface_ClearConfig_Call{Call: _e.mock.On("ClearConfig", opts, donId, configVersion)} +} + +func (_c *KeystoneForwarderInterface_ClearConfig_Call) Run(run func(opts *bind.TransactOpts, donId uint32, configVersion uint32)) *KeystoneForwarderInterface_ClearConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].(uint32), args[2].(uint32)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_ClearConfig_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_ClearConfig_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_ClearConfig_Call) RunAndReturn(run func(*bind.TransactOpts, uint32, uint32) (*types.Transaction, error)) *KeystoneForwarderInterface_ClearConfig_Call { + _c.Call.Return(run) + return _c +} + +// FilterConfigSet provides a mock function with given fields: opts, donId, configVersion +func (_m *KeystoneForwarderInterface) FilterConfigSet(opts *bind.FilterOpts, donId []uint32, configVersion []uint32) (*forwarder.KeystoneForwarderConfigSetIterator, error) { + ret := _m.Called(opts, donId, configVersion) + + if len(ret) == 0 { + panic("no return value specified for FilterConfigSet") + } + + var r0 *forwarder.KeystoneForwarderConfigSetIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32, []uint32) (*forwarder.KeystoneForwarderConfigSetIterator, error)); ok { + return rf(opts, donId, configVersion) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32, []uint32) *forwarder.KeystoneForwarderConfigSetIterator); ok { + r0 = rf(opts, donId, configVersion) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*forwarder.KeystoneForwarderConfigSetIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint32, []uint32) error); ok { + r1 = rf(opts, donId, configVersion) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_FilterConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterConfigSet' +type KeystoneForwarderInterface_FilterConfigSet_Call struct { + *mock.Call +} + +// FilterConfigSet is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - donId []uint32 +// - configVersion []uint32 +func (_e *KeystoneForwarderInterface_Expecter) FilterConfigSet(opts interface{}, donId interface{}, configVersion interface{}) *KeystoneForwarderInterface_FilterConfigSet_Call { + return &KeystoneForwarderInterface_FilterConfigSet_Call{Call: _e.mock.On("FilterConfigSet", opts, donId, configVersion)} +} + +func (_c *KeystoneForwarderInterface_FilterConfigSet_Call) Run(run func(opts *bind.FilterOpts, donId []uint32, configVersion []uint32)) *KeystoneForwarderInterface_FilterConfigSet_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]uint32), args[2].([]uint32)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_FilterConfigSet_Call) Return(_a0 *forwarder.KeystoneForwarderConfigSetIterator, _a1 error) *KeystoneForwarderInterface_FilterConfigSet_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_FilterConfigSet_Call) RunAndReturn(run func(*bind.FilterOpts, []uint32, []uint32) (*forwarder.KeystoneForwarderConfigSetIterator, error)) *KeystoneForwarderInterface_FilterConfigSet_Call { + _c.Call.Return(run) + return _c +} + +// FilterForwarderAdded provides a mock function with given fields: opts, _a1 +func (_m *KeystoneForwarderInterface) FilterForwarderAdded(opts *bind.FilterOpts, _a1 []common.Address) (*forwarder.KeystoneForwarderForwarderAddedIterator, error) { + ret := _m.Called(opts, _a1) + + if len(ret) == 0 { + panic("no return value specified for FilterForwarderAdded") + } + + var r0 *forwarder.KeystoneForwarderForwarderAddedIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address) (*forwarder.KeystoneForwarderForwarderAddedIterator, error)); ok { + return rf(opts, _a1) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address) *forwarder.KeystoneForwarderForwarderAddedIterator); ok { + r0 = rf(opts, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*forwarder.KeystoneForwarderForwarderAddedIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address) error); ok { + r1 = rf(opts, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_FilterForwarderAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterForwarderAdded' +type KeystoneForwarderInterface_FilterForwarderAdded_Call struct { + *mock.Call +} + +// FilterForwarderAdded is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - _a1 []common.Address +func (_e *KeystoneForwarderInterface_Expecter) FilterForwarderAdded(opts interface{}, _a1 interface{}) *KeystoneForwarderInterface_FilterForwarderAdded_Call { + return &KeystoneForwarderInterface_FilterForwarderAdded_Call{Call: _e.mock.On("FilterForwarderAdded", opts, _a1)} +} + +func (_c *KeystoneForwarderInterface_FilterForwarderAdded_Call) Run(run func(opts *bind.FilterOpts, _a1 []common.Address)) *KeystoneForwarderInterface_FilterForwarderAdded_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]common.Address)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_FilterForwarderAdded_Call) Return(_a0 *forwarder.KeystoneForwarderForwarderAddedIterator, _a1 error) *KeystoneForwarderInterface_FilterForwarderAdded_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_FilterForwarderAdded_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address) (*forwarder.KeystoneForwarderForwarderAddedIterator, error)) *KeystoneForwarderInterface_FilterForwarderAdded_Call { + _c.Call.Return(run) + return _c +} + +// FilterForwarderRemoved provides a mock function with given fields: opts, _a1 +func (_m *KeystoneForwarderInterface) FilterForwarderRemoved(opts *bind.FilterOpts, _a1 []common.Address) (*forwarder.KeystoneForwarderForwarderRemovedIterator, error) { + ret := _m.Called(opts, _a1) + + if len(ret) == 0 { + panic("no return value specified for FilterForwarderRemoved") + } + + var r0 *forwarder.KeystoneForwarderForwarderRemovedIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address) (*forwarder.KeystoneForwarderForwarderRemovedIterator, error)); ok { + return rf(opts, _a1) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address) *forwarder.KeystoneForwarderForwarderRemovedIterator); ok { + r0 = rf(opts, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*forwarder.KeystoneForwarderForwarderRemovedIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address) error); ok { + r1 = rf(opts, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_FilterForwarderRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterForwarderRemoved' +type KeystoneForwarderInterface_FilterForwarderRemoved_Call struct { + *mock.Call +} + +// FilterForwarderRemoved is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - _a1 []common.Address +func (_e *KeystoneForwarderInterface_Expecter) FilterForwarderRemoved(opts interface{}, _a1 interface{}) *KeystoneForwarderInterface_FilterForwarderRemoved_Call { + return &KeystoneForwarderInterface_FilterForwarderRemoved_Call{Call: _e.mock.On("FilterForwarderRemoved", opts, _a1)} +} + +func (_c *KeystoneForwarderInterface_FilterForwarderRemoved_Call) Run(run func(opts *bind.FilterOpts, _a1 []common.Address)) *KeystoneForwarderInterface_FilterForwarderRemoved_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]common.Address)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_FilterForwarderRemoved_Call) Return(_a0 *forwarder.KeystoneForwarderForwarderRemovedIterator, _a1 error) *KeystoneForwarderInterface_FilterForwarderRemoved_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_FilterForwarderRemoved_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address) (*forwarder.KeystoneForwarderForwarderRemovedIterator, error)) *KeystoneForwarderInterface_FilterForwarderRemoved_Call { + _c.Call.Return(run) + return _c +} + +// FilterOwnershipTransferRequested provides a mock function with given fields: opts, from, to +func (_m *KeystoneForwarderInterface) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*forwarder.KeystoneForwarderOwnershipTransferRequestedIterator, error) { + ret := _m.Called(opts, from, to) + + if len(ret) == 0 { + panic("no return value specified for FilterOwnershipTransferRequested") + } + + var r0 *forwarder.KeystoneForwarderOwnershipTransferRequestedIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*forwarder.KeystoneForwarderOwnershipTransferRequestedIterator, error)); ok { + return rf(opts, from, to) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *forwarder.KeystoneForwarderOwnershipTransferRequestedIterator); ok { + r0 = rf(opts, from, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*forwarder.KeystoneForwarderOwnershipTransferRequestedIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { + r1 = rf(opts, from, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterOwnershipTransferRequested' +type KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call struct { + *mock.Call +} + +// FilterOwnershipTransferRequested is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - from []common.Address +// - to []common.Address +func (_e *KeystoneForwarderInterface_Expecter) FilterOwnershipTransferRequested(opts interface{}, from interface{}, to interface{}) *KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call { + return &KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call{Call: _e.mock.On("FilterOwnershipTransferRequested", opts, from, to)} +} + +func (_c *KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call) Run(run func(opts *bind.FilterOpts, from []common.Address, to []common.Address)) *KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]common.Address), args[2].([]common.Address)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call) Return(_a0 *forwarder.KeystoneForwarderOwnershipTransferRequestedIterator, _a1 error) *KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address, []common.Address) (*forwarder.KeystoneForwarderOwnershipTransferRequestedIterator, error)) *KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call { + _c.Call.Return(run) + return _c +} + +// FilterOwnershipTransferred provides a mock function with given fields: opts, from, to +func (_m *KeystoneForwarderInterface) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*forwarder.KeystoneForwarderOwnershipTransferredIterator, error) { + ret := _m.Called(opts, from, to) + + if len(ret) == 0 { + panic("no return value specified for FilterOwnershipTransferred") + } + + var r0 *forwarder.KeystoneForwarderOwnershipTransferredIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*forwarder.KeystoneForwarderOwnershipTransferredIterator, error)); ok { + return rf(opts, from, to) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *forwarder.KeystoneForwarderOwnershipTransferredIterator); ok { + r0 = rf(opts, from, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*forwarder.KeystoneForwarderOwnershipTransferredIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { + r1 = rf(opts, from, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_FilterOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterOwnershipTransferred' +type KeystoneForwarderInterface_FilterOwnershipTransferred_Call struct { + *mock.Call +} + +// FilterOwnershipTransferred is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - from []common.Address +// - to []common.Address +func (_e *KeystoneForwarderInterface_Expecter) FilterOwnershipTransferred(opts interface{}, from interface{}, to interface{}) *KeystoneForwarderInterface_FilterOwnershipTransferred_Call { + return &KeystoneForwarderInterface_FilterOwnershipTransferred_Call{Call: _e.mock.On("FilterOwnershipTransferred", opts, from, to)} +} + +func (_c *KeystoneForwarderInterface_FilterOwnershipTransferred_Call) Run(run func(opts *bind.FilterOpts, from []common.Address, to []common.Address)) *KeystoneForwarderInterface_FilterOwnershipTransferred_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]common.Address), args[2].([]common.Address)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_FilterOwnershipTransferred_Call) Return(_a0 *forwarder.KeystoneForwarderOwnershipTransferredIterator, _a1 error) *KeystoneForwarderInterface_FilterOwnershipTransferred_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_FilterOwnershipTransferred_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address, []common.Address) (*forwarder.KeystoneForwarderOwnershipTransferredIterator, error)) *KeystoneForwarderInterface_FilterOwnershipTransferred_Call { + _c.Call.Return(run) + return _c +} + +// FilterReportProcessed provides a mock function with given fields: opts, receiver, workflowExecutionId, reportId +func (_m *KeystoneForwarderInterface) FilterReportProcessed(opts *bind.FilterOpts, receiver []common.Address, workflowExecutionId [][32]byte, reportId [][2]byte) (*forwarder.KeystoneForwarderReportProcessedIterator, error) { + ret := _m.Called(opts, receiver, workflowExecutionId, reportId) + + if len(ret) == 0 { + panic("no return value specified for FilterReportProcessed") + } + + var r0 *forwarder.KeystoneForwarderReportProcessedIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, [][32]byte, [][2]byte) (*forwarder.KeystoneForwarderReportProcessedIterator, error)); ok { + return rf(opts, receiver, workflowExecutionId, reportId) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, [][32]byte, [][2]byte) *forwarder.KeystoneForwarderReportProcessedIterator); ok { + r0 = rf(opts, receiver, workflowExecutionId, reportId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*forwarder.KeystoneForwarderReportProcessedIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, [][32]byte, [][2]byte) error); ok { + r1 = rf(opts, receiver, workflowExecutionId, reportId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_FilterReportProcessed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterReportProcessed' +type KeystoneForwarderInterface_FilterReportProcessed_Call struct { + *mock.Call +} + +// FilterReportProcessed is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - receiver []common.Address +// - workflowExecutionId [][32]byte +// - reportId [][2]byte +func (_e *KeystoneForwarderInterface_Expecter) FilterReportProcessed(opts interface{}, receiver interface{}, workflowExecutionId interface{}, reportId interface{}) *KeystoneForwarderInterface_FilterReportProcessed_Call { + return &KeystoneForwarderInterface_FilterReportProcessed_Call{Call: _e.mock.On("FilterReportProcessed", opts, receiver, workflowExecutionId, reportId)} +} + +func (_c *KeystoneForwarderInterface_FilterReportProcessed_Call) Run(run func(opts *bind.FilterOpts, receiver []common.Address, workflowExecutionId [][32]byte, reportId [][2]byte)) *KeystoneForwarderInterface_FilterReportProcessed_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]common.Address), args[2].([][32]byte), args[3].([][2]byte)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_FilterReportProcessed_Call) Return(_a0 *forwarder.KeystoneForwarderReportProcessedIterator, _a1 error) *KeystoneForwarderInterface_FilterReportProcessed_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_FilterReportProcessed_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address, [][32]byte, [][2]byte) (*forwarder.KeystoneForwarderReportProcessedIterator, error)) *KeystoneForwarderInterface_FilterReportProcessed_Call { + _c.Call.Return(run) + return _c +} + +// GetTransmissionId provides a mock function with given fields: opts, receiver, workflowExecutionId, reportId +func (_m *KeystoneForwarderInterface) GetTransmissionId(opts *bind.CallOpts, receiver common.Address, workflowExecutionId [32]byte, reportId [2]byte) ([32]byte, error) { + ret := _m.Called(opts, receiver, workflowExecutionId, reportId) + + if len(ret) == 0 { + panic("no return value specified for GetTransmissionId") + } + + var r0 [32]byte + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) ([32]byte, error)); ok { + return rf(opts, receiver, workflowExecutionId, reportId) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) [32]byte); ok { + r0 = rf(opts, receiver, workflowExecutionId, reportId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([32]byte) + } + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) error); ok { + r1 = rf(opts, receiver, workflowExecutionId, reportId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_GetTransmissionId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTransmissionId' +type KeystoneForwarderInterface_GetTransmissionId_Call struct { + *mock.Call +} + +// GetTransmissionId is a helper method to define mock.On call +// - opts *bind.CallOpts +// - receiver common.Address +// - workflowExecutionId [32]byte +// - reportId [2]byte +func (_e *KeystoneForwarderInterface_Expecter) GetTransmissionId(opts interface{}, receiver interface{}, workflowExecutionId interface{}, reportId interface{}) *KeystoneForwarderInterface_GetTransmissionId_Call { + return &KeystoneForwarderInterface_GetTransmissionId_Call{Call: _e.mock.On("GetTransmissionId", opts, receiver, workflowExecutionId, reportId)} +} + +func (_c *KeystoneForwarderInterface_GetTransmissionId_Call) Run(run func(opts *bind.CallOpts, receiver common.Address, workflowExecutionId [32]byte, reportId [2]byte)) *KeystoneForwarderInterface_GetTransmissionId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts), args[1].(common.Address), args[2].([32]byte), args[3].([2]byte)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_GetTransmissionId_Call) Return(_a0 [32]byte, _a1 error) *KeystoneForwarderInterface_GetTransmissionId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_GetTransmissionId_Call) RunAndReturn(run func(*bind.CallOpts, common.Address, [32]byte, [2]byte) ([32]byte, error)) *KeystoneForwarderInterface_GetTransmissionId_Call { + _c.Call.Return(run) + return _c +} + +// GetTransmissionInfo provides a mock function with given fields: opts, receiver, workflowExecutionId, reportId +func (_m *KeystoneForwarderInterface) GetTransmissionInfo(opts *bind.CallOpts, receiver common.Address, workflowExecutionId [32]byte, reportId [2]byte) (forwarder.IRouterTransmissionInfo, error) { + ret := _m.Called(opts, receiver, workflowExecutionId, reportId) + + if len(ret) == 0 { + panic("no return value specified for GetTransmissionInfo") + } + + var r0 forwarder.IRouterTransmissionInfo + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) (forwarder.IRouterTransmissionInfo, error)); ok { + return rf(opts, receiver, workflowExecutionId, reportId) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) forwarder.IRouterTransmissionInfo); ok { + r0 = rf(opts, receiver, workflowExecutionId, reportId) + } else { + r0 = ret.Get(0).(forwarder.IRouterTransmissionInfo) + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) error); ok { + r1 = rf(opts, receiver, workflowExecutionId, reportId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_GetTransmissionInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTransmissionInfo' +type KeystoneForwarderInterface_GetTransmissionInfo_Call struct { + *mock.Call +} + +// GetTransmissionInfo is a helper method to define mock.On call +// - opts *bind.CallOpts +// - receiver common.Address +// - workflowExecutionId [32]byte +// - reportId [2]byte +func (_e *KeystoneForwarderInterface_Expecter) GetTransmissionInfo(opts interface{}, receiver interface{}, workflowExecutionId interface{}, reportId interface{}) *KeystoneForwarderInterface_GetTransmissionInfo_Call { + return &KeystoneForwarderInterface_GetTransmissionInfo_Call{Call: _e.mock.On("GetTransmissionInfo", opts, receiver, workflowExecutionId, reportId)} +} + +func (_c *KeystoneForwarderInterface_GetTransmissionInfo_Call) Run(run func(opts *bind.CallOpts, receiver common.Address, workflowExecutionId [32]byte, reportId [2]byte)) *KeystoneForwarderInterface_GetTransmissionInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts), args[1].(common.Address), args[2].([32]byte), args[3].([2]byte)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_GetTransmissionInfo_Call) Return(_a0 forwarder.IRouterTransmissionInfo, _a1 error) *KeystoneForwarderInterface_GetTransmissionInfo_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_GetTransmissionInfo_Call) RunAndReturn(run func(*bind.CallOpts, common.Address, [32]byte, [2]byte) (forwarder.IRouterTransmissionInfo, error)) *KeystoneForwarderInterface_GetTransmissionInfo_Call { + _c.Call.Return(run) + return _c +} + +// GetTransmitter provides a mock function with given fields: opts, receiver, workflowExecutionId, reportId +func (_m *KeystoneForwarderInterface) GetTransmitter(opts *bind.CallOpts, receiver common.Address, workflowExecutionId [32]byte, reportId [2]byte) (common.Address, error) { + ret := _m.Called(opts, receiver, workflowExecutionId, reportId) + + if len(ret) == 0 { + panic("no return value specified for GetTransmitter") + } + + var r0 common.Address + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) (common.Address, error)); ok { + return rf(opts, receiver, workflowExecutionId, reportId) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) common.Address); ok { + r0 = rf(opts, receiver, workflowExecutionId, reportId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(common.Address) + } + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) error); ok { + r1 = rf(opts, receiver, workflowExecutionId, reportId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_GetTransmitter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTransmitter' +type KeystoneForwarderInterface_GetTransmitter_Call struct { + *mock.Call +} + +// GetTransmitter is a helper method to define mock.On call +// - opts *bind.CallOpts +// - receiver common.Address +// - workflowExecutionId [32]byte +// - reportId [2]byte +func (_e *KeystoneForwarderInterface_Expecter) GetTransmitter(opts interface{}, receiver interface{}, workflowExecutionId interface{}, reportId interface{}) *KeystoneForwarderInterface_GetTransmitter_Call { + return &KeystoneForwarderInterface_GetTransmitter_Call{Call: _e.mock.On("GetTransmitter", opts, receiver, workflowExecutionId, reportId)} +} + +func (_c *KeystoneForwarderInterface_GetTransmitter_Call) Run(run func(opts *bind.CallOpts, receiver common.Address, workflowExecutionId [32]byte, reportId [2]byte)) *KeystoneForwarderInterface_GetTransmitter_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts), args[1].(common.Address), args[2].([32]byte), args[3].([2]byte)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_GetTransmitter_Call) Return(_a0 common.Address, _a1 error) *KeystoneForwarderInterface_GetTransmitter_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_GetTransmitter_Call) RunAndReturn(run func(*bind.CallOpts, common.Address, [32]byte, [2]byte) (common.Address, error)) *KeystoneForwarderInterface_GetTransmitter_Call { + _c.Call.Return(run) + return _c +} + +// IsForwarder provides a mock function with given fields: opts, _a1 +func (_m *KeystoneForwarderInterface) IsForwarder(opts *bind.CallOpts, _a1 common.Address) (bool, error) { + ret := _m.Called(opts, _a1) + + if len(ret) == 0 { + panic("no return value specified for IsForwarder") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address) (bool, error)); ok { + return rf(opts, _a1) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address) bool); ok { + r0 = rf(opts, _a1) + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts, common.Address) error); ok { + r1 = rf(opts, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_IsForwarder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsForwarder' +type KeystoneForwarderInterface_IsForwarder_Call struct { + *mock.Call +} + +// IsForwarder is a helper method to define mock.On call +// - opts *bind.CallOpts +// - _a1 common.Address +func (_e *KeystoneForwarderInterface_Expecter) IsForwarder(opts interface{}, _a1 interface{}) *KeystoneForwarderInterface_IsForwarder_Call { + return &KeystoneForwarderInterface_IsForwarder_Call{Call: _e.mock.On("IsForwarder", opts, _a1)} +} + +func (_c *KeystoneForwarderInterface_IsForwarder_Call) Run(run func(opts *bind.CallOpts, _a1 common.Address)) *KeystoneForwarderInterface_IsForwarder_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts), args[1].(common.Address)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_IsForwarder_Call) Return(_a0 bool, _a1 error) *KeystoneForwarderInterface_IsForwarder_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_IsForwarder_Call) RunAndReturn(run func(*bind.CallOpts, common.Address) (bool, error)) *KeystoneForwarderInterface_IsForwarder_Call { + _c.Call.Return(run) + return _c +} + +// Owner provides a mock function with given fields: opts +func (_m *KeystoneForwarderInterface) Owner(opts *bind.CallOpts) (common.Address, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for Owner") + } + + var r0 common.Address + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts) (common.Address, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts) common.Address); ok { + r0 = rf(opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(common.Address) + } + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_Owner_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Owner' +type KeystoneForwarderInterface_Owner_Call struct { + *mock.Call +} + +// Owner is a helper method to define mock.On call +// - opts *bind.CallOpts +func (_e *KeystoneForwarderInterface_Expecter) Owner(opts interface{}) *KeystoneForwarderInterface_Owner_Call { + return &KeystoneForwarderInterface_Owner_Call{Call: _e.mock.On("Owner", opts)} +} + +func (_c *KeystoneForwarderInterface_Owner_Call) Run(run func(opts *bind.CallOpts)) *KeystoneForwarderInterface_Owner_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_Owner_Call) Return(_a0 common.Address, _a1 error) *KeystoneForwarderInterface_Owner_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_Owner_Call) RunAndReturn(run func(*bind.CallOpts) (common.Address, error)) *KeystoneForwarderInterface_Owner_Call { + _c.Call.Return(run) + return _c +} + +// ParseConfigSet provides a mock function with given fields: log +func (_m *KeystoneForwarderInterface) ParseConfigSet(log types.Log) (*forwarder.KeystoneForwarderConfigSet, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseConfigSet") + } + + var r0 *forwarder.KeystoneForwarderConfigSet + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*forwarder.KeystoneForwarderConfigSet, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *forwarder.KeystoneForwarderConfigSet); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*forwarder.KeystoneForwarderConfigSet) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_ParseConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseConfigSet' +type KeystoneForwarderInterface_ParseConfigSet_Call struct { + *mock.Call +} + +// ParseConfigSet is a helper method to define mock.On call +// - log types.Log +func (_e *KeystoneForwarderInterface_Expecter) ParseConfigSet(log interface{}) *KeystoneForwarderInterface_ParseConfigSet_Call { + return &KeystoneForwarderInterface_ParseConfigSet_Call{Call: _e.mock.On("ParseConfigSet", log)} +} + +func (_c *KeystoneForwarderInterface_ParseConfigSet_Call) Run(run func(log types.Log)) *KeystoneForwarderInterface_ParseConfigSet_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_ParseConfigSet_Call) Return(_a0 *forwarder.KeystoneForwarderConfigSet, _a1 error) *KeystoneForwarderInterface_ParseConfigSet_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_ParseConfigSet_Call) RunAndReturn(run func(types.Log) (*forwarder.KeystoneForwarderConfigSet, error)) *KeystoneForwarderInterface_ParseConfigSet_Call { + _c.Call.Return(run) + return _c +} + +// ParseForwarderAdded provides a mock function with given fields: log +func (_m *KeystoneForwarderInterface) ParseForwarderAdded(log types.Log) (*forwarder.KeystoneForwarderForwarderAdded, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseForwarderAdded") + } + + var r0 *forwarder.KeystoneForwarderForwarderAdded + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*forwarder.KeystoneForwarderForwarderAdded, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *forwarder.KeystoneForwarderForwarderAdded); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*forwarder.KeystoneForwarderForwarderAdded) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_ParseForwarderAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseForwarderAdded' +type KeystoneForwarderInterface_ParseForwarderAdded_Call struct { + *mock.Call +} + +// ParseForwarderAdded is a helper method to define mock.On call +// - log types.Log +func (_e *KeystoneForwarderInterface_Expecter) ParseForwarderAdded(log interface{}) *KeystoneForwarderInterface_ParseForwarderAdded_Call { + return &KeystoneForwarderInterface_ParseForwarderAdded_Call{Call: _e.mock.On("ParseForwarderAdded", log)} +} + +func (_c *KeystoneForwarderInterface_ParseForwarderAdded_Call) Run(run func(log types.Log)) *KeystoneForwarderInterface_ParseForwarderAdded_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_ParseForwarderAdded_Call) Return(_a0 *forwarder.KeystoneForwarderForwarderAdded, _a1 error) *KeystoneForwarderInterface_ParseForwarderAdded_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_ParseForwarderAdded_Call) RunAndReturn(run func(types.Log) (*forwarder.KeystoneForwarderForwarderAdded, error)) *KeystoneForwarderInterface_ParseForwarderAdded_Call { + _c.Call.Return(run) + return _c +} + +// ParseForwarderRemoved provides a mock function with given fields: log +func (_m *KeystoneForwarderInterface) ParseForwarderRemoved(log types.Log) (*forwarder.KeystoneForwarderForwarderRemoved, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseForwarderRemoved") + } + + var r0 *forwarder.KeystoneForwarderForwarderRemoved + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*forwarder.KeystoneForwarderForwarderRemoved, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *forwarder.KeystoneForwarderForwarderRemoved); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*forwarder.KeystoneForwarderForwarderRemoved) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_ParseForwarderRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseForwarderRemoved' +type KeystoneForwarderInterface_ParseForwarderRemoved_Call struct { + *mock.Call +} + +// ParseForwarderRemoved is a helper method to define mock.On call +// - log types.Log +func (_e *KeystoneForwarderInterface_Expecter) ParseForwarderRemoved(log interface{}) *KeystoneForwarderInterface_ParseForwarderRemoved_Call { + return &KeystoneForwarderInterface_ParseForwarderRemoved_Call{Call: _e.mock.On("ParseForwarderRemoved", log)} +} + +func (_c *KeystoneForwarderInterface_ParseForwarderRemoved_Call) Run(run func(log types.Log)) *KeystoneForwarderInterface_ParseForwarderRemoved_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_ParseForwarderRemoved_Call) Return(_a0 *forwarder.KeystoneForwarderForwarderRemoved, _a1 error) *KeystoneForwarderInterface_ParseForwarderRemoved_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_ParseForwarderRemoved_Call) RunAndReturn(run func(types.Log) (*forwarder.KeystoneForwarderForwarderRemoved, error)) *KeystoneForwarderInterface_ParseForwarderRemoved_Call { + _c.Call.Return(run) + return _c +} + +// ParseLog provides a mock function with given fields: log +func (_m *KeystoneForwarderInterface) ParseLog(log types.Log) (generated.AbigenLog, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseLog") + } + + var r0 generated.AbigenLog + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (generated.AbigenLog, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) generated.AbigenLog); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(generated.AbigenLog) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_ParseLog_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseLog' +type KeystoneForwarderInterface_ParseLog_Call struct { + *mock.Call +} + +// ParseLog is a helper method to define mock.On call +// - log types.Log +func (_e *KeystoneForwarderInterface_Expecter) ParseLog(log interface{}) *KeystoneForwarderInterface_ParseLog_Call { + return &KeystoneForwarderInterface_ParseLog_Call{Call: _e.mock.On("ParseLog", log)} +} + +func (_c *KeystoneForwarderInterface_ParseLog_Call) Run(run func(log types.Log)) *KeystoneForwarderInterface_ParseLog_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_ParseLog_Call) Return(_a0 generated.AbigenLog, _a1 error) *KeystoneForwarderInterface_ParseLog_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_ParseLog_Call) RunAndReturn(run func(types.Log) (generated.AbigenLog, error)) *KeystoneForwarderInterface_ParseLog_Call { + _c.Call.Return(run) + return _c +} + +// ParseOwnershipTransferRequested provides a mock function with given fields: log +func (_m *KeystoneForwarderInterface) ParseOwnershipTransferRequested(log types.Log) (*forwarder.KeystoneForwarderOwnershipTransferRequested, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseOwnershipTransferRequested") + } + + var r0 *forwarder.KeystoneForwarderOwnershipTransferRequested + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*forwarder.KeystoneForwarderOwnershipTransferRequested, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *forwarder.KeystoneForwarderOwnershipTransferRequested); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*forwarder.KeystoneForwarderOwnershipTransferRequested) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseOwnershipTransferRequested' +type KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call struct { + *mock.Call +} + +// ParseOwnershipTransferRequested is a helper method to define mock.On call +// - log types.Log +func (_e *KeystoneForwarderInterface_Expecter) ParseOwnershipTransferRequested(log interface{}) *KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call { + return &KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call{Call: _e.mock.On("ParseOwnershipTransferRequested", log)} +} + +func (_c *KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call) Run(run func(log types.Log)) *KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call) Return(_a0 *forwarder.KeystoneForwarderOwnershipTransferRequested, _a1 error) *KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call) RunAndReturn(run func(types.Log) (*forwarder.KeystoneForwarderOwnershipTransferRequested, error)) *KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call { + _c.Call.Return(run) + return _c +} + +// ParseOwnershipTransferred provides a mock function with given fields: log +func (_m *KeystoneForwarderInterface) ParseOwnershipTransferred(log types.Log) (*forwarder.KeystoneForwarderOwnershipTransferred, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseOwnershipTransferred") + } + + var r0 *forwarder.KeystoneForwarderOwnershipTransferred + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*forwarder.KeystoneForwarderOwnershipTransferred, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *forwarder.KeystoneForwarderOwnershipTransferred); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*forwarder.KeystoneForwarderOwnershipTransferred) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_ParseOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseOwnershipTransferred' +type KeystoneForwarderInterface_ParseOwnershipTransferred_Call struct { + *mock.Call +} + +// ParseOwnershipTransferred is a helper method to define mock.On call +// - log types.Log +func (_e *KeystoneForwarderInterface_Expecter) ParseOwnershipTransferred(log interface{}) *KeystoneForwarderInterface_ParseOwnershipTransferred_Call { + return &KeystoneForwarderInterface_ParseOwnershipTransferred_Call{Call: _e.mock.On("ParseOwnershipTransferred", log)} +} + +func (_c *KeystoneForwarderInterface_ParseOwnershipTransferred_Call) Run(run func(log types.Log)) *KeystoneForwarderInterface_ParseOwnershipTransferred_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_ParseOwnershipTransferred_Call) Return(_a0 *forwarder.KeystoneForwarderOwnershipTransferred, _a1 error) *KeystoneForwarderInterface_ParseOwnershipTransferred_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_ParseOwnershipTransferred_Call) RunAndReturn(run func(types.Log) (*forwarder.KeystoneForwarderOwnershipTransferred, error)) *KeystoneForwarderInterface_ParseOwnershipTransferred_Call { + _c.Call.Return(run) + return _c +} + +// ParseReportProcessed provides a mock function with given fields: log +func (_m *KeystoneForwarderInterface) ParseReportProcessed(log types.Log) (*forwarder.KeystoneForwarderReportProcessed, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseReportProcessed") + } + + var r0 *forwarder.KeystoneForwarderReportProcessed + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*forwarder.KeystoneForwarderReportProcessed, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *forwarder.KeystoneForwarderReportProcessed); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*forwarder.KeystoneForwarderReportProcessed) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_ParseReportProcessed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseReportProcessed' +type KeystoneForwarderInterface_ParseReportProcessed_Call struct { + *mock.Call +} + +// ParseReportProcessed is a helper method to define mock.On call +// - log types.Log +func (_e *KeystoneForwarderInterface_Expecter) ParseReportProcessed(log interface{}) *KeystoneForwarderInterface_ParseReportProcessed_Call { + return &KeystoneForwarderInterface_ParseReportProcessed_Call{Call: _e.mock.On("ParseReportProcessed", log)} +} + +func (_c *KeystoneForwarderInterface_ParseReportProcessed_Call) Run(run func(log types.Log)) *KeystoneForwarderInterface_ParseReportProcessed_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_ParseReportProcessed_Call) Return(_a0 *forwarder.KeystoneForwarderReportProcessed, _a1 error) *KeystoneForwarderInterface_ParseReportProcessed_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_ParseReportProcessed_Call) RunAndReturn(run func(types.Log) (*forwarder.KeystoneForwarderReportProcessed, error)) *KeystoneForwarderInterface_ParseReportProcessed_Call { + _c.Call.Return(run) + return _c +} + +// RemoveForwarder provides a mock function with given fields: opts, _a1 +func (_m *KeystoneForwarderInterface) RemoveForwarder(opts *bind.TransactOpts, _a1 common.Address) (*types.Transaction, error) { + ret := _m.Called(opts, _a1) + + if len(ret) == 0 { + panic("no return value specified for RemoveForwarder") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { + return rf(opts, _a1) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { + r0 = rf(opts, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { + r1 = rf(opts, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_RemoveForwarder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveForwarder' +type KeystoneForwarderInterface_RemoveForwarder_Call struct { + *mock.Call +} + +// RemoveForwarder is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - _a1 common.Address +func (_e *KeystoneForwarderInterface_Expecter) RemoveForwarder(opts interface{}, _a1 interface{}) *KeystoneForwarderInterface_RemoveForwarder_Call { + return &KeystoneForwarderInterface_RemoveForwarder_Call{Call: _e.mock.On("RemoveForwarder", opts, _a1)} +} + +func (_c *KeystoneForwarderInterface_RemoveForwarder_Call) Run(run func(opts *bind.TransactOpts, _a1 common.Address)) *KeystoneForwarderInterface_RemoveForwarder_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].(common.Address)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_RemoveForwarder_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_RemoveForwarder_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_RemoveForwarder_Call) RunAndReturn(run func(*bind.TransactOpts, common.Address) (*types.Transaction, error)) *KeystoneForwarderInterface_RemoveForwarder_Call { + _c.Call.Return(run) + return _c +} + +// Report provides a mock function with given fields: opts, receiver, rawReport, reportContext, signatures +func (_m *KeystoneForwarderInterface) Report(opts *bind.TransactOpts, receiver common.Address, rawReport []byte, reportContext []byte, signatures [][]byte) (*types.Transaction, error) { + ret := _m.Called(opts, receiver, rawReport, reportContext, signatures) + + if len(ret) == 0 { + panic("no return value specified for Report") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address, []byte, []byte, [][]byte) (*types.Transaction, error)); ok { + return rf(opts, receiver, rawReport, reportContext, signatures) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address, []byte, []byte, [][]byte) *types.Transaction); ok { + r0 = rf(opts, receiver, rawReport, reportContext, signatures) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address, []byte, []byte, [][]byte) error); ok { + r1 = rf(opts, receiver, rawReport, reportContext, signatures) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_Report_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Report' +type KeystoneForwarderInterface_Report_Call struct { + *mock.Call +} + +// Report is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - receiver common.Address +// - rawReport []byte +// - reportContext []byte +// - signatures [][]byte +func (_e *KeystoneForwarderInterface_Expecter) Report(opts interface{}, receiver interface{}, rawReport interface{}, reportContext interface{}, signatures interface{}) *KeystoneForwarderInterface_Report_Call { + return &KeystoneForwarderInterface_Report_Call{Call: _e.mock.On("Report", opts, receiver, rawReport, reportContext, signatures)} +} + +func (_c *KeystoneForwarderInterface_Report_Call) Run(run func(opts *bind.TransactOpts, receiver common.Address, rawReport []byte, reportContext []byte, signatures [][]byte)) *KeystoneForwarderInterface_Report_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].(common.Address), args[2].([]byte), args[3].([]byte), args[4].([][]byte)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_Report_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_Report_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_Report_Call) RunAndReturn(run func(*bind.TransactOpts, common.Address, []byte, []byte, [][]byte) (*types.Transaction, error)) *KeystoneForwarderInterface_Report_Call { + _c.Call.Return(run) + return _c +} + +// Route provides a mock function with given fields: opts, transmissionId, transmitter, receiver, metadata, validatedReport +func (_m *KeystoneForwarderInterface) Route(opts *bind.TransactOpts, transmissionId [32]byte, transmitter common.Address, receiver common.Address, metadata []byte, validatedReport []byte) (*types.Transaction, error) { + ret := _m.Called(opts, transmissionId, transmitter, receiver, metadata, validatedReport) + + if len(ret) == 0 { + panic("no return value specified for Route") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [32]byte, common.Address, common.Address, []byte, []byte) (*types.Transaction, error)); ok { + return rf(opts, transmissionId, transmitter, receiver, metadata, validatedReport) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [32]byte, common.Address, common.Address, []byte, []byte) *types.Transaction); ok { + r0 = rf(opts, transmissionId, transmitter, receiver, metadata, validatedReport) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, [32]byte, common.Address, common.Address, []byte, []byte) error); ok { + r1 = rf(opts, transmissionId, transmitter, receiver, metadata, validatedReport) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_Route_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Route' +type KeystoneForwarderInterface_Route_Call struct { + *mock.Call +} + +// Route is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - transmissionId [32]byte +// - transmitter common.Address +// - receiver common.Address +// - metadata []byte +// - validatedReport []byte +func (_e *KeystoneForwarderInterface_Expecter) Route(opts interface{}, transmissionId interface{}, transmitter interface{}, receiver interface{}, metadata interface{}, validatedReport interface{}) *KeystoneForwarderInterface_Route_Call { + return &KeystoneForwarderInterface_Route_Call{Call: _e.mock.On("Route", opts, transmissionId, transmitter, receiver, metadata, validatedReport)} +} + +func (_c *KeystoneForwarderInterface_Route_Call) Run(run func(opts *bind.TransactOpts, transmissionId [32]byte, transmitter common.Address, receiver common.Address, metadata []byte, validatedReport []byte)) *KeystoneForwarderInterface_Route_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].([32]byte), args[2].(common.Address), args[3].(common.Address), args[4].([]byte), args[5].([]byte)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_Route_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_Route_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_Route_Call) RunAndReturn(run func(*bind.TransactOpts, [32]byte, common.Address, common.Address, []byte, []byte) (*types.Transaction, error)) *KeystoneForwarderInterface_Route_Call { + _c.Call.Return(run) + return _c +} + +// SetConfig provides a mock function with given fields: opts, donId, configVersion, f, signers +func (_m *KeystoneForwarderInterface) SetConfig(opts *bind.TransactOpts, donId uint32, configVersion uint32, f uint8, signers []common.Address) (*types.Transaction, error) { + ret := _m.Called(opts, donId, configVersion, f, signers) + + if len(ret) == 0 { + panic("no return value specified for SetConfig") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, uint32, uint32, uint8, []common.Address) (*types.Transaction, error)); ok { + return rf(opts, donId, configVersion, f, signers) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, uint32, uint32, uint8, []common.Address) *types.Transaction); ok { + r0 = rf(opts, donId, configVersion, f, signers) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, uint32, uint32, uint8, []common.Address) error); ok { + r1 = rf(opts, donId, configVersion, f, signers) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_SetConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetConfig' +type KeystoneForwarderInterface_SetConfig_Call struct { + *mock.Call +} + +// SetConfig is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - donId uint32 +// - configVersion uint32 +// - f uint8 +// - signers []common.Address +func (_e *KeystoneForwarderInterface_Expecter) SetConfig(opts interface{}, donId interface{}, configVersion interface{}, f interface{}, signers interface{}) *KeystoneForwarderInterface_SetConfig_Call { + return &KeystoneForwarderInterface_SetConfig_Call{Call: _e.mock.On("SetConfig", opts, donId, configVersion, f, signers)} +} + +func (_c *KeystoneForwarderInterface_SetConfig_Call) Run(run func(opts *bind.TransactOpts, donId uint32, configVersion uint32, f uint8, signers []common.Address)) *KeystoneForwarderInterface_SetConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].(uint32), args[2].(uint32), args[3].(uint8), args[4].([]common.Address)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_SetConfig_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_SetConfig_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_SetConfig_Call) RunAndReturn(run func(*bind.TransactOpts, uint32, uint32, uint8, []common.Address) (*types.Transaction, error)) *KeystoneForwarderInterface_SetConfig_Call { + _c.Call.Return(run) + return _c +} + +// TransferOwnership provides a mock function with given fields: opts, to +func (_m *KeystoneForwarderInterface) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { + ret := _m.Called(opts, to) + + if len(ret) == 0 { + panic("no return value specified for TransferOwnership") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { + return rf(opts, to) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { + r0 = rf(opts, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { + r1 = rf(opts, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_TransferOwnership_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransferOwnership' +type KeystoneForwarderInterface_TransferOwnership_Call struct { + *mock.Call +} + +// TransferOwnership is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - to common.Address +func (_e *KeystoneForwarderInterface_Expecter) TransferOwnership(opts interface{}, to interface{}) *KeystoneForwarderInterface_TransferOwnership_Call { + return &KeystoneForwarderInterface_TransferOwnership_Call{Call: _e.mock.On("TransferOwnership", opts, to)} +} + +func (_c *KeystoneForwarderInterface_TransferOwnership_Call) Run(run func(opts *bind.TransactOpts, to common.Address)) *KeystoneForwarderInterface_TransferOwnership_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].(common.Address)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_TransferOwnership_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_TransferOwnership_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_TransferOwnership_Call) RunAndReturn(run func(*bind.TransactOpts, common.Address) (*types.Transaction, error)) *KeystoneForwarderInterface_TransferOwnership_Call { + _c.Call.Return(run) + return _c +} + +// TypeAndVersion provides a mock function with given fields: opts +func (_m *KeystoneForwarderInterface) TypeAndVersion(opts *bind.CallOpts) (string, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for TypeAndVersion") + } + + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts) (string, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts) string); ok { + r0 = rf(opts) + } else { + r0 = ret.Get(0).(string) + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_TypeAndVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeAndVersion' +type KeystoneForwarderInterface_TypeAndVersion_Call struct { + *mock.Call +} + +// TypeAndVersion is a helper method to define mock.On call +// - opts *bind.CallOpts +func (_e *KeystoneForwarderInterface_Expecter) TypeAndVersion(opts interface{}) *KeystoneForwarderInterface_TypeAndVersion_Call { + return &KeystoneForwarderInterface_TypeAndVersion_Call{Call: _e.mock.On("TypeAndVersion", opts)} +} + +func (_c *KeystoneForwarderInterface_TypeAndVersion_Call) Run(run func(opts *bind.CallOpts)) *KeystoneForwarderInterface_TypeAndVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_TypeAndVersion_Call) Return(_a0 string, _a1 error) *KeystoneForwarderInterface_TypeAndVersion_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_TypeAndVersion_Call) RunAndReturn(run func(*bind.CallOpts) (string, error)) *KeystoneForwarderInterface_TypeAndVersion_Call { + _c.Call.Return(run) + return _c +} + +// WatchConfigSet provides a mock function with given fields: opts, sink, donId, configVersion +func (_m *KeystoneForwarderInterface) WatchConfigSet(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderConfigSet, donId []uint32, configVersion []uint32) (event.Subscription, error) { + ret := _m.Called(opts, sink, donId, configVersion) + + if len(ret) == 0 { + panic("no return value specified for WatchConfigSet") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderConfigSet, []uint32, []uint32) (event.Subscription, error)); ok { + return rf(opts, sink, donId, configVersion) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderConfigSet, []uint32, []uint32) event.Subscription); ok { + r0 = rf(opts, sink, donId, configVersion) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderConfigSet, []uint32, []uint32) error); ok { + r1 = rf(opts, sink, donId, configVersion) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_WatchConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchConfigSet' +type KeystoneForwarderInterface_WatchConfigSet_Call struct { + *mock.Call +} + +// WatchConfigSet is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *forwarder.KeystoneForwarderConfigSet +// - donId []uint32 +// - configVersion []uint32 +func (_e *KeystoneForwarderInterface_Expecter) WatchConfigSet(opts interface{}, sink interface{}, donId interface{}, configVersion interface{}) *KeystoneForwarderInterface_WatchConfigSet_Call { + return &KeystoneForwarderInterface_WatchConfigSet_Call{Call: _e.mock.On("WatchConfigSet", opts, sink, donId, configVersion)} +} + +func (_c *KeystoneForwarderInterface_WatchConfigSet_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderConfigSet, donId []uint32, configVersion []uint32)) *KeystoneForwarderInterface_WatchConfigSet_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *forwarder.KeystoneForwarderConfigSet), args[2].([]uint32), args[3].([]uint32)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_WatchConfigSet_Call) Return(_a0 event.Subscription, _a1 error) *KeystoneForwarderInterface_WatchConfigSet_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_WatchConfigSet_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderConfigSet, []uint32, []uint32) (event.Subscription, error)) *KeystoneForwarderInterface_WatchConfigSet_Call { + _c.Call.Return(run) + return _c +} + +// WatchForwarderAdded provides a mock function with given fields: opts, sink, _a2 +func (_m *KeystoneForwarderInterface) WatchForwarderAdded(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderForwarderAdded, _a2 []common.Address) (event.Subscription, error) { + ret := _m.Called(opts, sink, _a2) + + if len(ret) == 0 { + panic("no return value specified for WatchForwarderAdded") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderAdded, []common.Address) (event.Subscription, error)); ok { + return rf(opts, sink, _a2) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderAdded, []common.Address) event.Subscription); ok { + r0 = rf(opts, sink, _a2) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderAdded, []common.Address) error); ok { + r1 = rf(opts, sink, _a2) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_WatchForwarderAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchForwarderAdded' +type KeystoneForwarderInterface_WatchForwarderAdded_Call struct { + *mock.Call +} + +// WatchForwarderAdded is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *forwarder.KeystoneForwarderForwarderAdded +// - _a2 []common.Address +func (_e *KeystoneForwarderInterface_Expecter) WatchForwarderAdded(opts interface{}, sink interface{}, _a2 interface{}) *KeystoneForwarderInterface_WatchForwarderAdded_Call { + return &KeystoneForwarderInterface_WatchForwarderAdded_Call{Call: _e.mock.On("WatchForwarderAdded", opts, sink, _a2)} +} + +func (_c *KeystoneForwarderInterface_WatchForwarderAdded_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderForwarderAdded, _a2 []common.Address)) *KeystoneForwarderInterface_WatchForwarderAdded_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *forwarder.KeystoneForwarderForwarderAdded), args[2].([]common.Address)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_WatchForwarderAdded_Call) Return(_a0 event.Subscription, _a1 error) *KeystoneForwarderInterface_WatchForwarderAdded_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_WatchForwarderAdded_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderAdded, []common.Address) (event.Subscription, error)) *KeystoneForwarderInterface_WatchForwarderAdded_Call { + _c.Call.Return(run) + return _c +} + +// WatchForwarderRemoved provides a mock function with given fields: opts, sink, _a2 +func (_m *KeystoneForwarderInterface) WatchForwarderRemoved(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderForwarderRemoved, _a2 []common.Address) (event.Subscription, error) { + ret := _m.Called(opts, sink, _a2) + + if len(ret) == 0 { + panic("no return value specified for WatchForwarderRemoved") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderRemoved, []common.Address) (event.Subscription, error)); ok { + return rf(opts, sink, _a2) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderRemoved, []common.Address) event.Subscription); ok { + r0 = rf(opts, sink, _a2) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderRemoved, []common.Address) error); ok { + r1 = rf(opts, sink, _a2) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_WatchForwarderRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchForwarderRemoved' +type KeystoneForwarderInterface_WatchForwarderRemoved_Call struct { + *mock.Call +} + +// WatchForwarderRemoved is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *forwarder.KeystoneForwarderForwarderRemoved +// - _a2 []common.Address +func (_e *KeystoneForwarderInterface_Expecter) WatchForwarderRemoved(opts interface{}, sink interface{}, _a2 interface{}) *KeystoneForwarderInterface_WatchForwarderRemoved_Call { + return &KeystoneForwarderInterface_WatchForwarderRemoved_Call{Call: _e.mock.On("WatchForwarderRemoved", opts, sink, _a2)} +} + +func (_c *KeystoneForwarderInterface_WatchForwarderRemoved_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderForwarderRemoved, _a2 []common.Address)) *KeystoneForwarderInterface_WatchForwarderRemoved_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *forwarder.KeystoneForwarderForwarderRemoved), args[2].([]common.Address)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_WatchForwarderRemoved_Call) Return(_a0 event.Subscription, _a1 error) *KeystoneForwarderInterface_WatchForwarderRemoved_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_WatchForwarderRemoved_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderRemoved, []common.Address) (event.Subscription, error)) *KeystoneForwarderInterface_WatchForwarderRemoved_Call { + _c.Call.Return(run) + return _c +} + +// WatchOwnershipTransferRequested provides a mock function with given fields: opts, sink, from, to +func (_m *KeystoneForwarderInterface) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) { + ret := _m.Called(opts, sink, from, to) + + if len(ret) == 0 { + panic("no return value specified for WatchOwnershipTransferRequested") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested, []common.Address, []common.Address) (event.Subscription, error)); ok { + return rf(opts, sink, from, to) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested, []common.Address, []common.Address) event.Subscription); ok { + r0 = rf(opts, sink, from, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested, []common.Address, []common.Address) error); ok { + r1 = rf(opts, sink, from, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchOwnershipTransferRequested' +type KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call struct { + *mock.Call +} + +// WatchOwnershipTransferRequested is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested +// - from []common.Address +// - to []common.Address +func (_e *KeystoneForwarderInterface_Expecter) WatchOwnershipTransferRequested(opts interface{}, sink interface{}, from interface{}, to interface{}) *KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call { + return &KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call{Call: _e.mock.On("WatchOwnershipTransferRequested", opts, sink, from, to)} +} + +func (_c *KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested, from []common.Address, to []common.Address)) *KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested), args[2].([]common.Address), args[3].([]common.Address)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call) Return(_a0 event.Subscription, _a1 error) *KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested, []common.Address, []common.Address) (event.Subscription, error)) *KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call { + _c.Call.Return(run) + return _c +} + +// WatchOwnershipTransferred provides a mock function with given fields: opts, sink, from, to +func (_m *KeystoneForwarderInterface) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) { + ret := _m.Called(opts, sink, from, to) + + if len(ret) == 0 { + panic("no return value specified for WatchOwnershipTransferred") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferred, []common.Address, []common.Address) (event.Subscription, error)); ok { + return rf(opts, sink, from, to) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferred, []common.Address, []common.Address) event.Subscription); ok { + r0 = rf(opts, sink, from, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferred, []common.Address, []common.Address) error); ok { + r1 = rf(opts, sink, from, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_WatchOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchOwnershipTransferred' +type KeystoneForwarderInterface_WatchOwnershipTransferred_Call struct { + *mock.Call +} + +// WatchOwnershipTransferred is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *forwarder.KeystoneForwarderOwnershipTransferred +// - from []common.Address +// - to []common.Address +func (_e *KeystoneForwarderInterface_Expecter) WatchOwnershipTransferred(opts interface{}, sink interface{}, from interface{}, to interface{}) *KeystoneForwarderInterface_WatchOwnershipTransferred_Call { + return &KeystoneForwarderInterface_WatchOwnershipTransferred_Call{Call: _e.mock.On("WatchOwnershipTransferred", opts, sink, from, to)} +} + +func (_c *KeystoneForwarderInterface_WatchOwnershipTransferred_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderOwnershipTransferred, from []common.Address, to []common.Address)) *KeystoneForwarderInterface_WatchOwnershipTransferred_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *forwarder.KeystoneForwarderOwnershipTransferred), args[2].([]common.Address), args[3].([]common.Address)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_WatchOwnershipTransferred_Call) Return(_a0 event.Subscription, _a1 error) *KeystoneForwarderInterface_WatchOwnershipTransferred_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_WatchOwnershipTransferred_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferred, []common.Address, []common.Address) (event.Subscription, error)) *KeystoneForwarderInterface_WatchOwnershipTransferred_Call { + _c.Call.Return(run) + return _c +} + +// WatchReportProcessed provides a mock function with given fields: opts, sink, receiver, workflowExecutionId, reportId +func (_m *KeystoneForwarderInterface) WatchReportProcessed(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderReportProcessed, receiver []common.Address, workflowExecutionId [][32]byte, reportId [][2]byte) (event.Subscription, error) { + ret := _m.Called(opts, sink, receiver, workflowExecutionId, reportId) + + if len(ret) == 0 { + panic("no return value specified for WatchReportProcessed") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderReportProcessed, []common.Address, [][32]byte, [][2]byte) (event.Subscription, error)); ok { + return rf(opts, sink, receiver, workflowExecutionId, reportId) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderReportProcessed, []common.Address, [][32]byte, [][2]byte) event.Subscription); ok { + r0 = rf(opts, sink, receiver, workflowExecutionId, reportId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderReportProcessed, []common.Address, [][32]byte, [][2]byte) error); ok { + r1 = rf(opts, sink, receiver, workflowExecutionId, reportId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// KeystoneForwarderInterface_WatchReportProcessed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchReportProcessed' +type KeystoneForwarderInterface_WatchReportProcessed_Call struct { + *mock.Call +} + +// WatchReportProcessed is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *forwarder.KeystoneForwarderReportProcessed +// - receiver []common.Address +// - workflowExecutionId [][32]byte +// - reportId [][2]byte +func (_e *KeystoneForwarderInterface_Expecter) WatchReportProcessed(opts interface{}, sink interface{}, receiver interface{}, workflowExecutionId interface{}, reportId interface{}) *KeystoneForwarderInterface_WatchReportProcessed_Call { + return &KeystoneForwarderInterface_WatchReportProcessed_Call{Call: _e.mock.On("WatchReportProcessed", opts, sink, receiver, workflowExecutionId, reportId)} +} + +func (_c *KeystoneForwarderInterface_WatchReportProcessed_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderReportProcessed, receiver []common.Address, workflowExecutionId [][32]byte, reportId [][2]byte)) *KeystoneForwarderInterface_WatchReportProcessed_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *forwarder.KeystoneForwarderReportProcessed), args[2].([]common.Address), args[3].([][32]byte), args[4].([][2]byte)) + }) + return _c +} + +func (_c *KeystoneForwarderInterface_WatchReportProcessed_Call) Return(_a0 event.Subscription, _a1 error) *KeystoneForwarderInterface_WatchReportProcessed_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *KeystoneForwarderInterface_WatchReportProcessed_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderReportProcessed, []common.Address, [][32]byte, [][2]byte) (event.Subscription, error)) *KeystoneForwarderInterface_WatchReportProcessed_Call { + _c.Call.Return(run) + return _c +} + +// NewKeystoneForwarderInterface creates a new instance of KeystoneForwarderInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewKeystoneForwarderInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *KeystoneForwarderInterface { + mock := &KeystoneForwarderInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/core/gethwrappers/keystone/mocks/ocr3_capability_interface.go b/core/gethwrappers/keystone/mocks/ocr3_capability_interface.go new file mode 100644 index 00000000000..4293e5c5364 --- /dev/null +++ b/core/gethwrappers/keystone/mocks/ocr3_capability_interface.go @@ -0,0 +1,1316 @@ +// Code generated by mockery v2.45.0. DO NOT EDIT. + +package mock_contracts + +import ( + bind "github.com/ethereum/go-ethereum/accounts/abi/bind" + common "github.com/ethereum/go-ethereum/common" + + event "github.com/ethereum/go-ethereum/event" + + generated "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" + + mock "github.com/stretchr/testify/mock" + + ocr3_capability "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability" + + types "github.com/ethereum/go-ethereum/core/types" +) + +// OCR3CapabilityInterface is an autogenerated mock type for the OCR3CapabilityInterface type +type OCR3CapabilityInterface struct { + mock.Mock +} + +type OCR3CapabilityInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *OCR3CapabilityInterface) EXPECT() *OCR3CapabilityInterface_Expecter { + return &OCR3CapabilityInterface_Expecter{mock: &_m.Mock} +} + +// AcceptOwnership provides a mock function with given fields: opts +func (_m *OCR3CapabilityInterface) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for AcceptOwnership") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts) (*types.Transaction, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts) *types.Transaction); ok { + r0 = rf(opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_AcceptOwnership_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AcceptOwnership' +type OCR3CapabilityInterface_AcceptOwnership_Call struct { + *mock.Call +} + +// AcceptOwnership is a helper method to define mock.On call +// - opts *bind.TransactOpts +func (_e *OCR3CapabilityInterface_Expecter) AcceptOwnership(opts interface{}) *OCR3CapabilityInterface_AcceptOwnership_Call { + return &OCR3CapabilityInterface_AcceptOwnership_Call{Call: _e.mock.On("AcceptOwnership", opts)} +} + +func (_c *OCR3CapabilityInterface_AcceptOwnership_Call) Run(run func(opts *bind.TransactOpts)) *OCR3CapabilityInterface_AcceptOwnership_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_AcceptOwnership_Call) Return(_a0 *types.Transaction, _a1 error) *OCR3CapabilityInterface_AcceptOwnership_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_AcceptOwnership_Call) RunAndReturn(run func(*bind.TransactOpts) (*types.Transaction, error)) *OCR3CapabilityInterface_AcceptOwnership_Call { + _c.Call.Return(run) + return _c +} + +// Address provides a mock function with given fields: +func (_m *OCR3CapabilityInterface) Address() common.Address { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Address") + } + + var r0 common.Address + if rf, ok := ret.Get(0).(func() common.Address); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(common.Address) + } + } + + return r0 +} + +// OCR3CapabilityInterface_Address_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Address' +type OCR3CapabilityInterface_Address_Call struct { + *mock.Call +} + +// Address is a helper method to define mock.On call +func (_e *OCR3CapabilityInterface_Expecter) Address() *OCR3CapabilityInterface_Address_Call { + return &OCR3CapabilityInterface_Address_Call{Call: _e.mock.On("Address")} +} + +func (_c *OCR3CapabilityInterface_Address_Call) Run(run func()) *OCR3CapabilityInterface_Address_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *OCR3CapabilityInterface_Address_Call) Return(_a0 common.Address) *OCR3CapabilityInterface_Address_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *OCR3CapabilityInterface_Address_Call) RunAndReturn(run func() common.Address) *OCR3CapabilityInterface_Address_Call { + _c.Call.Return(run) + return _c +} + +// FilterConfigSet provides a mock function with given fields: opts +func (_m *OCR3CapabilityInterface) FilterConfigSet(opts *bind.FilterOpts) (*ocr3_capability.OCR3CapabilityConfigSetIterator, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for FilterConfigSet") + } + + var r0 *ocr3_capability.OCR3CapabilityConfigSetIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*ocr3_capability.OCR3CapabilityConfigSetIterator, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *ocr3_capability.OCR3CapabilityConfigSetIterator); ok { + r0 = rf(opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityConfigSetIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_FilterConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterConfigSet' +type OCR3CapabilityInterface_FilterConfigSet_Call struct { + *mock.Call +} + +// FilterConfigSet is a helper method to define mock.On call +// - opts *bind.FilterOpts +func (_e *OCR3CapabilityInterface_Expecter) FilterConfigSet(opts interface{}) *OCR3CapabilityInterface_FilterConfigSet_Call { + return &OCR3CapabilityInterface_FilterConfigSet_Call{Call: _e.mock.On("FilterConfigSet", opts)} +} + +func (_c *OCR3CapabilityInterface_FilterConfigSet_Call) Run(run func(opts *bind.FilterOpts)) *OCR3CapabilityInterface_FilterConfigSet_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_FilterConfigSet_Call) Return(_a0 *ocr3_capability.OCR3CapabilityConfigSetIterator, _a1 error) *OCR3CapabilityInterface_FilterConfigSet_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_FilterConfigSet_Call) RunAndReturn(run func(*bind.FilterOpts) (*ocr3_capability.OCR3CapabilityConfigSetIterator, error)) *OCR3CapabilityInterface_FilterConfigSet_Call { + _c.Call.Return(run) + return _c +} + +// FilterOwnershipTransferRequested provides a mock function with given fields: opts, from, to +func (_m *OCR3CapabilityInterface) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ocr3_capability.OCR3CapabilityOwnershipTransferRequestedIterator, error) { + ret := _m.Called(opts, from, to) + + if len(ret) == 0 { + panic("no return value specified for FilterOwnershipTransferRequested") + } + + var r0 *ocr3_capability.OCR3CapabilityOwnershipTransferRequestedIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*ocr3_capability.OCR3CapabilityOwnershipTransferRequestedIterator, error)); ok { + return rf(opts, from, to) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *ocr3_capability.OCR3CapabilityOwnershipTransferRequestedIterator); ok { + r0 = rf(opts, from, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityOwnershipTransferRequestedIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { + r1 = rf(opts, from, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterOwnershipTransferRequested' +type OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call struct { + *mock.Call +} + +// FilterOwnershipTransferRequested is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - from []common.Address +// - to []common.Address +func (_e *OCR3CapabilityInterface_Expecter) FilterOwnershipTransferRequested(opts interface{}, from interface{}, to interface{}) *OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call { + return &OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call{Call: _e.mock.On("FilterOwnershipTransferRequested", opts, from, to)} +} + +func (_c *OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call) Run(run func(opts *bind.FilterOpts, from []common.Address, to []common.Address)) *OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]common.Address), args[2].([]common.Address)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call) Return(_a0 *ocr3_capability.OCR3CapabilityOwnershipTransferRequestedIterator, _a1 error) *OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address, []common.Address) (*ocr3_capability.OCR3CapabilityOwnershipTransferRequestedIterator, error)) *OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call { + _c.Call.Return(run) + return _c +} + +// FilterOwnershipTransferred provides a mock function with given fields: opts, from, to +func (_m *OCR3CapabilityInterface) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ocr3_capability.OCR3CapabilityOwnershipTransferredIterator, error) { + ret := _m.Called(opts, from, to) + + if len(ret) == 0 { + panic("no return value specified for FilterOwnershipTransferred") + } + + var r0 *ocr3_capability.OCR3CapabilityOwnershipTransferredIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*ocr3_capability.OCR3CapabilityOwnershipTransferredIterator, error)); ok { + return rf(opts, from, to) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *ocr3_capability.OCR3CapabilityOwnershipTransferredIterator); ok { + r0 = rf(opts, from, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityOwnershipTransferredIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { + r1 = rf(opts, from, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_FilterOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterOwnershipTransferred' +type OCR3CapabilityInterface_FilterOwnershipTransferred_Call struct { + *mock.Call +} + +// FilterOwnershipTransferred is a helper method to define mock.On call +// - opts *bind.FilterOpts +// - from []common.Address +// - to []common.Address +func (_e *OCR3CapabilityInterface_Expecter) FilterOwnershipTransferred(opts interface{}, from interface{}, to interface{}) *OCR3CapabilityInterface_FilterOwnershipTransferred_Call { + return &OCR3CapabilityInterface_FilterOwnershipTransferred_Call{Call: _e.mock.On("FilterOwnershipTransferred", opts, from, to)} +} + +func (_c *OCR3CapabilityInterface_FilterOwnershipTransferred_Call) Run(run func(opts *bind.FilterOpts, from []common.Address, to []common.Address)) *OCR3CapabilityInterface_FilterOwnershipTransferred_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts), args[1].([]common.Address), args[2].([]common.Address)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_FilterOwnershipTransferred_Call) Return(_a0 *ocr3_capability.OCR3CapabilityOwnershipTransferredIterator, _a1 error) *OCR3CapabilityInterface_FilterOwnershipTransferred_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_FilterOwnershipTransferred_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address, []common.Address) (*ocr3_capability.OCR3CapabilityOwnershipTransferredIterator, error)) *OCR3CapabilityInterface_FilterOwnershipTransferred_Call { + _c.Call.Return(run) + return _c +} + +// FilterTransmitted provides a mock function with given fields: opts +func (_m *OCR3CapabilityInterface) FilterTransmitted(opts *bind.FilterOpts) (*ocr3_capability.OCR3CapabilityTransmittedIterator, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for FilterTransmitted") + } + + var r0 *ocr3_capability.OCR3CapabilityTransmittedIterator + var r1 error + if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*ocr3_capability.OCR3CapabilityTransmittedIterator, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *ocr3_capability.OCR3CapabilityTransmittedIterator); ok { + r0 = rf(opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityTransmittedIterator) + } + } + + if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_FilterTransmitted_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterTransmitted' +type OCR3CapabilityInterface_FilterTransmitted_Call struct { + *mock.Call +} + +// FilterTransmitted is a helper method to define mock.On call +// - opts *bind.FilterOpts +func (_e *OCR3CapabilityInterface_Expecter) FilterTransmitted(opts interface{}) *OCR3CapabilityInterface_FilterTransmitted_Call { + return &OCR3CapabilityInterface_FilterTransmitted_Call{Call: _e.mock.On("FilterTransmitted", opts)} +} + +func (_c *OCR3CapabilityInterface_FilterTransmitted_Call) Run(run func(opts *bind.FilterOpts)) *OCR3CapabilityInterface_FilterTransmitted_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.FilterOpts)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_FilterTransmitted_Call) Return(_a0 *ocr3_capability.OCR3CapabilityTransmittedIterator, _a1 error) *OCR3CapabilityInterface_FilterTransmitted_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_FilterTransmitted_Call) RunAndReturn(run func(*bind.FilterOpts) (*ocr3_capability.OCR3CapabilityTransmittedIterator, error)) *OCR3CapabilityInterface_FilterTransmitted_Call { + _c.Call.Return(run) + return _c +} + +// LatestConfigDetails provides a mock function with given fields: opts +func (_m *OCR3CapabilityInterface) LatestConfigDetails(opts *bind.CallOpts) (ocr3_capability.LatestConfigDetails, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for LatestConfigDetails") + } + + var r0 ocr3_capability.LatestConfigDetails + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts) (ocr3_capability.LatestConfigDetails, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts) ocr3_capability.LatestConfigDetails); ok { + r0 = rf(opts) + } else { + r0 = ret.Get(0).(ocr3_capability.LatestConfigDetails) + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_LatestConfigDetails_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LatestConfigDetails' +type OCR3CapabilityInterface_LatestConfigDetails_Call struct { + *mock.Call +} + +// LatestConfigDetails is a helper method to define mock.On call +// - opts *bind.CallOpts +func (_e *OCR3CapabilityInterface_Expecter) LatestConfigDetails(opts interface{}) *OCR3CapabilityInterface_LatestConfigDetails_Call { + return &OCR3CapabilityInterface_LatestConfigDetails_Call{Call: _e.mock.On("LatestConfigDetails", opts)} +} + +func (_c *OCR3CapabilityInterface_LatestConfigDetails_Call) Run(run func(opts *bind.CallOpts)) *OCR3CapabilityInterface_LatestConfigDetails_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_LatestConfigDetails_Call) Return(_a0 ocr3_capability.LatestConfigDetails, _a1 error) *OCR3CapabilityInterface_LatestConfigDetails_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_LatestConfigDetails_Call) RunAndReturn(run func(*bind.CallOpts) (ocr3_capability.LatestConfigDetails, error)) *OCR3CapabilityInterface_LatestConfigDetails_Call { + _c.Call.Return(run) + return _c +} + +// LatestConfigDigestAndEpoch provides a mock function with given fields: opts +func (_m *OCR3CapabilityInterface) LatestConfigDigestAndEpoch(opts *bind.CallOpts) (ocr3_capability.LatestConfigDigestAndEpoch, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for LatestConfigDigestAndEpoch") + } + + var r0 ocr3_capability.LatestConfigDigestAndEpoch + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts) (ocr3_capability.LatestConfigDigestAndEpoch, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts) ocr3_capability.LatestConfigDigestAndEpoch); ok { + r0 = rf(opts) + } else { + r0 = ret.Get(0).(ocr3_capability.LatestConfigDigestAndEpoch) + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LatestConfigDigestAndEpoch' +type OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call struct { + *mock.Call +} + +// LatestConfigDigestAndEpoch is a helper method to define mock.On call +// - opts *bind.CallOpts +func (_e *OCR3CapabilityInterface_Expecter) LatestConfigDigestAndEpoch(opts interface{}) *OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call { + return &OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call{Call: _e.mock.On("LatestConfigDigestAndEpoch", opts)} +} + +func (_c *OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call) Run(run func(opts *bind.CallOpts)) *OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call) Return(_a0 ocr3_capability.LatestConfigDigestAndEpoch, _a1 error) *OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call) RunAndReturn(run func(*bind.CallOpts) (ocr3_capability.LatestConfigDigestAndEpoch, error)) *OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call { + _c.Call.Return(run) + return _c +} + +// Owner provides a mock function with given fields: opts +func (_m *OCR3CapabilityInterface) Owner(opts *bind.CallOpts) (common.Address, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for Owner") + } + + var r0 common.Address + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts) (common.Address, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts) common.Address); ok { + r0 = rf(opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(common.Address) + } + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_Owner_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Owner' +type OCR3CapabilityInterface_Owner_Call struct { + *mock.Call +} + +// Owner is a helper method to define mock.On call +// - opts *bind.CallOpts +func (_e *OCR3CapabilityInterface_Expecter) Owner(opts interface{}) *OCR3CapabilityInterface_Owner_Call { + return &OCR3CapabilityInterface_Owner_Call{Call: _e.mock.On("Owner", opts)} +} + +func (_c *OCR3CapabilityInterface_Owner_Call) Run(run func(opts *bind.CallOpts)) *OCR3CapabilityInterface_Owner_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_Owner_Call) Return(_a0 common.Address, _a1 error) *OCR3CapabilityInterface_Owner_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_Owner_Call) RunAndReturn(run func(*bind.CallOpts) (common.Address, error)) *OCR3CapabilityInterface_Owner_Call { + _c.Call.Return(run) + return _c +} + +// ParseConfigSet provides a mock function with given fields: log +func (_m *OCR3CapabilityInterface) ParseConfigSet(log types.Log) (*ocr3_capability.OCR3CapabilityConfigSet, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseConfigSet") + } + + var r0 *ocr3_capability.OCR3CapabilityConfigSet + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*ocr3_capability.OCR3CapabilityConfigSet, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *ocr3_capability.OCR3CapabilityConfigSet); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityConfigSet) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_ParseConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseConfigSet' +type OCR3CapabilityInterface_ParseConfigSet_Call struct { + *mock.Call +} + +// ParseConfigSet is a helper method to define mock.On call +// - log types.Log +func (_e *OCR3CapabilityInterface_Expecter) ParseConfigSet(log interface{}) *OCR3CapabilityInterface_ParseConfigSet_Call { + return &OCR3CapabilityInterface_ParseConfigSet_Call{Call: _e.mock.On("ParseConfigSet", log)} +} + +func (_c *OCR3CapabilityInterface_ParseConfigSet_Call) Run(run func(log types.Log)) *OCR3CapabilityInterface_ParseConfigSet_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_ParseConfigSet_Call) Return(_a0 *ocr3_capability.OCR3CapabilityConfigSet, _a1 error) *OCR3CapabilityInterface_ParseConfigSet_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_ParseConfigSet_Call) RunAndReturn(run func(types.Log) (*ocr3_capability.OCR3CapabilityConfigSet, error)) *OCR3CapabilityInterface_ParseConfigSet_Call { + _c.Call.Return(run) + return _c +} + +// ParseLog provides a mock function with given fields: log +func (_m *OCR3CapabilityInterface) ParseLog(log types.Log) (generated.AbigenLog, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseLog") + } + + var r0 generated.AbigenLog + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (generated.AbigenLog, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) generated.AbigenLog); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(generated.AbigenLog) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_ParseLog_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseLog' +type OCR3CapabilityInterface_ParseLog_Call struct { + *mock.Call +} + +// ParseLog is a helper method to define mock.On call +// - log types.Log +func (_e *OCR3CapabilityInterface_Expecter) ParseLog(log interface{}) *OCR3CapabilityInterface_ParseLog_Call { + return &OCR3CapabilityInterface_ParseLog_Call{Call: _e.mock.On("ParseLog", log)} +} + +func (_c *OCR3CapabilityInterface_ParseLog_Call) Run(run func(log types.Log)) *OCR3CapabilityInterface_ParseLog_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_ParseLog_Call) Return(_a0 generated.AbigenLog, _a1 error) *OCR3CapabilityInterface_ParseLog_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_ParseLog_Call) RunAndReturn(run func(types.Log) (generated.AbigenLog, error)) *OCR3CapabilityInterface_ParseLog_Call { + _c.Call.Return(run) + return _c +} + +// ParseOwnershipTransferRequested provides a mock function with given fields: log +func (_m *OCR3CapabilityInterface) ParseOwnershipTransferRequested(log types.Log) (*ocr3_capability.OCR3CapabilityOwnershipTransferRequested, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseOwnershipTransferRequested") + } + + var r0 *ocr3_capability.OCR3CapabilityOwnershipTransferRequested + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*ocr3_capability.OCR3CapabilityOwnershipTransferRequested, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *ocr3_capability.OCR3CapabilityOwnershipTransferRequested); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityOwnershipTransferRequested) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseOwnershipTransferRequested' +type OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call struct { + *mock.Call +} + +// ParseOwnershipTransferRequested is a helper method to define mock.On call +// - log types.Log +func (_e *OCR3CapabilityInterface_Expecter) ParseOwnershipTransferRequested(log interface{}) *OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call { + return &OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call{Call: _e.mock.On("ParseOwnershipTransferRequested", log)} +} + +func (_c *OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call) Run(run func(log types.Log)) *OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call) Return(_a0 *ocr3_capability.OCR3CapabilityOwnershipTransferRequested, _a1 error) *OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call) RunAndReturn(run func(types.Log) (*ocr3_capability.OCR3CapabilityOwnershipTransferRequested, error)) *OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call { + _c.Call.Return(run) + return _c +} + +// ParseOwnershipTransferred provides a mock function with given fields: log +func (_m *OCR3CapabilityInterface) ParseOwnershipTransferred(log types.Log) (*ocr3_capability.OCR3CapabilityOwnershipTransferred, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseOwnershipTransferred") + } + + var r0 *ocr3_capability.OCR3CapabilityOwnershipTransferred + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*ocr3_capability.OCR3CapabilityOwnershipTransferred, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *ocr3_capability.OCR3CapabilityOwnershipTransferred); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityOwnershipTransferred) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_ParseOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseOwnershipTransferred' +type OCR3CapabilityInterface_ParseOwnershipTransferred_Call struct { + *mock.Call +} + +// ParseOwnershipTransferred is a helper method to define mock.On call +// - log types.Log +func (_e *OCR3CapabilityInterface_Expecter) ParseOwnershipTransferred(log interface{}) *OCR3CapabilityInterface_ParseOwnershipTransferred_Call { + return &OCR3CapabilityInterface_ParseOwnershipTransferred_Call{Call: _e.mock.On("ParseOwnershipTransferred", log)} +} + +func (_c *OCR3CapabilityInterface_ParseOwnershipTransferred_Call) Run(run func(log types.Log)) *OCR3CapabilityInterface_ParseOwnershipTransferred_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_ParseOwnershipTransferred_Call) Return(_a0 *ocr3_capability.OCR3CapabilityOwnershipTransferred, _a1 error) *OCR3CapabilityInterface_ParseOwnershipTransferred_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_ParseOwnershipTransferred_Call) RunAndReturn(run func(types.Log) (*ocr3_capability.OCR3CapabilityOwnershipTransferred, error)) *OCR3CapabilityInterface_ParseOwnershipTransferred_Call { + _c.Call.Return(run) + return _c +} + +// ParseTransmitted provides a mock function with given fields: log +func (_m *OCR3CapabilityInterface) ParseTransmitted(log types.Log) (*ocr3_capability.OCR3CapabilityTransmitted, error) { + ret := _m.Called(log) + + if len(ret) == 0 { + panic("no return value specified for ParseTransmitted") + } + + var r0 *ocr3_capability.OCR3CapabilityTransmitted + var r1 error + if rf, ok := ret.Get(0).(func(types.Log) (*ocr3_capability.OCR3CapabilityTransmitted, error)); ok { + return rf(log) + } + if rf, ok := ret.Get(0).(func(types.Log) *ocr3_capability.OCR3CapabilityTransmitted); ok { + r0 = rf(log) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityTransmitted) + } + } + + if rf, ok := ret.Get(1).(func(types.Log) error); ok { + r1 = rf(log) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_ParseTransmitted_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseTransmitted' +type OCR3CapabilityInterface_ParseTransmitted_Call struct { + *mock.Call +} + +// ParseTransmitted is a helper method to define mock.On call +// - log types.Log +func (_e *OCR3CapabilityInterface_Expecter) ParseTransmitted(log interface{}) *OCR3CapabilityInterface_ParseTransmitted_Call { + return &OCR3CapabilityInterface_ParseTransmitted_Call{Call: _e.mock.On("ParseTransmitted", log)} +} + +func (_c *OCR3CapabilityInterface_ParseTransmitted_Call) Run(run func(log types.Log)) *OCR3CapabilityInterface_ParseTransmitted_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Log)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_ParseTransmitted_Call) Return(_a0 *ocr3_capability.OCR3CapabilityTransmitted, _a1 error) *OCR3CapabilityInterface_ParseTransmitted_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_ParseTransmitted_Call) RunAndReturn(run func(types.Log) (*ocr3_capability.OCR3CapabilityTransmitted, error)) *OCR3CapabilityInterface_ParseTransmitted_Call { + _c.Call.Return(run) + return _c +} + +// SetConfig provides a mock function with given fields: opts, _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig +func (_m *OCR3CapabilityInterface) SetConfig(opts *bind.TransactOpts, _signers [][]byte, _transmitters []common.Address, _f uint8, _onchainConfig []byte, _offchainConfigVersion uint64, _offchainConfig []byte) (*types.Transaction, error) { + ret := _m.Called(opts, _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig) + + if len(ret) == 0 { + panic("no return value specified for SetConfig") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][]byte, []common.Address, uint8, []byte, uint64, []byte) (*types.Transaction, error)); ok { + return rf(opts, _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][]byte, []common.Address, uint8, []byte, uint64, []byte) *types.Transaction); ok { + r0 = rf(opts, _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, [][]byte, []common.Address, uint8, []byte, uint64, []byte) error); ok { + r1 = rf(opts, _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_SetConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetConfig' +type OCR3CapabilityInterface_SetConfig_Call struct { + *mock.Call +} + +// SetConfig is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - _signers [][]byte +// - _transmitters []common.Address +// - _f uint8 +// - _onchainConfig []byte +// - _offchainConfigVersion uint64 +// - _offchainConfig []byte +func (_e *OCR3CapabilityInterface_Expecter) SetConfig(opts interface{}, _signers interface{}, _transmitters interface{}, _f interface{}, _onchainConfig interface{}, _offchainConfigVersion interface{}, _offchainConfig interface{}) *OCR3CapabilityInterface_SetConfig_Call { + return &OCR3CapabilityInterface_SetConfig_Call{Call: _e.mock.On("SetConfig", opts, _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig)} +} + +func (_c *OCR3CapabilityInterface_SetConfig_Call) Run(run func(opts *bind.TransactOpts, _signers [][]byte, _transmitters []common.Address, _f uint8, _onchainConfig []byte, _offchainConfigVersion uint64, _offchainConfig []byte)) *OCR3CapabilityInterface_SetConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].([][]byte), args[2].([]common.Address), args[3].(uint8), args[4].([]byte), args[5].(uint64), args[6].([]byte)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_SetConfig_Call) Return(_a0 *types.Transaction, _a1 error) *OCR3CapabilityInterface_SetConfig_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_SetConfig_Call) RunAndReturn(run func(*bind.TransactOpts, [][]byte, []common.Address, uint8, []byte, uint64, []byte) (*types.Transaction, error)) *OCR3CapabilityInterface_SetConfig_Call { + _c.Call.Return(run) + return _c +} + +// TransferOwnership provides a mock function with given fields: opts, to +func (_m *OCR3CapabilityInterface) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { + ret := _m.Called(opts, to) + + if len(ret) == 0 { + panic("no return value specified for TransferOwnership") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { + return rf(opts, to) + } + if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { + r0 = rf(opts, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { + r1 = rf(opts, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_TransferOwnership_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransferOwnership' +type OCR3CapabilityInterface_TransferOwnership_Call struct { + *mock.Call +} + +// TransferOwnership is a helper method to define mock.On call +// - opts *bind.TransactOpts +// - to common.Address +func (_e *OCR3CapabilityInterface_Expecter) TransferOwnership(opts interface{}, to interface{}) *OCR3CapabilityInterface_TransferOwnership_Call { + return &OCR3CapabilityInterface_TransferOwnership_Call{Call: _e.mock.On("TransferOwnership", opts, to)} +} + +func (_c *OCR3CapabilityInterface_TransferOwnership_Call) Run(run func(opts *bind.TransactOpts, to common.Address)) *OCR3CapabilityInterface_TransferOwnership_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.TransactOpts), args[1].(common.Address)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_TransferOwnership_Call) Return(_a0 *types.Transaction, _a1 error) *OCR3CapabilityInterface_TransferOwnership_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_TransferOwnership_Call) RunAndReturn(run func(*bind.TransactOpts, common.Address) (*types.Transaction, error)) *OCR3CapabilityInterface_TransferOwnership_Call { + _c.Call.Return(run) + return _c +} + +// Transmit provides a mock function with given fields: opts, arg0, arg1, arg2, arg3, arg4 +func (_m *OCR3CapabilityInterface) Transmit(opts *bind.CallOpts, arg0 [3][32]byte, arg1 []byte, arg2 [][32]byte, arg3 [][32]byte, arg4 [32]byte) error { + ret := _m.Called(opts, arg0, arg1, arg2, arg3, arg4) + + if len(ret) == 0 { + panic("no return value specified for Transmit") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts, [3][32]byte, []byte, [][32]byte, [][32]byte, [32]byte) error); ok { + r0 = rf(opts, arg0, arg1, arg2, arg3, arg4) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// OCR3CapabilityInterface_Transmit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Transmit' +type OCR3CapabilityInterface_Transmit_Call struct { + *mock.Call +} + +// Transmit is a helper method to define mock.On call +// - opts *bind.CallOpts +// - arg0 [3][32]byte +// - arg1 []byte +// - arg2 [][32]byte +// - arg3 [][32]byte +// - arg4 [32]byte +func (_e *OCR3CapabilityInterface_Expecter) Transmit(opts interface{}, arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}) *OCR3CapabilityInterface_Transmit_Call { + return &OCR3CapabilityInterface_Transmit_Call{Call: _e.mock.On("Transmit", opts, arg0, arg1, arg2, arg3, arg4)} +} + +func (_c *OCR3CapabilityInterface_Transmit_Call) Run(run func(opts *bind.CallOpts, arg0 [3][32]byte, arg1 []byte, arg2 [][32]byte, arg3 [][32]byte, arg4 [32]byte)) *OCR3CapabilityInterface_Transmit_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts), args[1].([3][32]byte), args[2].([]byte), args[3].([][32]byte), args[4].([][32]byte), args[5].([32]byte)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_Transmit_Call) Return(_a0 error) *OCR3CapabilityInterface_Transmit_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *OCR3CapabilityInterface_Transmit_Call) RunAndReturn(run func(*bind.CallOpts, [3][32]byte, []byte, [][32]byte, [][32]byte, [32]byte) error) *OCR3CapabilityInterface_Transmit_Call { + _c.Call.Return(run) + return _c +} + +// TypeAndVersion provides a mock function with given fields: opts +func (_m *OCR3CapabilityInterface) TypeAndVersion(opts *bind.CallOpts) (string, error) { + ret := _m.Called(opts) + + if len(ret) == 0 { + panic("no return value specified for TypeAndVersion") + } + + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(*bind.CallOpts) (string, error)); ok { + return rf(opts) + } + if rf, ok := ret.Get(0).(func(*bind.CallOpts) string); ok { + r0 = rf(opts) + } else { + r0 = ret.Get(0).(string) + } + + if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_TypeAndVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeAndVersion' +type OCR3CapabilityInterface_TypeAndVersion_Call struct { + *mock.Call +} + +// TypeAndVersion is a helper method to define mock.On call +// - opts *bind.CallOpts +func (_e *OCR3CapabilityInterface_Expecter) TypeAndVersion(opts interface{}) *OCR3CapabilityInterface_TypeAndVersion_Call { + return &OCR3CapabilityInterface_TypeAndVersion_Call{Call: _e.mock.On("TypeAndVersion", opts)} +} + +func (_c *OCR3CapabilityInterface_TypeAndVersion_Call) Run(run func(opts *bind.CallOpts)) *OCR3CapabilityInterface_TypeAndVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.CallOpts)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_TypeAndVersion_Call) Return(_a0 string, _a1 error) *OCR3CapabilityInterface_TypeAndVersion_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_TypeAndVersion_Call) RunAndReturn(run func(*bind.CallOpts) (string, error)) *OCR3CapabilityInterface_TypeAndVersion_Call { + _c.Call.Return(run) + return _c +} + +// WatchConfigSet provides a mock function with given fields: opts, sink +func (_m *OCR3CapabilityInterface) WatchConfigSet(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityConfigSet) (event.Subscription, error) { + ret := _m.Called(opts, sink) + + if len(ret) == 0 { + panic("no return value specified for WatchConfigSet") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityConfigSet) (event.Subscription, error)); ok { + return rf(opts, sink) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityConfigSet) event.Subscription); ok { + r0 = rf(opts, sink) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityConfigSet) error); ok { + r1 = rf(opts, sink) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_WatchConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchConfigSet' +type OCR3CapabilityInterface_WatchConfigSet_Call struct { + *mock.Call +} + +// WatchConfigSet is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *ocr3_capability.OCR3CapabilityConfigSet +func (_e *OCR3CapabilityInterface_Expecter) WatchConfigSet(opts interface{}, sink interface{}) *OCR3CapabilityInterface_WatchConfigSet_Call { + return &OCR3CapabilityInterface_WatchConfigSet_Call{Call: _e.mock.On("WatchConfigSet", opts, sink)} +} + +func (_c *OCR3CapabilityInterface_WatchConfigSet_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityConfigSet)) *OCR3CapabilityInterface_WatchConfigSet_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *ocr3_capability.OCR3CapabilityConfigSet)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_WatchConfigSet_Call) Return(_a0 event.Subscription, _a1 error) *OCR3CapabilityInterface_WatchConfigSet_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_WatchConfigSet_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityConfigSet) (event.Subscription, error)) *OCR3CapabilityInterface_WatchConfigSet_Call { + _c.Call.Return(run) + return _c +} + +// WatchOwnershipTransferRequested provides a mock function with given fields: opts, sink, from, to +func (_m *OCR3CapabilityInterface) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) { + ret := _m.Called(opts, sink, from, to) + + if len(ret) == 0 { + panic("no return value specified for WatchOwnershipTransferRequested") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested, []common.Address, []common.Address) (event.Subscription, error)); ok { + return rf(opts, sink, from, to) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested, []common.Address, []common.Address) event.Subscription); ok { + r0 = rf(opts, sink, from, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested, []common.Address, []common.Address) error); ok { + r1 = rf(opts, sink, from, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchOwnershipTransferRequested' +type OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call struct { + *mock.Call +} + +// WatchOwnershipTransferRequested is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested +// - from []common.Address +// - to []common.Address +func (_e *OCR3CapabilityInterface_Expecter) WatchOwnershipTransferRequested(opts interface{}, sink interface{}, from interface{}, to interface{}) *OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call { + return &OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call{Call: _e.mock.On("WatchOwnershipTransferRequested", opts, sink, from, to)} +} + +func (_c *OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested, from []common.Address, to []common.Address)) *OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested), args[2].([]common.Address), args[3].([]common.Address)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call) Return(_a0 event.Subscription, _a1 error) *OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested, []common.Address, []common.Address) (event.Subscription, error)) *OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call { + _c.Call.Return(run) + return _c +} + +// WatchOwnershipTransferred provides a mock function with given fields: opts, sink, from, to +func (_m *OCR3CapabilityInterface) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) { + ret := _m.Called(opts, sink, from, to) + + if len(ret) == 0 { + panic("no return value specified for WatchOwnershipTransferred") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred, []common.Address, []common.Address) (event.Subscription, error)); ok { + return rf(opts, sink, from, to) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred, []common.Address, []common.Address) event.Subscription); ok { + r0 = rf(opts, sink, from, to) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred, []common.Address, []common.Address) error); ok { + r1 = rf(opts, sink, from, to) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_WatchOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchOwnershipTransferred' +type OCR3CapabilityInterface_WatchOwnershipTransferred_Call struct { + *mock.Call +} + +// WatchOwnershipTransferred is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred +// - from []common.Address +// - to []common.Address +func (_e *OCR3CapabilityInterface_Expecter) WatchOwnershipTransferred(opts interface{}, sink interface{}, from interface{}, to interface{}) *OCR3CapabilityInterface_WatchOwnershipTransferred_Call { + return &OCR3CapabilityInterface_WatchOwnershipTransferred_Call{Call: _e.mock.On("WatchOwnershipTransferred", opts, sink, from, to)} +} + +func (_c *OCR3CapabilityInterface_WatchOwnershipTransferred_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred, from []common.Address, to []common.Address)) *OCR3CapabilityInterface_WatchOwnershipTransferred_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred), args[2].([]common.Address), args[3].([]common.Address)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_WatchOwnershipTransferred_Call) Return(_a0 event.Subscription, _a1 error) *OCR3CapabilityInterface_WatchOwnershipTransferred_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_WatchOwnershipTransferred_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred, []common.Address, []common.Address) (event.Subscription, error)) *OCR3CapabilityInterface_WatchOwnershipTransferred_Call { + _c.Call.Return(run) + return _c +} + +// WatchTransmitted provides a mock function with given fields: opts, sink +func (_m *OCR3CapabilityInterface) WatchTransmitted(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityTransmitted) (event.Subscription, error) { + ret := _m.Called(opts, sink) + + if len(ret) == 0 { + panic("no return value specified for WatchTransmitted") + } + + var r0 event.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityTransmitted) (event.Subscription, error)); ok { + return rf(opts, sink) + } + if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityTransmitted) event.Subscription); ok { + r0 = rf(opts, sink) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(event.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityTransmitted) error); ok { + r1 = rf(opts, sink) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OCR3CapabilityInterface_WatchTransmitted_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchTransmitted' +type OCR3CapabilityInterface_WatchTransmitted_Call struct { + *mock.Call +} + +// WatchTransmitted is a helper method to define mock.On call +// - opts *bind.WatchOpts +// - sink chan<- *ocr3_capability.OCR3CapabilityTransmitted +func (_e *OCR3CapabilityInterface_Expecter) WatchTransmitted(opts interface{}, sink interface{}) *OCR3CapabilityInterface_WatchTransmitted_Call { + return &OCR3CapabilityInterface_WatchTransmitted_Call{Call: _e.mock.On("WatchTransmitted", opts, sink)} +} + +func (_c *OCR3CapabilityInterface_WatchTransmitted_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityTransmitted)) *OCR3CapabilityInterface_WatchTransmitted_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*bind.WatchOpts), args[1].(chan<- *ocr3_capability.OCR3CapabilityTransmitted)) + }) + return _c +} + +func (_c *OCR3CapabilityInterface_WatchTransmitted_Call) Return(_a0 event.Subscription, _a1 error) *OCR3CapabilityInterface_WatchTransmitted_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OCR3CapabilityInterface_WatchTransmitted_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityTransmitted) (event.Subscription, error)) *OCR3CapabilityInterface_WatchTransmitted_Call { + _c.Call.Return(run) + return _c +} + +// NewOCR3CapabilityInterface creates a new instance of OCR3CapabilityInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewOCR3CapabilityInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *OCR3CapabilityInterface { + mock := &OCR3CapabilityInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} From 7b7ca446c20717635ece4d9274945e014bd8ebc1 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 28 Oct 2024 22:52:46 -0700 Subject: [PATCH 072/117] Refactor - Use single entrypoint for provisiong keystone in CRIB --- core/scripts/keystone/main.go | 18 +- .../keystone/src/01_deploy_contracts_cmd.go | 229 -------------- .../keystone/src/01_provision_keystone.go | 145 +++++++++ .../keystone/src/02_deploy_jobspecs_cmd.go | 94 ------ .../src/02_deploy_keystone_workflows.go | 174 ++++++++++ .../src/02_deploy_keystone_workflows_test.go | 21 ++ .../keystone/src/02_fund_transmitters.go | 59 ++++ ... => 02_provision_capabilities_registry.go} | 82 ++--- ..._overrides_cmd.go => 02_provision_crib.go} | 123 +++++--- ..._cmd_test.go => 02_provision_crib_test.go} | 15 +- .../src/02_provision_forwarder_contract.go | 71 +++++ .../src/02_provision_ocr3_capability.go | 296 ++++++++++++++++++ .../src/02_provision_ocr3_capability_test.go | 61 ++++ ...2_provision_streams_trigger_capability.go} | 266 +++++----------- ...vision_streams_trigger_capability_test.go} | 15 +- .../keystone/src/04_delete_ocr3_jobs_cmd.go | 85 ----- .../keystone/src/06_deploy_workflows_cmd.go | 72 ----- .../keystone/src/07_delete_workflows_cmd.go | 72 ----- ...go => 88_capabilities_registry_helpers.go} | 119 ++++--- .../keystone/src/88_contracts_helpers.go | 155 +++++++++ core/scripts/keystone/src/88_gen_jobspecs.go | 92 ------ .../keystone/src/88_gen_jobspecs_test.go | 36 --- .../keystone/src/88_gen_ocr3_config.go | 40 --- .../keystone/src/88_gen_ocr3_config_test.go | 31 -- .../keystone/src/88_jobspecs_helpers.go | 50 +++ core/scripts/keystone/src/99_files.go | 1 + 26 files changed, 1319 insertions(+), 1103 deletions(-) delete mode 100644 core/scripts/keystone/src/01_deploy_contracts_cmd.go create mode 100644 core/scripts/keystone/src/01_provision_keystone.go delete mode 100644 core/scripts/keystone/src/02_deploy_jobspecs_cmd.go create mode 100644 core/scripts/keystone/src/02_deploy_keystone_workflows.go create mode 100644 core/scripts/keystone/src/02_deploy_keystone_workflows_test.go create mode 100644 core/scripts/keystone/src/02_fund_transmitters.go rename core/scripts/keystone/src/{06_provision_capabilities_registry.go => 02_provision_capabilities_registry.go} (64%) rename core/scripts/keystone/src/{03_gen_crib_cluster_overrides_cmd.go => 02_provision_crib.go} (71%) rename core/scripts/keystone/src/{03_gen_crib_cluster_overrides_cmd_test.go => 02_provision_crib_test.go} (66%) create mode 100644 core/scripts/keystone/src/02_provision_forwarder_contract.go create mode 100644 core/scripts/keystone/src/02_provision_ocr3_capability.go create mode 100644 core/scripts/keystone/src/02_provision_ocr3_capability_test.go rename core/scripts/keystone/src/{03_deploy_streams_trigger_cmd.go => 02_provision_streams_trigger_capability.go} (76%) rename core/scripts/keystone/src/{03_deploy_streams_trigger_cmd_test.go => 02_provision_streams_trigger_capability_test.go} (72%) delete mode 100644 core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go delete mode 100644 core/scripts/keystone/src/06_deploy_workflows_cmd.go delete mode 100644 core/scripts/keystone/src/07_delete_workflows_cmd.go rename core/scripts/keystone/src/{88_capabilities_registry.go => 88_capabilities_registry_helpers.go} (85%) create mode 100644 core/scripts/keystone/src/88_contracts_helpers.go delete mode 100644 core/scripts/keystone/src/88_gen_jobspecs.go delete mode 100644 core/scripts/keystone/src/88_gen_jobspecs_test.go delete mode 100644 core/scripts/keystone/src/88_gen_ocr3_config.go delete mode 100644 core/scripts/keystone/src/88_gen_ocr3_config_test.go create mode 100644 core/scripts/keystone/src/88_jobspecs_helpers.go diff --git a/core/scripts/keystone/main.go b/core/scripts/keystone/main.go index 0ff26859171..2b95693f7e2 100644 --- a/core/scripts/keystone/main.go +++ b/core/scripts/keystone/main.go @@ -15,16 +15,16 @@ type command interface { func main() { commands := []command{ - src.NewDeployContractsCommand(), - src.NewDeployJobSpecsCommand(), - src.NewGenerateCribClusterOverridesPreprovisionCommand(), - src.NewGenerateCribClusterOverridesPostprovisionCommand(), - src.NewDeleteJobsCommand(), - src.NewDeployAndInitializeCapabilitiesRegistryCommand(), - src.NewDeployWorkflowsCommand(), - src.NewDeleteWorkflowsCommand(), - src.NewDeployStreamsTriggerCommand(), + src.NewProvisionKeystoneCommand(), + src.NewFundTransmittersCommand(), + src.NewProvisionOCR3CapabilityCommand(), + src.NewDeployKeystoneWorkflowsCommand(), + src.NewDeployForwarderCommand(), + src.NewPreprovisionCribCommand(), + src.NewPostprovisionCribCommand(), src.NewProvisionCapabilitesRegistryCommand(), + src.NewProvisionStreamsTriggerCommand(), + src.NewDeployAndInitializeCapabilitiesRegistryCommand(), } commandsList := func(commands []command) string { diff --git a/core/scripts/keystone/src/01_deploy_contracts_cmd.go b/core/scripts/keystone/src/01_deploy_contracts_cmd.go deleted file mode 100644 index ccc1ab7d95e..00000000000 --- a/core/scripts/keystone/src/01_deploy_contracts_cmd.go +++ /dev/null @@ -1,229 +0,0 @@ -package src - -import ( - "context" - "encoding/json" - "flag" - "fmt" - "math/big" - "os" - "path/filepath" - - "github.com/ethereum/go-ethereum/common" - - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability" -) - -type deployedContracts struct { - OCRContract common.Address `json:"ocrContract"` - ForwarderContract common.Address `json:"forwarderContract"` - CapabilityRegistry common.Address `json:"capabilityRegistry"` - // The block number of the transaction that set the config on the OCR3 contract. We use this to replay blocks from this point on - // when we load the OCR3 job specs on the nodes. - SetConfigTxBlock uint64 `json:"setConfigTxBlock"` -} - -type deployContracts struct{} - -func NewDeployContractsCommand() *deployContracts { - return &deployContracts{} -} - -func (g *deployContracts) Name() string { - return "deploy-contracts" -} - -// Run expects the follow environment variables to be set: -// -// 1. Deploys the OCR3 contract -// 2. Deploys the Forwarder contract -// 3. Sets the config on the OCR3 contract -// 4. Writes the deployed contract addresses to a file -// 5. Funds the transmitters -func (g *deployContracts) Run(args []string) { - fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) - ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") - // create flags for all of the env vars then set the env vars to normalize the interface - // this is a bit of a hack but it's the easiest way to make this work - ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") - chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") - accountKey := fs.String("accountkey", "", "private key of the account to deploy from") - skipFunding := fs.Bool("skipfunding", false, "skip funding the transmitters") - onlySetConfig := fs.Bool("onlysetconfig", false, "set the config on the OCR3 contract without deploying the contracts or funding transmitters") - dryRun := fs.Bool("dryrun", false, "dry run, don't actually deploy the contracts and do not fund transmitters") - nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") - artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") - nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") - - err := fs.Parse(args) - - if err != nil || - *ocrConfigFile == "" || ocrConfigFile == nil || - *ethUrl == "" || ethUrl == nil || - *chainID == 0 || chainID == nil || - *accountKey == "" || accountKey == nil { - fs.Usage() - os.Exit(1) - } - - if *artefactsDir == "" { - *artefactsDir = defaultArtefactsDir - } - if *nodeSetsPath == "" { - *nodeSetsPath = defaultNodeSetsPath - } - - os.Setenv("ETH_URL", *ethUrl) - os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) - os.Setenv("ACCOUNT_KEY", *accountKey) - os.Setenv("INSECURE_SKIP_VERIFY", "true") - deploy(*nodeSetsPath, *ocrConfigFile, *skipFunding, *dryRun, *onlySetConfig, *artefactsDir, *nodeSetSize) -} - -// deploy does the following: -// 1. Deploys the OCR3 contract -// 2. Deploys the Forwarder contract -// 3. Sets the config on the OCR3 contract -// 4. Writes the deployed contract addresses to a file -// 5. Funds the transmitters -func deploy( - nodeSetsPath string, - configFile string, - skipFunding bool, - dryRun bool, - onlySetConfig bool, - artefacts string, - nodeSetSize int, -) { - env := helpers.SetupEnv(false) - ocrConfig := generateOCR3Config( - configFile, - env.ChainID, - nodeSetsPath, - nodeSetSize, - ) - - if dryRun { - fmt.Println("Dry run, skipping deployment and funding") - return - } - - if onlySetConfig { - fmt.Println("Skipping deployment of contracts and skipping funding transmitters, only setting config") - setOCR3Config(env, ocrConfig, artefacts) - return - } - - if ContractsAlreadyDeployed(artefacts) { - fmt.Println("Contracts already deployed") - return - } - - fmt.Println("Deploying keystone ocr3 contract...") - ocrContract := DeployKeystoneOCR3Capability(env) - fmt.Println("Deploying keystone forwarder contract...") - forwarderContract := DeployForwarder(env) - - fmt.Println("Writing deployed contract addresses to file...") - contracts := deployedContracts{ - OCRContract: ocrContract.Address(), - ForwarderContract: forwarderContract.Address(), - } - WriteDeployedContracts(contracts, artefacts) - - setOCR3Config(env, ocrConfig, artefacts) - - if skipFunding { - fmt.Println("Skipping funding transmitters") - return - } - fmt.Println("Funding transmitters...") - transmittersStr := []string{} - for _, t := range ocrConfig.Transmitters { - transmittersStr = append(transmittersStr, t.String()) - } - - helpers.FundNodes(env, transmittersStr, big.NewInt(50000000000000000)) // 0.05 ETH -} - -func setOCR3Config( - env helpers.Environment, - ocrConfig ksdeploy.Orc2drOracleConfig, - artefacts string, -) { - loadedContracts, err := LoadDeployedContracts(artefacts) - PanicErr(err) - - ocrContract, err := ocr3_capability.NewOCR3Capability(loadedContracts.OCRContract, env.Ec) - PanicErr(err) - fmt.Println("Setting OCR3 contract config...") - fmt.Printf("Signers: %v\n", ocrConfig.Signers) - fmt.Printf("Transmitters: %v\n", ocrConfig.Transmitters) - fmt.Printf("F: %v\n", ocrConfig.F) - fmt.Printf("OnchainConfig: %v\n", ocrConfig.OnchainConfig) - fmt.Printf("OffchainConfigVersion: %v\n", ocrConfig.OffchainConfigVersion) - fmt.Printf("OffchainConfig: %v\n", ocrConfig.OffchainConfig) - tx, err := ocrContract.SetConfig(env.Owner, - ocrConfig.Signers, - ocrConfig.Transmitters, - ocrConfig.F, - ocrConfig.OnchainConfig, - ocrConfig.OffchainConfigVersion, - ocrConfig.OffchainConfig, - ) - PanicErr(err) - receipt := helpers.ConfirmTXMined(context.Background(), env.Ec, tx, env.ChainID) - // Write blocknumber of the transaction to the deployed contracts file - loadedContracts.SetConfigTxBlock = receipt.BlockNumber.Uint64() - WriteDeployedContracts(loadedContracts, artefacts) -} - -func WriteDeployedContracts(contracts deployedContracts, artefactsDir string) { - jsonBytes, err := json.Marshal(contracts) - PanicErr(err) - err = os.WriteFile(DeployedContractsFilePath(artefactsDir), jsonBytes, 0600) - PanicErr(err) -} - -func LoadDeployedContracts(artefacts string) (deployedContracts, error) { - if !ContractsAlreadyDeployed(artefacts) { - return deployedContracts{}, fmt.Errorf("no deployed contracts found, run deploy first") - } - - jsonBytes, err := os.ReadFile(DeployedContractsFilePath(artefacts)) - if err != nil { - return deployedContracts{}, err - } - - var contracts deployedContracts - err = json.Unmarshal(jsonBytes, &contracts) - return contracts, err -} - -func ContractsAlreadyDeployed(artefacts string) bool { - _, err := os.Stat(DeployedContractsFilePath(artefacts)) - return err == nil -} - -func DeployedContractsFilePath(artefacts string) string { - return filepath.Join(artefacts, deployedContractsJSON) -} - -func DeployForwarder(e helpers.Environment) *forwarder.KeystoneForwarder { - _, tx, contract, err := forwarder.DeployKeystoneForwarder(e.Owner, e.Ec) - PanicErr(err) - helpers.ConfirmContractDeployed(context.Background(), e.Ec, tx, e.ChainID) - - return contract -} - -func DeployKeystoneOCR3Capability(e helpers.Environment) *ocr3_capability.OCR3Capability { - _, tx, contract, err := ocr3_capability.DeployOCR3Capability(e.Owner, e.Ec) - PanicErr(err) - helpers.ConfirmContractDeployed(context.Background(), e.Ec, tx, e.ChainID) - - return contract -} diff --git a/core/scripts/keystone/src/01_provision_keystone.go b/core/scripts/keystone/src/01_provision_keystone.go new file mode 100644 index 00000000000..fc593ba5efd --- /dev/null +++ b/core/scripts/keystone/src/01_provision_keystone.go @@ -0,0 +1,145 @@ +package src + +import ( + "flag" + "fmt" + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" + "os" + "path/filepath" +) + +type provisionKeystone struct{} + +func NewProvisionKeystoneCommand() *provisionKeystone { + return &provisionKeystone{} +} + +func (g *provisionKeystone) Name() string { + return "provision-keystone" +} + +func (g *provisionKeystone) Run(args []string) { + fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) + preprovison := fs.Bool("preprovision", false, "Preprovision crib") + // create flags for all of the env vars then set the env vars to normalize the interface + // this is a bit of a hack but it's the easiest way to make this work + ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") + chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") + accountKey := fs.String("accountkey", "", "private key of the account to deploy from") + nodeSetsPath := fs.String("nodesets", defaultNodeSetsPath, "Custom node sets location") + nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") + replaceResources := fs.Bool("replacejob", false, "replace jobs if they already exist") + ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") + p2pPort := fs.Int64("p2pport", 6690, "p2p port") + capabilitiesP2PPort := fs.Int64("capabilitiesp2pport", 6691, "p2p port for capabilities") + templatesDir := fs.String("templates", defaultTemplatesDir, "Custom templates location") + artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") + preprovisionConfigName := fs.String("preprovisionconfig", "crib-preprovision.yaml", "Name of the preprovision config file, stored in the artefacts directory") + postprovisionConfigName := fs.String("postprovisionconfig", "crib-postprovision.yaml", "Name of the postprovision config file, stored in the artefacts directory") + + err := fs.Parse(args) + + if err != nil || + *ethUrl == "" || ethUrl == nil || + *accountKey == "" || accountKey == nil { + fs.Usage() + os.Exit(1) + } + + os.Setenv("ETH_URL", *ethUrl) + os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) + os.Setenv("ACCOUNT_KEY", *accountKey) + os.Setenv("INSECURE_SKIP_VERIFY", "true") + env := helpers.SetupEnv(false) + nodeSets := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize) + if *preprovison { + fmt.Printf("Preprovisioning crib with %d nodes\n", *nodeSetSize) + writePreprovisionConfig(*nodeSetSize, filepath.Join(*artefactsDir, *preprovisionConfigName)) + return + } + + reg := provisionCapabillitiesRegistry( + env, + nodeSets, + *chainID, + *artefactsDir, + ) + + provisionStreamsDON( + env, + nodeSets.StreamsTrigger, + *chainID, + *p2pPort, + *ocrConfigFile, + *replaceResources, + ) + + onchainMeta := provisionWorkflowDON( + env, + nodeSets.Workflow, + *chainID, + *p2pPort, + *ocrConfigFile, + *templatesDir, + *artefactsDir, + *replaceResources, + reg, + ) + + writePostProvisionConfig( + nodeSets, + *chainID, + *capabilitiesP2PPort, + onchainMeta.ForwarderContract.Address().Hex(), + onchainMeta.CapabilitiesRegistry.Address().Hex(), + filepath.Join(*artefactsDir, *postprovisionConfigName), + ) +} + +func provisionStreamsDON( + env helpers.Environment, + nodeSet NodeSet, + chainID int64, + p2pPort int64, + ocrConfigFilePath string, + replaceResources bool, +) { + setupStreamsTrigger( + env, + nodeSet, + chainID, + p2pPort, + ocrConfigFilePath, + replaceResources, + ) +} + +func provisionWorkflowDON( + env helpers.Environment, + nodeSet NodeSet, + chainID int64, + p2pPort int64, + ocrConfigFile string, + templatesDir string, + artefactsDir string, + replaceJob bool, + reg kcr.CapabilitiesRegistryInterface, +) (onchainMeta onchainMeta) { + deployForwarder(env, artefactsDir) + + onchainMeta, _ = provisionOCR3( + env, + nodeSet, + chainID, + p2pPort, + ocrConfigFile, + templatesDir, + artefactsDir, + ) + distributeFunds(nodeSet, env) + + deployKeystoneWorkflowsTo(nodeSet, reg, chainID, replaceJob) + + return onchainMeta +} diff --git a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go b/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go deleted file mode 100644 index cfa71f0022f..00000000000 --- a/core/scripts/keystone/src/02_deploy_jobspecs_cmd.go +++ /dev/null @@ -1,94 +0,0 @@ -package src - -import ( - "errors" - "flag" - "fmt" - "os" - - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" -) - -// Could be useful https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/scripts/chaincli/handler/scrape_node_config.go#L102 -type deployJobSpecs struct{} - -func NewDeployJobSpecsCommand() *deployJobSpecs { - return &deployJobSpecs{} -} - -func (g *deployJobSpecs) Name() string { - return "deploy-jobspecs" -} - -func (g *deployJobSpecs) Run(args []string) { - fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) - chainID := fs.Int64("chainid", 1337, "chain id") - p2pPort := fs.Int64("p2pport", 6690, "p2p port") - onlyReplay := fs.Bool("onlyreplay", false, "only replay the block from the OCR3 contract setConfig transaction") - templatesLocation := fs.String("templates", "", "Custom templates location") - nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") - artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") - nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") - - err := fs.Parse(args) - if err != nil || chainID == nil || *chainID == 0 || p2pPort == nil || *p2pPort == 0 || onlyReplay == nil { - fs.Usage() - os.Exit(1) - } - if *onlyReplay { - fmt.Println("Only replaying OCR3 contract setConfig transaction") - } else { - fmt.Println("Deploying OCR3 job specs") - } - - if *artefactsDir == "" { - *artefactsDir = defaultArtefactsDir - } - if *nodeSetsPath == "" { - *nodeSetsPath = defaultNodeSetsPath - } - if *templatesLocation == "" { - *templatesLocation = "templates" - } - - nodes := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize).Workflow.Nodes - deployedContracts, err := LoadDeployedContracts(*artefactsDir) - PanicErr(err) - - jobspecs := generateOCR3JobSpecs( - *nodeSetsPath, - *templatesLocation, - *chainID, *p2pPort, deployedContracts.OCRContract.Hex(), - *nodeSetSize, - ) - flattenedSpecs := []hostSpec{jobspecs.bootstrap} - flattenedSpecs = append(flattenedSpecs, jobspecs.oracles...) - - // sanity check arr lengths - if len(nodes) != len(flattenedSpecs) { - PanicErr(errors.New("Mismatched node and job spec lengths")) - } - - for i, n := range nodes { - api := newNodeAPI(n) - if !*onlyReplay { - specToDeploy := flattenedSpecs[i].spec.ToString() - specFragment := flattenedSpecs[i].spec[0:1] - fmt.Printf("Deploying jobspec: %s\n... \n", specFragment) - - _, err := api.withArg(specToDeploy).exec(api.methods.CreateJob) - if err != nil { - fmt.Println("Failed to deploy job spec:", specFragment, "Error:", err) - } - } - - fmt.Printf("Replaying from block: %d\n", deployedContracts.SetConfigTxBlock) - fmt.Printf("EVM Chain ID: %d\n\n", *chainID) - api.withFlags(api.methods.ReplayFromBlock, func(fs *flag.FlagSet) { - err = fs.Set("block-number", fmt.Sprint(deployedContracts.SetConfigTxBlock)) - helpers.PanicErr(err) - err = fs.Set("evm-chain-id", fmt.Sprint(*chainID)) - helpers.PanicErr(err) - }).mustExec() - } -} diff --git a/core/scripts/keystone/src/02_deploy_keystone_workflows.go b/core/scripts/keystone/src/02_deploy_keystone_workflows.go new file mode 100644 index 00000000000..85b8758e6ed --- /dev/null +++ b/core/scripts/keystone/src/02_deploy_keystone_workflows.go @@ -0,0 +1,174 @@ +package src + +import ( + "bytes" + "flag" + "fmt" + "html/template" + "os" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" +) + +type deployKeystoneWorkflows struct{} + +func NewDeployKeystoneWorkflowsCommand() *deployKeystoneWorkflows { + return &deployKeystoneWorkflows{} +} + +func (g *deployKeystoneWorkflows) Name() string { + return "deploy-keystone-workflows" +} + +func (g *deployKeystoneWorkflows) Run(args []string) { + fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) + chainID := fs.Int64("chainid", 1337, "chain id") + nodeSetsPath := fs.String("nodesets", defaultNodeSetsPath, "Custom node sets location") + nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") + replaceJob := fs.Bool("replacejob", false, "replace jobs if they already exist") + + ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") + accountKey := fs.String("accountkey", "", "private key of the account to deploy from") + artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") + err := fs.Parse(args) + if err != nil || + *ethUrl == "" || ethUrl == nil || + *accountKey == "" || accountKey == nil { + fs.Usage() + os.Exit(1) + } + workflowNodeSet := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize).Workflow + os.Setenv("ETH_URL", *ethUrl) + os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) + os.Setenv("ACCOUNT_KEY", *accountKey) + os.Setenv("INSECURE_SKIP_VERIFY", "true") + env := helpers.SetupEnv(false) + + o := LoadOnchainMeta(*artefactsDir, env) + deployKeystoneWorkflowsTo(workflowNodeSet, o.CapabilitiesRegistry, *chainID, *replaceJob) +} + +func deployKeystoneWorkflowsTo(nodeSet NodeSet, reg kcr.CapabilitiesRegistryInterface, chainID int64, replaceJob bool) { + fmt.Println("Deploying Keystone workflow jobs") + caps, err := reg.GetCapabilities(&bind.CallOpts{}) + PanicErr(err) + + streams := NewStreamsTriggerV1Capability() + ocr3 := NewOCR3V1ConsensusCapability() + testnetWrite := NewEthereumGethTestnetV1WriteCapability() + + capSet := NewCapabilitySet(streams, ocr3, testnetWrite) + expectedHashedCIDs := capSet.HashedIDs(reg) + + // Check that the capabilities are registered + for _, c := range caps { + found := false + for _, expected := range expectedHashedCIDs { + if c.HashedId == expected { + found = true + break + } + } + + if !found { + panic(fmt.Sprintf("Capability %s not found in registry", c.HashedId)) + } + } + + feedIds := []string{} + for _, feed := range feeds { + feedIds = append(feedIds, fmt.Sprintf("0x%x", feed.id)) + } + workflowConfig := WorkflowJobSpecConfig{ + JobSpecName: "keystone_workflow", + WorkflowOwnerAddress: "0x1234567890abcdef1234567890abcdef12345678", + FeedIDs: feedIds, + TargetID: testnetWrite.GetID(), + ConsensusID: ocr3.GetID(), + TriggerID: streams.GetID(), + TargetAddress: "0x1234567890abcdef1234567890abcdef12345678", + } + jobSpecStr := createKeystoneWorkflowJob(workflowConfig) + for _, n := range nodeSet.Nodes[1:] { // skip the bootstrap node + api := newNodeAPI(n) + maybeUpsertJob(api, workflowConfig.JobSpecName, jobSpecStr, replaceJob) + } +} + +type WorkflowJobSpecConfig struct { + JobSpecName string + WorkflowOwnerAddress string + FeedIDs []string + TargetID string + ConsensusID string + TriggerID string + TargetAddress string +} + +func createKeystoneWorkflowJob(workflowConfig WorkflowJobSpecConfig) string { + const keystoneWorkflowTemplate = ` +type = "workflow" +schemaVersion = 1 +name = "{{ .JobSpecName }}" +workflow = """ +name: "ccip_kiab1" +owner: '{{ .WorkflowOwnerAddress }}' +triggers: + - id: streams-trigger@1.0.0 + config: + maxFrequencyMs: 10000 + feedIds: +{{- range .FeedIDs }} + - '{{ . }}' +{{- end }} + +consensus: + - id: offchain_reporting@1.0.0 + ref: ccip_feeds + inputs: + observations: + - $(trigger.outputs) + config: + report_id: '0001' + key_id: 'evm' + aggregation_method: data_feeds + aggregation_config: + feeds: +{{- range .FeedIDs }} + '{{ . }}': + deviation: '0.05' + heartbeat: 1800 +{{- end }} + encoder: EVM + encoder_config: + abi: "(bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports" + abi: (bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports + +targets: + - id: {{ .TargetID }} + inputs: + signed_report: $(ccip_feeds.outputs) + config: + address: '{{ .TargetAddress }}' + deltaStage: 5s + schedule: oneAtATime + +""" +workflowOwner = "{{ .WorkflowOwnerAddress }}" +` + + tmpl, err := template.New("workflow").Parse(keystoneWorkflowTemplate) + + if err != nil { + panic(err) + } + var renderedTemplate bytes.Buffer + err = tmpl.Execute(&renderedTemplate, workflowConfig) + if err != nil { + panic(err) + } + + return renderedTemplate.String() +} diff --git a/core/scripts/keystone/src/02_deploy_keystone_workflows_test.go b/core/scripts/keystone/src/02_deploy_keystone_workflows_test.go new file mode 100644 index 00000000000..bef6a768dce --- /dev/null +++ b/core/scripts/keystone/src/02_deploy_keystone_workflows_test.go @@ -0,0 +1,21 @@ +package src + +import ( + "testing" + + "github.com/gkampitakis/go-snaps/snaps" +) + +func TestCreateKeystoneWorkflowJob(t *testing.T) { + workflowConfig := WorkflowJobSpecConfig{ + JobSpecName: "keystone_workflow", + WorkflowOwnerAddress: "0x1234567890abcdef1234567890abcdef12345678", + FeedIDs: []string{"feed1", "feed2", "feed3"}, + TargetID: "target_id", + TargetAddress: "0xabcdefabcdefabcdefabcdefabcdefabcdef", + } + + output := createKeystoneWorkflowJob(workflowConfig) + + snaps.MatchSnapshot(t, output) +} diff --git a/core/scripts/keystone/src/02_fund_transmitters.go b/core/scripts/keystone/src/02_fund_transmitters.go new file mode 100644 index 00000000000..d4803fc06f1 --- /dev/null +++ b/core/scripts/keystone/src/02_fund_transmitters.go @@ -0,0 +1,59 @@ +package src + +import ( + "flag" + "fmt" + "math/big" + "os" + + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" +) + +type fundTransmitters struct{} + +func NewFundTransmittersCommand() *fundTransmitters { + return &fundTransmitters{} +} + +func (g *fundTransmitters) Name() string { + return "fund-transmitters" +} + +func (g *fundTransmitters) Run(args []string) { + fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) + // create flags for all of the env vars then set the env vars to normalize the interface + // this is a bit of a hack but it's the easiest way to make this work + chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") + ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") + accountKey := fs.String("accountkey", "", "private key of the account to deploy from") + nodeSetsPath := fs.String("nodesets", defaultNodeSetsPath, "Custom node sets location") + nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") + + err := fs.Parse(args) + + if err != nil || + *ethUrl == "" || ethUrl == nil || + *accountKey == "" || accountKey == nil { + fs.Usage() + os.Exit(1) + } + + os.Setenv("ETH_URL", *ethUrl) + os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) + os.Setenv("ACCOUNT_KEY", *accountKey) + os.Setenv("INSECURE_SKIP_VERIFY", "true") + env := helpers.SetupEnv(false) + + nodeSet := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize).Workflow + distributeFunds(nodeSet, env) +} + +func distributeFunds(nodeSet NodeSet, env helpers.Environment) { + fmt.Println("Funding transmitters...") + transmittersStr := []string{} + for _, n := range nodeSet.NodeKeys { + transmittersStr = append(transmittersStr, n.EthAddress) + } + + helpers.FundNodes(env, transmittersStr, big.NewInt(50000000000000000)) // 0.05 ETH +} diff --git a/core/scripts/keystone/src/06_provision_capabilities_registry.go b/core/scripts/keystone/src/02_provision_capabilities_registry.go similarity index 64% rename from core/scripts/keystone/src/06_provision_capabilities_registry.go rename to core/scripts/keystone/src/02_provision_capabilities_registry.go index c6eaa49b829..14bce1c391e 100644 --- a/core/scripts/keystone/src/06_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/02_provision_capabilities_registry.go @@ -6,8 +6,6 @@ import ( "fmt" "os" - "github.com/ethereum/go-ethereum/common" - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" ) @@ -23,15 +21,13 @@ func (c *provisionCR) Name() string { } func (c *provisionCR) Run(args []string) { - ctx := context.Background() - fs := flag.NewFlagSet(c.Name(), flag.ExitOnError) ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") chainID := fs.Int64("chainid", 1337, "Chain ID of the Ethereum network to deploy to") accountKey := fs.String("accountkey", "", "Private key of the account to deploy from") nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") - nodeSetSize := fs.Int("nodeSetSize", 5, "Number of nodes in a nodeset") + nodeSetSize := fs.Int("nodesetsize", 5, "Number of nodes in a nodeset") err := fs.Parse(args) if err != nil || @@ -56,44 +52,36 @@ func (c *provisionCR) Run(args []string) { env := helpers.SetupEnv(false) - reg := getOrDeployCapabilitiesRegistry(ctx, *artefactsDir, env) - + // We skip the first node in the node set as it is the bootstrap node + // technically we could do a single addnodes call here if we merged all the nodes together nodeSets := downloadNodeSets( *chainID, *nodeSetsPath, *nodeSetSize, ) + provisionCapabillitiesRegistry(env, nodeSets, *chainID, *artefactsDir) +} +func provisionCapabillitiesRegistry(env helpers.Environment, nodeSets NodeSets, chainID int64, artefactsDir string) kcr.CapabilitiesRegistryInterface { + ctx := context.Background() + reg := deployCR(ctx, artefactsDir, env) crProvisioner := NewCapabilityRegistryProvisioner(reg, env) - - streamsTriggerCapSet := NewCapabilitySet( - NewStreamsTriggerV1Capability(), - ) - workflowCapSet := NewCapabilitySet( - NewOCR3V1ConsensusCapability(), - NewEthereumGethTestnetV1WriteCapability(), - ) - crProvisioner.AddCapabilities(ctx, streamsTriggerCapSet) - crProvisioner.AddCapabilities(ctx, workflowCapSet) - - // We skip the first node in the node set as it is the bootstrap node + streamsTriggerCapSet := NewCapabilitySet(NewStreamsTriggerV1Capability()) + workflowCapSet := NewCapabilitySet(NewOCR3V1ConsensusCapability(), NewEthereumGethTestnetV1WriteCapability()) workflowDON := nodeKeysToDON(nodeSets.Workflow.Name, nodeSets.Workflow.NodeKeys[1:], workflowCapSet) streamsTriggerDON := nodeKeysToDON(nodeSets.StreamsTrigger.Name, nodeSets.StreamsTrigger.NodeKeys[1:], streamsTriggerCapSet) - dons := map[string]DON{ - workflowDON.Name: workflowDON, - streamsTriggerDON.Name: streamsTriggerDON, - } - + crProvisioner.AddCapabilities(ctx, MergeCapabilitySets(streamsTriggerCapSet, workflowCapSet)) + dons := map[string]DON{workflowDON.Name: workflowDON, streamsTriggerDON.Name: streamsTriggerDON} nodeOperator := NewNodeOperator(env.Owner.From, "MY_NODE_OPERATOR", dons) crProvisioner.AddNodeOperator(ctx, nodeOperator) - // technically we could do a single addnodes call here if we merged all the nodes together - crProvisioner.AddNodes(ctx, nodeOperator, nodeSets.Workflow.Name) - crProvisioner.AddNodes(ctx, nodeOperator, nodeSets.StreamsTrigger.Name) + crProvisioner.AddNodes(ctx, nodeOperator, nodeSets.Workflow.Name, nodeSets.StreamsTrigger.Name) crProvisioner.AddDON(ctx, nodeOperator, nodeSets.Workflow.Name, true, true) crProvisioner.AddDON(ctx, nodeOperator, nodeSets.StreamsTrigger.Name, true, false) + + return reg } // nodeKeysToDON converts a slice of NodeKeys into a DON struct with the given name and CapabilitySet. @@ -114,28 +102,20 @@ func nodeKeysToDON(donName string, nodeKeys []NodeKeys, capSet CapabilitySet) DO } } -func getOrDeployCapabilitiesRegistry(ctx context.Context, artefactsDir string, env helpers.Environment) *kcr.CapabilitiesRegistry { - contracts, err := LoadDeployedContracts(artefactsDir) - if err != nil { - fmt.Println("Could not load deployed contracts, deploying new ones") - } - - if contracts.CapabilityRegistry.String() == (common.Address{}).String() { - _, tx, capabilitiesRegistry, innerErr := kcr.DeployCapabilitiesRegistry(env.Owner, env.Ec) - if innerErr != nil { - panic(innerErr) - } - - helpers.ConfirmContractDeployed(ctx, env.Ec, tx, env.ChainID) - contracts.CapabilityRegistry = capabilitiesRegistry.Address() - WriteDeployedContracts(contracts, artefactsDir) - return capabilitiesRegistry - } else { - capabilitiesRegistry, innerErr := kcr.NewCapabilitiesRegistry(contracts.CapabilityRegistry, env.Ec) - if innerErr != nil { - panic(innerErr) - } - - return capabilitiesRegistry - } +func deployCR(ctx context.Context, artefactsDir string, env helpers.Environment) kcr.CapabilitiesRegistryInterface { + o := LoadOnchainMeta(artefactsDir, env) + // We always redeploy the capabilities registry to ensure it is up to date + // since we don't have diffing logic to determine if it has changed + // if o.CapabilitiesRegistry != nil { + // fmt.Println("CapabilitiesRegistry already deployed, skipping...") + // return o.CapabilitiesRegistry + // } + + _, tx, capabilitiesRegistry, innerErr := kcr.DeployCapabilitiesRegistry(env.Owner, env.Ec) + PanicErr(innerErr) + helpers.ConfirmContractDeployed(ctx, env.Ec, tx, env.ChainID) + + o.CapabilitiesRegistry = capabilitiesRegistry + WriteOnchainMeta(o, artefactsDir) + return capabilitiesRegistry } diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go b/core/scripts/keystone/src/02_provision_crib.go similarity index 71% rename from core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go rename to core/scripts/keystone/src/02_provision_crib.go index 1159f66722a..c5e0bc59494 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd.go +++ b/core/scripts/keystone/src/02_provision_crib.go @@ -17,15 +17,15 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" ) -type generateCribClusterOverridesPreprovision struct{} -type generateCribClusterOverridesPostprovision struct{} +type preprovisionCrib struct{} +type postprovisionCrib struct{} -func NewGenerateCribClusterOverridesPreprovisionCommand() *generateCribClusterOverridesPreprovision { - return &generateCribClusterOverridesPreprovision{} +func NewPreprovisionCribCommand() *preprovisionCrib { + return &preprovisionCrib{} } -func NewGenerateCribClusterOverridesPostprovisionCommand() *generateCribClusterOverridesPostprovision { - return &generateCribClusterOverridesPostprovision{} +func NewPostprovisionCribCommand() *postprovisionCrib { + return &postprovisionCrib{} } type Helm struct { @@ -81,31 +81,39 @@ type Node struct { OverridesToml string `yaml:"overridesToml,omitempty"` } -func (g *generateCribClusterOverridesPreprovision) Name() string { - return "crib-config-preprovision" +func (g *preprovisionCrib) Name() string { + return "preprovision-crib" } -func (g *generateCribClusterOverridesPreprovision) Run(args []string) { +func (g *preprovisionCrib) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) - nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") + nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") outputPath := fs.String("outpath", "-", "the path to output the generated overrides (use '-' for stdout)") err := fs.Parse(args) - if err != nil || outputPath == nil || *outputPath == "" { + if err != nil { fs.Usage() os.Exit(1) } - chart := generatePreprovisionConfig(*nodeSetSize) + writePreprovisionConfig(*nodeSetSize, *outputPath) +} + +func writePreprovisionConfig(nodeSetSize int, outputPath string) { + chart := generatePreprovisionConfig(nodeSetSize) + + writeCribConfig(chart, outputPath) +} +func writeCribConfig(chart Helm, outputPath string) { yamlData, err := yaml.Marshal(chart) helpers.PanicErr(err) - if *outputPath == "-" { + if outputPath == "-" { _, err = os.Stdout.Write(yamlData) helpers.PanicErr(err) } else { - err = os.WriteFile(filepath.Join(*outputPath, "crib-preprovision.yaml"), yamlData, 0600) + err = os.WriteFile(filepath.Join(outputPath), yamlData, 0600) helpers.PanicErr(err) } } @@ -149,24 +157,35 @@ func generatePreprovisionConfig(nodeSetSize int) Helm { return helm } -func (g *generateCribClusterOverridesPostprovision) Name() string { - return "crib-config-postprovision" +func (g *postprovisionCrib) Name() string { + return "postprovision-crib" } -func (g *generateCribClusterOverridesPostprovision) Run(args []string) { +func (g *postprovisionCrib) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) chainID := fs.Int64("chainid", 1337, "chain id") + capabilitiesP2PPort := fs.Int64("capabilitiesP2PPort", 6691, "p2p port for capabilities") outputPath := fs.String("outpath", "-", "the path to output the generated overrides (use '-' for stdout)") - nodeSetSize := fs.Int("nodeSetSize", 5, "number of noes in a nodeset") + nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") + ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") + accountKey := fs.String("accountkey", "", "private key of the account to deploy from") err := fs.Parse(args) - if err != nil || outputPath == nil || *outputPath == "" || chainID == nil || *chainID == 0 { + if err != nil || *outputPath == "" || *chainID == 0 || + *ethUrl == "" || ethUrl == nil || + *accountKey == "" || accountKey == nil { fs.Usage() os.Exit(1) } + os.Setenv("ETH_URL", *ethUrl) + os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) + os.Setenv("ACCOUNT_KEY", *accountKey) + os.Setenv("INSECURE_SKIP_VERIFY", "true") + env := helpers.SetupEnv(false) + if *artefactsDir == "" { *artefactsDir = defaultArtefactsDir } @@ -174,25 +193,46 @@ func (g *generateCribClusterOverridesPostprovision) Run(args []string) { *nodeSetsPath = defaultNodeSetsPath } - contracts, err := LoadDeployedContracts(*artefactsDir) - helpers.PanicErr(err) - - chart := generatePostprovisionConfig(*chainID, *nodeSetsPath, *nodeSetSize, contracts) - - yamlData, err := yaml.Marshal(chart) - helpers.PanicErr(err) + contracts := LoadOnchainMeta(*artefactsDir, env) + nodeSets := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize) + + writePostProvisionConfig( + nodeSets, + *chainID, + *capabilitiesP2PPort, + contracts.ForwarderContract.Address().Hex(), + contracts.CapabilitiesRegistry.Address().Hex(), + *outputPath, + ) +} - if *outputPath == "-" { - _, err = os.Stdout.Write(yamlData) - helpers.PanicErr(err) - } else { - err = os.WriteFile(filepath.Join(*outputPath, "crib-postprovision.yaml"), yamlData, 0600) - helpers.PanicErr(err) - } +func writePostProvisionConfig( + nodeSets NodeSets, + chainID int64, + capabilitiesP2PPort int64, + forwarderAddress string, + capabilitiesRegistryAddress string, + outputPath string, +) { + chart := generatePostprovisionConfig( + nodeSets, + chainID, + capabilitiesP2PPort, + forwarderAddress, + capabilitiesRegistryAddress, + ) + + writeCribConfig(chart, outputPath) } -func generatePostprovisionConfig(chainID int64, nodeSetsPath string, nodeSetSize int, contracts deployedContracts) Helm { - nodeSets := downloadNodeSets(chainID, nodeSetsPath, nodeSetSize) + +func generatePostprovisionConfig( + nodeSets NodeSets, + chainID int64, + capabilitiesP2PPort int64, + forwarderAddress string, + capabillitiesRegistryAddress string, +) Helm { nodes := make(map[string]Node) nodeNames := []string{} @@ -207,7 +247,8 @@ func generatePostprovisionConfig(chainID int64, nodeSetsPath string, nodeSetSize // we do not include the bootstrapper config to itself overridesToml := generateOverridesToml( chainID, - contracts.CapabilityRegistry.Hex(), + capabilitiesP2PPort, + capabillitiesRegistryAddress, "", "", capabilitiesBootstrapper, @@ -219,7 +260,7 @@ func generatePostprovisionConfig(chainID int64, nodeSetsPath string, nodeSetSize } if nodeSet.Name == WorkflowNodeSetName { workflowBtNodeKey := nodeSets.Workflow.NodeKeys[0] // First node key as bootstrapper - wfBt, err := ocrcommontypes.NewBootstrapperLocator(workflowBtNodeKey.P2PPeerID, []string{fmt.Sprintf("%s:6691", nodeSets.Workflow.Nodes[0].ServiceName)}) + wfBt, err := ocrcommontypes.NewBootstrapperLocator(workflowBtNodeKey.P2PPeerID, []string{fmt.Sprintf("%s:%d", nodeSets.Workflow.Nodes[0].ServiceName, capabilitiesP2PPort)}) helpers.PanicErr(err) capabilitiesBootstrapper = wfBt } @@ -231,9 +272,10 @@ func generatePostprovisionConfig(chainID int64, nodeSetsPath string, nodeSetSize nodeNames = append(nodeNames, nodeName) overridesToml := generateOverridesToml( chainID, - contracts.CapabilityRegistry.Hex(), + capabilitiesP2PPort, + capabillitiesRegistryAddress, nodeKey.EthAddress, - contracts.ForwarderContract.Hex(), + forwarderAddress, capabilitiesBootstrapper, nodeSet.Name, ) @@ -262,6 +304,7 @@ func generatePostprovisionConfig(chainID int64, nodeSetsPath string, nodeSetSize func generateOverridesToml( chainID int64, + capabilitiesP2PPort int64, externalRegistryAddress string, fromAddress string, forwarderAddress string, @@ -284,7 +327,7 @@ func generateOverridesToml( Peering: toml.P2P{ V2: toml.P2PV2{ Enabled: ptr(true), - ListenAddresses: ptr([]string{"0.0.0.0:6691"}), + ListenAddresses: ptr([]string{fmt.Sprintf("0.0.0.0:%d", capabilitiesP2PPort)}), }, }, }, diff --git a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go b/core/scripts/keystone/src/02_provision_crib_test.go similarity index 66% rename from core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go rename to core/scripts/keystone/src/02_provision_crib_test.go index 85a5e44bd73..4e4cbf1efd5 100644 --- a/core/scripts/keystone/src/03_gen_crib_cluster_overrides_cmd_test.go +++ b/core/scripts/keystone/src/02_provision_crib_test.go @@ -4,24 +4,21 @@ import ( "strings" "testing" + "github.com/ethereum/go-ethereum/common" "github.com/gkampitakis/go-snaps/snaps" "gopkg.in/yaml.v3" ) func TestGeneratePostprovisionConfig(t *testing.T) { chainID := int64(1337) + capabilitiesP2PPort := int64(6691) nodeSetsPath := "./testdata/node_sets.json" - - contracts := deployedContracts{ - OCRContract: [20]byte{0: 1}, - ForwarderContract: [20]byte{0: 2}, - CapabilityRegistry: [20]byte{0: 3}, - SetConfigTxBlock: 0, - } - nodeSetSize := 5 + forwarderAddress := common.Address([20]byte{0: 1}).Hex() + capabilitiesRegistryAddress := common.Address([20]byte{0: 2}).Hex() + nodeSets := downloadNodeSets(chainID, nodeSetsPath, nodeSetSize) - chart := generatePostprovisionConfig(chainID, nodeSetsPath, nodeSetSize, contracts) + chart := generatePostprovisionConfig(nodeSets, chainID, capabilitiesP2PPort, forwarderAddress, capabilitiesRegistryAddress) yamlData, err := yaml.Marshal(chart) if err != nil { diff --git a/core/scripts/keystone/src/02_provision_forwarder_contract.go b/core/scripts/keystone/src/02_provision_forwarder_contract.go new file mode 100644 index 00000000000..711a90b3bc1 --- /dev/null +++ b/core/scripts/keystone/src/02_provision_forwarder_contract.go @@ -0,0 +1,71 @@ +package src + +import ( + "context" + "flag" + "fmt" + "os" + + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder" +) + +type provisionForwarderContract struct{} + +func NewDeployForwarderCommand() *provisionForwarderContract { + return &provisionForwarderContract{} +} + +func (g *provisionForwarderContract) Name() string { + return "provision-forwarder-contract" +} + +func (g *provisionForwarderContract) Run(args []string) { + fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) + // create flags for all of the env vars then set the env vars to normalize the interface + // this is a bit of a hack but it's the easiest way to make this work + ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") + chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") + accountKey := fs.String("accountkey", "", "private key of the account to deploy from") + artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") + + err := fs.Parse(args) + + if err != nil || + *ethUrl == "" || ethUrl == nil || + *accountKey == "" || accountKey == nil { + fs.Usage() + os.Exit(1) + } + + os.Setenv("ETH_URL", *ethUrl) + os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) + os.Setenv("ACCOUNT_KEY", *accountKey) + os.Setenv("INSECURE_SKIP_VERIFY", "true") + env := helpers.SetupEnv(false) + + deployForwarder(env, *artefactsDir) +} + +func deployForwarder( + env helpers.Environment, + artefacts string, +) { + o := LoadOnchainMeta(artefacts, env) + if o.ForwarderContract != nil { + fmt.Println("Forwarder contract already deployed, skipping") + } + + fmt.Println("Deploying forwarder contract...") + forwarderContract := DeployForwarder(env) + o.ForwarderContract = forwarderContract + WriteOnchainMeta(o, artefacts) +} + +func DeployForwarder(e helpers.Environment) *forwarder.KeystoneForwarder { + _, tx, contract, err := forwarder.DeployKeystoneForwarder(e.Owner, e.Ec) + PanicErr(err) + helpers.ConfirmContractDeployed(context.Background(), e.Ec, tx, e.ChainID) + + return contract +} diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability.go b/core/scripts/keystone/src/02_provision_ocr3_capability.go new file mode 100644 index 00000000000..49e47b890b3 --- /dev/null +++ b/core/scripts/keystone/src/02_provision_ocr3_capability.go @@ -0,0 +1,296 @@ +package src + +import ( + "path/filepath" + "strconv" + "strings" + + "context" + "errors" + "flag" + "fmt" + "os" + + ksdeploy "github.com/smartcontractkit/chainlink/integration-tests/deployment/keystone" + + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability" +) + +type provisionOCR3Capability struct{} + +func NewProvisionOCR3CapabilityCommand() *provisionOCR3Capability { + return &provisionOCR3Capability{} +} + +func (g *provisionOCR3Capability) Name() string { + return "provision-ocr3-capability" +} + +func (g *provisionOCR3Capability) Run(args []string) { + fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) + ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") + ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") + chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") + p2pPort := fs.Int64("p2pport", 6690, "p2p port") + accountKey := fs.String("accountkey", "", "private key of the account to deploy from") + nodeSetsPath := fs.String("nodesets", defaultNodeSetsPath, "Custom node sets location") + nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") + artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") + templatesLocation := fs.String("templates", defaultTemplatesDir, "Custom templates location") + + err := fs.Parse(args) + + if err != nil || + *accountKey == "" || accountKey == nil { + fs.Usage() + os.Exit(1) + } + + // use flags for all of the env vars then set the env vars to normalize the interface + // this is a bit of a hack but it's the easiest way to make this work + os.Setenv("ETH_URL", *ethUrl) + os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) + os.Setenv("ACCOUNT_KEY", *accountKey) + os.Setenv("INSECURE_SKIP_VERIFY", "true") + env := helpers.SetupEnv(false) + + nodeSet := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize).Workflow + + provisionOCR3( + env, + nodeSet, + *chainID, + *p2pPort, + *ocrConfigFile, + *templatesLocation, + *artefactsDir, + ) +} + +func provisionOCR3( + env helpers.Environment, + nodeSet NodeSet, + chainID int64, + p2pPort int64, + ocrConfigFile string, + templatesLocation string, + artefactsDir string, +) (onchainMeta onchainMeta, cacheHit bool) { + onchainMeta, cacheHit = deployOCR3Contract( + nodeSet, + env, + ocrConfigFile, + artefactsDir, + ) + + deployOCR3JobSpecsTo( + nodeSet, + chainID, + p2pPort, + templatesLocation, + artefactsDir, + onchainMeta, + cacheHit, + ) + + return +} + +func deployOCR3Contract( + nodeSet NodeSet, + env helpers.Environment, + configFile string, + artefacts string, +) (o onchainMeta, cacheHit bool) { + o = LoadOnchainMeta(artefacts, env) + if o.OCRContract != nil { + fmt.Println("OCR3 Contract already deployed, skipping...") + return o, true + } + + fmt.Println("Deploying keystone ocr3 contract...") + _, tx, ocrContract, err := ocr3_capability.DeployOCR3Capability(env.Owner, env.Ec) + PanicErr(err) + helpers.ConfirmContractDeployed(context.Background(), env.Ec, tx, env.ChainID) + + ocrConf := generateOCR3Config( + nodeSet, + configFile, + env.ChainID, + ) + + fmt.Println("Setting OCR3 contract config...") + fmt.Printf("Signers: %v\n", ocrConf.Signers) + fmt.Printf("Transmitters: %v\n", ocrConf.Transmitters) + fmt.Printf("F: %v\n", ocrConf.F) + fmt.Printf("OnchainConfig: %v\n", ocrConf.OnchainConfig) + fmt.Printf("OffchainConfigVersion: %v\n", ocrConf.OffchainConfigVersion) + fmt.Printf("OffchainConfig: %v\n", ocrConf.OffchainConfig) + tx, err = ocrContract.SetConfig(env.Owner, + ocrConf.Signers, + ocrConf.Transmitters, + ocrConf.F, + ocrConf.OnchainConfig, + ocrConf.OffchainConfigVersion, + ocrConf.OffchainConfig, + ) + PanicErr(err) + + receipt := helpers.ConfirmTXMined(context.Background(), env.Ec, tx, env.ChainID) + o.SetConfigTxBlock = receipt.BlockNumber.Uint64() + o.OCRContract = ocrContract + WriteOnchainMeta(o, artefacts) + + return o, false +} + +func deployOCR3JobSpecsTo( + nodeSet NodeSet, + chainID int64, + p2pPort int64, + templatesDir string, + artefactsDir string, + onchainMeta onchainMeta, + replaceJob bool, +) { + + jobspecs := generateOCR3JobSpecs( + nodeSet, + templatesDir, + chainID, + p2pPort, + onchainMeta.OCRContract.Address().Hex(), + ) + flattenedSpecs := []hostSpec{jobspecs.bootstrap} + flattenedSpecs = append(flattenedSpecs, jobspecs.oracles...) + + if len(nodeSet.Nodes) != len(flattenedSpecs) { + PanicErr(errors.New("Mismatched node and job spec lengths")) + } + + for i, n := range nodeSet.Nodes { + api := newNodeAPI(n) + specToDeploy := flattenedSpecs[i].spec.ToString() + maybeUpsertJob(api, specToDeploy, specToDeploy, replaceJob) + + fmt.Printf("Replaying from block: %d\n", onchainMeta.SetConfigTxBlock) + fmt.Printf("EVM Chain ID: %d\n\n", chainID) + api.withFlags(api.methods.ReplayFromBlock, func(fs *flag.FlagSet) { + err := fs.Set("block-number", fmt.Sprint(onchainMeta.SetConfigTxBlock)) + helpers.PanicErr(err) + err = fs.Set("evm-chain-id", fmt.Sprint(chainID)) + helpers.PanicErr(err) + }).mustExec() + } +} + +type spec []string + +func (s spec) ToString() string { + return strings.Join(s, "\n") +} + +type hostSpec struct { + spec spec + host string +} + +type donHostSpec struct { + bootstrap hostSpec + oracles []hostSpec +} + +func generateOCR3JobSpecs( + nodeSet NodeSet, + templatesDir string, + chainID int64, + p2pPort int64, + ocrConfigContractAddress string, +) donHostSpec { + nodeKeys := nodeKeysToKsDeployNodeKeys(nodeSet.NodeKeys) + nodes := nodeSet.Nodes + bootstrapNode := nodeKeys[0] + + bootstrapSpecLines, err := readLines(filepath.Join(templatesDir, bootstrapSpecTemplate)) + helpers.PanicErr(err) + bootHost := nodes[0].ServiceName + bootstrapSpecLines = replaceOCR3TemplatePlaceholders( + bootstrapSpecLines, + chainID, p2pPort, + ocrConfigContractAddress, bootHost, + bootstrapNode, bootstrapNode, + ) + bootstrap := hostSpec{bootstrapSpecLines, bootHost} + + oracleSpecLinesTemplate, err := readLines(filepath.Join(templatesDir, oracleSpecTemplate)) + helpers.PanicErr(err) + oracles := []hostSpec{} + for i := 1; i < len(nodes); i++ { + oracleSpecLines := oracleSpecLinesTemplate + oracleSpecLines = replaceOCR3TemplatePlaceholders( + oracleSpecLines, + chainID, p2pPort, + ocrConfigContractAddress, bootHost, + bootstrapNode, nodeKeys[i], + ) + oracles = append(oracles, hostSpec{oracleSpecLines, nodes[i].RemoteURL.Host}) + } + + return donHostSpec{ + bootstrap: bootstrap, + oracles: oracles, + } +} + +func replaceOCR3TemplatePlaceholders( + lines []string, + + chainID, p2pPort int64, + contractAddress, bootHost string, + boot, node ksdeploy.NodeKeys, +) (output []string) { + chainIDStr := strconv.FormatInt(chainID, 10) + bootstrapper := fmt.Sprintf("%s@%s:%d", boot.P2PPeerID, bootHost, p2pPort) + for _, l := range lines { + l = strings.Replace(l, "{{ chain_id }}", chainIDStr, 1) + l = strings.Replace(l, "{{ ocr_config_contract_address }}", contractAddress, 1) + l = strings.Replace(l, "{{ transmitter_id }}", node.EthAddress, 1) + l = strings.Replace(l, "{{ ocr_key_bundle_id }}", node.OCR2BundleID, 1) + l = strings.Replace(l, "{{ aptos_key_bundle_id }}", node.AptosBundleID, 1) + l = strings.Replace(l, "{{ bootstrapper_p2p_id }}", bootstrapper, 1) + output = append(output, l) + } + return +} + +func mustReadConfig(fileName string) (output ksdeploy.TopLevelConfigSource) { + return mustReadJSON[ksdeploy.TopLevelConfigSource](fileName) +} + +func generateOCR3Config(nodeSet NodeSet, configFile string, chainID int64) ksdeploy.Orc2drOracleConfig { + topLevelCfg := mustReadConfig(configFile) + cfg := topLevelCfg.OracleConfig + c, err := ksdeploy.GenerateOCR3Config(cfg, nodeKeysToKsDeployNodeKeys(nodeSet.NodeKeys[1:])) // skip the bootstrap node + helpers.PanicErr(err) + return c +} + +func nodeKeysToKsDeployNodeKeys(nks []NodeKeys) []ksdeploy.NodeKeys { + keys := []ksdeploy.NodeKeys{} + for _, nk := range nks { + keys = append(keys, ksdeploy.NodeKeys{ + EthAddress: nk.EthAddress, + AptosAccount: nk.AptosAccount, + AptosBundleID: nk.AptosBundleID, + AptosOnchainPublicKey: nk.AptosOnchainPublicKey, + P2PPeerID: nk.P2PPeerID, + OCR2BundleID: nk.OCR2BundleID, + OCR2OnchainPublicKey: nk.OCR2OnchainPublicKey, + OCR2OffchainPublicKey: nk.OCR2OffchainPublicKey, + OCR2ConfigPublicKey: nk.OCR2ConfigPublicKey, + CSAPublicKey: nk.CSAPublicKey, + }) + } + return keys +} diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability_test.go b/core/scripts/keystone/src/02_provision_ocr3_capability_test.go new file mode 100644 index 00000000000..9624ff5c33c --- /dev/null +++ b/core/scripts/keystone/src/02_provision_ocr3_capability_test.go @@ -0,0 +1,61 @@ +package src + +import ( + "errors" + "fmt" + "testing" + + "github.com/gkampitakis/go-snaps/match" + "github.com/gkampitakis/go-snaps/snaps" +) + +func TestGenerateOCR3Config(t *testing.T) { + // Generate OCR3 config + nodeSet := downloadNodeSets(1337, "./testdata/node_sets.json", 4) + config := generateOCR3Config(nodeSet.Workflow, "./testdata/SampleConfig.json", 1337) + + matchOffchainConfig := match.Custom("OffchainConfig", func(s any) (any, error) { + // coerce the value to a string + s, ok := s.(string) + if !ok { + return nil, errors.New("offchain config is not a string") + } + + // if the string is not empty + if s == "" { + return nil, errors.New("offchain config is empty") + } + + return "", nil + }) + + snaps.MatchJSON(t, config, matchOffchainConfig) +} + +func (d *donHostSpec) ToString() string { + var result string + result += "Bootstrap:\n" + result += "Host: " + d.bootstrap.host + "\n" + result += d.bootstrap.spec.ToString() + result += "\n\nOracles:\n" + for i, oracle := range d.oracles { + if i != 0 { + result += "--------------------------------\n" + } + result += fmt.Sprintf("Oracle %d:\n", i) + result += "Host: " + oracle.host + "\n" + result += oracle.spec.ToString() + result += "\n\n" + } + return result +} + +func TestGenSpecs(t *testing.T) { + nodeSetsPath := "./testdata/node_sets.json" + chainID := int64(1337) + p2pPort := int64(6690) + contractAddress := "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" + nodeSet := downloadNodeSets(chainID, nodeSetsPath, 4).Workflow + specs := generateOCR3JobSpecs(nodeSet, "../templates", chainID, p2pPort, contractAddress) + snaps.MatchSnapshot(t, specs.ToString()) +} diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go similarity index 76% rename from core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go rename to core/scripts/keystone/src/02_provision_streams_trigger_capability.go index 6076ef9fe06..a1dcd7173e6 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd.go +++ b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go @@ -51,59 +51,24 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/web/presenters" ) -type feed struct { - id [32]byte - name string - - // we create a bridge for each feed - bridgeName string - bridgeUrl string -} - -func v3FeedID(id [32]byte) [32]byte { - - binary.BigEndian.PutUint16(id[:2], 3) - return id -} - -var feeds = []feed{ - { - v3FeedID([32]byte{5: 1}), - "BTC/USD", - "mock-bridge-btc", - "http://external-adapter:4001", - }, - { - v3FeedID([32]byte{5: 2}), - "LINK/USD", - "mock-bridge-link", - "http://external-adapter:4002", - }, - { - v3FeedID([32]byte{5: 3}), - "NATIVE/USD", - "mock-bridge-native", - "http://external-adapter:4003", - }, -} - -type deployStreamsTrigger struct{} +type provisionStreamsTrigger struct{} -func NewDeployStreamsTriggerCommand() *deployStreamsTrigger { - return &deployStreamsTrigger{} +func NewProvisionStreamsTriggerCommand() *provisionStreamsTrigger { + return &provisionStreamsTrigger{} } -func (g *deployStreamsTrigger) Name() string { - return "deploy-streams-trigger" +func (g *provisionStreamsTrigger) Name() string { + return "provision-streams-trigger-capability" } -func (g *deployStreamsTrigger) Run(args []string) { +func (g *provisionStreamsTrigger) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) chainID := fs.Int64("chainid", 1337, "chain id") + p2pPort := fs.Int64("p2pport", 6690, "p2p port") ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") - force := fs.Bool("force", false, "Force deployment") - nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") + replaceResources := fs.Bool("replaceresources", false, "Replace bridges and jobs if they already exist") + nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") accountKey := fs.String("accountkey", "", "private key of the account to deploy from") @@ -129,30 +94,70 @@ func (g *deployStreamsTrigger) Run(args []string) { env := helpers.SetupEnv(false) - setupMercuryV03( + nodeSet := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize).StreamsTrigger + setupStreamsTrigger( env, - *ocrConfigFile, + nodeSet, *chainID, - *nodeSetsPath, - *nodeSetSize, - *force, + *p2pPort, + *ocrConfigFile, + *replaceResources, ) } +type feed struct { + id [32]byte + name string + + // we create a bridge for each feed + bridgeName string + bridgeUrl string +} + +func v3FeedID(id [32]byte) [32]byte { + binary.BigEndian.PutUint16(id[:2], 3) + return id +} + +var feeds = []feed{ + { + v3FeedID([32]byte{5: 1}), + "BTC/USD", + "mock-bridge-btc", + "http://external-adapter:4001", + }, + { + v3FeedID([32]byte{5: 2}), + "LINK/USD", + "mock-bridge-link", + "http://external-adapter:4002", + }, + { + v3FeedID([32]byte{5: 3}), + "NATIVE/USD", + "mock-bridge-native", + "http://external-adapter:4003", + }, +} + // See /core/services/ocr2/plugins/mercury/integration_test.go -func setupMercuryV03(env helpers.Environment, ocrConfigFilePath string, chainId int64, nodeSetsPath string, nodeSetSize int, force bool) { +func setupStreamsTrigger( + env helpers.Environment, + nodeSet NodeSet, + chainId int64, + p2pPort int64, + ocrConfigFilePath string, + replaceResources bool, +) { fmt.Printf("Deploying streams trigger for chain %d\n", chainId) fmt.Printf("Using OCR config file: %s\n", ocrConfigFilePath) - fmt.Printf("Using node sets: %s\n", nodeSetsPath) - fmt.Printf("Force: %t\n\n", force) + fmt.Printf("ReplaceResources: %t\n\n", replaceResources) fmt.Printf("Deploying Mercury V0.3 contracts\n") _, _, _, verifier := deployMercuryV03Contracts(env) - nodeSets := downloadNodeSets(chainId, nodeSetsPath, nodeSetSize) - - fmt.Printf("Generating OCR3 config\n") - ocrConfig := generateMercuryOCR2Config(nodeSets.StreamsTrigger.NodeKeys[1:]) // skip the bootstrap node + fmt.Printf("Generating Mercury OCR config\n") + ocrConfig := generateMercuryOCR2Config(nodeSet.NodeKeys[1:]) // skip the bootstrap node for _, feed := range feeds { fmt.Println("Configuring feeds...") @@ -181,31 +186,10 @@ func setupMercuryV03(env helpers.Environment, ocrConfigFilePath string, chainId PanicErr(err) fmt.Printf("Deploying OCR2 job specs for feed %s\n", feed.name) - deployOCR2JobSpecsForFeed(nodeSets.StreamsTrigger, verifier, feed, chainId, force) + deployOCR2JobSpecsForFeed(nodeSet, verifier, feed, chainId, p2pPort, replaceResources) } fmt.Println("Finished deploying streams trigger") - - fmt.Println("Deploying Keystone workflow job") - - feedIds := []string{} - for _, feed := range feeds { - feedIds = append(feedIds, fmt.Sprintf("0x%x", feed.id)) - } - writeTarget := NewEthereumGethTestnetV1WriteCapability().baseCapability.capability - writeTargetID := fmt.Sprintf("%s@%s", writeTarget.LabelledName, writeTarget.Version) - workflowConfig := WorkflowJobSpecConfig{ - JobSpecName: "keystone_workflow", - WorkflowOwnerAddress: "0x1234567890abcdef1234567890abcdef12345678", - FeedIDs: feedIds, - TargetID: writeTargetID, - TargetAddress: "0x1234567890abcdef1234567890abcdef12345678", - } - jobSpecStr := createKeystoneWorkflowJob(workflowConfig) - for _, n := range nodeSets.Workflow.Nodes[1:] { // skip the bootstrap node - api := newNodeAPI(n) - upsertJob(api, workflowConfig.JobSpecName, jobSpecStr, force) - } } func deployMercuryV03Contracts(env helpers.Environment) (linkToken *link_token_interface.LinkToken, nativeToken *link_token_interface.LinkToken, verifierProxy *verifier_proxy.VerifierProxy, verifier *verifierContract.Verifier) { @@ -245,7 +229,7 @@ func deployMercuryV03Contracts(env helpers.Environment) (linkToken *link_token_i return } -func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier *verifierContract.Verifier, feed feed, chainId int64, force bool) { +func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier *verifierContract.Verifier, feed feed, chainId int64, p2pPort int64, replaceJob bool) { // we assign the first node as the bootstrap node for i, n := range nodeSet.NodeKeys { // parallel arrays @@ -253,7 +237,7 @@ func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier *verifierContract.Verif jobSpecName := "" jobSpecStr := "" - createBridgeIfDoesNotExist(api, feed.bridgeName, feed.bridgeUrl, force) + createBridgeIfDoesNotExist(api, feed.bridgeName, feed.bridgeUrl, replaceJob) if i == 0 { // Prepare data for Bootstrap Job @@ -270,7 +254,7 @@ func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier *verifierContract.Verif // Prepare data for Mercury V3 Job mercuryData := MercuryV3JobSpecData{ FeedName: fmt.Sprintf("feed-%s", feed.name), - BootstrapHost: fmt.Sprintf("%s@%s:%s", nodeSet.NodeKeys[0].P2PPeerID, nodeSet.Nodes[0].ServiceName, "6690"), + BootstrapHost: fmt.Sprintf("%s@%s:%s", nodeSet.NodeKeys[0].P2PPeerID, nodeSet.Nodes[0].ServiceName, p2pPort), VerifierAddress: verifier.Address().Hex(), Bridge: feed.bridgeName, NodeCSAKey: n.CSAPublicKey, @@ -282,113 +266,15 @@ func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier *verifierContract.Verif } // Create Mercury V3 Job - jobSpecName, jobSpecStr = createMercuryV3Job(mercuryData) + jobSpecName, jobSpecStr = createMercuryV3OracleJob(mercuryData) } - upsertJob(api, jobSpecName, jobSpecStr, force) - } -} - -func upsertJob(api *nodeAPI, jobSpecName string, jobSpecStr string, upsert bool) { - jobsResp := api.mustExec(api.methods.ListJobs) - jobs := mustJSON[[]JobSpec](jobsResp) - for _, job := range *jobs { - if job.Name == jobSpecName { - if !upsert { - fmt.Printf("Job already exists: %s, skipping..\n", jobSpecName) - return - } - - fmt.Printf("Job already exists: %s, replacing..\n", jobSpecName) - api.withArg(job.Id).mustExec(api.methods.DeleteJob) - fmt.Printf("Deleted job: %s\n", jobSpecName) - break - } - } - - fmt.Printf("Deploying jobspec: %s\n... \n", jobSpecStr) - _, err := api.withArg(jobSpecStr).exec(api.methods.CreateJob) - if err != nil { - panic(fmt.Sprintf("Failed to deploy job spec: %s Error: %s", jobSpecStr, err)) - } -} - -type WorkflowJobSpecConfig struct { - JobSpecName string - WorkflowOwnerAddress string - FeedIDs []string - TargetID string - TargetAddress string -} - -func createKeystoneWorkflowJob(workflowConfig WorkflowJobSpecConfig) string { - const keystoneWorkflowTemplate = ` -type = "workflow" -schemaVersion = 1 -name = "{{ .JobSpecName }}" -workflow = """ -name: "ccip_kiab1" -owner: '{{ .WorkflowOwnerAddress }}' -triggers: - - id: streams-trigger@1.0.0 - config: - maxFrequencyMs: 10000 - feedIds: -{{- range .FeedIDs }} - - '{{ . }}' -{{- end }} - -consensus: - - id: offchain_reporting@1.0.0 - ref: ccip_feeds - inputs: - observations: - - $(trigger.outputs) - config: - report_id: '0001' - key_id: 'evm' - aggregation_method: data_feeds - aggregation_config: - feeds: -{{- range .FeedIDs }} - '{{ . }}': - deviation: '0.05' - heartbeat: 1800 -{{- end }} - encoder: EVM - encoder_config: - abi: "(bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports" - abi: (bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports - -targets: - - id: {{ .TargetID }} - inputs: - signed_report: $(ccip_feeds.outputs) - config: - address: '{{ .TargetAddress }}' - deltaStage: 5s - schedule: oneAtATime - -""" -workflowOwner = "{{ .WorkflowOwnerAddress }}" -` - - tmpl, err := template.New("workflow").Parse(keystoneWorkflowTemplate) - - if err != nil { - panic(err) + maybeUpsertJob(api, jobSpecName, jobSpecStr, replaceJob) } - var renderedTemplate bytes.Buffer - err = tmpl.Execute(&renderedTemplate, workflowConfig) - if err != nil { - panic(err) - } - - return renderedTemplate.String() } // Template definitions -const bootstrapJobTemplate = ` +const mercuryV3OCR2bootstrapJobTemplate = ` type = "bootstrap" relay = "evm" schemaVersion = 1 @@ -402,7 +288,7 @@ chainID = {{ .ChainID }} enableTriggerCapability = true ` -const mercuryV3JobTemplate = ` +const mercuryV3OCR2OracleJobTemplate = ` type = "offchainreporting2" schemaVersion = 1 name = "{{ .Name }}" @@ -467,7 +353,7 @@ func createMercuryV3BootstrapJob(data MercuryV3BootstrapJobSpecData) (name strin fmt.Printf("Creating bootstrap job (%s):\nverifier address: %s\nfeed name: %s\nfeed ID: %s\nchain ID: %d\n", name, data.VerifierAddress, data.FeedName, data.FeedID, data.ChainID) - tmpl, err := template.New("bootstrapJob").Parse(bootstrapJobTemplate) + tmpl, err := template.New("bootstrapJob").Parse(mercuryV3OCR2bootstrapJobTemplate) PanicErr(err) var buf bytes.Buffer @@ -479,14 +365,14 @@ func createMercuryV3BootstrapJob(data MercuryV3BootstrapJobSpecData) (name strin return name, jobSpecStr } -// createMercuryV3Job creates a Mercury V3 job specification using the provided data. -func createMercuryV3Job(data MercuryV3JobSpecData) (name string, jobSpecStr string) { +// createMercuryV3OracleJob creates a Mercury V3 job specification using the provided data. +func createMercuryV3OracleJob(data MercuryV3JobSpecData) (name string, jobSpecStr string) { name = fmt.Sprintf("mercury-%s", data.FeedName) data.Name = name fmt.Printf("Creating ocr2 job(%s):\nOCR key bundle ID: %s\nverifier address: %s\nbridge: %s\nnodeCSAKey: %s\nfeed name: %s\nfeed ID: %s\nlink feed ID: %s\nnative feed ID: %s\nchain ID: %d\n", data.Name, data.OCRKeyBundleID, data.VerifierAddress, data.Bridge, data.NodeCSAKey, data.FeedName, data.FeedID, data.LinkFeedID, data.NativeFeedID, data.ChainID) - tmpl, err := template.New("mercuryV3Job").Parse(mercuryV3JobTemplate) + tmpl, err := template.New("mercuryV3Job").Parse(mercuryV3OCR2OracleJobTemplate) PanicErr(err) var buf bytes.Buffer @@ -511,7 +397,7 @@ func strToBytes32(str string) [32]byte { return pkBytesFixed } -func createBridgeIfDoesNotExist(api *nodeAPI, name string, eaURL string, force bool) { +func createBridgeIfDoesNotExist(api *nodeAPI, name string, eaURL string, replaceBridge bool) { u, err := url.Parse(eaURL) url := models.WebURL(*u) // Confirmations and MinimumContractPayment are not used, so we can leave them as 0 @@ -525,8 +411,8 @@ func createBridgeIfDoesNotExist(api *nodeAPI, name string, eaURL string, force b fmt.Printf("Creating bridge (%s): %s\n", name, eaURL) if doesBridgeExist(api, name) { - if force { - fmt.Println("Force flag is set, updating existing bridge") + if replaceBridge { + fmt.Println("Updating existing bridge") api.withArgs(name, payload).mustExec(api.methods.UpdateBridge) fmt.Println("Updated bridge", name) } else { diff --git a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go b/core/scripts/keystone/src/02_provision_streams_trigger_capability_test.go similarity index 72% rename from core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go rename to core/scripts/keystone/src/02_provision_streams_trigger_capability_test.go index 7aa9970971d..3a2234ba4d7 100644 --- a/core/scripts/keystone/src/03_deploy_streams_trigger_cmd_test.go +++ b/core/scripts/keystone/src/02_provision_streams_trigger_capability_test.go @@ -38,7 +38,7 @@ func TestCreateMercuryV3Job(t *testing.T) { NativeFeedID: nativeFeedID, ChainID: chainID, } - _, output := createMercuryV3Job(jobConfigData) + _, output := createMercuryV3OracleJob(jobConfigData) snaps.MatchSnapshot(t, output) } @@ -55,16 +55,3 @@ func TestCreateMercuryBootstrapJob(t *testing.T) { snaps.MatchSnapshot(t, output) } -func TestCreateKeystoneWorkflowJob(t *testing.T) { - workflowConfig := WorkflowJobSpecConfig{ - JobSpecName: "keystone_workflow", - WorkflowOwnerAddress: "0x1234567890abcdef1234567890abcdef12345678", - FeedIDs: []string{"feed1", "feed2", "feed3"}, - TargetID: "target_id", - TargetAddress: "0xabcdefabcdefabcdefabcdefabcdefabcdef", - } - - output := createKeystoneWorkflowJob(workflowConfig) - - snaps.MatchSnapshot(t, output) -} diff --git a/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go b/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go deleted file mode 100644 index 15c04db30a8..00000000000 --- a/core/scripts/keystone/src/04_delete_ocr3_jobs_cmd.go +++ /dev/null @@ -1,85 +0,0 @@ -package src - -import ( - "encoding/json" - "flag" - "fmt" - "os" - - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" -) - -type deleteJobs struct{} - -type OCRSpec struct { - ContractID string -} - -type BootSpec struct { - ContractID string -} - -type WorkflowSpec struct { - WorkflowID string -} - -type JobSpec struct { - Id string - Name string - BootstrapSpec BootSpec - OffChainReporting2OracleSpec OCRSpec - WorkflowSpec WorkflowSpec -} - -func NewDeleteJobsCommand() *deleteJobs { - return &deleteJobs{} -} - -func (g *deleteJobs) Name() string { - return "delete-ocr3-jobs" -} - -func (g *deleteJobs) Run(args []string) { - fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) - chainID := fs.Int64("chainid", 1337, "chain id") - nodeSetsPath := fs.String("nodes", "", "Custom node sets location") - artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") - nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") - - err := fs.Parse(args) - if err != nil { - fs.Usage() - os.Exit(1) - } - - if *artefactsDir == "" { - *artefactsDir = defaultArtefactsDir - } - if *nodeSetsPath == "" { - *nodeSetsPath = defaultNodeSetsPath - } - - deployedContracts, err := LoadDeployedContracts(*artefactsDir) - if err != nil { - fmt.Println("Error loading deployed contracts, skipping:", err) - return - } - nodes := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize).Workflow.Nodes - - for _, node := range nodes { - api := newNodeAPI(node) - jobsb := api.mustExec(api.methods.ListJobs) - - var parsed []JobSpec - err = json.Unmarshal(jobsb, &parsed) - helpers.PanicErr(err) - - for _, jobSpec := range parsed { - if jobSpec.BootstrapSpec.ContractID == deployedContracts.OCRContract.String() || - jobSpec.OffChainReporting2OracleSpec.ContractID == deployedContracts.OCRContract.String() { - fmt.Println("Deleting OCR3 job ID:", jobSpec.Id, "name:", jobSpec.Name) - api.withArg(jobSpec.Id).mustExec(api.methods.DeleteJob) - } - } - } -} diff --git a/core/scripts/keystone/src/06_deploy_workflows_cmd.go b/core/scripts/keystone/src/06_deploy_workflows_cmd.go deleted file mode 100644 index 50b579cfcad..00000000000 --- a/core/scripts/keystone/src/06_deploy_workflows_cmd.go +++ /dev/null @@ -1,72 +0,0 @@ -package src - -import ( - "bytes" - "errors" - "flag" - "fmt" - "os" - - "github.com/urfave/cli" - - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" -) - -type deployWorkflows struct{} - -func NewDeployWorkflowsCommand() *deployWorkflows { - return &deployWorkflows{} -} - -func (g *deployWorkflows) Name() string { - return "deploy-workflows" -} - -func (g *deployWorkflows) Run(args []string) { - fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) - chainID := fs.Int64("chainid", 1337, "chain id") - workflowFile := fs.String("workflow", "workflow.yml", "path to workflow file") - nodeSets := fs.String("nodes", "", "Custom node sets location") - nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") - err := fs.Parse(args) - if err != nil || workflowFile == nil || *workflowFile == "" || nodeSetSize == nil || *nodeSetSize == 0 { - fs.Usage() - os.Exit(1) - } - if *nodeSets == "" { - *nodeSets = defaultNodeSetsPath - } - fmt.Println("Deploying workflows") - - nodes := downloadNodeSets(*chainID, *nodeSets, *nodeSetSize).Workflow.Nodes - - if _, err = os.Stat(*workflowFile); err != nil { - PanicErr(errors.New("toml file does not exist")) - } - - for i, n := range nodes { - if i == 0 { - continue // skip bootstrap node - } - output := &bytes.Buffer{} - client, app := newApp(n, output) - fmt.Println("Logging in:", n.RemoteURL) - loginFs := flag.NewFlagSet("test", flag.ContinueOnError) - loginFs.Bool("bypass-version-check", true, "") - loginCtx := cli.NewContext(app, loginFs, nil) - err := client.RemoteLogin(loginCtx) - helpers.PanicErr(err) - output.Reset() - - fmt.Printf("Deploying workflow\n... \n") - fs := flag.NewFlagSet("test", flag.ExitOnError) - err = fs.Parse([]string{*workflowFile}) - - helpers.PanicErr(err) - err = client.CreateJob(cli.NewContext(app, fs, nil)) - if err != nil { - fmt.Println("Failed to deploy workflow:", "Error:", err) - } - output.Reset() - } -} diff --git a/core/scripts/keystone/src/07_delete_workflows_cmd.go b/core/scripts/keystone/src/07_delete_workflows_cmd.go deleted file mode 100644 index 722e647d98e..00000000000 --- a/core/scripts/keystone/src/07_delete_workflows_cmd.go +++ /dev/null @@ -1,72 +0,0 @@ -package src - -import ( - "bytes" - "encoding/json" - "flag" - "fmt" - "os" - - "github.com/urfave/cli" - - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" -) - -type deleteWorkflows struct{} - -func NewDeleteWorkflowsCommand() *deleteWorkflows { - return &deleteWorkflows{} -} - -func (g *deleteWorkflows) Name() string { - return "delete-workflows" -} - -func (g *deleteWorkflows) Run(args []string) { - fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) - chainID := fs.Int64("chainid", 1337, "chain id") - nodeSetsPath := fs.String("nodes", "", "Custom node sets location") - nodeSetSize := fs.Int("nodeSetSize", 5, "number of nodes in a nodeset") - - err := fs.Parse(args) - if err != nil { - fs.Usage() - os.Exit(1) - } - - nodes := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize).Workflow.Nodes - - for _, node := range nodes { - output := &bytes.Buffer{} - client, app := newApp(node, output) - - fmt.Println("Logging in:", node.RemoteURL) - loginFs := flag.NewFlagSet("test", flag.ContinueOnError) - loginFs.Bool("bypass-version-check", true, "") - loginCtx := cli.NewContext(app, loginFs, nil) - err := client.RemoteLogin(loginCtx) - helpers.PanicErr(err) - output.Reset() - - fileFs := flag.NewFlagSet("test", flag.ExitOnError) - err = client.ListJobs(cli.NewContext(app, fileFs, nil)) - helpers.PanicErr(err) - - var parsed []JobSpec - err = json.Unmarshal(output.Bytes(), &parsed) - helpers.PanicErr(err) - - for _, jobSpec := range parsed { - if jobSpec.WorkflowSpec.WorkflowID != "" { - fmt.Println("Deleting workflow job ID:", jobSpec.Id, "name:", jobSpec.Name) - set := flag.NewFlagSet("test", flag.ExitOnError) - err = set.Parse([]string{jobSpec.Id}) - helpers.PanicErr(err) - err = client.DeleteJob(cli.NewContext(app, set, nil)) - helpers.PanicErr(err) - } - } - - output.Reset() - } -} diff --git a/core/scripts/keystone/src/88_capabilities_registry.go b/core/scripts/keystone/src/88_capabilities_registry_helpers.go similarity index 85% rename from core/scripts/keystone/src/88_capabilities_registry.go rename to core/scripts/keystone/src/88_capabilities_registry_helpers.go index 28597fa75dc..613b2a2d015 100644 --- a/core/scripts/keystone/src/88_capabilities_registry.go +++ b/core/scripts/keystone/src/88_capabilities_registry_helpers.go @@ -28,11 +28,11 @@ import ( ) type CapabilityRegistryProvisioner struct { - reg *kcr.CapabilitiesRegistry + reg kcr.CapabilitiesRegistryInterface env helpers.Environment } -func NewCapabilityRegistryProvisioner(reg *kcr.CapabilitiesRegistry, env helpers.Environment) *CapabilityRegistryProvisioner { +func NewCapabilityRegistryProvisioner(reg kcr.CapabilitiesRegistryInterface, env helpers.Environment) *CapabilityRegistryProvisioner { return &CapabilityRegistryProvisioner{reg: reg, env: env} } @@ -59,7 +59,7 @@ func extractRevertReason(errData string, a abi.ABI) (string, string, error) { return "", "", fmt.Errorf("revert Reason could not be found for given abistring") } -func (c *CapabilityRegistryProvisioner) testCallContract(method string, args ...interface{}) { +func (c *CapabilityRegistryProvisioner) testCallContract(method string, args ...interface{}) error { abi := evmtypes.MustGetABI(kcr.CapabilitiesRegistryABI) data, err := abi.Pack(method, args...) helpers.PanicErr(err) @@ -78,22 +78,29 @@ func (c *CapabilityRegistryProvisioner) testCallContract(method string, args ... if err != nil { if err.Error() == "execution reverted" { rpcError, ierr := evmclient.ExtractRPCError(err) - helpers.PanicErr(ierr) + if ierr != nil { + return ierr + } + reason, abiErr, ierr := extractRevertReason(rpcError.Data.(string), abi) - helpers.PanicErr(ierr) + if ierr != nil { + return ierr + } e := fmt.Errorf("failed to call %s: reason: %s reasonargs: %s", method, reason, abiErr) - helpers.PanicErr(e) + return e } - helpers.PanicErr(err) + + return err } + + return nil } // AddCapabilities takes a capability set and provisions it in the registry. func (c *CapabilityRegistryProvisioner) AddCapabilities(ctx context.Context, capSet CapabilitySet) { - c.testCallContract("addCapabilities", capSet.Capabilities()) - tx, err := c.reg.AddCapabilities(c.env.Owner, capSet.Capabilities()) + helpers.PanicErr(err) helpers.ConfirmTXMined(ctx, c.env.Ec, tx, c.env.ChainID) } @@ -111,6 +118,17 @@ func (c *CapabilityRegistryProvisioner) AddCapabilities(ctx context.Context, cap func (c *CapabilityRegistryProvisioner) AddNodeOperator(ctx context.Context, nop *NodeOperator) { nop.BindToRegistry(c.reg) + nops, err := c.reg.GetNodeOperators(&bind.CallOpts{}) + if err != nil { + log.Printf("failed to GetNodeOperators: %s", err) + } + for _, n := range nops { + if n.Admin == nop.Admin { + log.Printf("NodeOperator with admin address %s already exists", n.Admin.Hex()) + return + } + } + tx, err := c.reg.AddNodeOperators(c.env.Owner, []kcr.CapabilitiesRegistryNodeOperator{ { Admin: nop.Admin, @@ -138,30 +156,29 @@ func (c *CapabilityRegistryProvisioner) AddNodeOperator(ctx context.Context, nop // // Note that in terms of the provisioning process, this is not the last step. A capability is only active once // there is a DON servicing it. This is done via `AddDON`. -func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop *NodeOperator, donName string) { - don, exists := nop.DONs[donName] - if !exists { - log.Fatalf("DON with name %s does not exist in NodeOperator %s", donName, nop.Name) - } - - capSet := don.CapabilitySet - - params := []kcr.CapabilitiesRegistryNodeParams{} - for i, peer := range don.Peers { - node, innerErr := peerToNode(nop.id, peer) - if innerErr != nil { - panic(innerErr) +func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop *NodeOperator, donNames ...string) { + var params []kcr.CapabilitiesRegistryNodeParams + for _, donName := range donNames { + don, exists := nop.DONs[donName] + if !exists { + log.Fatalf("DON with name %s does not exist in NodeOperator %s", donName, nop.Name) + } + capSet := don.CapabilitySet + for i, peer := range don.Peers { + node, innerErr := peerToNode(nop.id, peer) + if innerErr != nil { + panic(innerErr) + } + node.HashedCapabilityIds = capSet.HashedIDs(c.reg) + node.EncryptionPublicKey = [32]byte{2: byte(i + 1)} + params = append(params, node) } - - // Use the capability set attached to the DON - node.HashedCapabilityIds = capSet.CapabilityIDs(c.reg) - node.EncryptionPublicKey = [32]byte{2: byte(i + 1)} - params = append(params, node) } - c.testCallContract("addNodes", params) - tx, err := c.reg.AddNodes(c.env.Owner, params) + err := c.testCallContract("addNodes", params) + PanicErr(err) + tx, err := c.reg.AddNodes(c.env.Owner, params) if err != nil { log.Printf("failed to AddNodes: %s", err) } @@ -194,11 +211,13 @@ func (c *CapabilityRegistryProvisioner) AddDON(ctx context.Context, nop *NodeOpe if !exists { log.Fatalf("DON with name %s does not exist in NodeOperator %s", donName, nop.Name) } - configs := don.CapabilitySet.Configs(c.reg) - c.testCallContract("addDON", don.MustGetPeerIDs(), configs, isPublic, acceptsWorkflows, don.F) + err := c.testCallContract("addDON", don.MustGetPeerIDs(), configs, isPublic, acceptsWorkflows, don.F) + PanicErr(err) + tx, err := c.reg.AddDON(c.env.Owner, don.MustGetPeerIDs(), configs, isPublic, acceptsWorkflows, don.F) + if err != nil { log.Printf("failed to AddDON: %s", err) } @@ -221,16 +240,16 @@ const ( // Taken from https://github.com/smartcontractkit/chainlink/blob/2911785 type CapabillityProvisioner interface { Config() kcr.CapabilitiesRegistryCapabilityConfiguration Capability() kcr.CapabilitiesRegistryCapability - BindToRegistry(reg *kcr.CapabilitiesRegistry) + BindToRegistry(reg kcr.CapabilitiesRegistryInterface) GetHashedCID() [32]byte } type baseCapability struct { - registry *kcr.CapabilitiesRegistry + registry kcr.CapabilitiesRegistryInterface capability kcr.CapabilitiesRegistryCapability } -func (b *baseCapability) BindToRegistry(reg *kcr.CapabilitiesRegistry) { +func (b *baseCapability) BindToRegistry(reg kcr.CapabilitiesRegistryInterface) { b.registry = reg } @@ -242,6 +261,10 @@ func (b *baseCapability) GetHashedCID() [32]byte { return mustHashCapabilityID(b.registry, b.capability) } +func (b *baseCapability) GetID() string { + return fmt.Sprintf("%s@%s", b.capability.LabelledName, b.capability.Version) +} + func (b *baseCapability) config(config *capabilitiespb.CapabilityConfig) kcr.CapabilitiesRegistryCapabilityConfiguration { configBytes, err := proto.Marshal(config) if err != nil { @@ -355,7 +378,7 @@ func NewStreamsTriggerV1Capability() *TriggerCapability { } } -func mustHashCapabilityID(reg *kcr.CapabilitiesRegistry, capability kcr.CapabilitiesRegistryCapability) [32]byte { +func mustHashCapabilityID(reg kcr.CapabilitiesRegistryInterface, capability kcr.CapabilitiesRegistryCapability) [32]byte { hashedCapabilityID, err := reg.GetHashedCapabilityId(&bind.CallOpts{}, capability.LabelledName, capability.Version) if err != nil { panic(err) @@ -379,6 +402,15 @@ func NewCapabilitySet(capabilities ...CapabillityProvisioner) CapabilitySet { return capabilities } +func MergeCapabilitySets(sets ...CapabilitySet) CapabilitySet { + var merged CapabilitySet + for _, set := range sets { + merged = append(merged, set...) + } + + return merged +} + func (c *CapabilitySet) Capabilities() []kcr.CapabilitiesRegistryCapability { var definitions []kcr.CapabilitiesRegistryCapability for _, cap := range *c { @@ -388,7 +420,16 @@ func (c *CapabilitySet) Capabilities() []kcr.CapabilitiesRegistryCapability { return definitions } -func (c *CapabilitySet) CapabilityIDs(reg *kcr.CapabilitiesRegistry) [][32]byte { +func (c *CapabilitySet) IDs() []string { + var strings []string + for _, cap := range *c { + strings = append(strings, fmt.Sprintf("%s@%s", cap.Capability().LabelledName, cap.Capability().Version)) + } + + return strings +} + +func (c *CapabilitySet) HashedIDs(reg kcr.CapabilitiesRegistryInterface) [][32]byte { var ids [][32]byte for _, cap := range *c { cap.BindToRegistry(reg) @@ -398,7 +439,7 @@ func (c *CapabilitySet) CapabilityIDs(reg *kcr.CapabilitiesRegistry) [][32]byte return ids } -func (c *CapabilitySet) Configs(reg *kcr.CapabilitiesRegistry) []kcr.CapabilitiesRegistryCapabilityConfiguration { +func (c *CapabilitySet) Configs(reg kcr.CapabilitiesRegistryInterface) []kcr.CapabilitiesRegistryCapabilityConfiguration { var configs []kcr.CapabilitiesRegistryCapabilityConfiguration for _, cap := range *c { cap.BindToRegistry(reg) @@ -438,7 +479,7 @@ type NodeOperator struct { Name string DONs map[string]DON - reg *kcr.CapabilitiesRegistry + reg kcr.CapabilitiesRegistryInterface // This ID is generated by the registry when the NodeOperator is added id uint32 } @@ -452,7 +493,7 @@ func NewNodeOperator(admin gethCommon.Address, name string, dons map[string]DON) } } -func (n *NodeOperator) BindToRegistry(reg *kcr.CapabilitiesRegistry) { +func (n *NodeOperator) BindToRegistry(reg kcr.CapabilitiesRegistryInterface) { n.reg = reg } diff --git a/core/scripts/keystone/src/88_contracts_helpers.go b/core/scripts/keystone/src/88_contracts_helpers.go new file mode 100644 index 00000000000..cd2b1be0769 --- /dev/null +++ b/core/scripts/keystone/src/88_contracts_helpers.go @@ -0,0 +1,155 @@ +package src + +import ( + "context" + + "encoding/json" + "fmt" + "os" + "path/filepath" + + "github.com/ethereum/go-ethereum/common" + + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability" +) + +var ZeroAddress = common.Address{} + +type OnChainMetaSerialized struct { + OCRContract common.Address `json:"ocrContract"` + ForwarderContract common.Address `json:"forwarderContract"` + // The block number of the transaction that set the config on the OCR3 contract. We use this to replay blocks from this point on + // when we load the OCR3 job specs on the nodes. + SetConfigTxBlock uint64 `json:"setConfigTxBlock"` + + CapabilitiesRegistry common.Address `json:"CapabilitiesRegistry"` +} + +type onchainMeta struct { + OCRContract ocr3_capability.OCR3CapabilityInterface + ForwarderContract forwarder.KeystoneForwarderInterface + // The block number of the transaction that set the config on the OCR3 contract. We use this to replay blocks from this point on + // when we load the OCR3 job specs on the nodes. + SetConfigTxBlock uint64 + + CapabilitiesRegistry capabilities_registry.CapabilitiesRegistryInterface +} + +func WriteOnchainMeta(o onchainMeta, artefactsDir string) { + _, err := os.Stat(artefactsDir) + if err != nil { + fmt.Println("Creating artefacts directory") + err = os.MkdirAll(artefactsDir, 0700) + PanicErr(err) + } + + fmt.Println("Writing deployed contract addresses to file...") + serialzed := OnChainMetaSerialized{ + OCRContract: o.OCRContract.Address(), + ForwarderContract: o.ForwarderContract.Address(), + SetConfigTxBlock: o.SetConfigTxBlock, + CapabilitiesRegistry: o.CapabilitiesRegistry.Address(), + } + + jsonBytes, err := json.Marshal(serialzed) + PanicErr(err) + + err = os.WriteFile(deployedContractsFilePath(artefactsDir), jsonBytes, 0600) + PanicErr(err) +} + +func LoadOnchainMeta(artefactsDir string, env helpers.Environment) onchainMeta { + if !ContractsAlreadyDeployed(artefactsDir) { + fmt.Printf("No deployed contracts file found at %s\n", deployedContractsFilePath(artefactsDir)) + return onchainMeta{} + } + + jsonBytes, err := os.ReadFile(deployedContractsFilePath(artefactsDir)) + if err != nil { + fmt.Printf("Error reading deployed contracts file: %s\n", err) + return onchainMeta{} + } + + var s OnChainMetaSerialized + err = json.Unmarshal(jsonBytes, &s) + if err != nil { + return onchainMeta{} + } + + hydrated := onchainMeta{ + SetConfigTxBlock: s.SetConfigTxBlock, + } + + if s.OCRContract != ZeroAddress { + if !contractExists(s.OCRContract, env) { + fmt.Printf("OCR contract at %s does not exist, setting to zero address\n", s.OCRContract.Hex()) + s.OCRContract = ZeroAddress + } + + ocr3, err := ocr3_capability.NewOCR3Capability(s.OCRContract, env.Ec) + PanicErr(err) + hydrated.OCRContract = ocr3 + } + + if s.ForwarderContract != ZeroAddress { + if !contractExists(s.ForwarderContract, env) { + fmt.Printf("Forwarder contract at %s does not exist, setting to zero address\n", s.ForwarderContract.Hex()) + s.ForwarderContract = ZeroAddress + } + + fwdr, err := forwarder.NewKeystoneForwarder(s.ForwarderContract, env.Ec) + PanicErr(err) + hydrated.ForwarderContract = fwdr + } + + if s.CapabilitiesRegistry != ZeroAddress { + if !contractExists(s.CapabilitiesRegistry, env) { + fmt.Printf("CapabilityRegistry contract at %s does not exist, setting to zero address\n", s.CapabilitiesRegistry.Hex()) + s.CapabilitiesRegistry = ZeroAddress + } + + cr, err := capabilities_registry.NewCapabilitiesRegistry(s.CapabilitiesRegistry, env.Ec) + PanicErr(err) + hydrated.CapabilitiesRegistry = cr + } + + blkNum, err := env.Ec.BlockNumber(context.Background()) + PanicErr(err) + + if s.SetConfigTxBlock > blkNum { + fmt.Printf("Stale SetConfigTxBlock: %d, current block number: %d\n", s.SetConfigTxBlock, blkNum) + + return onchainMeta{} + } + + return hydrated +} + +func ContractsAlreadyDeployed(artefactsDir string) bool { + _, err := os.Stat(artefactsDir) + if err != nil { + return false + } + + _, err = os.Stat(deployedContractsFilePath(artefactsDir)) + if err != nil { + return false + } + + return true +} + +func deployedContractsFilePath(artefactsDir string) string { + return filepath.Join(artefactsDir, deployedContractsJSON) +} + +func contractExists(address common.Address, env helpers.Environment) bool { + byteCode, err := env.Ec.CodeAt(context.Background(), address, nil) + if err != nil { + return false + } + return len(byteCode) != 0 +} diff --git a/core/scripts/keystone/src/88_gen_jobspecs.go b/core/scripts/keystone/src/88_gen_jobspecs.go deleted file mode 100644 index 86f53812ec2..00000000000 --- a/core/scripts/keystone/src/88_gen_jobspecs.go +++ /dev/null @@ -1,92 +0,0 @@ -package src - -import ( - "fmt" - "path/filepath" - "strconv" - "strings" - - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" -) - -type spec []string - -func (s spec) ToString() string { - return strings.Join(s, "\n") -} - -type hostSpec struct { - spec spec - host string -} - -type donHostSpec struct { - bootstrap hostSpec - oracles []hostSpec -} - -func generateOCR3JobSpecs( - nodeSetsPath string, - templatesDir string, - chainID int64, - p2pPort int64, - ocrConfigContractAddress string, - nodeSetSize int, -) donHostSpec { - workflowNodes := downloadNodeSets(chainID, nodeSetsPath, nodeSetSize).Workflow - workflowNodeKeys := nodeKeysToKsDeployNodeKeys(workflowNodes.NodeKeys) - nodes := workflowNodes.Nodes - bootstrapNode := workflowNodeKeys[0] - - bootstrapSpecLines, err := readLines(filepath.Join(templatesDir, bootstrapSpecTemplate)) - helpers.PanicErr(err) - bootHost := nodes[0].ServiceName - bootstrapSpecLines = replacePlaceholders( - bootstrapSpecLines, - chainID, p2pPort, - ocrConfigContractAddress, bootHost, - bootstrapNode, bootstrapNode, - ) - bootstrap := hostSpec{bootstrapSpecLines, bootHost} - - oracleSpecLinesTemplate, err := readLines(filepath.Join(templatesDir, oracleSpecTemplate)) - helpers.PanicErr(err) - oracles := []hostSpec{} - for i := 1; i < len(nodes); i++ { - oracleSpecLines := oracleSpecLinesTemplate - oracleSpecLines = replacePlaceholders( - oracleSpecLines, - chainID, p2pPort, - ocrConfigContractAddress, bootHost, - bootstrapNode, workflowNodeKeys[i], - ) - oracles = append(oracles, hostSpec{oracleSpecLines, nodes[i].RemoteURL.Host}) - } - - return donHostSpec{ - bootstrap: bootstrap, - oracles: oracles, - } -} - -func replacePlaceholders( - lines []string, - - chainID, p2pPort int64, - contractAddress, bootHost string, - boot, node ksdeploy.NodeKeys, -) (output []string) { - chainIDStr := strconv.FormatInt(chainID, 10) - bootstrapper := fmt.Sprintf("%s@%s:%d", boot.P2PPeerID, bootHost, p2pPort) - for _, l := range lines { - l = strings.Replace(l, "{{ chain_id }}", chainIDStr, 1) - l = strings.Replace(l, "{{ ocr_config_contract_address }}", contractAddress, 1) - l = strings.Replace(l, "{{ transmitter_id }}", node.EthAddress, 1) - l = strings.Replace(l, "{{ ocr_key_bundle_id }}", node.OCR2BundleID, 1) - l = strings.Replace(l, "{{ aptos_key_bundle_id }}", node.AptosBundleID, 1) - l = strings.Replace(l, "{{ bootstrapper_p2p_id }}", bootstrapper, 1) - output = append(output, l) - } - return -} diff --git a/core/scripts/keystone/src/88_gen_jobspecs_test.go b/core/scripts/keystone/src/88_gen_jobspecs_test.go deleted file mode 100644 index a4524e98f48..00000000000 --- a/core/scripts/keystone/src/88_gen_jobspecs_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package src - -import ( - "fmt" - "testing" - - "github.com/gkampitakis/go-snaps/snaps" -) - -func (d *donHostSpec) ToString() string { - var result string - result += "Bootstrap:\n" - result += "Host: " + d.bootstrap.host + "\n" - result += d.bootstrap.spec.ToString() - result += "\n\nOracles:\n" - for i, oracle := range d.oracles { - if i != 0 { - result += "--------------------------------\n" - } - result += fmt.Sprintf("Oracle %d:\n", i) - result += "Host: " + oracle.host + "\n" - result += oracle.spec.ToString() - result += "\n\n" - } - return result -} - -func TestGenSpecs(t *testing.T) { - nodeSetsPath := "./testdata/node_sets.json" - chainID := int64(1337) - p2pPort := int64(6690) - contractAddress := "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" - - specs := generateOCR3JobSpecs(nodeSetsPath, "../templates", chainID, p2pPort, contractAddress, 4) - snaps.MatchSnapshot(t, specs.ToString()) -} diff --git a/core/scripts/keystone/src/88_gen_ocr3_config.go b/core/scripts/keystone/src/88_gen_ocr3_config.go deleted file mode 100644 index 1a11c51f3ca..00000000000 --- a/core/scripts/keystone/src/88_gen_ocr3_config.go +++ /dev/null @@ -1,40 +0,0 @@ -package src - -import ( - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - "github.com/smartcontractkit/chainlink/deployment" - ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" -) - -func mustReadConfig(fileName string) (output ksdeploy.TopLevelConfigSource) { - return mustReadJSON[ksdeploy.TopLevelConfigSource](fileName) -} - -func generateOCR3Config(configFile string, chainID int64, nodeSetsPath string, nodeSetSize int) ksdeploy.Orc2drOracleConfig { - topLevelCfg := mustReadConfig(configFile) - cfg := topLevelCfg.OracleConfig - cfg.OCRSecrets = deployment.XXXGenerateTestOCRSecrets() - nodeSets := downloadNodeSets(chainID, nodeSetsPath, nodeSetSize) - c, err := ksdeploy.GenerateOCR3Config(cfg, nodeKeysToKsDeployNodeKeys(nodeSets.Workflow.NodeKeys[1:])) // skip the bootstrap node - helpers.PanicErr(err) - return c -} - -func nodeKeysToKsDeployNodeKeys(nks []NodeKeys) []ksdeploy.NodeKeys { - keys := []ksdeploy.NodeKeys{} - for _, nk := range nks { - keys = append(keys, ksdeploy.NodeKeys{ - EthAddress: nk.EthAddress, - AptosAccount: nk.AptosAccount, - AptosBundleID: nk.AptosBundleID, - AptosOnchainPublicKey: nk.AptosOnchainPublicKey, - P2PPeerID: nk.P2PPeerID, - OCR2BundleID: nk.OCR2BundleID, - OCR2OnchainPublicKey: nk.OCR2OnchainPublicKey, - OCR2OffchainPublicKey: nk.OCR2OffchainPublicKey, - OCR2ConfigPublicKey: nk.OCR2ConfigPublicKey, - CSAPublicKey: nk.CSAPublicKey, - }) - } - return keys -} diff --git a/core/scripts/keystone/src/88_gen_ocr3_config_test.go b/core/scripts/keystone/src/88_gen_ocr3_config_test.go deleted file mode 100644 index 12f58e6fc87..00000000000 --- a/core/scripts/keystone/src/88_gen_ocr3_config_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package src - -import ( - "errors" - "testing" - - "github.com/gkampitakis/go-snaps/match" - "github.com/gkampitakis/go-snaps/snaps" -) - -func TestGenerateOCR3Config(t *testing.T) { - // Generate OCR3 config - config := generateOCR3Config("./testdata/SampleConfig.json", 1337, "./testdata/node_sets.json", 4) - - matchOffchainConfig := match.Custom("OffchainConfig", func(s any) (any, error) { - // coerce the value to a string - s, ok := s.(string) - if !ok { - return nil, errors.New("offchain config is not a string") - } - - // if the string is not empty - if s == "" { - return nil, errors.New("offchain config is empty") - } - - return "", nil - }) - - snaps.MatchJSON(t, config, matchOffchainConfig) -} diff --git a/core/scripts/keystone/src/88_jobspecs_helpers.go b/core/scripts/keystone/src/88_jobspecs_helpers.go new file mode 100644 index 00000000000..80c06e56c29 --- /dev/null +++ b/core/scripts/keystone/src/88_jobspecs_helpers.go @@ -0,0 +1,50 @@ +package src + +import ( + "fmt" +) + +type OCRSpec struct { + ContractID string +} + +type BootSpec struct { + ContractID string +} + +type WorkflowSpec struct { + WorkflowID string +} + +type JobSpec struct { + Id string + Name string + BootstrapSpec BootSpec + OffChainReporting2OracleSpec OCRSpec + WorkflowSpec WorkflowSpec +} + + +func maybeUpsertJob(api *nodeAPI, jobSpecName string, jobSpecStr string, upsert bool) { + jobsResp := api.mustExec(api.methods.ListJobs) + jobs := mustJSON[[]JobSpec](jobsResp) + for _, job := range *jobs { + if job.Name == jobSpecName { + if !upsert { + fmt.Printf("Job already exists: %s, skipping..\n", jobSpecName) + return + } + + fmt.Printf("Job already exists: %s, replacing..\n", jobSpecName) + api.withArg(job.Id).mustExec(api.methods.DeleteJob) + fmt.Printf("Deleted job: %s\n", jobSpecName) + break + } + } + + fmt.Printf("Deploying jobspec: %s\n... \n", jobSpecStr) + _, err := api.withArg(jobSpecStr).exec(api.methods.CreateJob) + if err != nil { + panic(fmt.Sprintf("Failed to deploy job spec: %s Error: %s", jobSpecStr, err)) + } +} diff --git a/core/scripts/keystone/src/99_files.go b/core/scripts/keystone/src/99_files.go index b9d8f0387fb..a4ccccae6d7 100644 --- a/core/scripts/keystone/src/99_files.go +++ b/core/scripts/keystone/src/99_files.go @@ -12,6 +12,7 @@ import ( const ( defaultArtefactsDir = "artefacts" + defaultTemplatesDir = "templates" defaultNodeSetsPath = ".cache/node_sets.json" deployedContractsJSON = "deployed_contracts.json" bootstrapSpecTemplate = "bootstrap.toml" From 47f93b916f12cdce2aa31212b7574f78203c5f6d Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:36:46 -0700 Subject: [PATCH 073/117] Add OCR3 caching --- .../src/02_provision_ocr3_capability.go | 79 +++++++++++-------- core/scripts/keystone/src/88_ocr_helpers.go | 37 +++++++++ 2 files changed, 85 insertions(+), 31 deletions(-) create mode 100644 core/scripts/keystone/src/88_ocr_helpers.go diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability.go b/core/scripts/keystone/src/02_provision_ocr3_capability.go index 49e47b890b3..5b6b7eb6c47 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability.go @@ -15,6 +15,8 @@ import ( helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability" + "github.com/smartcontractkit/libocr/offchainreporting2/chains/evmutil" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" ) type provisionOCR3Capability struct{} @@ -76,8 +78,8 @@ func provisionOCR3( ocrConfigFile string, templatesLocation string, artefactsDir string, -) (onchainMeta onchainMeta, cacheHit bool) { - onchainMeta, cacheHit = deployOCR3Contract( +) (onchainMeta onchainMeta, shouldRedeployJobspecs bool) { + onchainMeta, shouldRedeployJobspecs = deployOCR3Contract( nodeSet, env, ocrConfigFile, @@ -91,7 +93,7 @@ func provisionOCR3( templatesLocation, artefactsDir, onchainMeta, - cacheHit, + shouldRedeployJobspecs, ) return @@ -102,10 +104,36 @@ func deployOCR3Contract( env helpers.Environment, configFile string, artefacts string, -) (o onchainMeta, cacheHit bool) { +) (o onchainMeta, shouldRedeployJobspecs bool) { o = LoadOnchainMeta(artefacts, env) + ocrConf := generateOCR3Config( + nodeSet, + configFile, + env.ChainID, + ) + if o.OCRContract != nil { - fmt.Println("OCR3 Contract already deployed, skipping...") + // types.ConfigDigestPrefixKeystoneOCR3Capability + fmt.Println("OCR3 Contract already deployed, checking config...") + latestConfigDigestBytes, err := o.OCRContract.LatestConfigDetails(nil) + PanicErr(err) + latestConfigDigest, err := types.BytesToConfigDigest(latestConfigDigestBytes.ConfigDigest[:]) + + cc := ocrConfToContractConfig(ocrConf, latestConfigDigestBytes.ConfigCount) + digester := evmutil.EVMOffchainConfigDigester{ + ChainID: uint64(env.ChainID), + ContractAddress: o.OCRContract.Address(), + } + digest, err := digester.ConfigDigest(context.Background(), cc) + PanicErr(err) + + if digest.Hex() == latestConfigDigest.Hex() { + fmt.Println("OCR3 Contract already deployed with the same config, skipping...") + return o, false + } + + fmt.Println("OCR3 Contract contains a different config, updating...") + setOCRConfig(o, env, ocrConf, artefacts) return o, true } @@ -113,21 +141,22 @@ func deployOCR3Contract( _, tx, ocrContract, err := ocr3_capability.DeployOCR3Capability(env.Owner, env.Ec) PanicErr(err) helpers.ConfirmContractDeployed(context.Background(), env.Ec, tx, env.ChainID) + o.OCRContract = ocrContract + setOCRConfig(o, env, ocrConf, artefacts) - ocrConf := generateOCR3Config( - nodeSet, - configFile, - env.ChainID, - ) + return o, true +} + +func generateOCR3Config(nodeSet NodeSet, configFile string, chainID int64) ksdeploy.Orc2drOracleConfig { + topLevelCfg := mustReadOCR3Config(configFile) + cfg := topLevelCfg.OracleConfig + c, err := ksdeploy.GenerateOCR3Config(cfg, nodeKeysToKsDeployNodeKeys(nodeSet.NodeKeys[1:])) // skip the bootstrap node + helpers.PanicErr(err) + return c +} - fmt.Println("Setting OCR3 contract config...") - fmt.Printf("Signers: %v\n", ocrConf.Signers) - fmt.Printf("Transmitters: %v\n", ocrConf.Transmitters) - fmt.Printf("F: %v\n", ocrConf.F) - fmt.Printf("OnchainConfig: %v\n", ocrConf.OnchainConfig) - fmt.Printf("OffchainConfigVersion: %v\n", ocrConf.OffchainConfigVersion) - fmt.Printf("OffchainConfig: %v\n", ocrConf.OffchainConfig) - tx, err = ocrContract.SetConfig(env.Owner, +func setOCRConfig(o onchainMeta, env helpers.Environment, ocrConf ksdeploy.Orc2drOracleConfig, artefacts string) { + tx, err := o.OCRContract.SetConfig(env.Owner, ocrConf.Signers, ocrConf.Transmitters, ocrConf.F, @@ -136,13 +165,9 @@ func deployOCR3Contract( ocrConf.OffchainConfig, ) PanicErr(err) - receipt := helpers.ConfirmTXMined(context.Background(), env.Ec, tx, env.ChainID) o.SetConfigTxBlock = receipt.BlockNumber.Uint64() - o.OCRContract = ocrContract WriteOnchainMeta(o, artefacts) - - return o, false } func deployOCR3JobSpecsTo( @@ -264,18 +289,10 @@ func replaceOCR3TemplatePlaceholders( return } -func mustReadConfig(fileName string) (output ksdeploy.TopLevelConfigSource) { +func mustReadOCR3Config(fileName string) (output ksdeploy.TopLevelConfigSource) { return mustReadJSON[ksdeploy.TopLevelConfigSource](fileName) } -func generateOCR3Config(nodeSet NodeSet, configFile string, chainID int64) ksdeploy.Orc2drOracleConfig { - topLevelCfg := mustReadConfig(configFile) - cfg := topLevelCfg.OracleConfig - c, err := ksdeploy.GenerateOCR3Config(cfg, nodeKeysToKsDeployNodeKeys(nodeSet.NodeKeys[1:])) // skip the bootstrap node - helpers.PanicErr(err) - return c -} - func nodeKeysToKsDeployNodeKeys(nks []NodeKeys) []ksdeploy.NodeKeys { keys := []ksdeploy.NodeKeys{} for _, nk := range nks { diff --git a/core/scripts/keystone/src/88_ocr_helpers.go b/core/scripts/keystone/src/88_ocr_helpers.go new file mode 100644 index 00000000000..90fb7b9b538 --- /dev/null +++ b/core/scripts/keystone/src/88_ocr_helpers.go @@ -0,0 +1,37 @@ +package src + +import ( + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + ksdeploy "github.com/smartcontractkit/chainlink/integration-tests/deployment/keystone" + "github.com/smartcontractkit/libocr/offchainreporting2/types" +) + +func ocrConfToContractConfig(ocrConf ksdeploy.Orc2drOracleConfig, configCount uint32) types.ContractConfig { + cc := types.ContractConfig{ + Signers: convertByteSliceToOnchainPublicKeys(ocrConf.Signers), + Transmitters: convertAddressesToAccounts(ocrConf.Transmitters), + F: ocrConf.F, + OnchainConfig: ocrConf.OnchainConfig, + OffchainConfigVersion: ocrConf.OffchainConfigVersion, + OffchainConfig: ocrConf.OffchainConfig, + ConfigCount: uint64(configCount), + } + return cc +} + +func convertAddressesToAccounts(addresses []common.Address) []types.Account { + accounts := make([]types.Account, len(addresses)) + for i, addr := range addresses { + accounts[i] = types.Account(addr.Hex()) + } + return accounts +} + +func convertByteSliceToOnchainPublicKeys(bs [][]byte) []types.OnchainPublicKey { + keys := make([]types.OnchainPublicKey, len(bs)) + for i, b := range bs { + keys[i] = types.OnchainPublicKey(hexutil.Encode(b)) + } + return keys +} From 779a06016720ac683aa588047ed84d13991160a3 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:38:27 -0700 Subject: [PATCH 074/117] Refactor provisioning flags and improve argument validation in keystone script --- .../keystone/src/01_provision_keystone.go | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/core/scripts/keystone/src/01_provision_keystone.go b/core/scripts/keystone/src/01_provision_keystone.go index fc593ba5efd..05a5505f7ea 100644 --- a/core/scripts/keystone/src/01_provision_keystone.go +++ b/core/scripts/keystone/src/01_provision_keystone.go @@ -21,37 +21,34 @@ func (g *provisionKeystone) Name() string { func (g *provisionKeystone) Run(args []string) { fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) + + // common flags + artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") + nodeSetsPath := fs.String("nodesets", defaultNodeSetsPath, "Custom node sets location") + chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") + + // preprovisioning flags preprovison := fs.Bool("preprovision", false, "Preprovision crib") - // create flags for all of the env vars then set the env vars to normalize the interface - // this is a bit of a hack but it's the easiest way to make this work + + // provisioning flags ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") - chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") accountKey := fs.String("accountkey", "", "private key of the account to deploy from") - nodeSetsPath := fs.String("nodesets", defaultNodeSetsPath, "Custom node sets location") nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") - replaceResources := fs.Bool("replacejob", false, "replace jobs if they already exist") + replaceResources := fs.Bool("replaceresources", false, "replace jobs if they already exist") ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") p2pPort := fs.Int64("p2pport", 6690, "p2p port") capabilitiesP2PPort := fs.Int64("capabilitiesp2pport", 6691, "p2p port for capabilities") templatesDir := fs.String("templates", defaultTemplatesDir, "Custom templates location") - artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") preprovisionConfigName := fs.String("preprovisionconfig", "crib-preprovision.yaml", "Name of the preprovision config file, stored in the artefacts directory") postprovisionConfigName := fs.String("postprovisionconfig", "crib-postprovision.yaml", "Name of the postprovision config file, stored in the artefacts directory") err := fs.Parse(args) - if err != nil || - *ethUrl == "" || ethUrl == nil || - *accountKey == "" || accountKey == nil { + if err != nil || (!*preprovison && (*ethUrl == "" || *accountKey == "")) { fs.Usage() os.Exit(1) } - os.Setenv("ETH_URL", *ethUrl) - os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) - os.Setenv("ACCOUNT_KEY", *accountKey) - os.Setenv("INSECURE_SKIP_VERIFY", "true") - env := helpers.SetupEnv(false) nodeSets := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize) if *preprovison { fmt.Printf("Preprovisioning crib with %d nodes\n", *nodeSetSize) @@ -59,6 +56,14 @@ func (g *provisionKeystone) Run(args []string) { return } + // Kinda hacky but it prevents us from refactoring the setupenv function which + // is used in many other places + os.Setenv("ETH_URL", *ethUrl) + os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) + os.Setenv("ACCOUNT_KEY", *accountKey) + os.Setenv("INSECURE_SKIP_VERIFY", "true") + env := helpers.SetupEnv(false) + reg := provisionCapabillitiesRegistry( env, nodeSets, From b4aada090e328a3bd9ab09c49fccee7083bb8df5 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Tue, 29 Oct 2024 18:45:09 -0700 Subject: [PATCH 075/117] Refactor: Remove stale references and fix refactor related bugs --- .../keystone/01_deploy_contracts-sample.sh | 11 - .../keystone/02_deploy_jobspecs-sample.sh | 7 - core/scripts/keystone/03_gen_crib-sample.sh | 6 - .../keystone/04_delete_ocr3_jobs-sample.sh | 3 - .../04_deploy_streams_trigger-sample.sh | 12 - ...initialize_capabilities_registry-sample.sh | 8 - ..._provision_capabilities_registry-sample.sh | 6 - .../keystone/src/01_provision_keystone.go | 51 ++-- .../src/02_deploy_keystone_workflows.go | 2 +- .../keystone/src/02_fund_transmitters.go | 28 +- .../src/02_provision_ocr3_capability.go | 241 ++++++++++-------- .../src/02_provision_ocr3_capability_test.go | 45 ++-- ...02_provision_streams_trigger_capability.go | 2 +- .../keystone/src/88_contracts_helpers.go | 40 +-- .../keystone/src/88_jobspecs_helpers.go | 11 +- core/scripts/keystone/src/99_files.go | 39 --- core/scripts/keystone/src/99_files_test.go | 36 --- .../02_deploy_keystone_workflows_test.snap | 57 +++++ ..._test.snap => 02_provision_crib_test.snap} | 28 +- .../02_provision_ocr3_capability_test.snap | 65 +++++ ...ision_streams_trigger_capability_test.snap | 50 ++++ .../03_deploy_streams_trigger_cmd_test.snap | 147 ----------- .../__snapshots__/88_gen_jobspecs_test.snap | 140 ---------- .../88_gen_ocr3_config_test.snap | 21 -- .../scripts/keystone/templates/bootstrap.toml | 9 - core/scripts/keystone/templates/oracle.toml | 27 -- 26 files changed, 437 insertions(+), 655 deletions(-) delete mode 100755 core/scripts/keystone/01_deploy_contracts-sample.sh delete mode 100755 core/scripts/keystone/02_deploy_jobspecs-sample.sh delete mode 100755 core/scripts/keystone/03_gen_crib-sample.sh delete mode 100755 core/scripts/keystone/04_delete_ocr3_jobs-sample.sh delete mode 100755 core/scripts/keystone/04_deploy_streams_trigger-sample.sh delete mode 100755 core/scripts/keystone/05_deploy_and_initialize_capabilities_registry-sample.sh delete mode 100644 core/scripts/keystone/06_provision_capabilities_registry-sample.sh delete mode 100644 core/scripts/keystone/src/99_files_test.go create mode 100755 core/scripts/keystone/src/__snapshots__/02_deploy_keystone_workflows_test.snap rename core/scripts/keystone/src/__snapshots__/{03_gen_crib_cluster_overrides_cmd_test.snap => 02_provision_crib_test.snap} (95%) create mode 100755 core/scripts/keystone/src/__snapshots__/02_provision_ocr3_capability_test.snap create mode 100755 core/scripts/keystone/src/__snapshots__/02_provision_streams_trigger_capability_test.snap delete mode 100755 core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap delete mode 100755 core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap delete mode 100755 core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap delete mode 100644 core/scripts/keystone/templates/bootstrap.toml delete mode 100644 core/scripts/keystone/templates/oracle.toml diff --git a/core/scripts/keystone/01_deploy_contracts-sample.sh b/core/scripts/keystone/01_deploy_contracts-sample.sh deleted file mode 100755 index 6853b48920f..00000000000 --- a/core/scripts/keystone/01_deploy_contracts-sample.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -go run main.go \ - deploy-contracts \ - --ocrfile=ocr_config.json \ - --chainid=1337 \ - --ethurl=ETH_URL \ - --accountkey=ACCOUNT_KEY \ - --onlysetconfig=false \ - --skipfunding=false \ - --dryrun=false diff --git a/core/scripts/keystone/02_deploy_jobspecs-sample.sh b/core/scripts/keystone/02_deploy_jobspecs-sample.sh deleted file mode 100755 index 212c0d820f7..00000000000 --- a/core/scripts/keystone/02_deploy_jobspecs-sample.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -go run main.go \ - deploy-jobspecs \ - --chainid=1337 \ - --p2pport=6690 \ - --onlyreplay=false diff --git a/core/scripts/keystone/03_gen_crib-sample.sh b/core/scripts/keystone/03_gen_crib-sample.sh deleted file mode 100755 index 2271f2dbe21..00000000000 --- a/core/scripts/keystone/03_gen_crib-sample.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -go run main.go \ - generate-crib \ - --chainid=1337 \ - --outpath=/tmp diff --git a/core/scripts/keystone/04_delete_ocr3_jobs-sample.sh b/core/scripts/keystone/04_delete_ocr3_jobs-sample.sh deleted file mode 100755 index 3f3b50b055c..00000000000 --- a/core/scripts/keystone/04_delete_ocr3_jobs-sample.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -go run main.go delete-ocr3-jobs diff --git a/core/scripts/keystone/04_deploy_streams_trigger-sample.sh b/core/scripts/keystone/04_deploy_streams_trigger-sample.sh deleted file mode 100755 index 5ccb9bcbc53..00000000000 --- a/core/scripts/keystone/04_deploy_streams_trigger-sample.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# This is for arb sepolia, see jobspec on https://cl-df-mercury-arb-sepolia-0.main.stage.cldev.sh/jobs/34/definition -go run main.go \ - deploy-streams-trigger \ - --verifierproxycontractaddress=$VERIFIER_PROXY_CONTRACT_ADDRESS \ - --verifiercontractaddress=$VERIFIER_CONTRACT_ADDRESS \ - --chainid=$CHAIN_ID \ - --fromblock=$FROM_BLOCK \ - --linkfeedid=$LINK_FEED_ID \ - --nativefeedid=$NATIVE_FEED_ID \ - --feedid=$FEED_ID \ - --dryrun=true diff --git a/core/scripts/keystone/05_deploy_and_initialize_capabilities_registry-sample.sh b/core/scripts/keystone/05_deploy_and_initialize_capabilities_registry-sample.sh deleted file mode 100755 index 0fec03e7b42..00000000000 --- a/core/scripts/keystone/05_deploy_and_initialize_capabilities_registry-sample.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -go run main.go \ - deploy-and-initialize-capabilities-registry \ - --chainid=1337 \ - --ethurl=$ETH_URL \ - --accountkey=$ACCOUNT_KEY \ - --craddress=$CR_ADDRESS \ // 0x0d36aAC2Fd9d6d1C1F59251be6A2B337af27C52B diff --git a/core/scripts/keystone/06_provision_capabilities_registry-sample.sh b/core/scripts/keystone/06_provision_capabilities_registry-sample.sh deleted file mode 100644 index ede7cccfdcc..00000000000 --- a/core/scripts/keystone/06_provision_capabilities_registry-sample.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -go run main.go provision-capabilites-registry \ - --chainid=11155111 \ - --ethurl=$ETH_URL \ - --accountkey=$ACCOUNT_KEY diff --git a/core/scripts/keystone/src/01_provision_keystone.go b/core/scripts/keystone/src/01_provision_keystone.go index 05a5505f7ea..af04642b078 100644 --- a/core/scripts/keystone/src/01_provision_keystone.go +++ b/core/scripts/keystone/src/01_provision_keystone.go @@ -24,6 +24,7 @@ func (g *provisionKeystone) Run(args []string) { // common flags artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") + nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") nodeSetsPath := fs.String("nodesets", defaultNodeSetsPath, "Custom node sets location") chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") @@ -33,14 +34,14 @@ func (g *provisionKeystone) Run(args []string) { // provisioning flags ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") accountKey := fs.String("accountkey", "", "private key of the account to deploy from") - nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") replaceResources := fs.Bool("replaceresources", false, "replace jobs if they already exist") ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") p2pPort := fs.Int64("p2pport", 6690, "p2p port") capabilitiesP2PPort := fs.Int64("capabilitiesp2pport", 6691, "p2p port for capabilities") - templatesDir := fs.String("templates", defaultTemplatesDir, "Custom templates location") preprovisionConfigName := fs.String("preprovisionconfig", "crib-preprovision.yaml", "Name of the preprovision config file, stored in the artefacts directory") postprovisionConfigName := fs.String("postprovisionconfig", "crib-postprovision.yaml", "Name of the postprovision config file, stored in the artefacts directory") + // additional flags + clean := fs.Bool("clean", false, "Clean up resources before provisioning") err := fs.Parse(args) @@ -49,13 +50,32 @@ func (g *provisionKeystone) Run(args []string) { os.Exit(1) } - nodeSets := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize) if *preprovison { - fmt.Printf("Preprovisioning crib with %d nodes\n", *nodeSetSize) + fmt.Printf("Preprovisioning crib with %d nodes per set\n", *nodeSetSize) writePreprovisionConfig(*nodeSetSize, filepath.Join(*artefactsDir, *preprovisionConfigName)) return } + nodeSets := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize) + if *clean { + + fmt.Println("Cleaning up resources") + // clean nodesets path + err = os.RemoveAll(*nodeSetsPath) + PanicErr(err) + + for _, node := range nodeSets.Workflow.Nodes { + clearJobs(newNodeAPI(node)) + } + + for _, node := range nodeSets.StreamsTrigger.Nodes { + clearJobs(newNodeAPI(node)) + } + + os.RemoveAll(*artefactsDir) + } + + nodeSets = downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize) // Kinda hacky but it prevents us from refactoring the setupenv function which // is used in many other places os.Setenv("ETH_URL", *ethUrl) @@ -64,13 +84,7 @@ func (g *provisionKeystone) Run(args []string) { os.Setenv("INSECURE_SKIP_VERIFY", "true") env := helpers.SetupEnv(false) - reg := provisionCapabillitiesRegistry( - env, - nodeSets, - *chainID, - *artefactsDir, - ) - + provisionStreamsDON( env, nodeSets.StreamsTrigger, @@ -80,13 +94,19 @@ func (g *provisionKeystone) Run(args []string) { *replaceResources, ) + reg := provisionCapabillitiesRegistry( + env, + nodeSets, + *chainID, + *artefactsDir, + ) + onchainMeta := provisionWorkflowDON( env, nodeSets.Workflow, *chainID, *p2pPort, *ocrConfigFile, - *templatesDir, *artefactsDir, *replaceResources, reg, @@ -126,11 +146,10 @@ func provisionWorkflowDON( chainID int64, p2pPort int64, ocrConfigFile string, - templatesDir string, artefactsDir string, replaceJob bool, reg kcr.CapabilitiesRegistryInterface, -) (onchainMeta onchainMeta) { +) (onchainMeta *onchainMeta) { deployForwarder(env, artefactsDir) onchainMeta, _ = provisionOCR3( @@ -139,11 +158,13 @@ func provisionWorkflowDON( chainID, p2pPort, ocrConfigFile, - templatesDir, artefactsDir, ) distributeFunds(nodeSet, env) + // We don't technically need the capability registry as a dependency + // as we just use it for a sanity check + // We could remove it so that we can execute provisioning in parallel deployKeystoneWorkflowsTo(nodeSet, reg, chainID, replaceJob) return onchainMeta diff --git a/core/scripts/keystone/src/02_deploy_keystone_workflows.go b/core/scripts/keystone/src/02_deploy_keystone_workflows.go index 85b8758e6ed..470b8b6e8b6 100644 --- a/core/scripts/keystone/src/02_deploy_keystone_workflows.go +++ b/core/scripts/keystone/src/02_deploy_keystone_workflows.go @@ -4,7 +4,7 @@ import ( "bytes" "flag" "fmt" - "html/template" + "text/template" "os" "github.com/ethereum/go-ethereum/accounts/abi/bind" diff --git a/core/scripts/keystone/src/02_fund_transmitters.go b/core/scripts/keystone/src/02_fund_transmitters.go index d4803fc06f1..dcbf91d6aca 100644 --- a/core/scripts/keystone/src/02_fund_transmitters.go +++ b/core/scripts/keystone/src/02_fund_transmitters.go @@ -5,8 +5,10 @@ import ( "fmt" "math/big" "os" + "context" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + "github.com/ethereum/go-ethereum/common" ) type fundTransmitters struct{} @@ -51,9 +53,31 @@ func (g *fundTransmitters) Run(args []string) { func distributeFunds(nodeSet NodeSet, env helpers.Environment) { fmt.Println("Funding transmitters...") transmittersStr := []string{} + minThreshold := big.NewInt(50000000000000000) // 0.05 ETH + for _, n := range nodeSet.NodeKeys { - transmittersStr = append(transmittersStr, n.EthAddress) + balance, err := getBalance(n.EthAddress, env) + if err != nil { + fmt.Printf("Error fetching balance for %s: %v\n", n.EthAddress, err) + continue + } + if balance.Cmp(minThreshold) < 0 { + transmittersStr = append(transmittersStr, n.EthAddress) + } + } + + if len(transmittersStr) > 0 { + helpers.FundNodes(env, transmittersStr, minThreshold) + } else { + fmt.Println("All transmitters have sufficient funds.") + } +} + +func getBalance(address string, env helpers.Environment) (*big.Int, error) { + balance, err := env.Ec.BalanceAt(context.Background(), common.HexToAddress(address), nil) + if err != nil { + return nil, err } - helpers.FundNodes(env, transmittersStr, big.NewInt(50000000000000000)) // 0.05 ETH + return balance, nil } diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability.go b/core/scripts/keystone/src/02_provision_ocr3_capability.go index 5b6b7eb6c47..6456337bb6e 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability.go @@ -1,12 +1,10 @@ package src import ( - "path/filepath" - "strconv" - "strings" + "bytes" + "text/template" "context" - "errors" "flag" "fmt" "os" @@ -15,7 +13,7 @@ import ( helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability" - "github.com/smartcontractkit/libocr/offchainreporting2/chains/evmutil" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/libocr/offchainreporting2plus/types" ) @@ -39,7 +37,6 @@ func (g *provisionOCR3Capability) Run(args []string) { nodeSetsPath := fs.String("nodesets", defaultNodeSetsPath, "Custom node sets location") nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") - templatesLocation := fs.String("templates", defaultTemplatesDir, "Custom templates location") err := fs.Parse(args) @@ -65,7 +62,6 @@ func (g *provisionOCR3Capability) Run(args []string) { *chainID, *p2pPort, *ocrConfigFile, - *templatesLocation, *artefactsDir, ) } @@ -76,9 +72,8 @@ func provisionOCR3( chainID int64, p2pPort int64, ocrConfigFile string, - templatesLocation string, artefactsDir string, -) (onchainMeta onchainMeta, shouldRedeployJobspecs bool) { +) (onchainMeta *onchainMeta, shouldRedeployJobspecs bool) { onchainMeta, shouldRedeployJobspecs = deployOCR3Contract( nodeSet, env, @@ -90,7 +85,6 @@ func provisionOCR3( nodeSet, chainID, p2pPort, - templatesLocation, artefactsDir, onchainMeta, shouldRedeployJobspecs, @@ -104,7 +98,7 @@ func deployOCR3Contract( env helpers.Environment, configFile string, artefacts string, -) (o onchainMeta, shouldRedeployJobspecs bool) { +) (o *onchainMeta, shouldRedeployJobspecs bool) { o = LoadOnchainMeta(artefacts, env) ocrConf := generateOCR3Config( nodeSet, @@ -120,7 +114,7 @@ func deployOCR3Contract( latestConfigDigest, err := types.BytesToConfigDigest(latestConfigDigestBytes.ConfigDigest[:]) cc := ocrConfToContractConfig(ocrConf, latestConfigDigestBytes.ConfigCount) - digester := evmutil.EVMOffchainConfigDigester{ + digester := evm.OCR3CapabilityOffchainConfigDigester{ ChainID: uint64(env.ChainID), ContractAddress: o.OCRContract.Address(), } @@ -128,11 +122,11 @@ func deployOCR3Contract( PanicErr(err) if digest.Hex() == latestConfigDigest.Hex() { - fmt.Println("OCR3 Contract already deployed with the same config, skipping...") + fmt.Printf("OCR3 Contract already deployed with the same config (digest: %s), skipping...\n", digest.Hex()) return o, false } - fmt.Println("OCR3 Contract contains a different config, updating...") + fmt.Printf("OCR3 Contract contains a different config, updating...\nOld digest: %s\nNew digest: %s\n", latestConfigDigest.Hex(), digest.Hex()) setOCRConfig(o, env, ocrConf, artefacts) return o, true } @@ -155,7 +149,7 @@ func generateOCR3Config(nodeSet NodeSet, configFile string, chainID int64) ksdep return c } -func setOCRConfig(o onchainMeta, env helpers.Environment, ocrConf ksdeploy.Orc2drOracleConfig, artefacts string) { +func setOCRConfig(o *onchainMeta, env helpers.Environment, ocrConf ksdeploy.Orc2drOracleConfig, artefacts string) { tx, err := o.OCRContract.SetConfig(env.Owner, ocrConf.Signers, ocrConf.Transmitters, @@ -174,30 +168,42 @@ func deployOCR3JobSpecsTo( nodeSet NodeSet, chainID int64, p2pPort int64, - templatesDir string, artefactsDir string, - onchainMeta onchainMeta, + onchainMeta *onchainMeta, replaceJob bool, ) { + ocrAddress := onchainMeta.OCRContract.Address().Hex() + nodeKeys := nodeSet.NodeKeys + nodes := nodeSet.Nodes - jobspecs := generateOCR3JobSpecs( - nodeSet, - templatesDir, - chainID, - p2pPort, - onchainMeta.OCRContract.Address().Hex(), - ) - flattenedSpecs := []hostSpec{jobspecs.bootstrap} - flattenedSpecs = append(flattenedSpecs, jobspecs.oracles...) - - if len(nodeSet.Nodes) != len(flattenedSpecs) { - PanicErr(errors.New("Mismatched node and job spec lengths")) - } + var specName string + for i, n := range nodes { + var spec string + + if i == 0 { + bootstrapSpecConfig := BootstrapJobSpecConfig{ + JobSpecName: "ocr3_bootstrap", + OCRConfigContractAddress: ocrAddress, + ChainID: chainID, + } + specName = bootstrapSpecConfig.JobSpecName + spec = createBootstrapJobSpec(bootstrapSpecConfig) + } else { + oc := OracleJobSpecConfig{ + JobSpecName: fmt.Sprintf("ocr3_oracle"), + OCRConfigContractAddress: ocrAddress, + OCRKeyBundleID: nodeKeys[i].OCR2BundleID, + BootstrapURI: fmt.Sprintf("%s@%s:%d", nodeKeys[0].P2PPeerID, nodeSet.Nodes[0].ServiceName, p2pPort), + TransmitterID: nodeKeys[i].EthAddress, + ChainID: chainID, + AptosKeyBundleID: nodeKeys[i].AptosBundleID, + } + specName = oc.JobSpecName + spec = createOracleJobSpec(oc) + } - for i, n := range nodeSet.Nodes { api := newNodeAPI(n) - specToDeploy := flattenedSpecs[i].spec.ToString() - maybeUpsertJob(api, specToDeploy, specToDeploy, replaceJob) + maybeUpsertJob(api, specName, spec, replaceJob) fmt.Printf("Replaying from block: %d\n", onchainMeta.SetConfigTxBlock) fmt.Printf("EVM Chain ID: %d\n\n", chainID) @@ -210,85 +216,6 @@ func deployOCR3JobSpecsTo( } } -type spec []string - -func (s spec) ToString() string { - return strings.Join(s, "\n") -} - -type hostSpec struct { - spec spec - host string -} - -type donHostSpec struct { - bootstrap hostSpec - oracles []hostSpec -} - -func generateOCR3JobSpecs( - nodeSet NodeSet, - templatesDir string, - chainID int64, - p2pPort int64, - ocrConfigContractAddress string, -) donHostSpec { - nodeKeys := nodeKeysToKsDeployNodeKeys(nodeSet.NodeKeys) - nodes := nodeSet.Nodes - bootstrapNode := nodeKeys[0] - - bootstrapSpecLines, err := readLines(filepath.Join(templatesDir, bootstrapSpecTemplate)) - helpers.PanicErr(err) - bootHost := nodes[0].ServiceName - bootstrapSpecLines = replaceOCR3TemplatePlaceholders( - bootstrapSpecLines, - chainID, p2pPort, - ocrConfigContractAddress, bootHost, - bootstrapNode, bootstrapNode, - ) - bootstrap := hostSpec{bootstrapSpecLines, bootHost} - - oracleSpecLinesTemplate, err := readLines(filepath.Join(templatesDir, oracleSpecTemplate)) - helpers.PanicErr(err) - oracles := []hostSpec{} - for i := 1; i < len(nodes); i++ { - oracleSpecLines := oracleSpecLinesTemplate - oracleSpecLines = replaceOCR3TemplatePlaceholders( - oracleSpecLines, - chainID, p2pPort, - ocrConfigContractAddress, bootHost, - bootstrapNode, nodeKeys[i], - ) - oracles = append(oracles, hostSpec{oracleSpecLines, nodes[i].RemoteURL.Host}) - } - - return donHostSpec{ - bootstrap: bootstrap, - oracles: oracles, - } -} - -func replaceOCR3TemplatePlaceholders( - lines []string, - - chainID, p2pPort int64, - contractAddress, bootHost string, - boot, node ksdeploy.NodeKeys, -) (output []string) { - chainIDStr := strconv.FormatInt(chainID, 10) - bootstrapper := fmt.Sprintf("%s@%s:%d", boot.P2PPeerID, bootHost, p2pPort) - for _, l := range lines { - l = strings.Replace(l, "{{ chain_id }}", chainIDStr, 1) - l = strings.Replace(l, "{{ ocr_config_contract_address }}", contractAddress, 1) - l = strings.Replace(l, "{{ transmitter_id }}", node.EthAddress, 1) - l = strings.Replace(l, "{{ ocr_key_bundle_id }}", node.OCR2BundleID, 1) - l = strings.Replace(l, "{{ aptos_key_bundle_id }}", node.AptosBundleID, 1) - l = strings.Replace(l, "{{ bootstrapper_p2p_id }}", bootstrapper, 1) - output = append(output, l) - } - return -} - func mustReadOCR3Config(fileName string) (output ksdeploy.TopLevelConfigSource) { return mustReadJSON[ksdeploy.TopLevelConfigSource](fileName) } @@ -311,3 +238,93 @@ func nodeKeysToKsDeployNodeKeys(nks []NodeKeys) []ksdeploy.NodeKeys { } return keys } + +// BootstrapJobSpecConfig holds configuration for the bootstrap job spec +type BootstrapJobSpecConfig struct { + JobSpecName string + OCRConfigContractAddress string + ChainID int64 +} + +// OracleJobSpecConfig holds configuration for the oracle job spec +type OracleJobSpecConfig struct { + JobSpecName string + OCRConfigContractAddress string + OCRKeyBundleID string + BootstrapURI string + TransmitterID string + ChainID int64 + AptosKeyBundleID string +} + +func createBootstrapJobSpec(config BootstrapJobSpecConfig) string { + const bootstrapTemplate = ` +type = "bootstrap" +schemaVersion = 1 +name = "{{ .JobSpecName }}" +contractID = "{{ .OCRConfigContractAddress }}" +relay = "evm" + +[relayConfig] +chainID = "{{ .ChainID }}" +providerType = "ocr3-capability" +` + + tmpl, err := template.New("bootstrap").Parse(bootstrapTemplate) + if err != nil { + panic(err) + } + + var rendered bytes.Buffer + err = tmpl.Execute(&rendered, config) + if err != nil { + panic(err) + } + + return rendered.String() +} + +func createOracleJobSpec(config OracleJobSpecConfig) string { + const oracleTemplate = ` +type = "offchainreporting2" +schemaVersion = 1 +name = "{{ .JobSpecName }}" +contractID = "{{ .OCRConfigContractAddress }}" +ocrKeyBundleID = "{{ .OCRKeyBundleID }}" +p2pv2Bootstrappers = [ + "{{ .BootstrapURI }}", +] +relay = "evm" +pluginType = "plugin" +transmitterID = "{{ .TransmitterID }}" + +[relayConfig] +chainID = "{{ .ChainID }}" + +[pluginConfig] +command = "chainlink-ocr3-capability" +ocrVersion = 3 +pluginName = "ocr-capability" +providerType = "ocr3-capability" +telemetryType = "plugin" + +[onchainSigningStrategy] +strategyName = 'multi-chain' +[onchainSigningStrategy.config] +evm = "{{ .OCRKeyBundleID }}" +aptos = "{{ .AptosKeyBundleID }}" +` + + tmpl, err := template.New("oracle").Parse(oracleTemplate) + if err != nil { + panic(err) + } + + var rendered bytes.Buffer + err = tmpl.Execute(&rendered, config) + if err != nil { + panic(err) + } + + return rendered.String() +} diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability_test.go b/core/scripts/keystone/src/02_provision_ocr3_capability_test.go index 9624ff5c33c..f6d82e669fa 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability_test.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability_test.go @@ -32,30 +32,35 @@ func TestGenerateOCR3Config(t *testing.T) { snaps.MatchJSON(t, config, matchOffchainConfig) } -func (d *donHostSpec) ToString() string { - var result string - result += "Bootstrap:\n" - result += "Host: " + d.bootstrap.host + "\n" - result += d.bootstrap.spec.ToString() - result += "\n\nOracles:\n" - for i, oracle := range d.oracles { - if i != 0 { - result += "--------------------------------\n" - } - result += fmt.Sprintf("Oracle %d:\n", i) - result += "Host: " + oracle.host + "\n" - result += oracle.spec.ToString() - result += "\n\n" - } - return result -} - func TestGenSpecs(t *testing.T) { nodeSetsPath := "./testdata/node_sets.json" chainID := int64(1337) p2pPort := int64(6690) contractAddress := "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" nodeSet := downloadNodeSets(chainID, nodeSetsPath, 4).Workflow - specs := generateOCR3JobSpecs(nodeSet, "../templates", chainID, p2pPort, contractAddress) - snaps.MatchSnapshot(t, specs.ToString()) + + // Create Bootstrap Job Spec + bootstrapConfig := BootstrapJobSpecConfig{ + JobSpecName: "ocr3_bootstrap", + OCRConfigContractAddress: contractAddress, + ChainID: chainID, + } + bootstrapSpec := createBootstrapJobSpec(bootstrapConfig) + + // Create Oracle Job Spec + oracleConfig := OracleJobSpecConfig{ + JobSpecName: "ocr3_oracle", + OCRConfigContractAddress: contractAddress, + OCRKeyBundleID: nodeSet.NodeKeys[1].OCR2BundleID, + BootstrapURI: fmt.Sprintf("%s@%s:%d", nodeSet.NodeKeys[0].P2PPeerID, nodeSet.Nodes[0].ServiceName, p2pPort), + TransmitterID: nodeSet.NodeKeys[1].P2PPeerID, + ChainID: chainID, + AptosKeyBundleID: nodeSet.NodeKeys[1].AptosBundleID, + } + oracleSpec := createOracleJobSpec(oracleConfig) + + // Combine Specs + generatedSpecs := fmt.Sprintf("%s\n\n%s", bootstrapSpec, oracleSpec) + + snaps.MatchSnapshot(t, generatedSpecs) } diff --git a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go index a1dcd7173e6..527a6fe1b92 100644 --- a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go +++ b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go @@ -254,7 +254,7 @@ func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier *verifierContract.Verif // Prepare data for Mercury V3 Job mercuryData := MercuryV3JobSpecData{ FeedName: fmt.Sprintf("feed-%s", feed.name), - BootstrapHost: fmt.Sprintf("%s@%s:%s", nodeSet.NodeKeys[0].P2PPeerID, nodeSet.Nodes[0].ServiceName, p2pPort), + BootstrapHost: fmt.Sprintf("%s@%s:%d", nodeSet.NodeKeys[0].P2PPeerID, nodeSet.Nodes[0].ServiceName, p2pPort), VerifierAddress: verifier.Address().Hex(), Bridge: feed.bridgeName, NodeCSAKey: n.CSAPublicKey, diff --git a/core/scripts/keystone/src/88_contracts_helpers.go b/core/scripts/keystone/src/88_contracts_helpers.go index cd2b1be0769..148f92fab83 100644 --- a/core/scripts/keystone/src/88_contracts_helpers.go +++ b/core/scripts/keystone/src/88_contracts_helpers.go @@ -38,20 +38,29 @@ type onchainMeta struct { CapabilitiesRegistry capabilities_registry.CapabilitiesRegistryInterface } -func WriteOnchainMeta(o onchainMeta, artefactsDir string) { +func WriteOnchainMeta(o *onchainMeta, artefactsDir string) { _, err := os.Stat(artefactsDir) if err != nil { - fmt.Println("Creating artefacts directory") + fmt.Println("Creating artefacts directory" + artefactsDir) err = os.MkdirAll(artefactsDir, 0700) PanicErr(err) } fmt.Println("Writing deployed contract addresses to file...") - serialzed := OnChainMetaSerialized{ - OCRContract: o.OCRContract.Address(), - ForwarderContract: o.ForwarderContract.Address(), - SetConfigTxBlock: o.SetConfigTxBlock, - CapabilitiesRegistry: o.CapabilitiesRegistry.Address(), + serialzed := OnChainMetaSerialized{} + + if o.OCRContract != nil { + serialzed.OCRContract = o.OCRContract.Address() + } + + if o.ForwarderContract != nil { + serialzed.ForwarderContract = o.ForwarderContract.Address() + } + + serialzed.SetConfigTxBlock = o.SetConfigTxBlock + + if o.CapabilitiesRegistry != nil { + serialzed.CapabilitiesRegistry = o.CapabilitiesRegistry.Address() } jsonBytes, err := json.Marshal(serialzed) @@ -61,28 +70,26 @@ func WriteOnchainMeta(o onchainMeta, artefactsDir string) { PanicErr(err) } -func LoadOnchainMeta(artefactsDir string, env helpers.Environment) onchainMeta { +func LoadOnchainMeta(artefactsDir string, env helpers.Environment) *onchainMeta { + hydrated := &onchainMeta{} if !ContractsAlreadyDeployed(artefactsDir) { fmt.Printf("No deployed contracts file found at %s\n", deployedContractsFilePath(artefactsDir)) - return onchainMeta{} + return hydrated } jsonBytes, err := os.ReadFile(deployedContractsFilePath(artefactsDir)) if err != nil { fmt.Printf("Error reading deployed contracts file: %s\n", err) - return onchainMeta{} + return hydrated } var s OnChainMetaSerialized err = json.Unmarshal(jsonBytes, &s) if err != nil { - return onchainMeta{} - } - - hydrated := onchainMeta{ - SetConfigTxBlock: s.SetConfigTxBlock, + return hydrated } + hydrated.SetConfigTxBlock = s.SetConfigTxBlock if s.OCRContract != ZeroAddress { if !contractExists(s.OCRContract, env) { fmt.Printf("OCR contract at %s does not exist, setting to zero address\n", s.OCRContract.Hex()) @@ -121,8 +128,7 @@ func LoadOnchainMeta(artefactsDir string, env helpers.Environment) onchainMeta { if s.SetConfigTxBlock > blkNum { fmt.Printf("Stale SetConfigTxBlock: %d, current block number: %d\n", s.SetConfigTxBlock, blkNum) - - return onchainMeta{} + return hydrated } return hydrated diff --git a/core/scripts/keystone/src/88_jobspecs_helpers.go b/core/scripts/keystone/src/88_jobspecs_helpers.go index 80c06e56c29..1e81d943a8e 100644 --- a/core/scripts/keystone/src/88_jobspecs_helpers.go +++ b/core/scripts/keystone/src/88_jobspecs_helpers.go @@ -24,7 +24,6 @@ type JobSpec struct { WorkflowSpec WorkflowSpec } - func maybeUpsertJob(api *nodeAPI, jobSpecName string, jobSpecStr string, upsert bool) { jobsResp := api.mustExec(api.methods.ListJobs) jobs := mustJSON[[]JobSpec](jobsResp) @@ -48,3 +47,13 @@ func maybeUpsertJob(api *nodeAPI, jobSpecName string, jobSpecStr string, upsert panic(fmt.Sprintf("Failed to deploy job spec: %s Error: %s", jobSpecStr, err)) } } + +func clearJobs(api *nodeAPI) { + jobsResp := api.mustExec(api.methods.ListJobs) + jobs := mustJSON[[]JobSpec](jobsResp) + for _, job := range *jobs { + fmt.Printf("Deleting job: %s\n", job.Name) + api.withArg(job.Id).mustExec(api.methods.DeleteJob) + } + fmt.Println("All jobs have been deleted.") +} diff --git a/core/scripts/keystone/src/99_files.go b/core/scripts/keystone/src/99_files.go index a4ccccae6d7..df014f74c3e 100644 --- a/core/scripts/keystone/src/99_files.go +++ b/core/scripts/keystone/src/99_files.go @@ -1,57 +1,18 @@ package src import ( - "bufio" "encoding/json" "fmt" "io" "os" - - "github.com/smartcontractkit/chainlink/v2/core/utils" ) const ( defaultArtefactsDir = "artefacts" - defaultTemplatesDir = "templates" defaultNodeSetsPath = ".cache/node_sets.json" deployedContractsJSON = "deployed_contracts.json" - bootstrapSpecTemplate = "bootstrap.toml" - oracleSpecTemplate = "oracle.toml" ) -func writeLines(lines []string, path string) error { - file, err := os.Create(path) - if err != nil { - return err - } - wc := utils.NewDeferableWriteCloser(file) - defer wc.Close() - - w := bufio.NewWriter(file) - for _, line := range lines { - fmt.Fprintln(w, line) - } - if err := w.Flush(); err != nil { - return err - } - return wc.Close() -} - -func readLines(path string) ([]string, error) { - file, err := os.Open(path) - if err != nil { - return nil, err - } - defer file.Close() - - var lines []string - scanner := bufio.NewScanner(file) - for scanner.Scan() { - lines = append(lines, scanner.Text()) - } - return lines, scanner.Err() -} - func mustReadJSON[T any](fileName string) (output T) { jsonFile, err := os.Open(fileName) if err != nil { diff --git a/core/scripts/keystone/src/99_files_test.go b/core/scripts/keystone/src/99_files_test.go deleted file mode 100644 index 83ceb5cd9cc..00000000000 --- a/core/scripts/keystone/src/99_files_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package src - -import ( - "path/filepath" - "strings" - "testing" - - "github.com/stretchr/testify/assert" -) - -func Test_writeLines(t *testing.T) { - type args struct { - lines []string - } - tests := []struct { - name string - args args - }{ - { - name: "write read lines", - args: args{ - lines: []string{"a", "b"}, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - pth := filepath.Join(t.TempDir(), strings.ReplaceAll(tt.name, " ", "_")) - err := writeLines(tt.args.lines, pth) - assert.NoError(t, err) - got, err := readLines(pth) - assert.NoError(t, err) - assert.Equal(t, tt.args.lines, got) - }) - } -} diff --git a/core/scripts/keystone/src/__snapshots__/02_deploy_keystone_workflows_test.snap b/core/scripts/keystone/src/__snapshots__/02_deploy_keystone_workflows_test.snap new file mode 100755 index 00000000000..56506e1f750 --- /dev/null +++ b/core/scripts/keystone/src/__snapshots__/02_deploy_keystone_workflows_test.snap @@ -0,0 +1,57 @@ + +[TestCreateKeystoneWorkflowJob - 1] + +type = "workflow" +schemaVersion = 1 +name = "keystone_workflow" +workflow = """ +name: "ccip_kiab1" +owner: '0x1234567890abcdef1234567890abcdef12345678' +triggers: + - id: streams-trigger@1.0.0 + config: + maxFrequencyMs: 10000 + feedIds: + - 'feed1' + - 'feed2' + - 'feed3' + +consensus: + - id: offchain_reporting@1.0.0 + ref: ccip_feeds + inputs: + observations: + - $(trigger.outputs) + config: + report_id: '0001' + key_id: 'evm' + aggregation_method: data_feeds + aggregation_config: + feeds: + 'feed1': + deviation: '0.05' + heartbeat: 1800 + 'feed2': + deviation: '0.05' + heartbeat: 1800 + 'feed3': + deviation: '0.05' + heartbeat: 1800 + encoder: EVM + encoder_config: + abi: "(bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports" + abi: (bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports + +targets: + - id: target_id + inputs: + signed_report: $(ccip_feeds.outputs) + config: + address: '0xabcdefabcdefabcdefabcdefabcdefabcdef' + deltaStage: 5s + schedule: oneAtATime + +""" +workflowOwner = "0x1234567890abcdef1234567890abcdef12345678" + +--- diff --git a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/02_provision_crib_test.snap similarity index 95% rename from core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap rename to core/scripts/keystone/src/__snapshots__/02_provision_crib_test.snap index 55cb88a0930..06532bea727 100755 --- a/core/scripts/keystone/src/__snapshots__/03_gen_crib_cluster_overrides_cmd_test.snap +++ b/core/scripts/keystone/src/__snapshots__/02_provision_crib_test.snap @@ -14,7 +14,7 @@ helm: ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] - Address = '0x0300000000000000000000000000000000000000' + Address = '0x0200000000000000000000000000000000000000' NetworkID = 'evm' ChainID = '1337' @@ -32,7 +32,7 @@ helm: ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] - Address = '0x0300000000000000000000000000000000000000' + Address = '0x0200000000000000000000000000000000000000' NetworkID = 'evm' ChainID = '1337' @@ -42,7 +42,7 @@ helm: [EVM.Workflow] FromAddress = '0x75cf1355cC4Eb358feaBb9e269a4DAEeB6721DBB' - ForwarderAddress = '0x0200000000000000000000000000000000000000' + ForwarderAddress = '0x0100000000000000000000000000000000000000' 0-ks-wf-node3: image: ${runtime.images.app} overridesToml: | @@ -54,7 +54,7 @@ helm: ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] - Address = '0x0300000000000000000000000000000000000000' + Address = '0x0200000000000000000000000000000000000000' NetworkID = 'evm' ChainID = '1337' @@ -64,7 +64,7 @@ helm: [EVM.Workflow] FromAddress = '0xc6dcE30f492CBD223b9946603192f22D86e783ca' - ForwarderAddress = '0x0200000000000000000000000000000000000000' + ForwarderAddress = '0x0100000000000000000000000000000000000000' 0-ks-wf-node4: image: ${runtime.images.app} overridesToml: | @@ -76,7 +76,7 @@ helm: ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] - Address = '0x0300000000000000000000000000000000000000' + Address = '0x0200000000000000000000000000000000000000' NetworkID = 'evm' ChainID = '1337' @@ -86,7 +86,7 @@ helm: [EVM.Workflow] FromAddress = '0x1289d00A6565Afcd6437B09548F6019EF49696d0' - ForwarderAddress = '0x0200000000000000000000000000000000000000' + ForwarderAddress = '0x0100000000000000000000000000000000000000' 0-ks-wf-node5: image: ${runtime.images.app} overridesToml: | @@ -98,7 +98,7 @@ helm: ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] - Address = '0x0300000000000000000000000000000000000000' + Address = '0x0200000000000000000000000000000000000000' NetworkID = 'evm' ChainID = '1337' @@ -108,7 +108,7 @@ helm: [EVM.Workflow] FromAddress = '0x4b92B0aaC39932B7302676F48e78FA91852DC0EE' - ForwarderAddress = '0x0200000000000000000000000000000000000000' + ForwarderAddress = '0x0100000000000000000000000000000000000000' 1-ks-str-trig-bt-node1: image: ${runtime.images.app} overridesToml: | @@ -120,7 +120,7 @@ helm: ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] - Address = '0x0300000000000000000000000000000000000000' + Address = '0x0200000000000000000000000000000000000000' NetworkID = 'evm' ChainID = '1337' @@ -138,7 +138,7 @@ helm: ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] - Address = '0x0300000000000000000000000000000000000000' + Address = '0x0200000000000000000000000000000000000000' NetworkID = 'evm' ChainID = '1337' @@ -156,7 +156,7 @@ helm: ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] - Address = '0x0300000000000000000000000000000000000000' + Address = '0x0200000000000000000000000000000000000000' NetworkID = 'evm' ChainID = '1337' @@ -174,7 +174,7 @@ helm: ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] - Address = '0x0300000000000000000000000000000000000000' + Address = '0x0200000000000000000000000000000000000000' NetworkID = 'evm' ChainID = '1337' @@ -192,7 +192,7 @@ helm: ListenAddresses = ['0.0.0.0:6691'] [Capabilities.ExternalRegistry] - Address = '0x0300000000000000000000000000000000000000' + Address = '0x0200000000000000000000000000000000000000' NetworkID = 'evm' ChainID = '1337' diff --git a/core/scripts/keystone/src/__snapshots__/02_provision_ocr3_capability_test.snap b/core/scripts/keystone/src/__snapshots__/02_provision_ocr3_capability_test.snap new file mode 100755 index 00000000000..9d38f78899b --- /dev/null +++ b/core/scripts/keystone/src/__snapshots__/02_provision_ocr3_capability_test.snap @@ -0,0 +1,65 @@ + +[TestGenerateOCR3Config - 1] +{ + "F": 1, + "OffchainConfig": "", + "OffchainConfigVersion": 30, + "OnchainConfig": "0x", + "Signers": [ + "011400321bc7af41a634375526006365a31bf32b4cfa7c0520004ca789105da974eec967758ad32b575741d6cb36c1bb3bcfd87b235502cc1753", + "0114005192c43a68efb7a698c0459ff8591a115da128ee052000169008927a60e6c03e99aac6fa268dabaf4d00e117419861d87836211267361b", + "011400ed613636925af2df6ed8332d95028eabcbe95a3f052000ce86b34de67249f92058f69e47961907ebbf8a71c12123f1d2a7cab4874f6365", + "01140053b5bbc0efa2e2d2770029bab5d5a647a260a72b052000f2cb4932d3ce8c10bf67c60d35372a5ff1578255e25c2a119c2dea70e919567a" + ], + "Transmitters": [ + "0x75cf1355cC4Eb358feaBb9e269a4DAEeB6721DBB", + "0xc6dcE30f492CBD223b9946603192f22D86e783ca", + "0x1289d00A6565Afcd6437B09548F6019EF49696d0", + "0x4b92B0aaC39932B7302676F48e78FA91852DC0EE" + ] +} +--- + +[TestGenSpecs - 1] + +type = "bootstrap" +schemaVersion = 1 +name = "ocr3_bootstrap" +contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" +relay = "evm" + +[relayConfig] +chainID = "1337" +providerType = "ocr3-capability" + + + +type = "offchainreporting2" +schemaVersion = 1 +name = "ocr3_oracle" +contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" +ocrKeyBundleID = "20ccdc97afdf467465590115e3da4e5eb591bf5f43808e81a5d0807cd889b3c7" +p2pv2Bootstrappers = [ + "12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6690", +] +relay = "evm" +pluginType = "plugin" +transmitterID = "12D3KooWHhXyDmHB6D1UQosLXmhczw3zxB3DLYBuq9Unb4iCD4Sc" + +[relayConfig] +chainID = "1337" + +[pluginConfig] +command = "chainlink-ocr3-capability" +ocrVersion = 3 +pluginName = "ocr-capability" +providerType = "ocr3-capability" +telemetryType = "plugin" + +[onchainSigningStrategy] +strategyName = 'multi-chain' +[onchainSigningStrategy.config] +evm = "20ccdc97afdf467465590115e3da4e5eb591bf5f43808e81a5d0807cd889b3c7" +aptos = "ac364cec9fe7d9ea1035fc511e5b2f30900caa6e65ac0501168005d05129e088" + +--- diff --git a/core/scripts/keystone/src/__snapshots__/02_provision_streams_trigger_capability_test.snap b/core/scripts/keystone/src/__snapshots__/02_provision_streams_trigger_capability_test.snap new file mode 100755 index 00000000000..07ac61b7264 --- /dev/null +++ b/core/scripts/keystone/src/__snapshots__/02_provision_streams_trigger_capability_test.snap @@ -0,0 +1,50 @@ + +[TestCreateMercuryV3Job - 1] + +type = "offchainreporting2" +schemaVersion = 1 +name = "mercury-BTC/USD" +p2pv2Bootstrappers = ["crib-henry-keystone-node1.main.stage.cldev.sh"] +forwardingAllowed = false +maxTaskDuration = "1s" +contractID = "0x0700000000000000000000000000000000000000" +feedID = "0x0100000000000000000000000000000000000000000000000000000000000000" +contractConfigTrackerPollInterval = "1s" +ocrKeyBundleID = "ocr_key_bundle_id" +relay = "evm" +pluginType = "mercury" +transmitterID = "node_csa_key" +observationSource = """ + price [type=bridge name="bridge_name" timeout="50ms" requestData=""]; + + benchmark_price [type=jsonparse path="result,mid" index=0]; + price -> benchmark_price; + + bid_price [type=jsonparse path="result,bid" index=1]; + price -> bid_price; + + ask_price [type=jsonparse path="result,ask" index=2]; + price -> ask_price; +""" + +[relayConfig] +enableTriggerCapability = true +chainID = "123456" + +--- + +[TestCreateMercuryBootstrapJob - 1] + +type = "bootstrap" +relay = "evm" +schemaVersion = 1 +name = "boot-BTC/USD" +contractID = "0x0700000000000000000000000000000000000000" +feedID = "0x0100000000000000000000000000000000000000000000000000000000000000" +contractConfigTrackerPollInterval = "1s" + +[relayConfig] +chainID = 123456 +enableTriggerCapability = true + +--- diff --git a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap b/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap deleted file mode 100755 index f4fd2beede6..00000000000 --- a/core/scripts/keystone/src/__snapshots__/03_deploy_streams_trigger_cmd_test.snap +++ /dev/null @@ -1,147 +0,0 @@ - -[TestGenStreamsTriggerJobSpecs - 1] - -type = "offchainreporting2" -schemaVersion = 1 -name = "mercury-BTC/USD" -forwardingAllowed = false -maxTaskDuration = "1s" -contractID = "0x0700000000000000000000000000000000000000" -feedID = "0x0100000000000000000000000000000000000000000000000000000000000000" -contractConfigTrackerPollInterval = "1s" -ocrKeyBundleID = "ocr_key_bundle_id" -relay = "evm" -pluginType = "mercury" -transmitterID = "0400000000000000000000000000000000000000000000000000000000000004" -observationSource = """ - price [type=bridge name="bridge_name" timeout="50ms" requestData=""]; - - benchmark_price [type=jsonparse path="result,mid" index=0]; - price -> benchmark_price; - - bid_price [type=jsonparse path="result,bid" index=1]; - price -> bid_price; - - ask_price [type=jsonparse path="result,ask" index=2]; - price -> ask_price; -""" - -[pluginConfig] -# Dummy pub key -serverPubKey = "11a34b5187b1498c0ccb2e56d5ee8040a03a4955822ed208749b474058fc3f9c" -linkFeedID = "0x0200000000000000000000000000000000000000000000000000000000000000" -nativeFeedID = "0x0300000000000000000000000000000000000000000000000000000000000000" -serverURL = "wss://unknown" - -[relayConfig] -enableTriggerCapability = true -chainID = "123456" - ---- - -[TestCreateMercuryBootstrapJob - 1] - -type = "bootstrap" -relay = "evm" -schemaVersion = 1 -name = "boot-BTC/USD" -contractID = "0x0700000000000000000000000000000000000000" -feedID = "0x0100000000000000000000000000000000000000000000000000000000000000" -contractConfigTrackerPollInterval = "1s" - -[relayConfig] -chainID = 123456 -enableTriggerCapability = true - ---- - -[TestCreateMercuryV3Job - 1] - -type = "offchainreporting2" -schemaVersion = 1 -name = "mercury-BTC/USD" -p2pv2Bootstrappers = ["crib-henry-keystone-node1.main.stage.cldev.sh"] -forwardingAllowed = false -maxTaskDuration = "1s" -contractID = "0x0700000000000000000000000000000000000000" -feedID = "0x0100000000000000000000000000000000000000000000000000000000000000" -contractConfigTrackerPollInterval = "1s" -ocrKeyBundleID = "ocr_key_bundle_id" -relay = "evm" -pluginType = "mercury" -transmitterID = "node_csa_key" -observationSource = """ - price [type=bridge name="bridge_name" timeout="50ms" requestData=""]; - - benchmark_price [type=jsonparse path="result,mid" index=0]; - price -> benchmark_price; - - bid_price [type=jsonparse path="result,bid" index=1]; - price -> bid_price; - - ask_price [type=jsonparse path="result,ask" index=2]; - price -> ask_price; -""" - -[relayConfig] -enableTriggerCapability = true -chainID = "123456" - ---- - -[TestCreateKeystoneWorkflowJob - 1] - -type = "workflow" -schemaVersion = 1 -name = "keystone_workflow" -workflow = """ -name: "ccip_kiab1" -owner: '0x1234567890abcdef1234567890abcdef12345678' -triggers: - - id: streams-trigger@1.0.0 - config: - maxFrequencyMs: 10000 - feedIds: - - 'feed1' - - 'feed2' - - 'feed3' - -consensus: - - id: offchain_reporting@1.0.0 - ref: ccip_feeds - inputs: - observations: - - $(trigger.outputs) - config: - report_id: '0001' - key_id: 'evm' - aggregation_method: data_feeds - aggregation_config: - feeds: - 'feed1': - deviation: '0.05' - heartbeat: 1800 - 'feed2': - deviation: '0.05' - heartbeat: 1800 - 'feed3': - deviation: '0.05' - heartbeat: 1800 - encoder: EVM - encoder_config: - abi: "(bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports" - abi: (bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports - -targets: - - id: target_id - inputs: - signed_report: $(ccip_feeds.outputs) - config: - address: '0xabcdefabcdefabcdefabcdefabcdefabcdef' - deltaStage: 5s - schedule: oneAtATime - -""" -workflowOwner = "0x1234567890abcdef1234567890abcdef12345678" - ---- diff --git a/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap b/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap deleted file mode 100755 index ab20fb10ae7..00000000000 --- a/core/scripts/keystone/src/__snapshots__/88_gen_jobspecs_test.snap +++ /dev/null @@ -1,140 +0,0 @@ - -[TestGenSpecs - 1] -Bootstrap: -Host: app-0-ks-wf-bt-node1 -type = "bootstrap" -schemaVersion = 1 -name = "Keystone boot" -contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -relay = "evm" - -[relayConfig] -chainID = "1337" -providerType = "ocr3-capability" - -Oracles: -Oracle 0: -Host: crib-local-0-ks-wf-node2.local -type = "offchainreporting2" -schemaVersion = 1 -name = "Keystone" -contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "20ccdc97afdf467465590115e3da4e5eb591bf5f43808e81a5d0807cd889b3c7" -p2pv2Bootstrappers = [ - "12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6690", -] -relay = "evm" -pluginType = "plugin" -transmitterID = "0x75cf1355cC4Eb358feaBb9e269a4DAEeB6721DBB" - -[relayConfig] -chainID = "1337" - -[pluginConfig] -command = "chainlink-ocr3-capability" -ocrVersion = 3 -pluginName = "ocr-capability" -providerType = "ocr3-capability" -telemetryType = "plugin" - -[onchainSigningStrategy] -strategyName = 'multi-chain' -[onchainSigningStrategy.config] -evm = "20ccdc97afdf467465590115e3da4e5eb591bf5f43808e81a5d0807cd889b3c7" -aptos = "ac364cec9fe7d9ea1035fc511e5b2f30900caa6e65ac0501168005d05129e088" - --------------------------------- -Oracle 1: -Host: crib-local-0-ks-wf-node3.local -type = "offchainreporting2" -schemaVersion = 1 -name = "Keystone" -contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "c734a4bf01aabe8152b7d0df0b18111ce9b3fe1ef1bca1d6a580967c8e4afc2d" -p2pv2Bootstrappers = [ - "12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6690", -] -relay = "evm" -pluginType = "plugin" -transmitterID = "0xc6dcE30f492CBD223b9946603192f22D86e783ca" - -[relayConfig] -chainID = "1337" - -[pluginConfig] -command = "chainlink-ocr3-capability" -ocrVersion = 3 -pluginName = "ocr-capability" -providerType = "ocr3-capability" -telemetryType = "plugin" - -[onchainSigningStrategy] -strategyName = 'multi-chain' -[onchainSigningStrategy.config] -evm = "c734a4bf01aabe8152b7d0df0b18111ce9b3fe1ef1bca1d6a580967c8e4afc2d" -aptos = "f1dfc3d44ee349b4349f33ce4c0ec3716142e9be3ae3ba9276c616556f6430bb" - --------------------------------- -Oracle 2: -Host: crib-local-0-ks-wf-node4.local -type = "offchainreporting2" -schemaVersion = 1 -name = "Keystone" -contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "129377e1aea4f628b2a3274e528a131175ace13e7cc062b048a34f5b4cf7b512" -p2pv2Bootstrappers = [ - "12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6690", -] -relay = "evm" -pluginType = "plugin" -transmitterID = "0x1289d00A6565Afcd6437B09548F6019EF49696d0" - -[relayConfig] -chainID = "1337" - -[pluginConfig] -command = "chainlink-ocr3-capability" -ocrVersion = 3 -pluginName = "ocr-capability" -providerType = "ocr3-capability" -telemetryType = "plugin" - -[onchainSigningStrategy] -strategyName = 'multi-chain' -[onchainSigningStrategy.config] -evm = "129377e1aea4f628b2a3274e528a131175ace13e7cc062b048a34f5b4cf7b512" -aptos = "2e39d555ec0d1e8795167d72d2a53faa5c537762c144f8a569c601f6bcc95d1d" - --------------------------------- -Oracle 3: -Host: crib-local-0-ks-wf-node5.local -type = "offchainreporting2" -schemaVersion = 1 -name = "Keystone" -contractID = "0xB29934624cAe3765E33115A9530a13f5aEC7fa8A" -ocrKeyBundleID = "053f21bfd2bbdb65261308af2d0be48593229d644d8b9e3e5dbe36f85399ae6c" -p2pv2Bootstrappers = [ - "12D3KooWFSmZaLFF1nu3mzxPKj43F89WgVDqkpvwFUHBfMHSqpVq@app-0-ks-wf-bt-node1:6690", -] -relay = "evm" -pluginType = "plugin" -transmitterID = "0x4b92B0aaC39932B7302676F48e78FA91852DC0EE" - -[relayConfig] -chainID = "1337" - -[pluginConfig] -command = "chainlink-ocr3-capability" -ocrVersion = 3 -pluginName = "ocr-capability" -providerType = "ocr3-capability" -telemetryType = "plugin" - -[onchainSigningStrategy] -strategyName = 'multi-chain' -[onchainSigningStrategy.config] -evm = "053f21bfd2bbdb65261308af2d0be48593229d644d8b9e3e5dbe36f85399ae6c" -aptos = "3de7ab03a5b6b7fcfd196c6101d9302c5e6a5221ebd82b1fd9afa9a6bc9b0445" - - ---- diff --git a/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap b/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap deleted file mode 100755 index 76c7b8965d3..00000000000 --- a/core/scripts/keystone/src/__snapshots__/88_gen_ocr3_config_test.snap +++ /dev/null @@ -1,21 +0,0 @@ - -[TestGenerateOCR3Config - 1] -{ - "F": 1, - "OffchainConfig": "", - "OffchainConfigVersion": 30, - "OnchainConfig": "0x", - "Signers": [ - "011400321bc7af41a634375526006365a31bf32b4cfa7c0520004ca789105da974eec967758ad32b575741d6cb36c1bb3bcfd87b235502cc1753", - "0114005192c43a68efb7a698c0459ff8591a115da128ee052000169008927a60e6c03e99aac6fa268dabaf4d00e117419861d87836211267361b", - "011400ed613636925af2df6ed8332d95028eabcbe95a3f052000ce86b34de67249f92058f69e47961907ebbf8a71c12123f1d2a7cab4874f6365", - "01140053b5bbc0efa2e2d2770029bab5d5a647a260a72b052000f2cb4932d3ce8c10bf67c60d35372a5ff1578255e25c2a119c2dea70e919567a" - ], - "Transmitters": [ - "0x75cf1355cC4Eb358feaBb9e269a4DAEeB6721DBB", - "0xc6dcE30f492CBD223b9946603192f22D86e783ca", - "0x1289d00A6565Afcd6437B09548F6019EF49696d0", - "0x4b92B0aaC39932B7302676F48e78FA91852DC0EE" - ] -} ---- diff --git a/core/scripts/keystone/templates/bootstrap.toml b/core/scripts/keystone/templates/bootstrap.toml deleted file mode 100644 index cdd9065caba..00000000000 --- a/core/scripts/keystone/templates/bootstrap.toml +++ /dev/null @@ -1,9 +0,0 @@ -type = "bootstrap" -schemaVersion = 1 -name = "Keystone boot" -contractID = "{{ ocr_config_contract_address }}" -relay = "evm" - -[relayConfig] -chainID = "{{ chain_id }}" -providerType = "ocr3-capability" diff --git a/core/scripts/keystone/templates/oracle.toml b/core/scripts/keystone/templates/oracle.toml deleted file mode 100644 index 053baa2223b..00000000000 --- a/core/scripts/keystone/templates/oracle.toml +++ /dev/null @@ -1,27 +0,0 @@ -type = "offchainreporting2" -schemaVersion = 1 -name = "Keystone" -contractID = "{{ ocr_config_contract_address }}" -ocrKeyBundleID = "{{ ocr_key_bundle_id }}" -p2pv2Bootstrappers = [ - "{{ bootstrapper_p2p_id }}", -] -relay = "evm" -pluginType = "plugin" -transmitterID = "{{ transmitter_id }}" - -[relayConfig] -chainID = "{{ chain_id }}" - -[pluginConfig] -command = "chainlink-ocr3-capability" -ocrVersion = 3 -pluginName = "ocr-capability" -providerType = "ocr3-capability" -telemetryType = "plugin" - -[onchainSigningStrategy] -strategyName = 'multi-chain' -[onchainSigningStrategy.config] -evm = "{{ ocr_key_bundle_id }}" -aptos = "{{ aptos_key_bundle_id }}" From e63bca369f1ca1d392c5056009b34099586ae9cd Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 30 Oct 2024 10:43:01 -0700 Subject: [PATCH 076/117] Create artefacts dir if it doesnt exist --- core/scripts/keystone/artefacts/README.md | 1 - core/scripts/keystone/src/01_provision_keystone.go | 1 - core/scripts/keystone/src/02_provision_crib.go | 1 + core/scripts/keystone/src/88_contracts_helpers.go | 7 +------ core/scripts/keystone/src/99_files.go | 9 +++++++++ 5 files changed, 11 insertions(+), 8 deletions(-) delete mode 100644 core/scripts/keystone/artefacts/README.md diff --git a/core/scripts/keystone/artefacts/README.md b/core/scripts/keystone/artefacts/README.md deleted file mode 100644 index 68f06dbd1c8..00000000000 --- a/core/scripts/keystone/artefacts/README.md +++ /dev/null @@ -1 +0,0 @@ -All generated artefacts will be saved here. \ No newline at end of file diff --git a/core/scripts/keystone/src/01_provision_keystone.go b/core/scripts/keystone/src/01_provision_keystone.go index af04642b078..9b39b371362 100644 --- a/core/scripts/keystone/src/01_provision_keystone.go +++ b/core/scripts/keystone/src/01_provision_keystone.go @@ -58,7 +58,6 @@ func (g *provisionKeystone) Run(args []string) { nodeSets := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize) if *clean { - fmt.Println("Cleaning up resources") // clean nodesets path err = os.RemoveAll(*nodeSetsPath) diff --git a/core/scripts/keystone/src/02_provision_crib.go b/core/scripts/keystone/src/02_provision_crib.go index c5e0bc59494..20ab0c648b8 100644 --- a/core/scripts/keystone/src/02_provision_crib.go +++ b/core/scripts/keystone/src/02_provision_crib.go @@ -113,6 +113,7 @@ func writeCribConfig(chart Helm, outputPath string) { _, err = os.Stdout.Write(yamlData) helpers.PanicErr(err) } else { + ensureArtefactsDir(filepath.Dir(outputPath)) err = os.WriteFile(filepath.Join(outputPath), yamlData, 0600) helpers.PanicErr(err) } diff --git a/core/scripts/keystone/src/88_contracts_helpers.go b/core/scripts/keystone/src/88_contracts_helpers.go index 148f92fab83..3a6a365d23d 100644 --- a/core/scripts/keystone/src/88_contracts_helpers.go +++ b/core/scripts/keystone/src/88_contracts_helpers.go @@ -39,12 +39,7 @@ type onchainMeta struct { } func WriteOnchainMeta(o *onchainMeta, artefactsDir string) { - _, err := os.Stat(artefactsDir) - if err != nil { - fmt.Println("Creating artefacts directory" + artefactsDir) - err = os.MkdirAll(artefactsDir, 0700) - PanicErr(err) - } + ensureArtefactsDir(artefactsDir) fmt.Println("Writing deployed contract addresses to file...") serialzed := OnChainMetaSerialized{} diff --git a/core/scripts/keystone/src/99_files.go b/core/scripts/keystone/src/99_files.go index df014f74c3e..1848ba8fae9 100644 --- a/core/scripts/keystone/src/99_files.go +++ b/core/scripts/keystone/src/99_files.go @@ -43,3 +43,12 @@ func mustWriteJSON[T any](fileName string, data T) { panic(fmt.Sprintf("failed to encode data: %v", err)) } } + +func ensureArtefactsDir(artefactsDir string) { + _, err := os.Stat(artefactsDir) + if err != nil { + fmt.Println("Creating artefacts directory" + artefactsDir) + err = os.MkdirAll(artefactsDir, 0700) + PanicErr(err) + } +} From 61075290b04b768c8bd366e652f5e03c79521ff8 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:01:08 -0700 Subject: [PATCH 077/117] Simplify jobspec and bridge handling --- .../keystone/src/01_provision_keystone.go | 8 +-- .../src/02_deploy_keystone_workflows.go | 11 ++-- .../src/02_provision_ocr3_capability.go | 10 ++-- ...02_provision_streams_trigger_capability.go | 54 ++++++++++--------- .../keystone/src/88_jobspecs_helpers.go | 7 +-- 5 files changed, 40 insertions(+), 50 deletions(-) diff --git a/core/scripts/keystone/src/01_provision_keystone.go b/core/scripts/keystone/src/01_provision_keystone.go index 9b39b371362..d86b833a9e5 100644 --- a/core/scripts/keystone/src/01_provision_keystone.go +++ b/core/scripts/keystone/src/01_provision_keystone.go @@ -34,7 +34,6 @@ func (g *provisionKeystone) Run(args []string) { // provisioning flags ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") accountKey := fs.String("accountkey", "", "private key of the account to deploy from") - replaceResources := fs.Bool("replaceresources", false, "replace jobs if they already exist") ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") p2pPort := fs.Int64("p2pport", 6690, "p2p port") capabilitiesP2PPort := fs.Int64("capabilitiesp2pport", 6691, "p2p port for capabilities") @@ -90,7 +89,6 @@ func (g *provisionKeystone) Run(args []string) { *chainID, *p2pPort, *ocrConfigFile, - *replaceResources, ) reg := provisionCapabillitiesRegistry( @@ -107,7 +105,6 @@ func (g *provisionKeystone) Run(args []string) { *p2pPort, *ocrConfigFile, *artefactsDir, - *replaceResources, reg, ) @@ -127,7 +124,6 @@ func provisionStreamsDON( chainID int64, p2pPort int64, ocrConfigFilePath string, - replaceResources bool, ) { setupStreamsTrigger( env, @@ -135,7 +131,6 @@ func provisionStreamsDON( chainID, p2pPort, ocrConfigFilePath, - replaceResources, ) } @@ -146,7 +141,6 @@ func provisionWorkflowDON( p2pPort int64, ocrConfigFile string, artefactsDir string, - replaceJob bool, reg kcr.CapabilitiesRegistryInterface, ) (onchainMeta *onchainMeta) { deployForwarder(env, artefactsDir) @@ -164,7 +158,7 @@ func provisionWorkflowDON( // We don't technically need the capability registry as a dependency // as we just use it for a sanity check // We could remove it so that we can execute provisioning in parallel - deployKeystoneWorkflowsTo(nodeSet, reg, chainID, replaceJob) + deployKeystoneWorkflowsTo(nodeSet, reg, chainID) return onchainMeta } diff --git a/core/scripts/keystone/src/02_deploy_keystone_workflows.go b/core/scripts/keystone/src/02_deploy_keystone_workflows.go index 470b8b6e8b6..d9814e08f0a 100644 --- a/core/scripts/keystone/src/02_deploy_keystone_workflows.go +++ b/core/scripts/keystone/src/02_deploy_keystone_workflows.go @@ -4,12 +4,12 @@ import ( "bytes" "flag" "fmt" - "text/template" "os" + "text/template" "github.com/ethereum/go-ethereum/accounts/abi/bind" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" ) type deployKeystoneWorkflows struct{} @@ -27,7 +27,6 @@ func (g *deployKeystoneWorkflows) Run(args []string) { chainID := fs.Int64("chainid", 1337, "chain id") nodeSetsPath := fs.String("nodesets", defaultNodeSetsPath, "Custom node sets location") nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") - replaceJob := fs.Bool("replacejob", false, "replace jobs if they already exist") ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") accountKey := fs.String("accountkey", "", "private key of the account to deploy from") @@ -47,10 +46,10 @@ func (g *deployKeystoneWorkflows) Run(args []string) { env := helpers.SetupEnv(false) o := LoadOnchainMeta(*artefactsDir, env) - deployKeystoneWorkflowsTo(workflowNodeSet, o.CapabilitiesRegistry, *chainID, *replaceJob) + deployKeystoneWorkflowsTo(workflowNodeSet, o.CapabilitiesRegistry, *chainID) } -func deployKeystoneWorkflowsTo(nodeSet NodeSet, reg kcr.CapabilitiesRegistryInterface, chainID int64, replaceJob bool) { +func deployKeystoneWorkflowsTo(nodeSet NodeSet, reg kcr.CapabilitiesRegistryInterface, chainID int64) { fmt.Println("Deploying Keystone workflow jobs") caps, err := reg.GetCapabilities(&bind.CallOpts{}) PanicErr(err) @@ -93,7 +92,7 @@ func deployKeystoneWorkflowsTo(nodeSet NodeSet, reg kcr.CapabilitiesRegistryInte jobSpecStr := createKeystoneWorkflowJob(workflowConfig) for _, n := range nodeSet.Nodes[1:] { // skip the bootstrap node api := newNodeAPI(n) - maybeUpsertJob(api, workflowConfig.JobSpecName, jobSpecStr, replaceJob) + upsertJob(api, workflowConfig.JobSpecName, jobSpecStr) } } diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability.go b/core/scripts/keystone/src/02_provision_ocr3_capability.go index 6456337bb6e..75b92a87017 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability.go @@ -73,8 +73,8 @@ func provisionOCR3( p2pPort int64, ocrConfigFile string, artefactsDir string, -) (onchainMeta *onchainMeta, shouldRedeployJobspecs bool) { - onchainMeta, shouldRedeployJobspecs = deployOCR3Contract( +) (onchainMeta *onchainMeta, cacheHit bool) { + onchainMeta, cacheHit = deployOCR3Contract( nodeSet, env, ocrConfigFile, @@ -87,7 +87,6 @@ func provisionOCR3( p2pPort, artefactsDir, onchainMeta, - shouldRedeployJobspecs, ) return @@ -98,7 +97,7 @@ func deployOCR3Contract( env helpers.Environment, configFile string, artefacts string, -) (o *onchainMeta, shouldRedeployJobspecs bool) { +) (o *onchainMeta, cacheHit bool) { o = LoadOnchainMeta(artefacts, env) ocrConf := generateOCR3Config( nodeSet, @@ -170,7 +169,6 @@ func deployOCR3JobSpecsTo( p2pPort int64, artefactsDir string, onchainMeta *onchainMeta, - replaceJob bool, ) { ocrAddress := onchainMeta.OCRContract.Address().Hex() nodeKeys := nodeSet.NodeKeys @@ -203,7 +201,7 @@ func deployOCR3JobSpecsTo( } api := newNodeAPI(n) - maybeUpsertJob(api, specName, spec, replaceJob) + upsertJob(api, specName, spec) fmt.Printf("Replaying from block: %d\n", onchainMeta.SetConfigTxBlock) fmt.Printf("EVM Chain ID: %d\n\n", chainID) diff --git a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go index 527a6fe1b92..389b42ae067 100644 --- a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go +++ b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go @@ -67,7 +67,6 @@ func (g *provisionStreamsTrigger) Run(args []string) { p2pPort := fs.Int64("p2pport", 6690, "p2p port") ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") - replaceResources := fs.Bool("replaceresources", false, "Replace bridges and jobs if they already exist") nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") @@ -101,7 +100,6 @@ func (g *provisionStreamsTrigger) Run(args []string) { *chainID, *p2pPort, *ocrConfigFile, - *replaceResources, ) } @@ -147,11 +145,9 @@ func setupStreamsTrigger( chainId int64, p2pPort int64, ocrConfigFilePath string, - replaceResources bool, ) { fmt.Printf("Deploying streams trigger for chain %d\n", chainId) fmt.Printf("Using OCR config file: %s\n", ocrConfigFilePath) - fmt.Printf("ReplaceResources: %t\n\n", replaceResources) fmt.Printf("Deploying Mercury V0.3 contracts\n") _, _, _, verifier := deployMercuryV03Contracts(env) @@ -186,7 +182,7 @@ func setupStreamsTrigger( PanicErr(err) fmt.Printf("Deploying OCR2 job specs for feed %s\n", feed.name) - deployOCR2JobSpecsForFeed(nodeSet, verifier, feed, chainId, p2pPort, replaceResources) + deployOCR2JobSpecsForFeed(nodeSet, verifier, feed, chainId, p2pPort) } fmt.Println("Finished deploying streams trigger") @@ -229,7 +225,7 @@ func deployMercuryV03Contracts(env helpers.Environment) (linkToken *link_token_i return } -func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier *verifierContract.Verifier, feed feed, chainId int64, p2pPort int64, replaceJob bool) { +func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier *verifierContract.Verifier, feed feed, chainId int64, p2pPort int64) { // we assign the first node as the bootstrap node for i, n := range nodeSet.NodeKeys { // parallel arrays @@ -237,7 +233,7 @@ func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier *verifierContract.Verif jobSpecName := "" jobSpecStr := "" - createBridgeIfDoesNotExist(api, feed.bridgeName, feed.bridgeUrl, replaceJob) + createBridgeIfDoesNotExist(api, feed.bridgeName, feed.bridgeUrl) if i == 0 { // Prepare data for Bootstrap Job @@ -269,7 +265,7 @@ func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier *verifierContract.Verif jobSpecName, jobSpecStr = createMercuryV3OracleJob(mercuryData) } - maybeUpsertJob(api, jobSpecName, jobSpecStr, replaceJob) + upsertJob(api, jobSpecName, jobSpecStr) } } @@ -397,7 +393,7 @@ func strToBytes32(str string) [32]byte { return pkBytesFixed } -func createBridgeIfDoesNotExist(api *nodeAPI, name string, eaURL string, replaceBridge bool) { +func createBridgeIfDoesNotExist(api *nodeAPI, name string, eaURL string) { u, err := url.Parse(eaURL) url := models.WebURL(*u) // Confirmations and MinimumContractPayment are not used, so we can leave them as 0 @@ -409,33 +405,41 @@ func createBridgeIfDoesNotExist(api *nodeAPI, name string, eaURL string, replace helpers.PanicErr(err) payload := string(payloadb) - fmt.Printf("Creating bridge (%s): %s\n", name, eaURL) - if doesBridgeExist(api, name) { - if replaceBridge { - fmt.Println("Updating existing bridge") - api.withArgs(name, payload).mustExec(api.methods.UpdateBridge) - fmt.Println("Updated bridge", name) - } else { - fmt.Println("Bridge", name, "already exists, skipping creation") - return - } - } else { + bridgeActionType := bridgeAction(api, b) + switch bridgeActionType { + case shouldCreateBridge: + fmt.Printf("Creating bridge (%s): %s\n", name, eaURL) resp := api.withArg(payload).mustExec(api.methods.CreateBridge) resource := mustJSON[presenters.BridgeResource](resp) fmt.Printf("Created bridge: %s %s\n", resource.Name, resource.URL) + case shouldUpdateBridge: + fmt.Println("Updating existing bridge") + api.withArgs(name, payload).mustExec(api.methods.UpdateBridge) + fmt.Println("Updated bridge", name) + case shouldNoChangeBridge: + fmt.Println("No changes needed for bridge", name) } } -func doesBridgeExist(api *nodeAPI, name string) bool { - resp, err := api.withArg(name).exec(api.methods.ShowBridge) +// create enum for 3 states: create, update, no change +var ( + shouldCreateBridge = 0 + shouldUpdateBridge = 1 + shouldNoChangeBridge = 2 +) +func bridgeAction(api *nodeAPI, existingBridge bridges.BridgeTypeRequest) int { + resp, err := api.withArg(existingBridge.Name.String()).exec(api.methods.ShowBridge) if err != nil { - return false + return shouldCreateBridge } b := mustJSON[presenters.BridgeResource](resp) - fmt.Printf("Found bridge: %s with URL: %s\n", b.Name, b.URL) - return true + fmt.Printf("Found matching bridge: %s with URL: %s\n", b.Name, b.URL) + if b.URL == existingBridge.URL.String() { + return shouldNoChangeBridge + } + return shouldUpdateBridge } func generateMercuryOCR2Config(nca []NodeKeys) MercuryOCR2Config { diff --git a/core/scripts/keystone/src/88_jobspecs_helpers.go b/core/scripts/keystone/src/88_jobspecs_helpers.go index 1e81d943a8e..5d5b782cddb 100644 --- a/core/scripts/keystone/src/88_jobspecs_helpers.go +++ b/core/scripts/keystone/src/88_jobspecs_helpers.go @@ -24,16 +24,11 @@ type JobSpec struct { WorkflowSpec WorkflowSpec } -func maybeUpsertJob(api *nodeAPI, jobSpecName string, jobSpecStr string, upsert bool) { +func upsertJob(api *nodeAPI, jobSpecName string, jobSpecStr string) { jobsResp := api.mustExec(api.methods.ListJobs) jobs := mustJSON[[]JobSpec](jobsResp) for _, job := range *jobs { if job.Name == jobSpecName { - if !upsert { - fmt.Printf("Job already exists: %s, skipping..\n", jobSpecName) - return - } - fmt.Printf("Job already exists: %s, replacing..\n", jobSpecName) api.withArg(job.Id).mustExec(api.methods.DeleteJob) fmt.Printf("Deleted job: %s\n", jobSpecName) From 254d4f2db826cdb38749c550a8a61889513c92fb Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:24:32 -0700 Subject: [PATCH 078/117] Remove unneeded token transfer calls --- ...02_provision_streams_trigger_capability.go | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go index 389b42ae067..84bc059340b 100644 --- a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go +++ b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go @@ -41,7 +41,6 @@ import ( helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "github.com/smartcontractkit/chainlink/v2/core/bridges" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" verifierContract "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier" @@ -150,7 +149,7 @@ func setupStreamsTrigger( fmt.Printf("Using OCR config file: %s\n", ocrConfigFilePath) fmt.Printf("Deploying Mercury V0.3 contracts\n") - _, _, _, verifier := deployMercuryV03Contracts(env) + verifier := deployMercuryV03Contracts(env) fmt.Printf("Generating Mercury OCR config\n") ocrConfig := generateMercuryOCR2Config(nodeSet.NodeKeys[1:]) // skip the bootstrap node @@ -188,7 +187,7 @@ func setupStreamsTrigger( fmt.Println("Finished deploying streams trigger") } -func deployMercuryV03Contracts(env helpers.Environment) (linkToken *link_token_interface.LinkToken, nativeToken *link_token_interface.LinkToken, verifierProxy *verifier_proxy.VerifierProxy, verifier *verifierContract.Verifier) { +func deployMercuryV03Contracts(env helpers.Environment) (verifier *verifierContract.Verifier) { var confirmDeploy = func(tx *types.Transaction, err error) { helpers.ConfirmContractDeployed(context.Background(), env.Ec, tx, env.ChainID) PanicErr(err) @@ -198,21 +197,6 @@ func deployMercuryV03Contracts(env helpers.Environment) (linkToken *link_token_i PanicErr(err) } - _, tx, linkToken, err := link_token_interface.DeployLinkToken(env.Owner, env.Ec) - confirmDeploy(tx, err) - - // Not sure if we actually need to have tokens - tx, err = linkToken.Transfer(env.Owner, env.Owner.From, big.NewInt(1000)) - confirmTx(tx, err) - - // We reuse the link token for the native token - _, tx, nativeToken, err = link_token_interface.DeployLinkToken(env.Owner, env.Ec) - confirmDeploy(tx, err) - - // Not sure if we actually need to have tokens - tx, err = nativeToken.Transfer(env.Owner, env.Owner.From, big.NewInt(1000)) - confirmTx(tx, err) - verifierProxyAddr, tx, verifierProxy, err := verifier_proxy.DeployVerifierProxy(env.Owner, env.Ec, common.Address{}) // zero address for access controller disables access control confirmDeploy(tx, err) From 403b13504086d7b89e6e9217ec7c37b3d27e31b9 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:49:57 -0700 Subject: [PATCH 079/117] Refactor: Cleanup logging, add more tx caching --- core/scripts/go.mod | 1 + core/scripts/go.sum | 2 + .../keystone/src/01_provision_keystone.go | 60 +++++++++- .../keystone/src/02_fund_transmitters.go | 18 ++- .../src/02_provision_capabilities_registry.go | 1 + .../scripts/keystone/src/02_provision_crib.go | 2 +- .../src/02_provision_forwarder_contract.go | 5 +- .../src/02_provision_ocr3_capability.go | 12 +- ...02_provision_streams_trigger_capability.go | 106 +++++++++++++----- .../src/88_capabilities_registry_helpers.go | 5 + .../keystone/src/88_contracts_helpers.go | 84 ++++++++++---- .../keystone/src/88_jobspecs_helpers.go | 3 +- core/scripts/keystone/src/88_ocr_helpers.go | 37 +++++- core/scripts/keystone/src/99_app.go | 101 ++++++++++------- core/scripts/keystone/src/99_crib_client.go | 13 --- 15 files changed, 326 insertions(+), 124 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index bb7fe46fe48..6a44d0cdde2 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -297,6 +297,7 @@ require ( github.com/smartcontractkit/chainlink-protos/orchestrator v0.3.0 // indirect github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241104202120-39cabce465f6 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241017135645-176a23722fd8 // indirect + github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.12 github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20241009055228-33d0c0bf38de // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 86c93da9e33..fa4e8f11c14 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1108,6 +1108,8 @@ github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241104202120-39cabce465f github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241104202120-39cabce465f6/go.mod h1:iZugccCLpPWtcGiR/8gurre2j3RtyKnqd1FcVR0NzQw= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241017135645-176a23722fd8 h1:B4DFdk6MGcQnoCjjMBCx7Z+GWQpxRWJ4O8W/dVJyWGA= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241017135645-176a23722fd8/go.mod h1:WkBqgBo+g34Gm5vWkDDl8Fh3Mzd7bF5hXp7rryg0t5o= +github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.12 h1:B3+KM0cNxEtynbKnvixHnW5oUCq1Dv3b0gTKYRt3dOs= +github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.12/go.mod h1:Mi8q2e6gSnBhVdYehNesfh3aJMibGpS/nzgfN1yHoFY= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 h1:NzZGjaqez21I3DU7objl3xExTH4fxYvzTqar8DC6360= diff --git a/core/scripts/keystone/src/01_provision_keystone.go b/core/scripts/keystone/src/01_provision_keystone.go index d86b833a9e5..9faa950744b 100644 --- a/core/scripts/keystone/src/01_provision_keystone.go +++ b/core/scripts/keystone/src/01_provision_keystone.go @@ -50,7 +50,13 @@ func (g *provisionKeystone) Run(args []string) { } if *preprovison { - fmt.Printf("Preprovisioning crib with %d nodes per set\n", *nodeSetSize) + fmt.Println() + fmt.Println() + fmt.Println("========================") + fmt.Println("Writing Preprovisioning Config") + fmt.Println("========================") + fmt.Println() + fmt.Println() writePreprovisionConfig(*nodeSetSize, filepath.Join(*artefactsDir, *preprovisionConfigName)) return } @@ -82,16 +88,16 @@ func (g *provisionKeystone) Run(args []string) { os.Setenv("INSECURE_SKIP_VERIFY", "true") env := helpers.SetupEnv(false) - provisionStreamsDON( env, nodeSets.StreamsTrigger, *chainID, *p2pPort, *ocrConfigFile, + *artefactsDir, ) - reg := provisionCapabillitiesRegistry( + reg := provisionCapabilitiesRegistry( env, nodeSets, *chainID, @@ -108,29 +114,68 @@ func (g *provisionKeystone) Run(args []string) { reg, ) + fmt.Println() + fmt.Println() + fmt.Println("========================") + fmt.Println("Writing Postprovision Config") + fmt.Println("========================") + fmt.Println() + fmt.Println() + writePostProvisionConfig( nodeSets, *chainID, *capabilitiesP2PPort, - onchainMeta.ForwarderContract.Address().Hex(), + onchainMeta.Forwarder.Address().Hex(), onchainMeta.CapabilitiesRegistry.Address().Hex(), filepath.Join(*artefactsDir, *postprovisionConfigName), ) } +func provisionCapabilitiesRegistry( + env helpers.Environment, + nodeSets NodeSets, + chainID int64, + artefactsDir string, +) kcr.CapabilitiesRegistryInterface { + fmt.Println() + fmt.Println() + fmt.Println("========================") + fmt.Println("Provisioning Capabilities Registry DON") + fmt.Println("========================") + fmt.Println() + fmt.Println() + reg := provisionCapabillitiesRegistry( + env, + nodeSets, + chainID, + artefactsDir, + ) + return reg +} + func provisionStreamsDON( env helpers.Environment, nodeSet NodeSet, chainID int64, p2pPort int64, ocrConfigFilePath string, + artefactsDir string, ) { + fmt.Println() + fmt.Println() + fmt.Println("========================") + fmt.Println("Provisioning streams DON") + fmt.Println("========================") + fmt.Println() + fmt.Println() setupStreamsTrigger( env, nodeSet, chainID, p2pPort, ocrConfigFilePath, + artefactsDir, ) } @@ -143,6 +188,13 @@ func provisionWorkflowDON( artefactsDir string, reg kcr.CapabilitiesRegistryInterface, ) (onchainMeta *onchainMeta) { + fmt.Println() + fmt.Println() + fmt.Println("========================") + fmt.Println("Provisioning workflow DON") + fmt.Println("========================") + fmt.Println() + fmt.Println() deployForwarder(env, artefactsDir) onchainMeta, _ = provisionOCR3( diff --git a/core/scripts/keystone/src/02_fund_transmitters.go b/core/scripts/keystone/src/02_fund_transmitters.go index dcbf91d6aca..0a8403c8b3c 100644 --- a/core/scripts/keystone/src/02_fund_transmitters.go +++ b/core/scripts/keystone/src/02_fund_transmitters.go @@ -1,14 +1,16 @@ package src import ( + "context" "flag" "fmt" "math/big" "os" - "context" - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "github.com/ethereum/go-ethereum/common" + + "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/conversions" + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" ) type fundTransmitters struct{} @@ -53,7 +55,8 @@ func (g *fundTransmitters) Run(args []string) { func distributeFunds(nodeSet NodeSet, env helpers.Environment) { fmt.Println("Funding transmitters...") transmittersStr := []string{} - minThreshold := big.NewInt(50000000000000000) // 0.05 ETH + fundingAmount := big.NewInt(500000000000000000) // 0.5 ETH + minThreshold := big.NewInt(50000000000000000) // 0.05 ETH for _, n := range nodeSet.NodeKeys { balance, err := getBalance(n.EthAddress, env) @@ -62,12 +65,19 @@ func distributeFunds(nodeSet NodeSet, env helpers.Environment) { continue } if balance.Cmp(minThreshold) < 0 { + fmt.Printf( + "Transmitter %s has insufficient funds, funding with %s ETH. Current balance: %s, threshold: %s\n", + n.EthAddress, + conversions.WeiToEther(fundingAmount).String(), + conversions.WeiToEther(balance).String(), + conversions.WeiToEther(minThreshold).String(), + ) transmittersStr = append(transmittersStr, n.EthAddress) } } if len(transmittersStr) > 0 { - helpers.FundNodes(env, transmittersStr, minThreshold) + helpers.FundNodes(env, transmittersStr, fundingAmount) } else { fmt.Println("All transmitters have sufficient funds.") } diff --git a/core/scripts/keystone/src/02_provision_capabilities_registry.go b/core/scripts/keystone/src/02_provision_capabilities_registry.go index 14bce1c391e..74f0f7ac4f2 100644 --- a/core/scripts/keystone/src/02_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/02_provision_capabilities_registry.go @@ -63,6 +63,7 @@ func (c *provisionCR) Run(args []string) { } func provisionCapabillitiesRegistry(env helpers.Environment, nodeSets NodeSets, chainID int64, artefactsDir string) kcr.CapabilitiesRegistryInterface { + fmt.Printf("Provisioning capabilities registry on chain %d\n", chainID) ctx := context.Background() reg := deployCR(ctx, artefactsDir, env) crProvisioner := NewCapabilityRegistryProvisioner(reg, env) diff --git a/core/scripts/keystone/src/02_provision_crib.go b/core/scripts/keystone/src/02_provision_crib.go index 20ab0c648b8..e98bfa6e6c8 100644 --- a/core/scripts/keystone/src/02_provision_crib.go +++ b/core/scripts/keystone/src/02_provision_crib.go @@ -201,7 +201,7 @@ func (g *postprovisionCrib) Run(args []string) { nodeSets, *chainID, *capabilitiesP2PPort, - contracts.ForwarderContract.Address().Hex(), + contracts.Forwarder.Address().Hex(), contracts.CapabilitiesRegistry.Address().Hex(), *outputPath, ) diff --git a/core/scripts/keystone/src/02_provision_forwarder_contract.go b/core/scripts/keystone/src/02_provision_forwarder_contract.go index 711a90b3bc1..054286a6fd9 100644 --- a/core/scripts/keystone/src/02_provision_forwarder_contract.go +++ b/core/scripts/keystone/src/02_provision_forwarder_contract.go @@ -52,13 +52,14 @@ func deployForwarder( artefacts string, ) { o := LoadOnchainMeta(artefacts, env) - if o.ForwarderContract != nil { + if o.Forwarder != nil { fmt.Println("Forwarder contract already deployed, skipping") + return } fmt.Println("Deploying forwarder contract...") forwarderContract := DeployForwarder(env) - o.ForwarderContract = forwarderContract + o.Forwarder = forwarderContract WriteOnchainMeta(o, artefacts) } diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability.go b/core/scripts/keystone/src/02_provision_ocr3_capability.go index 75b92a87017..0fc39c80c0c 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability.go @@ -105,17 +105,17 @@ func deployOCR3Contract( env.ChainID, ) - if o.OCRContract != nil { + if o.OCR3 != nil { // types.ConfigDigestPrefixKeystoneOCR3Capability fmt.Println("OCR3 Contract already deployed, checking config...") - latestConfigDigestBytes, err := o.OCRContract.LatestConfigDetails(nil) + latestConfigDigestBytes, err := o.OCR3.LatestConfigDetails(nil) PanicErr(err) latestConfigDigest, err := types.BytesToConfigDigest(latestConfigDigestBytes.ConfigDigest[:]) cc := ocrConfToContractConfig(ocrConf, latestConfigDigestBytes.ConfigCount) digester := evm.OCR3CapabilityOffchainConfigDigester{ ChainID: uint64(env.ChainID), - ContractAddress: o.OCRContract.Address(), + ContractAddress: o.OCR3.Address(), } digest, err := digester.ConfigDigest(context.Background(), cc) PanicErr(err) @@ -134,7 +134,7 @@ func deployOCR3Contract( _, tx, ocrContract, err := ocr3_capability.DeployOCR3Capability(env.Owner, env.Ec) PanicErr(err) helpers.ConfirmContractDeployed(context.Background(), env.Ec, tx, env.ChainID) - o.OCRContract = ocrContract + o.OCR3 = ocrContract setOCRConfig(o, env, ocrConf, artefacts) return o, true @@ -149,7 +149,7 @@ func generateOCR3Config(nodeSet NodeSet, configFile string, chainID int64) ksdep } func setOCRConfig(o *onchainMeta, env helpers.Environment, ocrConf ksdeploy.Orc2drOracleConfig, artefacts string) { - tx, err := o.OCRContract.SetConfig(env.Owner, + tx, err := o.OCR3.SetConfig(env.Owner, ocrConf.Signers, ocrConf.Transmitters, ocrConf.F, @@ -170,7 +170,7 @@ func deployOCR3JobSpecsTo( artefactsDir string, onchainMeta *onchainMeta, ) { - ocrAddress := onchainMeta.OCRContract.Address().Hex() + ocrAddress := onchainMeta.OCR3.Address().Hex() nodeKeys := nodeSet.NodeKeys nodes := nodeSet.Nodes diff --git a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go index 84bc059340b..e0c37bb1359 100644 --- a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go +++ b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go @@ -42,6 +42,7 @@ import ( helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury" verifierContract "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier_proxy" @@ -67,7 +68,7 @@ func (g *provisionStreamsTrigger) Run(args []string) { ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") - + artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") accountKey := fs.String("accountkey", "", "private key of the account to deploy from") @@ -99,6 +100,7 @@ func (g *provisionStreamsTrigger) Run(args []string) { *chainID, *p2pPort, *ocrConfigFile, + *artefactsDir, ) } @@ -144,12 +146,13 @@ func setupStreamsTrigger( chainId int64, p2pPort int64, ocrConfigFilePath string, + artefactsDir string, ) { fmt.Printf("Deploying streams trigger for chain %d\n", chainId) fmt.Printf("Using OCR config file: %s\n", ocrConfigFilePath) fmt.Printf("Deploying Mercury V0.3 contracts\n") - verifier := deployMercuryV03Contracts(env) + verifier := deployMercuryV03Contracts(env, artefactsDir) fmt.Printf("Generating Mercury OCR config\n") ocrConfig := generateMercuryOCR2Config(nodeSet.NodeKeys[1:]) // skip the bootstrap node @@ -161,25 +164,45 @@ func setupStreamsTrigger( fmt.Printf("BridgeName: %s\n", feed.bridgeName) fmt.Printf("BridgeURL: %s\n", feed.bridgeUrl) - fmt.Printf("Setting verifier config\n") - fmt.Printf("Signers: %v\n", ocrConfig.Signers) - fmt.Printf("Transmitters: %v\n", ocrConfig.Transmitters) - fmt.Printf("F: %d\n", ocrConfig.F) + latestConfigDetails, err := verifier.LatestConfigDetails(nil, feed.id) + PanicErr(err) + latestConfigDigest, err := ocrtypes.BytesToConfigDigest(latestConfigDetails.ConfigDigest[:]) + PanicErr(err) - tx, err := verifier.SetConfig( - env.Owner, + digester := mercury.NewOffchainConfigDigester( feed.id, - ocrConfig.Signers, - ocrConfig.Transmitters, - ocrConfig.F, - ocrConfig.OnchainConfig, - ocrConfig.OffchainConfigVersion, - ocrConfig.OffchainConfig, - nil, + big.NewInt(chainId), + verifier.Address(), + ocrtypes.ConfigDigestPrefixMercuryV02, + ) + configDigest, err := digester.ConfigDigest( + context.Background(), + mercuryOCRConfigToContractConfig( + ocrConfig, + latestConfigDetails.ConfigCount, + ), ) - helpers.ConfirmTXMined(context.Background(), env.Ec, tx, env.ChainID) PanicErr(err) + if configDigest.Hex() == latestConfigDigest.Hex() { + fmt.Printf("Verifier already deployed with the same config (digest: %s), skipping...\n", configDigest.Hex()) + } else { + fmt.Printf("Verifier contains a different config, updating...\nOld digest: %s\nNew digest: %s\n", latestConfigDigest.Hex(), configDigest.Hex()) + tx, err := verifier.SetConfig( + env.Owner, + feed.id, + ocrConfig.Signers, + ocrConfig.Transmitters, + ocrConfig.F, + ocrConfig.OnchainConfig, + ocrConfig.OffchainConfigVersion, + ocrConfig.OffchainConfig, + nil, + ) + helpers.ConfirmTXMined(context.Background(), env.Ec, tx, env.ChainID) + PanicErr(err) + } + fmt.Printf("Deploying OCR2 job specs for feed %s\n", feed.name) deployOCR2JobSpecsForFeed(nodeSet, verifier, feed, chainId, p2pPort) } @@ -187,29 +210,50 @@ func setupStreamsTrigger( fmt.Println("Finished deploying streams trigger") } -func deployMercuryV03Contracts(env helpers.Environment) (verifier *verifierContract.Verifier) { +func deployMercuryV03Contracts(env helpers.Environment, artefactsDir string) verifierContract.VerifierInterface { var confirmDeploy = func(tx *types.Transaction, err error) { helpers.ConfirmContractDeployed(context.Background(), env.Ec, tx, env.ChainID) PanicErr(err) } - var confirmTx = func(tx *types.Transaction, err error) { - helpers.ConfirmTXMined(context.Background(), env.Ec, tx, env.ChainID) - PanicErr(err) + o := LoadOnchainMeta(artefactsDir, env) + + if o.VerifierProxy != nil { + fmt.Printf("Verifier proxy contract already deployed at %s\n", o.VerifierProxy.Address()) + } else { + fmt.Printf("Deploying verifier proxy contract\n") + _, tx, verifierProxy, err := verifier_proxy.DeployVerifierProxy(env.Owner, env.Ec, common.Address{}) // zero address for access controller disables access control + confirmDeploy(tx, err) + o.VerifierProxy = verifierProxy + WriteOnchainMeta(o, artefactsDir) } - verifierProxyAddr, tx, verifierProxy, err := verifier_proxy.DeployVerifierProxy(env.Owner, env.Ec, common.Address{}) // zero address for access controller disables access control - confirmDeploy(tx, err) - - verifierAddress, tx, verifier, err := verifierContract.DeployVerifier(env.Owner, env.Ec, verifierProxyAddr) - confirmDeploy(tx, err) + if o.Verifier == nil { + fmt.Printf("Deploying verifier contract\n") + _, tx, verifier, err := verifierContract.DeployVerifier(env.Owner, env.Ec, o.VerifierProxy.Address()) + confirmDeploy(tx, err) + o.Verifier = verifier + WriteOnchainMeta(o, artefactsDir) + } else { + fmt.Printf("Verifier contract already deployed at %s\n", o.Verifier.Address().Hex()) + } - tx, err = verifierProxy.InitializeVerifier(env.Owner, verifierAddress) - confirmTx(tx, err) + if o.InitializedVerifierAddress != o.Verifier.Address() { + fmt.Printf("Current initialized verifier address (%s) differs from the new verifier address (%s). Initializing verifier.\n", o.InitializedVerifierAddress.Hex(), o.Verifier.Address().Hex()) + tx, err := o.VerifierProxy.InitializeVerifier(env.Owner, o.Verifier.Address()) + receipt := helpers.ConfirmTXMined(context.Background(), env.Ec, tx, env.ChainID) + PanicErr(err) + inited, err := o.VerifierProxy.ParseVerifierInitialized(*receipt.Logs[0]) + PanicErr(err) + o.InitializedVerifierAddress = inited.VerifierAddress + WriteOnchainMeta(o, artefactsDir) + } else { + fmt.Printf("Verifier %s already initialized\n", o.Verifier.Address().Hex()) + } - return + return o.Verifier } -func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier *verifierContract.Verifier, feed feed, chainId int64, p2pPort int64) { +func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier verifierContract.VerifierInterface, feed feed, chainId int64, p2pPort int64) { // we assign the first node as the bootstrap node for i, n := range nodeSet.NodeKeys { // parallel arrays @@ -217,7 +261,7 @@ func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier *verifierContract.Verif jobSpecName := "" jobSpecStr := "" - createBridgeIfDoesNotExist(api, feed.bridgeName, feed.bridgeUrl) + upsertBridge(api, feed.bridgeName, feed.bridgeUrl) if i == 0 { // Prepare data for Bootstrap Job @@ -377,7 +421,7 @@ func strToBytes32(str string) [32]byte { return pkBytesFixed } -func createBridgeIfDoesNotExist(api *nodeAPI, name string, eaURL string) { +func upsertBridge(api *nodeAPI, name string, eaURL string) { u, err := url.Parse(eaURL) url := models.WebURL(*u) // Confirmations and MinimumContractPayment are not used, so we can leave them as 0 diff --git a/core/scripts/keystone/src/88_capabilities_registry_helpers.go b/core/scripts/keystone/src/88_capabilities_registry_helpers.go index 613b2a2d015..3e958f72ff9 100644 --- a/core/scripts/keystone/src/88_capabilities_registry_helpers.go +++ b/core/scripts/keystone/src/88_capabilities_registry_helpers.go @@ -99,6 +99,7 @@ func (c *CapabilityRegistryProvisioner) testCallContract(method string, args ... // AddCapabilities takes a capability set and provisions it in the registry. func (c *CapabilityRegistryProvisioner) AddCapabilities(ctx context.Context, capSet CapabilitySet) { + fmt.Printf("Adding capabilities to registry: %s\n", capSet.IDs()) tx, err := c.reg.AddCapabilities(c.env.Owner, capSet.Capabilities()) helpers.PanicErr(err) @@ -116,6 +117,7 @@ func (c *CapabilityRegistryProvisioner) AddCapabilities(ctx context.Context, cap // The ID is then used when adding nodes to the registry such that the registry knows which nodes belong to which // node operator. func (c *CapabilityRegistryProvisioner) AddNodeOperator(ctx context.Context, nop *NodeOperator) { + fmt.Printf("Adding NodeOperator to registry: %s\n", nop.Name) nop.BindToRegistry(c.reg) nops, err := c.reg.GetNodeOperators(&bind.CallOpts{}) @@ -157,6 +159,7 @@ func (c *CapabilityRegistryProvisioner) AddNodeOperator(ctx context.Context, nop // Note that in terms of the provisioning process, this is not the last step. A capability is only active once // there is a DON servicing it. This is done via `AddDON`. func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop *NodeOperator, donNames ...string) { + fmt.Printf("Adding nodes to registry for NodeOperator %s with DONs: %v\n", nop.Name, donNames) var params []kcr.CapabilitiesRegistryNodeParams for _, donName := range donNames { don, exists := nop.DONs[donName] @@ -171,6 +174,7 @@ func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop *NodeO } node.HashedCapabilityIds = capSet.HashedIDs(c.reg) node.EncryptionPublicKey = [32]byte{2: byte(i + 1)} + fmt.Printf("Adding node %s to registry with capabilities: %s\n", peer.PeerID, capSet.IDs()) params = append(params, node) } } @@ -207,6 +211,7 @@ func (c *CapabilityRegistryProvisioner) AddNodes(ctx context.Context, nop *NodeO // // Another important distinction is that DON can comprise of nodes from different node operators, but for now, we're keeping it simple and restricting it to a single node operator. We also hard code F to 1. func (c *CapabilityRegistryProvisioner) AddDON(ctx context.Context, nop *NodeOperator, donName string, isPublic bool, acceptsWorkflows bool) { + fmt.Printf("Adding DON %s to registry for NodeOperator %s with isPublic: %t and acceptsWorkflows: %t\n", donName, nop.Name, isPublic, acceptsWorkflows) don, exists := nop.DONs[donName] if !exists { log.Fatalf("DON with name %s does not exist in NodeOperator %s", donName, nop.Name) diff --git a/core/scripts/keystone/src/88_contracts_helpers.go b/core/scripts/keystone/src/88_contracts_helpers.go index 3a6a365d23d..a54a9f5e8f2 100644 --- a/core/scripts/keystone/src/88_contracts_helpers.go +++ b/core/scripts/keystone/src/88_contracts_helpers.go @@ -14,28 +14,37 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability" + verifierContract "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier_proxy" ) var ZeroAddress = common.Address{} type OnChainMetaSerialized struct { - OCRContract common.Address `json:"ocrContract"` - ForwarderContract common.Address `json:"forwarderContract"` + OCR common.Address `json:"ocrContract"` + Forwarder common.Address `json:"forwarderContract"` // The block number of the transaction that set the config on the OCR3 contract. We use this to replay blocks from this point on // when we load the OCR3 job specs on the nodes. SetConfigTxBlock uint64 `json:"setConfigTxBlock"` CapabilitiesRegistry common.Address `json:"CapabilitiesRegistry"` + Verifier common.Address `json:"VerifierContract"` + VerifierProxy common.Address `json:"VerifierProxy"` + // Stores the address that has been initialized by the proxy, if any + InitializedVerifierAddress common.Address `json:"InitializedVerifierAddress"` } type onchainMeta struct { - OCRContract ocr3_capability.OCR3CapabilityInterface - ForwarderContract forwarder.KeystoneForwarderInterface + OCR3 ocr3_capability.OCR3CapabilityInterface + Forwarder forwarder.KeystoneForwarderInterface // The block number of the transaction that set the config on the OCR3 contract. We use this to replay blocks from this point on // when we load the OCR3 job specs on the nodes. SetConfigTxBlock uint64 - CapabilitiesRegistry capabilities_registry.CapabilitiesRegistryInterface + CapabilitiesRegistry capabilities_registry.CapabilitiesRegistryInterface + Verifier verifierContract.VerifierInterface + VerifierProxy verifier_proxy.VerifierProxyInterface + InitializedVerifierAddress common.Address `json:"InitializedVerifierAddress"` } func WriteOnchainMeta(o *onchainMeta, artefactsDir string) { @@ -44,20 +53,29 @@ func WriteOnchainMeta(o *onchainMeta, artefactsDir string) { fmt.Println("Writing deployed contract addresses to file...") serialzed := OnChainMetaSerialized{} - if o.OCRContract != nil { - serialzed.OCRContract = o.OCRContract.Address() + if o.OCR3 != nil { + serialzed.OCR = o.OCR3.Address() } - if o.ForwarderContract != nil { - serialzed.ForwarderContract = o.ForwarderContract.Address() + if o.Forwarder != nil { + serialzed.Forwarder = o.Forwarder.Address() } serialzed.SetConfigTxBlock = o.SetConfigTxBlock + serialzed.InitializedVerifierAddress = o.InitializedVerifierAddress if o.CapabilitiesRegistry != nil { serialzed.CapabilitiesRegistry = o.CapabilitiesRegistry.Address() } + if o.Verifier != nil { + serialzed.Verifier = o.Verifier.Address() + } + + if o.VerifierProxy != nil { + serialzed.VerifierProxy = o.VerifierProxy.Address() + } + jsonBytes, err := json.Marshal(serialzed) PanicErr(err) @@ -85,26 +103,26 @@ func LoadOnchainMeta(artefactsDir string, env helpers.Environment) *onchainMeta } hydrated.SetConfigTxBlock = s.SetConfigTxBlock - if s.OCRContract != ZeroAddress { - if !contractExists(s.OCRContract, env) { - fmt.Printf("OCR contract at %s does not exist, setting to zero address\n", s.OCRContract.Hex()) - s.OCRContract = ZeroAddress + if s.OCR != ZeroAddress { + if !contractExists(s.OCR, env) { + fmt.Printf("OCR contract at %s does not exist, setting to zero address\n", s.OCR.Hex()) + s.OCR = ZeroAddress } - ocr3, err := ocr3_capability.NewOCR3Capability(s.OCRContract, env.Ec) + ocr3, err := ocr3_capability.NewOCR3Capability(s.OCR, env.Ec) PanicErr(err) - hydrated.OCRContract = ocr3 + hydrated.OCR3 = ocr3 } - if s.ForwarderContract != ZeroAddress { - if !contractExists(s.ForwarderContract, env) { - fmt.Printf("Forwarder contract at %s does not exist, setting to zero address\n", s.ForwarderContract.Hex()) - s.ForwarderContract = ZeroAddress + if s.Forwarder != ZeroAddress { + if !contractExists(s.Forwarder, env) { + fmt.Printf("Forwarder contract at %s does not exist, setting to zero address\n", s.Forwarder.Hex()) + s.Forwarder = ZeroAddress } - fwdr, err := forwarder.NewKeystoneForwarder(s.ForwarderContract, env.Ec) + fwdr, err := forwarder.NewKeystoneForwarder(s.Forwarder, env.Ec) PanicErr(err) - hydrated.ForwarderContract = fwdr + hydrated.Forwarder = fwdr } if s.CapabilitiesRegistry != ZeroAddress { @@ -118,6 +136,30 @@ func LoadOnchainMeta(artefactsDir string, env helpers.Environment) *onchainMeta hydrated.CapabilitiesRegistry = cr } + if s.Verifier != ZeroAddress { + if !contractExists(s.Verifier, env) { + fmt.Printf("Verifier contract at %s does not exist, setting to zero address\n", s.Verifier.Hex()) + s.Verifier = ZeroAddress + } + + verifier, err := verifierContract.NewVerifier(s.Verifier, env.Ec) + PanicErr(err) + hydrated.Verifier = verifier + } + + if s.VerifierProxy != ZeroAddress { + if !contractExists(s.VerifierProxy, env) { + fmt.Printf("VerifierProxy contract at %s does not exist, setting to zero address\n", s.VerifierProxy.Hex()) + s.VerifierProxy = ZeroAddress + } + + verifierProxy, err := verifier_proxy.NewVerifierProxy(s.VerifierProxy, env.Ec) + PanicErr(err) + hydrated.VerifierProxy = verifierProxy + } + + hydrated.InitializedVerifierAddress = s.InitializedVerifierAddress + blkNum, err := env.Ec.BlockNumber(context.Background()) PanicErr(err) diff --git a/core/scripts/keystone/src/88_jobspecs_helpers.go b/core/scripts/keystone/src/88_jobspecs_helpers.go index 5d5b782cddb..4c106ead505 100644 --- a/core/scripts/keystone/src/88_jobspecs_helpers.go +++ b/core/scripts/keystone/src/88_jobspecs_helpers.go @@ -31,12 +31,11 @@ func upsertJob(api *nodeAPI, jobSpecName string, jobSpecStr string) { if job.Name == jobSpecName { fmt.Printf("Job already exists: %s, replacing..\n", jobSpecName) api.withArg(job.Id).mustExec(api.methods.DeleteJob) - fmt.Printf("Deleted job: %s\n", jobSpecName) break } } - fmt.Printf("Deploying jobspec: %s\n... \n", jobSpecStr) + fmt.Printf("Deploying jobspec: %s\n", jobSpecName) _, err := api.withArg(jobSpecStr).exec(api.methods.CreateJob) if err != nil { panic(fmt.Sprintf("Failed to deploy job spec: %s Error: %s", jobSpecStr, err)) diff --git a/core/scripts/keystone/src/88_ocr_helpers.go b/core/scripts/keystone/src/88_ocr_helpers.go index 90fb7b9b538..369c4e81c4c 100644 --- a/core/scripts/keystone/src/88_ocr_helpers.go +++ b/core/scripts/keystone/src/88_ocr_helpers.go @@ -1,8 +1,9 @@ package src import ( + "encoding/hex" + "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" ksdeploy "github.com/smartcontractkit/chainlink/integration-tests/deployment/keystone" "github.com/smartcontractkit/libocr/offchainreporting2/types" ) @@ -20,6 +21,30 @@ func ocrConfToContractConfig(ocrConf ksdeploy.Orc2drOracleConfig, configCount ui return cc } + +func mercuryOCRConfigToContractConfig(ocrConf MercuryOCR2Config, configCount uint32) types.ContractConfig { + cc := types.ContractConfig{ + Signers: convertAddressesToOnchainPublicKeys(ocrConf.Signers), + Transmitters: convertBytes32sToAccounts(ocrConf.Transmitters), + F: ocrConf.F, + OnchainConfig: ocrConf.OnchainConfig, + OffchainConfigVersion: ocrConf.OffchainConfigVersion, + OffchainConfig: ocrConf.OffchainConfig, + ConfigCount: uint64(configCount), + } + + return cc +} + +func convertAddressesToOnchainPublicKeys(addresses []common.Address) []types.OnchainPublicKey { + keys := make([]types.OnchainPublicKey, len(addresses)) + for i, addr := range addresses { + keys[i] = types.OnchainPublicKey(addr.Bytes()) + } + return keys +} + + func convertAddressesToAccounts(addresses []common.Address) []types.Account { accounts := make([]types.Account, len(addresses)) for i, addr := range addresses { @@ -28,10 +53,18 @@ func convertAddressesToAccounts(addresses []common.Address) []types.Account { return accounts } +func convertBytes32sToAccounts(bs [][32]byte) []types.Account { + accounts := make([]types.Account, len(bs)) + for i, b := range bs { + accounts[i] = types.Account(hex.EncodeToString(b[:])) + } + return accounts +} + func convertByteSliceToOnchainPublicKeys(bs [][]byte) []types.OnchainPublicKey { keys := make([]types.OnchainPublicKey, len(bs)) for i, b := range bs { - keys[i] = types.OnchainPublicKey(hexutil.Encode(b)) + keys[i] = types.OnchainPublicKey(hex.EncodeToString(b)) } return keys } diff --git a/core/scripts/keystone/src/99_app.go b/core/scripts/keystone/src/99_app.go index 93305c9462f..87ae9aada01 100644 --- a/core/scripts/keystone/src/99_app.go +++ b/core/scripts/keystone/src/99_app.go @@ -2,22 +2,33 @@ package src import ( "bytes" + "context" "encoding/json" "errors" "flag" - "fmt" "io" + "net/url" "reflect" "runtime" "strings" + "sync" "time" "github.com/jpillora/backoff" + clsessions "github.com/smartcontractkit/chainlink/v2/core/sessions" "github.com/urfave/cli" + "go.uber.org/zap/zapcore" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "github.com/smartcontractkit/chainlink/v2/core/cmd" clcmd "github.com/smartcontractkit/chainlink/v2/core/cmd" + "github.com/smartcontractkit/chainlink/v2/core/logger" +) + +// Package-level cache and mutex +var ( + nodeAPICache = make(map[string]*nodeAPI) + cacheMutex = &sync.Mutex{} ) // NewRedialBackoff is a standard backoff to use for redialling or reconnecting to @@ -31,23 +42,45 @@ func NewRedialBackoff() backoff.Backoff { } func newApp(n NodeWthCreds, writer io.Writer) (*clcmd.Shell, *cli.App) { + loggingCfg := logger.Config{ + LogLevel: zapcore.InfoLevel, + JsonConsole: true, + } + logger, closeLggr := loggingCfg.New() + u, err := url.Parse(n.RemoteURL.String()) + PanicErr(err) + + clientOpts := clcmd.ClientOpts{RemoteNodeURL: *u, InsecureSkipVerify: true} + sr := clsessions.SessionRequest{Email: n.APILogin, Password: n.APIPassword} + + // Set the log level to error for the HTTP client, we don't care about + // the ssl warnings it emits for CRIB + logger.SetLogLevel(zapcore.ErrorLevel) + cookieAuth := cmd.NewSessionCookieAuthenticator( + clientOpts, + &cmd.MemoryCookieStore{}, + logger, + ) + cookieAuth.Authenticate(context.Background(), sr) + http := cmd.NewAuthenticatedHTTPClient( + logger, + clientOpts, + cookieAuth, + sr, + ) + // Set the log level back to info for the shell + logger.SetLogLevel(zapcore.InfoLevel) + client := &clcmd.Shell{ - Renderer: clcmd.RendererJSON{Writer: writer}, - AppFactory: clcmd.ChainlinkAppFactory{}, - KeyStoreAuthenticator: clcmd.TerminalKeyStoreAuthenticator{Prompter: n}, - FallbackAPIInitializer: clcmd.NewPromptingAPIInitializer(n), - Runner: clcmd.ChainlinkRunner{}, - PromptingSessionRequestBuilder: clcmd.NewPromptingSessionRequestBuilder(n), - ChangePasswordPrompter: clcmd.NewChangePasswordPrompter(), - PasswordPrompter: clcmd.NewPasswordPrompter(), + Logger: logger, + Renderer: clcmd.RendererJSON{Writer: writer}, + AppFactory: clcmd.ChainlinkAppFactory{}, + Runner: clcmd.ChainlinkRunner{}, + HTTP: http, + CookieAuthenticator: cookieAuth, + CloseLogger: closeLggr, } app := clcmd.NewApp(client) - fs := flag.NewFlagSet("blah", flag.ContinueOnError) - fs.String("remote-node-url", n.RemoteURL.String(), "") - fs.Bool("insecure-skip-verify", true, "") - helpers.PanicErr(app.Before(cli.NewContext(nil, fs, nil))) - // overwrite renderer since it's set to stdout after Before() is called - client.Renderer = clcmd.RendererJSON{Writer: writer} return client, app } @@ -60,6 +93,17 @@ type nodeAPI struct { } func newNodeAPI(n NodeWthCreds) *nodeAPI { + // Create a unique key for the cache + key := n.RemoteURL.String() + + // Check if the nodeAPI exists in the cache + cacheMutex.Lock() + if api, exists := nodeAPICache[key]; exists { + cacheMutex.Unlock() + return api + } + cacheMutex.Unlock() + output := &bytes.Buffer{} methods, app := newApp(n, output) @@ -70,29 +114,10 @@ func newNodeAPI(n NodeWthCreds) *nodeAPI { fs: flag.NewFlagSet("test", flag.ContinueOnError), } - fmt.Println("Logging in:", n.RemoteURL) - loginFs := flag.NewFlagSet("test", flag.ContinueOnError) - loginFs.Bool("bypass-version-check", true, "") - loginCtx := cli.NewContext(app, loginFs, nil) - - redial := NewRedialBackoff() - - for { - err := methods.RemoteLogin(loginCtx) - if err == nil { - break - } - - fmt.Println("Error logging in:", err) - if strings.Contains(err.Error(), "invalid character '<' looking for beginning of value") { - fmt.Println("Likely a transient network error, retrying...") - } else { - helpers.PanicErr(err) - } - - time.Sleep(redial.Duration()) - } - output.Reset() + // Store the new nodeAPI in the cache + cacheMutex.Lock() + nodeAPICache[key] = api + cacheMutex.Unlock() return api } diff --git a/core/scripts/keystone/src/99_crib_client.go b/core/scripts/keystone/src/99_crib_client.go index 0d946805904..0bf1610a4dd 100644 --- a/core/scripts/keystone/src/99_crib_client.go +++ b/core/scripts/keystone/src/99_crib_client.go @@ -83,16 +83,3 @@ func (m *CribClient) getCLNodes() ([]NodeWthCreds, error) { return nodes, nil } - -// Implements Prompter interface -func (n NodeWthCreds) IsTerminal() bool { - return false -} - -func (n NodeWthCreds) PasswordPrompt(p string) string { - return n.APIPassword -} - -func (n NodeWthCreds) Prompt(p string) string { - return n.APILogin -} From 31bab6cffc8f1d9f24515ec7470e697eb193b0cf Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:21:59 -0700 Subject: [PATCH 080/117] Fix post-rebase errors --- core/scripts/go.mod | 6 +++--- .../keystone/src/02_provision_ocr3_capability.go | 5 ++++- .../02_provision_streams_trigger_capability.go | 15 +++++++++++---- core/scripts/keystone/src/88_ocr_helpers.go | 2 +- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 6a44d0cdde2..e7351d41f23 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -26,8 +26,8 @@ require ( github.com/shopspring/decimal v1.4.0 github.com/smartcontractkit/chainlink-automation v0.8.1 github.com/smartcontractkit/chainlink-common v0.3.1-0.20241107134205-25e45ecd73ba + github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e github.com/smartcontractkit/chainlink/deployment v0.0.0-00010101000000-000000000000 - github.com/smartcontractkit/chainlink/integration-tests v0.0.0-00010101000000-000000000000 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 github.com/spf13/cobra v1.8.1 @@ -37,10 +37,10 @@ require ( github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722 github.com/urfave/cli v1.22.14 google.golang.org/protobuf v1.35.1 + gopkg.in/yaml.v3 v3.0.1 k8s.io/api v0.31.1 k8s.io/apimachinery v0.31.1 k8s.io/client-go v0.31.1 - k8s.io/client-go v0.31.0 ) require ( @@ -362,7 +362,7 @@ require ( go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/ratelimit v0.3.1 // indirect - go.uber.org/zap v1.27.0 // indirect + go.uber.org/zap v1.27.0 golang.org/x/arch v0.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability.go b/core/scripts/keystone/src/02_provision_ocr3_capability.go index 0fc39c80c0c..b2c64ff9322 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability.go @@ -9,7 +9,9 @@ import ( "fmt" "os" - ksdeploy "github.com/smartcontractkit/chainlink/integration-tests/deployment/keystone" + "github.com/smartcontractkit/chainlink/deployment" + + ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability" @@ -143,6 +145,7 @@ func deployOCR3Contract( func generateOCR3Config(nodeSet NodeSet, configFile string, chainID int64) ksdeploy.Orc2drOracleConfig { topLevelCfg := mustReadOCR3Config(configFile) cfg := topLevelCfg.OracleConfig + cfg.OCRSecrets = deployment.XXXGenerateTestOCRSecrets() c, err := ksdeploy.GenerateOCR3Config(cfg, nodeKeysToKsDeployNodeKeys(nodeSet.NodeKeys[1:])) // skip the bootstrap node helpers.PanicErr(err) return c diff --git a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go index e0c37bb1359..c9b22d94e16 100644 --- a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go +++ b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go @@ -40,6 +40,7 @@ import ( datastreamsmercury "github.com/smartcontractkit/chainlink-data-streams/mercury" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury" @@ -522,8 +523,11 @@ func generateMercuryOCR2Config(nca []NodeKeys) MercuryOCR2Config { }) } + secrets := deployment.XXXGenerateTestOCRSecrets() // Values were taken from Data Streams 250ms feeds, given by @austinborn - signers, _, _, onchainConfig, offchainConfigVersion, offchainConfig, err := ocr3confighelper.ContractSetConfigArgsForTestsMercuryV02( + signers, _, _, onchainConfig, offchainConfigVersion, offchainConfig, err := ocr3confighelper.ContractSetConfigArgsDeterministic( + secrets.EphemeralSk, + secrets.SharedSecret, 10*time.Second, // DeltaProgress 10*time.Second, // DeltaResend 400*time.Millisecond, // DeltaInitial @@ -535,9 +539,12 @@ func generateMercuryOCR2Config(nca []NodeKeys) MercuryOCR2Config { []int{len(identities)}, // S identities, reportingPluginConfig, // reportingPluginConfig []byte, - nil, - 250*time.Millisecond, // Max duration observation - int(f), // f + nil, // maxDurationInitialization *time.Duration, + 0, // maxDurationQuery time.Duration, + 250*time.Millisecond, // Max duration observation + 0, // Max duration should accept attested report + 0, // Max duration should transmit accepted report + int(f), // f onchainConfig, ) signerAddresses, err := evm.OnchainPublicKeyToAddress(signers) diff --git a/core/scripts/keystone/src/88_ocr_helpers.go b/core/scripts/keystone/src/88_ocr_helpers.go index 369c4e81c4c..e4889b952ef 100644 --- a/core/scripts/keystone/src/88_ocr_helpers.go +++ b/core/scripts/keystone/src/88_ocr_helpers.go @@ -4,7 +4,7 @@ import ( "encoding/hex" "github.com/ethereum/go-ethereum/common" - ksdeploy "github.com/smartcontractkit/chainlink/integration-tests/deployment/keystone" + ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" "github.com/smartcontractkit/libocr/offchainreporting2/types" ) From 8a91cf2196f7d8f7bc1a899bb68f6565dfd65672 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:31:51 -0700 Subject: [PATCH 081/117] Fix OCR3 digest comparison --- core/scripts/keystone/src/88_ocr_helpers.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/scripts/keystone/src/88_ocr_helpers.go b/core/scripts/keystone/src/88_ocr_helpers.go index e4889b952ef..f27d161ecb6 100644 --- a/core/scripts/keystone/src/88_ocr_helpers.go +++ b/core/scripts/keystone/src/88_ocr_helpers.go @@ -4,7 +4,7 @@ import ( "encoding/hex" "github.com/ethereum/go-ethereum/common" - ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" + ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" "github.com/smartcontractkit/libocr/offchainreporting2/types" ) @@ -21,7 +21,6 @@ func ocrConfToContractConfig(ocrConf ksdeploy.Orc2drOracleConfig, configCount ui return cc } - func mercuryOCRConfigToContractConfig(ocrConf MercuryOCR2Config, configCount uint32) types.ContractConfig { cc := types.ContractConfig{ Signers: convertAddressesToOnchainPublicKeys(ocrConf.Signers), @@ -44,7 +43,6 @@ func convertAddressesToOnchainPublicKeys(addresses []common.Address) []types.Onc return keys } - func convertAddressesToAccounts(addresses []common.Address) []types.Account { accounts := make([]types.Account, len(addresses)) for i, addr := range addresses { @@ -64,7 +62,7 @@ func convertBytes32sToAccounts(bs [][32]byte) []types.Account { func convertByteSliceToOnchainPublicKeys(bs [][]byte) []types.OnchainPublicKey { keys := make([]types.OnchainPublicKey, len(bs)) for i, b := range bs { - keys[i] = types.OnchainPublicKey(hex.EncodeToString(b)) + keys[i] = types.OnchainPublicKey(b) } return keys } From 541ea0e8ce8c2d41cfea30cda1bceaa9cac8b857 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:45:08 -0700 Subject: [PATCH 082/117] Remove extra cmd cruft --- core/scripts/keystone/main.go | 8 -- .../src/02_deploy_keystone_workflows.go | 40 ---------- .../keystone/src/02_fund_transmitters.go | 41 ---------- .../src/02_provision_capabilities_registry.go | 53 ------------ .../scripts/keystone/src/02_provision_crib.go | 80 ------------------- .../src/02_provision_forwarder_contract.go | 38 --------- .../src/02_provision_ocr3_capability.go | 50 ------------ ...02_provision_streams_trigger_capability.go | 58 +------------- 8 files changed, 1 insertion(+), 367 deletions(-) diff --git a/core/scripts/keystone/main.go b/core/scripts/keystone/main.go index 2b95693f7e2..6a3515988ca 100644 --- a/core/scripts/keystone/main.go +++ b/core/scripts/keystone/main.go @@ -16,14 +16,6 @@ type command interface { func main() { commands := []command{ src.NewProvisionKeystoneCommand(), - src.NewFundTransmittersCommand(), - src.NewProvisionOCR3CapabilityCommand(), - src.NewDeployKeystoneWorkflowsCommand(), - src.NewDeployForwarderCommand(), - src.NewPreprovisionCribCommand(), - src.NewPostprovisionCribCommand(), - src.NewProvisionCapabilitesRegistryCommand(), - src.NewProvisionStreamsTriggerCommand(), src.NewDeployAndInitializeCapabilitiesRegistryCommand(), } diff --git a/core/scripts/keystone/src/02_deploy_keystone_workflows.go b/core/scripts/keystone/src/02_deploy_keystone_workflows.go index d9814e08f0a..5eeadf90f57 100644 --- a/core/scripts/keystone/src/02_deploy_keystone_workflows.go +++ b/core/scripts/keystone/src/02_deploy_keystone_workflows.go @@ -2,53 +2,13 @@ package src import ( "bytes" - "flag" "fmt" - "os" "text/template" "github.com/ethereum/go-ethereum/accounts/abi/bind" - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" ) -type deployKeystoneWorkflows struct{} - -func NewDeployKeystoneWorkflowsCommand() *deployKeystoneWorkflows { - return &deployKeystoneWorkflows{} -} - -func (g *deployKeystoneWorkflows) Name() string { - return "deploy-keystone-workflows" -} - -func (g *deployKeystoneWorkflows) Run(args []string) { - fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) - chainID := fs.Int64("chainid", 1337, "chain id") - nodeSetsPath := fs.String("nodesets", defaultNodeSetsPath, "Custom node sets location") - nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") - - ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") - accountKey := fs.String("accountkey", "", "private key of the account to deploy from") - artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") - err := fs.Parse(args) - if err != nil || - *ethUrl == "" || ethUrl == nil || - *accountKey == "" || accountKey == nil { - fs.Usage() - os.Exit(1) - } - workflowNodeSet := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize).Workflow - os.Setenv("ETH_URL", *ethUrl) - os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) - os.Setenv("ACCOUNT_KEY", *accountKey) - os.Setenv("INSECURE_SKIP_VERIFY", "true") - env := helpers.SetupEnv(false) - - o := LoadOnchainMeta(*artefactsDir, env) - deployKeystoneWorkflowsTo(workflowNodeSet, o.CapabilitiesRegistry, *chainID) -} - func deployKeystoneWorkflowsTo(nodeSet NodeSet, reg kcr.CapabilitiesRegistryInterface, chainID int64) { fmt.Println("Deploying Keystone workflow jobs") caps, err := reg.GetCapabilities(&bind.CallOpts{}) diff --git a/core/scripts/keystone/src/02_fund_transmitters.go b/core/scripts/keystone/src/02_fund_transmitters.go index 0a8403c8b3c..45e684de65b 100644 --- a/core/scripts/keystone/src/02_fund_transmitters.go +++ b/core/scripts/keystone/src/02_fund_transmitters.go @@ -2,10 +2,8 @@ package src import ( "context" - "flag" "fmt" "math/big" - "os" "github.com/ethereum/go-ethereum/common" @@ -13,45 +11,6 @@ import ( helpers "github.com/smartcontractkit/chainlink/core/scripts/common" ) -type fundTransmitters struct{} - -func NewFundTransmittersCommand() *fundTransmitters { - return &fundTransmitters{} -} - -func (g *fundTransmitters) Name() string { - return "fund-transmitters" -} - -func (g *fundTransmitters) Run(args []string) { - fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) - // create flags for all of the env vars then set the env vars to normalize the interface - // this is a bit of a hack but it's the easiest way to make this work - chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") - ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") - accountKey := fs.String("accountkey", "", "private key of the account to deploy from") - nodeSetsPath := fs.String("nodesets", defaultNodeSetsPath, "Custom node sets location") - nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") - - err := fs.Parse(args) - - if err != nil || - *ethUrl == "" || ethUrl == nil || - *accountKey == "" || accountKey == nil { - fs.Usage() - os.Exit(1) - } - - os.Setenv("ETH_URL", *ethUrl) - os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) - os.Setenv("ACCOUNT_KEY", *accountKey) - os.Setenv("INSECURE_SKIP_VERIFY", "true") - env := helpers.SetupEnv(false) - - nodeSet := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize).Workflow - distributeFunds(nodeSet, env) -} - func distributeFunds(nodeSet NodeSet, env helpers.Environment) { fmt.Println("Funding transmitters...") transmittersStr := []string{} diff --git a/core/scripts/keystone/src/02_provision_capabilities_registry.go b/core/scripts/keystone/src/02_provision_capabilities_registry.go index 74f0f7ac4f2..88b100d1987 100644 --- a/core/scripts/keystone/src/02_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/02_provision_capabilities_registry.go @@ -2,65 +2,12 @@ package src import ( "context" - "flag" "fmt" - "os" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" ) -type provisionCR struct{} - -func NewProvisionCapabilitesRegistryCommand() *provisionCR { - return &provisionCR{} -} - -func (c *provisionCR) Name() string { - return "provision-capabilities-registry" -} - -func (c *provisionCR) Run(args []string) { - fs := flag.NewFlagSet(c.Name(), flag.ExitOnError) - ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") - chainID := fs.Int64("chainid", 1337, "Chain ID of the Ethereum network to deploy to") - accountKey := fs.String("accountkey", "", "Private key of the account to deploy from") - nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") - artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") - nodeSetSize := fs.Int("nodesetsize", 5, "Number of nodes in a nodeset") - - err := fs.Parse(args) - if err != nil || - *chainID == 0 || chainID == nil || - *ethUrl == "" || ethUrl == nil || - *accountKey == "" || accountKey == nil { - fs.Usage() - os.Exit(1) - } - - if *artefactsDir == "" { - *artefactsDir = defaultArtefactsDir - } - if *nodeSetsPath == "" { - *nodeSetsPath = defaultNodeSetsPath - } - - os.Setenv("ETH_URL", *ethUrl) - os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) - os.Setenv("ACCOUNT_KEY", *accountKey) - os.Setenv("INSECURE_SKIP_VERIFY", "true") - - env := helpers.SetupEnv(false) - - // We skip the first node in the node set as it is the bootstrap node - // technically we could do a single addnodes call here if we merged all the nodes together - nodeSets := downloadNodeSets( - *chainID, - *nodeSetsPath, - *nodeSetSize, - ) - provisionCapabillitiesRegistry(env, nodeSets, *chainID, *artefactsDir) -} func provisionCapabillitiesRegistry(env helpers.Environment, nodeSets NodeSets, chainID int64, artefactsDir string) kcr.CapabilitiesRegistryInterface { fmt.Printf("Provisioning capabilities registry on chain %d\n", chainID) diff --git a/core/scripts/keystone/src/02_provision_crib.go b/core/scripts/keystone/src/02_provision_crib.go index e98bfa6e6c8..eb2f7912d2d 100644 --- a/core/scripts/keystone/src/02_provision_crib.go +++ b/core/scripts/keystone/src/02_provision_crib.go @@ -1,7 +1,6 @@ package src import ( - "flag" "fmt" "os" "path/filepath" @@ -17,17 +16,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" ) -type preprovisionCrib struct{} -type postprovisionCrib struct{} - -func NewPreprovisionCribCommand() *preprovisionCrib { - return &preprovisionCrib{} -} - -func NewPostprovisionCribCommand() *postprovisionCrib { - return &postprovisionCrib{} -} - type Helm struct { Helm Chart `yaml:"helm"` } @@ -81,24 +69,6 @@ type Node struct { OverridesToml string `yaml:"overridesToml,omitempty"` } -func (g *preprovisionCrib) Name() string { - return "preprovision-crib" -} - -func (g *preprovisionCrib) Run(args []string) { - fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) - nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") - outputPath := fs.String("outpath", "-", "the path to output the generated overrides (use '-' for stdout)") - - err := fs.Parse(args) - if err != nil { - fs.Usage() - os.Exit(1) - } - - writePreprovisionConfig(*nodeSetSize, *outputPath) -} - func writePreprovisionConfig(nodeSetSize int, outputPath string) { chart := generatePreprovisionConfig(nodeSetSize) @@ -158,55 +128,6 @@ func generatePreprovisionConfig(nodeSetSize int) Helm { return helm } -func (g *postprovisionCrib) Name() string { - return "postprovision-crib" -} - -func (g *postprovisionCrib) Run(args []string) { - fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) - chainID := fs.Int64("chainid", 1337, "chain id") - capabilitiesP2PPort := fs.Int64("capabilitiesP2PPort", 6691, "p2p port for capabilities") - outputPath := fs.String("outpath", "-", "the path to output the generated overrides (use '-' for stdout)") - nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") - nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") - artefactsDir := fs.String("artefacts", "", "Custom artefacts directory location") - ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") - accountKey := fs.String("accountkey", "", "private key of the account to deploy from") - - err := fs.Parse(args) - if err != nil || *outputPath == "" || *chainID == 0 || - *ethUrl == "" || ethUrl == nil || - *accountKey == "" || accountKey == nil { - fs.Usage() - os.Exit(1) - } - - os.Setenv("ETH_URL", *ethUrl) - os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) - os.Setenv("ACCOUNT_KEY", *accountKey) - os.Setenv("INSECURE_SKIP_VERIFY", "true") - env := helpers.SetupEnv(false) - - if *artefactsDir == "" { - *artefactsDir = defaultArtefactsDir - } - if *nodeSetsPath == "" { - *nodeSetsPath = defaultNodeSetsPath - } - - contracts := LoadOnchainMeta(*artefactsDir, env) - nodeSets := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize) - - writePostProvisionConfig( - nodeSets, - *chainID, - *capabilitiesP2PPort, - contracts.Forwarder.Address().Hex(), - contracts.CapabilitiesRegistry.Address().Hex(), - *outputPath, - ) -} - func writePostProvisionConfig( nodeSets NodeSets, chainID int64, @@ -226,7 +147,6 @@ func writePostProvisionConfig( writeCribConfig(chart, outputPath) } - func generatePostprovisionConfig( nodeSets NodeSets, chainID int64, diff --git a/core/scripts/keystone/src/02_provision_forwarder_contract.go b/core/scripts/keystone/src/02_provision_forwarder_contract.go index 054286a6fd9..8c0395f3d5c 100644 --- a/core/scripts/keystone/src/02_provision_forwarder_contract.go +++ b/core/scripts/keystone/src/02_provision_forwarder_contract.go @@ -2,50 +2,12 @@ package src import ( "context" - "flag" "fmt" - "os" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder" ) -type provisionForwarderContract struct{} - -func NewDeployForwarderCommand() *provisionForwarderContract { - return &provisionForwarderContract{} -} - -func (g *provisionForwarderContract) Name() string { - return "provision-forwarder-contract" -} - -func (g *provisionForwarderContract) Run(args []string) { - fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) - // create flags for all of the env vars then set the env vars to normalize the interface - // this is a bit of a hack but it's the easiest way to make this work - ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") - chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") - accountKey := fs.String("accountkey", "", "private key of the account to deploy from") - artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") - - err := fs.Parse(args) - - if err != nil || - *ethUrl == "" || ethUrl == nil || - *accountKey == "" || accountKey == nil { - fs.Usage() - os.Exit(1) - } - - os.Setenv("ETH_URL", *ethUrl) - os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) - os.Setenv("ACCOUNT_KEY", *accountKey) - os.Setenv("INSECURE_SKIP_VERIFY", "true") - env := helpers.SetupEnv(false) - - deployForwarder(env, *artefactsDir) -} func deployForwarder( env helpers.Environment, diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability.go b/core/scripts/keystone/src/02_provision_ocr3_capability.go index b2c64ff9322..55738d9038d 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability.go @@ -7,7 +7,6 @@ import ( "context" "flag" "fmt" - "os" "github.com/smartcontractkit/chainlink/deployment" @@ -19,55 +18,6 @@ import ( "github.com/smartcontractkit/libocr/offchainreporting2plus/types" ) -type provisionOCR3Capability struct{} - -func NewProvisionOCR3CapabilityCommand() *provisionOCR3Capability { - return &provisionOCR3Capability{} -} - -func (g *provisionOCR3Capability) Name() string { - return "provision-ocr3-capability" -} - -func (g *provisionOCR3Capability) Run(args []string) { - fs := flag.NewFlagSet(g.Name(), flag.ExitOnError) - ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") - ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") - chainID := fs.Int64("chainid", 1337, "chain ID of the Ethereum network to deploy to") - p2pPort := fs.Int64("p2pport", 6690, "p2p port") - accountKey := fs.String("accountkey", "", "private key of the account to deploy from") - nodeSetsPath := fs.String("nodesets", defaultNodeSetsPath, "Custom node sets location") - nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") - artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") - - err := fs.Parse(args) - - if err != nil || - *accountKey == "" || accountKey == nil { - fs.Usage() - os.Exit(1) - } - - // use flags for all of the env vars then set the env vars to normalize the interface - // this is a bit of a hack but it's the easiest way to make this work - os.Setenv("ETH_URL", *ethUrl) - os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) - os.Setenv("ACCOUNT_KEY", *accountKey) - os.Setenv("INSECURE_SKIP_VERIFY", "true") - env := helpers.SetupEnv(false) - - nodeSet := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize).Workflow - - provisionOCR3( - env, - nodeSet, - *chainID, - *p2pPort, - *ocrConfigFile, - *artefactsDir, - ) -} - func provisionOCR3( env helpers.Environment, nodeSet NodeSet, diff --git a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go index c9b22d94e16..4b3e31a1e20 100644 --- a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go +++ b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go @@ -1,14 +1,13 @@ package src // This package deploys "offchainreporting2" job specs, which setup the streams trigger -// for the targetted node set +// for the targeted node set // See https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/ocr2/plugins/mercury/integration_test.go#L92 // for how to setup the mercury portion of the streams trigger // You can see how all fields are being used here: https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/ocr2/plugins/mercury/helpers_test.go#L314 // https://github.com/smartcontractkit/infra-k8s/blob/be47098adfb605d79b5bab6aa601bcf443a6c48b/projects/chainlink/files/chainlink-clusters/cl-keystone-cap-one/config.yaml#L1 // Trigger gets added to the registry here: https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/services/relay/evm/evm.go#L360 // See integration workflow here: https://github.com/smartcontractkit/chainlink/blob/4d5fc1943bd6a60b49cbc3d263c0aa47dc3cecb7/core/capabilities/integration_tests/workflow.go#L15 -// ^ setup.go provides good insight too import ( "bytes" "context" @@ -16,12 +15,10 @@ import ( "encoding/binary" "encoding/hex" "encoding/json" - "flag" "fmt" "html/template" "math" "math/big" - "os" "time" "net/url" @@ -52,59 +49,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/web/presenters" ) -type provisionStreamsTrigger struct{} - -func NewProvisionStreamsTriggerCommand() *provisionStreamsTrigger { - return &provisionStreamsTrigger{} -} - -func (g *provisionStreamsTrigger) Name() string { - return "provision-streams-trigger-capability" -} - -func (g *provisionStreamsTrigger) Run(args []string) { - fs := flag.NewFlagSet(g.Name(), flag.ContinueOnError) - chainID := fs.Int64("chainid", 1337, "chain id") - p2pPort := fs.Int64("p2pport", 6690, "p2p port") - ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") - nodeSetsPath := fs.String("nodesets", "", "Custom node sets location") - nodeSetSize := fs.Int("nodesetsize", 5, "number of nodes in a nodeset") - artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") - ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") - accountKey := fs.String("accountkey", "", "private key of the account to deploy from") - - err := fs.Parse(args) - if err != nil || - *ocrConfigFile == "" || ocrConfigFile == nil || - chainID == nil || *chainID == 0 || - *ethUrl == "" || ethUrl == nil || - *accountKey == "" || accountKey == nil { - fs.Usage() - os.Exit(1) - } - - if *nodeSetsPath == "" { - *nodeSetsPath = defaultNodeSetsPath - } - - os.Setenv("ETH_URL", *ethUrl) - os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) - os.Setenv("ACCOUNT_KEY", *accountKey) - os.Setenv("INSECURE_SKIP_VERIFY", "true") - - env := helpers.SetupEnv(false) - - nodeSet := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize).StreamsTrigger - setupStreamsTrigger( - env, - nodeSet, - *chainID, - *p2pPort, - *ocrConfigFile, - *artefactsDir, - ) -} - type feed struct { id [32]byte name string From f86f77087a09cc0750b948b799c107b49b73aae5 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:46:08 -0700 Subject: [PATCH 083/117] Remove unused func --- core/scripts/keystone/src/99_app.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/core/scripts/keystone/src/99_app.go b/core/scripts/keystone/src/99_app.go index 87ae9aada01..6e7f134d9e6 100644 --- a/core/scripts/keystone/src/99_app.go +++ b/core/scripts/keystone/src/99_app.go @@ -12,9 +12,7 @@ import ( "runtime" "strings" "sync" - "time" - "github.com/jpillora/backoff" clsessions "github.com/smartcontractkit/chainlink/v2/core/sessions" "github.com/urfave/cli" "go.uber.org/zap/zapcore" @@ -31,16 +29,6 @@ var ( cacheMutex = &sync.Mutex{} ) -// NewRedialBackoff is a standard backoff to use for redialling or reconnecting to -// unreachable network endpoints -func NewRedialBackoff() backoff.Backoff { - return backoff.Backoff{ - Min: 1 * time.Second, - Max: 15 * time.Second, - Jitter: true, - } -} - func newApp(n NodeWthCreds, writer io.Writer) (*clcmd.Shell, *cli.App) { loggingCfg := logger.Config{ LogLevel: zapcore.InfoLevel, From 74d7e9b63b9ea9ca17fc34e59df784a595b829db Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:47:47 -0700 Subject: [PATCH 084/117] Undo transmitter changes --- core/services/relay/evm/mercury/transmitter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/services/relay/evm/mercury/transmitter.go b/core/services/relay/evm/mercury/transmitter.go index f5318fa91c1..4e57a3d07cf 100644 --- a/core/services/relay/evm/mercury/transmitter.go +++ b/core/services/relay/evm/mercury/transmitter.go @@ -394,7 +394,7 @@ func (mt *mercuryTransmitter) HealthReport() map[string]error { return report } -func (mt *mercuryTransmitter) sendToTrigger(ctx context.Context, report ocrtypes.Report, rawReportCtx [3][32]byte, signatures []ocrtypes.AttributedOnchainSignature) error { +func (mt *mercuryTransmitter) sendToTrigger(report ocrtypes.Report, rawReportCtx [3][32]byte, signatures []ocrtypes.AttributedOnchainSignature) error { rawSignatures := [][]byte{} for _, sig := range signatures { rawSignatures = append(rawSignatures, sig.Signature) @@ -421,7 +421,7 @@ func (mt *mercuryTransmitter) Transmit(ctx context.Context, reportCtx ocrtypes.R rawReportCtx := evmutil.RawReportContext(reportCtx) if mt.triggerCapability != nil { // Acting as a Capability - send report to trigger service and exit. - return mt.sendToTrigger(ctx, report, rawReportCtx, signatures) + return mt.sendToTrigger(report, rawReportCtx, signatures) } var rs [][32]byte From b42d0b14ebd2f258183e622233b06ec02272e484 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:50:32 -0700 Subject: [PATCH 085/117] Revert "Add test mocks" This reverts commit 75cafe96a08d6495c8040076a053e3e1a33e4154. --- .mockery.yaml | 23 +- .../mocks/capabilities_registry_interface.go | 3752 ----------------- .../keystone/mocks/forwarder_interface.go | 2056 --------- .../mocks/ocr3_capability_interface.go | 1316 ------ 4 files changed, 1 insertion(+), 7146 deletions(-) delete mode 100644 core/gethwrappers/keystone/mocks/capabilities_registry_interface.go delete mode 100644 core/gethwrappers/keystone/mocks/forwarder_interface.go delete mode 100644 core/gethwrappers/keystone/mocks/ocr3_capability_interface.go diff --git a/.mockery.yaml b/.mockery.yaml index 5b680a77c8f..711d70f59e9 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -348,27 +348,6 @@ packages: config: dir: core/services/relay/evm/mocks ChainWriter: - github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry: - config: - dir: core/gethwrappers/keystone/mocks/ - filename: capabilities_registry_interface.go - outpkg: mock_contracts - interfaces: - CapabilitiesRegistryInterface: - github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder: - config: - dir: core/gethwrappers/keystone/mocks/ - filename: forwarder_interface.go - outpkg: mock_contracts - interfaces: - KeystoneForwarderInterface: - github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability: - config: - dir: core/gethwrappers/keystone/mocks/ - filename: ocr3_capability_interface.go - outpkg: mock_contracts - interfaces: - OCR3CapabilityInterface: github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/evm_2_evm_onramp: config: dir: core/gethwrappers/ccip/mocks/ @@ -602,4 +581,4 @@ packages: ORM: github.com/smartcontractkit/chainlink/v2/core/capabilities/targets: interfaces: - ContractValueGetter: + ContractValueGetter: \ No newline at end of file diff --git a/core/gethwrappers/keystone/mocks/capabilities_registry_interface.go b/core/gethwrappers/keystone/mocks/capabilities_registry_interface.go deleted file mode 100644 index 2bcb9f20ae9..00000000000 --- a/core/gethwrappers/keystone/mocks/capabilities_registry_interface.go +++ /dev/null @@ -1,3752 +0,0 @@ -// Code generated by mockery v2.45.0. DO NOT EDIT. - -package mock_contracts - -import ( - bind "github.com/ethereum/go-ethereum/accounts/abi/bind" - common "github.com/ethereum/go-ethereum/common" - capabilities_registry "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" - - event "github.com/ethereum/go-ethereum/event" - - generated "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" - - mock "github.com/stretchr/testify/mock" - - types "github.com/ethereum/go-ethereum/core/types" -) - -// CapabilitiesRegistryInterface is an autogenerated mock type for the CapabilitiesRegistryInterface type -type CapabilitiesRegistryInterface struct { - mock.Mock -} - -type CapabilitiesRegistryInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *CapabilitiesRegistryInterface) EXPECT() *CapabilitiesRegistryInterface_Expecter { - return &CapabilitiesRegistryInterface_Expecter{mock: &_m.Mock} -} - -// AcceptOwnership provides a mock function with given fields: opts -func (_m *CapabilitiesRegistryInterface) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for AcceptOwnership") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts) (*types.Transaction, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts) *types.Transaction); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_AcceptOwnership_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AcceptOwnership' -type CapabilitiesRegistryInterface_AcceptOwnership_Call struct { - *mock.Call -} - -// AcceptOwnership is a helper method to define mock.On call -// - opts *bind.TransactOpts -func (_e *CapabilitiesRegistryInterface_Expecter) AcceptOwnership(opts interface{}) *CapabilitiesRegistryInterface_AcceptOwnership_Call { - return &CapabilitiesRegistryInterface_AcceptOwnership_Call{Call: _e.mock.On("AcceptOwnership", opts)} -} - -func (_c *CapabilitiesRegistryInterface_AcceptOwnership_Call) Run(run func(opts *bind.TransactOpts)) *CapabilitiesRegistryInterface_AcceptOwnership_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_AcceptOwnership_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_AcceptOwnership_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_AcceptOwnership_Call) RunAndReturn(run func(*bind.TransactOpts) (*types.Transaction, error)) *CapabilitiesRegistryInterface_AcceptOwnership_Call { - _c.Call.Return(run) - return _c -} - -// AddCapabilities provides a mock function with given fields: opts, capabilities -func (_m *CapabilitiesRegistryInterface) AddCapabilities(opts *bind.TransactOpts, capabilities []capabilities_registry.CapabilitiesRegistryCapability) (*types.Transaction, error) { - ret := _m.Called(opts, capabilities) - - if len(ret) == 0 { - panic("no return value specified for AddCapabilities") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryCapability) (*types.Transaction, error)); ok { - return rf(opts, capabilities) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryCapability) *types.Transaction); ok { - r0 = rf(opts, capabilities) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryCapability) error); ok { - r1 = rf(opts, capabilities) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_AddCapabilities_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddCapabilities' -type CapabilitiesRegistryInterface_AddCapabilities_Call struct { - *mock.Call -} - -// AddCapabilities is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - capabilities []capabilities_registry.CapabilitiesRegistryCapability -func (_e *CapabilitiesRegistryInterface_Expecter) AddCapabilities(opts interface{}, capabilities interface{}) *CapabilitiesRegistryInterface_AddCapabilities_Call { - return &CapabilitiesRegistryInterface_AddCapabilities_Call{Call: _e.mock.On("AddCapabilities", opts, capabilities)} -} - -func (_c *CapabilitiesRegistryInterface_AddCapabilities_Call) Run(run func(opts *bind.TransactOpts, capabilities []capabilities_registry.CapabilitiesRegistryCapability)) *CapabilitiesRegistryInterface_AddCapabilities_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].([]capabilities_registry.CapabilitiesRegistryCapability)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_AddCapabilities_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_AddCapabilities_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_AddCapabilities_Call) RunAndReturn(run func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryCapability) (*types.Transaction, error)) *CapabilitiesRegistryInterface_AddCapabilities_Call { - _c.Call.Return(run) - return _c -} - -// AddDON provides a mock function with given fields: opts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f -func (_m *CapabilitiesRegistryInterface) AddDON(opts *bind.TransactOpts, nodes [][32]byte, capabilityConfigurations []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) { - ret := _m.Called(opts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) - - if len(ret) == 0 { - panic("no return value specified for AddDON") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, bool, uint8) (*types.Transaction, error)); ok { - return rf(opts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, bool, uint8) *types.Transaction); ok { - r0 = rf(opts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, bool, uint8) error); ok { - r1 = rf(opts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_AddDON_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddDON' -type CapabilitiesRegistryInterface_AddDON_Call struct { - *mock.Call -} - -// AddDON is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - nodes [][32]byte -// - capabilityConfigurations []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration -// - isPublic bool -// - acceptsWorkflows bool -// - f uint8 -func (_e *CapabilitiesRegistryInterface_Expecter) AddDON(opts interface{}, nodes interface{}, capabilityConfigurations interface{}, isPublic interface{}, acceptsWorkflows interface{}, f interface{}) *CapabilitiesRegistryInterface_AddDON_Call { - return &CapabilitiesRegistryInterface_AddDON_Call{Call: _e.mock.On("AddDON", opts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f)} -} - -func (_c *CapabilitiesRegistryInterface_AddDON_Call) Run(run func(opts *bind.TransactOpts, nodes [][32]byte, capabilityConfigurations []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8)) *CapabilitiesRegistryInterface_AddDON_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].([][32]byte), args[2].([]capabilities_registry.CapabilitiesRegistryCapabilityConfiguration), args[3].(bool), args[4].(bool), args[5].(uint8)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_AddDON_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_AddDON_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_AddDON_Call) RunAndReturn(run func(*bind.TransactOpts, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, bool, uint8) (*types.Transaction, error)) *CapabilitiesRegistryInterface_AddDON_Call { - _c.Call.Return(run) - return _c -} - -// AddNodeOperators provides a mock function with given fields: opts, nodeOperators -func (_m *CapabilitiesRegistryInterface) AddNodeOperators(opts *bind.TransactOpts, nodeOperators []capabilities_registry.CapabilitiesRegistryNodeOperator) (*types.Transaction, error) { - ret := _m.Called(opts, nodeOperators) - - if len(ret) == 0 { - panic("no return value specified for AddNodeOperators") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeOperator) (*types.Transaction, error)); ok { - return rf(opts, nodeOperators) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeOperator) *types.Transaction); ok { - r0 = rf(opts, nodeOperators) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeOperator) error); ok { - r1 = rf(opts, nodeOperators) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_AddNodeOperators_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddNodeOperators' -type CapabilitiesRegistryInterface_AddNodeOperators_Call struct { - *mock.Call -} - -// AddNodeOperators is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - nodeOperators []capabilities_registry.CapabilitiesRegistryNodeOperator -func (_e *CapabilitiesRegistryInterface_Expecter) AddNodeOperators(opts interface{}, nodeOperators interface{}) *CapabilitiesRegistryInterface_AddNodeOperators_Call { - return &CapabilitiesRegistryInterface_AddNodeOperators_Call{Call: _e.mock.On("AddNodeOperators", opts, nodeOperators)} -} - -func (_c *CapabilitiesRegistryInterface_AddNodeOperators_Call) Run(run func(opts *bind.TransactOpts, nodeOperators []capabilities_registry.CapabilitiesRegistryNodeOperator)) *CapabilitiesRegistryInterface_AddNodeOperators_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].([]capabilities_registry.CapabilitiesRegistryNodeOperator)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_AddNodeOperators_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_AddNodeOperators_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_AddNodeOperators_Call) RunAndReturn(run func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeOperator) (*types.Transaction, error)) *CapabilitiesRegistryInterface_AddNodeOperators_Call { - _c.Call.Return(run) - return _c -} - -// AddNodes provides a mock function with given fields: opts, nodes -func (_m *CapabilitiesRegistryInterface) AddNodes(opts *bind.TransactOpts, nodes []capabilities_registry.CapabilitiesRegistryNodeParams) (*types.Transaction, error) { - ret := _m.Called(opts, nodes) - - if len(ret) == 0 { - panic("no return value specified for AddNodes") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) (*types.Transaction, error)); ok { - return rf(opts, nodes) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) *types.Transaction); ok { - r0 = rf(opts, nodes) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) error); ok { - r1 = rf(opts, nodes) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_AddNodes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddNodes' -type CapabilitiesRegistryInterface_AddNodes_Call struct { - *mock.Call -} - -// AddNodes is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - nodes []capabilities_registry.CapabilitiesRegistryNodeParams -func (_e *CapabilitiesRegistryInterface_Expecter) AddNodes(opts interface{}, nodes interface{}) *CapabilitiesRegistryInterface_AddNodes_Call { - return &CapabilitiesRegistryInterface_AddNodes_Call{Call: _e.mock.On("AddNodes", opts, nodes)} -} - -func (_c *CapabilitiesRegistryInterface_AddNodes_Call) Run(run func(opts *bind.TransactOpts, nodes []capabilities_registry.CapabilitiesRegistryNodeParams)) *CapabilitiesRegistryInterface_AddNodes_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].([]capabilities_registry.CapabilitiesRegistryNodeParams)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_AddNodes_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_AddNodes_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_AddNodes_Call) RunAndReturn(run func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) (*types.Transaction, error)) *CapabilitiesRegistryInterface_AddNodes_Call { - _c.Call.Return(run) - return _c -} - -// Address provides a mock function with given fields: -func (_m *CapabilitiesRegistryInterface) Address() common.Address { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Address") - } - - var r0 common.Address - if rf, ok := ret.Get(0).(func() common.Address); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - return r0 -} - -// CapabilitiesRegistryInterface_Address_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Address' -type CapabilitiesRegistryInterface_Address_Call struct { - *mock.Call -} - -// Address is a helper method to define mock.On call -func (_e *CapabilitiesRegistryInterface_Expecter) Address() *CapabilitiesRegistryInterface_Address_Call { - return &CapabilitiesRegistryInterface_Address_Call{Call: _e.mock.On("Address")} -} - -func (_c *CapabilitiesRegistryInterface_Address_Call) Run(run func()) *CapabilitiesRegistryInterface_Address_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_Address_Call) Return(_a0 common.Address) *CapabilitiesRegistryInterface_Address_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *CapabilitiesRegistryInterface_Address_Call) RunAndReturn(run func() common.Address) *CapabilitiesRegistryInterface_Address_Call { - _c.Call.Return(run) - return _c -} - -// DeprecateCapabilities provides a mock function with given fields: opts, hashedCapabilityIds -func (_m *CapabilitiesRegistryInterface) DeprecateCapabilities(opts *bind.TransactOpts, hashedCapabilityIds [][32]byte) (*types.Transaction, error) { - ret := _m.Called(opts, hashedCapabilityIds) - - if len(ret) == 0 { - panic("no return value specified for DeprecateCapabilities") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][32]byte) (*types.Transaction, error)); ok { - return rf(opts, hashedCapabilityIds) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][32]byte) *types.Transaction); ok { - r0 = rf(opts, hashedCapabilityIds) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, [][32]byte) error); ok { - r1 = rf(opts, hashedCapabilityIds) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_DeprecateCapabilities_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeprecateCapabilities' -type CapabilitiesRegistryInterface_DeprecateCapabilities_Call struct { - *mock.Call -} - -// DeprecateCapabilities is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - hashedCapabilityIds [][32]byte -func (_e *CapabilitiesRegistryInterface_Expecter) DeprecateCapabilities(opts interface{}, hashedCapabilityIds interface{}) *CapabilitiesRegistryInterface_DeprecateCapabilities_Call { - return &CapabilitiesRegistryInterface_DeprecateCapabilities_Call{Call: _e.mock.On("DeprecateCapabilities", opts, hashedCapabilityIds)} -} - -func (_c *CapabilitiesRegistryInterface_DeprecateCapabilities_Call) Run(run func(opts *bind.TransactOpts, hashedCapabilityIds [][32]byte)) *CapabilitiesRegistryInterface_DeprecateCapabilities_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].([][32]byte)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_DeprecateCapabilities_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_DeprecateCapabilities_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_DeprecateCapabilities_Call) RunAndReturn(run func(*bind.TransactOpts, [][32]byte) (*types.Transaction, error)) *CapabilitiesRegistryInterface_DeprecateCapabilities_Call { - _c.Call.Return(run) - return _c -} - -// FilterCapabilityConfigured provides a mock function with given fields: opts, hashedCapabilityId -func (_m *CapabilitiesRegistryInterface) FilterCapabilityConfigured(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*capabilities_registry.CapabilitiesRegistryCapabilityConfiguredIterator, error) { - ret := _m.Called(opts, hashedCapabilityId) - - if len(ret) == 0 { - panic("no return value specified for FilterCapabilityConfigured") - } - - var r0 *capabilities_registry.CapabilitiesRegistryCapabilityConfiguredIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, [][32]byte) (*capabilities_registry.CapabilitiesRegistryCapabilityConfiguredIterator, error)); ok { - return rf(opts, hashedCapabilityId) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, [][32]byte) *capabilities_registry.CapabilitiesRegistryCapabilityConfiguredIterator); ok { - r0 = rf(opts, hashedCapabilityId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryCapabilityConfiguredIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, [][32]byte) error); ok { - r1 = rf(opts, hashedCapabilityId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterCapabilityConfigured' -type CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call struct { - *mock.Call -} - -// FilterCapabilityConfigured is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - hashedCapabilityId [][32]byte -func (_e *CapabilitiesRegistryInterface_Expecter) FilterCapabilityConfigured(opts interface{}, hashedCapabilityId interface{}) *CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call { - return &CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call{Call: _e.mock.On("FilterCapabilityConfigured", opts, hashedCapabilityId)} -} - -func (_c *CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call) Run(run func(opts *bind.FilterOpts, hashedCapabilityId [][32]byte)) *CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([][32]byte)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryCapabilityConfiguredIterator, _a1 error) *CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call) RunAndReturn(run func(*bind.FilterOpts, [][32]byte) (*capabilities_registry.CapabilitiesRegistryCapabilityConfiguredIterator, error)) *CapabilitiesRegistryInterface_FilterCapabilityConfigured_Call { - _c.Call.Return(run) - return _c -} - -// FilterCapabilityDeprecated provides a mock function with given fields: opts, hashedCapabilityId -func (_m *CapabilitiesRegistryInterface) FilterCapabilityDeprecated(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*capabilities_registry.CapabilitiesRegistryCapabilityDeprecatedIterator, error) { - ret := _m.Called(opts, hashedCapabilityId) - - if len(ret) == 0 { - panic("no return value specified for FilterCapabilityDeprecated") - } - - var r0 *capabilities_registry.CapabilitiesRegistryCapabilityDeprecatedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, [][32]byte) (*capabilities_registry.CapabilitiesRegistryCapabilityDeprecatedIterator, error)); ok { - return rf(opts, hashedCapabilityId) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, [][32]byte) *capabilities_registry.CapabilitiesRegistryCapabilityDeprecatedIterator); ok { - r0 = rf(opts, hashedCapabilityId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryCapabilityDeprecatedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, [][32]byte) error); ok { - r1 = rf(opts, hashedCapabilityId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterCapabilityDeprecated' -type CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call struct { - *mock.Call -} - -// FilterCapabilityDeprecated is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - hashedCapabilityId [][32]byte -func (_e *CapabilitiesRegistryInterface_Expecter) FilterCapabilityDeprecated(opts interface{}, hashedCapabilityId interface{}) *CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call { - return &CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call{Call: _e.mock.On("FilterCapabilityDeprecated", opts, hashedCapabilityId)} -} - -func (_c *CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call) Run(run func(opts *bind.FilterOpts, hashedCapabilityId [][32]byte)) *CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([][32]byte)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryCapabilityDeprecatedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call) RunAndReturn(run func(*bind.FilterOpts, [][32]byte) (*capabilities_registry.CapabilitiesRegistryCapabilityDeprecatedIterator, error)) *CapabilitiesRegistryInterface_FilterCapabilityDeprecated_Call { - _c.Call.Return(run) - return _c -} - -// FilterConfigSet provides a mock function with given fields: opts, donId -func (_m *CapabilitiesRegistryInterface) FilterConfigSet(opts *bind.FilterOpts, donId []uint32) (*capabilities_registry.CapabilitiesRegistryConfigSetIterator, error) { - ret := _m.Called(opts, donId) - - if len(ret) == 0 { - panic("no return value specified for FilterConfigSet") - } - - var r0 *capabilities_registry.CapabilitiesRegistryConfigSetIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryConfigSetIterator, error)); ok { - return rf(opts, donId) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) *capabilities_registry.CapabilitiesRegistryConfigSetIterator); ok { - r0 = rf(opts, donId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryConfigSetIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint32) error); ok { - r1 = rf(opts, donId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_FilterConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterConfigSet' -type CapabilitiesRegistryInterface_FilterConfigSet_Call struct { - *mock.Call -} - -// FilterConfigSet is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - donId []uint32 -func (_e *CapabilitiesRegistryInterface_Expecter) FilterConfigSet(opts interface{}, donId interface{}) *CapabilitiesRegistryInterface_FilterConfigSet_Call { - return &CapabilitiesRegistryInterface_FilterConfigSet_Call{Call: _e.mock.On("FilterConfigSet", opts, donId)} -} - -func (_c *CapabilitiesRegistryInterface_FilterConfigSet_Call) Run(run func(opts *bind.FilterOpts, donId []uint32)) *CapabilitiesRegistryInterface_FilterConfigSet_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]uint32)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterConfigSet_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryConfigSetIterator, _a1 error) *CapabilitiesRegistryInterface_FilterConfigSet_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterConfigSet_Call) RunAndReturn(run func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryConfigSetIterator, error)) *CapabilitiesRegistryInterface_FilterConfigSet_Call { - _c.Call.Return(run) - return _c -} - -// FilterNodeAdded provides a mock function with given fields: opts, nodeOperatorId -func (_m *CapabilitiesRegistryInterface) FilterNodeAdded(opts *bind.FilterOpts, nodeOperatorId []uint32) (*capabilities_registry.CapabilitiesRegistryNodeAddedIterator, error) { - ret := _m.Called(opts, nodeOperatorId) - - if len(ret) == 0 { - panic("no return value specified for FilterNodeAdded") - } - - var r0 *capabilities_registry.CapabilitiesRegistryNodeAddedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryNodeAddedIterator, error)); ok { - return rf(opts, nodeOperatorId) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) *capabilities_registry.CapabilitiesRegistryNodeAddedIterator); ok { - r0 = rf(opts, nodeOperatorId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeAddedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint32) error); ok { - r1 = rf(opts, nodeOperatorId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_FilterNodeAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterNodeAdded' -type CapabilitiesRegistryInterface_FilterNodeAdded_Call struct { - *mock.Call -} - -// FilterNodeAdded is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - nodeOperatorId []uint32 -func (_e *CapabilitiesRegistryInterface_Expecter) FilterNodeAdded(opts interface{}, nodeOperatorId interface{}) *CapabilitiesRegistryInterface_FilterNodeAdded_Call { - return &CapabilitiesRegistryInterface_FilterNodeAdded_Call{Call: _e.mock.On("FilterNodeAdded", opts, nodeOperatorId)} -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeAdded_Call) Run(run func(opts *bind.FilterOpts, nodeOperatorId []uint32)) *CapabilitiesRegistryInterface_FilterNodeAdded_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]uint32)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeAdded_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeAddedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterNodeAdded_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeAdded_Call) RunAndReturn(run func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryNodeAddedIterator, error)) *CapabilitiesRegistryInterface_FilterNodeAdded_Call { - _c.Call.Return(run) - return _c -} - -// FilterNodeOperatorAdded provides a mock function with given fields: opts, nodeOperatorId, admin -func (_m *CapabilitiesRegistryInterface) FilterNodeOperatorAdded(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address) (*capabilities_registry.CapabilitiesRegistryNodeOperatorAddedIterator, error) { - ret := _m.Called(opts, nodeOperatorId, admin) - - if len(ret) == 0 { - panic("no return value specified for FilterNodeOperatorAdded") - } - - var r0 *capabilities_registry.CapabilitiesRegistryNodeOperatorAddedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32, []common.Address) (*capabilities_registry.CapabilitiesRegistryNodeOperatorAddedIterator, error)); ok { - return rf(opts, nodeOperatorId, admin) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32, []common.Address) *capabilities_registry.CapabilitiesRegistryNodeOperatorAddedIterator); ok { - r0 = rf(opts, nodeOperatorId, admin) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeOperatorAddedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint32, []common.Address) error); ok { - r1 = rf(opts, nodeOperatorId, admin) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterNodeOperatorAdded' -type CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call struct { - *mock.Call -} - -// FilterNodeOperatorAdded is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - nodeOperatorId []uint32 -// - admin []common.Address -func (_e *CapabilitiesRegistryInterface_Expecter) FilterNodeOperatorAdded(opts interface{}, nodeOperatorId interface{}, admin interface{}) *CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call { - return &CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call{Call: _e.mock.On("FilterNodeOperatorAdded", opts, nodeOperatorId, admin)} -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call) Run(run func(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address)) *CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]uint32), args[2].([]common.Address)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeOperatorAddedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call) RunAndReturn(run func(*bind.FilterOpts, []uint32, []common.Address) (*capabilities_registry.CapabilitiesRegistryNodeOperatorAddedIterator, error)) *CapabilitiesRegistryInterface_FilterNodeOperatorAdded_Call { - _c.Call.Return(run) - return _c -} - -// FilterNodeOperatorRemoved provides a mock function with given fields: opts, nodeOperatorId -func (_m *CapabilitiesRegistryInterface) FilterNodeOperatorRemoved(opts *bind.FilterOpts, nodeOperatorId []uint32) (*capabilities_registry.CapabilitiesRegistryNodeOperatorRemovedIterator, error) { - ret := _m.Called(opts, nodeOperatorId) - - if len(ret) == 0 { - panic("no return value specified for FilterNodeOperatorRemoved") - } - - var r0 *capabilities_registry.CapabilitiesRegistryNodeOperatorRemovedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryNodeOperatorRemovedIterator, error)); ok { - return rf(opts, nodeOperatorId) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) *capabilities_registry.CapabilitiesRegistryNodeOperatorRemovedIterator); ok { - r0 = rf(opts, nodeOperatorId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeOperatorRemovedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint32) error); ok { - r1 = rf(opts, nodeOperatorId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterNodeOperatorRemoved' -type CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call struct { - *mock.Call -} - -// FilterNodeOperatorRemoved is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - nodeOperatorId []uint32 -func (_e *CapabilitiesRegistryInterface_Expecter) FilterNodeOperatorRemoved(opts interface{}, nodeOperatorId interface{}) *CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call { - return &CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call{Call: _e.mock.On("FilterNodeOperatorRemoved", opts, nodeOperatorId)} -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call) Run(run func(opts *bind.FilterOpts, nodeOperatorId []uint32)) *CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]uint32)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeOperatorRemovedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call) RunAndReturn(run func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryNodeOperatorRemovedIterator, error)) *CapabilitiesRegistryInterface_FilterNodeOperatorRemoved_Call { - _c.Call.Return(run) - return _c -} - -// FilterNodeOperatorUpdated provides a mock function with given fields: opts, nodeOperatorId, admin -func (_m *CapabilitiesRegistryInterface) FilterNodeOperatorUpdated(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address) (*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdatedIterator, error) { - ret := _m.Called(opts, nodeOperatorId, admin) - - if len(ret) == 0 { - panic("no return value specified for FilterNodeOperatorUpdated") - } - - var r0 *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdatedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32, []common.Address) (*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdatedIterator, error)); ok { - return rf(opts, nodeOperatorId, admin) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32, []common.Address) *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdatedIterator); ok { - r0 = rf(opts, nodeOperatorId, admin) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdatedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint32, []common.Address) error); ok { - r1 = rf(opts, nodeOperatorId, admin) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterNodeOperatorUpdated' -type CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call struct { - *mock.Call -} - -// FilterNodeOperatorUpdated is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - nodeOperatorId []uint32 -// - admin []common.Address -func (_e *CapabilitiesRegistryInterface_Expecter) FilterNodeOperatorUpdated(opts interface{}, nodeOperatorId interface{}, admin interface{}) *CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call { - return &CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call{Call: _e.mock.On("FilterNodeOperatorUpdated", opts, nodeOperatorId, admin)} -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call) Run(run func(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address)) *CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]uint32), args[2].([]common.Address)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdatedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call) RunAndReturn(run func(*bind.FilterOpts, []uint32, []common.Address) (*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdatedIterator, error)) *CapabilitiesRegistryInterface_FilterNodeOperatorUpdated_Call { - _c.Call.Return(run) - return _c -} - -// FilterNodeRemoved provides a mock function with given fields: opts -func (_m *CapabilitiesRegistryInterface) FilterNodeRemoved(opts *bind.FilterOpts) (*capabilities_registry.CapabilitiesRegistryNodeRemovedIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterNodeRemoved") - } - - var r0 *capabilities_registry.CapabilitiesRegistryNodeRemovedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*capabilities_registry.CapabilitiesRegistryNodeRemovedIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *capabilities_registry.CapabilitiesRegistryNodeRemovedIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeRemovedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_FilterNodeRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterNodeRemoved' -type CapabilitiesRegistryInterface_FilterNodeRemoved_Call struct { - *mock.Call -} - -// FilterNodeRemoved is a helper method to define mock.On call -// - opts *bind.FilterOpts -func (_e *CapabilitiesRegistryInterface_Expecter) FilterNodeRemoved(opts interface{}) *CapabilitiesRegistryInterface_FilterNodeRemoved_Call { - return &CapabilitiesRegistryInterface_FilterNodeRemoved_Call{Call: _e.mock.On("FilterNodeRemoved", opts)} -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeRemoved_Call) Run(run func(opts *bind.FilterOpts)) *CapabilitiesRegistryInterface_FilterNodeRemoved_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeRemoved_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeRemovedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterNodeRemoved_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeRemoved_Call) RunAndReturn(run func(*bind.FilterOpts) (*capabilities_registry.CapabilitiesRegistryNodeRemovedIterator, error)) *CapabilitiesRegistryInterface_FilterNodeRemoved_Call { - _c.Call.Return(run) - return _c -} - -// FilterNodeUpdated provides a mock function with given fields: opts, nodeOperatorId -func (_m *CapabilitiesRegistryInterface) FilterNodeUpdated(opts *bind.FilterOpts, nodeOperatorId []uint32) (*capabilities_registry.CapabilitiesRegistryNodeUpdatedIterator, error) { - ret := _m.Called(opts, nodeOperatorId) - - if len(ret) == 0 { - panic("no return value specified for FilterNodeUpdated") - } - - var r0 *capabilities_registry.CapabilitiesRegistryNodeUpdatedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryNodeUpdatedIterator, error)); ok { - return rf(opts, nodeOperatorId) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32) *capabilities_registry.CapabilitiesRegistryNodeUpdatedIterator); ok { - r0 = rf(opts, nodeOperatorId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeUpdatedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint32) error); ok { - r1 = rf(opts, nodeOperatorId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_FilterNodeUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterNodeUpdated' -type CapabilitiesRegistryInterface_FilterNodeUpdated_Call struct { - *mock.Call -} - -// FilterNodeUpdated is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - nodeOperatorId []uint32 -func (_e *CapabilitiesRegistryInterface_Expecter) FilterNodeUpdated(opts interface{}, nodeOperatorId interface{}) *CapabilitiesRegistryInterface_FilterNodeUpdated_Call { - return &CapabilitiesRegistryInterface_FilterNodeUpdated_Call{Call: _e.mock.On("FilterNodeUpdated", opts, nodeOperatorId)} -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeUpdated_Call) Run(run func(opts *bind.FilterOpts, nodeOperatorId []uint32)) *CapabilitiesRegistryInterface_FilterNodeUpdated_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]uint32)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeUpdated_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeUpdatedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterNodeUpdated_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterNodeUpdated_Call) RunAndReturn(run func(*bind.FilterOpts, []uint32) (*capabilities_registry.CapabilitiesRegistryNodeUpdatedIterator, error)) *CapabilitiesRegistryInterface_FilterNodeUpdated_Call { - _c.Call.Return(run) - return _c -} - -// FilterOwnershipTransferRequested provides a mock function with given fields: opts, from, to -func (_m *CapabilitiesRegistryInterface) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequestedIterator, error) { - ret := _m.Called(opts, from, to) - - if len(ret) == 0 { - panic("no return value specified for FilterOwnershipTransferRequested") - } - - var r0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequestedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequestedIterator, error)); ok { - return rf(opts, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequestedIterator); ok { - r0 = rf(opts, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequestedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { - r1 = rf(opts, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterOwnershipTransferRequested' -type CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call struct { - *mock.Call -} - -// FilterOwnershipTransferRequested is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - from []common.Address -// - to []common.Address -func (_e *CapabilitiesRegistryInterface_Expecter) FilterOwnershipTransferRequested(opts interface{}, from interface{}, to interface{}) *CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call { - return &CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call{Call: _e.mock.On("FilterOwnershipTransferRequested", opts, from, to)} -} - -func (_c *CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call) Run(run func(opts *bind.FilterOpts, from []common.Address, to []common.Address)) *CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]common.Address), args[2].([]common.Address)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequestedIterator, _a1 error) *CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address, []common.Address) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequestedIterator, error)) *CapabilitiesRegistryInterface_FilterOwnershipTransferRequested_Call { - _c.Call.Return(run) - return _c -} - -// FilterOwnershipTransferred provides a mock function with given fields: opts, from, to -func (_m *CapabilitiesRegistryInterface) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferredIterator, error) { - ret := _m.Called(opts, from, to) - - if len(ret) == 0 { - panic("no return value specified for FilterOwnershipTransferred") - } - - var r0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferredIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferredIterator, error)); ok { - return rf(opts, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *capabilities_registry.CapabilitiesRegistryOwnershipTransferredIterator); ok { - r0 = rf(opts, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryOwnershipTransferredIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { - r1 = rf(opts, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterOwnershipTransferred' -type CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call struct { - *mock.Call -} - -// FilterOwnershipTransferred is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - from []common.Address -// - to []common.Address -func (_e *CapabilitiesRegistryInterface_Expecter) FilterOwnershipTransferred(opts interface{}, from interface{}, to interface{}) *CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call { - return &CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call{Call: _e.mock.On("FilterOwnershipTransferred", opts, from, to)} -} - -func (_c *CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call) Run(run func(opts *bind.FilterOpts, from []common.Address, to []common.Address)) *CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]common.Address), args[2].([]common.Address)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferredIterator, _a1 error) *CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address, []common.Address) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferredIterator, error)) *CapabilitiesRegistryInterface_FilterOwnershipTransferred_Call { - _c.Call.Return(run) - return _c -} - -// GetCapabilities provides a mock function with given fields: opts -func (_m *CapabilitiesRegistryInterface) GetCapabilities(opts *bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryCapabilityInfo, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for GetCapabilities") - } - - var r0 []capabilities_registry.CapabilitiesRegistryCapabilityInfo - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryCapabilityInfo, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) []capabilities_registry.CapabilitiesRegistryCapabilityInfo); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]capabilities_registry.CapabilitiesRegistryCapabilityInfo) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_GetCapabilities_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCapabilities' -type CapabilitiesRegistryInterface_GetCapabilities_Call struct { - *mock.Call -} - -// GetCapabilities is a helper method to define mock.On call -// - opts *bind.CallOpts -func (_e *CapabilitiesRegistryInterface_Expecter) GetCapabilities(opts interface{}) *CapabilitiesRegistryInterface_GetCapabilities_Call { - return &CapabilitiesRegistryInterface_GetCapabilities_Call{Call: _e.mock.On("GetCapabilities", opts)} -} - -func (_c *CapabilitiesRegistryInterface_GetCapabilities_Call) Run(run func(opts *bind.CallOpts)) *CapabilitiesRegistryInterface_GetCapabilities_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetCapabilities_Call) Return(_a0 []capabilities_registry.CapabilitiesRegistryCapabilityInfo, _a1 error) *CapabilitiesRegistryInterface_GetCapabilities_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetCapabilities_Call) RunAndReturn(run func(*bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryCapabilityInfo, error)) *CapabilitiesRegistryInterface_GetCapabilities_Call { - _c.Call.Return(run) - return _c -} - -// GetCapability provides a mock function with given fields: opts, hashedId -func (_m *CapabilitiesRegistryInterface) GetCapability(opts *bind.CallOpts, hashedId [32]byte) (capabilities_registry.CapabilitiesRegistryCapabilityInfo, error) { - ret := _m.Called(opts, hashedId) - - if len(ret) == 0 { - panic("no return value specified for GetCapability") - } - - var r0 capabilities_registry.CapabilitiesRegistryCapabilityInfo - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, [32]byte) (capabilities_registry.CapabilitiesRegistryCapabilityInfo, error)); ok { - return rf(opts, hashedId) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, [32]byte) capabilities_registry.CapabilitiesRegistryCapabilityInfo); ok { - r0 = rf(opts, hashedId) - } else { - r0 = ret.Get(0).(capabilities_registry.CapabilitiesRegistryCapabilityInfo) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, [32]byte) error); ok { - r1 = rf(opts, hashedId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_GetCapability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCapability' -type CapabilitiesRegistryInterface_GetCapability_Call struct { - *mock.Call -} - -// GetCapability is a helper method to define mock.On call -// - opts *bind.CallOpts -// - hashedId [32]byte -func (_e *CapabilitiesRegistryInterface_Expecter) GetCapability(opts interface{}, hashedId interface{}) *CapabilitiesRegistryInterface_GetCapability_Call { - return &CapabilitiesRegistryInterface_GetCapability_Call{Call: _e.mock.On("GetCapability", opts, hashedId)} -} - -func (_c *CapabilitiesRegistryInterface_GetCapability_Call) Run(run func(opts *bind.CallOpts, hashedId [32]byte)) *CapabilitiesRegistryInterface_GetCapability_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts), args[1].([32]byte)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetCapability_Call) Return(_a0 capabilities_registry.CapabilitiesRegistryCapabilityInfo, _a1 error) *CapabilitiesRegistryInterface_GetCapability_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetCapability_Call) RunAndReturn(run func(*bind.CallOpts, [32]byte) (capabilities_registry.CapabilitiesRegistryCapabilityInfo, error)) *CapabilitiesRegistryInterface_GetCapability_Call { - _c.Call.Return(run) - return _c -} - -// GetCapabilityConfigs provides a mock function with given fields: opts, donId, capabilityId -func (_m *CapabilitiesRegistryInterface) GetCapabilityConfigs(opts *bind.CallOpts, donId uint32, capabilityId [32]byte) ([]byte, []byte, error) { - ret := _m.Called(opts, donId, capabilityId) - - if len(ret) == 0 { - panic("no return value specified for GetCapabilityConfigs") - } - - var r0 []byte - var r1 []byte - var r2 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, uint32, [32]byte) ([]byte, []byte, error)); ok { - return rf(opts, donId, capabilityId) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, uint32, [32]byte) []byte); ok { - r0 = rf(opts, donId, capabilityId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]byte) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, uint32, [32]byte) []byte); ok { - r1 = rf(opts, donId, capabilityId) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).([]byte) - } - } - - if rf, ok := ret.Get(2).(func(*bind.CallOpts, uint32, [32]byte) error); ok { - r2 = rf(opts, donId, capabilityId) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CapabilitiesRegistryInterface_GetCapabilityConfigs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCapabilityConfigs' -type CapabilitiesRegistryInterface_GetCapabilityConfigs_Call struct { - *mock.Call -} - -// GetCapabilityConfigs is a helper method to define mock.On call -// - opts *bind.CallOpts -// - donId uint32 -// - capabilityId [32]byte -func (_e *CapabilitiesRegistryInterface_Expecter) GetCapabilityConfigs(opts interface{}, donId interface{}, capabilityId interface{}) *CapabilitiesRegistryInterface_GetCapabilityConfigs_Call { - return &CapabilitiesRegistryInterface_GetCapabilityConfigs_Call{Call: _e.mock.On("GetCapabilityConfigs", opts, donId, capabilityId)} -} - -func (_c *CapabilitiesRegistryInterface_GetCapabilityConfigs_Call) Run(run func(opts *bind.CallOpts, donId uint32, capabilityId [32]byte)) *CapabilitiesRegistryInterface_GetCapabilityConfigs_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts), args[1].(uint32), args[2].([32]byte)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetCapabilityConfigs_Call) Return(_a0 []byte, _a1 []byte, _a2 error) *CapabilitiesRegistryInterface_GetCapabilityConfigs_Call { - _c.Call.Return(_a0, _a1, _a2) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetCapabilityConfigs_Call) RunAndReturn(run func(*bind.CallOpts, uint32, [32]byte) ([]byte, []byte, error)) *CapabilitiesRegistryInterface_GetCapabilityConfigs_Call { - _c.Call.Return(run) - return _c -} - -// GetDON provides a mock function with given fields: opts, donId -func (_m *CapabilitiesRegistryInterface) GetDON(opts *bind.CallOpts, donId uint32) (capabilities_registry.CapabilitiesRegistryDONInfo, error) { - ret := _m.Called(opts, donId) - - if len(ret) == 0 { - panic("no return value specified for GetDON") - } - - var r0 capabilities_registry.CapabilitiesRegistryDONInfo - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, uint32) (capabilities_registry.CapabilitiesRegistryDONInfo, error)); ok { - return rf(opts, donId) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, uint32) capabilities_registry.CapabilitiesRegistryDONInfo); ok { - r0 = rf(opts, donId) - } else { - r0 = ret.Get(0).(capabilities_registry.CapabilitiesRegistryDONInfo) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, uint32) error); ok { - r1 = rf(opts, donId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_GetDON_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDON' -type CapabilitiesRegistryInterface_GetDON_Call struct { - *mock.Call -} - -// GetDON is a helper method to define mock.On call -// - opts *bind.CallOpts -// - donId uint32 -func (_e *CapabilitiesRegistryInterface_Expecter) GetDON(opts interface{}, donId interface{}) *CapabilitiesRegistryInterface_GetDON_Call { - return &CapabilitiesRegistryInterface_GetDON_Call{Call: _e.mock.On("GetDON", opts, donId)} -} - -func (_c *CapabilitiesRegistryInterface_GetDON_Call) Run(run func(opts *bind.CallOpts, donId uint32)) *CapabilitiesRegistryInterface_GetDON_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts), args[1].(uint32)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetDON_Call) Return(_a0 capabilities_registry.CapabilitiesRegistryDONInfo, _a1 error) *CapabilitiesRegistryInterface_GetDON_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetDON_Call) RunAndReturn(run func(*bind.CallOpts, uint32) (capabilities_registry.CapabilitiesRegistryDONInfo, error)) *CapabilitiesRegistryInterface_GetDON_Call { - _c.Call.Return(run) - return _c -} - -// GetDONs provides a mock function with given fields: opts -func (_m *CapabilitiesRegistryInterface) GetDONs(opts *bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryDONInfo, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for GetDONs") - } - - var r0 []capabilities_registry.CapabilitiesRegistryDONInfo - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryDONInfo, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) []capabilities_registry.CapabilitiesRegistryDONInfo); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]capabilities_registry.CapabilitiesRegistryDONInfo) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_GetDONs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDONs' -type CapabilitiesRegistryInterface_GetDONs_Call struct { - *mock.Call -} - -// GetDONs is a helper method to define mock.On call -// - opts *bind.CallOpts -func (_e *CapabilitiesRegistryInterface_Expecter) GetDONs(opts interface{}) *CapabilitiesRegistryInterface_GetDONs_Call { - return &CapabilitiesRegistryInterface_GetDONs_Call{Call: _e.mock.On("GetDONs", opts)} -} - -func (_c *CapabilitiesRegistryInterface_GetDONs_Call) Run(run func(opts *bind.CallOpts)) *CapabilitiesRegistryInterface_GetDONs_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetDONs_Call) Return(_a0 []capabilities_registry.CapabilitiesRegistryDONInfo, _a1 error) *CapabilitiesRegistryInterface_GetDONs_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetDONs_Call) RunAndReturn(run func(*bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryDONInfo, error)) *CapabilitiesRegistryInterface_GetDONs_Call { - _c.Call.Return(run) - return _c -} - -// GetHashedCapabilityId provides a mock function with given fields: opts, labelledName, version -func (_m *CapabilitiesRegistryInterface) GetHashedCapabilityId(opts *bind.CallOpts, labelledName string, version string) ([32]byte, error) { - ret := _m.Called(opts, labelledName, version) - - if len(ret) == 0 { - panic("no return value specified for GetHashedCapabilityId") - } - - var r0 [32]byte - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, string, string) ([32]byte, error)); ok { - return rf(opts, labelledName, version) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, string, string) [32]byte); ok { - r0 = rf(opts, labelledName, version) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([32]byte) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, string, string) error); ok { - r1 = rf(opts, labelledName, version) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_GetHashedCapabilityId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetHashedCapabilityId' -type CapabilitiesRegistryInterface_GetHashedCapabilityId_Call struct { - *mock.Call -} - -// GetHashedCapabilityId is a helper method to define mock.On call -// - opts *bind.CallOpts -// - labelledName string -// - version string -func (_e *CapabilitiesRegistryInterface_Expecter) GetHashedCapabilityId(opts interface{}, labelledName interface{}, version interface{}) *CapabilitiesRegistryInterface_GetHashedCapabilityId_Call { - return &CapabilitiesRegistryInterface_GetHashedCapabilityId_Call{Call: _e.mock.On("GetHashedCapabilityId", opts, labelledName, version)} -} - -func (_c *CapabilitiesRegistryInterface_GetHashedCapabilityId_Call) Run(run func(opts *bind.CallOpts, labelledName string, version string)) *CapabilitiesRegistryInterface_GetHashedCapabilityId_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts), args[1].(string), args[2].(string)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetHashedCapabilityId_Call) Return(_a0 [32]byte, _a1 error) *CapabilitiesRegistryInterface_GetHashedCapabilityId_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetHashedCapabilityId_Call) RunAndReturn(run func(*bind.CallOpts, string, string) ([32]byte, error)) *CapabilitiesRegistryInterface_GetHashedCapabilityId_Call { - _c.Call.Return(run) - return _c -} - -// GetNextDONId provides a mock function with given fields: opts -func (_m *CapabilitiesRegistryInterface) GetNextDONId(opts *bind.CallOpts) (uint32, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for GetNextDONId") - } - - var r0 uint32 - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (uint32, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) uint32); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(uint32) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_GetNextDONId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNextDONId' -type CapabilitiesRegistryInterface_GetNextDONId_Call struct { - *mock.Call -} - -// GetNextDONId is a helper method to define mock.On call -// - opts *bind.CallOpts -func (_e *CapabilitiesRegistryInterface_Expecter) GetNextDONId(opts interface{}) *CapabilitiesRegistryInterface_GetNextDONId_Call { - return &CapabilitiesRegistryInterface_GetNextDONId_Call{Call: _e.mock.On("GetNextDONId", opts)} -} - -func (_c *CapabilitiesRegistryInterface_GetNextDONId_Call) Run(run func(opts *bind.CallOpts)) *CapabilitiesRegistryInterface_GetNextDONId_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetNextDONId_Call) Return(_a0 uint32, _a1 error) *CapabilitiesRegistryInterface_GetNextDONId_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetNextDONId_Call) RunAndReturn(run func(*bind.CallOpts) (uint32, error)) *CapabilitiesRegistryInterface_GetNextDONId_Call { - _c.Call.Return(run) - return _c -} - -// GetNode provides a mock function with given fields: opts, p2pId -func (_m *CapabilitiesRegistryInterface) GetNode(opts *bind.CallOpts, p2pId [32]byte) (capabilities_registry.INodeInfoProviderNodeInfo, error) { - ret := _m.Called(opts, p2pId) - - if len(ret) == 0 { - panic("no return value specified for GetNode") - } - - var r0 capabilities_registry.INodeInfoProviderNodeInfo - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, [32]byte) (capabilities_registry.INodeInfoProviderNodeInfo, error)); ok { - return rf(opts, p2pId) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, [32]byte) capabilities_registry.INodeInfoProviderNodeInfo); ok { - r0 = rf(opts, p2pId) - } else { - r0 = ret.Get(0).(capabilities_registry.INodeInfoProviderNodeInfo) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, [32]byte) error); ok { - r1 = rf(opts, p2pId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_GetNode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNode' -type CapabilitiesRegistryInterface_GetNode_Call struct { - *mock.Call -} - -// GetNode is a helper method to define mock.On call -// - opts *bind.CallOpts -// - p2pId [32]byte -func (_e *CapabilitiesRegistryInterface_Expecter) GetNode(opts interface{}, p2pId interface{}) *CapabilitiesRegistryInterface_GetNode_Call { - return &CapabilitiesRegistryInterface_GetNode_Call{Call: _e.mock.On("GetNode", opts, p2pId)} -} - -func (_c *CapabilitiesRegistryInterface_GetNode_Call) Run(run func(opts *bind.CallOpts, p2pId [32]byte)) *CapabilitiesRegistryInterface_GetNode_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts), args[1].([32]byte)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetNode_Call) Return(_a0 capabilities_registry.INodeInfoProviderNodeInfo, _a1 error) *CapabilitiesRegistryInterface_GetNode_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetNode_Call) RunAndReturn(run func(*bind.CallOpts, [32]byte) (capabilities_registry.INodeInfoProviderNodeInfo, error)) *CapabilitiesRegistryInterface_GetNode_Call { - _c.Call.Return(run) - return _c -} - -// GetNodeOperator provides a mock function with given fields: opts, nodeOperatorId -func (_m *CapabilitiesRegistryInterface) GetNodeOperator(opts *bind.CallOpts, nodeOperatorId uint32) (capabilities_registry.CapabilitiesRegistryNodeOperator, error) { - ret := _m.Called(opts, nodeOperatorId) - - if len(ret) == 0 { - panic("no return value specified for GetNodeOperator") - } - - var r0 capabilities_registry.CapabilitiesRegistryNodeOperator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, uint32) (capabilities_registry.CapabilitiesRegistryNodeOperator, error)); ok { - return rf(opts, nodeOperatorId) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, uint32) capabilities_registry.CapabilitiesRegistryNodeOperator); ok { - r0 = rf(opts, nodeOperatorId) - } else { - r0 = ret.Get(0).(capabilities_registry.CapabilitiesRegistryNodeOperator) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, uint32) error); ok { - r1 = rf(opts, nodeOperatorId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_GetNodeOperator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNodeOperator' -type CapabilitiesRegistryInterface_GetNodeOperator_Call struct { - *mock.Call -} - -// GetNodeOperator is a helper method to define mock.On call -// - opts *bind.CallOpts -// - nodeOperatorId uint32 -func (_e *CapabilitiesRegistryInterface_Expecter) GetNodeOperator(opts interface{}, nodeOperatorId interface{}) *CapabilitiesRegistryInterface_GetNodeOperator_Call { - return &CapabilitiesRegistryInterface_GetNodeOperator_Call{Call: _e.mock.On("GetNodeOperator", opts, nodeOperatorId)} -} - -func (_c *CapabilitiesRegistryInterface_GetNodeOperator_Call) Run(run func(opts *bind.CallOpts, nodeOperatorId uint32)) *CapabilitiesRegistryInterface_GetNodeOperator_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts), args[1].(uint32)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetNodeOperator_Call) Return(_a0 capabilities_registry.CapabilitiesRegistryNodeOperator, _a1 error) *CapabilitiesRegistryInterface_GetNodeOperator_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetNodeOperator_Call) RunAndReturn(run func(*bind.CallOpts, uint32) (capabilities_registry.CapabilitiesRegistryNodeOperator, error)) *CapabilitiesRegistryInterface_GetNodeOperator_Call { - _c.Call.Return(run) - return _c -} - -// GetNodeOperators provides a mock function with given fields: opts -func (_m *CapabilitiesRegistryInterface) GetNodeOperators(opts *bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryNodeOperator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for GetNodeOperators") - } - - var r0 []capabilities_registry.CapabilitiesRegistryNodeOperator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryNodeOperator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) []capabilities_registry.CapabilitiesRegistryNodeOperator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]capabilities_registry.CapabilitiesRegistryNodeOperator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_GetNodeOperators_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNodeOperators' -type CapabilitiesRegistryInterface_GetNodeOperators_Call struct { - *mock.Call -} - -// GetNodeOperators is a helper method to define mock.On call -// - opts *bind.CallOpts -func (_e *CapabilitiesRegistryInterface_Expecter) GetNodeOperators(opts interface{}) *CapabilitiesRegistryInterface_GetNodeOperators_Call { - return &CapabilitiesRegistryInterface_GetNodeOperators_Call{Call: _e.mock.On("GetNodeOperators", opts)} -} - -func (_c *CapabilitiesRegistryInterface_GetNodeOperators_Call) Run(run func(opts *bind.CallOpts)) *CapabilitiesRegistryInterface_GetNodeOperators_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetNodeOperators_Call) Return(_a0 []capabilities_registry.CapabilitiesRegistryNodeOperator, _a1 error) *CapabilitiesRegistryInterface_GetNodeOperators_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetNodeOperators_Call) RunAndReturn(run func(*bind.CallOpts) ([]capabilities_registry.CapabilitiesRegistryNodeOperator, error)) *CapabilitiesRegistryInterface_GetNodeOperators_Call { - _c.Call.Return(run) - return _c -} - -// GetNodes provides a mock function with given fields: opts -func (_m *CapabilitiesRegistryInterface) GetNodes(opts *bind.CallOpts) ([]capabilities_registry.INodeInfoProviderNodeInfo, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for GetNodes") - } - - var r0 []capabilities_registry.INodeInfoProviderNodeInfo - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) ([]capabilities_registry.INodeInfoProviderNodeInfo, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) []capabilities_registry.INodeInfoProviderNodeInfo); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]capabilities_registry.INodeInfoProviderNodeInfo) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_GetNodes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNodes' -type CapabilitiesRegistryInterface_GetNodes_Call struct { - *mock.Call -} - -// GetNodes is a helper method to define mock.On call -// - opts *bind.CallOpts -func (_e *CapabilitiesRegistryInterface_Expecter) GetNodes(opts interface{}) *CapabilitiesRegistryInterface_GetNodes_Call { - return &CapabilitiesRegistryInterface_GetNodes_Call{Call: _e.mock.On("GetNodes", opts)} -} - -func (_c *CapabilitiesRegistryInterface_GetNodes_Call) Run(run func(opts *bind.CallOpts)) *CapabilitiesRegistryInterface_GetNodes_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetNodes_Call) Return(_a0 []capabilities_registry.INodeInfoProviderNodeInfo, _a1 error) *CapabilitiesRegistryInterface_GetNodes_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetNodes_Call) RunAndReturn(run func(*bind.CallOpts) ([]capabilities_registry.INodeInfoProviderNodeInfo, error)) *CapabilitiesRegistryInterface_GetNodes_Call { - _c.Call.Return(run) - return _c -} - -// GetNodesByP2PIds provides a mock function with given fields: opts, p2pIds -func (_m *CapabilitiesRegistryInterface) GetNodesByP2PIds(opts *bind.CallOpts, p2pIds [][32]byte) ([]capabilities_registry.INodeInfoProviderNodeInfo, error) { - ret := _m.Called(opts, p2pIds) - - if len(ret) == 0 { - panic("no return value specified for GetNodesByP2PIds") - } - - var r0 []capabilities_registry.INodeInfoProviderNodeInfo - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, [][32]byte) ([]capabilities_registry.INodeInfoProviderNodeInfo, error)); ok { - return rf(opts, p2pIds) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, [][32]byte) []capabilities_registry.INodeInfoProviderNodeInfo); ok { - r0 = rf(opts, p2pIds) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]capabilities_registry.INodeInfoProviderNodeInfo) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, [][32]byte) error); ok { - r1 = rf(opts, p2pIds) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_GetNodesByP2PIds_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNodesByP2PIds' -type CapabilitiesRegistryInterface_GetNodesByP2PIds_Call struct { - *mock.Call -} - -// GetNodesByP2PIds is a helper method to define mock.On call -// - opts *bind.CallOpts -// - p2pIds [][32]byte -func (_e *CapabilitiesRegistryInterface_Expecter) GetNodesByP2PIds(opts interface{}, p2pIds interface{}) *CapabilitiesRegistryInterface_GetNodesByP2PIds_Call { - return &CapabilitiesRegistryInterface_GetNodesByP2PIds_Call{Call: _e.mock.On("GetNodesByP2PIds", opts, p2pIds)} -} - -func (_c *CapabilitiesRegistryInterface_GetNodesByP2PIds_Call) Run(run func(opts *bind.CallOpts, p2pIds [][32]byte)) *CapabilitiesRegistryInterface_GetNodesByP2PIds_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts), args[1].([][32]byte)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetNodesByP2PIds_Call) Return(_a0 []capabilities_registry.INodeInfoProviderNodeInfo, _a1 error) *CapabilitiesRegistryInterface_GetNodesByP2PIds_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_GetNodesByP2PIds_Call) RunAndReturn(run func(*bind.CallOpts, [][32]byte) ([]capabilities_registry.INodeInfoProviderNodeInfo, error)) *CapabilitiesRegistryInterface_GetNodesByP2PIds_Call { - _c.Call.Return(run) - return _c -} - -// IsCapabilityDeprecated provides a mock function with given fields: opts, hashedCapabilityId -func (_m *CapabilitiesRegistryInterface) IsCapabilityDeprecated(opts *bind.CallOpts, hashedCapabilityId [32]byte) (bool, error) { - ret := _m.Called(opts, hashedCapabilityId) - - if len(ret) == 0 { - panic("no return value specified for IsCapabilityDeprecated") - } - - var r0 bool - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, [32]byte) (bool, error)); ok { - return rf(opts, hashedCapabilityId) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, [32]byte) bool); ok { - r0 = rf(opts, hashedCapabilityId) - } else { - r0 = ret.Get(0).(bool) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, [32]byte) error); ok { - r1 = rf(opts, hashedCapabilityId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsCapabilityDeprecated' -type CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call struct { - *mock.Call -} - -// IsCapabilityDeprecated is a helper method to define mock.On call -// - opts *bind.CallOpts -// - hashedCapabilityId [32]byte -func (_e *CapabilitiesRegistryInterface_Expecter) IsCapabilityDeprecated(opts interface{}, hashedCapabilityId interface{}) *CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call { - return &CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call{Call: _e.mock.On("IsCapabilityDeprecated", opts, hashedCapabilityId)} -} - -func (_c *CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call) Run(run func(opts *bind.CallOpts, hashedCapabilityId [32]byte)) *CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts), args[1].([32]byte)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call) Return(_a0 bool, _a1 error) *CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call) RunAndReturn(run func(*bind.CallOpts, [32]byte) (bool, error)) *CapabilitiesRegistryInterface_IsCapabilityDeprecated_Call { - _c.Call.Return(run) - return _c -} - -// Owner provides a mock function with given fields: opts -func (_m *CapabilitiesRegistryInterface) Owner(opts *bind.CallOpts) (common.Address, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for Owner") - } - - var r0 common.Address - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (common.Address, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) common.Address); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_Owner_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Owner' -type CapabilitiesRegistryInterface_Owner_Call struct { - *mock.Call -} - -// Owner is a helper method to define mock.On call -// - opts *bind.CallOpts -func (_e *CapabilitiesRegistryInterface_Expecter) Owner(opts interface{}) *CapabilitiesRegistryInterface_Owner_Call { - return &CapabilitiesRegistryInterface_Owner_Call{Call: _e.mock.On("Owner", opts)} -} - -func (_c *CapabilitiesRegistryInterface_Owner_Call) Run(run func(opts *bind.CallOpts)) *CapabilitiesRegistryInterface_Owner_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_Owner_Call) Return(_a0 common.Address, _a1 error) *CapabilitiesRegistryInterface_Owner_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_Owner_Call) RunAndReturn(run func(*bind.CallOpts) (common.Address, error)) *CapabilitiesRegistryInterface_Owner_Call { - _c.Call.Return(run) - return _c -} - -// ParseCapabilityConfigured provides a mock function with given fields: log -func (_m *CapabilitiesRegistryInterface) ParseCapabilityConfigured(log types.Log) (*capabilities_registry.CapabilitiesRegistryCapabilityConfigured, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseCapabilityConfigured") - } - - var r0 *capabilities_registry.CapabilitiesRegistryCapabilityConfigured - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryCapabilityConfigured, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryCapabilityConfigured); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryCapabilityConfigured) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseCapabilityConfigured' -type CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call struct { - *mock.Call -} - -// ParseCapabilityConfigured is a helper method to define mock.On call -// - log types.Log -func (_e *CapabilitiesRegistryInterface_Expecter) ParseCapabilityConfigured(log interface{}) *CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call { - return &CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call{Call: _e.mock.On("ParseCapabilityConfigured", log)} -} - -func (_c *CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryCapabilityConfigured, _a1 error) *CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryCapabilityConfigured, error)) *CapabilitiesRegistryInterface_ParseCapabilityConfigured_Call { - _c.Call.Return(run) - return _c -} - -// ParseCapabilityDeprecated provides a mock function with given fields: log -func (_m *CapabilitiesRegistryInterface) ParseCapabilityDeprecated(log types.Log) (*capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseCapabilityDeprecated") - } - - var r0 *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryCapabilityDeprecated) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseCapabilityDeprecated' -type CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call struct { - *mock.Call -} - -// ParseCapabilityDeprecated is a helper method to define mock.On call -// - log types.Log -func (_e *CapabilitiesRegistryInterface_Expecter) ParseCapabilityDeprecated(log interface{}) *CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call { - return &CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call{Call: _e.mock.On("ParseCapabilityDeprecated", log)} -} - -func (_c *CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, _a1 error) *CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, error)) *CapabilitiesRegistryInterface_ParseCapabilityDeprecated_Call { - _c.Call.Return(run) - return _c -} - -// ParseConfigSet provides a mock function with given fields: log -func (_m *CapabilitiesRegistryInterface) ParseConfigSet(log types.Log) (*capabilities_registry.CapabilitiesRegistryConfigSet, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseConfigSet") - } - - var r0 *capabilities_registry.CapabilitiesRegistryConfigSet - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryConfigSet, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryConfigSet); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryConfigSet) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_ParseConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseConfigSet' -type CapabilitiesRegistryInterface_ParseConfigSet_Call struct { - *mock.Call -} - -// ParseConfigSet is a helper method to define mock.On call -// - log types.Log -func (_e *CapabilitiesRegistryInterface_Expecter) ParseConfigSet(log interface{}) *CapabilitiesRegistryInterface_ParseConfigSet_Call { - return &CapabilitiesRegistryInterface_ParseConfigSet_Call{Call: _e.mock.On("ParseConfigSet", log)} -} - -func (_c *CapabilitiesRegistryInterface_ParseConfigSet_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseConfigSet_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseConfigSet_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryConfigSet, _a1 error) *CapabilitiesRegistryInterface_ParseConfigSet_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseConfigSet_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryConfigSet, error)) *CapabilitiesRegistryInterface_ParseConfigSet_Call { - _c.Call.Return(run) - return _c -} - -// ParseLog provides a mock function with given fields: log -func (_m *CapabilitiesRegistryInterface) ParseLog(log types.Log) (generated.AbigenLog, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseLog") - } - - var r0 generated.AbigenLog - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (generated.AbigenLog, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) generated.AbigenLog); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(generated.AbigenLog) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_ParseLog_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseLog' -type CapabilitiesRegistryInterface_ParseLog_Call struct { - *mock.Call -} - -// ParseLog is a helper method to define mock.On call -// - log types.Log -func (_e *CapabilitiesRegistryInterface_Expecter) ParseLog(log interface{}) *CapabilitiesRegistryInterface_ParseLog_Call { - return &CapabilitiesRegistryInterface_ParseLog_Call{Call: _e.mock.On("ParseLog", log)} -} - -func (_c *CapabilitiesRegistryInterface_ParseLog_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseLog_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseLog_Call) Return(_a0 generated.AbigenLog, _a1 error) *CapabilitiesRegistryInterface_ParseLog_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseLog_Call) RunAndReturn(run func(types.Log) (generated.AbigenLog, error)) *CapabilitiesRegistryInterface_ParseLog_Call { - _c.Call.Return(run) - return _c -} - -// ParseNodeAdded provides a mock function with given fields: log -func (_m *CapabilitiesRegistryInterface) ParseNodeAdded(log types.Log) (*capabilities_registry.CapabilitiesRegistryNodeAdded, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseNodeAdded") - } - - var r0 *capabilities_registry.CapabilitiesRegistryNodeAdded - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeAdded, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryNodeAdded); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeAdded) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_ParseNodeAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseNodeAdded' -type CapabilitiesRegistryInterface_ParseNodeAdded_Call struct { - *mock.Call -} - -// ParseNodeAdded is a helper method to define mock.On call -// - log types.Log -func (_e *CapabilitiesRegistryInterface_Expecter) ParseNodeAdded(log interface{}) *CapabilitiesRegistryInterface_ParseNodeAdded_Call { - return &CapabilitiesRegistryInterface_ParseNodeAdded_Call{Call: _e.mock.On("ParseNodeAdded", log)} -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeAdded_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseNodeAdded_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeAdded_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeAdded, _a1 error) *CapabilitiesRegistryInterface_ParseNodeAdded_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeAdded_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeAdded, error)) *CapabilitiesRegistryInterface_ParseNodeAdded_Call { - _c.Call.Return(run) - return _c -} - -// ParseNodeOperatorAdded provides a mock function with given fields: log -func (_m *CapabilitiesRegistryInterface) ParseNodeOperatorAdded(log types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseNodeOperatorAdded") - } - - var r0 *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeOperatorAdded) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseNodeOperatorAdded' -type CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call struct { - *mock.Call -} - -// ParseNodeOperatorAdded is a helper method to define mock.On call -// - log types.Log -func (_e *CapabilitiesRegistryInterface_Expecter) ParseNodeOperatorAdded(log interface{}) *CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call { - return &CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call{Call: _e.mock.On("ParseNodeOperatorAdded", log)} -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, _a1 error) *CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, error)) *CapabilitiesRegistryInterface_ParseNodeOperatorAdded_Call { - _c.Call.Return(run) - return _c -} - -// ParseNodeOperatorRemoved provides a mock function with given fields: log -func (_m *CapabilitiesRegistryInterface) ParseNodeOperatorRemoved(log types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseNodeOperatorRemoved") - } - - var r0 *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseNodeOperatorRemoved' -type CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call struct { - *mock.Call -} - -// ParseNodeOperatorRemoved is a helper method to define mock.On call -// - log types.Log -func (_e *CapabilitiesRegistryInterface_Expecter) ParseNodeOperatorRemoved(log interface{}) *CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call { - return &CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call{Call: _e.mock.On("ParseNodeOperatorRemoved", log)} -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, _a1 error) *CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, error)) *CapabilitiesRegistryInterface_ParseNodeOperatorRemoved_Call { - _c.Call.Return(run) - return _c -} - -// ParseNodeOperatorUpdated provides a mock function with given fields: log -func (_m *CapabilitiesRegistryInterface) ParseNodeOperatorUpdated(log types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseNodeOperatorUpdated") - } - - var r0 *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseNodeOperatorUpdated' -type CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call struct { - *mock.Call -} - -// ParseNodeOperatorUpdated is a helper method to define mock.On call -// - log types.Log -func (_e *CapabilitiesRegistryInterface_Expecter) ParseNodeOperatorUpdated(log interface{}) *CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call { - return &CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call{Call: _e.mock.On("ParseNodeOperatorUpdated", log)} -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, _a1 error) *CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, error)) *CapabilitiesRegistryInterface_ParseNodeOperatorUpdated_Call { - _c.Call.Return(run) - return _c -} - -// ParseNodeRemoved provides a mock function with given fields: log -func (_m *CapabilitiesRegistryInterface) ParseNodeRemoved(log types.Log) (*capabilities_registry.CapabilitiesRegistryNodeRemoved, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseNodeRemoved") - } - - var r0 *capabilities_registry.CapabilitiesRegistryNodeRemoved - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeRemoved, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryNodeRemoved); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeRemoved) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_ParseNodeRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseNodeRemoved' -type CapabilitiesRegistryInterface_ParseNodeRemoved_Call struct { - *mock.Call -} - -// ParseNodeRemoved is a helper method to define mock.On call -// - log types.Log -func (_e *CapabilitiesRegistryInterface_Expecter) ParseNodeRemoved(log interface{}) *CapabilitiesRegistryInterface_ParseNodeRemoved_Call { - return &CapabilitiesRegistryInterface_ParseNodeRemoved_Call{Call: _e.mock.On("ParseNodeRemoved", log)} -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeRemoved_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseNodeRemoved_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeRemoved_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeRemoved, _a1 error) *CapabilitiesRegistryInterface_ParseNodeRemoved_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeRemoved_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeRemoved, error)) *CapabilitiesRegistryInterface_ParseNodeRemoved_Call { - _c.Call.Return(run) - return _c -} - -// ParseNodeUpdated provides a mock function with given fields: log -func (_m *CapabilitiesRegistryInterface) ParseNodeUpdated(log types.Log) (*capabilities_registry.CapabilitiesRegistryNodeUpdated, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseNodeUpdated") - } - - var r0 *capabilities_registry.CapabilitiesRegistryNodeUpdated - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeUpdated, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryNodeUpdated); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryNodeUpdated) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_ParseNodeUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseNodeUpdated' -type CapabilitiesRegistryInterface_ParseNodeUpdated_Call struct { - *mock.Call -} - -// ParseNodeUpdated is a helper method to define mock.On call -// - log types.Log -func (_e *CapabilitiesRegistryInterface_Expecter) ParseNodeUpdated(log interface{}) *CapabilitiesRegistryInterface_ParseNodeUpdated_Call { - return &CapabilitiesRegistryInterface_ParseNodeUpdated_Call{Call: _e.mock.On("ParseNodeUpdated", log)} -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeUpdated_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseNodeUpdated_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeUpdated_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryNodeUpdated, _a1 error) *CapabilitiesRegistryInterface_ParseNodeUpdated_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseNodeUpdated_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryNodeUpdated, error)) *CapabilitiesRegistryInterface_ParseNodeUpdated_Call { - _c.Call.Return(run) - return _c -} - -// ParseOwnershipTransferRequested provides a mock function with given fields: log -func (_m *CapabilitiesRegistryInterface) ParseOwnershipTransferRequested(log types.Log) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseOwnershipTransferRequested") - } - - var r0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseOwnershipTransferRequested' -type CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call struct { - *mock.Call -} - -// ParseOwnershipTransferRequested is a helper method to define mock.On call -// - log types.Log -func (_e *CapabilitiesRegistryInterface_Expecter) ParseOwnershipTransferRequested(log interface{}) *CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call { - return &CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call{Call: _e.mock.On("ParseOwnershipTransferRequested", log)} -} - -func (_c *CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, _a1 error) *CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, error)) *CapabilitiesRegistryInterface_ParseOwnershipTransferRequested_Call { - _c.Call.Return(run) - return _c -} - -// ParseOwnershipTransferred provides a mock function with given fields: log -func (_m *CapabilitiesRegistryInterface) ParseOwnershipTransferred(log types.Log) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferred, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseOwnershipTransferred") - } - - var r0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferred - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferred, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *capabilities_registry.CapabilitiesRegistryOwnershipTransferred); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*capabilities_registry.CapabilitiesRegistryOwnershipTransferred) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseOwnershipTransferred' -type CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call struct { - *mock.Call -} - -// ParseOwnershipTransferred is a helper method to define mock.On call -// - log types.Log -func (_e *CapabilitiesRegistryInterface_Expecter) ParseOwnershipTransferred(log interface{}) *CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call { - return &CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call{Call: _e.mock.On("ParseOwnershipTransferred", log)} -} - -func (_c *CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call) Run(run func(log types.Log)) *CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call) Return(_a0 *capabilities_registry.CapabilitiesRegistryOwnershipTransferred, _a1 error) *CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call) RunAndReturn(run func(types.Log) (*capabilities_registry.CapabilitiesRegistryOwnershipTransferred, error)) *CapabilitiesRegistryInterface_ParseOwnershipTransferred_Call { - _c.Call.Return(run) - return _c -} - -// RemoveDONs provides a mock function with given fields: opts, donIds -func (_m *CapabilitiesRegistryInterface) RemoveDONs(opts *bind.TransactOpts, donIds []uint32) (*types.Transaction, error) { - ret := _m.Called(opts, donIds) - - if len(ret) == 0 { - panic("no return value specified for RemoveDONs") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []uint32) (*types.Transaction, error)); ok { - return rf(opts, donIds) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []uint32) *types.Transaction); ok { - r0 = rf(opts, donIds) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []uint32) error); ok { - r1 = rf(opts, donIds) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_RemoveDONs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveDONs' -type CapabilitiesRegistryInterface_RemoveDONs_Call struct { - *mock.Call -} - -// RemoveDONs is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - donIds []uint32 -func (_e *CapabilitiesRegistryInterface_Expecter) RemoveDONs(opts interface{}, donIds interface{}) *CapabilitiesRegistryInterface_RemoveDONs_Call { - return &CapabilitiesRegistryInterface_RemoveDONs_Call{Call: _e.mock.On("RemoveDONs", opts, donIds)} -} - -func (_c *CapabilitiesRegistryInterface_RemoveDONs_Call) Run(run func(opts *bind.TransactOpts, donIds []uint32)) *CapabilitiesRegistryInterface_RemoveDONs_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].([]uint32)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_RemoveDONs_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_RemoveDONs_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_RemoveDONs_Call) RunAndReturn(run func(*bind.TransactOpts, []uint32) (*types.Transaction, error)) *CapabilitiesRegistryInterface_RemoveDONs_Call { - _c.Call.Return(run) - return _c -} - -// RemoveNodeOperators provides a mock function with given fields: opts, nodeOperatorIds -func (_m *CapabilitiesRegistryInterface) RemoveNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []uint32) (*types.Transaction, error) { - ret := _m.Called(opts, nodeOperatorIds) - - if len(ret) == 0 { - panic("no return value specified for RemoveNodeOperators") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []uint32) (*types.Transaction, error)); ok { - return rf(opts, nodeOperatorIds) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []uint32) *types.Transaction); ok { - r0 = rf(opts, nodeOperatorIds) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []uint32) error); ok { - r1 = rf(opts, nodeOperatorIds) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_RemoveNodeOperators_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveNodeOperators' -type CapabilitiesRegistryInterface_RemoveNodeOperators_Call struct { - *mock.Call -} - -// RemoveNodeOperators is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - nodeOperatorIds []uint32 -func (_e *CapabilitiesRegistryInterface_Expecter) RemoveNodeOperators(opts interface{}, nodeOperatorIds interface{}) *CapabilitiesRegistryInterface_RemoveNodeOperators_Call { - return &CapabilitiesRegistryInterface_RemoveNodeOperators_Call{Call: _e.mock.On("RemoveNodeOperators", opts, nodeOperatorIds)} -} - -func (_c *CapabilitiesRegistryInterface_RemoveNodeOperators_Call) Run(run func(opts *bind.TransactOpts, nodeOperatorIds []uint32)) *CapabilitiesRegistryInterface_RemoveNodeOperators_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].([]uint32)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_RemoveNodeOperators_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_RemoveNodeOperators_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_RemoveNodeOperators_Call) RunAndReturn(run func(*bind.TransactOpts, []uint32) (*types.Transaction, error)) *CapabilitiesRegistryInterface_RemoveNodeOperators_Call { - _c.Call.Return(run) - return _c -} - -// RemoveNodes provides a mock function with given fields: opts, removedNodeP2PIds -func (_m *CapabilitiesRegistryInterface) RemoveNodes(opts *bind.TransactOpts, removedNodeP2PIds [][32]byte) (*types.Transaction, error) { - ret := _m.Called(opts, removedNodeP2PIds) - - if len(ret) == 0 { - panic("no return value specified for RemoveNodes") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][32]byte) (*types.Transaction, error)); ok { - return rf(opts, removedNodeP2PIds) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][32]byte) *types.Transaction); ok { - r0 = rf(opts, removedNodeP2PIds) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, [][32]byte) error); ok { - r1 = rf(opts, removedNodeP2PIds) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_RemoveNodes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveNodes' -type CapabilitiesRegistryInterface_RemoveNodes_Call struct { - *mock.Call -} - -// RemoveNodes is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - removedNodeP2PIds [][32]byte -func (_e *CapabilitiesRegistryInterface_Expecter) RemoveNodes(opts interface{}, removedNodeP2PIds interface{}) *CapabilitiesRegistryInterface_RemoveNodes_Call { - return &CapabilitiesRegistryInterface_RemoveNodes_Call{Call: _e.mock.On("RemoveNodes", opts, removedNodeP2PIds)} -} - -func (_c *CapabilitiesRegistryInterface_RemoveNodes_Call) Run(run func(opts *bind.TransactOpts, removedNodeP2PIds [][32]byte)) *CapabilitiesRegistryInterface_RemoveNodes_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].([][32]byte)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_RemoveNodes_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_RemoveNodes_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_RemoveNodes_Call) RunAndReturn(run func(*bind.TransactOpts, [][32]byte) (*types.Transaction, error)) *CapabilitiesRegistryInterface_RemoveNodes_Call { - _c.Call.Return(run) - return _c -} - -// TransferOwnership provides a mock function with given fields: opts, to -func (_m *CapabilitiesRegistryInterface) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, to) - - if len(ret) == 0 { - panic("no return value specified for TransferOwnership") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { - return rf(opts, to) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { - r0 = rf(opts, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { - r1 = rf(opts, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_TransferOwnership_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransferOwnership' -type CapabilitiesRegistryInterface_TransferOwnership_Call struct { - *mock.Call -} - -// TransferOwnership is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - to common.Address -func (_e *CapabilitiesRegistryInterface_Expecter) TransferOwnership(opts interface{}, to interface{}) *CapabilitiesRegistryInterface_TransferOwnership_Call { - return &CapabilitiesRegistryInterface_TransferOwnership_Call{Call: _e.mock.On("TransferOwnership", opts, to)} -} - -func (_c *CapabilitiesRegistryInterface_TransferOwnership_Call) Run(run func(opts *bind.TransactOpts, to common.Address)) *CapabilitiesRegistryInterface_TransferOwnership_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].(common.Address)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_TransferOwnership_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_TransferOwnership_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_TransferOwnership_Call) RunAndReturn(run func(*bind.TransactOpts, common.Address) (*types.Transaction, error)) *CapabilitiesRegistryInterface_TransferOwnership_Call { - _c.Call.Return(run) - return _c -} - -// TypeAndVersion provides a mock function with given fields: opts -func (_m *CapabilitiesRegistryInterface) TypeAndVersion(opts *bind.CallOpts) (string, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for TypeAndVersion") - } - - var r0 string - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (string, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) string); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(string) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_TypeAndVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeAndVersion' -type CapabilitiesRegistryInterface_TypeAndVersion_Call struct { - *mock.Call -} - -// TypeAndVersion is a helper method to define mock.On call -// - opts *bind.CallOpts -func (_e *CapabilitiesRegistryInterface_Expecter) TypeAndVersion(opts interface{}) *CapabilitiesRegistryInterface_TypeAndVersion_Call { - return &CapabilitiesRegistryInterface_TypeAndVersion_Call{Call: _e.mock.On("TypeAndVersion", opts)} -} - -func (_c *CapabilitiesRegistryInterface_TypeAndVersion_Call) Run(run func(opts *bind.CallOpts)) *CapabilitiesRegistryInterface_TypeAndVersion_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_TypeAndVersion_Call) Return(_a0 string, _a1 error) *CapabilitiesRegistryInterface_TypeAndVersion_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_TypeAndVersion_Call) RunAndReturn(run func(*bind.CallOpts) (string, error)) *CapabilitiesRegistryInterface_TypeAndVersion_Call { - _c.Call.Return(run) - return _c -} - -// UpdateDON provides a mock function with given fields: opts, donId, nodes, capabilityConfigurations, isPublic, f -func (_m *CapabilitiesRegistryInterface) UpdateDON(opts *bind.TransactOpts, donId uint32, nodes [][32]byte, capabilityConfigurations []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, isPublic bool, f uint8) (*types.Transaction, error) { - ret := _m.Called(opts, donId, nodes, capabilityConfigurations, isPublic, f) - - if len(ret) == 0 { - panic("no return value specified for UpdateDON") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, uint32, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, uint8) (*types.Transaction, error)); ok { - return rf(opts, donId, nodes, capabilityConfigurations, isPublic, f) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, uint32, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, uint8) *types.Transaction); ok { - r0 = rf(opts, donId, nodes, capabilityConfigurations, isPublic, f) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, uint32, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, uint8) error); ok { - r1 = rf(opts, donId, nodes, capabilityConfigurations, isPublic, f) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_UpdateDON_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDON' -type CapabilitiesRegistryInterface_UpdateDON_Call struct { - *mock.Call -} - -// UpdateDON is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - donId uint32 -// - nodes [][32]byte -// - capabilityConfigurations []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration -// - isPublic bool -// - f uint8 -func (_e *CapabilitiesRegistryInterface_Expecter) UpdateDON(opts interface{}, donId interface{}, nodes interface{}, capabilityConfigurations interface{}, isPublic interface{}, f interface{}) *CapabilitiesRegistryInterface_UpdateDON_Call { - return &CapabilitiesRegistryInterface_UpdateDON_Call{Call: _e.mock.On("UpdateDON", opts, donId, nodes, capabilityConfigurations, isPublic, f)} -} - -func (_c *CapabilitiesRegistryInterface_UpdateDON_Call) Run(run func(opts *bind.TransactOpts, donId uint32, nodes [][32]byte, capabilityConfigurations []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, isPublic bool, f uint8)) *CapabilitiesRegistryInterface_UpdateDON_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].(uint32), args[2].([][32]byte), args[3].([]capabilities_registry.CapabilitiesRegistryCapabilityConfiguration), args[4].(bool), args[5].(uint8)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_UpdateDON_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_UpdateDON_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_UpdateDON_Call) RunAndReturn(run func(*bind.TransactOpts, uint32, [][32]byte, []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration, bool, uint8) (*types.Transaction, error)) *CapabilitiesRegistryInterface_UpdateDON_Call { - _c.Call.Return(run) - return _c -} - -// UpdateNodeOperators provides a mock function with given fields: opts, nodeOperatorIds, nodeOperators -func (_m *CapabilitiesRegistryInterface) UpdateNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []uint32, nodeOperators []capabilities_registry.CapabilitiesRegistryNodeOperator) (*types.Transaction, error) { - ret := _m.Called(opts, nodeOperatorIds, nodeOperators) - - if len(ret) == 0 { - panic("no return value specified for UpdateNodeOperators") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []uint32, []capabilities_registry.CapabilitiesRegistryNodeOperator) (*types.Transaction, error)); ok { - return rf(opts, nodeOperatorIds, nodeOperators) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []uint32, []capabilities_registry.CapabilitiesRegistryNodeOperator) *types.Transaction); ok { - r0 = rf(opts, nodeOperatorIds, nodeOperators) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []uint32, []capabilities_registry.CapabilitiesRegistryNodeOperator) error); ok { - r1 = rf(opts, nodeOperatorIds, nodeOperators) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_UpdateNodeOperators_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateNodeOperators' -type CapabilitiesRegistryInterface_UpdateNodeOperators_Call struct { - *mock.Call -} - -// UpdateNodeOperators is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - nodeOperatorIds []uint32 -// - nodeOperators []capabilities_registry.CapabilitiesRegistryNodeOperator -func (_e *CapabilitiesRegistryInterface_Expecter) UpdateNodeOperators(opts interface{}, nodeOperatorIds interface{}, nodeOperators interface{}) *CapabilitiesRegistryInterface_UpdateNodeOperators_Call { - return &CapabilitiesRegistryInterface_UpdateNodeOperators_Call{Call: _e.mock.On("UpdateNodeOperators", opts, nodeOperatorIds, nodeOperators)} -} - -func (_c *CapabilitiesRegistryInterface_UpdateNodeOperators_Call) Run(run func(opts *bind.TransactOpts, nodeOperatorIds []uint32, nodeOperators []capabilities_registry.CapabilitiesRegistryNodeOperator)) *CapabilitiesRegistryInterface_UpdateNodeOperators_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].([]uint32), args[2].([]capabilities_registry.CapabilitiesRegistryNodeOperator)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_UpdateNodeOperators_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_UpdateNodeOperators_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_UpdateNodeOperators_Call) RunAndReturn(run func(*bind.TransactOpts, []uint32, []capabilities_registry.CapabilitiesRegistryNodeOperator) (*types.Transaction, error)) *CapabilitiesRegistryInterface_UpdateNodeOperators_Call { - _c.Call.Return(run) - return _c -} - -// UpdateNodes provides a mock function with given fields: opts, nodes -func (_m *CapabilitiesRegistryInterface) UpdateNodes(opts *bind.TransactOpts, nodes []capabilities_registry.CapabilitiesRegistryNodeParams) (*types.Transaction, error) { - ret := _m.Called(opts, nodes) - - if len(ret) == 0 { - panic("no return value specified for UpdateNodes") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) (*types.Transaction, error)); ok { - return rf(opts, nodes) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) *types.Transaction); ok { - r0 = rf(opts, nodes) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) error); ok { - r1 = rf(opts, nodes) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_UpdateNodes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateNodes' -type CapabilitiesRegistryInterface_UpdateNodes_Call struct { - *mock.Call -} - -// UpdateNodes is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - nodes []capabilities_registry.CapabilitiesRegistryNodeParams -func (_e *CapabilitiesRegistryInterface_Expecter) UpdateNodes(opts interface{}, nodes interface{}) *CapabilitiesRegistryInterface_UpdateNodes_Call { - return &CapabilitiesRegistryInterface_UpdateNodes_Call{Call: _e.mock.On("UpdateNodes", opts, nodes)} -} - -func (_c *CapabilitiesRegistryInterface_UpdateNodes_Call) Run(run func(opts *bind.TransactOpts, nodes []capabilities_registry.CapabilitiesRegistryNodeParams)) *CapabilitiesRegistryInterface_UpdateNodes_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].([]capabilities_registry.CapabilitiesRegistryNodeParams)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_UpdateNodes_Call) Return(_a0 *types.Transaction, _a1 error) *CapabilitiesRegistryInterface_UpdateNodes_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_UpdateNodes_Call) RunAndReturn(run func(*bind.TransactOpts, []capabilities_registry.CapabilitiesRegistryNodeParams) (*types.Transaction, error)) *CapabilitiesRegistryInterface_UpdateNodes_Call { - _c.Call.Return(run) - return _c -} - -// WatchCapabilityConfigured provides a mock function with given fields: opts, sink, hashedCapabilityId -func (_m *CapabilitiesRegistryInterface) WatchCapabilityConfigured(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured, hashedCapabilityId [][32]byte) (event.Subscription, error) { - ret := _m.Called(opts, sink, hashedCapabilityId) - - if len(ret) == 0 { - panic("no return value specified for WatchCapabilityConfigured") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured, [][32]byte) (event.Subscription, error)); ok { - return rf(opts, sink, hashedCapabilityId) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured, [][32]byte) event.Subscription); ok { - r0 = rf(opts, sink, hashedCapabilityId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured, [][32]byte) error); ok { - r1 = rf(opts, sink, hashedCapabilityId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchCapabilityConfigured' -type CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call struct { - *mock.Call -} - -// WatchCapabilityConfigured is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured -// - hashedCapabilityId [][32]byte -func (_e *CapabilitiesRegistryInterface_Expecter) WatchCapabilityConfigured(opts interface{}, sink interface{}, hashedCapabilityId interface{}) *CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call { - return &CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call{Call: _e.mock.On("WatchCapabilityConfigured", opts, sink, hashedCapabilityId)} -} - -func (_c *CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured, hashedCapabilityId [][32]byte)) *CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured), args[2].([][32]byte)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityConfigured, [][32]byte) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchCapabilityConfigured_Call { - _c.Call.Return(run) - return _c -} - -// WatchCapabilityDeprecated provides a mock function with given fields: opts, sink, hashedCapabilityId -func (_m *CapabilitiesRegistryInterface) WatchCapabilityDeprecated(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, hashedCapabilityId [][32]byte) (event.Subscription, error) { - ret := _m.Called(opts, sink, hashedCapabilityId) - - if len(ret) == 0 { - panic("no return value specified for WatchCapabilityDeprecated") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, [][32]byte) (event.Subscription, error)); ok { - return rf(opts, sink, hashedCapabilityId) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, [][32]byte) event.Subscription); ok { - r0 = rf(opts, sink, hashedCapabilityId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, [][32]byte) error); ok { - r1 = rf(opts, sink, hashedCapabilityId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchCapabilityDeprecated' -type CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call struct { - *mock.Call -} - -// WatchCapabilityDeprecated is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated -// - hashedCapabilityId [][32]byte -func (_e *CapabilitiesRegistryInterface_Expecter) WatchCapabilityDeprecated(opts interface{}, sink interface{}, hashedCapabilityId interface{}) *CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call { - return &CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call{Call: _e.mock.On("WatchCapabilityDeprecated", opts, sink, hashedCapabilityId)} -} - -func (_c *CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, hashedCapabilityId [][32]byte)) *CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated), args[2].([][32]byte)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryCapabilityDeprecated, [][32]byte) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchCapabilityDeprecated_Call { - _c.Call.Return(run) - return _c -} - -// WatchConfigSet provides a mock function with given fields: opts, sink, donId -func (_m *CapabilitiesRegistryInterface) WatchConfigSet(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryConfigSet, donId []uint32) (event.Subscription, error) { - ret := _m.Called(opts, sink, donId) - - if len(ret) == 0 { - panic("no return value specified for WatchConfigSet") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryConfigSet, []uint32) (event.Subscription, error)); ok { - return rf(opts, sink, donId) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryConfigSet, []uint32) event.Subscription); ok { - r0 = rf(opts, sink, donId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryConfigSet, []uint32) error); ok { - r1 = rf(opts, sink, donId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_WatchConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchConfigSet' -type CapabilitiesRegistryInterface_WatchConfigSet_Call struct { - *mock.Call -} - -// WatchConfigSet is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *capabilities_registry.CapabilitiesRegistryConfigSet -// - donId []uint32 -func (_e *CapabilitiesRegistryInterface_Expecter) WatchConfigSet(opts interface{}, sink interface{}, donId interface{}) *CapabilitiesRegistryInterface_WatchConfigSet_Call { - return &CapabilitiesRegistryInterface_WatchConfigSet_Call{Call: _e.mock.On("WatchConfigSet", opts, sink, donId)} -} - -func (_c *CapabilitiesRegistryInterface_WatchConfigSet_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryConfigSet, donId []uint32)) *CapabilitiesRegistryInterface_WatchConfigSet_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryConfigSet), args[2].([]uint32)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchConfigSet_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchConfigSet_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchConfigSet_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryConfigSet, []uint32) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchConfigSet_Call { - _c.Call.Return(run) - return _c -} - -// WatchNodeAdded provides a mock function with given fields: opts, sink, nodeOperatorId -func (_m *CapabilitiesRegistryInterface) WatchNodeAdded(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded, nodeOperatorId []uint32) (event.Subscription, error) { - ret := _m.Called(opts, sink, nodeOperatorId) - - if len(ret) == 0 { - panic("no return value specified for WatchNodeAdded") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded, []uint32) (event.Subscription, error)); ok { - return rf(opts, sink, nodeOperatorId) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded, []uint32) event.Subscription); ok { - r0 = rf(opts, sink, nodeOperatorId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded, []uint32) error); ok { - r1 = rf(opts, sink, nodeOperatorId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_WatchNodeAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchNodeAdded' -type CapabilitiesRegistryInterface_WatchNodeAdded_Call struct { - *mock.Call -} - -// WatchNodeAdded is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded -// - nodeOperatorId []uint32 -func (_e *CapabilitiesRegistryInterface_Expecter) WatchNodeAdded(opts interface{}, sink interface{}, nodeOperatorId interface{}) *CapabilitiesRegistryInterface_WatchNodeAdded_Call { - return &CapabilitiesRegistryInterface_WatchNodeAdded_Call{Call: _e.mock.On("WatchNodeAdded", opts, sink, nodeOperatorId)} -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeAdded_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded, nodeOperatorId []uint32)) *CapabilitiesRegistryInterface_WatchNodeAdded_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded), args[2].([]uint32)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeAdded_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchNodeAdded_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeAdded_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeAdded, []uint32) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchNodeAdded_Call { - _c.Call.Return(run) - return _c -} - -// WatchNodeOperatorAdded provides a mock function with given fields: opts, sink, nodeOperatorId, admin -func (_m *CapabilitiesRegistryInterface) WatchNodeOperatorAdded(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, nodeOperatorId []uint32, admin []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, nodeOperatorId, admin) - - if len(ret) == 0 { - panic("no return value specified for WatchNodeOperatorAdded") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, []uint32, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, nodeOperatorId, admin) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, []uint32, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, nodeOperatorId, admin) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, []uint32, []common.Address) error); ok { - r1 = rf(opts, sink, nodeOperatorId, admin) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchNodeOperatorAdded' -type CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call struct { - *mock.Call -} - -// WatchNodeOperatorAdded is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded -// - nodeOperatorId []uint32 -// - admin []common.Address -func (_e *CapabilitiesRegistryInterface_Expecter) WatchNodeOperatorAdded(opts interface{}, sink interface{}, nodeOperatorId interface{}, admin interface{}) *CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call { - return &CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call{Call: _e.mock.On("WatchNodeOperatorAdded", opts, sink, nodeOperatorId, admin)} -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, nodeOperatorId []uint32, admin []common.Address)) *CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded), args[2].([]uint32), args[3].([]common.Address)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorAdded, []uint32, []common.Address) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchNodeOperatorAdded_Call { - _c.Call.Return(run) - return _c -} - -// WatchNodeOperatorRemoved provides a mock function with given fields: opts, sink, nodeOperatorId -func (_m *CapabilitiesRegistryInterface) WatchNodeOperatorRemoved(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, nodeOperatorId []uint32) (event.Subscription, error) { - ret := _m.Called(opts, sink, nodeOperatorId) - - if len(ret) == 0 { - panic("no return value specified for WatchNodeOperatorRemoved") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, []uint32) (event.Subscription, error)); ok { - return rf(opts, sink, nodeOperatorId) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, []uint32) event.Subscription); ok { - r0 = rf(opts, sink, nodeOperatorId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, []uint32) error); ok { - r1 = rf(opts, sink, nodeOperatorId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchNodeOperatorRemoved' -type CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call struct { - *mock.Call -} - -// WatchNodeOperatorRemoved is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved -// - nodeOperatorId []uint32 -func (_e *CapabilitiesRegistryInterface_Expecter) WatchNodeOperatorRemoved(opts interface{}, sink interface{}, nodeOperatorId interface{}) *CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call { - return &CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call{Call: _e.mock.On("WatchNodeOperatorRemoved", opts, sink, nodeOperatorId)} -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, nodeOperatorId []uint32)) *CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved), args[2].([]uint32)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorRemoved, []uint32) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchNodeOperatorRemoved_Call { - _c.Call.Return(run) - return _c -} - -// WatchNodeOperatorUpdated provides a mock function with given fields: opts, sink, nodeOperatorId, admin -func (_m *CapabilitiesRegistryInterface) WatchNodeOperatorUpdated(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, nodeOperatorId []uint32, admin []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, nodeOperatorId, admin) - - if len(ret) == 0 { - panic("no return value specified for WatchNodeOperatorUpdated") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, []uint32, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, nodeOperatorId, admin) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, []uint32, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, nodeOperatorId, admin) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, []uint32, []common.Address) error); ok { - r1 = rf(opts, sink, nodeOperatorId, admin) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchNodeOperatorUpdated' -type CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call struct { - *mock.Call -} - -// WatchNodeOperatorUpdated is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated -// - nodeOperatorId []uint32 -// - admin []common.Address -func (_e *CapabilitiesRegistryInterface_Expecter) WatchNodeOperatorUpdated(opts interface{}, sink interface{}, nodeOperatorId interface{}, admin interface{}) *CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call { - return &CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call{Call: _e.mock.On("WatchNodeOperatorUpdated", opts, sink, nodeOperatorId, admin)} -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, nodeOperatorId []uint32, admin []common.Address)) *CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated), args[2].([]uint32), args[3].([]common.Address)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeOperatorUpdated, []uint32, []common.Address) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchNodeOperatorUpdated_Call { - _c.Call.Return(run) - return _c -} - -// WatchNodeRemoved provides a mock function with given fields: opts, sink -func (_m *CapabilitiesRegistryInterface) WatchNodeRemoved(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchNodeRemoved") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_WatchNodeRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchNodeRemoved' -type CapabilitiesRegistryInterface_WatchNodeRemoved_Call struct { - *mock.Call -} - -// WatchNodeRemoved is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved -func (_e *CapabilitiesRegistryInterface_Expecter) WatchNodeRemoved(opts interface{}, sink interface{}) *CapabilitiesRegistryInterface_WatchNodeRemoved_Call { - return &CapabilitiesRegistryInterface_WatchNodeRemoved_Call{Call: _e.mock.On("WatchNodeRemoved", opts, sink)} -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeRemoved_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved)) *CapabilitiesRegistryInterface_WatchNodeRemoved_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeRemoved_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchNodeRemoved_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeRemoved_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeRemoved) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchNodeRemoved_Call { - _c.Call.Return(run) - return _c -} - -// WatchNodeUpdated provides a mock function with given fields: opts, sink, nodeOperatorId -func (_m *CapabilitiesRegistryInterface) WatchNodeUpdated(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated, nodeOperatorId []uint32) (event.Subscription, error) { - ret := _m.Called(opts, sink, nodeOperatorId) - - if len(ret) == 0 { - panic("no return value specified for WatchNodeUpdated") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated, []uint32) (event.Subscription, error)); ok { - return rf(opts, sink, nodeOperatorId) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated, []uint32) event.Subscription); ok { - r0 = rf(opts, sink, nodeOperatorId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated, []uint32) error); ok { - r1 = rf(opts, sink, nodeOperatorId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_WatchNodeUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchNodeUpdated' -type CapabilitiesRegistryInterface_WatchNodeUpdated_Call struct { - *mock.Call -} - -// WatchNodeUpdated is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated -// - nodeOperatorId []uint32 -func (_e *CapabilitiesRegistryInterface_Expecter) WatchNodeUpdated(opts interface{}, sink interface{}, nodeOperatorId interface{}) *CapabilitiesRegistryInterface_WatchNodeUpdated_Call { - return &CapabilitiesRegistryInterface_WatchNodeUpdated_Call{Call: _e.mock.On("WatchNodeUpdated", opts, sink, nodeOperatorId)} -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeUpdated_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated, nodeOperatorId []uint32)) *CapabilitiesRegistryInterface_WatchNodeUpdated_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated), args[2].([]uint32)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeUpdated_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchNodeUpdated_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchNodeUpdated_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryNodeUpdated, []uint32) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchNodeUpdated_Call { - _c.Call.Return(run) - return _c -} - -// WatchOwnershipTransferRequested provides a mock function with given fields: opts, sink, from, to -func (_m *CapabilitiesRegistryInterface) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, from, to) - - if len(ret) == 0 { - panic("no return value specified for WatchOwnershipTransferRequested") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, []common.Address, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, []common.Address, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, []common.Address, []common.Address) error); ok { - r1 = rf(opts, sink, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchOwnershipTransferRequested' -type CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call struct { - *mock.Call -} - -// WatchOwnershipTransferRequested is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested -// - from []common.Address -// - to []common.Address -func (_e *CapabilitiesRegistryInterface_Expecter) WatchOwnershipTransferRequested(opts interface{}, sink interface{}, from interface{}, to interface{}) *CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call { - return &CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call{Call: _e.mock.On("WatchOwnershipTransferRequested", opts, sink, from, to)} -} - -func (_c *CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, from []common.Address, to []common.Address)) *CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested), args[2].([]common.Address), args[3].([]common.Address)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferRequested, []common.Address, []common.Address) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchOwnershipTransferRequested_Call { - _c.Call.Return(run) - return _c -} - -// WatchOwnershipTransferred provides a mock function with given fields: opts, sink, from, to -func (_m *CapabilitiesRegistryInterface) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, from, to) - - if len(ret) == 0 { - panic("no return value specified for WatchOwnershipTransferred") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred, []common.Address, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred, []common.Address, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred, []common.Address, []common.Address) error); ok { - r1 = rf(opts, sink, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchOwnershipTransferred' -type CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call struct { - *mock.Call -} - -// WatchOwnershipTransferred is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred -// - from []common.Address -// - to []common.Address -func (_e *CapabilitiesRegistryInterface_Expecter) WatchOwnershipTransferred(opts interface{}, sink interface{}, from interface{}, to interface{}) *CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call { - return &CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call{Call: _e.mock.On("WatchOwnershipTransferred", opts, sink, from, to)} -} - -func (_c *CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred, from []common.Address, to []common.Address)) *CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred), args[2].([]common.Address), args[3].([]common.Address)) - }) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call) Return(_a0 event.Subscription, _a1 error) *CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *capabilities_registry.CapabilitiesRegistryOwnershipTransferred, []common.Address, []common.Address) (event.Subscription, error)) *CapabilitiesRegistryInterface_WatchOwnershipTransferred_Call { - _c.Call.Return(run) - return _c -} - -// NewCapabilitiesRegistryInterface creates a new instance of CapabilitiesRegistryInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewCapabilitiesRegistryInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CapabilitiesRegistryInterface { - mock := &CapabilitiesRegistryInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/core/gethwrappers/keystone/mocks/forwarder_interface.go b/core/gethwrappers/keystone/mocks/forwarder_interface.go deleted file mode 100644 index 3392ebc14b0..00000000000 --- a/core/gethwrappers/keystone/mocks/forwarder_interface.go +++ /dev/null @@ -1,2056 +0,0 @@ -// Code generated by mockery v2.45.0. DO NOT EDIT. - -package mock_contracts - -import ( - bind "github.com/ethereum/go-ethereum/accounts/abi/bind" - common "github.com/ethereum/go-ethereum/common" - - event "github.com/ethereum/go-ethereum/event" - - forwarder "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder" - - generated "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" - - mock "github.com/stretchr/testify/mock" - - types "github.com/ethereum/go-ethereum/core/types" -) - -// KeystoneForwarderInterface is an autogenerated mock type for the KeystoneForwarderInterface type -type KeystoneForwarderInterface struct { - mock.Mock -} - -type KeystoneForwarderInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *KeystoneForwarderInterface) EXPECT() *KeystoneForwarderInterface_Expecter { - return &KeystoneForwarderInterface_Expecter{mock: &_m.Mock} -} - -// AcceptOwnership provides a mock function with given fields: opts -func (_m *KeystoneForwarderInterface) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for AcceptOwnership") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts) (*types.Transaction, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts) *types.Transaction); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_AcceptOwnership_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AcceptOwnership' -type KeystoneForwarderInterface_AcceptOwnership_Call struct { - *mock.Call -} - -// AcceptOwnership is a helper method to define mock.On call -// - opts *bind.TransactOpts -func (_e *KeystoneForwarderInterface_Expecter) AcceptOwnership(opts interface{}) *KeystoneForwarderInterface_AcceptOwnership_Call { - return &KeystoneForwarderInterface_AcceptOwnership_Call{Call: _e.mock.On("AcceptOwnership", opts)} -} - -func (_c *KeystoneForwarderInterface_AcceptOwnership_Call) Run(run func(opts *bind.TransactOpts)) *KeystoneForwarderInterface_AcceptOwnership_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_AcceptOwnership_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_AcceptOwnership_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_AcceptOwnership_Call) RunAndReturn(run func(*bind.TransactOpts) (*types.Transaction, error)) *KeystoneForwarderInterface_AcceptOwnership_Call { - _c.Call.Return(run) - return _c -} - -// AddForwarder provides a mock function with given fields: opts, _a1 -func (_m *KeystoneForwarderInterface) AddForwarder(opts *bind.TransactOpts, _a1 common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, _a1) - - if len(ret) == 0 { - panic("no return value specified for AddForwarder") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { - return rf(opts, _a1) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { - r0 = rf(opts, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { - r1 = rf(opts, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_AddForwarder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddForwarder' -type KeystoneForwarderInterface_AddForwarder_Call struct { - *mock.Call -} - -// AddForwarder is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - _a1 common.Address -func (_e *KeystoneForwarderInterface_Expecter) AddForwarder(opts interface{}, _a1 interface{}) *KeystoneForwarderInterface_AddForwarder_Call { - return &KeystoneForwarderInterface_AddForwarder_Call{Call: _e.mock.On("AddForwarder", opts, _a1)} -} - -func (_c *KeystoneForwarderInterface_AddForwarder_Call) Run(run func(opts *bind.TransactOpts, _a1 common.Address)) *KeystoneForwarderInterface_AddForwarder_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].(common.Address)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_AddForwarder_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_AddForwarder_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_AddForwarder_Call) RunAndReturn(run func(*bind.TransactOpts, common.Address) (*types.Transaction, error)) *KeystoneForwarderInterface_AddForwarder_Call { - _c.Call.Return(run) - return _c -} - -// Address provides a mock function with given fields: -func (_m *KeystoneForwarderInterface) Address() common.Address { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Address") - } - - var r0 common.Address - if rf, ok := ret.Get(0).(func() common.Address); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - return r0 -} - -// KeystoneForwarderInterface_Address_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Address' -type KeystoneForwarderInterface_Address_Call struct { - *mock.Call -} - -// Address is a helper method to define mock.On call -func (_e *KeystoneForwarderInterface_Expecter) Address() *KeystoneForwarderInterface_Address_Call { - return &KeystoneForwarderInterface_Address_Call{Call: _e.mock.On("Address")} -} - -func (_c *KeystoneForwarderInterface_Address_Call) Run(run func()) *KeystoneForwarderInterface_Address_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *KeystoneForwarderInterface_Address_Call) Return(_a0 common.Address) *KeystoneForwarderInterface_Address_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *KeystoneForwarderInterface_Address_Call) RunAndReturn(run func() common.Address) *KeystoneForwarderInterface_Address_Call { - _c.Call.Return(run) - return _c -} - -// ClearConfig provides a mock function with given fields: opts, donId, configVersion -func (_m *KeystoneForwarderInterface) ClearConfig(opts *bind.TransactOpts, donId uint32, configVersion uint32) (*types.Transaction, error) { - ret := _m.Called(opts, donId, configVersion) - - if len(ret) == 0 { - panic("no return value specified for ClearConfig") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, uint32, uint32) (*types.Transaction, error)); ok { - return rf(opts, donId, configVersion) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, uint32, uint32) *types.Transaction); ok { - r0 = rf(opts, donId, configVersion) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, uint32, uint32) error); ok { - r1 = rf(opts, donId, configVersion) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_ClearConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClearConfig' -type KeystoneForwarderInterface_ClearConfig_Call struct { - *mock.Call -} - -// ClearConfig is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - donId uint32 -// - configVersion uint32 -func (_e *KeystoneForwarderInterface_Expecter) ClearConfig(opts interface{}, donId interface{}, configVersion interface{}) *KeystoneForwarderInterface_ClearConfig_Call { - return &KeystoneForwarderInterface_ClearConfig_Call{Call: _e.mock.On("ClearConfig", opts, donId, configVersion)} -} - -func (_c *KeystoneForwarderInterface_ClearConfig_Call) Run(run func(opts *bind.TransactOpts, donId uint32, configVersion uint32)) *KeystoneForwarderInterface_ClearConfig_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].(uint32), args[2].(uint32)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_ClearConfig_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_ClearConfig_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_ClearConfig_Call) RunAndReturn(run func(*bind.TransactOpts, uint32, uint32) (*types.Transaction, error)) *KeystoneForwarderInterface_ClearConfig_Call { - _c.Call.Return(run) - return _c -} - -// FilterConfigSet provides a mock function with given fields: opts, donId, configVersion -func (_m *KeystoneForwarderInterface) FilterConfigSet(opts *bind.FilterOpts, donId []uint32, configVersion []uint32) (*forwarder.KeystoneForwarderConfigSetIterator, error) { - ret := _m.Called(opts, donId, configVersion) - - if len(ret) == 0 { - panic("no return value specified for FilterConfigSet") - } - - var r0 *forwarder.KeystoneForwarderConfigSetIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32, []uint32) (*forwarder.KeystoneForwarderConfigSetIterator, error)); ok { - return rf(opts, donId, configVersion) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint32, []uint32) *forwarder.KeystoneForwarderConfigSetIterator); ok { - r0 = rf(opts, donId, configVersion) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*forwarder.KeystoneForwarderConfigSetIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint32, []uint32) error); ok { - r1 = rf(opts, donId, configVersion) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_FilterConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterConfigSet' -type KeystoneForwarderInterface_FilterConfigSet_Call struct { - *mock.Call -} - -// FilterConfigSet is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - donId []uint32 -// - configVersion []uint32 -func (_e *KeystoneForwarderInterface_Expecter) FilterConfigSet(opts interface{}, donId interface{}, configVersion interface{}) *KeystoneForwarderInterface_FilterConfigSet_Call { - return &KeystoneForwarderInterface_FilterConfigSet_Call{Call: _e.mock.On("FilterConfigSet", opts, donId, configVersion)} -} - -func (_c *KeystoneForwarderInterface_FilterConfigSet_Call) Run(run func(opts *bind.FilterOpts, donId []uint32, configVersion []uint32)) *KeystoneForwarderInterface_FilterConfigSet_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]uint32), args[2].([]uint32)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_FilterConfigSet_Call) Return(_a0 *forwarder.KeystoneForwarderConfigSetIterator, _a1 error) *KeystoneForwarderInterface_FilterConfigSet_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_FilterConfigSet_Call) RunAndReturn(run func(*bind.FilterOpts, []uint32, []uint32) (*forwarder.KeystoneForwarderConfigSetIterator, error)) *KeystoneForwarderInterface_FilterConfigSet_Call { - _c.Call.Return(run) - return _c -} - -// FilterForwarderAdded provides a mock function with given fields: opts, _a1 -func (_m *KeystoneForwarderInterface) FilterForwarderAdded(opts *bind.FilterOpts, _a1 []common.Address) (*forwarder.KeystoneForwarderForwarderAddedIterator, error) { - ret := _m.Called(opts, _a1) - - if len(ret) == 0 { - panic("no return value specified for FilterForwarderAdded") - } - - var r0 *forwarder.KeystoneForwarderForwarderAddedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address) (*forwarder.KeystoneForwarderForwarderAddedIterator, error)); ok { - return rf(opts, _a1) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address) *forwarder.KeystoneForwarderForwarderAddedIterator); ok { - r0 = rf(opts, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*forwarder.KeystoneForwarderForwarderAddedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address) error); ok { - r1 = rf(opts, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_FilterForwarderAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterForwarderAdded' -type KeystoneForwarderInterface_FilterForwarderAdded_Call struct { - *mock.Call -} - -// FilterForwarderAdded is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - _a1 []common.Address -func (_e *KeystoneForwarderInterface_Expecter) FilterForwarderAdded(opts interface{}, _a1 interface{}) *KeystoneForwarderInterface_FilterForwarderAdded_Call { - return &KeystoneForwarderInterface_FilterForwarderAdded_Call{Call: _e.mock.On("FilterForwarderAdded", opts, _a1)} -} - -func (_c *KeystoneForwarderInterface_FilterForwarderAdded_Call) Run(run func(opts *bind.FilterOpts, _a1 []common.Address)) *KeystoneForwarderInterface_FilterForwarderAdded_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]common.Address)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_FilterForwarderAdded_Call) Return(_a0 *forwarder.KeystoneForwarderForwarderAddedIterator, _a1 error) *KeystoneForwarderInterface_FilterForwarderAdded_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_FilterForwarderAdded_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address) (*forwarder.KeystoneForwarderForwarderAddedIterator, error)) *KeystoneForwarderInterface_FilterForwarderAdded_Call { - _c.Call.Return(run) - return _c -} - -// FilterForwarderRemoved provides a mock function with given fields: opts, _a1 -func (_m *KeystoneForwarderInterface) FilterForwarderRemoved(opts *bind.FilterOpts, _a1 []common.Address) (*forwarder.KeystoneForwarderForwarderRemovedIterator, error) { - ret := _m.Called(opts, _a1) - - if len(ret) == 0 { - panic("no return value specified for FilterForwarderRemoved") - } - - var r0 *forwarder.KeystoneForwarderForwarderRemovedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address) (*forwarder.KeystoneForwarderForwarderRemovedIterator, error)); ok { - return rf(opts, _a1) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address) *forwarder.KeystoneForwarderForwarderRemovedIterator); ok { - r0 = rf(opts, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*forwarder.KeystoneForwarderForwarderRemovedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address) error); ok { - r1 = rf(opts, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_FilterForwarderRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterForwarderRemoved' -type KeystoneForwarderInterface_FilterForwarderRemoved_Call struct { - *mock.Call -} - -// FilterForwarderRemoved is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - _a1 []common.Address -func (_e *KeystoneForwarderInterface_Expecter) FilterForwarderRemoved(opts interface{}, _a1 interface{}) *KeystoneForwarderInterface_FilterForwarderRemoved_Call { - return &KeystoneForwarderInterface_FilterForwarderRemoved_Call{Call: _e.mock.On("FilterForwarderRemoved", opts, _a1)} -} - -func (_c *KeystoneForwarderInterface_FilterForwarderRemoved_Call) Run(run func(opts *bind.FilterOpts, _a1 []common.Address)) *KeystoneForwarderInterface_FilterForwarderRemoved_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]common.Address)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_FilterForwarderRemoved_Call) Return(_a0 *forwarder.KeystoneForwarderForwarderRemovedIterator, _a1 error) *KeystoneForwarderInterface_FilterForwarderRemoved_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_FilterForwarderRemoved_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address) (*forwarder.KeystoneForwarderForwarderRemovedIterator, error)) *KeystoneForwarderInterface_FilterForwarderRemoved_Call { - _c.Call.Return(run) - return _c -} - -// FilterOwnershipTransferRequested provides a mock function with given fields: opts, from, to -func (_m *KeystoneForwarderInterface) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*forwarder.KeystoneForwarderOwnershipTransferRequestedIterator, error) { - ret := _m.Called(opts, from, to) - - if len(ret) == 0 { - panic("no return value specified for FilterOwnershipTransferRequested") - } - - var r0 *forwarder.KeystoneForwarderOwnershipTransferRequestedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*forwarder.KeystoneForwarderOwnershipTransferRequestedIterator, error)); ok { - return rf(opts, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *forwarder.KeystoneForwarderOwnershipTransferRequestedIterator); ok { - r0 = rf(opts, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*forwarder.KeystoneForwarderOwnershipTransferRequestedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { - r1 = rf(opts, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterOwnershipTransferRequested' -type KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call struct { - *mock.Call -} - -// FilterOwnershipTransferRequested is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - from []common.Address -// - to []common.Address -func (_e *KeystoneForwarderInterface_Expecter) FilterOwnershipTransferRequested(opts interface{}, from interface{}, to interface{}) *KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call { - return &KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call{Call: _e.mock.On("FilterOwnershipTransferRequested", opts, from, to)} -} - -func (_c *KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call) Run(run func(opts *bind.FilterOpts, from []common.Address, to []common.Address)) *KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]common.Address), args[2].([]common.Address)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call) Return(_a0 *forwarder.KeystoneForwarderOwnershipTransferRequestedIterator, _a1 error) *KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address, []common.Address) (*forwarder.KeystoneForwarderOwnershipTransferRequestedIterator, error)) *KeystoneForwarderInterface_FilterOwnershipTransferRequested_Call { - _c.Call.Return(run) - return _c -} - -// FilterOwnershipTransferred provides a mock function with given fields: opts, from, to -func (_m *KeystoneForwarderInterface) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*forwarder.KeystoneForwarderOwnershipTransferredIterator, error) { - ret := _m.Called(opts, from, to) - - if len(ret) == 0 { - panic("no return value specified for FilterOwnershipTransferred") - } - - var r0 *forwarder.KeystoneForwarderOwnershipTransferredIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*forwarder.KeystoneForwarderOwnershipTransferredIterator, error)); ok { - return rf(opts, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *forwarder.KeystoneForwarderOwnershipTransferredIterator); ok { - r0 = rf(opts, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*forwarder.KeystoneForwarderOwnershipTransferredIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { - r1 = rf(opts, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_FilterOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterOwnershipTransferred' -type KeystoneForwarderInterface_FilterOwnershipTransferred_Call struct { - *mock.Call -} - -// FilterOwnershipTransferred is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - from []common.Address -// - to []common.Address -func (_e *KeystoneForwarderInterface_Expecter) FilterOwnershipTransferred(opts interface{}, from interface{}, to interface{}) *KeystoneForwarderInterface_FilterOwnershipTransferred_Call { - return &KeystoneForwarderInterface_FilterOwnershipTransferred_Call{Call: _e.mock.On("FilterOwnershipTransferred", opts, from, to)} -} - -func (_c *KeystoneForwarderInterface_FilterOwnershipTransferred_Call) Run(run func(opts *bind.FilterOpts, from []common.Address, to []common.Address)) *KeystoneForwarderInterface_FilterOwnershipTransferred_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]common.Address), args[2].([]common.Address)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_FilterOwnershipTransferred_Call) Return(_a0 *forwarder.KeystoneForwarderOwnershipTransferredIterator, _a1 error) *KeystoneForwarderInterface_FilterOwnershipTransferred_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_FilterOwnershipTransferred_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address, []common.Address) (*forwarder.KeystoneForwarderOwnershipTransferredIterator, error)) *KeystoneForwarderInterface_FilterOwnershipTransferred_Call { - _c.Call.Return(run) - return _c -} - -// FilterReportProcessed provides a mock function with given fields: opts, receiver, workflowExecutionId, reportId -func (_m *KeystoneForwarderInterface) FilterReportProcessed(opts *bind.FilterOpts, receiver []common.Address, workflowExecutionId [][32]byte, reportId [][2]byte) (*forwarder.KeystoneForwarderReportProcessedIterator, error) { - ret := _m.Called(opts, receiver, workflowExecutionId, reportId) - - if len(ret) == 0 { - panic("no return value specified for FilterReportProcessed") - } - - var r0 *forwarder.KeystoneForwarderReportProcessedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, [][32]byte, [][2]byte) (*forwarder.KeystoneForwarderReportProcessedIterator, error)); ok { - return rf(opts, receiver, workflowExecutionId, reportId) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, [][32]byte, [][2]byte) *forwarder.KeystoneForwarderReportProcessedIterator); ok { - r0 = rf(opts, receiver, workflowExecutionId, reportId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*forwarder.KeystoneForwarderReportProcessedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, [][32]byte, [][2]byte) error); ok { - r1 = rf(opts, receiver, workflowExecutionId, reportId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_FilterReportProcessed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterReportProcessed' -type KeystoneForwarderInterface_FilterReportProcessed_Call struct { - *mock.Call -} - -// FilterReportProcessed is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - receiver []common.Address -// - workflowExecutionId [][32]byte -// - reportId [][2]byte -func (_e *KeystoneForwarderInterface_Expecter) FilterReportProcessed(opts interface{}, receiver interface{}, workflowExecutionId interface{}, reportId interface{}) *KeystoneForwarderInterface_FilterReportProcessed_Call { - return &KeystoneForwarderInterface_FilterReportProcessed_Call{Call: _e.mock.On("FilterReportProcessed", opts, receiver, workflowExecutionId, reportId)} -} - -func (_c *KeystoneForwarderInterface_FilterReportProcessed_Call) Run(run func(opts *bind.FilterOpts, receiver []common.Address, workflowExecutionId [][32]byte, reportId [][2]byte)) *KeystoneForwarderInterface_FilterReportProcessed_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]common.Address), args[2].([][32]byte), args[3].([][2]byte)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_FilterReportProcessed_Call) Return(_a0 *forwarder.KeystoneForwarderReportProcessedIterator, _a1 error) *KeystoneForwarderInterface_FilterReportProcessed_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_FilterReportProcessed_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address, [][32]byte, [][2]byte) (*forwarder.KeystoneForwarderReportProcessedIterator, error)) *KeystoneForwarderInterface_FilterReportProcessed_Call { - _c.Call.Return(run) - return _c -} - -// GetTransmissionId provides a mock function with given fields: opts, receiver, workflowExecutionId, reportId -func (_m *KeystoneForwarderInterface) GetTransmissionId(opts *bind.CallOpts, receiver common.Address, workflowExecutionId [32]byte, reportId [2]byte) ([32]byte, error) { - ret := _m.Called(opts, receiver, workflowExecutionId, reportId) - - if len(ret) == 0 { - panic("no return value specified for GetTransmissionId") - } - - var r0 [32]byte - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) ([32]byte, error)); ok { - return rf(opts, receiver, workflowExecutionId, reportId) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) [32]byte); ok { - r0 = rf(opts, receiver, workflowExecutionId, reportId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([32]byte) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) error); ok { - r1 = rf(opts, receiver, workflowExecutionId, reportId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_GetTransmissionId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTransmissionId' -type KeystoneForwarderInterface_GetTransmissionId_Call struct { - *mock.Call -} - -// GetTransmissionId is a helper method to define mock.On call -// - opts *bind.CallOpts -// - receiver common.Address -// - workflowExecutionId [32]byte -// - reportId [2]byte -func (_e *KeystoneForwarderInterface_Expecter) GetTransmissionId(opts interface{}, receiver interface{}, workflowExecutionId interface{}, reportId interface{}) *KeystoneForwarderInterface_GetTransmissionId_Call { - return &KeystoneForwarderInterface_GetTransmissionId_Call{Call: _e.mock.On("GetTransmissionId", opts, receiver, workflowExecutionId, reportId)} -} - -func (_c *KeystoneForwarderInterface_GetTransmissionId_Call) Run(run func(opts *bind.CallOpts, receiver common.Address, workflowExecutionId [32]byte, reportId [2]byte)) *KeystoneForwarderInterface_GetTransmissionId_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts), args[1].(common.Address), args[2].([32]byte), args[3].([2]byte)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_GetTransmissionId_Call) Return(_a0 [32]byte, _a1 error) *KeystoneForwarderInterface_GetTransmissionId_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_GetTransmissionId_Call) RunAndReturn(run func(*bind.CallOpts, common.Address, [32]byte, [2]byte) ([32]byte, error)) *KeystoneForwarderInterface_GetTransmissionId_Call { - _c.Call.Return(run) - return _c -} - -// GetTransmissionInfo provides a mock function with given fields: opts, receiver, workflowExecutionId, reportId -func (_m *KeystoneForwarderInterface) GetTransmissionInfo(opts *bind.CallOpts, receiver common.Address, workflowExecutionId [32]byte, reportId [2]byte) (forwarder.IRouterTransmissionInfo, error) { - ret := _m.Called(opts, receiver, workflowExecutionId, reportId) - - if len(ret) == 0 { - panic("no return value specified for GetTransmissionInfo") - } - - var r0 forwarder.IRouterTransmissionInfo - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) (forwarder.IRouterTransmissionInfo, error)); ok { - return rf(opts, receiver, workflowExecutionId, reportId) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) forwarder.IRouterTransmissionInfo); ok { - r0 = rf(opts, receiver, workflowExecutionId, reportId) - } else { - r0 = ret.Get(0).(forwarder.IRouterTransmissionInfo) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) error); ok { - r1 = rf(opts, receiver, workflowExecutionId, reportId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_GetTransmissionInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTransmissionInfo' -type KeystoneForwarderInterface_GetTransmissionInfo_Call struct { - *mock.Call -} - -// GetTransmissionInfo is a helper method to define mock.On call -// - opts *bind.CallOpts -// - receiver common.Address -// - workflowExecutionId [32]byte -// - reportId [2]byte -func (_e *KeystoneForwarderInterface_Expecter) GetTransmissionInfo(opts interface{}, receiver interface{}, workflowExecutionId interface{}, reportId interface{}) *KeystoneForwarderInterface_GetTransmissionInfo_Call { - return &KeystoneForwarderInterface_GetTransmissionInfo_Call{Call: _e.mock.On("GetTransmissionInfo", opts, receiver, workflowExecutionId, reportId)} -} - -func (_c *KeystoneForwarderInterface_GetTransmissionInfo_Call) Run(run func(opts *bind.CallOpts, receiver common.Address, workflowExecutionId [32]byte, reportId [2]byte)) *KeystoneForwarderInterface_GetTransmissionInfo_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts), args[1].(common.Address), args[2].([32]byte), args[3].([2]byte)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_GetTransmissionInfo_Call) Return(_a0 forwarder.IRouterTransmissionInfo, _a1 error) *KeystoneForwarderInterface_GetTransmissionInfo_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_GetTransmissionInfo_Call) RunAndReturn(run func(*bind.CallOpts, common.Address, [32]byte, [2]byte) (forwarder.IRouterTransmissionInfo, error)) *KeystoneForwarderInterface_GetTransmissionInfo_Call { - _c.Call.Return(run) - return _c -} - -// GetTransmitter provides a mock function with given fields: opts, receiver, workflowExecutionId, reportId -func (_m *KeystoneForwarderInterface) GetTransmitter(opts *bind.CallOpts, receiver common.Address, workflowExecutionId [32]byte, reportId [2]byte) (common.Address, error) { - ret := _m.Called(opts, receiver, workflowExecutionId, reportId) - - if len(ret) == 0 { - panic("no return value specified for GetTransmitter") - } - - var r0 common.Address - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) (common.Address, error)); ok { - return rf(opts, receiver, workflowExecutionId, reportId) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) common.Address); ok { - r0 = rf(opts, receiver, workflowExecutionId, reportId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, common.Address, [32]byte, [2]byte) error); ok { - r1 = rf(opts, receiver, workflowExecutionId, reportId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_GetTransmitter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTransmitter' -type KeystoneForwarderInterface_GetTransmitter_Call struct { - *mock.Call -} - -// GetTransmitter is a helper method to define mock.On call -// - opts *bind.CallOpts -// - receiver common.Address -// - workflowExecutionId [32]byte -// - reportId [2]byte -func (_e *KeystoneForwarderInterface_Expecter) GetTransmitter(opts interface{}, receiver interface{}, workflowExecutionId interface{}, reportId interface{}) *KeystoneForwarderInterface_GetTransmitter_Call { - return &KeystoneForwarderInterface_GetTransmitter_Call{Call: _e.mock.On("GetTransmitter", opts, receiver, workflowExecutionId, reportId)} -} - -func (_c *KeystoneForwarderInterface_GetTransmitter_Call) Run(run func(opts *bind.CallOpts, receiver common.Address, workflowExecutionId [32]byte, reportId [2]byte)) *KeystoneForwarderInterface_GetTransmitter_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts), args[1].(common.Address), args[2].([32]byte), args[3].([2]byte)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_GetTransmitter_Call) Return(_a0 common.Address, _a1 error) *KeystoneForwarderInterface_GetTransmitter_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_GetTransmitter_Call) RunAndReturn(run func(*bind.CallOpts, common.Address, [32]byte, [2]byte) (common.Address, error)) *KeystoneForwarderInterface_GetTransmitter_Call { - _c.Call.Return(run) - return _c -} - -// IsForwarder provides a mock function with given fields: opts, _a1 -func (_m *KeystoneForwarderInterface) IsForwarder(opts *bind.CallOpts, _a1 common.Address) (bool, error) { - ret := _m.Called(opts, _a1) - - if len(ret) == 0 { - panic("no return value specified for IsForwarder") - } - - var r0 bool - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address) (bool, error)); ok { - return rf(opts, _a1) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address) bool); ok { - r0 = rf(opts, _a1) - } else { - r0 = ret.Get(0).(bool) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, common.Address) error); ok { - r1 = rf(opts, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_IsForwarder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsForwarder' -type KeystoneForwarderInterface_IsForwarder_Call struct { - *mock.Call -} - -// IsForwarder is a helper method to define mock.On call -// - opts *bind.CallOpts -// - _a1 common.Address -func (_e *KeystoneForwarderInterface_Expecter) IsForwarder(opts interface{}, _a1 interface{}) *KeystoneForwarderInterface_IsForwarder_Call { - return &KeystoneForwarderInterface_IsForwarder_Call{Call: _e.mock.On("IsForwarder", opts, _a1)} -} - -func (_c *KeystoneForwarderInterface_IsForwarder_Call) Run(run func(opts *bind.CallOpts, _a1 common.Address)) *KeystoneForwarderInterface_IsForwarder_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts), args[1].(common.Address)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_IsForwarder_Call) Return(_a0 bool, _a1 error) *KeystoneForwarderInterface_IsForwarder_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_IsForwarder_Call) RunAndReturn(run func(*bind.CallOpts, common.Address) (bool, error)) *KeystoneForwarderInterface_IsForwarder_Call { - _c.Call.Return(run) - return _c -} - -// Owner provides a mock function with given fields: opts -func (_m *KeystoneForwarderInterface) Owner(opts *bind.CallOpts) (common.Address, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for Owner") - } - - var r0 common.Address - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (common.Address, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) common.Address); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_Owner_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Owner' -type KeystoneForwarderInterface_Owner_Call struct { - *mock.Call -} - -// Owner is a helper method to define mock.On call -// - opts *bind.CallOpts -func (_e *KeystoneForwarderInterface_Expecter) Owner(opts interface{}) *KeystoneForwarderInterface_Owner_Call { - return &KeystoneForwarderInterface_Owner_Call{Call: _e.mock.On("Owner", opts)} -} - -func (_c *KeystoneForwarderInterface_Owner_Call) Run(run func(opts *bind.CallOpts)) *KeystoneForwarderInterface_Owner_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_Owner_Call) Return(_a0 common.Address, _a1 error) *KeystoneForwarderInterface_Owner_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_Owner_Call) RunAndReturn(run func(*bind.CallOpts) (common.Address, error)) *KeystoneForwarderInterface_Owner_Call { - _c.Call.Return(run) - return _c -} - -// ParseConfigSet provides a mock function with given fields: log -func (_m *KeystoneForwarderInterface) ParseConfigSet(log types.Log) (*forwarder.KeystoneForwarderConfigSet, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseConfigSet") - } - - var r0 *forwarder.KeystoneForwarderConfigSet - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*forwarder.KeystoneForwarderConfigSet, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *forwarder.KeystoneForwarderConfigSet); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*forwarder.KeystoneForwarderConfigSet) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_ParseConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseConfigSet' -type KeystoneForwarderInterface_ParseConfigSet_Call struct { - *mock.Call -} - -// ParseConfigSet is a helper method to define mock.On call -// - log types.Log -func (_e *KeystoneForwarderInterface_Expecter) ParseConfigSet(log interface{}) *KeystoneForwarderInterface_ParseConfigSet_Call { - return &KeystoneForwarderInterface_ParseConfigSet_Call{Call: _e.mock.On("ParseConfigSet", log)} -} - -func (_c *KeystoneForwarderInterface_ParseConfigSet_Call) Run(run func(log types.Log)) *KeystoneForwarderInterface_ParseConfigSet_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_ParseConfigSet_Call) Return(_a0 *forwarder.KeystoneForwarderConfigSet, _a1 error) *KeystoneForwarderInterface_ParseConfigSet_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_ParseConfigSet_Call) RunAndReturn(run func(types.Log) (*forwarder.KeystoneForwarderConfigSet, error)) *KeystoneForwarderInterface_ParseConfigSet_Call { - _c.Call.Return(run) - return _c -} - -// ParseForwarderAdded provides a mock function with given fields: log -func (_m *KeystoneForwarderInterface) ParseForwarderAdded(log types.Log) (*forwarder.KeystoneForwarderForwarderAdded, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseForwarderAdded") - } - - var r0 *forwarder.KeystoneForwarderForwarderAdded - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*forwarder.KeystoneForwarderForwarderAdded, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *forwarder.KeystoneForwarderForwarderAdded); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*forwarder.KeystoneForwarderForwarderAdded) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_ParseForwarderAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseForwarderAdded' -type KeystoneForwarderInterface_ParseForwarderAdded_Call struct { - *mock.Call -} - -// ParseForwarderAdded is a helper method to define mock.On call -// - log types.Log -func (_e *KeystoneForwarderInterface_Expecter) ParseForwarderAdded(log interface{}) *KeystoneForwarderInterface_ParseForwarderAdded_Call { - return &KeystoneForwarderInterface_ParseForwarderAdded_Call{Call: _e.mock.On("ParseForwarderAdded", log)} -} - -func (_c *KeystoneForwarderInterface_ParseForwarderAdded_Call) Run(run func(log types.Log)) *KeystoneForwarderInterface_ParseForwarderAdded_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_ParseForwarderAdded_Call) Return(_a0 *forwarder.KeystoneForwarderForwarderAdded, _a1 error) *KeystoneForwarderInterface_ParseForwarderAdded_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_ParseForwarderAdded_Call) RunAndReturn(run func(types.Log) (*forwarder.KeystoneForwarderForwarderAdded, error)) *KeystoneForwarderInterface_ParseForwarderAdded_Call { - _c.Call.Return(run) - return _c -} - -// ParseForwarderRemoved provides a mock function with given fields: log -func (_m *KeystoneForwarderInterface) ParseForwarderRemoved(log types.Log) (*forwarder.KeystoneForwarderForwarderRemoved, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseForwarderRemoved") - } - - var r0 *forwarder.KeystoneForwarderForwarderRemoved - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*forwarder.KeystoneForwarderForwarderRemoved, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *forwarder.KeystoneForwarderForwarderRemoved); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*forwarder.KeystoneForwarderForwarderRemoved) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_ParseForwarderRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseForwarderRemoved' -type KeystoneForwarderInterface_ParseForwarderRemoved_Call struct { - *mock.Call -} - -// ParseForwarderRemoved is a helper method to define mock.On call -// - log types.Log -func (_e *KeystoneForwarderInterface_Expecter) ParseForwarderRemoved(log interface{}) *KeystoneForwarderInterface_ParseForwarderRemoved_Call { - return &KeystoneForwarderInterface_ParseForwarderRemoved_Call{Call: _e.mock.On("ParseForwarderRemoved", log)} -} - -func (_c *KeystoneForwarderInterface_ParseForwarderRemoved_Call) Run(run func(log types.Log)) *KeystoneForwarderInterface_ParseForwarderRemoved_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_ParseForwarderRemoved_Call) Return(_a0 *forwarder.KeystoneForwarderForwarderRemoved, _a1 error) *KeystoneForwarderInterface_ParseForwarderRemoved_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_ParseForwarderRemoved_Call) RunAndReturn(run func(types.Log) (*forwarder.KeystoneForwarderForwarderRemoved, error)) *KeystoneForwarderInterface_ParseForwarderRemoved_Call { - _c.Call.Return(run) - return _c -} - -// ParseLog provides a mock function with given fields: log -func (_m *KeystoneForwarderInterface) ParseLog(log types.Log) (generated.AbigenLog, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseLog") - } - - var r0 generated.AbigenLog - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (generated.AbigenLog, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) generated.AbigenLog); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(generated.AbigenLog) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_ParseLog_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseLog' -type KeystoneForwarderInterface_ParseLog_Call struct { - *mock.Call -} - -// ParseLog is a helper method to define mock.On call -// - log types.Log -func (_e *KeystoneForwarderInterface_Expecter) ParseLog(log interface{}) *KeystoneForwarderInterface_ParseLog_Call { - return &KeystoneForwarderInterface_ParseLog_Call{Call: _e.mock.On("ParseLog", log)} -} - -func (_c *KeystoneForwarderInterface_ParseLog_Call) Run(run func(log types.Log)) *KeystoneForwarderInterface_ParseLog_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_ParseLog_Call) Return(_a0 generated.AbigenLog, _a1 error) *KeystoneForwarderInterface_ParseLog_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_ParseLog_Call) RunAndReturn(run func(types.Log) (generated.AbigenLog, error)) *KeystoneForwarderInterface_ParseLog_Call { - _c.Call.Return(run) - return _c -} - -// ParseOwnershipTransferRequested provides a mock function with given fields: log -func (_m *KeystoneForwarderInterface) ParseOwnershipTransferRequested(log types.Log) (*forwarder.KeystoneForwarderOwnershipTransferRequested, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseOwnershipTransferRequested") - } - - var r0 *forwarder.KeystoneForwarderOwnershipTransferRequested - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*forwarder.KeystoneForwarderOwnershipTransferRequested, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *forwarder.KeystoneForwarderOwnershipTransferRequested); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*forwarder.KeystoneForwarderOwnershipTransferRequested) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseOwnershipTransferRequested' -type KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call struct { - *mock.Call -} - -// ParseOwnershipTransferRequested is a helper method to define mock.On call -// - log types.Log -func (_e *KeystoneForwarderInterface_Expecter) ParseOwnershipTransferRequested(log interface{}) *KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call { - return &KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call{Call: _e.mock.On("ParseOwnershipTransferRequested", log)} -} - -func (_c *KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call) Run(run func(log types.Log)) *KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call) Return(_a0 *forwarder.KeystoneForwarderOwnershipTransferRequested, _a1 error) *KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call) RunAndReturn(run func(types.Log) (*forwarder.KeystoneForwarderOwnershipTransferRequested, error)) *KeystoneForwarderInterface_ParseOwnershipTransferRequested_Call { - _c.Call.Return(run) - return _c -} - -// ParseOwnershipTransferred provides a mock function with given fields: log -func (_m *KeystoneForwarderInterface) ParseOwnershipTransferred(log types.Log) (*forwarder.KeystoneForwarderOwnershipTransferred, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseOwnershipTransferred") - } - - var r0 *forwarder.KeystoneForwarderOwnershipTransferred - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*forwarder.KeystoneForwarderOwnershipTransferred, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *forwarder.KeystoneForwarderOwnershipTransferred); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*forwarder.KeystoneForwarderOwnershipTransferred) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_ParseOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseOwnershipTransferred' -type KeystoneForwarderInterface_ParseOwnershipTransferred_Call struct { - *mock.Call -} - -// ParseOwnershipTransferred is a helper method to define mock.On call -// - log types.Log -func (_e *KeystoneForwarderInterface_Expecter) ParseOwnershipTransferred(log interface{}) *KeystoneForwarderInterface_ParseOwnershipTransferred_Call { - return &KeystoneForwarderInterface_ParseOwnershipTransferred_Call{Call: _e.mock.On("ParseOwnershipTransferred", log)} -} - -func (_c *KeystoneForwarderInterface_ParseOwnershipTransferred_Call) Run(run func(log types.Log)) *KeystoneForwarderInterface_ParseOwnershipTransferred_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_ParseOwnershipTransferred_Call) Return(_a0 *forwarder.KeystoneForwarderOwnershipTransferred, _a1 error) *KeystoneForwarderInterface_ParseOwnershipTransferred_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_ParseOwnershipTransferred_Call) RunAndReturn(run func(types.Log) (*forwarder.KeystoneForwarderOwnershipTransferred, error)) *KeystoneForwarderInterface_ParseOwnershipTransferred_Call { - _c.Call.Return(run) - return _c -} - -// ParseReportProcessed provides a mock function with given fields: log -func (_m *KeystoneForwarderInterface) ParseReportProcessed(log types.Log) (*forwarder.KeystoneForwarderReportProcessed, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseReportProcessed") - } - - var r0 *forwarder.KeystoneForwarderReportProcessed - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*forwarder.KeystoneForwarderReportProcessed, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *forwarder.KeystoneForwarderReportProcessed); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*forwarder.KeystoneForwarderReportProcessed) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_ParseReportProcessed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseReportProcessed' -type KeystoneForwarderInterface_ParseReportProcessed_Call struct { - *mock.Call -} - -// ParseReportProcessed is a helper method to define mock.On call -// - log types.Log -func (_e *KeystoneForwarderInterface_Expecter) ParseReportProcessed(log interface{}) *KeystoneForwarderInterface_ParseReportProcessed_Call { - return &KeystoneForwarderInterface_ParseReportProcessed_Call{Call: _e.mock.On("ParseReportProcessed", log)} -} - -func (_c *KeystoneForwarderInterface_ParseReportProcessed_Call) Run(run func(log types.Log)) *KeystoneForwarderInterface_ParseReportProcessed_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_ParseReportProcessed_Call) Return(_a0 *forwarder.KeystoneForwarderReportProcessed, _a1 error) *KeystoneForwarderInterface_ParseReportProcessed_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_ParseReportProcessed_Call) RunAndReturn(run func(types.Log) (*forwarder.KeystoneForwarderReportProcessed, error)) *KeystoneForwarderInterface_ParseReportProcessed_Call { - _c.Call.Return(run) - return _c -} - -// RemoveForwarder provides a mock function with given fields: opts, _a1 -func (_m *KeystoneForwarderInterface) RemoveForwarder(opts *bind.TransactOpts, _a1 common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, _a1) - - if len(ret) == 0 { - panic("no return value specified for RemoveForwarder") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { - return rf(opts, _a1) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { - r0 = rf(opts, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { - r1 = rf(opts, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_RemoveForwarder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveForwarder' -type KeystoneForwarderInterface_RemoveForwarder_Call struct { - *mock.Call -} - -// RemoveForwarder is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - _a1 common.Address -func (_e *KeystoneForwarderInterface_Expecter) RemoveForwarder(opts interface{}, _a1 interface{}) *KeystoneForwarderInterface_RemoveForwarder_Call { - return &KeystoneForwarderInterface_RemoveForwarder_Call{Call: _e.mock.On("RemoveForwarder", opts, _a1)} -} - -func (_c *KeystoneForwarderInterface_RemoveForwarder_Call) Run(run func(opts *bind.TransactOpts, _a1 common.Address)) *KeystoneForwarderInterface_RemoveForwarder_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].(common.Address)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_RemoveForwarder_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_RemoveForwarder_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_RemoveForwarder_Call) RunAndReturn(run func(*bind.TransactOpts, common.Address) (*types.Transaction, error)) *KeystoneForwarderInterface_RemoveForwarder_Call { - _c.Call.Return(run) - return _c -} - -// Report provides a mock function with given fields: opts, receiver, rawReport, reportContext, signatures -func (_m *KeystoneForwarderInterface) Report(opts *bind.TransactOpts, receiver common.Address, rawReport []byte, reportContext []byte, signatures [][]byte) (*types.Transaction, error) { - ret := _m.Called(opts, receiver, rawReport, reportContext, signatures) - - if len(ret) == 0 { - panic("no return value specified for Report") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address, []byte, []byte, [][]byte) (*types.Transaction, error)); ok { - return rf(opts, receiver, rawReport, reportContext, signatures) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address, []byte, []byte, [][]byte) *types.Transaction); ok { - r0 = rf(opts, receiver, rawReport, reportContext, signatures) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address, []byte, []byte, [][]byte) error); ok { - r1 = rf(opts, receiver, rawReport, reportContext, signatures) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_Report_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Report' -type KeystoneForwarderInterface_Report_Call struct { - *mock.Call -} - -// Report is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - receiver common.Address -// - rawReport []byte -// - reportContext []byte -// - signatures [][]byte -func (_e *KeystoneForwarderInterface_Expecter) Report(opts interface{}, receiver interface{}, rawReport interface{}, reportContext interface{}, signatures interface{}) *KeystoneForwarderInterface_Report_Call { - return &KeystoneForwarderInterface_Report_Call{Call: _e.mock.On("Report", opts, receiver, rawReport, reportContext, signatures)} -} - -func (_c *KeystoneForwarderInterface_Report_Call) Run(run func(opts *bind.TransactOpts, receiver common.Address, rawReport []byte, reportContext []byte, signatures [][]byte)) *KeystoneForwarderInterface_Report_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].(common.Address), args[2].([]byte), args[3].([]byte), args[4].([][]byte)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_Report_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_Report_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_Report_Call) RunAndReturn(run func(*bind.TransactOpts, common.Address, []byte, []byte, [][]byte) (*types.Transaction, error)) *KeystoneForwarderInterface_Report_Call { - _c.Call.Return(run) - return _c -} - -// Route provides a mock function with given fields: opts, transmissionId, transmitter, receiver, metadata, validatedReport -func (_m *KeystoneForwarderInterface) Route(opts *bind.TransactOpts, transmissionId [32]byte, transmitter common.Address, receiver common.Address, metadata []byte, validatedReport []byte) (*types.Transaction, error) { - ret := _m.Called(opts, transmissionId, transmitter, receiver, metadata, validatedReport) - - if len(ret) == 0 { - panic("no return value specified for Route") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [32]byte, common.Address, common.Address, []byte, []byte) (*types.Transaction, error)); ok { - return rf(opts, transmissionId, transmitter, receiver, metadata, validatedReport) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [32]byte, common.Address, common.Address, []byte, []byte) *types.Transaction); ok { - r0 = rf(opts, transmissionId, transmitter, receiver, metadata, validatedReport) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, [32]byte, common.Address, common.Address, []byte, []byte) error); ok { - r1 = rf(opts, transmissionId, transmitter, receiver, metadata, validatedReport) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_Route_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Route' -type KeystoneForwarderInterface_Route_Call struct { - *mock.Call -} - -// Route is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - transmissionId [32]byte -// - transmitter common.Address -// - receiver common.Address -// - metadata []byte -// - validatedReport []byte -func (_e *KeystoneForwarderInterface_Expecter) Route(opts interface{}, transmissionId interface{}, transmitter interface{}, receiver interface{}, metadata interface{}, validatedReport interface{}) *KeystoneForwarderInterface_Route_Call { - return &KeystoneForwarderInterface_Route_Call{Call: _e.mock.On("Route", opts, transmissionId, transmitter, receiver, metadata, validatedReport)} -} - -func (_c *KeystoneForwarderInterface_Route_Call) Run(run func(opts *bind.TransactOpts, transmissionId [32]byte, transmitter common.Address, receiver common.Address, metadata []byte, validatedReport []byte)) *KeystoneForwarderInterface_Route_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].([32]byte), args[2].(common.Address), args[3].(common.Address), args[4].([]byte), args[5].([]byte)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_Route_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_Route_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_Route_Call) RunAndReturn(run func(*bind.TransactOpts, [32]byte, common.Address, common.Address, []byte, []byte) (*types.Transaction, error)) *KeystoneForwarderInterface_Route_Call { - _c.Call.Return(run) - return _c -} - -// SetConfig provides a mock function with given fields: opts, donId, configVersion, f, signers -func (_m *KeystoneForwarderInterface) SetConfig(opts *bind.TransactOpts, donId uint32, configVersion uint32, f uint8, signers []common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, donId, configVersion, f, signers) - - if len(ret) == 0 { - panic("no return value specified for SetConfig") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, uint32, uint32, uint8, []common.Address) (*types.Transaction, error)); ok { - return rf(opts, donId, configVersion, f, signers) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, uint32, uint32, uint8, []common.Address) *types.Transaction); ok { - r0 = rf(opts, donId, configVersion, f, signers) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, uint32, uint32, uint8, []common.Address) error); ok { - r1 = rf(opts, donId, configVersion, f, signers) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_SetConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetConfig' -type KeystoneForwarderInterface_SetConfig_Call struct { - *mock.Call -} - -// SetConfig is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - donId uint32 -// - configVersion uint32 -// - f uint8 -// - signers []common.Address -func (_e *KeystoneForwarderInterface_Expecter) SetConfig(opts interface{}, donId interface{}, configVersion interface{}, f interface{}, signers interface{}) *KeystoneForwarderInterface_SetConfig_Call { - return &KeystoneForwarderInterface_SetConfig_Call{Call: _e.mock.On("SetConfig", opts, donId, configVersion, f, signers)} -} - -func (_c *KeystoneForwarderInterface_SetConfig_Call) Run(run func(opts *bind.TransactOpts, donId uint32, configVersion uint32, f uint8, signers []common.Address)) *KeystoneForwarderInterface_SetConfig_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].(uint32), args[2].(uint32), args[3].(uint8), args[4].([]common.Address)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_SetConfig_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_SetConfig_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_SetConfig_Call) RunAndReturn(run func(*bind.TransactOpts, uint32, uint32, uint8, []common.Address) (*types.Transaction, error)) *KeystoneForwarderInterface_SetConfig_Call { - _c.Call.Return(run) - return _c -} - -// TransferOwnership provides a mock function with given fields: opts, to -func (_m *KeystoneForwarderInterface) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, to) - - if len(ret) == 0 { - panic("no return value specified for TransferOwnership") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { - return rf(opts, to) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { - r0 = rf(opts, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { - r1 = rf(opts, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_TransferOwnership_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransferOwnership' -type KeystoneForwarderInterface_TransferOwnership_Call struct { - *mock.Call -} - -// TransferOwnership is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - to common.Address -func (_e *KeystoneForwarderInterface_Expecter) TransferOwnership(opts interface{}, to interface{}) *KeystoneForwarderInterface_TransferOwnership_Call { - return &KeystoneForwarderInterface_TransferOwnership_Call{Call: _e.mock.On("TransferOwnership", opts, to)} -} - -func (_c *KeystoneForwarderInterface_TransferOwnership_Call) Run(run func(opts *bind.TransactOpts, to common.Address)) *KeystoneForwarderInterface_TransferOwnership_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].(common.Address)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_TransferOwnership_Call) Return(_a0 *types.Transaction, _a1 error) *KeystoneForwarderInterface_TransferOwnership_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_TransferOwnership_Call) RunAndReturn(run func(*bind.TransactOpts, common.Address) (*types.Transaction, error)) *KeystoneForwarderInterface_TransferOwnership_Call { - _c.Call.Return(run) - return _c -} - -// TypeAndVersion provides a mock function with given fields: opts -func (_m *KeystoneForwarderInterface) TypeAndVersion(opts *bind.CallOpts) (string, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for TypeAndVersion") - } - - var r0 string - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (string, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) string); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(string) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_TypeAndVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeAndVersion' -type KeystoneForwarderInterface_TypeAndVersion_Call struct { - *mock.Call -} - -// TypeAndVersion is a helper method to define mock.On call -// - opts *bind.CallOpts -func (_e *KeystoneForwarderInterface_Expecter) TypeAndVersion(opts interface{}) *KeystoneForwarderInterface_TypeAndVersion_Call { - return &KeystoneForwarderInterface_TypeAndVersion_Call{Call: _e.mock.On("TypeAndVersion", opts)} -} - -func (_c *KeystoneForwarderInterface_TypeAndVersion_Call) Run(run func(opts *bind.CallOpts)) *KeystoneForwarderInterface_TypeAndVersion_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_TypeAndVersion_Call) Return(_a0 string, _a1 error) *KeystoneForwarderInterface_TypeAndVersion_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_TypeAndVersion_Call) RunAndReturn(run func(*bind.CallOpts) (string, error)) *KeystoneForwarderInterface_TypeAndVersion_Call { - _c.Call.Return(run) - return _c -} - -// WatchConfigSet provides a mock function with given fields: opts, sink, donId, configVersion -func (_m *KeystoneForwarderInterface) WatchConfigSet(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderConfigSet, donId []uint32, configVersion []uint32) (event.Subscription, error) { - ret := _m.Called(opts, sink, donId, configVersion) - - if len(ret) == 0 { - panic("no return value specified for WatchConfigSet") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderConfigSet, []uint32, []uint32) (event.Subscription, error)); ok { - return rf(opts, sink, donId, configVersion) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderConfigSet, []uint32, []uint32) event.Subscription); ok { - r0 = rf(opts, sink, donId, configVersion) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderConfigSet, []uint32, []uint32) error); ok { - r1 = rf(opts, sink, donId, configVersion) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_WatchConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchConfigSet' -type KeystoneForwarderInterface_WatchConfigSet_Call struct { - *mock.Call -} - -// WatchConfigSet is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *forwarder.KeystoneForwarderConfigSet -// - donId []uint32 -// - configVersion []uint32 -func (_e *KeystoneForwarderInterface_Expecter) WatchConfigSet(opts interface{}, sink interface{}, donId interface{}, configVersion interface{}) *KeystoneForwarderInterface_WatchConfigSet_Call { - return &KeystoneForwarderInterface_WatchConfigSet_Call{Call: _e.mock.On("WatchConfigSet", opts, sink, donId, configVersion)} -} - -func (_c *KeystoneForwarderInterface_WatchConfigSet_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderConfigSet, donId []uint32, configVersion []uint32)) *KeystoneForwarderInterface_WatchConfigSet_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *forwarder.KeystoneForwarderConfigSet), args[2].([]uint32), args[3].([]uint32)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_WatchConfigSet_Call) Return(_a0 event.Subscription, _a1 error) *KeystoneForwarderInterface_WatchConfigSet_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_WatchConfigSet_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderConfigSet, []uint32, []uint32) (event.Subscription, error)) *KeystoneForwarderInterface_WatchConfigSet_Call { - _c.Call.Return(run) - return _c -} - -// WatchForwarderAdded provides a mock function with given fields: opts, sink, _a2 -func (_m *KeystoneForwarderInterface) WatchForwarderAdded(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderForwarderAdded, _a2 []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, _a2) - - if len(ret) == 0 { - panic("no return value specified for WatchForwarderAdded") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderAdded, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, _a2) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderAdded, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderAdded, []common.Address) error); ok { - r1 = rf(opts, sink, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_WatchForwarderAdded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchForwarderAdded' -type KeystoneForwarderInterface_WatchForwarderAdded_Call struct { - *mock.Call -} - -// WatchForwarderAdded is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *forwarder.KeystoneForwarderForwarderAdded -// - _a2 []common.Address -func (_e *KeystoneForwarderInterface_Expecter) WatchForwarderAdded(opts interface{}, sink interface{}, _a2 interface{}) *KeystoneForwarderInterface_WatchForwarderAdded_Call { - return &KeystoneForwarderInterface_WatchForwarderAdded_Call{Call: _e.mock.On("WatchForwarderAdded", opts, sink, _a2)} -} - -func (_c *KeystoneForwarderInterface_WatchForwarderAdded_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderForwarderAdded, _a2 []common.Address)) *KeystoneForwarderInterface_WatchForwarderAdded_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *forwarder.KeystoneForwarderForwarderAdded), args[2].([]common.Address)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_WatchForwarderAdded_Call) Return(_a0 event.Subscription, _a1 error) *KeystoneForwarderInterface_WatchForwarderAdded_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_WatchForwarderAdded_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderAdded, []common.Address) (event.Subscription, error)) *KeystoneForwarderInterface_WatchForwarderAdded_Call { - _c.Call.Return(run) - return _c -} - -// WatchForwarderRemoved provides a mock function with given fields: opts, sink, _a2 -func (_m *KeystoneForwarderInterface) WatchForwarderRemoved(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderForwarderRemoved, _a2 []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, _a2) - - if len(ret) == 0 { - panic("no return value specified for WatchForwarderRemoved") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderRemoved, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, _a2) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderRemoved, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderRemoved, []common.Address) error); ok { - r1 = rf(opts, sink, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_WatchForwarderRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchForwarderRemoved' -type KeystoneForwarderInterface_WatchForwarderRemoved_Call struct { - *mock.Call -} - -// WatchForwarderRemoved is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *forwarder.KeystoneForwarderForwarderRemoved -// - _a2 []common.Address -func (_e *KeystoneForwarderInterface_Expecter) WatchForwarderRemoved(opts interface{}, sink interface{}, _a2 interface{}) *KeystoneForwarderInterface_WatchForwarderRemoved_Call { - return &KeystoneForwarderInterface_WatchForwarderRemoved_Call{Call: _e.mock.On("WatchForwarderRemoved", opts, sink, _a2)} -} - -func (_c *KeystoneForwarderInterface_WatchForwarderRemoved_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderForwarderRemoved, _a2 []common.Address)) *KeystoneForwarderInterface_WatchForwarderRemoved_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *forwarder.KeystoneForwarderForwarderRemoved), args[2].([]common.Address)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_WatchForwarderRemoved_Call) Return(_a0 event.Subscription, _a1 error) *KeystoneForwarderInterface_WatchForwarderRemoved_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_WatchForwarderRemoved_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderForwarderRemoved, []common.Address) (event.Subscription, error)) *KeystoneForwarderInterface_WatchForwarderRemoved_Call { - _c.Call.Return(run) - return _c -} - -// WatchOwnershipTransferRequested provides a mock function with given fields: opts, sink, from, to -func (_m *KeystoneForwarderInterface) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, from, to) - - if len(ret) == 0 { - panic("no return value specified for WatchOwnershipTransferRequested") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested, []common.Address, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested, []common.Address, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested, []common.Address, []common.Address) error); ok { - r1 = rf(opts, sink, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchOwnershipTransferRequested' -type KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call struct { - *mock.Call -} - -// WatchOwnershipTransferRequested is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested -// - from []common.Address -// - to []common.Address -func (_e *KeystoneForwarderInterface_Expecter) WatchOwnershipTransferRequested(opts interface{}, sink interface{}, from interface{}, to interface{}) *KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call { - return &KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call{Call: _e.mock.On("WatchOwnershipTransferRequested", opts, sink, from, to)} -} - -func (_c *KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested, from []common.Address, to []common.Address)) *KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested), args[2].([]common.Address), args[3].([]common.Address)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call) Return(_a0 event.Subscription, _a1 error) *KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferRequested, []common.Address, []common.Address) (event.Subscription, error)) *KeystoneForwarderInterface_WatchOwnershipTransferRequested_Call { - _c.Call.Return(run) - return _c -} - -// WatchOwnershipTransferred provides a mock function with given fields: opts, sink, from, to -func (_m *KeystoneForwarderInterface) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, from, to) - - if len(ret) == 0 { - panic("no return value specified for WatchOwnershipTransferred") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferred, []common.Address, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferred, []common.Address, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferred, []common.Address, []common.Address) error); ok { - r1 = rf(opts, sink, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_WatchOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchOwnershipTransferred' -type KeystoneForwarderInterface_WatchOwnershipTransferred_Call struct { - *mock.Call -} - -// WatchOwnershipTransferred is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *forwarder.KeystoneForwarderOwnershipTransferred -// - from []common.Address -// - to []common.Address -func (_e *KeystoneForwarderInterface_Expecter) WatchOwnershipTransferred(opts interface{}, sink interface{}, from interface{}, to interface{}) *KeystoneForwarderInterface_WatchOwnershipTransferred_Call { - return &KeystoneForwarderInterface_WatchOwnershipTransferred_Call{Call: _e.mock.On("WatchOwnershipTransferred", opts, sink, from, to)} -} - -func (_c *KeystoneForwarderInterface_WatchOwnershipTransferred_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderOwnershipTransferred, from []common.Address, to []common.Address)) *KeystoneForwarderInterface_WatchOwnershipTransferred_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *forwarder.KeystoneForwarderOwnershipTransferred), args[2].([]common.Address), args[3].([]common.Address)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_WatchOwnershipTransferred_Call) Return(_a0 event.Subscription, _a1 error) *KeystoneForwarderInterface_WatchOwnershipTransferred_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_WatchOwnershipTransferred_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderOwnershipTransferred, []common.Address, []common.Address) (event.Subscription, error)) *KeystoneForwarderInterface_WatchOwnershipTransferred_Call { - _c.Call.Return(run) - return _c -} - -// WatchReportProcessed provides a mock function with given fields: opts, sink, receiver, workflowExecutionId, reportId -func (_m *KeystoneForwarderInterface) WatchReportProcessed(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderReportProcessed, receiver []common.Address, workflowExecutionId [][32]byte, reportId [][2]byte) (event.Subscription, error) { - ret := _m.Called(opts, sink, receiver, workflowExecutionId, reportId) - - if len(ret) == 0 { - panic("no return value specified for WatchReportProcessed") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderReportProcessed, []common.Address, [][32]byte, [][2]byte) (event.Subscription, error)); ok { - return rf(opts, sink, receiver, workflowExecutionId, reportId) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderReportProcessed, []common.Address, [][32]byte, [][2]byte) event.Subscription); ok { - r0 = rf(opts, sink, receiver, workflowExecutionId, reportId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderReportProcessed, []common.Address, [][32]byte, [][2]byte) error); ok { - r1 = rf(opts, sink, receiver, workflowExecutionId, reportId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeystoneForwarderInterface_WatchReportProcessed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchReportProcessed' -type KeystoneForwarderInterface_WatchReportProcessed_Call struct { - *mock.Call -} - -// WatchReportProcessed is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *forwarder.KeystoneForwarderReportProcessed -// - receiver []common.Address -// - workflowExecutionId [][32]byte -// - reportId [][2]byte -func (_e *KeystoneForwarderInterface_Expecter) WatchReportProcessed(opts interface{}, sink interface{}, receiver interface{}, workflowExecutionId interface{}, reportId interface{}) *KeystoneForwarderInterface_WatchReportProcessed_Call { - return &KeystoneForwarderInterface_WatchReportProcessed_Call{Call: _e.mock.On("WatchReportProcessed", opts, sink, receiver, workflowExecutionId, reportId)} -} - -func (_c *KeystoneForwarderInterface_WatchReportProcessed_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *forwarder.KeystoneForwarderReportProcessed, receiver []common.Address, workflowExecutionId [][32]byte, reportId [][2]byte)) *KeystoneForwarderInterface_WatchReportProcessed_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *forwarder.KeystoneForwarderReportProcessed), args[2].([]common.Address), args[3].([][32]byte), args[4].([][2]byte)) - }) - return _c -} - -func (_c *KeystoneForwarderInterface_WatchReportProcessed_Call) Return(_a0 event.Subscription, _a1 error) *KeystoneForwarderInterface_WatchReportProcessed_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *KeystoneForwarderInterface_WatchReportProcessed_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *forwarder.KeystoneForwarderReportProcessed, []common.Address, [][32]byte, [][2]byte) (event.Subscription, error)) *KeystoneForwarderInterface_WatchReportProcessed_Call { - _c.Call.Return(run) - return _c -} - -// NewKeystoneForwarderInterface creates a new instance of KeystoneForwarderInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewKeystoneForwarderInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *KeystoneForwarderInterface { - mock := &KeystoneForwarderInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/core/gethwrappers/keystone/mocks/ocr3_capability_interface.go b/core/gethwrappers/keystone/mocks/ocr3_capability_interface.go deleted file mode 100644 index 4293e5c5364..00000000000 --- a/core/gethwrappers/keystone/mocks/ocr3_capability_interface.go +++ /dev/null @@ -1,1316 +0,0 @@ -// Code generated by mockery v2.45.0. DO NOT EDIT. - -package mock_contracts - -import ( - bind "github.com/ethereum/go-ethereum/accounts/abi/bind" - common "github.com/ethereum/go-ethereum/common" - - event "github.com/ethereum/go-ethereum/event" - - generated "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" - - mock "github.com/stretchr/testify/mock" - - ocr3_capability "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability" - - types "github.com/ethereum/go-ethereum/core/types" -) - -// OCR3CapabilityInterface is an autogenerated mock type for the OCR3CapabilityInterface type -type OCR3CapabilityInterface struct { - mock.Mock -} - -type OCR3CapabilityInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *OCR3CapabilityInterface) EXPECT() *OCR3CapabilityInterface_Expecter { - return &OCR3CapabilityInterface_Expecter{mock: &_m.Mock} -} - -// AcceptOwnership provides a mock function with given fields: opts -func (_m *OCR3CapabilityInterface) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for AcceptOwnership") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts) (*types.Transaction, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts) *types.Transaction); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_AcceptOwnership_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AcceptOwnership' -type OCR3CapabilityInterface_AcceptOwnership_Call struct { - *mock.Call -} - -// AcceptOwnership is a helper method to define mock.On call -// - opts *bind.TransactOpts -func (_e *OCR3CapabilityInterface_Expecter) AcceptOwnership(opts interface{}) *OCR3CapabilityInterface_AcceptOwnership_Call { - return &OCR3CapabilityInterface_AcceptOwnership_Call{Call: _e.mock.On("AcceptOwnership", opts)} -} - -func (_c *OCR3CapabilityInterface_AcceptOwnership_Call) Run(run func(opts *bind.TransactOpts)) *OCR3CapabilityInterface_AcceptOwnership_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_AcceptOwnership_Call) Return(_a0 *types.Transaction, _a1 error) *OCR3CapabilityInterface_AcceptOwnership_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_AcceptOwnership_Call) RunAndReturn(run func(*bind.TransactOpts) (*types.Transaction, error)) *OCR3CapabilityInterface_AcceptOwnership_Call { - _c.Call.Return(run) - return _c -} - -// Address provides a mock function with given fields: -func (_m *OCR3CapabilityInterface) Address() common.Address { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Address") - } - - var r0 common.Address - if rf, ok := ret.Get(0).(func() common.Address); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - return r0 -} - -// OCR3CapabilityInterface_Address_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Address' -type OCR3CapabilityInterface_Address_Call struct { - *mock.Call -} - -// Address is a helper method to define mock.On call -func (_e *OCR3CapabilityInterface_Expecter) Address() *OCR3CapabilityInterface_Address_Call { - return &OCR3CapabilityInterface_Address_Call{Call: _e.mock.On("Address")} -} - -func (_c *OCR3CapabilityInterface_Address_Call) Run(run func()) *OCR3CapabilityInterface_Address_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *OCR3CapabilityInterface_Address_Call) Return(_a0 common.Address) *OCR3CapabilityInterface_Address_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *OCR3CapabilityInterface_Address_Call) RunAndReturn(run func() common.Address) *OCR3CapabilityInterface_Address_Call { - _c.Call.Return(run) - return _c -} - -// FilterConfigSet provides a mock function with given fields: opts -func (_m *OCR3CapabilityInterface) FilterConfigSet(opts *bind.FilterOpts) (*ocr3_capability.OCR3CapabilityConfigSetIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterConfigSet") - } - - var r0 *ocr3_capability.OCR3CapabilityConfigSetIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*ocr3_capability.OCR3CapabilityConfigSetIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *ocr3_capability.OCR3CapabilityConfigSetIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityConfigSetIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_FilterConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterConfigSet' -type OCR3CapabilityInterface_FilterConfigSet_Call struct { - *mock.Call -} - -// FilterConfigSet is a helper method to define mock.On call -// - opts *bind.FilterOpts -func (_e *OCR3CapabilityInterface_Expecter) FilterConfigSet(opts interface{}) *OCR3CapabilityInterface_FilterConfigSet_Call { - return &OCR3CapabilityInterface_FilterConfigSet_Call{Call: _e.mock.On("FilterConfigSet", opts)} -} - -func (_c *OCR3CapabilityInterface_FilterConfigSet_Call) Run(run func(opts *bind.FilterOpts)) *OCR3CapabilityInterface_FilterConfigSet_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_FilterConfigSet_Call) Return(_a0 *ocr3_capability.OCR3CapabilityConfigSetIterator, _a1 error) *OCR3CapabilityInterface_FilterConfigSet_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_FilterConfigSet_Call) RunAndReturn(run func(*bind.FilterOpts) (*ocr3_capability.OCR3CapabilityConfigSetIterator, error)) *OCR3CapabilityInterface_FilterConfigSet_Call { - _c.Call.Return(run) - return _c -} - -// FilterOwnershipTransferRequested provides a mock function with given fields: opts, from, to -func (_m *OCR3CapabilityInterface) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ocr3_capability.OCR3CapabilityOwnershipTransferRequestedIterator, error) { - ret := _m.Called(opts, from, to) - - if len(ret) == 0 { - panic("no return value specified for FilterOwnershipTransferRequested") - } - - var r0 *ocr3_capability.OCR3CapabilityOwnershipTransferRequestedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*ocr3_capability.OCR3CapabilityOwnershipTransferRequestedIterator, error)); ok { - return rf(opts, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *ocr3_capability.OCR3CapabilityOwnershipTransferRequestedIterator); ok { - r0 = rf(opts, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityOwnershipTransferRequestedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { - r1 = rf(opts, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterOwnershipTransferRequested' -type OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call struct { - *mock.Call -} - -// FilterOwnershipTransferRequested is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - from []common.Address -// - to []common.Address -func (_e *OCR3CapabilityInterface_Expecter) FilterOwnershipTransferRequested(opts interface{}, from interface{}, to interface{}) *OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call { - return &OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call{Call: _e.mock.On("FilterOwnershipTransferRequested", opts, from, to)} -} - -func (_c *OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call) Run(run func(opts *bind.FilterOpts, from []common.Address, to []common.Address)) *OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]common.Address), args[2].([]common.Address)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call) Return(_a0 *ocr3_capability.OCR3CapabilityOwnershipTransferRequestedIterator, _a1 error) *OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address, []common.Address) (*ocr3_capability.OCR3CapabilityOwnershipTransferRequestedIterator, error)) *OCR3CapabilityInterface_FilterOwnershipTransferRequested_Call { - _c.Call.Return(run) - return _c -} - -// FilterOwnershipTransferred provides a mock function with given fields: opts, from, to -func (_m *OCR3CapabilityInterface) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ocr3_capability.OCR3CapabilityOwnershipTransferredIterator, error) { - ret := _m.Called(opts, from, to) - - if len(ret) == 0 { - panic("no return value specified for FilterOwnershipTransferred") - } - - var r0 *ocr3_capability.OCR3CapabilityOwnershipTransferredIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*ocr3_capability.OCR3CapabilityOwnershipTransferredIterator, error)); ok { - return rf(opts, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *ocr3_capability.OCR3CapabilityOwnershipTransferredIterator); ok { - r0 = rf(opts, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityOwnershipTransferredIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { - r1 = rf(opts, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_FilterOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterOwnershipTransferred' -type OCR3CapabilityInterface_FilterOwnershipTransferred_Call struct { - *mock.Call -} - -// FilterOwnershipTransferred is a helper method to define mock.On call -// - opts *bind.FilterOpts -// - from []common.Address -// - to []common.Address -func (_e *OCR3CapabilityInterface_Expecter) FilterOwnershipTransferred(opts interface{}, from interface{}, to interface{}) *OCR3CapabilityInterface_FilterOwnershipTransferred_Call { - return &OCR3CapabilityInterface_FilterOwnershipTransferred_Call{Call: _e.mock.On("FilterOwnershipTransferred", opts, from, to)} -} - -func (_c *OCR3CapabilityInterface_FilterOwnershipTransferred_Call) Run(run func(opts *bind.FilterOpts, from []common.Address, to []common.Address)) *OCR3CapabilityInterface_FilterOwnershipTransferred_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts), args[1].([]common.Address), args[2].([]common.Address)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_FilterOwnershipTransferred_Call) Return(_a0 *ocr3_capability.OCR3CapabilityOwnershipTransferredIterator, _a1 error) *OCR3CapabilityInterface_FilterOwnershipTransferred_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_FilterOwnershipTransferred_Call) RunAndReturn(run func(*bind.FilterOpts, []common.Address, []common.Address) (*ocr3_capability.OCR3CapabilityOwnershipTransferredIterator, error)) *OCR3CapabilityInterface_FilterOwnershipTransferred_Call { - _c.Call.Return(run) - return _c -} - -// FilterTransmitted provides a mock function with given fields: opts -func (_m *OCR3CapabilityInterface) FilterTransmitted(opts *bind.FilterOpts) (*ocr3_capability.OCR3CapabilityTransmittedIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterTransmitted") - } - - var r0 *ocr3_capability.OCR3CapabilityTransmittedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*ocr3_capability.OCR3CapabilityTransmittedIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *ocr3_capability.OCR3CapabilityTransmittedIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityTransmittedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_FilterTransmitted_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterTransmitted' -type OCR3CapabilityInterface_FilterTransmitted_Call struct { - *mock.Call -} - -// FilterTransmitted is a helper method to define mock.On call -// - opts *bind.FilterOpts -func (_e *OCR3CapabilityInterface_Expecter) FilterTransmitted(opts interface{}) *OCR3CapabilityInterface_FilterTransmitted_Call { - return &OCR3CapabilityInterface_FilterTransmitted_Call{Call: _e.mock.On("FilterTransmitted", opts)} -} - -func (_c *OCR3CapabilityInterface_FilterTransmitted_Call) Run(run func(opts *bind.FilterOpts)) *OCR3CapabilityInterface_FilterTransmitted_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.FilterOpts)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_FilterTransmitted_Call) Return(_a0 *ocr3_capability.OCR3CapabilityTransmittedIterator, _a1 error) *OCR3CapabilityInterface_FilterTransmitted_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_FilterTransmitted_Call) RunAndReturn(run func(*bind.FilterOpts) (*ocr3_capability.OCR3CapabilityTransmittedIterator, error)) *OCR3CapabilityInterface_FilterTransmitted_Call { - _c.Call.Return(run) - return _c -} - -// LatestConfigDetails provides a mock function with given fields: opts -func (_m *OCR3CapabilityInterface) LatestConfigDetails(opts *bind.CallOpts) (ocr3_capability.LatestConfigDetails, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for LatestConfigDetails") - } - - var r0 ocr3_capability.LatestConfigDetails - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (ocr3_capability.LatestConfigDetails, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) ocr3_capability.LatestConfigDetails); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(ocr3_capability.LatestConfigDetails) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_LatestConfigDetails_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LatestConfigDetails' -type OCR3CapabilityInterface_LatestConfigDetails_Call struct { - *mock.Call -} - -// LatestConfigDetails is a helper method to define mock.On call -// - opts *bind.CallOpts -func (_e *OCR3CapabilityInterface_Expecter) LatestConfigDetails(opts interface{}) *OCR3CapabilityInterface_LatestConfigDetails_Call { - return &OCR3CapabilityInterface_LatestConfigDetails_Call{Call: _e.mock.On("LatestConfigDetails", opts)} -} - -func (_c *OCR3CapabilityInterface_LatestConfigDetails_Call) Run(run func(opts *bind.CallOpts)) *OCR3CapabilityInterface_LatestConfigDetails_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_LatestConfigDetails_Call) Return(_a0 ocr3_capability.LatestConfigDetails, _a1 error) *OCR3CapabilityInterface_LatestConfigDetails_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_LatestConfigDetails_Call) RunAndReturn(run func(*bind.CallOpts) (ocr3_capability.LatestConfigDetails, error)) *OCR3CapabilityInterface_LatestConfigDetails_Call { - _c.Call.Return(run) - return _c -} - -// LatestConfigDigestAndEpoch provides a mock function with given fields: opts -func (_m *OCR3CapabilityInterface) LatestConfigDigestAndEpoch(opts *bind.CallOpts) (ocr3_capability.LatestConfigDigestAndEpoch, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for LatestConfigDigestAndEpoch") - } - - var r0 ocr3_capability.LatestConfigDigestAndEpoch - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (ocr3_capability.LatestConfigDigestAndEpoch, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) ocr3_capability.LatestConfigDigestAndEpoch); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(ocr3_capability.LatestConfigDigestAndEpoch) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LatestConfigDigestAndEpoch' -type OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call struct { - *mock.Call -} - -// LatestConfigDigestAndEpoch is a helper method to define mock.On call -// - opts *bind.CallOpts -func (_e *OCR3CapabilityInterface_Expecter) LatestConfigDigestAndEpoch(opts interface{}) *OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call { - return &OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call{Call: _e.mock.On("LatestConfigDigestAndEpoch", opts)} -} - -func (_c *OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call) Run(run func(opts *bind.CallOpts)) *OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call) Return(_a0 ocr3_capability.LatestConfigDigestAndEpoch, _a1 error) *OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call) RunAndReturn(run func(*bind.CallOpts) (ocr3_capability.LatestConfigDigestAndEpoch, error)) *OCR3CapabilityInterface_LatestConfigDigestAndEpoch_Call { - _c.Call.Return(run) - return _c -} - -// Owner provides a mock function with given fields: opts -func (_m *OCR3CapabilityInterface) Owner(opts *bind.CallOpts) (common.Address, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for Owner") - } - - var r0 common.Address - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (common.Address, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) common.Address); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_Owner_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Owner' -type OCR3CapabilityInterface_Owner_Call struct { - *mock.Call -} - -// Owner is a helper method to define mock.On call -// - opts *bind.CallOpts -func (_e *OCR3CapabilityInterface_Expecter) Owner(opts interface{}) *OCR3CapabilityInterface_Owner_Call { - return &OCR3CapabilityInterface_Owner_Call{Call: _e.mock.On("Owner", opts)} -} - -func (_c *OCR3CapabilityInterface_Owner_Call) Run(run func(opts *bind.CallOpts)) *OCR3CapabilityInterface_Owner_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_Owner_Call) Return(_a0 common.Address, _a1 error) *OCR3CapabilityInterface_Owner_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_Owner_Call) RunAndReturn(run func(*bind.CallOpts) (common.Address, error)) *OCR3CapabilityInterface_Owner_Call { - _c.Call.Return(run) - return _c -} - -// ParseConfigSet provides a mock function with given fields: log -func (_m *OCR3CapabilityInterface) ParseConfigSet(log types.Log) (*ocr3_capability.OCR3CapabilityConfigSet, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseConfigSet") - } - - var r0 *ocr3_capability.OCR3CapabilityConfigSet - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*ocr3_capability.OCR3CapabilityConfigSet, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *ocr3_capability.OCR3CapabilityConfigSet); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityConfigSet) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_ParseConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseConfigSet' -type OCR3CapabilityInterface_ParseConfigSet_Call struct { - *mock.Call -} - -// ParseConfigSet is a helper method to define mock.On call -// - log types.Log -func (_e *OCR3CapabilityInterface_Expecter) ParseConfigSet(log interface{}) *OCR3CapabilityInterface_ParseConfigSet_Call { - return &OCR3CapabilityInterface_ParseConfigSet_Call{Call: _e.mock.On("ParseConfigSet", log)} -} - -func (_c *OCR3CapabilityInterface_ParseConfigSet_Call) Run(run func(log types.Log)) *OCR3CapabilityInterface_ParseConfigSet_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_ParseConfigSet_Call) Return(_a0 *ocr3_capability.OCR3CapabilityConfigSet, _a1 error) *OCR3CapabilityInterface_ParseConfigSet_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_ParseConfigSet_Call) RunAndReturn(run func(types.Log) (*ocr3_capability.OCR3CapabilityConfigSet, error)) *OCR3CapabilityInterface_ParseConfigSet_Call { - _c.Call.Return(run) - return _c -} - -// ParseLog provides a mock function with given fields: log -func (_m *OCR3CapabilityInterface) ParseLog(log types.Log) (generated.AbigenLog, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseLog") - } - - var r0 generated.AbigenLog - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (generated.AbigenLog, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) generated.AbigenLog); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(generated.AbigenLog) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_ParseLog_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseLog' -type OCR3CapabilityInterface_ParseLog_Call struct { - *mock.Call -} - -// ParseLog is a helper method to define mock.On call -// - log types.Log -func (_e *OCR3CapabilityInterface_Expecter) ParseLog(log interface{}) *OCR3CapabilityInterface_ParseLog_Call { - return &OCR3CapabilityInterface_ParseLog_Call{Call: _e.mock.On("ParseLog", log)} -} - -func (_c *OCR3CapabilityInterface_ParseLog_Call) Run(run func(log types.Log)) *OCR3CapabilityInterface_ParseLog_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_ParseLog_Call) Return(_a0 generated.AbigenLog, _a1 error) *OCR3CapabilityInterface_ParseLog_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_ParseLog_Call) RunAndReturn(run func(types.Log) (generated.AbigenLog, error)) *OCR3CapabilityInterface_ParseLog_Call { - _c.Call.Return(run) - return _c -} - -// ParseOwnershipTransferRequested provides a mock function with given fields: log -func (_m *OCR3CapabilityInterface) ParseOwnershipTransferRequested(log types.Log) (*ocr3_capability.OCR3CapabilityOwnershipTransferRequested, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseOwnershipTransferRequested") - } - - var r0 *ocr3_capability.OCR3CapabilityOwnershipTransferRequested - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*ocr3_capability.OCR3CapabilityOwnershipTransferRequested, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *ocr3_capability.OCR3CapabilityOwnershipTransferRequested); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityOwnershipTransferRequested) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseOwnershipTransferRequested' -type OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call struct { - *mock.Call -} - -// ParseOwnershipTransferRequested is a helper method to define mock.On call -// - log types.Log -func (_e *OCR3CapabilityInterface_Expecter) ParseOwnershipTransferRequested(log interface{}) *OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call { - return &OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call{Call: _e.mock.On("ParseOwnershipTransferRequested", log)} -} - -func (_c *OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call) Run(run func(log types.Log)) *OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call) Return(_a0 *ocr3_capability.OCR3CapabilityOwnershipTransferRequested, _a1 error) *OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call) RunAndReturn(run func(types.Log) (*ocr3_capability.OCR3CapabilityOwnershipTransferRequested, error)) *OCR3CapabilityInterface_ParseOwnershipTransferRequested_Call { - _c.Call.Return(run) - return _c -} - -// ParseOwnershipTransferred provides a mock function with given fields: log -func (_m *OCR3CapabilityInterface) ParseOwnershipTransferred(log types.Log) (*ocr3_capability.OCR3CapabilityOwnershipTransferred, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseOwnershipTransferred") - } - - var r0 *ocr3_capability.OCR3CapabilityOwnershipTransferred - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*ocr3_capability.OCR3CapabilityOwnershipTransferred, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *ocr3_capability.OCR3CapabilityOwnershipTransferred); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityOwnershipTransferred) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_ParseOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseOwnershipTransferred' -type OCR3CapabilityInterface_ParseOwnershipTransferred_Call struct { - *mock.Call -} - -// ParseOwnershipTransferred is a helper method to define mock.On call -// - log types.Log -func (_e *OCR3CapabilityInterface_Expecter) ParseOwnershipTransferred(log interface{}) *OCR3CapabilityInterface_ParseOwnershipTransferred_Call { - return &OCR3CapabilityInterface_ParseOwnershipTransferred_Call{Call: _e.mock.On("ParseOwnershipTransferred", log)} -} - -func (_c *OCR3CapabilityInterface_ParseOwnershipTransferred_Call) Run(run func(log types.Log)) *OCR3CapabilityInterface_ParseOwnershipTransferred_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_ParseOwnershipTransferred_Call) Return(_a0 *ocr3_capability.OCR3CapabilityOwnershipTransferred, _a1 error) *OCR3CapabilityInterface_ParseOwnershipTransferred_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_ParseOwnershipTransferred_Call) RunAndReturn(run func(types.Log) (*ocr3_capability.OCR3CapabilityOwnershipTransferred, error)) *OCR3CapabilityInterface_ParseOwnershipTransferred_Call { - _c.Call.Return(run) - return _c -} - -// ParseTransmitted provides a mock function with given fields: log -func (_m *OCR3CapabilityInterface) ParseTransmitted(log types.Log) (*ocr3_capability.OCR3CapabilityTransmitted, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseTransmitted") - } - - var r0 *ocr3_capability.OCR3CapabilityTransmitted - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*ocr3_capability.OCR3CapabilityTransmitted, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *ocr3_capability.OCR3CapabilityTransmitted); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ocr3_capability.OCR3CapabilityTransmitted) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_ParseTransmitted_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseTransmitted' -type OCR3CapabilityInterface_ParseTransmitted_Call struct { - *mock.Call -} - -// ParseTransmitted is a helper method to define mock.On call -// - log types.Log -func (_e *OCR3CapabilityInterface_Expecter) ParseTransmitted(log interface{}) *OCR3CapabilityInterface_ParseTransmitted_Call { - return &OCR3CapabilityInterface_ParseTransmitted_Call{Call: _e.mock.On("ParseTransmitted", log)} -} - -func (_c *OCR3CapabilityInterface_ParseTransmitted_Call) Run(run func(log types.Log)) *OCR3CapabilityInterface_ParseTransmitted_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Log)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_ParseTransmitted_Call) Return(_a0 *ocr3_capability.OCR3CapabilityTransmitted, _a1 error) *OCR3CapabilityInterface_ParseTransmitted_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_ParseTransmitted_Call) RunAndReturn(run func(types.Log) (*ocr3_capability.OCR3CapabilityTransmitted, error)) *OCR3CapabilityInterface_ParseTransmitted_Call { - _c.Call.Return(run) - return _c -} - -// SetConfig provides a mock function with given fields: opts, _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig -func (_m *OCR3CapabilityInterface) SetConfig(opts *bind.TransactOpts, _signers [][]byte, _transmitters []common.Address, _f uint8, _onchainConfig []byte, _offchainConfigVersion uint64, _offchainConfig []byte) (*types.Transaction, error) { - ret := _m.Called(opts, _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig) - - if len(ret) == 0 { - panic("no return value specified for SetConfig") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][]byte, []common.Address, uint8, []byte, uint64, []byte) (*types.Transaction, error)); ok { - return rf(opts, _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [][]byte, []common.Address, uint8, []byte, uint64, []byte) *types.Transaction); ok { - r0 = rf(opts, _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, [][]byte, []common.Address, uint8, []byte, uint64, []byte) error); ok { - r1 = rf(opts, _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_SetConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetConfig' -type OCR3CapabilityInterface_SetConfig_Call struct { - *mock.Call -} - -// SetConfig is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - _signers [][]byte -// - _transmitters []common.Address -// - _f uint8 -// - _onchainConfig []byte -// - _offchainConfigVersion uint64 -// - _offchainConfig []byte -func (_e *OCR3CapabilityInterface_Expecter) SetConfig(opts interface{}, _signers interface{}, _transmitters interface{}, _f interface{}, _onchainConfig interface{}, _offchainConfigVersion interface{}, _offchainConfig interface{}) *OCR3CapabilityInterface_SetConfig_Call { - return &OCR3CapabilityInterface_SetConfig_Call{Call: _e.mock.On("SetConfig", opts, _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig)} -} - -func (_c *OCR3CapabilityInterface_SetConfig_Call) Run(run func(opts *bind.TransactOpts, _signers [][]byte, _transmitters []common.Address, _f uint8, _onchainConfig []byte, _offchainConfigVersion uint64, _offchainConfig []byte)) *OCR3CapabilityInterface_SetConfig_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].([][]byte), args[2].([]common.Address), args[3].(uint8), args[4].([]byte), args[5].(uint64), args[6].([]byte)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_SetConfig_Call) Return(_a0 *types.Transaction, _a1 error) *OCR3CapabilityInterface_SetConfig_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_SetConfig_Call) RunAndReturn(run func(*bind.TransactOpts, [][]byte, []common.Address, uint8, []byte, uint64, []byte) (*types.Transaction, error)) *OCR3CapabilityInterface_SetConfig_Call { - _c.Call.Return(run) - return _c -} - -// TransferOwnership provides a mock function with given fields: opts, to -func (_m *OCR3CapabilityInterface) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, to) - - if len(ret) == 0 { - panic("no return value specified for TransferOwnership") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { - return rf(opts, to) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { - r0 = rf(opts, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { - r1 = rf(opts, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_TransferOwnership_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransferOwnership' -type OCR3CapabilityInterface_TransferOwnership_Call struct { - *mock.Call -} - -// TransferOwnership is a helper method to define mock.On call -// - opts *bind.TransactOpts -// - to common.Address -func (_e *OCR3CapabilityInterface_Expecter) TransferOwnership(opts interface{}, to interface{}) *OCR3CapabilityInterface_TransferOwnership_Call { - return &OCR3CapabilityInterface_TransferOwnership_Call{Call: _e.mock.On("TransferOwnership", opts, to)} -} - -func (_c *OCR3CapabilityInterface_TransferOwnership_Call) Run(run func(opts *bind.TransactOpts, to common.Address)) *OCR3CapabilityInterface_TransferOwnership_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.TransactOpts), args[1].(common.Address)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_TransferOwnership_Call) Return(_a0 *types.Transaction, _a1 error) *OCR3CapabilityInterface_TransferOwnership_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_TransferOwnership_Call) RunAndReturn(run func(*bind.TransactOpts, common.Address) (*types.Transaction, error)) *OCR3CapabilityInterface_TransferOwnership_Call { - _c.Call.Return(run) - return _c -} - -// Transmit provides a mock function with given fields: opts, arg0, arg1, arg2, arg3, arg4 -func (_m *OCR3CapabilityInterface) Transmit(opts *bind.CallOpts, arg0 [3][32]byte, arg1 []byte, arg2 [][32]byte, arg3 [][32]byte, arg4 [32]byte) error { - ret := _m.Called(opts, arg0, arg1, arg2, arg3, arg4) - - if len(ret) == 0 { - panic("no return value specified for Transmit") - } - - var r0 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, [3][32]byte, []byte, [][32]byte, [][32]byte, [32]byte) error); ok { - r0 = rf(opts, arg0, arg1, arg2, arg3, arg4) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// OCR3CapabilityInterface_Transmit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Transmit' -type OCR3CapabilityInterface_Transmit_Call struct { - *mock.Call -} - -// Transmit is a helper method to define mock.On call -// - opts *bind.CallOpts -// - arg0 [3][32]byte -// - arg1 []byte -// - arg2 [][32]byte -// - arg3 [][32]byte -// - arg4 [32]byte -func (_e *OCR3CapabilityInterface_Expecter) Transmit(opts interface{}, arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}) *OCR3CapabilityInterface_Transmit_Call { - return &OCR3CapabilityInterface_Transmit_Call{Call: _e.mock.On("Transmit", opts, arg0, arg1, arg2, arg3, arg4)} -} - -func (_c *OCR3CapabilityInterface_Transmit_Call) Run(run func(opts *bind.CallOpts, arg0 [3][32]byte, arg1 []byte, arg2 [][32]byte, arg3 [][32]byte, arg4 [32]byte)) *OCR3CapabilityInterface_Transmit_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts), args[1].([3][32]byte), args[2].([]byte), args[3].([][32]byte), args[4].([][32]byte), args[5].([32]byte)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_Transmit_Call) Return(_a0 error) *OCR3CapabilityInterface_Transmit_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *OCR3CapabilityInterface_Transmit_Call) RunAndReturn(run func(*bind.CallOpts, [3][32]byte, []byte, [][32]byte, [][32]byte, [32]byte) error) *OCR3CapabilityInterface_Transmit_Call { - _c.Call.Return(run) - return _c -} - -// TypeAndVersion provides a mock function with given fields: opts -func (_m *OCR3CapabilityInterface) TypeAndVersion(opts *bind.CallOpts) (string, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for TypeAndVersion") - } - - var r0 string - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (string, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) string); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(string) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_TypeAndVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeAndVersion' -type OCR3CapabilityInterface_TypeAndVersion_Call struct { - *mock.Call -} - -// TypeAndVersion is a helper method to define mock.On call -// - opts *bind.CallOpts -func (_e *OCR3CapabilityInterface_Expecter) TypeAndVersion(opts interface{}) *OCR3CapabilityInterface_TypeAndVersion_Call { - return &OCR3CapabilityInterface_TypeAndVersion_Call{Call: _e.mock.On("TypeAndVersion", opts)} -} - -func (_c *OCR3CapabilityInterface_TypeAndVersion_Call) Run(run func(opts *bind.CallOpts)) *OCR3CapabilityInterface_TypeAndVersion_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.CallOpts)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_TypeAndVersion_Call) Return(_a0 string, _a1 error) *OCR3CapabilityInterface_TypeAndVersion_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_TypeAndVersion_Call) RunAndReturn(run func(*bind.CallOpts) (string, error)) *OCR3CapabilityInterface_TypeAndVersion_Call { - _c.Call.Return(run) - return _c -} - -// WatchConfigSet provides a mock function with given fields: opts, sink -func (_m *OCR3CapabilityInterface) WatchConfigSet(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityConfigSet) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchConfigSet") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityConfigSet) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityConfigSet) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityConfigSet) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_WatchConfigSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchConfigSet' -type OCR3CapabilityInterface_WatchConfigSet_Call struct { - *mock.Call -} - -// WatchConfigSet is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *ocr3_capability.OCR3CapabilityConfigSet -func (_e *OCR3CapabilityInterface_Expecter) WatchConfigSet(opts interface{}, sink interface{}) *OCR3CapabilityInterface_WatchConfigSet_Call { - return &OCR3CapabilityInterface_WatchConfigSet_Call{Call: _e.mock.On("WatchConfigSet", opts, sink)} -} - -func (_c *OCR3CapabilityInterface_WatchConfigSet_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityConfigSet)) *OCR3CapabilityInterface_WatchConfigSet_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *ocr3_capability.OCR3CapabilityConfigSet)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_WatchConfigSet_Call) Return(_a0 event.Subscription, _a1 error) *OCR3CapabilityInterface_WatchConfigSet_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_WatchConfigSet_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityConfigSet) (event.Subscription, error)) *OCR3CapabilityInterface_WatchConfigSet_Call { - _c.Call.Return(run) - return _c -} - -// WatchOwnershipTransferRequested provides a mock function with given fields: opts, sink, from, to -func (_m *OCR3CapabilityInterface) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, from, to) - - if len(ret) == 0 { - panic("no return value specified for WatchOwnershipTransferRequested") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested, []common.Address, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested, []common.Address, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested, []common.Address, []common.Address) error); ok { - r1 = rf(opts, sink, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchOwnershipTransferRequested' -type OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call struct { - *mock.Call -} - -// WatchOwnershipTransferRequested is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested -// - from []common.Address -// - to []common.Address -func (_e *OCR3CapabilityInterface_Expecter) WatchOwnershipTransferRequested(opts interface{}, sink interface{}, from interface{}, to interface{}) *OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call { - return &OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call{Call: _e.mock.On("WatchOwnershipTransferRequested", opts, sink, from, to)} -} - -func (_c *OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested, from []common.Address, to []common.Address)) *OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested), args[2].([]common.Address), args[3].([]common.Address)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call) Return(_a0 event.Subscription, _a1 error) *OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferRequested, []common.Address, []common.Address) (event.Subscription, error)) *OCR3CapabilityInterface_WatchOwnershipTransferRequested_Call { - _c.Call.Return(run) - return _c -} - -// WatchOwnershipTransferred provides a mock function with given fields: opts, sink, from, to -func (_m *OCR3CapabilityInterface) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, from, to) - - if len(ret) == 0 { - panic("no return value specified for WatchOwnershipTransferred") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred, []common.Address, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred, []common.Address, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred, []common.Address, []common.Address) error); ok { - r1 = rf(opts, sink, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_WatchOwnershipTransferred_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchOwnershipTransferred' -type OCR3CapabilityInterface_WatchOwnershipTransferred_Call struct { - *mock.Call -} - -// WatchOwnershipTransferred is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred -// - from []common.Address -// - to []common.Address -func (_e *OCR3CapabilityInterface_Expecter) WatchOwnershipTransferred(opts interface{}, sink interface{}, from interface{}, to interface{}) *OCR3CapabilityInterface_WatchOwnershipTransferred_Call { - return &OCR3CapabilityInterface_WatchOwnershipTransferred_Call{Call: _e.mock.On("WatchOwnershipTransferred", opts, sink, from, to)} -} - -func (_c *OCR3CapabilityInterface_WatchOwnershipTransferred_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred, from []common.Address, to []common.Address)) *OCR3CapabilityInterface_WatchOwnershipTransferred_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred), args[2].([]common.Address), args[3].([]common.Address)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_WatchOwnershipTransferred_Call) Return(_a0 event.Subscription, _a1 error) *OCR3CapabilityInterface_WatchOwnershipTransferred_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_WatchOwnershipTransferred_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityOwnershipTransferred, []common.Address, []common.Address) (event.Subscription, error)) *OCR3CapabilityInterface_WatchOwnershipTransferred_Call { - _c.Call.Return(run) - return _c -} - -// WatchTransmitted provides a mock function with given fields: opts, sink -func (_m *OCR3CapabilityInterface) WatchTransmitted(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityTransmitted) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchTransmitted") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityTransmitted) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityTransmitted) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityTransmitted) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OCR3CapabilityInterface_WatchTransmitted_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchTransmitted' -type OCR3CapabilityInterface_WatchTransmitted_Call struct { - *mock.Call -} - -// WatchTransmitted is a helper method to define mock.On call -// - opts *bind.WatchOpts -// - sink chan<- *ocr3_capability.OCR3CapabilityTransmitted -func (_e *OCR3CapabilityInterface_Expecter) WatchTransmitted(opts interface{}, sink interface{}) *OCR3CapabilityInterface_WatchTransmitted_Call { - return &OCR3CapabilityInterface_WatchTransmitted_Call{Call: _e.mock.On("WatchTransmitted", opts, sink)} -} - -func (_c *OCR3CapabilityInterface_WatchTransmitted_Call) Run(run func(opts *bind.WatchOpts, sink chan<- *ocr3_capability.OCR3CapabilityTransmitted)) *OCR3CapabilityInterface_WatchTransmitted_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*bind.WatchOpts), args[1].(chan<- *ocr3_capability.OCR3CapabilityTransmitted)) - }) - return _c -} - -func (_c *OCR3CapabilityInterface_WatchTransmitted_Call) Return(_a0 event.Subscription, _a1 error) *OCR3CapabilityInterface_WatchTransmitted_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *OCR3CapabilityInterface_WatchTransmitted_Call) RunAndReturn(run func(*bind.WatchOpts, chan<- *ocr3_capability.OCR3CapabilityTransmitted) (event.Subscription, error)) *OCR3CapabilityInterface_WatchTransmitted_Call { - _c.Call.Return(run) - return _c -} - -// NewOCR3CapabilityInterface creates a new instance of OCR3CapabilityInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewOCR3CapabilityInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *OCR3CapabilityInterface { - mock := &OCR3CapabilityInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} From 8e7d9d53177c6a2b9b6b5d0696508db383affbc3 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:19:11 -0700 Subject: [PATCH 086/117] Fix caching --- .../keystone/src/01_provision_keystone.go | 12 ++-- .../keystone/src/88_contracts_helpers.go | 63 +++++++++---------- 2 files changed, 35 insertions(+), 40 deletions(-) diff --git a/core/scripts/keystone/src/01_provision_keystone.go b/core/scripts/keystone/src/01_provision_keystone.go index 9faa950744b..4e775acb86a 100644 --- a/core/scripts/keystone/src/01_provision_keystone.go +++ b/core/scripts/keystone/src/01_provision_keystone.go @@ -61,25 +61,23 @@ func (g *provisionKeystone) Run(args []string) { return } + // We always want to start with a clean slate + /// when it comes to nodesets + err = os.RemoveAll(*nodeSetsPath) + PanicErr(err) nodeSets := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize) + if *clean { fmt.Println("Cleaning up resources") - // clean nodesets path - err = os.RemoveAll(*nodeSetsPath) - PanicErr(err) - for _, node := range nodeSets.Workflow.Nodes { clearJobs(newNodeAPI(node)) } - for _, node := range nodeSets.StreamsTrigger.Nodes { clearJobs(newNodeAPI(node)) } - os.RemoveAll(*artefactsDir) } - nodeSets = downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize) // Kinda hacky but it prevents us from refactoring the setupenv function which // is used in many other places os.Setenv("ETH_URL", *ethUrl) diff --git a/core/scripts/keystone/src/88_contracts_helpers.go b/core/scripts/keystone/src/88_contracts_helpers.go index a54a9f5e8f2..65271fca9dc 100644 --- a/core/scripts/keystone/src/88_contracts_helpers.go +++ b/core/scripts/keystone/src/88_contracts_helpers.go @@ -105,67 +105,64 @@ func LoadOnchainMeta(artefactsDir string, env helpers.Environment) *onchainMeta hydrated.SetConfigTxBlock = s.SetConfigTxBlock if s.OCR != ZeroAddress { if !contractExists(s.OCR, env) { - fmt.Printf("OCR contract at %s does not exist, setting to zero address\n", s.OCR.Hex()) - s.OCR = ZeroAddress + fmt.Printf("OCR contract at %s does not exist\n", s.OCR.Hex()) + } else { + ocr3, err := ocr3_capability.NewOCR3Capability(s.OCR, env.Ec) + PanicErr(err) + hydrated.OCR3 = ocr3 } - - ocr3, err := ocr3_capability.NewOCR3Capability(s.OCR, env.Ec) - PanicErr(err) - hydrated.OCR3 = ocr3 } if s.Forwarder != ZeroAddress { if !contractExists(s.Forwarder, env) { - fmt.Printf("Forwarder contract at %s does not exist, setting to zero address\n", s.Forwarder.Hex()) - s.Forwarder = ZeroAddress + fmt.Printf("Forwarder contract at %s does not exist\n", s.Forwarder.Hex()) + } else { + fwdr, err := forwarder.NewKeystoneForwarder(s.Forwarder, env.Ec) + PanicErr(err) + hydrated.Forwarder = fwdr } - - fwdr, err := forwarder.NewKeystoneForwarder(s.Forwarder, env.Ec) - PanicErr(err) - hydrated.Forwarder = fwdr } if s.CapabilitiesRegistry != ZeroAddress { if !contractExists(s.CapabilitiesRegistry, env) { - fmt.Printf("CapabilityRegistry contract at %s does not exist, setting to zero address\n", s.CapabilitiesRegistry.Hex()) - s.CapabilitiesRegistry = ZeroAddress + fmt.Printf("CapabilityRegistry contract at %s does not exist\n", s.CapabilitiesRegistry.Hex()) + } else { + cr, err := capabilities_registry.NewCapabilitiesRegistry(s.CapabilitiesRegistry, env.Ec) + PanicErr(err) + hydrated.CapabilitiesRegistry = cr } - - cr, err := capabilities_registry.NewCapabilitiesRegistry(s.CapabilitiesRegistry, env.Ec) - PanicErr(err) - hydrated.CapabilitiesRegistry = cr } + hydrated.InitializedVerifierAddress = s.InitializedVerifierAddress + if s.Verifier != ZeroAddress { if !contractExists(s.Verifier, env) { - fmt.Printf("Verifier contract at %s does not exist, setting to zero address\n", s.Verifier.Hex()) - s.Verifier = ZeroAddress + fmt.Printf("Verifier contract at %s does not exist\n", s.Verifier.Hex()) + hydrated.InitializedVerifierAddress = ZeroAddress + } else { + verifier, err := verifierContract.NewVerifier(s.Verifier, env.Ec) + PanicErr(err) + hydrated.Verifier = verifier } - - verifier, err := verifierContract.NewVerifier(s.Verifier, env.Ec) - PanicErr(err) - hydrated.Verifier = verifier } if s.VerifierProxy != ZeroAddress { if !contractExists(s.VerifierProxy, env) { - fmt.Printf("VerifierProxy contract at %s does not exist, setting to zero address\n", s.VerifierProxy.Hex()) - s.VerifierProxy = ZeroAddress + fmt.Printf("VerifierProxy contract at %s does not exist\n", s.VerifierProxy.Hex()) + hydrated.InitializedVerifierAddress = ZeroAddress + } else { + verifierProxy, err := verifier_proxy.NewVerifierProxy(s.VerifierProxy, env.Ec) + PanicErr(err) + hydrated.VerifierProxy = verifierProxy } - - verifierProxy, err := verifier_proxy.NewVerifierProxy(s.VerifierProxy, env.Ec) - PanicErr(err) - hydrated.VerifierProxy = verifierProxy } - hydrated.InitializedVerifierAddress = s.InitializedVerifierAddress - blkNum, err := env.Ec.BlockNumber(context.Background()) PanicErr(err) if s.SetConfigTxBlock > blkNum { fmt.Printf("Stale SetConfigTxBlock: %d, current block number: %d\n", s.SetConfigTxBlock, blkNum) - return hydrated + hydrated.SetConfigTxBlock = 0 } return hydrated From 6d230da79fcb5f0d8c867ced6952ef0681a233ce Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:17:18 -0700 Subject: [PATCH 087/117] Remove deprecated assertion call --- core/cmd/bridge_commands_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/cmd/bridge_commands_test.go b/core/cmd/bridge_commands_test.go index 04352b0d5d1..5523fc09605 100644 --- a/core/cmd/bridge_commands_test.go +++ b/core/cmd/bridge_commands_test.go @@ -228,7 +228,7 @@ func TestShell_UpdateBridge(t *testing.T) { if test.errored { assert.Error(t, client.UpdateBridge(c)) } else { - assert.Nil(t, client.UpdateBridge(c)) + assert.NoError(t, client.UpdateBridge(c)) } }) } From a52439471b7e903f68f60aff260f09b6fcf6392b Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:17:24 -0700 Subject: [PATCH 088/117] Update gomod --- core/scripts/go.mod | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index e7351d41f23..009e4e2d6f1 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -17,7 +17,6 @@ require ( github.com/jmoiron/sqlx v1.4.0 github.com/joho/godotenv v1.5.1 github.com/jonboulle/clockwork v0.4.0 - github.com/jpillora/backoff v1.0.0 github.com/manyminds/api2go v0.0.0-20171030193247-e7b693844a6f github.com/montanaflynn/stats v0.7.1 github.com/olekukonko/tablewriter v0.0.5 @@ -43,6 +42,8 @@ require ( k8s.io/client-go v0.31.1 ) +require github.com/jpillora/backoff v1.0.0 // indirect + require ( contrib.go.opencensus.io/exporter/stackdriver v0.13.5 // indirect cosmossdk.io/api v0.3.1 // indirect From aeed96385eda1151f8c8b2c5ca43baecd9cf8866 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 31 Oct 2024 18:24:03 -0700 Subject: [PATCH 089/117] Fix linter warns --- .../keystone/src/01_provision_keystone.go | 16 +++++---- .../src/02_deploy_keystone_workflows.go | 9 ++--- .../src/02_provision_capabilities_registry.go | 1 - .../scripts/keystone/src/02_provision_crib.go | 8 ++--- .../src/02_provision_forwarder_contract.go | 1 - .../src/02_provision_ocr3_capability.go | 16 ++++----- .../src/02_provision_ocr3_capability_test.go | 2 +- ...02_provision_streams_trigger_capability.go | 35 ++++++++++--------- .../src/88_capabilities_registry_helpers.go | 15 ++++---- .../keystone/src/88_contracts_helpers.go | 25 ++++++------- .../keystone/src/88_jobspecs_helpers.go | 6 ++-- core/scripts/keystone/src/88_ocr_helpers.go | 3 +- core/scripts/keystone/src/99_app.go | 8 +++-- core/scripts/keystone/src/99_crib_client.go | 3 -- core/scripts/keystone/src/99_fetch_keys.go | 10 +++--- core/scripts/keystone/src/99_k8s_client.go | 5 +-- .../external-adapter/99_external_adapter.go | 6 +++- shell.nix | 1 - 18 files changed, 88 insertions(+), 82 deletions(-) diff --git a/core/scripts/keystone/src/01_provision_keystone.go b/core/scripts/keystone/src/01_provision_keystone.go index 4e775acb86a..3ea1504660c 100644 --- a/core/scripts/keystone/src/01_provision_keystone.go +++ b/core/scripts/keystone/src/01_provision_keystone.go @@ -3,10 +3,12 @@ package src import ( "flag" "fmt" - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" "os" "path/filepath" + "strconv" + + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" ) type provisionKeystone struct{} @@ -32,7 +34,7 @@ func (g *provisionKeystone) Run(args []string) { preprovison := fs.Bool("preprovision", false, "Preprovision crib") // provisioning flags - ethUrl := fs.String("ethurl", "", "URL of the Ethereum node") + ethURL := fs.String("ethurl", "", "URL of the Ethereum node") accountKey := fs.String("accountkey", "", "private key of the account to deploy from") ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "path to OCR config file") p2pPort := fs.Int64("p2pport", 6690, "p2p port") @@ -44,7 +46,7 @@ func (g *provisionKeystone) Run(args []string) { err := fs.Parse(args) - if err != nil || (!*preprovison && (*ethUrl == "" || *accountKey == "")) { + if err != nil || (!*preprovison && (*ethURL == "" || *accountKey == "")) { fs.Usage() os.Exit(1) } @@ -80,8 +82,8 @@ func (g *provisionKeystone) Run(args []string) { // Kinda hacky but it prevents us from refactoring the setupenv function which // is used in many other places - os.Setenv("ETH_URL", *ethUrl) - os.Setenv("ETH_CHAIN_ID", fmt.Sprintf("%d", *chainID)) + os.Setenv("ETH_URL", *ethURL) + os.Setenv("ETH_CHAIN_ID", strconv.FormatInt(*chainID, 10)) os.Setenv("ACCOUNT_KEY", *accountKey) os.Setenv("INSECURE_SKIP_VERIFY", "true") env := helpers.SetupEnv(false) @@ -208,7 +210,7 @@ func provisionWorkflowDON( // We don't technically need the capability registry as a dependency // as we just use it for a sanity check // We could remove it so that we can execute provisioning in parallel - deployKeystoneWorkflowsTo(nodeSet, reg, chainID) + deployKeystoneWorkflowsTo(nodeSet, reg) return onchainMeta } diff --git a/core/scripts/keystone/src/02_deploy_keystone_workflows.go b/core/scripts/keystone/src/02_deploy_keystone_workflows.go index 5eeadf90f57..cce15f8d2e0 100644 --- a/core/scripts/keystone/src/02_deploy_keystone_workflows.go +++ b/core/scripts/keystone/src/02_deploy_keystone_workflows.go @@ -6,10 +6,11 @@ import ( "text/template" "github.com/ethereum/go-ethereum/accounts/abi/bind" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" ) -func deployKeystoneWorkflowsTo(nodeSet NodeSet, reg kcr.CapabilitiesRegistryInterface, chainID int64) { +func deployKeystoneWorkflowsTo(nodeSet NodeSet, reg kcr.CapabilitiesRegistryInterface) { fmt.Println("Deploying Keystone workflow jobs") caps, err := reg.GetCapabilities(&bind.CallOpts{}) PanicErr(err) @@ -36,14 +37,14 @@ func deployKeystoneWorkflowsTo(nodeSet NodeSet, reg kcr.CapabilitiesRegistryInte } } - feedIds := []string{} + feedIDs := []string{} for _, feed := range feeds { - feedIds = append(feedIds, fmt.Sprintf("0x%x", feed.id)) + feedIDs = append(feedIDs, fmt.Sprintf("0x%x", feed.id)) } workflowConfig := WorkflowJobSpecConfig{ JobSpecName: "keystone_workflow", WorkflowOwnerAddress: "0x1234567890abcdef1234567890abcdef12345678", - FeedIDs: feedIds, + FeedIDs: feedIDs, TargetID: testnetWrite.GetID(), ConsensusID: ocr3.GetID(), TriggerID: streams.GetID(), diff --git a/core/scripts/keystone/src/02_provision_capabilities_registry.go b/core/scripts/keystone/src/02_provision_capabilities_registry.go index 88b100d1987..0eb8e8c3ed9 100644 --- a/core/scripts/keystone/src/02_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/02_provision_capabilities_registry.go @@ -8,7 +8,6 @@ import ( kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" ) - func provisionCapabillitiesRegistry(env helpers.Environment, nodeSets NodeSets, chainID int64, artefactsDir string) kcr.CapabilitiesRegistryInterface { fmt.Printf("Provisioning capabilities registry on chain %d\n", chainID) ctx := context.Background() diff --git a/core/scripts/keystone/src/02_provision_crib.go b/core/scripts/keystone/src/02_provision_crib.go index eb2f7912d2d..e07b5c28aed 100644 --- a/core/scripts/keystone/src/02_provision_crib.go +++ b/core/scripts/keystone/src/02_provision_crib.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "path/filepath" + "strconv" ocrcommontypes "github.com/smartcontractkit/libocr/commontypes" "gopkg.in/yaml.v3" @@ -154,7 +155,6 @@ func generatePostprovisionConfig( forwarderAddress string, capabillitiesRegistryAddress string, ) Helm { - nodes := make(map[string]Node) nodeNames := []string{} var capabilitiesBootstrapper *ocrcommontypes.BootstrapperLocator @@ -243,7 +243,7 @@ func generateOverridesToml( ExternalRegistry: toml.ExternalRegistry{ Address: ptr(externalRegistryAddress), NetworkID: ptr("evm"), - ChainID: ptr(fmt.Sprintf("%d", chainID)), + ChainID: ptr(strconv.FormatInt(chainID, 10)), }, Peering: toml.P2P{ V2: toml.P2PV2{ @@ -278,7 +278,7 @@ func generateOverridesToml( // New function to generate Ingress func generateIngress(nodeNames []string) Ingress { - var hosts []Host + hosts := make([]Host, 0, len(nodeNames)) for _, nodeName := range nodeNames { host := Host{ @@ -289,7 +289,7 @@ func generateIngress(nodeNames []string) Ingress { Path: "/", Backend: Backend{ Service: Service{ - Name: fmt.Sprintf("app-%s", nodeName), + Name: "app-" + nodeName, Port: Port{ Number: 6688, }, diff --git a/core/scripts/keystone/src/02_provision_forwarder_contract.go b/core/scripts/keystone/src/02_provision_forwarder_contract.go index 8c0395f3d5c..4cc3d7f70fa 100644 --- a/core/scripts/keystone/src/02_provision_forwarder_contract.go +++ b/core/scripts/keystone/src/02_provision_forwarder_contract.go @@ -8,7 +8,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder" ) - func deployForwarder( env helpers.Environment, artefacts string, diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability.go b/core/scripts/keystone/src/02_provision_ocr3_capability.go index 55738d9038d..f994de49248 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability.go @@ -2,6 +2,7 @@ package src import ( "bytes" + "strconv" "text/template" "context" @@ -12,10 +13,11 @@ import ( ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" - "github.com/smartcontractkit/libocr/offchainreporting2plus/types" ) func provisionOCR3( @@ -37,7 +39,6 @@ func provisionOCR3( nodeSet, chainID, p2pPort, - artefactsDir, onchainMeta, ) @@ -54,7 +55,6 @@ func deployOCR3Contract( ocrConf := generateOCR3Config( nodeSet, configFile, - env.ChainID, ) if o.OCR3 != nil { @@ -63,6 +63,7 @@ func deployOCR3Contract( latestConfigDigestBytes, err := o.OCR3.LatestConfigDetails(nil) PanicErr(err) latestConfigDigest, err := types.BytesToConfigDigest(latestConfigDigestBytes.ConfigDigest[:]) + PanicErr(err) cc := ocrConfToContractConfig(ocrConf, latestConfigDigestBytes.ConfigCount) digester := evm.OCR3CapabilityOffchainConfigDigester{ @@ -92,7 +93,7 @@ func deployOCR3Contract( return o, true } -func generateOCR3Config(nodeSet NodeSet, configFile string, chainID int64) ksdeploy.Orc2drOracleConfig { +func generateOCR3Config(nodeSet NodeSet, configFile string) ksdeploy.Orc2drOracleConfig { topLevelCfg := mustReadOCR3Config(configFile) cfg := topLevelCfg.OracleConfig cfg.OCRSecrets = deployment.XXXGenerateTestOCRSecrets() @@ -120,7 +121,6 @@ func deployOCR3JobSpecsTo( nodeSet NodeSet, chainID int64, p2pPort int64, - artefactsDir string, onchainMeta *onchainMeta, ) { ocrAddress := onchainMeta.OCR3.Address().Hex() @@ -141,7 +141,7 @@ func deployOCR3JobSpecsTo( spec = createBootstrapJobSpec(bootstrapSpecConfig) } else { oc := OracleJobSpecConfig{ - JobSpecName: fmt.Sprintf("ocr3_oracle"), + JobSpecName: "ocr3_oracle", OCRConfigContractAddress: ocrAddress, OCRKeyBundleID: nodeKeys[i].OCR2BundleID, BootstrapURI: fmt.Sprintf("%s@%s:%d", nodeKeys[0].P2PPeerID, nodeSet.Nodes[0].ServiceName, p2pPort), @@ -159,9 +159,9 @@ func deployOCR3JobSpecsTo( fmt.Printf("Replaying from block: %d\n", onchainMeta.SetConfigTxBlock) fmt.Printf("EVM Chain ID: %d\n\n", chainID) api.withFlags(api.methods.ReplayFromBlock, func(fs *flag.FlagSet) { - err := fs.Set("block-number", fmt.Sprint(onchainMeta.SetConfigTxBlock)) + err := fs.Set("block-number", strconv.FormatUint(onchainMeta.SetConfigTxBlock, 10)) helpers.PanicErr(err) - err = fs.Set("evm-chain-id", fmt.Sprint(chainID)) + err = fs.Set("evm-chain-id", strconv.FormatInt(chainID, 10)) helpers.PanicErr(err) }).mustExec() } diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability_test.go b/core/scripts/keystone/src/02_provision_ocr3_capability_test.go index f6d82e669fa..1c639860d63 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability_test.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability_test.go @@ -12,7 +12,7 @@ import ( func TestGenerateOCR3Config(t *testing.T) { // Generate OCR3 config nodeSet := downloadNodeSets(1337, "./testdata/node_sets.json", 4) - config := generateOCR3Config(nodeSet.Workflow, "./testdata/SampleConfig.json", 1337) + config := generateOCR3Config(nodeSet.Workflow, "./testdata/SampleConfig.json") matchOffchainConfig := match.Custom("OffchainConfig", func(s any) (any, error) { // coerce the value to a string diff --git a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go index 4b3e31a1e20..e0c33e6f710 100644 --- a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go +++ b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go @@ -55,7 +55,7 @@ type feed struct { // we create a bridge for each feed bridgeName string - bridgeUrl string + bridgeURL string } func v3FeedID(id [32]byte) [32]byte { @@ -88,12 +88,12 @@ var feeds = []feed{ func setupStreamsTrigger( env helpers.Environment, nodeSet NodeSet, - chainId int64, + chainID int64, p2pPort int64, ocrConfigFilePath string, artefactsDir string, ) { - fmt.Printf("Deploying streams trigger for chain %d\n", chainId) + fmt.Printf("Deploying streams trigger for chain %d\n", chainID) fmt.Printf("Using OCR config file: %s\n", ocrConfigFilePath) fmt.Printf("Deploying Mercury V0.3 contracts\n") @@ -107,7 +107,7 @@ func setupStreamsTrigger( fmt.Printf("FeedID: %x\n", feed.id) fmt.Printf("FeedName: %s\n", feed.name) fmt.Printf("BridgeName: %s\n", feed.bridgeName) - fmt.Printf("BridgeURL: %s\n", feed.bridgeUrl) + fmt.Printf("BridgeURL: %s\n", feed.bridgeURL) latestConfigDetails, err := verifier.LatestConfigDetails(nil, feed.id) PanicErr(err) @@ -116,7 +116,7 @@ func setupStreamsTrigger( digester := mercury.NewOffchainConfigDigester( feed.id, - big.NewInt(chainId), + big.NewInt(chainID), verifier.Address(), ocrtypes.ConfigDigestPrefixMercuryV02, ) @@ -149,7 +149,7 @@ func setupStreamsTrigger( } fmt.Printf("Deploying OCR2 job specs for feed %s\n", feed.name) - deployOCR2JobSpecsForFeed(nodeSet, verifier, feed, chainId, p2pPort) + deployOCR2JobSpecsForFeed(nodeSet, verifier, feed, chainID, p2pPort) } fmt.Println("Finished deploying streams trigger") @@ -198,7 +198,7 @@ func deployMercuryV03Contracts(env helpers.Environment, artefactsDir string) ver return o.Verifier } -func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier verifierContract.VerifierInterface, feed feed, chainId int64, p2pPort int64) { +func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier verifierContract.VerifierInterface, feed feed, chainID int64, p2pPort int64) { // we assign the first node as the bootstrap node for i, n := range nodeSet.NodeKeys { // parallel arrays @@ -206,7 +206,7 @@ func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier verifierContract.Verifi jobSpecName := "" jobSpecStr := "" - upsertBridge(api, feed.bridgeName, feed.bridgeUrl) + upsertBridge(api, feed.bridgeName, feed.bridgeURL) if i == 0 { // Prepare data for Bootstrap Job @@ -214,7 +214,7 @@ func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier verifierContract.Verifi FeedName: feed.name, VerifierAddress: verifier.Address().Hex(), FeedID: fmt.Sprintf("%x", feed.id), - ChainID: chainId, + ChainID: chainID, } // Create Bootstrap Job @@ -222,7 +222,7 @@ func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier verifierContract.Verifi } else { // Prepare data for Mercury V3 Job mercuryData := MercuryV3JobSpecData{ - FeedName: fmt.Sprintf("feed-%s", feed.name), + FeedName: "feed-" + feed.name, BootstrapHost: fmt.Sprintf("%s@%s:%d", nodeSet.NodeKeys[0].P2PPeerID, nodeSet.Nodes[0].ServiceName, p2pPort), VerifierAddress: verifier.Address().Hex(), Bridge: feed.bridgeName, @@ -231,7 +231,7 @@ func deployOCR2JobSpecsForFeed(nodeSet NodeSet, verifier verifierContract.Verifi LinkFeedID: fmt.Sprintf("%x", feeds[1].id), NativeFeedID: fmt.Sprintf("%x", feeds[2].id), OCRKeyBundleID: n.OCR2BundleID, - ChainID: chainId, + ChainID: chainID, } // Create Mercury V3 Job @@ -316,7 +316,7 @@ type MercuryV3JobSpecData struct { // createMercuryV3BootstrapJob creates a bootstrap job specification using the provided data. func createMercuryV3BootstrapJob(data MercuryV3BootstrapJobSpecData) (name string, jobSpecStr string) { - name = fmt.Sprintf("boot-%s", data.FeedName) + name = "boot-" + data.FeedName data.Name = name fmt.Printf("Creating bootstrap job (%s):\nverifier address: %s\nfeed name: %s\nfeed ID: %s\nchain ID: %d\n", @@ -336,7 +336,7 @@ func createMercuryV3BootstrapJob(data MercuryV3BootstrapJobSpecData) (name strin // createMercuryV3OracleJob creates a Mercury V3 job specification using the provided data. func createMercuryV3OracleJob(data MercuryV3JobSpecData) (name string, jobSpecStr string) { - name = fmt.Sprintf("mercury-%s", data.FeedName) + name = "mercury-" + data.FeedName data.Name = name fmt.Printf("Creating ocr2 job(%s):\nOCR key bundle ID: %s\nverifier address: %s\nbridge: %s\nnodeCSAKey: %s\nfeed name: %s\nfeed ID: %s\nlink feed ID: %s\nnative feed ID: %s\nchain ID: %d\n", data.Name, data.OCRKeyBundleID, data.VerifierAddress, data.Bridge, data.NodeCSAKey, data.FeedName, data.FeedID, data.LinkFeedID, data.NativeFeedID, data.ChainID) @@ -368,6 +368,7 @@ func strToBytes32(str string) [32]byte { func upsertBridge(api *nodeAPI, name string, eaURL string) { u, err := url.Parse(eaURL) + helpers.PanicErr(err) url := models.WebURL(*u) // Confirmations and MinimumContractPayment are not used, so we can leave them as 0 b := bridges.BridgeTypeRequest{ @@ -441,7 +442,6 @@ func generateMercuryOCR2Config(nca []NodeKeys) MercuryOCR2Config { offchainPubKeysBytes := []ocrtypes.OffchainPublicKey{} for _, n := range nca { - pkBytesFixed := strToBytes32(n.OCR2OffchainPublicKey) offchainPubKeysBytes = append(offchainPubKeysBytes, ocrtypes.OffchainPublicKey(pkBytesFixed)) } @@ -491,12 +491,13 @@ func generateMercuryOCR2Config(nca []NodeKeys) MercuryOCR2Config { int(f), // f onchainConfig, ) + PanicErr(err) signerAddresses, err := evm.OnchainPublicKeyToAddress(signers) PanicErr(err) - var offChainTransmitters [][32]byte - for _, n := range nca { - offChainTransmitters = append(offChainTransmitters, strToBytes32(n.CSAPublicKey)) + offChainTransmitters := make([][32]byte, len(nca)) + for i, n := range nca { + offChainTransmitters[i] = strToBytes32(n.CSAPublicKey) } config := MercuryOCR2Config{ diff --git a/core/scripts/keystone/src/88_capabilities_registry_helpers.go b/core/scripts/keystone/src/88_capabilities_registry_helpers.go index 3e958f72ff9..6d70ae8ea96 100644 --- a/core/scripts/keystone/src/88_capabilities_registry_helpers.go +++ b/core/scripts/keystone/src/88_capabilities_registry_helpers.go @@ -5,6 +5,7 @@ import ( "context" "encoding/hex" "encoding/json" + "errors" "fmt" "log" "strings" @@ -56,7 +57,7 @@ func extractRevertReason(errData string, a abi.ABI) (string, string, error) { return errName, string(b), nil } } - return "", "", fmt.Errorf("revert Reason could not be found for given abistring") + return "", "", errors.New("revert Reason could not be found for given abistring") } func (c *CapabilityRegistryProvisioner) testCallContract(method string, args ...interface{}) error { @@ -260,7 +261,7 @@ func (b *baseCapability) BindToRegistry(reg kcr.CapabilitiesRegistryInterface) { func (b *baseCapability) GetHashedCID() [32]byte { if b.registry == nil { - panic(fmt.Errorf("registry not bound to capability, cannot get hashed capability ID")) + panic(errors.New("registry not bound to capability, cannot get hashed capability ID")) } return mustHashCapabilityID(b.registry, b.capability) @@ -417,7 +418,7 @@ func MergeCapabilitySets(sets ...CapabilitySet) CapabilitySet { } func (c *CapabilitySet) Capabilities() []kcr.CapabilitiesRegistryCapability { - var definitions []kcr.CapabilitiesRegistryCapability + definitions := make([]kcr.CapabilitiesRegistryCapability, 0, len(*c)) for _, cap := range *c { definitions = append(definitions, cap.Capability()) } @@ -426,7 +427,7 @@ func (c *CapabilitySet) Capabilities() []kcr.CapabilitiesRegistryCapability { } func (c *CapabilitySet) IDs() []string { - var strings []string + strings := make([]string, 0, len(*c)) for _, cap := range *c { strings = append(strings, fmt.Sprintf("%s@%s", cap.Capability().LabelledName, cap.Capability().Version)) } @@ -435,7 +436,7 @@ func (c *CapabilitySet) IDs() []string { } func (c *CapabilitySet) HashedIDs(reg kcr.CapabilitiesRegistryInterface) [][32]byte { - var ids [][32]byte + ids := make([][32]byte, 0, len(*c)) for _, cap := range *c { cap.BindToRegistry(reg) ids = append(ids, cap.GetHashedCID()) @@ -445,7 +446,7 @@ func (c *CapabilitySet) HashedIDs(reg kcr.CapabilitiesRegistryInterface) [][32]b } func (c *CapabilitySet) Configs(reg kcr.CapabilitiesRegistryInterface) []kcr.CapabilitiesRegistryCapabilityConfiguration { - var configs []kcr.CapabilitiesRegistryCapabilityConfiguration + configs := make([]kcr.CapabilitiesRegistryCapabilityConfiguration, 0, len(*c)) for _, cap := range *c { cap.BindToRegistry(reg) configs = append(configs, cap.Config()) @@ -504,7 +505,7 @@ func (n *NodeOperator) BindToRegistry(reg kcr.CapabilitiesRegistryInterface) { func (n *NodeOperator) SetCapabilityRegistryIssuedID(receipt *gethTypes.Receipt) uint32 { if n.reg == nil { - panic(fmt.Errorf("registry not bound to node operator, cannot set ID")) + panic(errors.New("registry not bound to node operator, cannot set ID")) } // We'll need more complex handling for multiple node operators // since we'll need to handle log ordering diff --git a/core/scripts/keystone/src/88_contracts_helpers.go b/core/scripts/keystone/src/88_contracts_helpers.go index 65271fca9dc..239ac940607 100644 --- a/core/scripts/keystone/src/88_contracts_helpers.go +++ b/core/scripts/keystone/src/88_contracts_helpers.go @@ -107,8 +107,8 @@ func LoadOnchainMeta(artefactsDir string, env helpers.Environment) *onchainMeta if !contractExists(s.OCR, env) { fmt.Printf("OCR contract at %s does not exist\n", s.OCR.Hex()) } else { - ocr3, err := ocr3_capability.NewOCR3Capability(s.OCR, env.Ec) - PanicErr(err) + ocr3, e := ocr3_capability.NewOCR3Capability(s.OCR, env.Ec) + PanicErr(e) hydrated.OCR3 = ocr3 } } @@ -117,8 +117,8 @@ func LoadOnchainMeta(artefactsDir string, env helpers.Environment) *onchainMeta if !contractExists(s.Forwarder, env) { fmt.Printf("Forwarder contract at %s does not exist\n", s.Forwarder.Hex()) } else { - fwdr, err := forwarder.NewKeystoneForwarder(s.Forwarder, env.Ec) - PanicErr(err) + fwdr, e := forwarder.NewKeystoneForwarder(s.Forwarder, env.Ec) + PanicErr(e) hydrated.Forwarder = fwdr } } @@ -127,8 +127,8 @@ func LoadOnchainMeta(artefactsDir string, env helpers.Environment) *onchainMeta if !contractExists(s.CapabilitiesRegistry, env) { fmt.Printf("CapabilityRegistry contract at %s does not exist\n", s.CapabilitiesRegistry.Hex()) } else { - cr, err := capabilities_registry.NewCapabilitiesRegistry(s.CapabilitiesRegistry, env.Ec) - PanicErr(err) + cr, e := capabilities_registry.NewCapabilitiesRegistry(s.CapabilitiesRegistry, env.Ec) + PanicErr(e) hydrated.CapabilitiesRegistry = cr } } @@ -140,8 +140,8 @@ func LoadOnchainMeta(artefactsDir string, env helpers.Environment) *onchainMeta fmt.Printf("Verifier contract at %s does not exist\n", s.Verifier.Hex()) hydrated.InitializedVerifierAddress = ZeroAddress } else { - verifier, err := verifierContract.NewVerifier(s.Verifier, env.Ec) - PanicErr(err) + verifier, e := verifierContract.NewVerifier(s.Verifier, env.Ec) + PanicErr(e) hydrated.Verifier = verifier } } @@ -151,8 +151,8 @@ func LoadOnchainMeta(artefactsDir string, env helpers.Environment) *onchainMeta fmt.Printf("VerifierProxy contract at %s does not exist\n", s.VerifierProxy.Hex()) hydrated.InitializedVerifierAddress = ZeroAddress } else { - verifierProxy, err := verifier_proxy.NewVerifierProxy(s.VerifierProxy, env.Ec) - PanicErr(err) + verifierProxy, e := verifier_proxy.NewVerifierProxy(s.VerifierProxy, env.Ec) + PanicErr(e) hydrated.VerifierProxy = verifierProxy } } @@ -175,11 +175,8 @@ func ContractsAlreadyDeployed(artefactsDir string) bool { } _, err = os.Stat(deployedContractsFilePath(artefactsDir)) - if err != nil { - return false - } - return true + return err == nil } func deployedContractsFilePath(artefactsDir string) string { diff --git a/core/scripts/keystone/src/88_jobspecs_helpers.go b/core/scripts/keystone/src/88_jobspecs_helpers.go index 4c106ead505..0e6cc3a043a 100644 --- a/core/scripts/keystone/src/88_jobspecs_helpers.go +++ b/core/scripts/keystone/src/88_jobspecs_helpers.go @@ -17,7 +17,7 @@ type WorkflowSpec struct { } type JobSpec struct { - Id string + ID string Name string BootstrapSpec BootSpec OffChainReporting2OracleSpec OCRSpec @@ -30,7 +30,7 @@ func upsertJob(api *nodeAPI, jobSpecName string, jobSpecStr string) { for _, job := range *jobs { if job.Name == jobSpecName { fmt.Printf("Job already exists: %s, replacing..\n", jobSpecName) - api.withArg(job.Id).mustExec(api.methods.DeleteJob) + api.withArg(job.ID).mustExec(api.methods.DeleteJob) break } } @@ -47,7 +47,7 @@ func clearJobs(api *nodeAPI) { jobs := mustJSON[[]JobSpec](jobsResp) for _, job := range *jobs { fmt.Printf("Deleting job: %s\n", job.Name) - api.withArg(job.Id).mustExec(api.methods.DeleteJob) + api.withArg(job.ID).mustExec(api.methods.DeleteJob) } fmt.Println("All jobs have been deleted.") } diff --git a/core/scripts/keystone/src/88_ocr_helpers.go b/core/scripts/keystone/src/88_ocr_helpers.go index f27d161ecb6..6ad8f0761f0 100644 --- a/core/scripts/keystone/src/88_ocr_helpers.go +++ b/core/scripts/keystone/src/88_ocr_helpers.go @@ -4,8 +4,9 @@ import ( "encoding/hex" "github.com/ethereum/go-ethereum/common" - ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" "github.com/smartcontractkit/libocr/offchainreporting2/types" + + ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" ) func ocrConfToContractConfig(ocrConf ksdeploy.Orc2drOracleConfig, configCount uint32) types.ContractConfig { diff --git a/core/scripts/keystone/src/99_app.go b/core/scripts/keystone/src/99_app.go index 6e7f134d9e6..c4b508277d9 100644 --- a/core/scripts/keystone/src/99_app.go +++ b/core/scripts/keystone/src/99_app.go @@ -13,10 +13,11 @@ import ( "strings" "sync" - clsessions "github.com/smartcontractkit/chainlink/v2/core/sessions" "github.com/urfave/cli" "go.uber.org/zap/zapcore" + clsessions "github.com/smartcontractkit/chainlink/v2/core/sessions" + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "github.com/smartcontractkit/chainlink/v2/core/cmd" clcmd "github.com/smartcontractkit/chainlink/v2/core/cmd" @@ -49,7 +50,10 @@ func newApp(n NodeWthCreds, writer io.Writer) (*clcmd.Shell, *cli.App) { &cmd.MemoryCookieStore{}, logger, ) - cookieAuth.Authenticate(context.Background(), sr) + + _, err = cookieAuth.Authenticate(context.Background(), sr) + PanicErr(err) + http := cmd.NewAuthenticatedHTTPClient( logger, clientOpts, diff --git a/core/scripts/keystone/src/99_crib_client.go b/core/scripts/keystone/src/99_crib_client.go index 0bf1610a4dd..ec977a9384f 100644 --- a/core/scripts/keystone/src/99_crib_client.go +++ b/core/scripts/keystone/src/99_crib_client.go @@ -58,9 +58,6 @@ func (m *CribClient) getCLNodes() ([]NodeWthCreds, error) { Host: deployment.Host, Path: "", } - if err != nil { - return nil, err - } node := NodeWthCreds{ // We dont handle both in-cluster and out-of-cluster deployments diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index 732578a8dae..9fdd6d877a1 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -104,7 +104,7 @@ type OCR2AptosKBTrimmed struct { AptosOnchainPublicKey string `json:"AptosOnchainPublicKey"` // ocr2on_aptos_ } -func mustFetchNodeKeys(chainId int64, nodes []NodeWthCreds, createAptosKeys bool) []NodeKeys { +func mustFetchNodeKeys(chainID int64, nodes []NodeWthCreds, createAptosKeys bool) []NodeKeys { nodeKeys := []NodeKeys{} for _, n := range nodes { @@ -112,12 +112,12 @@ func mustFetchNodeKeys(chainId int64, nodes []NodeWthCreds, createAptosKeys bool // Get eth key eKey := api.mustExec(api.methods.ListETHKeys) ethKeys := mustJSON[[]presenters.ETHKeyResource](eKey) - ethAddress, err := findFirstGoodEthKeyAddress(chainId, *ethKeys) + ethAddress, err := findFirstGoodEthKeyAddress(chainID, *ethKeys) helpers.PanicErr(err) var aptosAccount string if createAptosKeys { - aptosAccount = getOrCreateAptosKey(api, err) + aptosAccount = getOrCreateAptosKey(api) } // Get p2p key @@ -213,10 +213,10 @@ func createAptosOCR2KB(ocr2Bundles *cmd.OCR2KeyBundlePresenters, expectedBundleL // getOrCreateAptosKey returns the Aptos account of the node. // // If the node has no Aptos keys, it creates one and returns the account. -func getOrCreateAptosKey(api *nodeAPI, err error) string { +func getOrCreateAptosKey(api *nodeAPI) string { api.output.Reset() aKeysClient := cmd.NewAptosKeysClient(api.methods) - err = aKeysClient.ListKeys(&cli.Context{App: api.app}) + err := aKeysClient.ListKeys(&cli.Context{App: api.app}) helpers.PanicErr(err) var aptosKeys []presenters.AptosKeyResource helpers.PanicErr(json.Unmarshal(api.output.Bytes(), &aptosKeys)) diff --git a/core/scripts/keystone/src/99_k8s_client.go b/core/scripts/keystone/src/99_k8s_client.go index 4844b88edba..e4885e53a19 100644 --- a/core/scripts/keystone/src/99_k8s_client.go +++ b/core/scripts/keystone/src/99_k8s_client.go @@ -2,6 +2,7 @@ package src import ( "context" + "errors" "fmt" "log" "sort" @@ -77,7 +78,7 @@ func (m *K8sClient) GetDeploymentsWithConfigMap() ([]DeploymentWithConfigMap, er return nil, err } if len(deployments.Items) == 0 { - return nil, fmt.Errorf("no deployments found, is your nodeset deployed?") + return nil, errors.New("no deployments found, is your nodeset deployed?") } deploymentsWithConfigMaps := []DeploymentWithConfigMap{} @@ -86,7 +87,7 @@ func (m *K8sClient) GetDeploymentsWithConfigMap() ([]DeploymentWithConfigMap, er return nil, err } if len(ingressList.Items) == 0 { - return nil, fmt.Errorf("no ingress found, is your nodeset deployed?") + return nil, errors.New("no ingress found, is your nodeset deployed?") } for _, deployment := range deployments.Items { diff --git a/core/scripts/keystone/src/external-adapter/99_external_adapter.go b/core/scripts/keystone/src/external-adapter/99_external_adapter.go index 537091bb1ac..8af035f30fd 100644 --- a/core/scripts/keystone/src/external-adapter/99_external_adapter.go +++ b/core/scripts/keystone/src/external-adapter/99_external_adapter.go @@ -119,7 +119,10 @@ func externalAdapter(initialValue float64, port string, pctBounds float64) *http // Create and start the test server ea := &httptest.Server{ Listener: listener, - Config: &http.Server{Handler: handler}, + Config: &http.Server{ + Handler: handler, + ReadHeaderTimeout: 5 * time.Second, + }, } ea.Start() @@ -132,6 +135,7 @@ func externalAdapter(initialValue float64, port string, pctBounds float64) *http // It ensures that the value stays within the specified bounds. func adjustValue(start, step, floor, ceiling float64) float64 { // Randomly choose to increase or decrease the value + // #nosec G404 if rand.Intn(2) == 0 { step = -step } diff --git a/shell.nix b/shell.nix index e3b187dcd96..5d5e6f53312 100644 --- a/shell.nix +++ b/shell.nix @@ -65,7 +65,6 @@ in ''} ''; - GOROOT = "${go}/share/go"; PGDATA = "db"; CL_DATABASE_URL = "postgresql://chainlink:chainlink@localhost:5432/chainlink_test?sslmode=disable"; } From 9168733343f2ca391128ef4a44b7dd9e907cae96 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 31 Oct 2024 21:03:25 -0700 Subject: [PATCH 090/117] Add changeset --- .changeset/loud-birds-remain.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/loud-birds-remain.md diff --git a/.changeset/loud-birds-remain.md b/.changeset/loud-birds-remain.md new file mode 100644 index 00000000000..eb1e8f8a9ca --- /dev/null +++ b/.changeset/loud-birds-remain.md @@ -0,0 +1,5 @@ +--- +"chainlink": minor +--- + +#internal Add unexposed shell cmd for updating a bridge From 39fa03559c3de1904efc336e131d0da2af8df51e Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 31 Oct 2024 21:49:58 -0700 Subject: [PATCH 091/117] Add additional logging around node sets and key fetching --- core/scripts/keystone/src/01_provision_keystone.go | 1 + core/scripts/keystone/src/99_fetch_keys.go | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/scripts/keystone/src/01_provision_keystone.go b/core/scripts/keystone/src/01_provision_keystone.go index 3ea1504660c..c5c5989d7f8 100644 --- a/core/scripts/keystone/src/01_provision_keystone.go +++ b/core/scripts/keystone/src/01_provision_keystone.go @@ -67,6 +67,7 @@ func (g *provisionKeystone) Run(args []string) { /// when it comes to nodesets err = os.RemoveAll(*nodeSetsPath) PanicErr(err) + fmt.Println("Collecting node sets...") nodeSets := downloadNodeSets(*chainID, *nodeSetsPath, *nodeSetSize) if *clean { diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index 9fdd6d877a1..57ee0df3d26 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -110,6 +110,7 @@ func mustFetchNodeKeys(chainID int64, nodes []NodeWthCreds, createAptosKeys bool for _, n := range nodes { api := newNodeAPI(n) // Get eth key + fmt.Printf("Fetching ETH keys for node %s\n", n.ServiceName) eKey := api.mustExec(api.methods.ListETHKeys) ethKeys := mustJSON[[]presenters.ETHKeyResource](eKey) ethAddress, err := findFirstGoodEthKeyAddress(chainID, *ethKeys) @@ -121,6 +122,7 @@ func mustFetchNodeKeys(chainID int64, nodes []NodeWthCreds, createAptosKeys bool } // Get p2p key + fmt.Printf("Fetching P2P key for node %s\n", n.ServiceName) p2pKeys := api.mustExec(api.methods.ListP2PKeys) p2pKey := mustJSON[[]presenters.P2PKeyResource](p2pKeys) if len(*p2pKey) != 1 { @@ -135,6 +137,7 @@ func mustFetchNodeKeys(chainID int64, nodes []NodeWthCreds, createAptosKeys bool expectedBundleLen := 1 // evm key bundles + fmt.Printf("Fetching OCR2 EVM key bundles for node %s\n", n.ServiceName) ocr2EvmBundles := getTrimmedEVMOCR2KBs(*ocr2Bundles) evmBundleLen := len(ocr2EvmBundles) if evmBundleLen < expectedBundleLen { @@ -150,9 +153,11 @@ func mustFetchNodeKeys(chainID int64, nodes []NodeWthCreds, createAptosKeys bool // aptos key bundles var ocr2AptosBundles []OCR2AptosKBTrimmed if createAptosKeys { + fmt.Printf("Fetching OCR2 Aptos key bundles for node %s\n", n.ServiceName) ocr2AptosBundles = createAptosOCR2KB(ocr2Bundles, expectedBundleLen, api) } + fmt.Printf("Fetching CSA keys for node %s\n", n.ServiceName) csaKeys := api.mustExec(api.methods.ListCSAKeys) csaKeyResources := mustJSON[[]presenters.CSAKeyResource](csaKeys) csaPubKey, err := findFirstCSAPublicKey(*csaKeyResources) @@ -237,7 +242,6 @@ func getOrCreateAptosKey(api *nodeAPI) string { PanicErr(errors.New("node must have single aptos key")) } - fmt.Printf("Node has aptos account %s\n", aptosKeys[0].Account) aptosAccount := aptosKeys[0].Account api.output.Reset() @@ -274,9 +278,6 @@ func findFirstCSAPublicKey(csaKeyResources []presenters.CSAKeyResource) (string, func findFirstGoodEthKeyAddress(chainID int64, ethKeys []presenters.ETHKeyResource) (string, error) { for _, ethKey := range ethKeys { if ethKey.EVMChainID.Equal(ubig.NewI(chainID)) && !ethKey.Disabled { - if ethKey.EthBalance == nil || ethKey.EthBalance.IsZero() { - fmt.Println("WARN: selected ETH address has zero balance", ethKey.Address) - } return ethKey.Address, nil } } From 9f251f01494cdaaf22065bf9e837be0b8a7cf925 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:52:29 -0700 Subject: [PATCH 092/117] Run gomodtidy --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 009e4e2d6f1..876fc8ebc9d 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -298,7 +298,7 @@ require ( github.com/smartcontractkit/chainlink-protos/orchestrator v0.3.0 // indirect github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241104202120-39cabce465f6 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241017135645-176a23722fd8 // indirect - github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.12 + github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13 github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20241009055228-33d0c0bf38de // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index fa4e8f11c14..e9e3495d45b 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -946,8 +946,8 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= -github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8= +github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= @@ -1108,8 +1108,8 @@ github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241104202120-39cabce465f github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241104202120-39cabce465f6/go.mod h1:iZugccCLpPWtcGiR/8gurre2j3RtyKnqd1FcVR0NzQw= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241017135645-176a23722fd8 h1:B4DFdk6MGcQnoCjjMBCx7Z+GWQpxRWJ4O8W/dVJyWGA= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241017135645-176a23722fd8/go.mod h1:WkBqgBo+g34Gm5vWkDDl8Fh3Mzd7bF5hXp7rryg0t5o= -github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.12 h1:B3+KM0cNxEtynbKnvixHnW5oUCq1Dv3b0gTKYRt3dOs= -github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.12/go.mod h1:Mi8q2e6gSnBhVdYehNesfh3aJMibGpS/nzgfN1yHoFY= +github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13 h1:T0kbw07Vb6xUyA9MIJZfErMgWseWi1zf7cYvRpoq7ug= +github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13/go.mod h1:1CKUOzoK+Ga19WuhRH9pxZ+qUUnrlIx108VEA6qSzeQ= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 h1:NzZGjaqez21I3DU7objl3xExTH4fxYvzTqar8DC6360= From 82c30fa007372d00c3f115d5efe3fda9c1051626 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Fri, 1 Nov 2024 15:46:43 -0700 Subject: [PATCH 093/117] Fix additional lints --- core/scripts/keystone/src/02_provision_crib.go | 2 +- .../keystone/src/02_provision_streams_trigger_capability.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/scripts/keystone/src/02_provision_crib.go b/core/scripts/keystone/src/02_provision_crib.go index e07b5c28aed..bf3a31f8b7e 100644 --- a/core/scripts/keystone/src/02_provision_crib.go +++ b/core/scripts/keystone/src/02_provision_crib.go @@ -85,7 +85,7 @@ func writeCribConfig(chart Helm, outputPath string) { helpers.PanicErr(err) } else { ensureArtefactsDir(filepath.Dir(outputPath)) - err = os.WriteFile(filepath.Join(outputPath), yamlData, 0600) + err = os.WriteFile(outputPath, yamlData, 0600) helpers.PanicErr(err) } } diff --git a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go index e0c33e6f710..f476319362b 100644 --- a/core/scripts/keystone/src/02_provision_streams_trigger_capability.go +++ b/core/scripts/keystone/src/02_provision_streams_trigger_capability.go @@ -454,7 +454,7 @@ func generateMercuryOCR2Config(nca []NodeKeys) MercuryOCR2Config { identities := []confighelper.OracleIdentityExtra{} for index := range nca { - transmitterAccount := ocrtypes.Account(fmt.Sprintf("%x", nca[index].CSAPublicKey[:])) + transmitterAccount := ocrtypes.Account(nca[index].CSAPublicKey) identities = append(identities, confighelper.OracleIdentityExtra{ OracleIdentity: confighelper.OracleIdentity{ From 19404f117adf42a2e511957c62fe50b2a688b2dc Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Fri, 1 Nov 2024 15:46:59 -0700 Subject: [PATCH 094/117] Harden API request logic --- core/scripts/keystone/src/99_app.go | 217 ++++++++++++++++++++++++---- 1 file changed, 192 insertions(+), 25 deletions(-) diff --git a/core/scripts/keystone/src/99_app.go b/core/scripts/keystone/src/99_app.go index c4b508277d9..cc6d471fb90 100644 --- a/core/scripts/keystone/src/99_app.go +++ b/core/scripts/keystone/src/99_app.go @@ -7,21 +7,22 @@ import ( "errors" "flag" "io" + "net/http" "net/url" "reflect" "runtime" "strings" "sync" + "time" "github.com/urfave/cli" "go.uber.org/zap/zapcore" - clsessions "github.com/smartcontractkit/chainlink/v2/core/sessions" - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "github.com/smartcontractkit/chainlink/v2/core/cmd" clcmd "github.com/smartcontractkit/chainlink/v2/core/cmd" "github.com/smartcontractkit/chainlink/v2/core/logger" + clsessions "github.com/smartcontractkit/chainlink/v2/core/sessions" ) // Package-level cache and mutex @@ -51,26 +52,17 @@ func newApp(n NodeWthCreds, writer io.Writer) (*clcmd.Shell, *cli.App) { logger, ) - _, err = cookieAuth.Authenticate(context.Background(), sr) - PanicErr(err) - - http := cmd.NewAuthenticatedHTTPClient( - logger, - clientOpts, - cookieAuth, - sr, - ) + http := NewRetryableAuthenticatedHTTPClient(logger, clientOpts, cookieAuth, sr) // Set the log level back to info for the shell logger.SetLogLevel(zapcore.InfoLevel) - client := &clcmd.Shell{ - Logger: logger, - Renderer: clcmd.RendererJSON{Writer: writer}, - AppFactory: clcmd.ChainlinkAppFactory{}, - Runner: clcmd.ChainlinkRunner{}, - HTTP: http, - CookieAuthenticator: cookieAuth, - CloseLogger: closeLggr, + Logger: logger, + Renderer: clcmd.RendererJSON{Writer: writer}, + AppFactory: clcmd.ChainlinkAppFactory{}, + Runner: clcmd.ChainlinkRunner{}, + HTTP: http, + + CloseLogger: closeLggr, } app := clcmd.NewApp(client) return client, app @@ -82,6 +74,7 @@ type nodeAPI struct { output *bytes.Buffer fs *flag.FlagSet clientMethod func(*cli.Context) error + logger logger.Logger } func newNodeAPI(n NodeWthCreds) *nodeAPI { @@ -104,6 +97,7 @@ func newNodeAPI(n NodeWthCreds) *nodeAPI { methods: methods, app: app, fs: flag.NewFlagSet("test", flag.ContinueOnError), + logger: methods.Logger.Named("NodeAPI"), } // Store the new nodeAPI in the cache @@ -142,7 +136,6 @@ func (c *nodeAPI) exec(clientMethod ...func(*cli.Context) error) ([]byte, error) PanicErr(errors.New("Only one client method allowed")) } - c.output.Reset() defer c.output.Reset() defer func() { c.fs = flag.NewFlagSet("test", flag.ContinueOnError) @@ -152,13 +145,46 @@ func (c *nodeAPI) exec(clientMethod ...func(*cli.Context) error) ([]byte, error) if c.clientMethod == nil { c.clientMethod = clientMethod[0] } - ctx := cli.NewContext(c.app, c.fs, nil) - err := c.clientMethod(ctx) - if err != nil { - return nil, err + + retryCount := 3 + for i := 0; i < retryCount; i++ { + c.logger.Tracew("Attempting API request", "attempt", i+1, "maxAttempts", retryCount) + c.output.Reset() + ctx := cli.NewContext(c.app, c.fs, nil) + err := c.clientMethod(ctx) + + if err == nil { + c.logger.Tracew("API request completed successfully", "attempt", i+1) + return c.output.Bytes(), nil + } + + if !strings.Contains(err.Error(), "invalid character '<' looking for beginning of value") { + c.logger.Tracew("API request failed with non-retriable error", + "attempt", i+1, + "err", err, + ) + return nil, err + } + + c.logger.Warnw("Encountered 504 gateway error during API request, retrying", + "attempt", i+1, + "maxAttempts", retryCount, + "err", err, + ) + + if i == retryCount-1 { + c.logger.Error("Failed to complete API request after all retry attempts") + return nil, err + } + + c.logger.Tracew("Waiting before retry attempt", + "attempt", i+1, + "waitTime", "1s", + ) + time.Sleep(1 * time.Second) } - return c.output.Bytes(), nil + return nil, errors.New("API request failed after retries") } func (c *nodeAPI) mustExec(clientMethod ...func(*cli.Context) error) []byte { @@ -220,3 +246,144 @@ func mustJSON[T any](bytes []byte) *T { } return typedPayload } + +type retryableAuthenticatedHTTPClient struct { + client cmd.HTTPClient + logger logger.Logger +} + +func NewRetryableAuthenticatedHTTPClient(lggr logger.Logger, clientOpts clcmd.ClientOpts, cookieAuth cmd.CookieAuthenticator, sessionRequest clsessions.SessionRequest) cmd.HTTPClient { + return &retryableAuthenticatedHTTPClient{ + client: cmd.NewAuthenticatedHTTPClient(lggr, clientOpts, cookieAuth, sessionRequest), + logger: lggr.Named("RetryableAuthenticatedHTTPClient"), + } +} + +func logBody(body io.Reader) (string, io.Reader) { + if body == nil { + return "", nil + } + + var buf bytes.Buffer + tee := io.TeeReader(body, &buf) + bodyBytes, _ := io.ReadAll(tee) + return string(bodyBytes), bytes.NewReader(buf.Bytes()) +} + +func logResponse(logger logger.Logger, resp *http.Response) { + if resp == nil { + logger.Trace("Response was nil") + return + } + + bodyBytes, err := io.ReadAll(resp.Body) + if err != nil { + logger.Errorw("Failed to read response body for logging", "err", err) + return + } + // Replace the body so it can be read again by the caller + resp.Body = io.NopCloser(bytes.NewReader(bodyBytes)) + + logger.Tracew("Response details", + "statusCode", resp.StatusCode, + "status", resp.Status, + "headers", resp.Header, + "body", string(bodyBytes), + ) +} + +func (h *retryableAuthenticatedHTTPClient) Get(ctx context.Context, path string, headers ...map[string]string) (*http.Response, error) { + h.logger.Tracew("Making GET request", + "path", path, + "headers", headers, + ) + return h.doRequestWithRetry(ctx, func() (*http.Response, error) { + return h.client.Get(ctx, path, headers...) + }) +} + +func (h *retryableAuthenticatedHTTPClient) Post(ctx context.Context, path string, body io.Reader) (*http.Response, error) { + bodyStr, newBody := logBody(body) + h.logger.Tracew("Making POST request", + "path", path, + "body", bodyStr, + ) + return h.doRequestWithRetry(ctx, func() (*http.Response, error) { + return h.client.Post(ctx, path, newBody) + }) +} + +func (h *retryableAuthenticatedHTTPClient) Put(ctx context.Context, path string, body io.Reader) (*http.Response, error) { + bodyStr, newBody := logBody(body) + h.logger.Tracew("Making PUT request", + "path", path, + "body", bodyStr, + ) + return h.doRequestWithRetry(ctx, func() (*http.Response, error) { + return h.client.Put(ctx, path, newBody) + }) +} + +func (h *retryableAuthenticatedHTTPClient) Patch(ctx context.Context, path string, body io.Reader, headers ...map[string]string) (*http.Response, error) { + bodyStr, newBody := logBody(body) + h.logger.Tracew("Making PATCH request", + "path", path, + "headers", headers, + "body", bodyStr, + ) + return h.doRequestWithRetry(ctx, func() (*http.Response, error) { + return h.client.Patch(ctx, path, newBody, headers...) + }) +} + +func (h *retryableAuthenticatedHTTPClient) Delete(ctx context.Context, path string) (*http.Response, error) { + h.logger.Tracew("Making DELETE request", + "path", path, + ) + return h.doRequestWithRetry(ctx, func() (*http.Response, error) { + return h.client.Delete(ctx, path) + }) +} + +func (h *retryableAuthenticatedHTTPClient) doRequestWithRetry(ctx context.Context, req func() (*http.Response, error)) (*http.Response, error) { + retryCount := 3 + for i := 0; i < retryCount; i++ { + h.logger.Tracew("Attempting request", "attempt", i+1, "maxAttempts", retryCount) + + response, err := req() + logResponse(h.logger, response) + + if err == nil || !strings.Contains(err.Error(), "invalid character '<' looking for beginning of value") { + if err != nil { + h.logger.Warn("Request completed with error", + "attempt", i+1, + "err", err, + ) + } else { + h.logger.Tracew("Request completed successfully", + "attempt", i+1, + "statusCode", response.StatusCode, + ) + } + return response, err + } + + h.logger.Warnw("Encountered 504 error during request, retrying", + "attempt", i+1, + "maxAttempts", retryCount, + "err", err, + ) + + if i == retryCount-1 { + h.logger.Error("Failed to complete request after all retry attempts") + return response, err + } + + h.logger.Tracew("Waiting before retry attempt", + "attempt", i+1, + "waitTime", "1s", + ) + time.Sleep(1 * time.Second) + } + return nil, errors.New("request failed after retries") +} From 3386abccc000b0ede8056e980fa6f140b96ab882 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 4 Nov 2024 18:15:50 -0800 Subject: [PATCH 095/117] Readme WIP --- core/scripts/keystone/README.md | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/core/scripts/keystone/README.md b/core/scripts/keystone/README.md index 9bf6adfff4e..6416d87a9b1 100644 --- a/core/scripts/keystone/README.md +++ b/core/scripts/keystone/README.md @@ -76,16 +76,3 @@ The next step is to deploy the OCR3 job specs to the chainlink node cluster. Thi While we already have the chainlink node cluster deployed, we need to update the TOML configuration for each node to configure the `ChainWriter`. After updated TOML configuration overrides are generated per node, the cluster is redeployed such that the updates that effect without wiping the databases. - -## Future Work - -### Keystone workflow deployment -Workflow style job spec deployments are not currently support, but it should be a minor modification to the existing OCR job spec deployment logic - -### Multi-DON support -Multiple DONs are not currently supported -- the devspace profile will need to be expanded so that we have multiple deployments, one per DON. -- network policy / open ports will likely have to be adjusted in the chart - -### Smarter jobspec deployment -Currently, job specs deployment logic is dumb. The scripts don't check if the jobspec to deploy already exists. If you need to redeploy a job spec that has the same name as a currently uploaded one, you'll want to delete the existing job specs via `./04_delete_ocr3_jobs.sh`. From c5a8411479b05d90f22898c04c92cc3eaab4e461 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 7 Nov 2024 18:13:10 -0800 Subject: [PATCH 096/117] Clean up lints, remove old readme --- core/scripts/go.mod | 2 +- core/scripts/keystone/README.md | 78 ------------------- .../src/02_provision_ocr3_capability.go | 3 +- core/scripts/keystone/src/99_app.go | 2 +- go.md | 15 ++-- 5 files changed, 12 insertions(+), 88 deletions(-) delete mode 100644 core/scripts/keystone/README.md diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 876fc8ebc9d..d23a393d734 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -27,7 +27,7 @@ require ( github.com/smartcontractkit/chainlink-common v0.3.1-0.20241107134205-25e45ecd73ba github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e github.com/smartcontractkit/chainlink/deployment v0.0.0-00010101000000-000000000000 - github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 + github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20241106193309-5560cd76211a github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 diff --git a/core/scripts/keystone/README.md b/core/scripts/keystone/README.md deleted file mode 100644 index 6416d87a9b1..00000000000 --- a/core/scripts/keystone/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# Provisioning a CRIB keystone cluster - -Kudos to Functions team for inspiration. - -This document outlines the steps to provision a CRIB keystone cluster for testing OCR3. - -## Pre-requisites - -### Blockchain Node - -An HTTP URL to a blockchain node, such as a Geth node. This should be the same blockchain node that you used to deploy the chainlink node cluster. - -### Private Key - -A private key to a testing wallet to use for deployment and funding. This wallet should have some native token on the chain you're deploying to. For Sepolia, around 2 ETH should be sufficient. - -The easiest way to set this up is to download [Metamask](https://metamask.io/) and create a new wallet. Once you have created a wallet, you can export the private key by clicking on the three dots next to the wallet name, selecting "Account Details", and then "Show Private Key". - -## Usage - -### Your first deployment - -Using devspace, we can deploy a cluster and provision it via the `keystone` devspace profile. You'll want to follow the instructions in the [CRIB README](../../../crib/README.md) to set up your environment and deploy the cluster. - -**NOTE**: You'll want to deploy using the `keystone` profile, not the default profile file. - -```bash -# From /crib -devspace deploy --profile keystone -``` - -For convenience, setting the TTL to be a much longer value is helpful, otherwise the testnet native tokens that you send to nodes will be lost. You can set this in your crib `.env` file, or interactively via: - -```bash -# From /crib -devspace run ttl ${namespace} 7d -``` - -Everytime the interactive command is run, the TTL is reset. - -### Iterate -Let's say you made some changes to the codebase, and you want to see that reflected within the cluster. Simply redeploy via: -```bash -devspace deploy --profile keystone -``` - -### Restarting from a fresh slate - -If you want to redeploy all resources, then you'll want to do the following: - -```bash -# From /crib -devspace purge --profile keystone # Remove all k8s resources -./cribbit.sh crib- # Purge currently leaves some hanging resources, make a new namespace -devspace deploy --profile keysone --clean # Wipe any keystone related persisted data, like artefacts and caches. -``` - -## What does Provisioning a CRIB keystone cluster do? - -### Provision On-Chain Resources - -This will provision on-chain resources, namely: - -1. Deploy the forwarder contract -2. Deploy OCR3 config contract -3. Setting the configuration for the OCR3 contract -4. Funding transmitters with native tokens - -When the on-chain resources are deployed, a json file within `artefacts` will be generated. This file will contain the addresses of the forwarder contract, the OCR3 config contract, and the block number at which the configuration was set. Be careful about deleting this file, as if you lose it, you will need to redeploy the contracts and run through all proceeding steps. - -### Job Spec Deployment - -The next step is to deploy the OCR3 job specs to the chainlink node cluster. This will create a bootstrapping job for the first node of the cluster (determined via alphabetical order) and an OCR job for each other node in the cluster. - -### Update Per-Node TOML Configuration - -While we already have the chainlink node cluster deployed, we need to update the TOML configuration for each node to configure the `ChainWriter`. -After updated TOML configuration overrides are generated per node, the cluster is redeployed such that the updates that effect without wiping the databases. diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability.go b/core/scripts/keystone/src/02_provision_ocr3_capability.go index f994de49248..0a2b7cd4f19 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability.go @@ -67,7 +67,8 @@ func deployOCR3Contract( cc := ocrConfToContractConfig(ocrConf, latestConfigDigestBytes.ConfigCount) digester := evm.OCR3CapabilityOffchainConfigDigester{ - ChainID: uint64(env.ChainID), + // ignore integer overflow + ChainID: uint64(env.ChainID), // nolint:gosec ContractAddress: o.OCR3.Address(), } digest, err := digester.ConfigDigest(context.Background(), cc) diff --git a/core/scripts/keystone/src/99_app.go b/core/scripts/keystone/src/99_app.go index cc6d471fb90..313dc90f1f6 100644 --- a/core/scripts/keystone/src/99_app.go +++ b/core/scripts/keystone/src/99_app.go @@ -345,7 +345,7 @@ func (h *retryableAuthenticatedHTTPClient) Delete(ctx context.Context, path stri }) } -func (h *retryableAuthenticatedHTTPClient) doRequestWithRetry(ctx context.Context, req func() (*http.Response, error)) (*http.Response, error) { +func (h *retryableAuthenticatedHTTPClient) doRequestWithRetry(_ context.Context, req func() (*http.Response, error)) (*http.Response, error) { retryCount := 3 for i := 0; i < retryCount; i++ { h.logger.Tracew("Attempting request", "attempt", i+1, "maxAttempts", retryCount) diff --git a/go.md b/go.md index e2c5ae57bdd..ee451a8f736 100644 --- a/go.md +++ b/go.md @@ -204,6 +204,8 @@ flowchart LR chainlink/core/scripts --> chainlink-protos/orchestrator chainlink/core/scripts --> chainlink-solana chainlink/core/scripts --> chainlink-starknet/relayer + chainlink/core/scripts --> chainlink-testing-framework/lib + click chainlink-testing-framework/lib href "https://github.com/smartcontractkit/chainlink-testing-framework" chainlink/core/scripts --> chainlink/deployment click chainlink/deployment href "https://github.com/smartcontractkit/chainlink" chainlink/core/scripts --> chainlink/v2 @@ -214,13 +216,18 @@ flowchart LR chainlink/core/scripts --> tdh2/go/tdh2 chainlink/core/scripts --> wsrpc ccip-owner-contracts --> chain-selectors + chainlink-testing-framework/lib --> chainlink-testing-framework/seth + click chainlink-testing-framework/seth href "https://github.com/smartcontractkit/chainlink-testing-framework" + chainlink-testing-framework/lib --> chainlink-testing-framework/wasp + click chainlink-testing-framework/wasp href "https://github.com/smartcontractkit/chainlink-testing-framework" + chainlink-testing-framework/lib --> chainlink-testing-framework/lib/grafana + click chainlink-testing-framework/lib/grafana href "https://github.com/smartcontractkit/chainlink-testing-framework" chainlink/deployment --> ccip-owner-contracts chainlink/deployment --> chain-selectors chainlink/deployment --> chainlink-ccip chainlink/deployment --> chainlink-common chainlink/deployment --> chainlink-protos/job-distributor chainlink/deployment --> chainlink-testing-framework/lib - click chainlink-testing-framework/lib href "https://github.com/smartcontractkit/chainlink-testing-framework" chainlink/deployment --> chainlink/v2 chainlink/deployment --> libocr chainlink/deployment --> chainlink-automation @@ -231,18 +238,12 @@ flowchart LR chainlink/deployment --> chainlink-solana chainlink/deployment --> chainlink-starknet/relayer chainlink/deployment --> chainlink-testing-framework/lib/grafana - click chainlink-testing-framework/lib/grafana href "https://github.com/smartcontractkit/chainlink-testing-framework" chainlink/deployment --> chainlink-testing-framework/seth - click chainlink-testing-framework/seth href "https://github.com/smartcontractkit/chainlink-testing-framework" chainlink/deployment --> chainlink-testing-framework/wasp - click chainlink-testing-framework/wasp href "https://github.com/smartcontractkit/chainlink-testing-framework" chainlink/deployment --> grpc-proxy chainlink/deployment --> tdh2/go/ocr2/decryptionplugin chainlink/deployment --> tdh2/go/tdh2 chainlink/deployment --> wsrpc - chainlink-testing-framework/lib --> chainlink-testing-framework/seth - chainlink-testing-framework/lib --> chainlink-testing-framework/wasp - chainlink-testing-framework/lib --> chainlink-testing-framework/lib/grafana chainlink-testing-framework/seth --> seth click seth href "https://github.com/smartcontractkit/seth" chainlink-testing-framework/wasp --> chainlink-testing-framework/lib/grafana From 62f99396be7bf5c98e3ad553b0d3be068f909999 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 11 Nov 2024 20:21:42 -0800 Subject: [PATCH 097/117] Increase retry interval --- core/scripts/keystone/src/99_app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/99_app.go b/core/scripts/keystone/src/99_app.go index 313dc90f1f6..8505de1ba85 100644 --- a/core/scripts/keystone/src/99_app.go +++ b/core/scripts/keystone/src/99_app.go @@ -181,7 +181,7 @@ func (c *nodeAPI) exec(clientMethod ...func(*cli.Context) error) ([]byte, error) "attempt", i+1, "waitTime", "1s", ) - time.Sleep(1 * time.Second) + time.Sleep(3 * time.Second) } return nil, errors.New("API request failed after retries") From ed1151c295bb44c0ce7e65f67a2102293c504d89 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 11 Nov 2024 23:02:01 -0800 Subject: [PATCH 098/117] Update goreleaser to 2.4.4-pro --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index a14b4a5d0a3..964b7557b08 100644 --- a/flake.lock +++ b/flake.lock @@ -45,11 +45,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1726594821, - "narHash": "sha256-ORImH+i+zOCMOdztNDqGDbyyFRC/FKmgbX8w50TNbQY=", + "lastModified": 1730775176, + "narHash": "sha256-Eeo4NoqoW+/lTiy19l4ndM9StQ5WpgDdjwqeGX1w6eM=", "owner": "goreleaser", "repo": "nur", - "rev": "bd2ee272ddfffbda9377a472131728e83ce2332d", + "rev": "fd8a59e1d41f904bd0c12ba04192c8eb1f4cff0f", "type": "github" }, "original": { From cd8b4a639fd6f6cabd5fe42ebf4aacdcec2de5ce Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 11 Nov 2024 23:05:22 -0800 Subject: [PATCH 099/117] Handle non postfix path --- tools/bin/goreleaser_utils | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/bin/goreleaser_utils b/tools/bin/goreleaser_utils index 52e37cefd51..0bf745d5a58 100755 --- a/tools/bin/goreleaser_utils +++ b/tools/bin/goreleaser_utils @@ -27,8 +27,10 @@ before_hook() { # linux_arm64, rather than being suffixless on native platforms if [ "$GOARCH" = "arm64" ]; then if [ -d "$BIN_DIR/linux_arm64" ]; then + cp "$BIN_DIR/linux_arm64"/chainlink* "$PLUGIN_DIR" + elif [ -d "$BIN_DIR/linux_arm64_v8.0" ]; then cp "$BIN_DIR/linux_arm64_v8.0"/chainlink* "$PLUGIN_DIR" - else + else cp "$BIN_DIR"/chainlink* "$PLUGIN_DIR" fi # Call patchelf --set-interpreter on all plugins From 47bd57ace99efb975a3a583e206b479923fb28a5 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 11 Nov 2024 23:45:42 -0800 Subject: [PATCH 100/117] Resolve darwin shell hook from git root --- shell.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell.nix b/shell.nix index 5d5e6f53312..7c0dc8b6cad 100644 --- a/shell.nix +++ b/shell.nix @@ -61,7 +61,7 @@ in echo "GORELEASER_KEY must be set in CRIB environments. You can find it in our 1p vault under 'goreleaser-pro-license'." exit 1 fi - ${if stdenv.isDarwin then "source ./nix-darwin-shell-hook.sh" else ""} + ${if stdenv.isDarwin then "source $(git rev-parse --show-toplevel)/nix-darwin-shell-hook.sh" else ""} ''} ''; From da696fd2da2122c89fcba49c772c3c3ce38b5eae Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Sat, 16 Nov 2024 16:35:37 -0800 Subject: [PATCH 101/117] Bump streams trigger cap to 1.1.0 --- core/scripts/keystone/src/02_deploy_keystone_workflows.go | 2 +- core/scripts/keystone/src/88_capabilities_registry_helpers.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/scripts/keystone/src/02_deploy_keystone_workflows.go b/core/scripts/keystone/src/02_deploy_keystone_workflows.go index cce15f8d2e0..06283bb5cb2 100644 --- a/core/scripts/keystone/src/02_deploy_keystone_workflows.go +++ b/core/scripts/keystone/src/02_deploy_keystone_workflows.go @@ -76,7 +76,7 @@ workflow = """ name: "ccip_kiab1" owner: '{{ .WorkflowOwnerAddress }}' triggers: - - id: streams-trigger@1.0.0 + - id: streams-trigger@1.1.0 config: maxFrequencyMs: 10000 feedIds: diff --git a/core/scripts/keystone/src/88_capabilities_registry_helpers.go b/core/scripts/keystone/src/88_capabilities_registry_helpers.go index 6d70ae8ea96..fc03a5edc1f 100644 --- a/core/scripts/keystone/src/88_capabilities_registry_helpers.go +++ b/core/scripts/keystone/src/88_capabilities_registry_helpers.go @@ -377,7 +377,7 @@ func NewStreamsTriggerV1Capability() *TriggerCapability { baseCapability{ capability: kcr.CapabilitiesRegistryCapability{ LabelledName: "streams-trigger", - Version: "1.0.0", + Version: "1.1.0", CapabilityType: CapabilityTypeTrigger, }, }, From 7d875dc5d44b85837aa460790131083210d3022b Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Sat, 16 Nov 2024 16:39:25 -0800 Subject: [PATCH 102/117] Create toolkit sub-cli --- core/scripts/keystone/main.go | 1 + .../keystone/src/01_provision_keystone.go | 2 +- core/scripts/keystone/src/01_toolkit.go | 208 ++++++++++++++++++ .../keystone/src/02_fund_transmitters.go | 4 +- .../src/02_provision_ocr3_capability.go | 30 +-- .../src/02_provision_ocr3_capability_test.go | 3 +- core/scripts/keystone/src/99_app.go | 4 +- core/scripts/keystone/src/99_crib_client.go | 8 +- core/scripts/keystone/src/99_fetch_keys.go | 4 +- 9 files changed, 239 insertions(+), 25 deletions(-) create mode 100644 core/scripts/keystone/src/01_toolkit.go diff --git a/core/scripts/keystone/main.go b/core/scripts/keystone/main.go index 6a3515988ca..4bd8dea0e5f 100644 --- a/core/scripts/keystone/main.go +++ b/core/scripts/keystone/main.go @@ -17,6 +17,7 @@ func main() { commands := []command{ src.NewProvisionKeystoneCommand(), src.NewDeployAndInitializeCapabilitiesRegistryCommand(), + src.NewToolkit(), } commandsList := func(commands []command) string { diff --git a/core/scripts/keystone/src/01_provision_keystone.go b/core/scripts/keystone/src/01_provision_keystone.go index c5c5989d7f8..bfe5d210282 100644 --- a/core/scripts/keystone/src/01_provision_keystone.go +++ b/core/scripts/keystone/src/01_provision_keystone.go @@ -206,7 +206,7 @@ func provisionWorkflowDON( ocrConfigFile, artefactsDir, ) - distributeFunds(nodeSet, env) + distributeFunds(nodeSet.NodeKeys, env) // We don't technically need the capability registry as a dependency // as we just use it for a sanity check diff --git a/core/scripts/keystone/src/01_toolkit.go b/core/scripts/keystone/src/01_toolkit.go new file mode 100644 index 00000000000..5fd15f53d95 --- /dev/null +++ b/core/scripts/keystone/src/01_toolkit.go @@ -0,0 +1,208 @@ +// This sub CLI acts as a temporary shim for external aptos support + +package src + +import ( + "bufio" + "errors" + "flag" + "fmt" + "net/url" + "os" + "strconv" + "strings" + + helpers "github.com/smartcontractkit/chainlink/core/scripts/common" +) + +type Toolkit struct{} + +func NewToolkit() *Toolkit { + return &Toolkit{} +} + +func (t *Toolkit) DeployWorkflow(args []string) { + fs := flag.NewFlagSet("deploy-workflow", flag.ExitOnError) + workflowFile := fs.String("workflow", "", "Path to workflow file") + nodesList := fs.String("nodes", ".cache/NodesList.txt", "Path to file with list of nodes") + + if err := fs.Parse(args); err != nil { + fs.Usage() + os.Exit(1) + } + + if *workflowFile == "" { + fs.Usage() + os.Exit(1) + } + nodesWithCreds := mustReadNodesList(*nodesList) + + for _, node := range nodesWithCreds { + api := newNodeAPI(node) + workflowContent, err := os.ReadFile(*workflowFile) + PanicErr(err) + + upsertJob(api, "workflow", string(workflowContent)) + fmt.Println("Workflow deployed successfully") + } +} + +func (t *Toolkit) DeployOCR3JobSpecs(args []string) { + fs := flag.NewFlagSet("deploy-ocr3-jobspecs", flag.ExitOnError) + chainID := fs.Int64("chainid", 0, "Chain ID") + p2pPort := fs.Int64("p2pport", 6690, "P2P port") + nodesListPath := fs.String("nodes", ".cache/NodesList.txt", "Path to file with list of nodes") + artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") + ethURL := fs.String("ethurl", "", "URL of the Ethereum node") + accountKey := fs.String("accountkey", "", "Private key of the deployer account") + + os.Setenv("ETH_URL", *ethURL) + os.Setenv("ETH_CHAIN_ID", strconv.FormatInt(*chainID, 10)) + os.Setenv("ACCOUNT_KEY", *accountKey) + os.Setenv("INSECURE_SKIP_VERIFY", "true") + + env := helpers.SetupEnv(false) + + if err := fs.Parse(args); err != nil { + fs.Usage() + os.Exit(1) + } + + if *chainID == 0 { + fs.Usage() + os.Exit(1) + } + + nodes := mustReadNodesList(*nodesListPath) + nodeKeys := mustFetchNodeKeys(*chainID, nodes, true) + o := LoadOnchainMeta(*artefactsDir, env) + + deployOCR3JobSpecs( + nodes, + *chainID, + nodeKeys, + *p2pPort, + o, + ) +} + +func (t *Toolkit) ProvisionOCR3andForwarder(args []string) { + fs := flag.NewFlagSet("deploy-ocr3-and-forwarder", flag.ExitOnError) + ethURL := fs.String("ethurl", "", "URL of the Ethereum node") + accountKey := fs.String("accountkey", "", "Private key of the deployer account") + chainID := fs.Int64("chainid", 0, "Chain ID") + nodesListPath := fs.String("nodes", ".cache/NodesList.txt", "Path to file with list of nodes") + artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") + ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "Path to OCR config file") + + if err := fs.Parse(args); err != nil { + fs.Usage() + os.Exit(1) + } + + if *ethURL == "" || *accountKey == "" || *chainID == 0 { + fs.Usage() + os.Exit(1) + } + + // Set environment variables required by setupenv + os.Setenv("ETH_URL", *ethURL) + os.Setenv("ETH_CHAIN_ID", strconv.FormatInt(*chainID, 10)) + os.Setenv("ACCOUNT_KEY", *accountKey) + os.Setenv("INSECURE_SKIP_VERIFY", "true") + + env := helpers.SetupEnv(false) + + nodes := mustReadNodesList(*nodesListPath) + nodeKeys := mustFetchNodeKeys(*chainID, nodes, true) + + deployForwarder(env, *artefactsDir) + deployOCR3Contract(nodeKeys, env, *ocrConfigFile, *artefactsDir) + + distributeFunds(nodeKeys, env) +} + +func (t *Toolkit) Run(args []string) { + if len(args) < 1 { + fmt.Println("Available commands:") + fmt.Println(" deploy-workflow") + fmt.Println(" deploy-ocr3-contracts") + fmt.Println(" deploy-ocr3-jobspecs") + os.Exit(1) + } + + command := args[0] + cmdArgs := args[1:] + + switch command { + case "deploy-workflow": + t.DeployWorkflow(cmdArgs) + case "deploy-ocr3-contracts": + t.ProvisionOCR3andForwarder(cmdArgs) + case "deploy-ocr3-jobspecs": + t.DeployOCR3JobSpecs(cmdArgs) + default: + fmt.Printf("Unknown command: %s\n", command) + os.Exit(1) + } +} + +func (t *Toolkit) Name() string { + return "toolkit" +} + +// Reads in a list of nodes from a file, where each line is in the format: +// http://localhost:50100 http://chainlink.core.1:50100 notreal@fakeemail.ch fj293fbBnlQ!f9vNs +func mustReadNodesList(path string) []NodeWithCreds { + fmt.Println("Reading nodes list from", path) + nodesList, err := readLines(path) + helpers.PanicErr(err) + + var nodes []NodeWithCreds + for _, r := range nodesList { + rr := strings.TrimSpace(r) + if len(rr) == 0 { + continue + } + s := strings.Split(rr, " ") + if len(s) != 4 { + helpers.PanicErr(errors.New("wrong nodes list format")) + } + + u := SimpleURL{ + Scheme: "http", + Host: s[0], + } + r := SimpleURL{ + Scheme: "http", + Host: s[1], + } + remoteURL, err := url.Parse(r.Host) + PanicErr(err) + nodes = append(nodes, NodeWithCreds{ + URL: u, + RemoteURL: r, + // This is the equivalent of "chainlink.core.1" in our above example + ServiceName: remoteURL.Hostname(), + APILogin: s[2], + APIPassword: s[3], + KeystorePassword: "", + }) + } + return nodes +} + +func readLines(path string) ([]string, error) { + file, err := os.Open(path) + if err != nil { + return nil, err + } + defer file.Close() + + var lines []string + scanner := bufio.NewScanner(file) + for scanner.Scan() { + lines = append(lines, scanner.Text()) + } + return lines, scanner.Err() +} diff --git a/core/scripts/keystone/src/02_fund_transmitters.go b/core/scripts/keystone/src/02_fund_transmitters.go index 45e684de65b..751a90d22d8 100644 --- a/core/scripts/keystone/src/02_fund_transmitters.go +++ b/core/scripts/keystone/src/02_fund_transmitters.go @@ -11,13 +11,13 @@ import ( helpers "github.com/smartcontractkit/chainlink/core/scripts/common" ) -func distributeFunds(nodeSet NodeSet, env helpers.Environment) { +func distributeFunds(nodeKeys []NodeKeys, env helpers.Environment) { fmt.Println("Funding transmitters...") transmittersStr := []string{} fundingAmount := big.NewInt(500000000000000000) // 0.5 ETH minThreshold := big.NewInt(50000000000000000) // 0.05 ETH - for _, n := range nodeSet.NodeKeys { + for _, n := range nodeKeys { balance, err := getBalance(n.EthAddress, env) if err != nil { fmt.Printf("Error fetching balance for %s: %v\n", n.EthAddress, err) diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability.go b/core/scripts/keystone/src/02_provision_ocr3_capability.go index 0a2b7cd4f19..4f94588b4ba 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability.go @@ -28,16 +28,20 @@ func provisionOCR3( ocrConfigFile string, artefactsDir string, ) (onchainMeta *onchainMeta, cacheHit bool) { + nodeKeys := nodeSet.NodeKeys + nodes := nodeSet.Nodes + onchainMeta, cacheHit = deployOCR3Contract( - nodeSet, + nodeKeys, env, ocrConfigFile, artefactsDir, ) - deployOCR3JobSpecsTo( - nodeSet, + deployOCR3JobSpecs( + nodes, chainID, + nodeKeys, p2pPort, onchainMeta, ) @@ -46,14 +50,14 @@ func provisionOCR3( } func deployOCR3Contract( - nodeSet NodeSet, + nodeKeys []NodeKeys, env helpers.Environment, configFile string, artefacts string, ) (o *onchainMeta, cacheHit bool) { o = LoadOnchainMeta(artefacts, env) ocrConf := generateOCR3Config( - nodeSet, + nodeKeys, configFile, ) @@ -68,7 +72,7 @@ func deployOCR3Contract( cc := ocrConfToContractConfig(ocrConf, latestConfigDigestBytes.ConfigCount) digester := evm.OCR3CapabilityOffchainConfigDigester{ // ignore integer overflow - ChainID: uint64(env.ChainID), // nolint:gosec + ChainID: uint64(env.ChainID), //nolint:gosec ContractAddress: o.OCR3.Address(), } digest, err := digester.ConfigDigest(context.Background(), cc) @@ -94,11 +98,11 @@ func deployOCR3Contract( return o, true } -func generateOCR3Config(nodeSet NodeSet, configFile string) ksdeploy.Orc2drOracleConfig { +func generateOCR3Config(nodeKeys []NodeKeys, configFile string) ksdeploy.Orc2drOracleConfig { topLevelCfg := mustReadOCR3Config(configFile) cfg := topLevelCfg.OracleConfig cfg.OCRSecrets = deployment.XXXGenerateTestOCRSecrets() - c, err := ksdeploy.GenerateOCR3Config(cfg, nodeKeysToKsDeployNodeKeys(nodeSet.NodeKeys[1:])) // skip the bootstrap node + c, err := ksdeploy.GenerateOCR3Config(cfg, nodeKeysToKsDeployNodeKeys(nodeKeys[1:])) // skip the bootstrap node helpers.PanicErr(err) return c } @@ -118,15 +122,15 @@ func setOCRConfig(o *onchainMeta, env helpers.Environment, ocrConf ksdeploy.Orc2 WriteOnchainMeta(o, artefacts) } -func deployOCR3JobSpecsTo( - nodeSet NodeSet, +func deployOCR3JobSpecs( + nodes []NodeWithCreds, chainID int64, + nodeKeys []NodeKeys, p2pPort int64, onchainMeta *onchainMeta, ) { ocrAddress := onchainMeta.OCR3.Address().Hex() - nodeKeys := nodeSet.NodeKeys - nodes := nodeSet.Nodes + bootstrapURI := fmt.Sprintf("%s@%s:%d", nodeKeys[0].P2PPeerID, nodes[0].ServiceName, p2pPort) var specName string for i, n := range nodes { @@ -145,7 +149,7 @@ func deployOCR3JobSpecsTo( JobSpecName: "ocr3_oracle", OCRConfigContractAddress: ocrAddress, OCRKeyBundleID: nodeKeys[i].OCR2BundleID, - BootstrapURI: fmt.Sprintf("%s@%s:%d", nodeKeys[0].P2PPeerID, nodeSet.Nodes[0].ServiceName, p2pPort), + BootstrapURI: bootstrapURI, TransmitterID: nodeKeys[i].EthAddress, ChainID: chainID, AptosKeyBundleID: nodeKeys[i].AptosBundleID, diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability_test.go b/core/scripts/keystone/src/02_provision_ocr3_capability_test.go index 1c639860d63..df4d9a41f5c 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability_test.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability_test.go @@ -12,7 +12,8 @@ import ( func TestGenerateOCR3Config(t *testing.T) { // Generate OCR3 config nodeSet := downloadNodeSets(1337, "./testdata/node_sets.json", 4) - config := generateOCR3Config(nodeSet.Workflow, "./testdata/SampleConfig.json") + nodeKeys := nodeSet.Workflow.NodeKeys + config := generateOCR3Config(nodeKeys, "./testdata/SampleConfig.json") matchOffchainConfig := match.Custom("OffchainConfig", func(s any) (any, error) { // coerce the value to a string diff --git a/core/scripts/keystone/src/99_app.go b/core/scripts/keystone/src/99_app.go index 8505de1ba85..29164959bec 100644 --- a/core/scripts/keystone/src/99_app.go +++ b/core/scripts/keystone/src/99_app.go @@ -31,7 +31,7 @@ var ( cacheMutex = &sync.Mutex{} ) -func newApp(n NodeWthCreds, writer io.Writer) (*clcmd.Shell, *cli.App) { +func newApp(n NodeWithCreds, writer io.Writer) (*clcmd.Shell, *cli.App) { loggingCfg := logger.Config{ LogLevel: zapcore.InfoLevel, JsonConsole: true, @@ -77,7 +77,7 @@ type nodeAPI struct { logger logger.Logger } -func newNodeAPI(n NodeWthCreds) *nodeAPI { +func newNodeAPI(n NodeWithCreds) *nodeAPI { // Create a unique key for the cache key := n.RemoteURL.String() diff --git a/core/scripts/keystone/src/99_crib_client.go b/core/scripts/keystone/src/99_crib_client.go index ec977a9384f..1a38cafe9bb 100644 --- a/core/scripts/keystone/src/99_crib_client.go +++ b/core/scripts/keystone/src/99_crib_client.go @@ -23,7 +23,7 @@ func (s SimpleURL) String() string { return fmt.Sprintf("%s://%s%s", s.Scheme, s.Host, s.Path) } -type NodeWthCreds struct { +type NodeWithCreds struct { URL SimpleURL RemoteURL SimpleURL ServiceName string @@ -39,13 +39,13 @@ func NewCribClient() *CribClient { } } -func (m *CribClient) getCLNodes() ([]NodeWthCreds, error) { +func (m *CribClient) getCLNodes() ([]NodeWithCreds, error) { fmt.Println("Getting CL node deployments with config maps...") deployments, err := m.k8sClient.GetDeploymentsWithConfigMap() if err != nil { return nil, err } - nodes := []NodeWthCreds{} + nodes := []NodeWithCreds{} for _, deployment := range deployments { apiCredentials := deployment.ConfigMap.Data["apicredentials"] @@ -59,7 +59,7 @@ func (m *CribClient) getCLNodes() ([]NodeWthCreds, error) { Path: "", } - node := NodeWthCreds{ + node := NodeWithCreds{ // We dont handle both in-cluster and out-of-cluster deployments // Hence why both URL and RemoteURL are the same URL: url, diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index 57ee0df3d26..63e191a1234 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -20,7 +20,7 @@ import ( type NodeSet struct { Name string Prefix string - Nodes []NodeWthCreds + Nodes []NodeWithCreds NodeKeys []NodeKeys } @@ -104,7 +104,7 @@ type OCR2AptosKBTrimmed struct { AptosOnchainPublicKey string `json:"AptosOnchainPublicKey"` // ocr2on_aptos_ } -func mustFetchNodeKeys(chainID int64, nodes []NodeWthCreds, createAptosKeys bool) []NodeKeys { +func mustFetchNodeKeys(chainID int64, nodes []NodeWithCreds, createAptosKeys bool) []NodeKeys { nodeKeys := []NodeKeys{} for _, n := range nodes { From 3deac1d428d9481086b765627458e9dfd608802e Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Sun, 17 Nov 2024 23:11:03 -0800 Subject: [PATCH 103/117] Cleanup toolkit --- core/scripts/keystone/src/01_toolkit.go | 138 ++++++++++++------------ 1 file changed, 68 insertions(+), 70 deletions(-) diff --git a/core/scripts/keystone/src/01_toolkit.go b/core/scripts/keystone/src/01_toolkit.go index 5fd15f53d95..7a960e394f2 100644 --- a/core/scripts/keystone/src/01_toolkit.go +++ b/core/scripts/keystone/src/01_toolkit.go @@ -17,44 +17,81 @@ import ( type Toolkit struct{} +func (t *Toolkit) Name() string { + return "toolkit" +} + func NewToolkit() *Toolkit { return &Toolkit{} } -func (t *Toolkit) DeployWorkflow(args []string) { - fs := flag.NewFlagSet("deploy-workflow", flag.ExitOnError) - workflowFile := fs.String("workflow", "", "Path to workflow file") - nodesList := fs.String("nodes", ".cache/NodesList.txt", "Path to file with list of nodes") +func (t *Toolkit) Run(args []string) { + if len(args) < 1 { + fmt.Println("Available commands:") + fmt.Println(" deploy-workflows") + fmt.Println(" deploy-ocr3-contracts") + fmt.Println(" deploy-ocr3-jobspecs") + os.Exit(1) + } + + command := args[0] + cmdArgs := args[1:] + + switch command { + case "deploy-workflows": + t.DeployWorkflows(cmdArgs) + case "deploy-ocr3-contracts": + t.ProvisionOCR3Contracts(cmdArgs) + case "deploy-ocr3-jobspecs": + t.DeployOCR3JobSpecs(cmdArgs) + default: + fmt.Printf("Unknown command: %s\n", command) + os.Exit(1) + } +} + +func (t *Toolkit) ProvisionOCR3Contracts(args []string) { + fs := flag.NewFlagSet("deploy-ocr3-contracts", flag.ExitOnError) + ethURL := fs.String("ethurl", "", "URL of the Ethereum node") + accountKey := fs.String("accountkey", "", "Private key of the deployer account") + chainID := fs.Int64("chainid", 1337, "Chain ID") + nodesListPath := fs.String("nodes", ".cache/NodesList.txt", "Path to file with list of nodes") + artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") + ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "Path to OCR config file") if err := fs.Parse(args); err != nil { fs.Usage() os.Exit(1) } - if *workflowFile == "" { + if *ethURL == "" || *accountKey == "" || *chainID == 0 { fs.Usage() os.Exit(1) } - nodesWithCreds := mustReadNodesList(*nodesList) - for _, node := range nodesWithCreds { - api := newNodeAPI(node) - workflowContent, err := os.ReadFile(*workflowFile) - PanicErr(err) + // Set environment variables required by setupenv + os.Setenv("ETH_URL", *ethURL) + os.Setenv("ETH_CHAIN_ID", strconv.FormatInt(*chainID, 10)) + os.Setenv("ACCOUNT_KEY", *accountKey) + os.Setenv("INSECURE_SKIP_VERIFY", "true") - upsertJob(api, "workflow", string(workflowContent)) - fmt.Println("Workflow deployed successfully") - } + env := helpers.SetupEnv(false) + + nodes := mustReadNodesList(*nodesListPath) + nodeKeys := mustFetchNodeKeys(*chainID, nodes, true) + + deployOCR3Contract(nodeKeys, env, *ocrConfigFile, *artefactsDir) } func (t *Toolkit) DeployOCR3JobSpecs(args []string) { fs := flag.NewFlagSet("deploy-ocr3-jobspecs", flag.ExitOnError) - chainID := fs.Int64("chainid", 0, "Chain ID") - p2pPort := fs.Int64("p2pport", 6690, "P2P port") - nodesListPath := fs.String("nodes", ".cache/NodesList.txt", "Path to file with list of nodes") - artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") + ethURL := fs.String("ethurl", "", "URL of the Ethereum node") accountKey := fs.String("accountkey", "", "Private key of the deployer account") + chainID := fs.Int64("chainid", 1337, "Chain ID") + nodesListPath := fs.String("nodes", ".cache/NodesList.txt", "Path to file with list of nodes") + p2pPort := fs.Int64("p2pport", 6690, "P2P port") + artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") os.Setenv("ETH_URL", *ethURL) os.Setenv("ETH_CHAIN_ID", strconv.FormatInt(*chainID, 10)) @@ -68,7 +105,7 @@ func (t *Toolkit) DeployOCR3JobSpecs(args []string) { os.Exit(1) } - if *chainID == 0 { + if *ethURL == "" || *accountKey == "" { fs.Usage() os.Exit(1) } @@ -86,71 +123,32 @@ func (t *Toolkit) DeployOCR3JobSpecs(args []string) { ) } -func (t *Toolkit) ProvisionOCR3andForwarder(args []string) { - fs := flag.NewFlagSet("deploy-ocr3-and-forwarder", flag.ExitOnError) - ethURL := fs.String("ethurl", "", "URL of the Ethereum node") - accountKey := fs.String("accountkey", "", "Private key of the deployer account") - chainID := fs.Int64("chainid", 0, "Chain ID") - nodesListPath := fs.String("nodes", ".cache/NodesList.txt", "Path to file with list of nodes") - artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") - ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "Path to OCR config file") +func (t *Toolkit) DeployWorkflows(args []string) { + fs := flag.NewFlagSet("deploy-workflows", flag.ExitOnError) + workflowFile := fs.String("workflow", "", "Path to workflow file") + nodesList := fs.String("nodes", ".cache/NodesList.txt", "Path to file with list of nodes") if err := fs.Parse(args); err != nil { fs.Usage() os.Exit(1) } - if *ethURL == "" || *accountKey == "" || *chainID == 0 { + if *workflowFile == "" { fs.Usage() os.Exit(1) } + nodesWithCreds := mustReadNodesList(*nodesList) - // Set environment variables required by setupenv - os.Setenv("ETH_URL", *ethURL) - os.Setenv("ETH_CHAIN_ID", strconv.FormatInt(*chainID, 10)) - os.Setenv("ACCOUNT_KEY", *accountKey) - os.Setenv("INSECURE_SKIP_VERIFY", "true") - - env := helpers.SetupEnv(false) - - nodes := mustReadNodesList(*nodesListPath) - nodeKeys := mustFetchNodeKeys(*chainID, nodes, true) - - deployForwarder(env, *artefactsDir) - deployOCR3Contract(nodeKeys, env, *ocrConfigFile, *artefactsDir) - - distributeFunds(nodeKeys, env) -} - -func (t *Toolkit) Run(args []string) { - if len(args) < 1 { - fmt.Println("Available commands:") - fmt.Println(" deploy-workflow") - fmt.Println(" deploy-ocr3-contracts") - fmt.Println(" deploy-ocr3-jobspecs") - os.Exit(1) - } - - command := args[0] - cmdArgs := args[1:] + for _, node := range nodesWithCreds { + api := newNodeAPI(node) + workflowContent, err := os.ReadFile(*workflowFile) + PanicErr(err) - switch command { - case "deploy-workflow": - t.DeployWorkflow(cmdArgs) - case "deploy-ocr3-contracts": - t.ProvisionOCR3andForwarder(cmdArgs) - case "deploy-ocr3-jobspecs": - t.DeployOCR3JobSpecs(cmdArgs) - default: - fmt.Printf("Unknown command: %s\n", command) - os.Exit(1) + upsertJob(api, "workflow", string(workflowContent)) + fmt.Println("Workflow deployed successfully") } } -func (t *Toolkit) Name() string { - return "toolkit" -} - // Reads in a list of nodes from a file, where each line is in the format: // http://localhost:50100 http://chainlink.core.1:50100 notreal@fakeemail.ch fj293fbBnlQ!f9vNs func mustReadNodesList(path string) []NodeWithCreds { @@ -158,7 +156,7 @@ func mustReadNodesList(path string) []NodeWithCreds { nodesList, err := readLines(path) helpers.PanicErr(err) - var nodes []NodeWithCreds + nodes := make([]NodeWithCreds, 0, len(nodesList)) for _, r := range nodesList { rr := strings.TrimSpace(r) if len(rr) == 0 { From cb46afc57f911282127d7582843d4d2016372944 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 18 Nov 2024 14:15:17 -0800 Subject: [PATCH 104/117] Reverse URLs for nodelists --- core/scripts/keystone/src/01_toolkit.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/scripts/keystone/src/01_toolkit.go b/core/scripts/keystone/src/01_toolkit.go index 7a960e394f2..157f0721fe6 100644 --- a/core/scripts/keystone/src/01_toolkit.go +++ b/core/scripts/keystone/src/01_toolkit.go @@ -167,15 +167,15 @@ func mustReadNodesList(path string) []NodeWithCreds { helpers.PanicErr(errors.New("wrong nodes list format")) } - u := SimpleURL{ + r := SimpleURL{ Scheme: "http", Host: s[0], } - r := SimpleURL{ + u := SimpleURL{ Scheme: "http", Host: s[1], } - remoteURL, err := url.Parse(r.Host) + remoteURL, err := url.Parse(u.Host) PanicErr(err) nodes = append(nodes, NodeWithCreds{ URL: u, @@ -187,6 +187,7 @@ func mustReadNodesList(path string) []NodeWithCreds { KeystorePassword: "", }) } + return nodes } From 987b8b5633a0d7a248e521986a10b9b125b0da06 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 18 Nov 2024 14:15:50 -0800 Subject: [PATCH 105/117] Update snapshots --- .../src/__snapshots__/02_deploy_keystone_workflows_test.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/__snapshots__/02_deploy_keystone_workflows_test.snap b/core/scripts/keystone/src/__snapshots__/02_deploy_keystone_workflows_test.snap index 56506e1f750..8556ca9304c 100755 --- a/core/scripts/keystone/src/__snapshots__/02_deploy_keystone_workflows_test.snap +++ b/core/scripts/keystone/src/__snapshots__/02_deploy_keystone_workflows_test.snap @@ -8,7 +8,7 @@ workflow = """ name: "ccip_kiab1" owner: '0x1234567890abcdef1234567890abcdef12345678' triggers: - - id: streams-trigger@1.0.0 + - id: streams-trigger@1.1.0 config: maxFrequencyMs: 10000 feedIds: From 0eb1a29cecbfa3113fd316003a585ed26bf08743 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 18 Nov 2024 14:17:19 -0800 Subject: [PATCH 106/117] Remove unneeded gosec ignore --- core/scripts/keystone/src/02_provision_ocr3_capability.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability.go b/core/scripts/keystone/src/02_provision_ocr3_capability.go index 4f94588b4ba..0b2fac79312 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability.go @@ -71,8 +71,7 @@ func deployOCR3Contract( cc := ocrConfToContractConfig(ocrConf, latestConfigDigestBytes.ConfigCount) digester := evm.OCR3CapabilityOffchainConfigDigester{ - // ignore integer overflow - ChainID: uint64(env.ChainID), //nolint:gosec + ChainID: uint64(env.ChainID), ContractAddress: o.OCR3.Address(), } digest, err := digester.ConfigDigest(context.Background(), cc) From 8626cabe84fe2412cd3b07ed13939cdd79be5ec7 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 18 Nov 2024 14:30:59 -0800 Subject: [PATCH 107/117] Update gomods --- core/scripts/go.mod | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 666763dd98f..60797c7dd2b 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -26,6 +26,7 @@ require ( github.com/smartcontractkit/chainlink-automation v0.8.1 github.com/smartcontractkit/chainlink-common v0.3.1-0.20241114134822-aadff98ef068 github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e + github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13 github.com/smartcontractkit/chainlink/deployment v0.0.0-00010101000000-000000000000 github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20241106193309-5560cd76211a github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 @@ -35,6 +36,7 @@ require ( github.com/umbracle/ethgo v0.1.3 github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722 github.com/urfave/cli v1.22.14 + go.uber.org/zap v1.27.0 google.golang.org/protobuf v1.35.1 gopkg.in/yaml.v3 v3.0.1 k8s.io/api v0.31.1 @@ -416,7 +418,6 @@ require ( github.com/smartcontractkit/chainlink-protos/orchestrator v0.3.0 // indirect github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241115191142-8b8369c1f44e // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241017135645-176a23722fd8 // indirect - github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13 // indirect github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 // indirect github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.5 // indirect github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.2 // indirect @@ -500,7 +501,6 @@ require ( go.uber.org/goleak v1.3.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/ratelimit v0.3.1 // indirect - go.uber.org/zap v1.27.0 // indirect go4.org/netipx v0.0.0-20230125063823-8449b0a6169f // indirect golang.org/x/arch v0.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect @@ -527,7 +527,6 @@ require ( gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.31.0 // indirect k8s.io/cli-runtime v0.31.1 // indirect k8s.io/component-base v0.31.1 // indirect From 376a354fa0a9327e09af97c8e58d615f90b67efe Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 18 Nov 2024 16:33:44 -0800 Subject: [PATCH 108/117] Log when we set ocr3 config --- core/scripts/keystone/src/02_provision_ocr3_capability.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability.go b/core/scripts/keystone/src/02_provision_ocr3_capability.go index 0b2fac79312..5caaa07300e 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability.go @@ -107,6 +107,7 @@ func generateOCR3Config(nodeKeys []NodeKeys, configFile string) ksdeploy.Orc2drO } func setOCRConfig(o *onchainMeta, env helpers.Environment, ocrConf ksdeploy.Orc2drOracleConfig, artefacts string) { + fmt.Println("Setting OCR3 contract config...") tx, err := o.OCR3.SetConfig(env.Owner, ocrConf.Signers, ocrConf.Transmitters, From a84d5d2d39a325c1fc21f8197d5c219283cc92f4 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 18 Nov 2024 16:33:58 -0800 Subject: [PATCH 109/117] Cleanup argument parsing --- core/scripts/keystone/src/01_toolkit.go | 47 ++++++++++++++----------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/core/scripts/keystone/src/01_toolkit.go b/core/scripts/keystone/src/01_toolkit.go index 157f0721fe6..a7177636609 100644 --- a/core/scripts/keystone/src/01_toolkit.go +++ b/core/scripts/keystone/src/01_toolkit.go @@ -38,6 +38,8 @@ func (t *Toolkit) Run(args []string) { cmdArgs := args[1:] switch command { + case "get-aptos-keys": + t.GetAptosKeys(cmdArgs) case "deploy-workflows": t.DeployWorkflows(cmdArgs) case "deploy-ocr3-contracts": @@ -50,6 +52,23 @@ func (t *Toolkit) Run(args []string) { } } +func (t *Toolkit) GetAptosKeys(args []string) { + fs := flag.NewFlagSet("get-aptos-keys", flag.ExitOnError) + nodesListPath := fs.String("nodes", ".cache/NodesList.txt", "Path to file with list of nodes") + artefacts := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") + chainID := fs.Int64("chainid", 1337, "Chain ID") + + if err := fs.Parse(args); err != nil { + fs.Usage() + os.Exit(1) + } + + nodes := mustReadNodesList(*nodesListPath) + keys := mustFetchNodeKeys(*chainID, nodes, true) + + mustWriteJSON(*artefacts+"/pubnodekeys.json", keys) +} + func (t *Toolkit) ProvisionOCR3Contracts(args []string) { fs := flag.NewFlagSet("deploy-ocr3-contracts", flag.ExitOnError) ethURL := fs.String("ethurl", "", "URL of the Ethereum node") @@ -59,12 +78,7 @@ func (t *Toolkit) ProvisionOCR3Contracts(args []string) { artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") ocrConfigFile := fs.String("ocrfile", "ocr_config.json", "Path to OCR config file") - if err := fs.Parse(args); err != nil { - fs.Usage() - os.Exit(1) - } - - if *ethURL == "" || *accountKey == "" || *chainID == 0 { + if err := fs.Parse(args); err != nil || *ethURL == "" || *accountKey == "" { fs.Usage() os.Exit(1) } @@ -93,6 +107,11 @@ func (t *Toolkit) DeployOCR3JobSpecs(args []string) { p2pPort := fs.Int64("p2pport", 6690, "P2P port") artefactsDir := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") + if err := fs.Parse(args); err != nil || *ethURL == "" || *accountKey == "" { + fs.Usage() + os.Exit(1) + } + os.Setenv("ETH_URL", *ethURL) os.Setenv("ETH_CHAIN_ID", strconv.FormatInt(*chainID, 10)) os.Setenv("ACCOUNT_KEY", *accountKey) @@ -100,16 +119,6 @@ func (t *Toolkit) DeployOCR3JobSpecs(args []string) { env := helpers.SetupEnv(false) - if err := fs.Parse(args); err != nil { - fs.Usage() - os.Exit(1) - } - - if *ethURL == "" || *accountKey == "" { - fs.Usage() - os.Exit(1) - } - nodes := mustReadNodesList(*nodesListPath) nodeKeys := mustFetchNodeKeys(*chainID, nodes, true) o := LoadOnchainMeta(*artefactsDir, env) @@ -128,15 +137,11 @@ func (t *Toolkit) DeployWorkflows(args []string) { workflowFile := fs.String("workflow", "", "Path to workflow file") nodesList := fs.String("nodes", ".cache/NodesList.txt", "Path to file with list of nodes") - if err := fs.Parse(args); err != nil { + if err := fs.Parse(args); err != nil || *workflowFile == "" { fs.Usage() os.Exit(1) } - if *workflowFile == "" { - fs.Usage() - os.Exit(1) - } nodesWithCreds := mustReadNodesList(*nodesList) for _, node := range nodesWithCreds { From 83b9d34752890c368d330732fa7005615af64f0a Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Mon, 18 Nov 2024 18:56:52 -0800 Subject: [PATCH 110/117] Fix nodes list parsing --- core/scripts/keystone/src/01_toolkit.go | 2 +- core/scripts/keystone/src/01_toolkit_test.go | 49 ++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 core/scripts/keystone/src/01_toolkit_test.go diff --git a/core/scripts/keystone/src/01_toolkit.go b/core/scripts/keystone/src/01_toolkit.go index a7177636609..9a4f9f39c6c 100644 --- a/core/scripts/keystone/src/01_toolkit.go +++ b/core/scripts/keystone/src/01_toolkit.go @@ -180,7 +180,7 @@ func mustReadNodesList(path string) []NodeWithCreds { Scheme: "http", Host: s[1], } - remoteURL, err := url.Parse(u.Host) + remoteURL, err := url.Parse(u.String()) PanicErr(err) nodes = append(nodes, NodeWithCreds{ URL: u, diff --git a/core/scripts/keystone/src/01_toolkit_test.go b/core/scripts/keystone/src/01_toolkit_test.go new file mode 100644 index 00000000000..6f4a083940e --- /dev/null +++ b/core/scripts/keystone/src/01_toolkit_test.go @@ -0,0 +1,49 @@ +package src + +import ( + "os" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestMustReadNodesList(t *testing.T) { + t.Run("valid nodes list", func(t *testing.T) { + content := "localhost:50100 chainlink.core.1:50100 user1 pass1\nlocalhost:50101 chainlink.core.2:50101 user2 pass2" + filePath := writeTempFile(t, content) + defer os.Remove(filePath) + + nodes := mustReadNodesList(filePath) + assert.Len(t, nodes, 2) + + assert.Equal(t, "user1", nodes[0].APILogin) + assert.Equal(t, "user2", nodes[1].APILogin) + + assert.Equal(t, "pass1", nodes[0].APIPassword) + assert.Equal(t, "pass2", nodes[1].APIPassword) + + assert.Equal(t, "http://localhost:50100", nodes[0].RemoteURL.String()) + assert.Equal(t, "http://localhost:50101", nodes[1].RemoteURL.String()) + + assert.Equal(t, "chainlink.core.1", nodes[0].ServiceName) + assert.Equal(t, "chainlink.core.2", nodes[1].ServiceName) + + assert.Equal(t, "http://chainlink.core.1:50100", nodes[0].URL.String()) + assert.Equal(t, "http://chainlink.core.2:50101", nodes[1].URL.String()) + }) +} + +func writeTempFile(t *testing.T, content string) string { + file, err := os.CreateTemp("", "nodeslist") + if err != nil { + t.Fatalf("failed to create temp file: %v", err) + } + defer file.Close() + + _, err = file.WriteString(content) + if err != nil { + t.Fatalf("failed to write to temp file: %v", err) + } + + return file.Name() +} From e27c821d62a2359994c46685cc02ca9478f90e63 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Tue, 19 Nov 2024 18:57:54 -0800 Subject: [PATCH 111/117] Fix lints + address feedback --- core/scripts/go.mod | 3 +-- core/scripts/keystone/src/01_toolkit.go | 4 ++-- core/scripts/keystone/src/02_provision_ocr3_capability.go | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 60797c7dd2b..5c35e1eec54 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -44,8 +44,6 @@ require ( k8s.io/client-go v0.31.1 ) -require github.com/jpillora/backoff v1.0.0 // indirect - require ( contrib.go.opencensus.io/exporter/stackdriver v0.13.5 // indirect cosmossdk.io/api v0.3.1 // indirect @@ -314,6 +312,7 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect + github.com/jpillora/backoff v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/julienschmidt/httprouter v1.3.0 // indirect github.com/kelseyhightower/envconfig v1.4.0 // indirect diff --git a/core/scripts/keystone/src/01_toolkit.go b/core/scripts/keystone/src/01_toolkit.go index 9a4f9f39c6c..6fe896667ce 100644 --- a/core/scripts/keystone/src/01_toolkit.go +++ b/core/scripts/keystone/src/01_toolkit.go @@ -39,7 +39,7 @@ func (t *Toolkit) Run(args []string) { switch command { case "get-aptos-keys": - t.GetAptosKeys(cmdArgs) + t.AptosKeys(cmdArgs) case "deploy-workflows": t.DeployWorkflows(cmdArgs) case "deploy-ocr3-contracts": @@ -52,7 +52,7 @@ func (t *Toolkit) Run(args []string) { } } -func (t *Toolkit) GetAptosKeys(args []string) { +func (t *Toolkit) AptosKeys(args []string) { fs := flag.NewFlagSet("get-aptos-keys", flag.ExitOnError) nodesListPath := fs.String("nodes", ".cache/NodesList.txt", "Path to file with list of nodes") artefacts := fs.String("artefacts", defaultArtefactsDir, "Custom artefacts directory location") diff --git a/core/scripts/keystone/src/02_provision_ocr3_capability.go b/core/scripts/keystone/src/02_provision_ocr3_capability.go index 5caaa07300e..35e93e21b8c 100644 --- a/core/scripts/keystone/src/02_provision_ocr3_capability.go +++ b/core/scripts/keystone/src/02_provision_ocr3_capability.go @@ -71,7 +71,7 @@ func deployOCR3Contract( cc := ocrConfToContractConfig(ocrConf, latestConfigDigestBytes.ConfigCount) digester := evm.OCR3CapabilityOffchainConfigDigester{ - ChainID: uint64(env.ChainID), + ChainID: uint64(env.ChainID), //nolint:gosec // this won't overflow ContractAddress: o.OCR3.Address(), } digest, err := digester.ConfigDigest(context.Background(), cc) From de1a8f5e5b427249fd8a2663a8f020ca3f7f5ccb Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:10:03 -0800 Subject: [PATCH 112/117] Update gomods to point to this branches pseudo version --- core/scripts/go.mod | 4 ++-- deployment/go.mod | 2 +- integration-tests/go.mod | 4 ++-- integration-tests/load/go.mod | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 5212f001330..bb80998727c 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -12,8 +12,8 @@ replace github.com/smartcontractkit/chainlink/deployment => ../../deployment // Using a separate `require` here to avoid surrounding line changes // creating potential merge conflicts. require ( - github.com/smartcontractkit/chainlink/deployment v0.0.0-20241206210521-125d98cdaf66 - github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20241106193309-5560cd76211a + github.com/smartcontractkit/chainlink/deployment v0.0.0-20241212003547-4aea6f720fb5 + github.com/smartcontractkit/chainlink/v2 v2.0.0-20241212003547-4aea6f720fb5 ) require ( diff --git a/deployment/go.mod b/deployment/go.mod index 0c6ba147013..4afb0c00e9e 100644 --- a/deployment/go.mod +++ b/deployment/go.mod @@ -9,7 +9,7 @@ replace github.com/smartcontractkit/chainlink/v2 => ../ // Using a separate inline `require` here to avoid surrounding line changes // creating potential merge conflicts. -require github.com/smartcontractkit/chainlink/v2 v2.0.0-20241206210521-125d98cdaf66 +require github.com/smartcontractkit/chainlink/v2 v2.0.0-20241212003547-4aea6f720fb5 require ( github.com/Khan/genqlient v0.7.0 diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 4e27404790a..32d2333488c 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -12,8 +12,8 @@ replace github.com/smartcontractkit/chainlink/deployment => ../deployment // Using a separate `require` here to avoid surrounding line changes // creating potential merge conflicts. require ( - github.com/smartcontractkit/chainlink/deployment v0.0.0-20241206210521-125d98cdaf66 - github.com/smartcontractkit/chainlink/v2 v2.0.0-20241206210521-125d98cdaf66 + github.com/smartcontractkit/chainlink/deployment v0.0.0-20241212003547-4aea6f720fb5 + github.com/smartcontractkit/chainlink/v2 v2.0.0-20241212003547-4aea6f720fb5 ) require ( diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 01877d77be5..debc7ca579d 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -14,9 +14,9 @@ replace github.com/smartcontractkit/chainlink/integration-tests => ../ // Using a separate `require` here to avoid surrounding line changes // creating potential merge conflicts. require ( - github.com/smartcontractkit/chainlink/deployment v0.0.0-20241206210521-125d98cdaf66 - github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20241206210521-125d98cdaf66 - github.com/smartcontractkit/chainlink/v2 v2.0.0-20241206210521-125d98cdaf66 + github.com/smartcontractkit/chainlink/deployment v0.0.0-20241212003547-4aea6f720fb5 + github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20241212003547-4aea6f720fb5 + github.com/smartcontractkit/chainlink/v2 v2.0.0-20241212003547-4aea6f720fb5 ) require ( From a05aab514cc47eac15956ccf804cd0ac9e12b945 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Thu, 12 Dec 2024 18:43:56 -0800 Subject: [PATCH 113/117] Update gomods to point to this branches pseudo version --- core/scripts/go.mod | 4 ++-- deployment/go.mod | 2 +- integration-tests/go.mod | 4 ++-- integration-tests/load/go.mod | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index bb80998727c..9eb930e7733 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -12,8 +12,8 @@ replace github.com/smartcontractkit/chainlink/deployment => ../../deployment // Using a separate `require` here to avoid surrounding line changes // creating potential merge conflicts. require ( - github.com/smartcontractkit/chainlink/deployment v0.0.0-20241212003547-4aea6f720fb5 - github.com/smartcontractkit/chainlink/v2 v2.0.0-20241212003547-4aea6f720fb5 + github.com/smartcontractkit/chainlink/deployment v0.0.0-20241212011003-de1a8f5e5b42 + github.com/smartcontractkit/chainlink/v2 v2.0.0-20241212011003-de1a8f5e5b42 ) require ( diff --git a/deployment/go.mod b/deployment/go.mod index 4afb0c00e9e..ffd5e89073b 100644 --- a/deployment/go.mod +++ b/deployment/go.mod @@ -9,7 +9,7 @@ replace github.com/smartcontractkit/chainlink/v2 => ../ // Using a separate inline `require` here to avoid surrounding line changes // creating potential merge conflicts. -require github.com/smartcontractkit/chainlink/v2 v2.0.0-20241212003547-4aea6f720fb5 +require github.com/smartcontractkit/chainlink/v2 v2.0.0-20241212011003-de1a8f5e5b42 require ( github.com/Khan/genqlient v0.7.0 diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 32d2333488c..6cc5a614f5c 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -12,8 +12,8 @@ replace github.com/smartcontractkit/chainlink/deployment => ../deployment // Using a separate `require` here to avoid surrounding line changes // creating potential merge conflicts. require ( - github.com/smartcontractkit/chainlink/deployment v0.0.0-20241212003547-4aea6f720fb5 - github.com/smartcontractkit/chainlink/v2 v2.0.0-20241212003547-4aea6f720fb5 + github.com/smartcontractkit/chainlink/deployment v0.0.0-20241212011003-de1a8f5e5b42 + github.com/smartcontractkit/chainlink/v2 v2.0.0-20241212011003-de1a8f5e5b42 ) require ( diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index debc7ca579d..32df4f530ca 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -14,9 +14,9 @@ replace github.com/smartcontractkit/chainlink/integration-tests => ../ // Using a separate `require` here to avoid surrounding line changes // creating potential merge conflicts. require ( - github.com/smartcontractkit/chainlink/deployment v0.0.0-20241212003547-4aea6f720fb5 - github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20241212003547-4aea6f720fb5 - github.com/smartcontractkit/chainlink/v2 v2.0.0-20241212003547-4aea6f720fb5 + github.com/smartcontractkit/chainlink/deployment v0.0.0-20241212011003-de1a8f5e5b42 + github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20241212011003-de1a8f5e5b42 + github.com/smartcontractkit/chainlink/v2 v2.0.0-20241212011003-de1a8f5e5b42 ) require ( From 2b0a459ac0b72f37eab8d51dce0d5098787e0c27 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:04:12 -0800 Subject: [PATCH 114/117] Bump wrappers to 1.1.0 --- core/scripts/keystone/src/01_provision_keystone.go | 2 +- core/scripts/keystone/src/02_deploy_keystone_workflows.go | 2 +- core/scripts/keystone/src/02_provision_capabilities_registry.go | 2 +- core/scripts/keystone/src/88_capabilities_registry_helpers.go | 2 +- core/scripts/keystone/src/88_contracts_helpers.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/scripts/keystone/src/01_provision_keystone.go b/core/scripts/keystone/src/01_provision_keystone.go index bfe5d210282..c7a2dd97127 100644 --- a/core/scripts/keystone/src/01_provision_keystone.go +++ b/core/scripts/keystone/src/01_provision_keystone.go @@ -8,7 +8,7 @@ import ( "strconv" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" ) type provisionKeystone struct{} diff --git a/core/scripts/keystone/src/02_deploy_keystone_workflows.go b/core/scripts/keystone/src/02_deploy_keystone_workflows.go index 06283bb5cb2..6c6580e21f0 100644 --- a/core/scripts/keystone/src/02_deploy_keystone_workflows.go +++ b/core/scripts/keystone/src/02_deploy_keystone_workflows.go @@ -7,7 +7,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" - kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" ) func deployKeystoneWorkflowsTo(nodeSet NodeSet, reg kcr.CapabilitiesRegistryInterface) { diff --git a/core/scripts/keystone/src/02_provision_capabilities_registry.go b/core/scripts/keystone/src/02_provision_capabilities_registry.go index 0eb8e8c3ed9..aa0f203f96b 100644 --- a/core/scripts/keystone/src/02_provision_capabilities_registry.go +++ b/core/scripts/keystone/src/02_provision_capabilities_registry.go @@ -5,7 +5,7 @@ import ( "fmt" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" ) func provisionCapabillitiesRegistry(env helpers.Environment, nodeSets NodeSets, chainID int64, artefactsDir string) kcr.CapabilitiesRegistryInterface { diff --git a/core/scripts/keystone/src/88_capabilities_registry_helpers.go b/core/scripts/keystone/src/88_capabilities_registry_helpers.go index fc03a5edc1f..5494375aa4f 100644 --- a/core/scripts/keystone/src/88_capabilities_registry_helpers.go +++ b/core/scripts/keystone/src/88_capabilities_registry_helpers.go @@ -25,7 +25,7 @@ import ( helpers "github.com/smartcontractkit/chainlink/core/scripts/common" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" ) type CapabilityRegistryProvisioner struct { diff --git a/core/scripts/keystone/src/88_contracts_helpers.go b/core/scripts/keystone/src/88_contracts_helpers.go index 239ac940607..77c0819e22a 100644 --- a/core/scripts/keystone/src/88_contracts_helpers.go +++ b/core/scripts/keystone/src/88_contracts_helpers.go @@ -11,7 +11,7 @@ import ( "github.com/ethereum/go-ethereum/common" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability" verifierContract "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier" From 8bbd762e3c0d9fa4a969473b6caf591a244a95c8 Mon Sep 17 00:00:00 2001 From: krehermann <16602512+krehermann@users.noreply.github.com> Date: Mon, 6 Jan 2025 12:02:39 -0700 Subject: [PATCH 115/117] fix test indentation, quoting --- core/capabilities/integration_tests/keystone/workflow.go | 2 +- core/services/job/models.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/capabilities/integration_tests/keystone/workflow.go b/core/capabilities/integration_tests/keystone/workflow.go index ce81b50dfdc..8cb9aa35cf5 100644 --- a/core/capabilities/integration_tests/keystone/workflow.go +++ b/core/capabilities/integration_tests/keystone/workflow.go @@ -35,7 +35,7 @@ consensus: encoder: "EVM" encoder_config: abi: "(bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports" - subabi: "map[string]string{"Reports.Price": "uint224 Price"}" + subabi: 'map[string]string{"Reports.Price": "uint224 Price"}' targets: - id: "write_geth-testnet@1.0.0" diff --git a/core/services/job/models.go b/core/services/job/models.go index 26d563c7ac8..63e521c5b3b 100644 --- a/core/services/job/models.go +++ b/core/services/job/models.go @@ -935,7 +935,7 @@ func (w *WorkflowSpec) SDKSpec(ctx context.Context) (sdk.WorkflowSpec, error) { } spec, rawSpec, cid, err := workflowSpecFactory.Spec(ctx, w.Workflow, w.Config) if err != nil { - return sdk.WorkflowSpec{}, err + return sdk.WorkflowSpec{}, fmt.Errorf("spec factory failed: %w", err) } w.sdkWorkflow = &spec w.rawSpec = rawSpec From 0db734658400b752e68eecbfdfb1cf185a518b6a Mon Sep 17 00:00:00 2001 From: krehermann <16602512+krehermann@users.noreply.github.com> Date: Fri, 10 Jan 2025 14:11:34 -0700 Subject: [PATCH 116/117] revert bad merge to main; workflow.go, cap_encoder* --- .../integration_tests/keystone/workflow.go | 1 - core/services/relay/evm/cap_encoder.go | 36 ++------ core/services/relay/evm/cap_encoder_test.go | 89 ------------------- 3 files changed, 8 insertions(+), 118 deletions(-) diff --git a/core/capabilities/integration_tests/keystone/workflow.go b/core/capabilities/integration_tests/keystone/workflow.go index 8cb9aa35cf5..25a26bf3f9f 100644 --- a/core/capabilities/integration_tests/keystone/workflow.go +++ b/core/capabilities/integration_tests/keystone/workflow.go @@ -35,7 +35,6 @@ consensus: encoder: "EVM" encoder_config: abi: "(bytes32 FeedID, uint224 Price, uint32 Timestamp)[] Reports" - subabi: 'map[string]string{"Reports.Price": "uint224 Price"}' targets: - id: "write_geth-testnet@1.0.0" diff --git a/core/services/relay/evm/cap_encoder.go b/core/services/relay/evm/cap_encoder.go index 1bf69b73fd3..713a9796dd2 100644 --- a/core/services/relay/evm/cap_encoder.go +++ b/core/services/relay/evm/cap_encoder.go @@ -18,10 +18,9 @@ import ( ) const ( - abiConfigFieldName = "abi" - subabiConfigFieldName = "subabi" - subabi2ConfigFieldName = "subabi2" - encoderName = "user" + abiConfigFieldName = "abi" + subabiConfigFieldName = "subabi" + encoderName = "user" ) type capEncoder struct { @@ -53,8 +52,6 @@ func NewEVMEncoder(config *values.Map) (consensustypes.Encoder, error) { TypeABI: string(jsonSelector), } - var modifierConfigs commoncodec.ModifiersConfig - var subabi map[string]string subabiConfig, ok := config.Underlying[subabiConfigFieldName] if ok { @@ -66,31 +63,14 @@ func NewEVMEncoder(config *values.Map) (consensustypes.Encoder, error) { if err2 != nil { return nil, err2 } - modifierConfigs = append(modifierConfigs, &commoncodec.PreCodecModifierConfig{ - Fields: subabi, - Codecs: codecs, - }) - } - - var subabi2 map[string]string - subabiConfig2, ok := config.Underlying[subabi2ConfigFieldName] - if ok { - err2 := subabiConfig2.UnwrapTo(&subabi2) - if err2 != nil { - return nil, err2 - } - codecs2, err2 := makePreCodecModifierCodecs(subabi2) - if err2 != nil { - return nil, err2 + chainCodecConfig.ModifierConfigs = commoncodec.ModifiersConfig{ + &commoncodec.PreCodecModifierConfig{ + Fields: subabi, + Codecs: codecs, + }, } - modifierConfigs = append(modifierConfigs, &commoncodec.PreCodecModifierConfig{ - Fields: subabi2, - Codecs: codecs2, - }) } - chainCodecConfig.ModifierConfigs = modifierConfigs - codecConfig := types.CodecConfig{Configs: map[string]types.ChainCodecConfig{ encoderName: chainCodecConfig, }} diff --git a/core/services/relay/evm/cap_encoder_test.go b/core/services/relay/evm/cap_encoder_test.go index 68c77762449..4c0285fc987 100644 --- a/core/services/relay/evm/cap_encoder_test.go +++ b/core/services/relay/evm/cap_encoder_test.go @@ -289,84 +289,6 @@ func TestEVMEncoder_SubABI(t *testing.T) { require.Equal(t, expected, hex.EncodeToString(encoded)) } -func TestEVMEncoder_SubABI2(t *testing.T) { - config := map[string]any{ - "abi": "(bytes Report)[] Reports", - "subabi2": map[string]string{ - "Reports.Report.Bundle": "uint256 Ask, uint256 Bid", - }, - "subabi": map[string]string{ - "Reports.Report": "bytes32 FeedID, bytes Bundle, uint32 Timestamp", - }, - } - wrapped, err := values.NewMap(config) - require.NoError(t, err) - enc, err := evm.NewEVMEncoder(wrapped) - require.NoError(t, err) - - type SubReport struct { - Ask int - Bid int - } - type ReportStruct struct { - FeedID [32]byte - Bundle SubReport - Timestamp uint32 - } - type ReportWrapper struct { - Report ReportStruct - } - reportOne := ReportWrapper{Report: ReportStruct{ - FeedID: [32]byte{1}, - Bundle: SubReport{ - Ask: 1, - Bid: 2, - }, - Timestamp: 47890122, - }} - reportTwo := ReportWrapper{Report: ReportStruct{ - FeedID: [32]byte{2}, - Bundle: SubReport{ - Ask: 3, - Bid: 4, - }, - Timestamp: 47890122, - }} - - // output of a reduce aggregator + metadata fields appended by OCR - input := map[string]any{ - "Reports": []any{reportOne, reportTwo}, - consensustypes.MetadataFieldName: getMetadata(workflowID), - } - wrapped, err = values.NewMap(input) - require.NoError(t, err) - encoded, err := enc.Encode(testutils.Context(t), *wrapped) - require.NoError(t, err) - - expected := - // start of the outer tuple - getHexMetadata() + - // start of the inner tuple (user_fields) - "0000000000000000000000000000000000000000000000000000000000000020" + // offset of Reports array - "0000000000000000000000000000000000000000000000000000000000000002" + // length of Reports array - "0000000000000000000000000000000000000000000000000000000000000040" + // offset of ReportOne - "0000000000000000000000000000000000000000000000000000000000000100" + // offset of ReportTwo - "0100000000000000000000000000000000000000000000000000000000000000" + // ReportOne FeedID - "0000000000000000000000000000000000000000000000000000000000000060" + // offset of ReportOne Bundle - "0000000000000000000000000000000000000000000000000000000002dabeca" + // ReportOne Timestamp - "0000000000000000000000000000000000000000000000000000000000000040" + // length of ReportOne Bundle - "0000000000000000000000000000000000000000000000000000000000000005" + // ReportOne Ask - "0000000000000000000000000000000000000000000000000000000000000006" + // ReportOne Bid - "0200000000000000000000000000000000000000000000000000000000000000" + // ReportTwo FeedID - "0000000000000000000000000000000000000000000000000000000000000060" + // offset of ReportTwo Bundle - "0000000000000000000000000000000000000000000000000000000002dabeca" + // ReportTwo Timestamp - "0000000000000000000000000000000000000000000000000000000000000040" + // length of ReportTwo Bundle - "0000000000000000000000000000000000000000000000000000000000000007" + // ReportTwo Ask - "0000000000000000000000000000000000000000000000000000000000000008" // ReportTwo Bid - - require.Equal(t, expected, hex.EncodeToString(encoded)) -} - func getHexMetadata() string { return "01" + executionID + timestampHex + donIDHex + configVersionHex + workflowID + workflowName + workflowOwnerID + reportID } @@ -384,14 +306,3 @@ func getMetadata(cid string) consensustypes.Metadata { ReportID: reportID, } } - -//0000000000000000000000000000000000000000000000000000000000000020 // offset of Reports array -//0000000000000000000000000000000000000000000000000000000000000001 // length of Reports array -//0000000000000000000000000000000000000000000000000000000000000020 // offset of ReportOne -//018bfe8840700040000000000000000000000000000000000000000000000000 -//000000000000000000000000000000000000000000000000000000006764774b -//0000000000000000000000000000000000000000000000000000000000000060 -//0000000000000000000000000000000000000000000000000000000000000020 -//0000000000000000000000000000000000000000000000000000000bb5c162c8 - -"0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000002dabeca000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000002dabeca000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000008" // ReportTwo Bid \ No newline at end of file From a7c47eda1367204360c556675eb5010f707af964 Mon Sep 17 00:00:00 2001 From: krehermann <16602512+krehermann@users.noreply.github.com> Date: Fri, 10 Jan 2025 14:24:00 -0700 Subject: [PATCH 117/117] linter --- core/scripts/keystone/src/88_contracts_helpers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/keystone/src/88_contracts_helpers.go b/core/scripts/keystone/src/88_contracts_helpers.go index 77c0819e22a..59bfeb68201 100644 --- a/core/scripts/keystone/src/88_contracts_helpers.go +++ b/core/scripts/keystone/src/88_contracts_helpers.go @@ -11,7 +11,7 @@ import ( "github.com/ethereum/go-ethereum/common" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" + capabilities_registry "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability" verifierContract "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier"