diff --git a/.changeset/curly-crabs-doubt.md b/.changeset/curly-crabs-doubt.md new file mode 100644 index 00000000000..0408383bd03 --- /dev/null +++ b/.changeset/curly-crabs-doubt.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +#internal diff --git a/.changeset/fair-buttons-judge.md b/.changeset/fair-buttons-judge.md new file mode 100644 index 00000000000..7aacd89787a --- /dev/null +++ b/.changeset/fair-buttons-judge.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +#internal Bumped `chainlink-common` package version to commit `1fb0b48758af25d689b6957ebfb76598c9fb27ea`. diff --git a/.changeset/lemon-buttons-raise.md b/.changeset/lemon-buttons-raise.md new file mode 100644 index 00000000000..0408383bd03 --- /dev/null +++ b/.changeset/lemon-buttons-raise.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +#internal diff --git a/.changeset/metal-glasses-count.md b/.changeset/metal-glasses-count.md new file mode 100644 index 00000000000..0408383bd03 --- /dev/null +++ b/.changeset/metal-glasses-count.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +#internal diff --git a/.github/actions/build-test-image/action.yml b/.github/actions/build-test-image/action.yml index dc80b485193..dfe31f639f4 100644 --- a/.github/actions/build-test-image/action.yml +++ b/.github/actions/build-test-image/action.yml @@ -73,7 +73,7 @@ runs: id: check-base-image uses: smartcontractkit/chainlink-github-actions/docker/image-exists@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 with: - repository: ${{ inputs.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ inputs.QA_AWS_REGION }}.amazonaws.com/test-base-image + repository: test-base-image tag: ${{ steps.long_sha.outputs.long_sha }} AWS_REGION: ${{ inputs.QA_AWS_REGION }} AWS_ROLE_TO_ASSUME: ${{ inputs.QA_AWS_ROLE_TO_ASSUME }} diff --git a/.github/workflows/automation-benchmark-tests.yml b/.github/workflows/automation-benchmark-tests.yml index 0b0404e0e07..c1a8d9edc9f 100644 --- a/.github/workflows/automation-benchmark-tests.yml +++ b/.github/workflows/automation-benchmark-tests.yml @@ -66,7 +66,7 @@ jobs: QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }} suites: benchmark chaos reorg load - name: Run Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 env: DETACH_RUNNER: true TEST_SUITE: benchmark diff --git a/.github/workflows/automation-load-tests.yml b/.github/workflows/automation-load-tests.yml index d3f0254446b..d56ee2e74c4 100644 --- a/.github/workflows/automation-load-tests.yml +++ b/.github/workflows/automation-load-tests.yml @@ -82,7 +82,7 @@ jobs: QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }} suites: benchmark chaos reorg load - name: Run Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 env: RR_CPU: 4000m RR_MEM: 4Gi diff --git a/.github/workflows/automation-nightly-tests.yml b/.github/workflows/automation-nightly-tests.yml index 183ead14477..39a6d907e61 100644 --- a/.github/workflows/automation-nightly-tests.yml +++ b/.github/workflows/automation-nightly-tests.yml @@ -114,7 +114,7 @@ jobs: grafanaDashboardUrl: "/d/ddf75041-1e39-42af-aa46-361fe4c36e9e/ci-e2e-tests-logs" grafanaBearerToken: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }} - name: Run Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 env: TEST_SUITE: ${{ matrix.tests.suite }} with: diff --git a/.github/workflows/automation-ondemand-tests.yml b/.github/workflows/automation-ondemand-tests.yml index 297f3532498..588bf567bc0 100644 --- a/.github/workflows/automation-ondemand-tests.yml +++ b/.github/workflows/automation-ondemand-tests.yml @@ -313,7 +313,7 @@ jobs: echo ::add-mask::$BASE64_CONFIG_OVERRIDE echo "BASE64_CONFIG_OVERRIDE=$BASE64_CONFIG_OVERRIDE" >> $GITHUB_ENV - name: Run Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 if: ${{ matrix.tests.enabled == true }} env: TEST_SUITE: ${{ matrix.tests.suite }} diff --git a/.github/workflows/client-compatibility-tests.yml b/.github/workflows/client-compatibility-tests.yml index 6734a6738a7..d953a087d43 100644 --- a/.github/workflows/client-compatibility-tests.yml +++ b/.github/workflows/client-compatibility-tests.yml @@ -253,7 +253,7 @@ jobs: echo "BASE64_CONFIG_OVERRIDE=$BASE64_CONFIG_OVERRIDE" >> $GITHUB_ENV touch .root_dir - name: Run Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: test_command_to_run: cd ./integration-tests/smoke && go test -timeout ${{ matrix.timeout }} -count=1 -json -test.run ${{ matrix.test }} 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage -hidepassingtests=false -hidepassinglogs test_download_vendor_packages_command: cd ./integration-tests && go mod download diff --git a/.github/workflows/evm-version-compatibility-tests.yml b/.github/workflows/evm-version-compatibility-tests.yml index a14d46cc790..6705ec79e7d 100644 --- a/.github/workflows/evm-version-compatibility-tests.yml +++ b/.github/workflows/evm-version-compatibility-tests.yml @@ -256,7 +256,7 @@ jobs: customEthClientDockerImage: ${{ matrix.evm_node.docker_image }} - name: Run Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: test_command_to_run: cd ./integration-tests && go test -timeout 45m -count=1 -json -test.parallel=2 ${{ steps.build-go-test-command.outputs.run_command }} 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage -hidepassingtests=false -hidepassinglogs test_download_vendor_packages_command: cd ./integration-tests && go mod download diff --git a/.github/workflows/integration-chaos-tests.yml b/.github/workflows/integration-chaos-tests.yml index 87075a63181..e276917f103 100644 --- a/.github/workflows/integration-chaos-tests.yml +++ b/.github/workflows/integration-chaos-tests.yml @@ -132,7 +132,7 @@ jobs: echo ::add-mask::$BASE64_CONFIG_OVERRIDE echo "BASE64_CONFIG_OVERRIDE=$BASE64_CONFIG_OVERRIDE" >> $GITHUB_ENV - name: Run Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: test_command_to_run: cd integration-tests && go test -timeout 1h -count=1 -json -test.parallel 11 ./chaos 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage -hidepassingtests=false -hidepassinglogs test_download_vendor_packages_command: cd ./integration-tests && go mod download diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 6b004b7c016..56d3a959871 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -352,7 +352,7 @@ jobs: ## Run this step when changes that require tests to be run are made - name: Run Tests if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch' - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: test_command_to_run: cd ./integration-tests && go test -timeout 30m -count=1 -json -test.parallel=${{ matrix.product.nodes }} ${{ steps.build-go-test-command.outputs.run_command }} 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage -hidepassingtests=false -hidepassinglogs test_download_vendor_packages_command: cd ./integration-tests && go mod download @@ -466,7 +466,7 @@ jobs: ## Run this step when changes that require tests to be run are made - name: Run Tests if: needs.changes.outputs.src == 'true' - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: test_command_to_run: cd ./integration-tests && go test -timeout 30m -count=1 -json -test.parallel=${{ matrix.product.nodes }} ${{ steps.build-go-test-command.outputs.run_command }} 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage -hidepassingtests=false -hidepassinglogs test_download_vendor_packages_command: cd ./integration-tests && go mod download @@ -695,7 +695,7 @@ jobs: ## Run this step when changes that require tests to be run are made - name: Run Tests if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch' - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: test_command_to_run: cd ./integration-tests && go test -timeout 30m -count=1 -json -test.parallel=${{ matrix.product.nodes }} ${{ steps.build-go-test-command.outputs.run_command }} 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage -hidepassingtests=false -hidepassinglogs test_download_vendor_packages_command: cd ./integration-tests && go mod download @@ -730,7 +730,7 @@ jobs: # Run this step when changes that do not need the test to run are made - name: Run Setup if: needs.changes.outputs.src == 'false' - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: test_download_vendor_packages_command: cd ./integration-tests && go mod download go_mod_path: ./integration-tests/go.mod @@ -936,7 +936,7 @@ jobs: grafanaUrl: ${{ vars.GRAFANA_URL }} grafanaDashboardUrl: "/d/ddf75041-1e39-42af-aa46-361fe4c36e9e/ci-e2e-tests-logs" - name: Run Migration Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: test_command_to_run: cd ./integration-tests && go test -timeout 20m -count=1 -json ./migration 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage -hidepassingtests=false -hidepassinglogs test_download_vendor_packages_command: cd ./integration-tests && go mod download @@ -1195,7 +1195,7 @@ jobs: ref: ${{ needs.get_solana_sha.outputs.sha }} - name: Run Setup if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch' - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: go_mod_path: ./integration-tests/go.mod cache_restore_only: true @@ -1247,7 +1247,7 @@ jobs: echo "BASE64_CONFIG_OVERRIDE=$BASE64_CONFIG_OVERRIDE" >> $GITHUB_ENV - name: Run Tests if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch' - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: test_command_to_run: export ENV_JOB_IMAGE=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-solana-tests:${{ needs.get_solana_sha.outputs.sha }} && make test_smoke cl_repo: ${{ env.CHAINLINK_IMAGE }} diff --git a/.github/workflows/on-demand-keeper-smoke-tests.yml b/.github/workflows/on-demand-keeper-smoke-tests.yml index 452c8478d00..f6fa8f4467a 100644 --- a/.github/workflows/on-demand-keeper-smoke-tests.yml +++ b/.github/workflows/on-demand-keeper-smoke-tests.yml @@ -151,7 +151,7 @@ jobs: ## Run this step when changes that require tests to be run are made - name: Run Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: test_command_to_run: cd ./integration-tests && go test -timeout 30m -count=1 -json -test.parallel=${{ matrix.product.nodes }} ${{ steps.build-go-test-command.outputs.run_command }} 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage -hidepassingtests=false -hidepassinglogs test_download_vendor_packages_command: cd ./integration-tests && go mod download diff --git a/.github/workflows/on-demand-ocr-soak-test.yml b/.github/workflows/on-demand-ocr-soak-test.yml index 9c29c021b8a..aacd07b7de7 100644 --- a/.github/workflows/on-demand-ocr-soak-test.yml +++ b/.github/workflows/on-demand-ocr-soak-test.yml @@ -73,7 +73,7 @@ jobs: QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }} QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }} - name: Run Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 env: DETACH_RUNNER: true TEST_SUITE: soak diff --git a/.github/workflows/on-demand-vrfv2-eth2-clients-test.yml b/.github/workflows/on-demand-vrfv2-eth2-clients-test.yml index beed388e3f6..03b07ab1b1b 100644 --- a/.github/workflows/on-demand-vrfv2-eth2-clients-test.yml +++ b/.github/workflows/on-demand-vrfv2-eth2-clients-test.yml @@ -46,7 +46,7 @@ jobs: echo "### Execution client used" >>$GITHUB_STEP_SUMMARY echo "\`${{ env.ETH2_EL_CLIENT }}\`" >>$GITHUB_STEP_SUMMARY - name: Run Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: test_command_to_run: cd ./integration-tests && go test -timeout 30m -count=1 -json -run TestVRFv2Basic ./smoke/vrfv2_test.go 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage -hidepassingtests=false -hidepassinglogs test_download_vendor_packages_command: cd ./integration-tests && go mod download diff --git a/.github/workflows/on-demand-vrfv2-performance-test.yml b/.github/workflows/on-demand-vrfv2-performance-test.yml index 79711a107b0..43899b4e577 100644 --- a/.github/workflows/on-demand-vrfv2-performance-test.yml +++ b/.github/workflows/on-demand-vrfv2-performance-test.yml @@ -76,7 +76,7 @@ jobs: echo "### Networks on which test was run" >>$GITHUB_STEP_SUMMARY echo "\`${{ env.NETWORKS }}\`" >>$GITHUB_STEP_SUMMARY - name: Run Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: test_command_to_run: cd ./integration-tests/load && go test -v -count=1 -timeout 24h -run "${{ inputs.test_list_regex }}" ./vrfv2 test_download_vendor_packages_command: cd ./integration-tests && go mod download diff --git a/.github/workflows/on-demand-vrfv2plus-eth2-clients-test.yml b/.github/workflows/on-demand-vrfv2plus-eth2-clients-test.yml index c2469d488d1..242eed23640 100644 --- a/.github/workflows/on-demand-vrfv2plus-eth2-clients-test.yml +++ b/.github/workflows/on-demand-vrfv2plus-eth2-clients-test.yml @@ -46,7 +46,7 @@ jobs: echo "### Execution client used" >>$GITHUB_STEP_SUMMARY echo "\`${{ env.ETH2_EL_CLIENT }}\`" >>$GITHUB_STEP_SUMMARY - name: Run Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: test_command_to_run: cd ./integration-tests && go test -timeout 30m -count=1 -json -run ^TestVRFv2Plus$/^Link_Billing$ ./smoke/vrfv2plus_test.go 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage -hidepassingtests=false -hidepassinglogs test_download_vendor_packages_command: cd ./integration-tests && go mod download diff --git a/.github/workflows/on-demand-vrfv2plus-performance-test.yml b/.github/workflows/on-demand-vrfv2plus-performance-test.yml index 2ee3256b53a..fa915381d1c 100644 --- a/.github/workflows/on-demand-vrfv2plus-performance-test.yml +++ b/.github/workflows/on-demand-vrfv2plus-performance-test.yml @@ -76,7 +76,7 @@ jobs: echo "### Networks on which test was run" >>$GITHUB_STEP_SUMMARY echo "\`${{ env.NETWORKS }}\`" >>$GITHUB_STEP_SUMMARY - name: Run Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21 with: test_command_to_run: cd ./integration-tests/load && go test -v -count=1 -timeout 24h -run "${{ inputs.test_list_regex }}" ./vrfv2plus test_download_vendor_packages_command: cd ./integration-tests && go mod download diff --git a/common/client/poller_test.go b/common/client/poller_test.go index 82a05b5dfc7..91af579307b 100644 --- a/common/client/poller_test.go +++ b/common/client/poller_test.go @@ -13,6 +13,7 @@ import ( "go.uber.org/zap" "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) func Test_Poller(t *testing.T) { @@ -89,7 +90,7 @@ func Test_Poller(t *testing.T) { } return true } - require.Eventually(t, logsSeen, time.Second, time.Millisecond) + require.Eventually(t, logsSeen, tests.WaitTimeout(t), 100*time.Millisecond) }) t.Run("Test polling timeout", func(t *testing.T) { @@ -114,13 +115,14 @@ func Test_Poller(t *testing.T) { logsSeen := func() bool { return observedLogs.FilterMessage("polling error: context deadline exceeded").Len() >= 1 } - require.Eventually(t, logsSeen, time.Second, time.Millisecond) + require.Eventually(t, logsSeen, tests.WaitTimeout(t), 100*time.Millisecond) }) t.Run("Test unsubscribe during polling", func(t *testing.T) { wait := make(chan struct{}) + closeOnce := sync.OnceFunc(func() { close(wait) }) pollFunc := func(ctx context.Context) (Head, error) { - close(wait) + closeOnce() // Block in polling function until context is cancelled if <-ctx.Done(); true { return nil, ctx.Err() @@ -145,7 +147,7 @@ func Test_Poller(t *testing.T) { logsSeen := func() bool { return observedLogs.FilterMessage("polling error: context canceled").Len() >= 1 } - require.Eventually(t, logsSeen, time.Second, time.Millisecond) + require.Eventually(t, logsSeen, tests.WaitTimeout(t), 100*time.Millisecond) }) } diff --git a/contracts/.changeset/red-wasps-behave.md b/contracts/.changeset/red-wasps-behave.md new file mode 100644 index 00000000000..93fba83b558 --- /dev/null +++ b/contracts/.changeset/red-wasps-behave.md @@ -0,0 +1,5 @@ +--- +'@chainlink/contracts': patch +--- + +#internal diff --git a/contracts/.changeset/spicy-mirrors-care.md b/contracts/.changeset/spicy-mirrors-care.md new file mode 100644 index 00000000000..93fba83b558 --- /dev/null +++ b/contracts/.changeset/spicy-mirrors-care.md @@ -0,0 +1,5 @@ +--- +'@chainlink/contracts': patch +--- + +#internal diff --git a/contracts/.changeset/two-doors-dance.md b/contracts/.changeset/two-doors-dance.md new file mode 100644 index 00000000000..93fba83b558 --- /dev/null +++ b/contracts/.changeset/two-doors-dance.md @@ -0,0 +1,5 @@ +--- +'@chainlink/contracts': patch +--- + +#internal diff --git a/contracts/gas-snapshots/keystone.gas-snapshot b/contracts/gas-snapshots/keystone.gas-snapshot index 60af8a141a3..1aa0c02e3f3 100644 --- a/contracts/gas-snapshots/keystone.gas-snapshot +++ b/contracts/gas-snapshots/keystone.gas-snapshot @@ -1,83 +1,85 @@ -CapabilityRegistry_AddCapabilitiesTest:test_AddCapability_NoConfigurationContract() (gas: 152156) -CapabilityRegistry_AddCapabilitiesTest:test_AddCapability_WithConfiguration() (gas: 176137) -CapabilityRegistry_AddCapabilitiesTest:test_RevertWhen_CalledByNonAdmin() (gas: 24723) -CapabilityRegistry_AddCapabilitiesTest:test_RevertWhen_CapabilityExists() (gas: 145769) -CapabilityRegistry_AddCapabilitiesTest:test_RevertWhen_ConfigurationContractDoesNotMatchInterface() (gas: 94606) -CapabilityRegistry_AddCapabilitiesTest:test_RevertWhen_ConfigurationContractNotDeployed() (gas: 92961) -CapabilityRegistry_AddDONTest:test_AddDON() (gas: 499005) -CapabilityRegistry_AddDONTest:test_RevertWhen_CalledByNonAdmin() (gas: 19247) -CapabilityRegistry_AddDONTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 291948) -CapabilityRegistry_AddDONTest:test_RevertWhen_DeprecatedCapabilityAdded() (gas: 365161) -CapabilityRegistry_AddDONTest:test_RevertWhen_DuplicateCapabilityAdded() (gas: 375975) -CapabilityRegistry_AddDONTest:test_RevertWhen_DuplicateNodeAdded() (gas: 177964) -CapabilityRegistry_AddDONTest:test_RevertWhen_FaultToleranceIsZero() (gas: 43332) -CapabilityRegistry_AddDONTest:test_RevertWhen_NodeDoesNotSupportCapability() (gas: 306409) -CapabilityRegistry_AddNodeOperatorsTest:test_AddNodeOperators() (gas: 184333) -CapabilityRegistry_AddNodeOperatorsTest:test_RevertWhen_CalledByNonAdmin() (gas: 17602) -CapabilityRegistry_AddNodeOperatorsTest:test_RevertWhen_NodeOperatorAdminAddressZero() (gas: 18498) -CapabilityRegistry_AddNodesTest:test_AddsNodeInfo() (gas: 355400) -CapabilityRegistry_AddNodesTest:test_OwnerCanAddNodes() (gas: 355388) -CapabilityRegistry_AddNodesTest:test_RevertWhen_AddingDuplicateP2PId() (gas: 301350) -CapabilityRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithInvalidCapability() (gas: 55207) -CapabilityRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithInvalidNodeOperator() (gas: 24940) -CapabilityRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithoutCapabilities() (gas: 27702) -CapabilityRegistry_AddNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 25108) -CapabilityRegistry_AddNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 27408) -CapabilityRegistry_AddNodesTest:test_RevertWhen_SignerAddressEmpty() (gas: 27047) -CapabilityRegistry_AddNodesTest:test_RevertWhen_SignerAddressNotUnique() (gas: 309778) -CapabilityRegistry_DeprecateCapabilitiesTest:test_DeprecatesCapability() (gas: 92938) -CapabilityRegistry_DeprecateCapabilitiesTest:test_EmitsEvent() (gas: 93066) -CapabilityRegistry_DeprecateCapabilitiesTest:test_RevertWhen_CalledByNonAdmin() (gas: 22944) -CapabilityRegistry_DeprecateCapabilitiesTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 16231) -CapabilityRegistry_DeprecateCapabilitiesTest:test_RevertWhen_CapabilityIsDeprecated() (gas: 94395) -CapabilityRegistry_GetCapabilitiesTest:test_ExcludesDeprecatedCapabilities() (gas: 122114) -CapabilityRegistry_GetCapabilitiesTest:test_ReturnsCapabilities() (gas: 58311) -CapabilityRegistry_GetDONsTest:test_CorrectlyFetchesDONs() (gas: 65746) -CapabilityRegistry_GetDONsTest:test_DoesNotIncludeRemovedDONs() (gas: 88461) -CapabilityRegistry_GetHashedCapabilityTest:test_CorrectlyGeneratesHashedCapabilityId() (gas: 11428) -CapabilityRegistry_GetHashedCapabilityTest:test_DoesNotCauseIncorrectClashes() (gas: 13087) -CapabilityRegistry_GetNodeOperatorsTest:test_CorrectlyFetchesNodeOperators() (gas: 36653) -CapabilityRegistry_GetNodeOperatorsTest:test_DoesNotIncludeRemovedNodeOperators() (gas: 38938) -CapabilityRegistry_GetNodesTest:test_CorrectlyFetchesNodes() (gas: 59861) -CapabilityRegistry_GetNodesTest:test_DoesNotIncludeRemovedNodes() (gas: 71597) -CapabilityRegistry_RemoveDONsTest:test_RemovesDON() (gas: 60669) -CapabilityRegistry_RemoveDONsTest:test_RevertWhen_CalledByNonAdmin() (gas: 15647) -CapabilityRegistry_RemoveDONsTest:test_RevertWhen_DONDoesNotExist() (gas: 16518) -CapabilityRegistry_RemoveNodeOperatorsTest:test_RemovesNodeOperator() (gas: 36122) -CapabilityRegistry_RemoveNodeOperatorsTest:test_RevertWhen_CalledByNonOwner() (gas: 15816) -CapabilityRegistry_RemoveNodesTest:test_CanAddNodeWithSameSignerAddressAfterRemoving() (gas: 114054) -CapabilityRegistry_RemoveNodesTest:test_CanRemoveWhenDONDeleted() (gas: 371555) -CapabilityRegistry_RemoveNodesTest:test_CanRemoveWhenNodeNoLongerPartOfDON() (gas: 712587) -CapabilityRegistry_RemoveNodesTest:test_OwnerCanRemoveNodes() (gas: 72342) -CapabilityRegistry_RemoveNodesTest:test_RemovesNode() (gas: 74176) -CapabilityRegistry_RemoveNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 24916) -CapabilityRegistry_RemoveNodesTest:test_RevertWhen_NodeDoesNotExist() (gas: 18418) -CapabilityRegistry_RemoveNodesTest:test_RevertWhen_NodePartOfDON() (gas: 385167) -CapabilityRegistry_RemoveNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 18430) -CapabilityRegistry_TypeAndVersionTest:test_TypeAndVersion() (gas: 9796) -CapabilityRegistry_UpdateDONTest:test_RevertWhen_CalledByNonAdmin() (gas: 19411) -CapabilityRegistry_UpdateDONTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 157904) -CapabilityRegistry_UpdateDONTest:test_RevertWhen_DONDoesNotExist() (gas: 17831) -CapabilityRegistry_UpdateDONTest:test_RevertWhen_DeprecatedCapabilityAdded() (gas: 231117) -CapabilityRegistry_UpdateDONTest:test_RevertWhen_DuplicateCapabilityAdded() (gas: 241977) -CapabilityRegistry_UpdateDONTest:test_RevertWhen_DuplicateNodeAdded() (gas: 103722) -CapabilityRegistry_UpdateDONTest:test_RevertWhen_NodeDoesNotSupportCapability() (gas: 172410) -CapabilityRegistry_UpdateDONTest:test_UpdatesDON() (gas: 433641) -CapabilityRegistry_UpdateNodeOperatorTest:test_RevertWhen_CalledByNonAdminAndNonOwner() (gas: 20627) -CapabilityRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorAdminIsZeroAddress() (gas: 20048) -CapabilityRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorDoesNotExist() (gas: 19786) -CapabilityRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorIdAndParamLengthsMismatch() (gas: 15426) -CapabilityRegistry_UpdateNodeOperatorTest:test_UpdatesNodeOperator() (gas: 36991) -CapabilityRegistry_UpdateNodesTest:test_CanUpdateParamsIfNodeSignerAddressNoLongerUsed() (gas: 250659) -CapabilityRegistry_UpdateNodesTest:test_OwnerCanUpdateNodes() (gas: 158814) -CapabilityRegistry_UpdateNodesTest:test_RevertWhen_AddingNodeWithInvalidCapability() (gas: 35963) -CapabilityRegistry_UpdateNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 25064) -CapabilityRegistry_UpdateNodesTest:test_RevertWhen_NodeDoesNotExist() (gas: 27303) -CapabilityRegistry_UpdateNodesTest:test_RevertWhen_NodeSignerAlreadyAssignedToAnotherNode() (gas: 29184) -CapabilityRegistry_UpdateNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 27291) -CapabilityRegistry_UpdateNodesTest:test_RevertWhen_SignerAddressEmpty() (gas: 26974) -CapabilityRegistry_UpdateNodesTest:test_RevertWhen_UpdatingNodeWithoutCapabilities() (gas: 25538) -CapabilityRegistry_UpdateNodesTest:test_UpdatesNodeInfo() (gas: 158803) +CapabilitiesRegistry_AddCapabilitiesTest:test_AddCapability_NoConfigurationContract() (gas: 154898) +CapabilitiesRegistry_AddCapabilitiesTest:test_AddCapability_WithConfiguration() (gas: 178879) +CapabilitiesRegistry_AddCapabilitiesTest:test_RevertWhen_CalledByNonAdmin() (gas: 24723) +CapabilitiesRegistry_AddCapabilitiesTest:test_RevertWhen_CapabilityExists() (gas: 145769) +CapabilitiesRegistry_AddCapabilitiesTest:test_RevertWhen_ConfigurationContractDoesNotMatchInterface() (gas: 94606) +CapabilitiesRegistry_AddCapabilitiesTest:test_RevertWhen_ConfigurationContractNotDeployed() (gas: 92961) +CapabilitiesRegistry_AddDONTest:test_AddDON() (gas: 372909) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_CalledByNonAdmin() (gas: 19269) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 169874) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_DeprecatedCapabilityAdded() (gas: 239974) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_DuplicateCapabilityAdded() (gas: 249901) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_DuplicateNodeAdded() (gas: 116949) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_FaultToleranceIsZero() (gas: 43354) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_NodeAlreadyBelongsToWorkflowDON() (gas: 344231) +CapabilitiesRegistry_AddDONTest:test_RevertWhen_NodeDoesNotSupportCapability() (gas: 180335) +CapabilitiesRegistry_AddNodeOperatorsTest:test_AddNodeOperators() (gas: 184333) +CapabilitiesRegistry_AddNodeOperatorsTest:test_RevertWhen_CalledByNonAdmin() (gas: 17602) +CapabilitiesRegistry_AddNodeOperatorsTest:test_RevertWhen_NodeOperatorAdminAddressZero() (gas: 18498) +CapabilitiesRegistry_AddNodesTest:test_AddsNodeParams() (gas: 358630) +CapabilitiesRegistry_AddNodesTest:test_OwnerCanAddNodes() (gas: 358596) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_AddingDuplicateP2PId() (gas: 301350) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithInvalidCapability() (gas: 55174) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithInvalidNodeOperator() (gas: 24895) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithoutCapabilities() (gas: 27669) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 25108) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 27408) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_SignerAddressEmpty() (gas: 27047) +CapabilitiesRegistry_AddNodesTest:test_RevertWhen_SignerAddressNotUnique() (gas: 309800) +CapabilitiesRegistry_DeprecateCapabilitiesTest:test_DeprecatesCapability() (gas: 89870) +CapabilitiesRegistry_DeprecateCapabilitiesTest:test_EmitsEvent() (gas: 89998) +CapabilitiesRegistry_DeprecateCapabilitiesTest:test_RevertWhen_CalledByNonAdmin() (gas: 22944) +CapabilitiesRegistry_DeprecateCapabilitiesTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 16231) +CapabilitiesRegistry_DeprecateCapabilitiesTest:test_RevertWhen_CapabilityIsDeprecated() (gas: 91327) +CapabilitiesRegistry_GetCapabilitiesTest:test_ReturnsCapabilities() (gas: 135740) +CapabilitiesRegistry_GetDONsTest:test_CorrectlyFetchesDONs() (gas: 65746) +CapabilitiesRegistry_GetDONsTest:test_DoesNotIncludeRemovedDONs() (gas: 65329) +CapabilitiesRegistry_GetHashedCapabilityTest:test_CorrectlyGeneratesHashedCapabilityId() (gas: 11428) +CapabilitiesRegistry_GetHashedCapabilityTest:test_DoesNotCauseIncorrectClashes() (gas: 13087) +CapabilitiesRegistry_GetNodeOperatorsTest:test_CorrectlyFetchesNodeOperators() (gas: 36653) +CapabilitiesRegistry_GetNodeOperatorsTest:test_DoesNotIncludeRemovedNodeOperators() (gas: 38938) +CapabilitiesRegistry_GetNodesTest:test_CorrectlyFetchesNodes() (gas: 65408) +CapabilitiesRegistry_GetNodesTest:test_DoesNotIncludeRemovedNodes() (gas: 73634) +CapabilitiesRegistry_RemoveDONsTest:test_RemovesDON() (gas: 54946) +CapabilitiesRegistry_RemoveDONsTest:test_RevertWhen_CalledByNonAdmin() (gas: 15647) +CapabilitiesRegistry_RemoveDONsTest:test_RevertWhen_DONDoesNotExist() (gas: 16550) +CapabilitiesRegistry_RemoveNodeOperatorsTest:test_RemovesNodeOperator() (gas: 36122) +CapabilitiesRegistry_RemoveNodeOperatorsTest:test_RevertWhen_CalledByNonOwner() (gas: 15816) +CapabilitiesRegistry_RemoveNodesTest:test_CanAddNodeWithSameSignerAddressAfterRemoving() (gas: 115399) +CapabilitiesRegistry_RemoveNodesTest:test_CanRemoveWhenDONDeleted() (gas: 288275) +CapabilitiesRegistry_RemoveNodesTest:test_CanRemoveWhenNodeNoLongerPartOfDON() (gas: 562024) +CapabilitiesRegistry_RemoveNodesTest:test_OwnerCanRemoveNodes() (gas: 73428) +CapabilitiesRegistry_RemoveNodesTest:test_RemovesNode() (gas: 75262) +CapabilitiesRegistry_RemoveNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 25053) +CapabilitiesRegistry_RemoveNodesTest:test_RevertWhen_NodeDoesNotExist() (gas: 18418) +CapabilitiesRegistry_RemoveNodesTest:test_RevertWhen_NodePartOfCapabilitiesDON() (gas: 385680) +CapabilitiesRegistry_RemoveNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 18408) +CapabilitiesRegistry_TypeAndVersionTest:test_TypeAndVersion() (gas: 9796) +CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_CalledByNonAdmin() (gas: 19411) +CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 153162) +CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_DONDoesNotExist() (gas: 17831) +CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_DeprecatedCapabilityAdded() (gas: 223307) +CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_DuplicateCapabilityAdded() (gas: 233235) +CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_DuplicateNodeAdded() (gas: 107828) +CapabilitiesRegistry_UpdateDONTest:test_RevertWhen_NodeDoesNotSupportCapability() (gas: 163668) +CapabilitiesRegistry_UpdateDONTest:test_UpdatesDON() (gas: 372699) +CapabilitiesRegistry_UpdateNodeOperatorTest:test_RevertWhen_CalledByNonAdminAndNonOwner() (gas: 20627) +CapabilitiesRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorAdminIsZeroAddress() (gas: 20048) +CapabilitiesRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorDoesNotExist() (gas: 19786) +CapabilitiesRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorIdAndParamLengthsMismatch() (gas: 15426) +CapabilitiesRegistry_UpdateNodeOperatorTest:test_UpdatesNodeOperator() (gas: 36991) +CapabilitiesRegistry_UpdateNodesTest:test_CanUpdateParamsIfNodeSignerAddressNoLongerUsed() (gas: 256393) +CapabilitiesRegistry_UpdateNodesTest:test_OwnerCanUpdateNodes() (gas: 162174) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_AddingNodeWithInvalidCapability() (gas: 35766) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 25069) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_NodeDoesNotExist() (gas: 27308) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_NodeSignerAlreadyAssignedToAnotherNode() (gas: 29219) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 27296) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_RemovingCapabilityRequiredByCapabilityDON() (gas: 471181) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_RemovingCapabilityRequiredByWorkflowDON() (gas: 341462) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_SignerAddressEmpty() (gas: 26951) +CapabilitiesRegistry_UpdateNodesTest:test_RevertWhen_UpdatingNodeWithoutCapabilities() (gas: 25480) +CapabilitiesRegistry_UpdateNodesTest:test_UpdatesNodeParams() (gas: 162228) KeystoneForwarder_ReportTest:test_Report_ConfigVersion() (gas: 1802140) KeystoneForwarder_ReportTest:test_Report_FailedDeliveryWhenReceiverInterfaceNotSupported() (gas: 126020) KeystoneForwarder_ReportTest:test_Report_FailedDeliveryWhenReceiverNotContract() (gas: 127513) diff --git a/contracts/scripts/native_solc_compile_all_keystone b/contracts/scripts/native_solc_compile_all_keystone index 1530b307dbd..4b7fca590d6 100755 --- a/contracts/scripts/native_solc_compile_all_keystone +++ b/contracts/scripts/native_solc_compile_all_keystone @@ -28,6 +28,6 @@ compileContract () { "$ROOT"/contracts/src/v0.8/"$1" } -compileContract keystone/CapabilityRegistry.sol +compileContract keystone/CapabilitiesRegistry.sol compileContract keystone/KeystoneForwarder.sol compileContract keystone/OCR3Capability.sol diff --git a/contracts/src/v0.8/keystone/CapabilityRegistry.sol b/contracts/src/v0.8/keystone/CapabilitiesRegistry.sol similarity index 80% rename from contracts/src/v0.8/keystone/CapabilityRegistry.sol rename to contracts/src/v0.8/keystone/CapabilitiesRegistry.sol index 9b59439e1b0..ff68b292836 100644 --- a/contracts/src/v0.8/keystone/CapabilityRegistry.sol +++ b/contracts/src/v0.8/keystone/CapabilitiesRegistry.sol @@ -7,7 +7,7 @@ import {IERC165} from "../vendor/openzeppelin-solidity/v4.8.3/contracts/interfac import {EnumerableSet} from "../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/structs/EnumerableSet.sol"; import {ICapabilityConfiguration} from "./interfaces/ICapabilityConfiguration.sol"; -/// @notice CapabilityRegistry is used to manage Nodes (including their links to Node +/// @notice CapabilitiesRegistry is used to manage Nodes (including their links to Node /// Operators), Capabilities, and DONs (Decentralized Oracle Networks) which are /// sets of nodes that support those Capabilities. /// @dev The contract currently stores the entire state of Node Operators, Nodes, @@ -15,7 +15,7 @@ import {ICapabilityConfiguration} from "./interfaces/ICapabilityConfiguration.so /// if an upgrade is ever required. The team acknowledges this and is fine /// reconfiguring the upgraded contract in the future so as to not add extra /// complexity to this current version. -contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { +contract CapabilitiesRegistry is OwnerIsCreator, TypeAndVersionInterface { // Add the library methods using EnumerableSet for EnumerableSet.Bytes32Set; using EnumerableSet for EnumerableSet.UintSet; @@ -31,17 +31,39 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { string name; } + struct NodeParams { + /// @notice The id of the node operator that manages this node + uint32 nodeOperatorId; + /// @notice The signer address for application-layer message verification. + bytes32 signer; + /// @notice This is an Ed25519 public key that is used to identify a node. + /// This key is guaranteed to be unique in the CapabilitiesRegistry. It is + /// used to identify a node in the the P2P network. + bytes32 p2pId; + /// @notice The list of hashed capability IDs supported by the node + bytes32[] hashedCapabilityIds; + } + struct NodeInfo { /// @notice The id of the node operator that manages this node uint32 nodeOperatorId; + /// @notice The number of times the node's configuration has been updated + uint32 configCount; + /// @notice The ID of the Workflow DON that the node belongs to. A node can + /// only belong to one DON that accepts Workflows. + uint32 workflowDONId; /// @notice The signer address for application-layer message verification. bytes32 signer; /// @notice This is an Ed25519 public key that is used to identify a node. - /// This key is guaranteed to be unique in the CapabilityRegistry. It is + /// This key is guaranteed to be unique in the CapabilitiesRegistry. It is /// used to identify a node in the the P2P network. bytes32 p2pId; /// @notice The list of hashed capability IDs supported by the node bytes32[] hashedCapabilityIds; + /// @notice The list of capabilities DON Ids supported by the node. A node + /// can belong to multiple capabilities DONs. This list does not include a + /// Workflow DON id if the node belongs to one. + uint256[] capabilitiesDONIds; } struct Node { @@ -50,8 +72,11 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { uint32 nodeOperatorId; /// @notice The number of times the node's configuration has been updated uint32 configCount; + /// @notice The ID of the Workflow DON that the node belongs to. A node can + /// only belong to one DON that accepts Workflows. + uint32 workflowDONId; /// @notice The signer address for application-layer message verification. - /// @dev This key is guaranteed to be unique in the CapabilityRegistry + /// @dev This key is guaranteed to be unique in the CapabilitiesRegistry /// as a signer address can only belong to one node. /// @dev This should be the ABI encoded version of the node's address. /// I.e 0x0000address. The Capability Registry does not store it as an address so that @@ -59,7 +84,7 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { /// in the future. bytes32 signer; /// @notice This is an Ed25519 public key that is used to identify a node. - /// This key is guaranteed to be unique in the CapabilityRegistry. It is + /// This key is guaranteed to be unique in the CapabilitiesRegistry. It is /// used to identify a node in the the P2P network. bytes32 p2pId; /// @notice The node's supported capabilities @@ -67,8 +92,10 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { /// new capabilities by incrementing the configCount and creating a /// new set of supported capability IDs mapping(uint32 configCount => EnumerableSet.Bytes32Set capabilityId) supportedHashedCapabilityIds; - /// @notice The list of DON Ids supported by the node. - EnumerableSet.UintSet supportedDONIds; + /// @notice The list of capabilities DON Ids supported by the node. A node + /// can belong to multiple capabilities DONs. This list does not include a + /// Workflow DON id if the node belongs to one. + EnumerableSet.UintSet capabilitiesDONIds; } /// @notice CapabilityResponseType indicates whether remote response requires @@ -101,8 +128,41 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { /// /// Ex. id = "data-streams-reports:chain:ethereum@1.0.0" /// labelledName = "data-streams-reports:chain:ethereum" + string labelledName; + /// @notice Semver, e.g., "1.2.3" + /// @dev must be valid Semver + max 32 characters. + string version; + /// @notice CapabilityType indicates the type of capability which determines + /// where the capability can be used in a Workflow Spec. + CapabilityType capabilityType; + /// @notice CapabilityResponseType indicates whether remote response requires + // aggregation or is an already aggregated report. There are multiple + // possible ways to aggregate. + CapabilityResponseType responseType; + /// @notice An address to the capability configuration contract. Having this defined + // on a capability enforces consistent configuration across DON instances + // serving the same capability. Configuration contract MUST implement + // CapabilityConfigurationContractInterface. + // + /// @dev The main use cases are: + // 1) Sharing capability configuration across DON instances + // 2) Inspect and modify on-chain configuration without off-chain + // capability code. + // + // It is not recommended to store configuration which requires knowledge of + // the DON membership. + address configurationContract; + } + + struct CapabilityInfo { + /// @notice A hashed ID created by the `getHashedCapabilityId` function. + bytes32 hashedId; + /// @notice The partially qualified ID for the capability. + /// @dev Given the following capability ID: {name}:{label1_key}_{label1_value}:{label2_key}_{label2_value}@{version} + // Then we denote the `labelledName` as the `{name}:{label1_key}_{label1_value}:{label2_key}_{label2_value}` portion of the ID. /// - /// validation regex: ^[a-z0-9_\-:]{1,32}$ + /// Ex. id = "data-streams-reports:chain:ethereum@1.0.0" + /// labelledName = "data-streams-reports:chain:ethereum" string labelledName; /// @notice Semver, e.g., "1.2.3" /// @dev must be valid Semver + max 32 characters. @@ -127,6 +187,8 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { // It is not recommended to store configuration which requires knowledge of // the DON membership. address configurationContract; + /// @notice True if the capability is deprecated + bool isDeprecated; } /// @notice CapabilityConfiguration is a struct that holds the capability configuration @@ -163,7 +225,9 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { /// @notice True if the DON is public. A public DON means that it accepts /// external capability requests bool isPublic; - /// @notice True if the DON accepts Workflows. + /// @notice True if the DON accepts Workflows. A DON that accepts Workflows + /// is called Workflow DON and it can process Workflow Specs. A Workflow + /// DON also support one or more capabilities as well. bool acceptsWorkflows; /// @notice Mapping of config counts to configurations mapping(uint32 configCount => DONCapabilityConfig donConfig) config; @@ -287,9 +351,24 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { error NodeOperatorDoesNotExist(uint32 nodeOperatorId); /// @notice This error is thrown when trying to remove a node that is still - /// part of a DON + /// part of a capabitlities DON + /// @param donId The Id of the DON the node belongs to /// @param nodeP2PId The P2P Id of the node being removed - error NodePartOfDON(bytes32 nodeP2PId); + error NodePartOfCapabilitiesDON(uint32 donId, bytes32 nodeP2PId); + + /// @notice This error is thrown when attempting to add a node to a second + /// Workflow DON or when trying to remove a node that belongs to a Workflow + /// DON + /// @param donId The Id of the DON the node belongs to + /// @param nodeP2PId The P2P Id of the node + error NodePartOfWorkflowDON(uint32 donId, bytes32 nodeP2PId); + + /// @notice This error is thrown when removing a capability from the node + /// when that capability is still required by one of the DONs the node + /// belongs to. + /// @param hashedCapabilityId The hashed ID of the capability + /// @param donId The ID of the DON that requires the capability + error CapabilityRequiredByDON(bytes32 hashedCapabilityId, uint32 donId); /// @notice This error is thrown when trying to add a capability with a /// configuration contract that does not implement the required interface. @@ -353,8 +432,6 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { /// @notice Set of deprecated hashed capability IDs, /// A hashed ID is created by the function `getHashedCapabilityId`. - /// - /// Deprecated capabilities are skipped by the `getCapabilities` function. EnumerableSet.Bytes32Set private s_deprecatedHashedCapabilityIds; /// @notice Encoded node signer addresses @@ -383,7 +460,7 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { uint32 private s_nextDONId = 1; function typeAndVersion() external pure override returns (string memory) { - return "CapabilityRegistry 1.0.0"; + return "CapabilitiesRegistry 1.0.0"; } /// @notice Adds a list of node operators @@ -469,10 +546,10 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { /// @notice Adds nodes. Nodes can be added with deprecated capabilities to /// avoid breaking changes when deprecating capabilities. /// @param nodes The nodes to add - function addNodes(NodeInfo[] calldata nodes) external { + function addNodes(NodeParams[] calldata nodes) external { bool isOwner = msg.sender == owner(); for (uint256 i; i < nodes.length; ++i) { - NodeInfo memory node = nodes[i]; + NodeParams memory node = nodes[i]; NodeOperator memory nodeOperator = s_nodeOperators[node.nodeOperatorId]; if (nodeOperator.admin == address(0)) revert NodeOperatorDoesNotExist(node.nodeOperatorId); @@ -515,7 +592,9 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { Node storage node = s_nodes[p2pId]; if (node.signer == bytes32("")) revert NodeDoesNotExist(p2pId); - if (node.supportedDONIds.length() > 0) revert NodePartOfDON(p2pId); + if (node.capabilitiesDONIds.length() > 0) + revert NodePartOfCapabilitiesDON(uint32(node.capabilitiesDONIds.at(i)), p2pId); + if (node.workflowDONId != 0) revert NodePartOfWorkflowDON(node.workflowDONId, p2pId); if (!isOwner && msg.sender != s_nodeOperators[node.nodeOperatorId].admin) revert AccessForbidden(msg.sender); s_nodeSigners.remove(node.signer); @@ -528,73 +607,94 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { /// @notice Updates nodes. The node admin can update the node's signer address /// and reconfigure its supported capabilities /// @param nodes The nodes to update - function updateNodes(NodeInfo[] calldata nodes) external { + function updateNodes(NodeParams[] calldata nodes) external { bool isOwner = msg.sender == owner(); for (uint256 i; i < nodes.length; ++i) { - NodeInfo memory node = nodes[i]; - + NodeParams memory node = nodes[i]; NodeOperator memory nodeOperator = s_nodeOperators[node.nodeOperatorId]; if (!isOwner && msg.sender != nodeOperator.admin) revert AccessForbidden(msg.sender); Node storage storedNode = s_nodes[node.p2pId]; if (storedNode.signer == bytes32("")) revert NodeDoesNotExist(node.p2pId); + if (node.signer == bytes32("")) revert InvalidNodeSigner(); - if (node.signer == bytes32("") || (storedNode.signer != node.signer && s_nodeSigners.contains(node.signer))) - revert InvalidNodeSigner(); + bytes32 previousSigner = storedNode.signer; + if (previousSigner != node.signer) { + if (s_nodeSigners.contains(node.signer)) revert InvalidNodeSigner(); + storedNode.signer = node.signer; + s_nodeSigners.remove(previousSigner); + s_nodeSigners.add(node.signer); + } bytes32[] memory supportedHashedCapabilityIds = node.hashedCapabilityIds; if (supportedHashedCapabilityIds.length == 0) revert InvalidNodeCapabilities(supportedHashedCapabilityIds); - storedNode.configCount++; - uint32 capabilityConfigCount = storedNode.configCount; + uint32 capabilityConfigCount = ++storedNode.configCount; for (uint256 j; j < supportedHashedCapabilityIds.length; ++j) { if (!s_hashedCapabilityIds.contains(supportedHashedCapabilityIds[j])) revert InvalidNodeCapabilities(supportedHashedCapabilityIds); storedNode.supportedHashedCapabilityIds[capabilityConfigCount].add(supportedHashedCapabilityIds[j]); } - storedNode.nodeOperatorId = node.nodeOperatorId; - storedNode.p2pId = node.p2pId; + // Validate that capabilities required by a Workflow DON are still supported + uint32 nodeWorkflowDONId = storedNode.workflowDONId; + if (nodeWorkflowDONId != 0) { + bytes32[] memory workflowDonCapabilityIds = s_dons[nodeWorkflowDONId] + .config[s_dons[nodeWorkflowDONId].configCount] + .capabilityIds; + + for (uint256 j; j < workflowDonCapabilityIds.length; ++j) { + if (!storedNode.supportedHashedCapabilityIds[capabilityConfigCount].contains(workflowDonCapabilityIds[j])) + revert CapabilityRequiredByDON(workflowDonCapabilityIds[j], nodeWorkflowDONId); + } + } - bytes32 previousSigner = storedNode.signer; + // Validate that capabilities required by capabilities DONs are still supported + uint256[] memory capabilitiesDONIds = storedNode.capabilitiesDONIds.values(); + for (uint32 j; j < capabilitiesDONIds.length; ++j) { + uint32 donId = uint32(capabilitiesDONIds[j]); + bytes32[] memory donCapabilityIds = s_dons[donId].config[s_dons[donId].configCount].capabilityIds; - if (storedNode.signer != node.signer) { - s_nodeSigners.remove(previousSigner); - storedNode.signer = node.signer; - s_nodeSigners.add(node.signer); + for (uint256 k; k < donCapabilityIds.length; ++k) { + if (!storedNode.supportedHashedCapabilityIds[capabilityConfigCount].contains(donCapabilityIds[k])) + revert CapabilityRequiredByDON(donCapabilityIds[k], donId); + } } + + storedNode.nodeOperatorId = node.nodeOperatorId; + storedNode.p2pId = node.p2pId; + emit NodeUpdated(node.p2pId, node.nodeOperatorId, node.signer); } } /// @notice Gets a node's data /// @param p2pId The P2P ID of the node to query for - /// @return NodeInfo The node data - /// @return configCount The number of times the node has been configured - function getNode(bytes32 p2pId) public view returns (NodeInfo memory, uint32 configCount) { + /// @return nodeInfo NodeInfo The node data + function getNode(bytes32 p2pId) public view returns (NodeInfo memory nodeInfo) { return ( NodeInfo({ nodeOperatorId: s_nodes[p2pId].nodeOperatorId, p2pId: s_nodes[p2pId].p2pId, signer: s_nodes[p2pId].signer, - hashedCapabilityIds: s_nodes[p2pId].supportedHashedCapabilityIds[s_nodes[p2pId].configCount].values() - }), - s_nodes[p2pId].configCount + hashedCapabilityIds: s_nodes[p2pId].supportedHashedCapabilityIds[s_nodes[p2pId].configCount].values(), + configCount: s_nodes[p2pId].configCount, + workflowDONId: s_nodes[p2pId].workflowDONId, + capabilitiesDONIds: s_nodes[p2pId].capabilitiesDONIds.values() + }) ); } /// @notice Gets all nodes - /// @return nodeInfo NodeInfo[] All nodes in the capability registry - /// @return configCounts uint32[] All the config counts for the nodes in the capability registry - function getNodes() external view returns (NodeInfo[] memory nodeInfo, uint32[] memory configCounts) { + /// @return NodeInfo[] All nodes in the capability registry + function getNodes() external view returns (NodeInfo[] memory) { bytes32[] memory p2pIds = s_nodeP2PIds.values(); - nodeInfo = new NodeInfo[](p2pIds.length); - configCounts = new uint32[](p2pIds.length); + NodeInfo[] memory nodesInfo = new NodeInfo[](p2pIds.length); for (uint256 i; i < p2pIds.length; ++i) { - (nodeInfo[i], configCounts[i]) = getNode(p2pIds[i]); + nodesInfo[i] = getNode(p2pIds[i]); } - return (nodeInfo, configCounts); + return nodesInfo; } /// @notice Adds a new capability to the capability registry @@ -619,51 +719,38 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { if (!s_hashedCapabilityIds.contains(hashedCapabilityId)) revert CapabilityDoesNotExist(hashedCapabilityId); if (!s_deprecatedHashedCapabilityIds.add(hashedCapabilityId)) revert CapabilityIsDeprecated(hashedCapabilityId); - delete s_capabilities[hashedCapabilityId]; emit CapabilityDeprecated(hashedCapabilityId); } } /// @notice Returns a Capability by its hashed ID. /// @dev Use `getHashedCapabilityId` to get the hashed ID. - function getCapability(bytes32 hashedId) external view returns (Capability memory) { - return s_capabilities[hashedId]; + function getCapability(bytes32 hashedId) public view returns (CapabilityInfo memory) { + return ( + CapabilityInfo({ + hashedId: hashedId, + labelledName: s_capabilities[hashedId].labelledName, + version: s_capabilities[hashedId].version, + capabilityType: s_capabilities[hashedId].capabilityType, + responseType: s_capabilities[hashedId].responseType, + configurationContract: s_capabilities[hashedId].configurationContract, + isDeprecated: s_deprecatedHashedCapabilityIds.contains(hashedId) + }) + ); } /// @notice Returns all capabilities. This operation will copy capabilities /// to memory, which can be quite expensive. This is designed to mostly be /// used by view accessors that are queried without any gas fees. - /// @return hashedCapabilityIds bytes32[] List of hashed capability Ids - /// @return capabilities Capability[] List of capabilities - function getCapabilities() - external - view - returns (bytes32[] memory hashedCapabilityIds, Capability[] memory capabilities) - { - hashedCapabilityIds = s_hashedCapabilityIds.values(); - - uint256 numSupportedCapabilities = hashedCapabilityIds.length - s_deprecatedHashedCapabilityIds.length(); - - // Solidity does not support dynamic arrays in memory, so we create a - // fixed-size array and copy the capabilities into it. - capabilities = new Capability[](numSupportedCapabilities); - bytes32[] memory supportedHashedCapabilityIds = new bytes32[](numSupportedCapabilities); - - // We need to keep track of the new index because we are skipping - // deprecated capabilities. - uint256 newIndex; + /// @return CapabilityInfo[] List of capabilities + function getCapabilities() external view returns (CapabilityInfo[] memory) { + bytes32[] memory hashedCapabilityIds = s_hashedCapabilityIds.values(); + CapabilityInfo[] memory capabilitiesInfo = new CapabilityInfo[](hashedCapabilityIds.length); for (uint256 i; i < hashedCapabilityIds.length; ++i) { - bytes32 hashedCapabilityId = hashedCapabilityIds[i]; - - if (!s_deprecatedHashedCapabilityIds.contains(hashedCapabilityId)) { - capabilities[newIndex] = s_capabilities[hashedCapabilityId]; - supportedHashedCapabilityIds[newIndex] = hashedCapabilityId; - ++newIndex; - } + capabilitiesInfo[i] = getCapability(hashedCapabilityIds[i]); } - - return (supportedHashedCapabilityIds, capabilities); + return capabilitiesInfo; } /// @notice This functions returns a capability id that has been hashed to fit into a bytes32 for cheaper access @@ -740,8 +827,13 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { uint32 configCount = don.configCount; EnumerableSet.Bytes32Set storage nodeP2PIds = don.config[configCount].nodes; + bool isWorkflowDON = don.acceptsWorkflows; for (uint256 j; j < nodeP2PIds.length(); ++j) { - s_nodes[nodeP2PIds.at(j)].supportedDONIds.remove(donId); + if (isWorkflowDON) { + delete s_nodes[nodeP2PIds.at(j)].workflowDONId; + } else { + s_nodes[nodeP2PIds.at(j)].capabilitiesDONIds.remove(donId); + } } // DON config count starts at index 1 @@ -827,16 +919,23 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface { // needed as the previous config will be overwritten by storing the latest config // at configCount for (uint256 i; i < prevDONCapabilityConfig.nodes.length(); ++i) { - s_nodes[prevDONCapabilityConfig.nodes.at(i)].supportedDONIds.remove(donParams.id); + s_nodes[prevDONCapabilityConfig.nodes.at(i)].capabilitiesDONIds.remove(donParams.id); + delete s_nodes[prevDONCapabilityConfig.nodes.at(i)].workflowDONId; } } for (uint256 i; i < nodes.length; ++i) { if (!donCapabilityConfig.nodes.add(nodes[i])) revert DuplicateDONNode(donParams.id, nodes[i]); - /// Fine to add a duplicate DON ID to the set of supported DON IDs again as the set - /// will only store unique DON IDs - s_nodes[nodes[i]].supportedDONIds.add(donParams.id); + if (donParams.acceptsWorkflows) { + if (s_nodes[nodes[i]].workflowDONId != donParams.id && s_nodes[nodes[i]].workflowDONId != 0) + revert NodePartOfWorkflowDON(donParams.id, nodes[i]); + s_nodes[nodes[i]].workflowDONId = donParams.id; + } else { + /// Fine to add a duplicate DON ID to the set of supported DON IDs again as the set + /// will only store unique DON IDs + s_nodes[nodes[i]].capabilitiesDONIds.add(donParams.id); + } } for (uint256 i; i < capabilityConfigurations.length; ++i) { diff --git a/contracts/src/v0.8/keystone/KeystoneForwarder.sol b/contracts/src/v0.8/keystone/KeystoneForwarder.sol index fe0597ae8f0..07b4b34da79 100644 --- a/contracts/src/v0.8/keystone/KeystoneForwarder.sol +++ b/contracts/src/v0.8/keystone/KeystoneForwarder.sol @@ -91,7 +91,7 @@ contract KeystoneForwarder is OwnerIsCreator, ITypeAndVersion, IRouter { uint256 internal constant SIGNATURE_LENGTH = 65; // ================================================================ - // │ IRouter │ + // │ Router │ // ================================================================ mapping(address forwarder => bool) internal s_forwarders; diff --git a/contracts/src/v0.8/keystone/interfaces/ICapabilityConfiguration.sol b/contracts/src/v0.8/keystone/interfaces/ICapabilityConfiguration.sol index 4deaaa4443e..429c2a1d3aa 100644 --- a/contracts/src/v0.8/keystone/interfaces/ICapabilityConfiguration.sol +++ b/contracts/src/v0.8/keystone/interfaces/ICapabilityConfiguration.sol @@ -16,7 +16,7 @@ interface ICapabilityConfiguration { /// @notice Returns the capability configuration for a particular DON instance. /// @dev donId is required to get DON-specific configuration. It avoids a /// situation where configuration size grows too large. - /// @param donId The DON instance ID. These are stored in the CapabilityRegistry. + /// @param donId The DON instance ID. These are stored in the CapabilitiesRegistry. /// @return configuration DON's configuration for the capability. function getCapabilityConfiguration(uint32 donId) external view returns (bytes memory configuration); diff --git a/contracts/src/v0.8/keystone/test/BaseTest.t.sol b/contracts/src/v0.8/keystone/test/BaseTest.t.sol index 795bb40843e..e637406c145 100644 --- a/contracts/src/v0.8/keystone/test/BaseTest.t.sol +++ b/contracts/src/v0.8/keystone/test/BaseTest.t.sol @@ -4,53 +4,59 @@ pragma solidity ^0.8.19; import {Test} from "forge-std/Test.sol"; import {Constants} from "./Constants.t.sol"; import {CapabilityConfigurationContract} from "./mocks/CapabilityConfigurationContract.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; contract BaseTest is Test, Constants { - CapabilityRegistry internal s_capabilityRegistry; + CapabilitiesRegistry internal s_CapabilitiesRegistry; CapabilityConfigurationContract internal s_capabilityConfigurationContract; - CapabilityRegistry.Capability internal s_basicCapability; - CapabilityRegistry.Capability internal s_capabilityWithConfigurationContract; + CapabilitiesRegistry.Capability internal s_basicCapability; + CapabilitiesRegistry.Capability internal s_capabilityWithConfigurationContract; bytes32 internal s_basicHashedCapabilityId; bytes32 internal s_capabilityWithConfigurationContractId; bytes32 internal s_nonExistentHashedCapabilityId; function setUp() public virtual { vm.startPrank(ADMIN); - s_capabilityRegistry = new CapabilityRegistry(); + s_CapabilitiesRegistry = new CapabilitiesRegistry(); s_capabilityConfigurationContract = new CapabilityConfigurationContract(); - s_basicCapability = CapabilityRegistry.Capability({ + s_basicCapability = CapabilitiesRegistry.Capability({ labelledName: "data-streams-reports", version: "1.0.0", - responseType: CapabilityRegistry.CapabilityResponseType.REPORT, + responseType: CapabilitiesRegistry.CapabilityResponseType.REPORT, configurationContract: address(0), - capabilityType: CapabilityRegistry.CapabilityType.TRIGGER + capabilityType: CapabilitiesRegistry.CapabilityType.TRIGGER }); - s_capabilityWithConfigurationContract = CapabilityRegistry.Capability({ + s_capabilityWithConfigurationContract = CapabilitiesRegistry.Capability({ labelledName: "read-ethereum-mainnet-gas-price", version: "1.0.2", - responseType: CapabilityRegistry.CapabilityResponseType.OBSERVATION_IDENTICAL, + responseType: CapabilitiesRegistry.CapabilityResponseType.OBSERVATION_IDENTICAL, configurationContract: address(s_capabilityConfigurationContract), - capabilityType: CapabilityRegistry.CapabilityType.ACTION + capabilityType: CapabilitiesRegistry.CapabilityType.ACTION }); - s_basicHashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( + s_basicHashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId( s_basicCapability.labelledName, s_basicCapability.version ); - s_capabilityWithConfigurationContractId = s_capabilityRegistry.getHashedCapabilityId( + s_capabilityWithConfigurationContractId = s_CapabilitiesRegistry.getHashedCapabilityId( s_capabilityWithConfigurationContract.labelledName, s_capabilityWithConfigurationContract.version ); - s_nonExistentHashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId("non-existent-capability", "1.0.0"); + s_nonExistentHashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId("non-existent-capability", "1.0.0"); } - function _getNodeOperators() internal pure returns (CapabilityRegistry.NodeOperator[] memory) { - CapabilityRegistry.NodeOperator[] memory nodeOperators = new CapabilityRegistry.NodeOperator[](3); - nodeOperators[0] = CapabilityRegistry.NodeOperator({admin: NODE_OPERATOR_ONE_ADMIN, name: NODE_OPERATOR_ONE_NAME}); - nodeOperators[1] = CapabilityRegistry.NodeOperator({admin: NODE_OPERATOR_TWO_ADMIN, name: NODE_OPERATOR_TWO_NAME}); - nodeOperators[2] = CapabilityRegistry.NodeOperator({admin: NODE_OPERATOR_THREE, name: NODE_OPERATOR_THREE_NAME}); + function _getNodeOperators() internal pure returns (CapabilitiesRegistry.NodeOperator[] memory) { + CapabilitiesRegistry.NodeOperator[] memory nodeOperators = new CapabilitiesRegistry.NodeOperator[](3); + nodeOperators[0] = CapabilitiesRegistry.NodeOperator({ + admin: NODE_OPERATOR_ONE_ADMIN, + name: NODE_OPERATOR_ONE_NAME + }); + nodeOperators[1] = CapabilitiesRegistry.NodeOperator({ + admin: NODE_OPERATOR_TWO_ADMIN, + name: NODE_OPERATOR_TWO_NAME + }); + nodeOperators[2] = CapabilitiesRegistry.NodeOperator({admin: NODE_OPERATOR_THREE, name: NODE_OPERATOR_THREE_NAME}); return nodeOperators; } } diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddCapabilitiesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddCapabilitiesTest.t.sol similarity index 60% rename from contracts/src/v0.8/keystone/test/CapabilityRegistry_AddCapabilitiesTest.t.sol rename to contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddCapabilitiesTest.t.sol index 6c6b164234f..c63decb68be 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddCapabilitiesTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddCapabilitiesTest.t.sol @@ -4,50 +4,50 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; import {CapabilityConfigurationContract} from "./mocks/CapabilityConfigurationContract.sol"; import {ICapabilityConfiguration} from "../interfaces/ICapabilityConfiguration.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; import {IERC165} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/interfaces/IERC165.sol"; -contract CapabilityRegistry_AddCapabilitiesTest is BaseTest { +contract CapabilitiesRegistry_AddCapabilitiesTest is BaseTest { event CapabilityConfigured(bytes32 indexed hashedCapabilityId); function test_RevertWhen_CalledByNonAdmin() public { changePrank(STRANGER); - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](1); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](1); capabilities[0] = s_basicCapability; vm.expectRevert("Only callable by owner"); - s_capabilityRegistry.addCapabilities(capabilities); + s_CapabilitiesRegistry.addCapabilities(capabilities); } function test_RevertWhen_CapabilityExists() public { - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](1); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](1); capabilities[0] = s_basicCapability; // Successfully add the capability the first time - s_capabilityRegistry.addCapabilities(capabilities); + s_CapabilitiesRegistry.addCapabilities(capabilities); // Try to add the same capability again vm.expectRevert( - abi.encodeWithSelector(CapabilityRegistry.CapabilityAlreadyExists.selector, s_basicHashedCapabilityId) + abi.encodeWithSelector(CapabilitiesRegistry.CapabilityAlreadyExists.selector, s_basicHashedCapabilityId) ); - s_capabilityRegistry.addCapabilities(capabilities); + s_CapabilitiesRegistry.addCapabilities(capabilities); } function test_RevertWhen_ConfigurationContractNotDeployed() public { address nonExistentContract = address(1); s_capabilityWithConfigurationContract.configurationContract = nonExistentContract; - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](1); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](1); capabilities[0] = s_capabilityWithConfigurationContract; vm.expectRevert( abi.encodeWithSelector( - CapabilityRegistry.InvalidCapabilityConfigurationContractInterface.selector, + CapabilitiesRegistry.InvalidCapabilityConfigurationContractInterface.selector, nonExistentContract ) ); - s_capabilityRegistry.addCapabilities(capabilities); + s_CapabilitiesRegistry.addCapabilities(capabilities); } function test_RevertWhen_ConfigurationContractDoesNotMatchInterface() public { @@ -62,27 +62,29 @@ contract CapabilityRegistry_AddCapabilitiesTest is BaseTest { abi.encode(false) ); s_capabilityWithConfigurationContract.configurationContract = contractWithoutERC165; - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](1); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](1); capabilities[0] = s_capabilityWithConfigurationContract; vm.expectRevert( abi.encodeWithSelector( - CapabilityRegistry.InvalidCapabilityConfigurationContractInterface.selector, + CapabilitiesRegistry.InvalidCapabilityConfigurationContractInterface.selector, contractWithoutERC165 ) ); - s_capabilityRegistry.addCapabilities(capabilities); + s_CapabilitiesRegistry.addCapabilities(capabilities); } function test_AddCapability_NoConfigurationContract() public { - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](1); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](1); capabilities[0] = s_basicCapability; - bytes32 hashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId("data-streams-reports", "1.0.0"); - vm.expectEmit(true, true, true, true, address(s_capabilityRegistry)); + bytes32 hashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId("data-streams-reports", "1.0.0"); + vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); emit CapabilityConfigured(hashedCapabilityId); - s_capabilityRegistry.addCapabilities(capabilities); - CapabilityRegistry.Capability memory storedCapability = s_capabilityRegistry.getCapability(hashedCapabilityId); + s_CapabilitiesRegistry.addCapabilities(capabilities); + CapabilitiesRegistry.CapabilityInfo memory storedCapability = s_CapabilitiesRegistry.getCapability( + hashedCapabilityId + ); assertEq(storedCapability.labelledName, s_basicCapability.labelledName); assertEq(storedCapability.version, s_basicCapability.version); @@ -91,18 +93,20 @@ contract CapabilityRegistry_AddCapabilitiesTest is BaseTest { } function test_AddCapability_WithConfiguration() public { - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](1); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](1); capabilities[0] = s_capabilityWithConfigurationContract; - bytes32 hashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( + bytes32 hashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId( s_capabilityWithConfigurationContract.labelledName, s_capabilityWithConfigurationContract.version ); - vm.expectEmit(true, true, true, true, address(s_capabilityRegistry)); + vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); emit CapabilityConfigured(hashedCapabilityId); - s_capabilityRegistry.addCapabilities(capabilities); + s_CapabilitiesRegistry.addCapabilities(capabilities); - CapabilityRegistry.Capability memory storedCapability = s_capabilityRegistry.getCapability(hashedCapabilityId); + CapabilitiesRegistry.CapabilityInfo memory storedCapability = s_CapabilitiesRegistry.getCapability( + hashedCapabilityId + ); assertEq(storedCapability.labelledName, s_capabilityWithConfigurationContract.labelledName); assertEq(storedCapability.version, s_capabilityWithConfigurationContract.version); diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddDONTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddDONTest.t.sol new file mode 100644 index 00000000000..df68f8d173a --- /dev/null +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddDONTest.t.sol @@ -0,0 +1,249 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +import {BaseTest} from "./BaseTest.t.sol"; +import {ICapabilityConfiguration} from "../interfaces/ICapabilityConfiguration.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; + +contract CapabilitiesRegistry_AddDONTest is BaseTest { + event ConfigSet(uint32 donId, uint32 configCount); + + function setUp() public override { + BaseTest.setUp(); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](2); + capabilities[0] = s_basicCapability; + capabilities[1] = s_capabilityWithConfigurationContract; + + s_CapabilitiesRegistry.addNodeOperators(_getNodeOperators()); + s_CapabilitiesRegistry.addCapabilities(capabilities); + + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](3); + bytes32[] memory capabilityIds = new bytes32[](2); + capabilityIds[0] = s_basicHashedCapabilityId; + capabilityIds[1] = s_capabilityWithConfigurationContractId; + + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, + p2pId: P2P_ID, + signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, + hashedCapabilityIds: capabilityIds + }); + + bytes32[] memory nodeTwoCapabilityIds = new bytes32[](1); + nodeTwoCapabilityIds[0] = s_basicHashedCapabilityId; + + nodes[1] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_TWO_ID, + p2pId: P2P_ID_TWO, + signer: NODE_OPERATOR_TWO_SIGNER_ADDRESS, + hashedCapabilityIds: nodeTwoCapabilityIds + }); + + nodes[2] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_THREE_ID, + p2pId: P2P_ID_THREE, + signer: NODE_OPERATOR_THREE_SIGNER_ADDRESS, + hashedCapabilityIds: capabilityIds + }); + + s_CapabilitiesRegistry.addNodes(nodes); + + changePrank(ADMIN); + } + + function test_RevertWhen_CalledByNonAdmin() public { + changePrank(STRANGER); + vm.expectRevert("Only callable by owner"); + bytes32[] memory nodes = new bytes32[](1); + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ + capabilityId: s_basicHashedCapabilityId, + config: BASIC_CAPABILITY_CONFIG + }); + s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); + } + + function test_RevertWhen_NodeDoesNotSupportCapability() public { + bytes32[] memory nodes = new bytes32[](2); + nodes[0] = P2P_ID; + nodes[1] = P2P_ID_TWO; + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ + capabilityId: s_capabilityWithConfigurationContractId, + config: CONFIG_CAPABILITY_CONFIG + }); + vm.expectRevert( + abi.encodeWithSelector( + CapabilitiesRegistry.NodeDoesNotSupportCapability.selector, + P2P_ID_TWO, + s_capabilityWithConfigurationContractId + ) + ); + s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); + } + + function test_RevertWhen_CapabilityDoesNotExist() public { + bytes32[] memory nodes = new bytes32[](2); + nodes[0] = P2P_ID; + nodes[1] = P2P_ID_TWO; + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ + capabilityId: s_nonExistentHashedCapabilityId, + config: BASIC_CAPABILITY_CONFIG + }); + vm.expectRevert( + abi.encodeWithSelector(CapabilitiesRegistry.CapabilityDoesNotExist.selector, s_nonExistentHashedCapabilityId) + ); + s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); + } + + function test_RevertWhen_FaultToleranceIsZero() public { + bytes32[] memory nodes = new bytes32[](1); + nodes[0] = P2P_ID; + + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ + capabilityId: s_basicHashedCapabilityId, + config: BASIC_CAPABILITY_CONFIG + }); + + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.InvalidFaultTolerance.selector, 0, 1)); + s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, true, 0); + } + + function test_RevertWhen_DuplicateCapabilityAdded() public { + bytes32[] memory nodes = new bytes32[](2); + nodes[0] = P2P_ID; + nodes[1] = P2P_ID_TWO; + + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](2); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ + capabilityId: s_basicHashedCapabilityId, + config: BASIC_CAPABILITY_CONFIG + }); + capabilityConfigs[1] = CapabilitiesRegistry.CapabilityConfiguration({ + capabilityId: s_basicHashedCapabilityId, + config: BASIC_CAPABILITY_CONFIG + }); + + vm.expectRevert( + abi.encodeWithSelector(CapabilitiesRegistry.DuplicateDONCapability.selector, 1, s_basicHashedCapabilityId) + ); + s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); + } + + function test_RevertWhen_DeprecatedCapabilityAdded() public { + bytes32 capabilityId = s_basicHashedCapabilityId; + bytes32[] memory deprecatedCapabilities = new bytes32[](1); + deprecatedCapabilities[0] = capabilityId; + s_CapabilitiesRegistry.deprecateCapabilities(deprecatedCapabilities); + + bytes32[] memory nodes = new bytes32[](2); + nodes[0] = P2P_ID; + nodes[1] = P2P_ID_TWO; + + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ + capabilityId: capabilityId, + config: BASIC_CAPABILITY_CONFIG + }); + + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.CapabilityIsDeprecated.selector, capabilityId)); + s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); + } + + function test_RevertWhen_DuplicateNodeAdded() public { + bytes32[] memory nodes = new bytes32[](2); + nodes[0] = P2P_ID; + nodes[1] = P2P_ID; + + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ + capabilityId: s_basicHashedCapabilityId, + config: BASIC_CAPABILITY_CONFIG + }); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.DuplicateDONNode.selector, 1, P2P_ID)); + s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); + } + + function test_RevertWhen_NodeAlreadyBelongsToWorkflowDON() public { + bytes32[] memory nodes = new bytes32[](2); + nodes[0] = P2P_ID; + nodes[1] = P2P_ID_TWO; + + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ + capabilityId: s_basicHashedCapabilityId, + config: BASIC_CAPABILITY_CONFIG + }); + + s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); + + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.NodePartOfWorkflowDON.selector, 2, P2P_ID)); + s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); + } + + function test_AddDON() public { + bytes32[] memory nodes = new bytes32[](2); + nodes[0] = P2P_ID; + nodes[1] = P2P_ID_THREE; + + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](2); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ + capabilityId: s_basicHashedCapabilityId, + config: BASIC_CAPABILITY_CONFIG + }); + capabilityConfigs[1] = CapabilitiesRegistry.CapabilityConfiguration({ + capabilityId: s_capabilityWithConfigurationContractId, + config: CONFIG_CAPABILITY_CONFIG + }); + + vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); + emit ConfigSet(DON_ID, 1); + vm.expectCall( + address(s_capabilityConfigurationContract), + abi.encodeWithSelector( + ICapabilityConfiguration.beforeCapabilityConfigSet.selector, + nodes, + CONFIG_CAPABILITY_CONFIG, + 1, + DON_ID + ), + 1 + ); + s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); + + CapabilitiesRegistry.DONInfo memory donInfo = s_CapabilitiesRegistry.getDON(DON_ID); + assertEq(donInfo.id, DON_ID); + assertEq(donInfo.configCount, 1); + assertEq(donInfo.isPublic, true); + assertEq(donInfo.capabilityConfigurations.length, capabilityConfigs.length); + assertEq(donInfo.capabilityConfigurations[0].capabilityId, s_basicHashedCapabilityId); + + (bytes memory CapabilitiesRegistryDONConfig, bytes memory capabilityConfigContractConfig) = s_CapabilitiesRegistry + .getCapabilityConfigs(DON_ID, s_basicHashedCapabilityId); + assertEq(CapabilitiesRegistryDONConfig, BASIC_CAPABILITY_CONFIG); + assertEq(capabilityConfigContractConfig, bytes("")); + + ( + bytes memory CapabilitiesRegistryDONConfigTwo, + bytes memory capabilityConfigContractConfigTwo + ) = s_CapabilitiesRegistry.getCapabilityConfigs(DON_ID, s_capabilityWithConfigurationContractId); + assertEq(CapabilitiesRegistryDONConfigTwo, CONFIG_CAPABILITY_CONFIG); + assertEq(capabilityConfigContractConfigTwo, CONFIG_CAPABILITY_CONFIG); + + assertEq(donInfo.nodeP2PIds.length, nodes.length); + assertEq(donInfo.nodeP2PIds[0], P2P_ID); + assertEq(donInfo.nodeP2PIds[1], P2P_ID_THREE); + } +} diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddNodeOperatorsTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodeOperatorsTest.t.sol similarity index 56% rename from contracts/src/v0.8/keystone/test/CapabilityRegistry_AddNodeOperatorsTest.t.sol rename to contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodeOperatorsTest.t.sol index 6fa799bd378..4b75739f05f 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddNodeOperatorsTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodeOperatorsTest.t.sol @@ -2,41 +2,41 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; -contract CapabilityRegistry_AddNodeOperatorsTest is BaseTest { +contract CapabilitiesRegistry_AddNodeOperatorsTest is BaseTest { event NodeOperatorAdded(uint32 indexed nodeOperatorId, address indexed admin, string name); function test_RevertWhen_CalledByNonAdmin() public { changePrank(STRANGER); vm.expectRevert("Only callable by owner"); - s_capabilityRegistry.addNodeOperators(_getNodeOperators()); + s_CapabilitiesRegistry.addNodeOperators(_getNodeOperators()); } function test_RevertWhen_NodeOperatorAdminAddressZero() public { changePrank(ADMIN); - CapabilityRegistry.NodeOperator[] memory nodeOperators = _getNodeOperators(); + CapabilitiesRegistry.NodeOperator[] memory nodeOperators = _getNodeOperators(); nodeOperators[0].admin = address(0); - vm.expectRevert(CapabilityRegistry.InvalidNodeOperatorAdmin.selector); - s_capabilityRegistry.addNodeOperators(nodeOperators); + vm.expectRevert(CapabilitiesRegistry.InvalidNodeOperatorAdmin.selector); + s_CapabilitiesRegistry.addNodeOperators(nodeOperators); } function test_AddNodeOperators() public { changePrank(ADMIN); - vm.expectEmit(true, true, true, true, address(s_capabilityRegistry)); + vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); emit NodeOperatorAdded(TEST_NODE_OPERATOR_ONE_ID, NODE_OPERATOR_ONE_ADMIN, NODE_OPERATOR_ONE_NAME); - vm.expectEmit(true, true, true, true, address(s_capabilityRegistry)); + vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); emit NodeOperatorAdded(TEST_NODE_OPERATOR_TWO_ID, NODE_OPERATOR_TWO_ADMIN, NODE_OPERATOR_TWO_NAME); - s_capabilityRegistry.addNodeOperators(_getNodeOperators()); + s_CapabilitiesRegistry.addNodeOperators(_getNodeOperators()); - CapabilityRegistry.NodeOperator memory nodeOperatorOne = s_capabilityRegistry.getNodeOperator( + CapabilitiesRegistry.NodeOperator memory nodeOperatorOne = s_CapabilitiesRegistry.getNodeOperator( TEST_NODE_OPERATOR_ONE_ID ); assertEq(nodeOperatorOne.admin, NODE_OPERATOR_ONE_ADMIN); assertEq(nodeOperatorOne.name, NODE_OPERATOR_ONE_NAME); - CapabilityRegistry.NodeOperator memory nodeOperatorTwo = s_capabilityRegistry.getNodeOperator( + CapabilitiesRegistry.NodeOperator memory nodeOperatorTwo = s_CapabilitiesRegistry.getNodeOperator( TEST_NODE_OPERATOR_TWO_ID ); assertEq(nodeOperatorTwo.admin, NODE_OPERATOR_TWO_ADMIN); diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddNodesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodesTest.t.sol similarity index 60% rename from contracts/src/v0.8/keystone/test/CapabilityRegistry_AddNodesTest.t.sol rename to contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodesTest.t.sol index 7bb4eb43c4d..3b570e2a6ea 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddNodesTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodesTest.t.sol @@ -2,50 +2,50 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; -contract CapabilityRegistry_AddNodesTest is BaseTest { +contract CapabilitiesRegistry_AddNodesTest is BaseTest { event NodeAdded(bytes32 p2pId, uint32 indexed nodeOperatorId, bytes32 signer); function setUp() public override { BaseTest.setUp(); - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](2); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](2); capabilities[0] = s_basicCapability; capabilities[1] = s_capabilityWithConfigurationContract; changePrank(ADMIN); - s_capabilityRegistry.addNodeOperators(_getNodeOperators()); - s_capabilityRegistry.addCapabilities(capabilities); + s_CapabilitiesRegistry.addNodeOperators(_getNodeOperators()); + s_CapabilitiesRegistry.addCapabilities(capabilities); } function test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() public { changePrank(STRANGER); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); bytes32[] memory hashedCapabilityIds = new bytes32[](1); hashedCapabilityIds[0] = s_basicHashedCapabilityId; - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, hashedCapabilityIds: hashedCapabilityIds }); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.AccessForbidden.selector, STRANGER)); - s_capabilityRegistry.addNodes(nodes); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.AccessForbidden.selector, STRANGER)); + s_CapabilitiesRegistry.addNodes(nodes); } function test_RevertWhen_AddingNodeWithInvalidNodeOperator() public { changePrank(ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); bytes32[] memory hashedCapabilityIds = new bytes32[](1); hashedCapabilityIds[0] = s_basicHashedCapabilityId; uint32 invalidNodeOperatorId = 10000; - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: invalidNodeOperatorId, // Invalid NOP p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, @@ -53,184 +53,184 @@ contract CapabilityRegistry_AddNodesTest is BaseTest { }); vm.expectRevert( - abi.encodeWithSelector(CapabilityRegistry.NodeOperatorDoesNotExist.selector, invalidNodeOperatorId) + abi.encodeWithSelector(CapabilitiesRegistry.NodeOperatorDoesNotExist.selector, invalidNodeOperatorId) ); - s_capabilityRegistry.addNodes(nodes); + s_CapabilitiesRegistry.addNodes(nodes); } function test_RevertWhen_SignerAddressEmpty() public { changePrank(NODE_OPERATOR_ONE_ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); bytes32[] memory hashedCapabilityIds = new bytes32[](1); hashedCapabilityIds[0] = s_basicHashedCapabilityId; - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: bytes32(""), hashedCapabilityIds: hashedCapabilityIds }); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.InvalidNodeSigner.selector)); - s_capabilityRegistry.addNodes(nodes); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.InvalidNodeSigner.selector)); + s_CapabilitiesRegistry.addNodes(nodes); } function test_RevertWhen_SignerAddressNotUnique() public { changePrank(NODE_OPERATOR_ONE_ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); bytes32[] memory hashedCapabilityIds = new bytes32[](1); hashedCapabilityIds[0] = s_basicHashedCapabilityId; - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, hashedCapabilityIds: hashedCapabilityIds }); - s_capabilityRegistry.addNodes(nodes); + s_CapabilitiesRegistry.addNodes(nodes); changePrank(NODE_OPERATOR_TWO_ADMIN); // Try adding another node with the same signer address - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_TWO_ID, p2pId: P2P_ID_TWO, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, hashedCapabilityIds: hashedCapabilityIds }); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.InvalidNodeSigner.selector)); - s_capabilityRegistry.addNodes(nodes); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.InvalidNodeSigner.selector)); + s_CapabilitiesRegistry.addNodes(nodes); } function test_RevertWhen_AddingDuplicateP2PId() public { changePrank(NODE_OPERATOR_ONE_ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); bytes32[] memory hashedCapabilityIds = new bytes32[](1); hashedCapabilityIds[0] = s_basicHashedCapabilityId; - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, hashedCapabilityIds: hashedCapabilityIds }); - s_capabilityRegistry.addNodes(nodes); + s_CapabilitiesRegistry.addNodes(nodes); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.NodeAlreadyExists.selector, P2P_ID)); - s_capabilityRegistry.addNodes(nodes); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.NodeAlreadyExists.selector, P2P_ID)); + s_CapabilitiesRegistry.addNodes(nodes); } function test_RevertWhen_P2PIDEmpty() public { changePrank(NODE_OPERATOR_ONE_ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); bytes32[] memory hashedCapabilityIds = new bytes32[](1); hashedCapabilityIds[0] = s_basicHashedCapabilityId; - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: bytes32(""), signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, hashedCapabilityIds: hashedCapabilityIds }); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.InvalidNodeP2PId.selector, bytes32(""))); - s_capabilityRegistry.addNodes(nodes); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.InvalidNodeP2PId.selector, bytes32(""))); + s_CapabilitiesRegistry.addNodes(nodes); } function test_RevertWhen_AddingNodeWithoutCapabilities() public { changePrank(NODE_OPERATOR_ONE_ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); bytes32[] memory hashedCapabilityIds = new bytes32[](0); - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, hashedCapabilityIds: hashedCapabilityIds }); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.InvalidNodeCapabilities.selector, hashedCapabilityIds)); - s_capabilityRegistry.addNodes(nodes); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.InvalidNodeCapabilities.selector, hashedCapabilityIds)); + s_CapabilitiesRegistry.addNodes(nodes); } function test_RevertWhen_AddingNodeWithInvalidCapability() public { changePrank(NODE_OPERATOR_ONE_ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); bytes32[] memory hashedCapabilityIds = new bytes32[](1); hashedCapabilityIds[0] = s_nonExistentHashedCapabilityId; - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, hashedCapabilityIds: hashedCapabilityIds }); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.InvalidNodeCapabilities.selector, hashedCapabilityIds)); - s_capabilityRegistry.addNodes(nodes); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.InvalidNodeCapabilities.selector, hashedCapabilityIds)); + s_CapabilitiesRegistry.addNodes(nodes); } - function test_AddsNodeInfo() public { + function test_AddsNodeParams() public { changePrank(NODE_OPERATOR_ONE_ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); bytes32[] memory hashedCapabilityIds = new bytes32[](2); hashedCapabilityIds[0] = s_basicHashedCapabilityId; hashedCapabilityIds[1] = s_capabilityWithConfigurationContractId; - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, hashedCapabilityIds: hashedCapabilityIds }); - vm.expectEmit(address(s_capabilityRegistry)); + vm.expectEmit(address(s_CapabilitiesRegistry)); emit NodeAdded(P2P_ID, TEST_NODE_OPERATOR_ONE_ID, NODE_OPERATOR_ONE_SIGNER_ADDRESS); - s_capabilityRegistry.addNodes(nodes); + s_CapabilitiesRegistry.addNodes(nodes); - (CapabilityRegistry.NodeInfo memory node, uint32 configCount) = s_capabilityRegistry.getNode(P2P_ID); + CapabilitiesRegistry.NodeInfo memory node = s_CapabilitiesRegistry.getNode(P2P_ID); assertEq(node.nodeOperatorId, TEST_NODE_OPERATOR_ONE_ID); assertEq(node.p2pId, P2P_ID); assertEq(node.hashedCapabilityIds.length, 2); assertEq(node.hashedCapabilityIds[0], s_basicHashedCapabilityId); assertEq(node.hashedCapabilityIds[1], s_capabilityWithConfigurationContractId); - assertEq(configCount, 1); + assertEq(node.configCount, 1); } function test_OwnerCanAddNodes() public { changePrank(ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); bytes32[] memory hashedCapabilityIds = new bytes32[](2); hashedCapabilityIds[0] = s_basicHashedCapabilityId; hashedCapabilityIds[1] = s_capabilityWithConfigurationContractId; - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, hashedCapabilityIds: hashedCapabilityIds }); - vm.expectEmit(address(s_capabilityRegistry)); + vm.expectEmit(address(s_CapabilitiesRegistry)); emit NodeAdded(P2P_ID, TEST_NODE_OPERATOR_ONE_ID, NODE_OPERATOR_ONE_SIGNER_ADDRESS); - s_capabilityRegistry.addNodes(nodes); + s_CapabilitiesRegistry.addNodes(nodes); - (CapabilityRegistry.NodeInfo memory node, uint32 configCount) = s_capabilityRegistry.getNode(P2P_ID); + CapabilitiesRegistry.NodeInfo memory node = s_CapabilitiesRegistry.getNode(P2P_ID); assertEq(node.nodeOperatorId, TEST_NODE_OPERATOR_ONE_ID); assertEq(node.p2pId, P2P_ID); assertEq(node.hashedCapabilityIds.length, 2); assertEq(node.hashedCapabilityIds[0], s_basicHashedCapabilityId); assertEq(node.hashedCapabilityIds[1], s_capabilityWithConfigurationContractId); - assertEq(configCount, 1); + assertEq(node.configCount, 1); } } diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_DeprecateCapabilitiesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_DeprecateCapabilitiesTest.t.sol similarity index 54% rename from contracts/src/v0.8/keystone/test/CapabilityRegistry_DeprecateCapabilitiesTest.t.sol rename to contracts/src/v0.8/keystone/test/CapabilitiesRegistry_DeprecateCapabilitiesTest.t.sol index 74c66f8f580..501146a7b78 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_DeprecateCapabilitiesTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_DeprecateCapabilitiesTest.t.sol @@ -2,23 +2,23 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; -contract CapabilityRegistry_DeprecateCapabilitiesTest is BaseTest { +contract CapabilitiesRegistry_DeprecateCapabilitiesTest is BaseTest { event CapabilityDeprecated(bytes32 indexed hashedCapabilityId); function setUp() public override { BaseTest.setUp(); - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](2); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](2); capabilities[0] = s_basicCapability; capabilities[1] = s_capabilityWithConfigurationContract; - s_capabilityRegistry.addCapabilities(capabilities); + s_CapabilitiesRegistry.addCapabilities(capabilities); } function test_RevertWhen_CalledByNonAdmin() public { changePrank(STRANGER); - bytes32 hashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( + bytes32 hashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId( s_basicCapability.labelledName, s_basicCapability.version ); @@ -27,7 +27,7 @@ contract CapabilityRegistry_DeprecateCapabilitiesTest is BaseTest { deprecatedCapabilities[0] = hashedCapabilityId; vm.expectRevert("Only callable by owner"); - s_capabilityRegistry.deprecateCapabilities(deprecatedCapabilities); + s_CapabilitiesRegistry.deprecateCapabilities(deprecatedCapabilities); } function test_RevertWhen_CapabilityDoesNotExist() public { @@ -35,13 +35,13 @@ contract CapabilityRegistry_DeprecateCapabilitiesTest is BaseTest { deprecatedCapabilities[0] = s_nonExistentHashedCapabilityId; vm.expectRevert( - abi.encodeWithSelector(CapabilityRegistry.CapabilityDoesNotExist.selector, s_nonExistentHashedCapabilityId) + abi.encodeWithSelector(CapabilitiesRegistry.CapabilityDoesNotExist.selector, s_nonExistentHashedCapabilityId) ); - s_capabilityRegistry.deprecateCapabilities(deprecatedCapabilities); + s_CapabilitiesRegistry.deprecateCapabilities(deprecatedCapabilities); } function test_RevertWhen_CapabilityIsDeprecated() public { - bytes32 hashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( + bytes32 hashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId( s_basicCapability.labelledName, s_basicCapability.version ); @@ -49,25 +49,25 @@ contract CapabilityRegistry_DeprecateCapabilitiesTest is BaseTest { bytes32[] memory deprecatedCapabilities = new bytes32[](1); deprecatedCapabilities[0] = hashedCapabilityId; - s_capabilityRegistry.deprecateCapabilities(deprecatedCapabilities); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.CapabilityIsDeprecated.selector, hashedCapabilityId)); - s_capabilityRegistry.deprecateCapabilities(deprecatedCapabilities); + s_CapabilitiesRegistry.deprecateCapabilities(deprecatedCapabilities); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.CapabilityIsDeprecated.selector, hashedCapabilityId)); + s_CapabilitiesRegistry.deprecateCapabilities(deprecatedCapabilities); } function test_DeprecatesCapability() public { - bytes32 hashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( + bytes32 hashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId( s_basicCapability.labelledName, s_basicCapability.version ); bytes32[] memory deprecatedCapabilities = new bytes32[](1); deprecatedCapabilities[0] = hashedCapabilityId; - s_capabilityRegistry.deprecateCapabilities(deprecatedCapabilities); - assertEq(s_capabilityRegistry.isCapabilityDeprecated(hashedCapabilityId), true); + s_CapabilitiesRegistry.deprecateCapabilities(deprecatedCapabilities); + assertEq(s_CapabilitiesRegistry.isCapabilityDeprecated(hashedCapabilityId), true); } function test_EmitsEvent() public { - bytes32 hashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( + bytes32 hashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId( s_basicCapability.labelledName, s_basicCapability.version ); @@ -75,8 +75,8 @@ contract CapabilityRegistry_DeprecateCapabilitiesTest is BaseTest { bytes32[] memory deprecatedCapabilities = new bytes32[](1); deprecatedCapabilities[0] = hashedCapabilityId; - vm.expectEmit(address(s_capabilityRegistry)); + vm.expectEmit(address(s_CapabilitiesRegistry)); emit CapabilityDeprecated(hashedCapabilityId); - s_capabilityRegistry.deprecateCapabilities(deprecatedCapabilities); + s_CapabilitiesRegistry.deprecateCapabilities(deprecatedCapabilities); } } diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetCapabilitiesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetCapabilitiesTest.t.sol new file mode 100644 index 00000000000..9702c62b9c7 --- /dev/null +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetCapabilitiesTest.t.sol @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +import {BaseTest} from "./BaseTest.t.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; + +contract CapabilitiesRegistry_GetCapabilitiesTest is BaseTest { + function setUp() public override { + BaseTest.setUp(); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](2); + capabilities[0] = s_basicCapability; + capabilities[1] = s_capabilityWithConfigurationContract; + s_CapabilitiesRegistry.addCapabilities(capabilities); + } + + function test_ReturnsCapabilities() public { + bytes32 hashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId( + s_basicCapability.labelledName, + s_basicCapability.version + ); + bytes32[] memory deprecatedCapabilities = new bytes32[](1); + deprecatedCapabilities[0] = hashedCapabilityId; + s_CapabilitiesRegistry.deprecateCapabilities(deprecatedCapabilities); + + CapabilitiesRegistry.CapabilityInfo[] memory capabilities = s_CapabilitiesRegistry.getCapabilities(); + + assertEq(capabilities.length, 2); + + assertEq(capabilities[0].labelledName, "data-streams-reports"); + assertEq(capabilities[0].version, "1.0.0"); + assertEq(uint256(capabilities[0].responseType), uint256(CapabilitiesRegistry.CapabilityResponseType.REPORT)); + assertEq(uint256(capabilities[0].capabilityType), uint256(CapabilitiesRegistry.CapabilityType.TRIGGER)); + assertEq(capabilities[0].configurationContract, address(0)); + assertEq(capabilities[0].hashedId, keccak256(abi.encode(capabilities[0].labelledName, capabilities[0].version))); + assertEq(capabilities[0].isDeprecated, true); + + assertEq(capabilities[1].labelledName, "read-ethereum-mainnet-gas-price"); + assertEq(capabilities[1].version, "1.0.2"); + assertEq( + uint256(capabilities[1].responseType), + uint256(CapabilitiesRegistry.CapabilityResponseType.OBSERVATION_IDENTICAL) + ); + assertEq(uint256(capabilities[1].capabilityType), uint256(CapabilitiesRegistry.CapabilityType.ACTION)); + assertEq(capabilities[1].configurationContract, address(s_capabilityConfigurationContract)); + assertEq(capabilities[1].hashedId, keccak256(abi.encode(capabilities[1].labelledName, capabilities[1].version))); + assertEq(capabilities[1].isDeprecated, false); + } +} diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetDONsTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetDONsTest.t.sol similarity index 69% rename from contracts/src/v0.8/keystone/test/CapabilityRegistry_GetDONsTest.t.sol rename to contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetDONsTest.t.sol index f53803c4041..15da8de4121 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetDONsTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetDONsTest.t.sol @@ -3,29 +3,29 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; -contract CapabilityRegistry_GetDONsTest is BaseTest { +contract CapabilitiesRegistry_GetDONsTest is BaseTest { event ConfigSet(uint32 donId, uint32 configCount); - CapabilityRegistry.CapabilityConfiguration[] private s_capabilityConfigs; + CapabilitiesRegistry.CapabilityConfiguration[] private s_capabilityConfigs; function setUp() public override { BaseTest.setUp(); - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](2); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](2); capabilities[0] = s_basicCapability; capabilities[1] = s_capabilityWithConfigurationContract; - s_capabilityRegistry.addNodeOperators(_getNodeOperators()); - s_capabilityRegistry.addCapabilities(capabilities); + s_CapabilitiesRegistry.addNodeOperators(_getNodeOperators()); + s_CapabilitiesRegistry.addCapabilities(capabilities); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](2); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](2); bytes32[] memory capabilityIds = new bytes32[](2); capabilityIds[0] = s_basicHashedCapabilityId; capabilityIds[1] = s_capabilityWithConfigurationContractId; - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, @@ -35,7 +35,7 @@ contract CapabilityRegistry_GetDONsTest is BaseTest { bytes32[] memory nodeTwoCapabilityIds = new bytes32[](1); nodeTwoCapabilityIds[0] = s_basicHashedCapabilityId; - nodes[1] = CapabilityRegistry.NodeInfo({ + nodes[1] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID_TWO, signer: NODE_OPERATOR_TWO_SIGNER_ADDRESS, @@ -43,10 +43,10 @@ contract CapabilityRegistry_GetDONsTest is BaseTest { }); changePrank(NODE_OPERATOR_ONE_ADMIN); - s_capabilityRegistry.addNodes(nodes); + s_CapabilitiesRegistry.addNodes(nodes); s_capabilityConfigs.push( - CapabilityRegistry.CapabilityConfiguration({ + CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG }) @@ -57,12 +57,12 @@ contract CapabilityRegistry_GetDONsTest is BaseTest { nodeIds[1] = P2P_ID_TWO; changePrank(ADMIN); - s_capabilityRegistry.addDON(nodeIds, s_capabilityConfigs, true, true, 1); - s_capabilityRegistry.addDON(nodeIds, s_capabilityConfigs, false, false, 1); + s_CapabilitiesRegistry.addDON(nodeIds, s_capabilityConfigs, true, true, 1); + s_CapabilitiesRegistry.addDON(nodeIds, s_capabilityConfigs, false, false, 1); } function test_CorrectlyFetchesDONs() public view { - CapabilityRegistry.DONInfo[] memory dons = s_capabilityRegistry.getDONs(); + CapabilitiesRegistry.DONInfo[] memory dons = s_CapabilitiesRegistry.getDONs(); assertEq(dons.length, 2); assertEq(dons[0].id, DON_ID); assertEq(dons[0].configCount, 1); @@ -82,9 +82,9 @@ contract CapabilityRegistry_GetDONsTest is BaseTest { function test_DoesNotIncludeRemovedDONs() public { uint32[] memory removedDONIDs = new uint32[](1); removedDONIDs[0] = DON_ID; - s_capabilityRegistry.removeDONs(removedDONIDs); + s_CapabilitiesRegistry.removeDONs(removedDONIDs); - CapabilityRegistry.DONInfo[] memory dons = s_capabilityRegistry.getDONs(); + CapabilitiesRegistry.DONInfo[] memory dons = s_CapabilitiesRegistry.getDONs(); assertEq(dons.length, 1); assertEq(dons[0].id, DON_ID_TWO); assertEq(dons[0].configCount, 1); diff --git a/contracts/src/v0.8/keystone/test/CapabiityRegistry_GetHashedCapabilityIdTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetHashedCapabilityIdTest.t.sol similarity index 61% rename from contracts/src/v0.8/keystone/test/CapabiityRegistry_GetHashedCapabilityIdTest.t.sol rename to contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetHashedCapabilityIdTest.t.sol index 435138c80e9..b9a6e6dc97a 100644 --- a/contracts/src/v0.8/keystone/test/CapabiityRegistry_GetHashedCapabilityIdTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetHashedCapabilityIdTest.t.sol @@ -4,9 +4,9 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; import {CapabilityConfigurationContract} from "./mocks/CapabilityConfigurationContract.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; -contract CapabilityRegistry_GetHashedCapabilityTest is BaseTest { +contract CapabilitiesRegistry_GetHashedCapabilityTest is BaseTest { string constant CAPABILITY_LABELLED_NAME = "ccip1"; string constant CAPABILITY_VERSION = "1.0.0"; @@ -14,15 +14,15 @@ contract CapabilityRegistry_GetHashedCapabilityTest is BaseTest { bytes32 expectedHashedCapabilityId = keccak256(abi.encode(CAPABILITY_LABELLED_NAME, CAPABILITY_VERSION)); assertEq( - s_capabilityRegistry.getHashedCapabilityId(CAPABILITY_LABELLED_NAME, CAPABILITY_VERSION), + s_CapabilitiesRegistry.getHashedCapabilityId(CAPABILITY_LABELLED_NAME, CAPABILITY_VERSION), expectedHashedCapabilityId ); } function test_DoesNotCauseIncorrectClashes() public view { assertNotEq( - s_capabilityRegistry.getHashedCapabilityId(CAPABILITY_LABELLED_NAME, CAPABILITY_VERSION), - s_capabilityRegistry.getHashedCapabilityId("ccip", "11.0.0") + s_CapabilitiesRegistry.getHashedCapabilityId(CAPABILITY_LABELLED_NAME, CAPABILITY_VERSION), + s_CapabilitiesRegistry.getHashedCapabilityId("ccip", "11.0.0") ); } } diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetNodeOperatorsTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNodeOperatorsTest.t.sol similarity index 70% rename from contracts/src/v0.8/keystone/test/CapabilityRegistry_GetNodeOperatorsTest.t.sol rename to contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNodeOperatorsTest.t.sol index f1ce3d79ab3..36ef201a998 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetNodeOperatorsTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNodeOperatorsTest.t.sol @@ -2,17 +2,17 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; -contract CapabilityRegistry_GetNodeOperatorsTest is BaseTest { +contract CapabilitiesRegistry_GetNodeOperatorsTest is BaseTest { function setUp() public override { BaseTest.setUp(); changePrank(ADMIN); - s_capabilityRegistry.addNodeOperators(_getNodeOperators()); + s_CapabilitiesRegistry.addNodeOperators(_getNodeOperators()); } function test_CorrectlyFetchesNodeOperators() public view { - CapabilityRegistry.NodeOperator[] memory nodeOperators = s_capabilityRegistry.getNodeOperators(); + CapabilitiesRegistry.NodeOperator[] memory nodeOperators = s_CapabilitiesRegistry.getNodeOperators(); assertEq(nodeOperators.length, 3); assertEq(nodeOperators[0].admin, NODE_OPERATOR_ONE_ADMIN); @@ -29,9 +29,9 @@ contract CapabilityRegistry_GetNodeOperatorsTest is BaseTest { changePrank(ADMIN); uint32[] memory nodeOperatorsToRemove = new uint32[](1); nodeOperatorsToRemove[0] = 2; - s_capabilityRegistry.removeNodeOperators(nodeOperatorsToRemove); + s_CapabilitiesRegistry.removeNodeOperators(nodeOperatorsToRemove); - CapabilityRegistry.NodeOperator[] memory nodeOperators = s_capabilityRegistry.getNodeOperators(); + CapabilitiesRegistry.NodeOperator[] memory nodeOperators = s_CapabilitiesRegistry.getNodeOperators(); assertEq(nodeOperators.length, 2); assertEq(nodeOperators[0].admin, NODE_OPERATOR_ONE_ADMIN); diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetNodesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNodesTest.t.sol similarity index 71% rename from contracts/src/v0.8/keystone/test/CapabilityRegistry_GetNodesTest.t.sol rename to contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNodesTest.t.sol index 28fc33ab1da..901e7b92728 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetNodesTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNodesTest.t.sol @@ -2,33 +2,33 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; -contract CapabilityRegistry_GetNodesTest is BaseTest { +contract CapabilitiesRegistry_GetNodesTest is BaseTest { function setUp() public override { BaseTest.setUp(); changePrank(ADMIN); - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](2); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](2); capabilities[0] = s_basicCapability; capabilities[1] = s_capabilityWithConfigurationContract; - s_capabilityRegistry.addNodeOperators(_getNodeOperators()); - s_capabilityRegistry.addCapabilities(capabilities); + s_CapabilitiesRegistry.addNodeOperators(_getNodeOperators()); + s_CapabilitiesRegistry.addCapabilities(capabilities); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](2); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](2); bytes32[] memory hashedCapabilityIds = new bytes32[](2); hashedCapabilityIds[0] = s_basicHashedCapabilityId; hashedCapabilityIds[1] = s_capabilityWithConfigurationContractId; - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, hashedCapabilityIds: hashedCapabilityIds }); - nodes[1] = CapabilityRegistry.NodeInfo({ + nodes[1] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID_TWO, signer: NODE_OPERATOR_TWO_SIGNER_ADDRESS, @@ -37,11 +37,11 @@ contract CapabilityRegistry_GetNodesTest is BaseTest { changePrank(NODE_OPERATOR_ONE_ADMIN); - s_capabilityRegistry.addNodes(nodes); + s_CapabilitiesRegistry.addNodes(nodes); } function test_CorrectlyFetchesNodes() public view { - (CapabilityRegistry.NodeInfo[] memory nodes, uint32[] memory configCounts) = s_capabilityRegistry.getNodes(); + CapabilitiesRegistry.NodeInfo[] memory nodes = s_CapabilitiesRegistry.getNodes(); assertEq(nodes.length, 2); assertEq(nodes[0].nodeOperatorId, TEST_NODE_OPERATOR_ONE_ID); @@ -50,7 +50,7 @@ contract CapabilityRegistry_GetNodesTest is BaseTest { assertEq(nodes[0].hashedCapabilityIds.length, 2); assertEq(nodes[0].hashedCapabilityIds[0], s_basicHashedCapabilityId); assertEq(nodes[0].hashedCapabilityIds[1], s_capabilityWithConfigurationContractId); - assertEq(configCounts[0], 1); + assertEq(nodes[0].configCount, 1); assertEq(nodes[1].nodeOperatorId, TEST_NODE_OPERATOR_ONE_ID); assertEq(nodes[1].signer, NODE_OPERATOR_TWO_SIGNER_ADDRESS); @@ -58,16 +58,16 @@ contract CapabilityRegistry_GetNodesTest is BaseTest { assertEq(nodes[1].hashedCapabilityIds.length, 2); assertEq(nodes[1].hashedCapabilityIds[0], s_basicHashedCapabilityId); assertEq(nodes[1].hashedCapabilityIds[1], s_capabilityWithConfigurationContractId); - assertEq(configCounts[1], 1); + assertEq(nodes[1].configCount, 1); } function test_DoesNotIncludeRemovedNodes() public { changePrank(ADMIN); bytes32[] memory nodesToRemove = new bytes32[](1); nodesToRemove[0] = P2P_ID_TWO; - s_capabilityRegistry.removeNodes(nodesToRemove); + s_CapabilitiesRegistry.removeNodes(nodesToRemove); - (CapabilityRegistry.NodeInfo[] memory nodes, uint32[] memory configCounts) = s_capabilityRegistry.getNodes(); + CapabilitiesRegistry.NodeInfo[] memory nodes = s_CapabilitiesRegistry.getNodes(); assertEq(nodes.length, 1); assertEq(nodes[0].nodeOperatorId, TEST_NODE_OPERATOR_ONE_ID); @@ -76,6 +76,6 @@ contract CapabilityRegistry_GetNodesTest is BaseTest { assertEq(nodes[0].hashedCapabilityIds.length, 2); assertEq(nodes[0].hashedCapabilityIds[0], s_basicHashedCapabilityId); assertEq(nodes[0].hashedCapabilityIds[1], s_capabilityWithConfigurationContractId); - assertEq(configCounts[0], 1); + assertEq(nodes[0].configCount, 1); } } diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_RemoveDONsTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveDONsTest.t.sol similarity index 58% rename from contracts/src/v0.8/keystone/test/CapabilityRegistry_RemoveDONsTest.t.sol rename to contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveDONsTest.t.sol index 8d5bfdeea6b..012ff102895 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_RemoveDONsTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveDONsTest.t.sol @@ -3,27 +3,27 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; -contract CapabilityRegistry_RemoveDONsTest is BaseTest { +contract CapabilitiesRegistry_RemoveDONsTest is BaseTest { event ConfigSet(uint32 donId, uint32 configCount); function setUp() public override { BaseTest.setUp(); - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](2); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](2); capabilities[0] = s_basicCapability; capabilities[1] = s_capabilityWithConfigurationContract; - s_capabilityRegistry.addNodeOperators(_getNodeOperators()); - s_capabilityRegistry.addCapabilities(capabilities); + s_CapabilitiesRegistry.addNodeOperators(_getNodeOperators()); + s_CapabilitiesRegistry.addCapabilities(capabilities); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](2); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](2); bytes32[] memory capabilityIds = new bytes32[](2); capabilityIds[0] = s_basicHashedCapabilityId; capabilityIds[1] = s_capabilityWithConfigurationContractId; - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, @@ -33,7 +33,7 @@ contract CapabilityRegistry_RemoveDONsTest is BaseTest { bytes32[] memory nodeTwoCapabilityIds = new bytes32[](1); nodeTwoCapabilityIds[0] = s_basicHashedCapabilityId; - nodes[1] = CapabilityRegistry.NodeInfo({ + nodes[1] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID_TWO, signer: NODE_OPERATOR_TWO_SIGNER_ADDRESS, @@ -41,11 +41,11 @@ contract CapabilityRegistry_RemoveDONsTest is BaseTest { }); changePrank(NODE_OPERATOR_ONE_ADMIN); - s_capabilityRegistry.addNodes(nodes); + s_CapabilitiesRegistry.addNodes(nodes); - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG }); @@ -55,7 +55,7 @@ contract CapabilityRegistry_RemoveDONsTest is BaseTest { nodeIds[1] = P2P_ID_TWO; changePrank(ADMIN); - s_capabilityRegistry.addDON(nodeIds, capabilityConfigs, true, true, 1); + s_CapabilitiesRegistry.addDON(nodeIds, capabilityConfigs, true, true, 1); } function test_RevertWhen_CalledByNonAdmin() public { @@ -63,34 +63,34 @@ contract CapabilityRegistry_RemoveDONsTest is BaseTest { donIDs[0] = 1; changePrank(STRANGER); vm.expectRevert("Only callable by owner"); - s_capabilityRegistry.removeDONs(donIDs); + s_CapabilitiesRegistry.removeDONs(donIDs); } function test_RevertWhen_DONDoesNotExist() public { uint32 invalidDONId = 10; uint32[] memory donIDs = new uint32[](1); donIDs[0] = invalidDONId; - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.DONDoesNotExist.selector, invalidDONId)); - s_capabilityRegistry.removeDONs(donIDs); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.DONDoesNotExist.selector, invalidDONId)); + s_CapabilitiesRegistry.removeDONs(donIDs); } function test_RemovesDON() public { uint32[] memory donIDs = new uint32[](1); donIDs[0] = DON_ID; - vm.expectEmit(true, true, true, true, address(s_capabilityRegistry)); + vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); emit ConfigSet(DON_ID, 0); - s_capabilityRegistry.removeDONs(donIDs); + s_CapabilitiesRegistry.removeDONs(donIDs); - CapabilityRegistry.DONInfo memory donInfo = s_capabilityRegistry.getDON(DON_ID); + CapabilitiesRegistry.DONInfo memory donInfo = s_CapabilitiesRegistry.getDON(DON_ID); assertEq(donInfo.id, 0); assertEq(donInfo.configCount, 0); assertEq(donInfo.isPublic, false); assertEq(donInfo.capabilityConfigurations.length, 0); - (bytes memory capabilityRegistryDONConfig, bytes memory capabilityConfigContractConfig) = s_capabilityRegistry + (bytes memory CapabilitiesRegistryDONConfig, bytes memory capabilityConfigContractConfig) = s_CapabilitiesRegistry .getCapabilityConfigs(DON_ID, s_basicHashedCapabilityId); - assertEq(capabilityRegistryDONConfig, bytes("")); + assertEq(CapabilitiesRegistryDONConfig, bytes("")); assertEq(capabilityConfigContractConfig, bytes("")); assertEq(donInfo.nodeP2PIds.length, 0); } diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_RemoveNodeOperatorsTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveNodeOperatorsTest.t.sol similarity index 61% rename from contracts/src/v0.8/keystone/test/CapabilityRegistry_RemoveNodeOperatorsTest.t.sol rename to contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveNodeOperatorsTest.t.sol index d7aef824593..bce4e49803b 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_RemoveNodeOperatorsTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveNodeOperatorsTest.t.sol @@ -2,15 +2,15 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; -contract CapabilityRegistry_RemoveNodeOperatorsTest is BaseTest { +contract CapabilitiesRegistry_RemoveNodeOperatorsTest is BaseTest { event NodeOperatorRemoved(uint32 indexed nodeOperatorId); function setUp() public override { BaseTest.setUp(); changePrank(ADMIN); - s_capabilityRegistry.addNodeOperators(_getNodeOperators()); + s_CapabilitiesRegistry.addNodeOperators(_getNodeOperators()); } function test_RevertWhen_CalledByNonOwner() public { @@ -18,28 +18,28 @@ contract CapabilityRegistry_RemoveNodeOperatorsTest is BaseTest { vm.expectRevert("Only callable by owner"); uint32[] memory nodeOperatorsToRemove = new uint32[](2); nodeOperatorsToRemove[1] = 1; - s_capabilityRegistry.removeNodeOperators(nodeOperatorsToRemove); + s_CapabilitiesRegistry.removeNodeOperators(nodeOperatorsToRemove); } function test_RemovesNodeOperator() public { changePrank(ADMIN); - vm.expectEmit(true, true, true, true, address(s_capabilityRegistry)); + vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); emit NodeOperatorRemoved(TEST_NODE_OPERATOR_ONE_ID); - vm.expectEmit(true, true, true, true, address(s_capabilityRegistry)); + vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); emit NodeOperatorRemoved(TEST_NODE_OPERATOR_TWO_ID); uint32[] memory nodeOperatorsToRemove = new uint32[](2); nodeOperatorsToRemove[0] = TEST_NODE_OPERATOR_ONE_ID; nodeOperatorsToRemove[1] = TEST_NODE_OPERATOR_TWO_ID; - s_capabilityRegistry.removeNodeOperators(nodeOperatorsToRemove); + s_CapabilitiesRegistry.removeNodeOperators(nodeOperatorsToRemove); - CapabilityRegistry.NodeOperator memory nodeOperatorOne = s_capabilityRegistry.getNodeOperator( + CapabilitiesRegistry.NodeOperator memory nodeOperatorOne = s_CapabilitiesRegistry.getNodeOperator( TEST_NODE_OPERATOR_ONE_ID ); assertEq(nodeOperatorOne.admin, address(0)); assertEq(nodeOperatorOne.name, ""); - CapabilityRegistry.NodeOperator memory nodeOperatorTwo = s_capabilityRegistry.getNodeOperator( + CapabilitiesRegistry.NodeOperator memory nodeOperatorTwo = s_CapabilitiesRegistry.getNodeOperator( TEST_NODE_OPERATOR_TWO_ID ); assertEq(nodeOperatorTwo.admin, address(0)); diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_RemoveNodesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveNodesTest.t.sol similarity index 55% rename from contracts/src/v0.8/keystone/test/CapabilityRegistry_RemoveNodesTest.t.sol rename to contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveNodesTest.t.sol index ac59435e35a..d607f42192c 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_RemoveNodesTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveNodesTest.t.sol @@ -2,41 +2,41 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; -contract CapabilityRegistry_RemoveNodesTest is BaseTest { +contract CapabilitiesRegistry_RemoveNodesTest is BaseTest { event NodeRemoved(bytes32 p2pId); function setUp() public override { BaseTest.setUp(); changePrank(ADMIN); - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](2); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](2); capabilities[0] = s_basicCapability; capabilities[1] = s_capabilityWithConfigurationContract; - s_capabilityRegistry.addNodeOperators(_getNodeOperators()); - s_capabilityRegistry.addCapabilities(capabilities); + s_CapabilitiesRegistry.addNodeOperators(_getNodeOperators()); + s_CapabilitiesRegistry.addCapabilities(capabilities); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](3); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](3); bytes32[] memory hashedCapabilityIds = new bytes32[](2); hashedCapabilityIds[0] = s_basicHashedCapabilityId; hashedCapabilityIds[1] = s_capabilityWithConfigurationContractId; - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, hashedCapabilityIds: hashedCapabilityIds }); - nodes[1] = CapabilityRegistry.NodeInfo({ + nodes[1] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_TWO_ID, p2pId: P2P_ID_TWO, signer: NODE_OPERATOR_TWO_SIGNER_ADDRESS, hashedCapabilityIds: hashedCapabilityIds }); - nodes[2] = CapabilityRegistry.NodeInfo({ + nodes[2] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_THREE_ID, p2pId: P2P_ID_THREE, signer: NODE_OPERATOR_THREE_SIGNER_ADDRESS, @@ -45,7 +45,7 @@ contract CapabilityRegistry_RemoveNodesTest is BaseTest { changePrank(ADMIN); - s_capabilityRegistry.addNodes(nodes); + s_CapabilitiesRegistry.addNodes(nodes); } function test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() public { @@ -53,8 +53,8 @@ contract CapabilityRegistry_RemoveNodesTest is BaseTest { bytes32[] memory nodes = new bytes32[](1); nodes[0] = P2P_ID; - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.AccessForbidden.selector, STRANGER)); - s_capabilityRegistry.removeNodes(nodes); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.AccessForbidden.selector, STRANGER)); + s_CapabilitiesRegistry.removeNodes(nodes); } function test_RevertWhen_NodeDoesNotExist() public { @@ -62,8 +62,8 @@ contract CapabilityRegistry_RemoveNodesTest is BaseTest { bytes32[] memory nodes = new bytes32[](1); nodes[0] = INVALID_P2P_ID; - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.NodeDoesNotExist.selector, INVALID_P2P_ID)); - s_capabilityRegistry.removeNodes(nodes); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.NodeDoesNotExist.selector, INVALID_P2P_ID)); + s_CapabilitiesRegistry.removeNodes(nodes); } function test_RevertWhen_P2PIDEmpty() public { @@ -71,27 +71,27 @@ contract CapabilityRegistry_RemoveNodesTest is BaseTest { bytes32[] memory nodes = new bytes32[](1); nodes[0] = bytes32(""); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.NodeDoesNotExist.selector, bytes32(""))); - s_capabilityRegistry.removeNodes(nodes); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.NodeDoesNotExist.selector, bytes32(""))); + s_CapabilitiesRegistry.removeNodes(nodes); } - function test_RevertWhen_NodePartOfDON() public { + function test_RevertWhen_NodePartOfCapabilitiesDON() public { changePrank(ADMIN); bytes32[] memory nodes = new bytes32[](2); nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG }); - s_capabilityRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); + s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, false, F_VALUE); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.NodePartOfDON.selector, P2P_ID)); - s_capabilityRegistry.removeNodes(nodes); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.NodePartOfCapabilitiesDON.selector, 1, P2P_ID)); + s_CapabilitiesRegistry.removeNodes(nodes); } function test_CanRemoveWhenDONDeleted() public { @@ -101,35 +101,35 @@ contract CapabilityRegistry_RemoveNodesTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG }); // Add DON - s_capabilityRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); + s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); // Try remove nodes bytes32[] memory removedNodes = new bytes32[](1); removedNodes[0] = P2P_ID; - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.NodePartOfDON.selector, P2P_ID)); - s_capabilityRegistry.removeNodes(removedNodes); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.NodePartOfWorkflowDON.selector, 1, P2P_ID)); + s_CapabilitiesRegistry.removeNodes(removedNodes); // Remove DON uint32[] memory donIds = new uint32[](1); donIds[0] = DON_ID; - s_capabilityRegistry.removeDONs(donIds); + s_CapabilitiesRegistry.removeDONs(donIds); // Remove node - s_capabilityRegistry.removeNodes(removedNodes); - (CapabilityRegistry.NodeInfo memory node, uint32 configCount) = s_capabilityRegistry.getNode(P2P_ID); + s_CapabilitiesRegistry.removeNodes(removedNodes); + CapabilitiesRegistry.NodeInfo memory node = s_CapabilitiesRegistry.getNode(P2P_ID); assertEq(node.nodeOperatorId, 0); assertEq(node.p2pId, bytes32("")); assertEq(node.signer, bytes32("")); assertEq(node.hashedCapabilityIds.length, 0); - assertEq(configCount, 0); + assertEq(node.configCount, 0); } function test_CanRemoveWhenNodeNoLongerPartOfDON() public { @@ -140,36 +140,36 @@ contract CapabilityRegistry_RemoveNodesTest is BaseTest { nodes[1] = P2P_ID_TWO; nodes[2] = P2P_ID_THREE; - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG }); // Add DON - s_capabilityRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); + s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); // Try remove nodes bytes32[] memory removedNodes = new bytes32[](1); removedNodes[0] = P2P_ID_TWO; - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.NodePartOfDON.selector, P2P_ID_TWO)); - s_capabilityRegistry.removeNodes(removedNodes); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.NodePartOfWorkflowDON.selector, 1, P2P_ID_TWO)); + s_CapabilitiesRegistry.removeNodes(removedNodes); // Update nodes in DON bytes32[] memory updatedNodes = new bytes32[](2); updatedNodes[0] = P2P_ID; updatedNodes[1] = P2P_ID_THREE; - s_capabilityRegistry.updateDON(DON_ID, updatedNodes, capabilityConfigs, true, true, F_VALUE); + s_CapabilitiesRegistry.updateDON(DON_ID, updatedNodes, capabilityConfigs, true, true, F_VALUE); // Remove node - s_capabilityRegistry.removeNodes(removedNodes); - (CapabilityRegistry.NodeInfo memory node, uint32 configCount) = s_capabilityRegistry.getNode(P2P_ID_TWO); + s_CapabilitiesRegistry.removeNodes(removedNodes); + CapabilitiesRegistry.NodeInfo memory node = s_CapabilitiesRegistry.getNode(P2P_ID_TWO); assertEq(node.nodeOperatorId, 0); assertEq(node.p2pId, bytes32("")); assertEq(node.signer, bytes32("")); assertEq(node.hashedCapabilityIds.length, 0); - assertEq(configCount, 0); + assertEq(node.configCount, 0); } function test_RemovesNode() public { @@ -178,16 +178,16 @@ contract CapabilityRegistry_RemoveNodesTest is BaseTest { bytes32[] memory nodes = new bytes32[](1); nodes[0] = P2P_ID; - vm.expectEmit(address(s_capabilityRegistry)); + vm.expectEmit(address(s_CapabilitiesRegistry)); emit NodeRemoved(P2P_ID); - s_capabilityRegistry.removeNodes(nodes); + s_CapabilitiesRegistry.removeNodes(nodes); - (CapabilityRegistry.NodeInfo memory node, uint32 configCount) = s_capabilityRegistry.getNode(P2P_ID); + CapabilitiesRegistry.NodeInfo memory node = s_CapabilitiesRegistry.getNode(P2P_ID); assertEq(node.nodeOperatorId, 0); assertEq(node.p2pId, bytes32("")); assertEq(node.signer, bytes32("")); assertEq(node.hashedCapabilityIds.length, 0); - assertEq(configCount, 0); + assertEq(node.configCount, 0); } function test_CanAddNodeWithSameSignerAddressAfterRemoving() public { @@ -196,29 +196,29 @@ contract CapabilityRegistry_RemoveNodesTest is BaseTest { bytes32[] memory nodes = new bytes32[](1); nodes[0] = P2P_ID; - s_capabilityRegistry.removeNodes(nodes); + s_CapabilitiesRegistry.removeNodes(nodes); - CapabilityRegistry.NodeInfo[] memory NodeInfo = new CapabilityRegistry.NodeInfo[](1); + CapabilitiesRegistry.NodeParams[] memory nodeParams = new CapabilitiesRegistry.NodeParams[](1); bytes32[] memory hashedCapabilityIds = new bytes32[](2); hashedCapabilityIds[0] = s_basicHashedCapabilityId; hashedCapabilityIds[1] = s_capabilityWithConfigurationContractId; - NodeInfo[0] = CapabilityRegistry.NodeInfo({ + nodeParams[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, hashedCapabilityIds: hashedCapabilityIds }); - s_capabilityRegistry.addNodes(NodeInfo); + s_CapabilitiesRegistry.addNodes(nodeParams); - (CapabilityRegistry.NodeInfo memory node, uint32 configCount) = s_capabilityRegistry.getNode(P2P_ID); + CapabilitiesRegistry.NodeInfo memory node = s_CapabilitiesRegistry.getNode(P2P_ID); assertEq(node.nodeOperatorId, TEST_NODE_OPERATOR_ONE_ID); assertEq(node.p2pId, P2P_ID); assertEq(node.hashedCapabilityIds.length, 2); assertEq(node.hashedCapabilityIds[0], s_basicHashedCapabilityId); assertEq(node.hashedCapabilityIds[1], s_capabilityWithConfigurationContractId); - assertEq(configCount, 1); + assertEq(node.configCount, 1); } function test_OwnerCanRemoveNodes() public { @@ -227,15 +227,15 @@ contract CapabilityRegistry_RemoveNodesTest is BaseTest { bytes32[] memory nodes = new bytes32[](1); nodes[0] = P2P_ID; - vm.expectEmit(address(s_capabilityRegistry)); + vm.expectEmit(address(s_CapabilitiesRegistry)); emit NodeRemoved(P2P_ID); - s_capabilityRegistry.removeNodes(nodes); + s_CapabilitiesRegistry.removeNodes(nodes); - (CapabilityRegistry.NodeInfo memory node, uint32 configCount) = s_capabilityRegistry.getNode(P2P_ID); + CapabilitiesRegistry.NodeInfo memory node = s_CapabilitiesRegistry.getNode(P2P_ID); assertEq(node.nodeOperatorId, 0); assertEq(node.p2pId, bytes32("")); assertEq(node.signer, bytes32("")); assertEq(node.hashedCapabilityIds.length, 0); - assertEq(configCount, 0); + assertEq(node.configCount, 0); } } diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_TypeAndVersionTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_TypeAndVersionTest.t.sol similarity index 51% rename from contracts/src/v0.8/keystone/test/CapabilityRegistry_TypeAndVersionTest.t.sol rename to contracts/src/v0.8/keystone/test/CapabilitiesRegistry_TypeAndVersionTest.t.sol index 629b4a17a5a..fb2b3f82b78 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_TypeAndVersionTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_TypeAndVersionTest.t.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; -contract CapabilityRegistry_TypeAndVersionTest is BaseTest { +contract CapabilitiesRegistry_TypeAndVersionTest is BaseTest { function test_TypeAndVersion() public view { - assertEq(s_capabilityRegistry.typeAndVersion(), "CapabilityRegistry 1.0.0"); + assertEq(s_CapabilitiesRegistry.typeAndVersion(), "CapabilitiesRegistry 1.0.0"); } } diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_UpdateDONTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateDONTest.t.sol similarity index 51% rename from contracts/src/v0.8/keystone/test/CapabilityRegistry_UpdateDONTest.t.sol rename to contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateDONTest.t.sol index 1737c19d272..bf9201a8296 100644 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_UpdateDONTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateDONTest.t.sol @@ -3,27 +3,27 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; import {ICapabilityConfiguration} from "../interfaces/ICapabilityConfiguration.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; -contract CapabilityRegistry_UpdateDONTest is BaseTest { +contract CapabilitiesRegistry_UpdateDONTest is BaseTest { event ConfigSet(uint32 donId, uint32 configCount); function setUp() public override { BaseTest.setUp(); - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](2); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](2); capabilities[0] = s_basicCapability; capabilities[1] = s_capabilityWithConfigurationContract; - s_capabilityRegistry.addNodeOperators(_getNodeOperators()); - s_capabilityRegistry.addCapabilities(capabilities); + s_CapabilitiesRegistry.addNodeOperators(_getNodeOperators()); + s_CapabilitiesRegistry.addCapabilities(capabilities); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](3); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](3); bytes32[] memory capabilityIds = new bytes32[](2); capabilityIds[0] = s_basicHashedCapabilityId; capabilityIds[1] = s_capabilityWithConfigurationContractId; - nodes[0] = CapabilityRegistry.NodeInfo({ + nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, p2pId: P2P_ID, signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, @@ -33,67 +33,67 @@ contract CapabilityRegistry_UpdateDONTest is BaseTest { bytes32[] memory nodeTwoCapabilityIds = new bytes32[](1); nodeTwoCapabilityIds[0] = s_basicHashedCapabilityId; - nodes[1] = CapabilityRegistry.NodeInfo({ + nodes[1] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_TWO_ID, p2pId: P2P_ID_TWO, signer: NODE_OPERATOR_TWO_SIGNER_ADDRESS, hashedCapabilityIds: nodeTwoCapabilityIds }); - nodes[2] = CapabilityRegistry.NodeInfo({ + nodes[2] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: TEST_NODE_OPERATOR_THREE_ID, p2pId: P2P_ID_THREE, signer: NODE_OPERATOR_THREE_SIGNER_ADDRESS, hashedCapabilityIds: capabilityIds }); - s_capabilityRegistry.addNodes(nodes); + s_CapabilitiesRegistry.addNodes(nodes); bytes32[] memory donNodes = new bytes32[](2); donNodes[0] = P2P_ID; donNodes[1] = P2P_ID_TWO; - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG }); - s_capabilityRegistry.addDON(donNodes, capabilityConfigs, true, true, F_VALUE); + s_CapabilitiesRegistry.addDON(donNodes, capabilityConfigs, true, true, F_VALUE); } function test_RevertWhen_CalledByNonAdmin() public { changePrank(STRANGER); vm.expectRevert("Only callable by owner"); bytes32[] memory nodes = new bytes32[](1); - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG }); - s_capabilityRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE); + s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE); } function test_RevertWhen_NodeDoesNotSupportCapability() public { bytes32[] memory nodes = new bytes32[](2); nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_capabilityWithConfigurationContractId, config: CONFIG_CAPABILITY_CONFIG }); vm.expectRevert( abi.encodeWithSelector( - CapabilityRegistry.NodeDoesNotSupportCapability.selector, + CapabilitiesRegistry.NodeDoesNotSupportCapability.selector, P2P_ID_TWO, s_capabilityWithConfigurationContractId ) ); - s_capabilityRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE); + s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE); } function test_RevertWhen_DONDoesNotExist() public { @@ -101,30 +101,30 @@ contract CapabilityRegistry_UpdateDONTest is BaseTest { bytes32[] memory nodes = new bytes32[](2); nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG }); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.DONDoesNotExist.selector, nonExistentDONId)); - s_capabilityRegistry.updateDON(nonExistentDONId, nodes, capabilityConfigs, true, true, F_VALUE); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.DONDoesNotExist.selector, nonExistentDONId)); + s_CapabilitiesRegistry.updateDON(nonExistentDONId, nodes, capabilityConfigs, true, true, F_VALUE); } function test_RevertWhen_CapabilityDoesNotExist() public { bytes32[] memory nodes = new bytes32[](2); nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_nonExistentHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG }); vm.expectRevert( - abi.encodeWithSelector(CapabilityRegistry.CapabilityDoesNotExist.selector, s_nonExistentHashedCapabilityId) + abi.encodeWithSelector(CapabilitiesRegistry.CapabilityDoesNotExist.selector, s_nonExistentHashedCapabilityId) ); - s_capabilityRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE); + s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE); } function test_RevertWhen_DuplicateCapabilityAdded() public { @@ -132,42 +132,42 @@ contract CapabilityRegistry_UpdateDONTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](2); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](2); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG }); - capabilityConfigs[1] = CapabilityRegistry.CapabilityConfiguration({ + capabilityConfigs[1] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG }); vm.expectRevert( - abi.encodeWithSelector(CapabilityRegistry.DuplicateDONCapability.selector, 1, s_basicHashedCapabilityId) + abi.encodeWithSelector(CapabilitiesRegistry.DuplicateDONCapability.selector, 1, s_basicHashedCapabilityId) ); - s_capabilityRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE); + s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE); } function test_RevertWhen_DeprecatedCapabilityAdded() public { bytes32 capabilityId = s_basicHashedCapabilityId; bytes32[] memory deprecatedCapabilities = new bytes32[](1); deprecatedCapabilities[0] = capabilityId; - s_capabilityRegistry.deprecateCapabilities(deprecatedCapabilities); + s_CapabilitiesRegistry.deprecateCapabilities(deprecatedCapabilities); bytes32[] memory nodes = new bytes32[](2); nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: capabilityId, config: BASIC_CAPABILITY_CONFIG }); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.CapabilityIsDeprecated.selector, capabilityId)); - s_capabilityRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.CapabilityIsDeprecated.selector, capabilityId)); + s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE); } function test_RevertWhen_DuplicateNodeAdded() public { @@ -175,14 +175,14 @@ contract CapabilityRegistry_UpdateDONTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID; - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG }); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.DuplicateDONNode.selector, 1, P2P_ID)); - s_capabilityRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE); + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.DuplicateDONNode.selector, 1, P2P_ID)); + s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE); } function test_UpdatesDON() public { @@ -190,23 +190,23 @@ contract CapabilityRegistry_UpdateDONTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID_THREE; - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](2); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](2); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG }); - capabilityConfigs[1] = CapabilityRegistry.CapabilityConfiguration({ + capabilityConfigs[1] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_capabilityWithConfigurationContractId, config: CONFIG_CAPABILITY_CONFIG }); - CapabilityRegistry.DONInfo memory oldDONInfo = s_capabilityRegistry.getDON(DON_ID); + CapabilitiesRegistry.DONInfo memory oldDONInfo = s_CapabilitiesRegistry.getDON(DON_ID); bool expectedDONIsPublic = false; uint32 expectedConfigCount = oldDONInfo.configCount + 1; - vm.expectEmit(true, true, true, true, address(s_capabilityRegistry)); + vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); emit ConfigSet(DON_ID, expectedConfigCount); vm.expectCall( address(s_capabilityConfigurationContract), @@ -219,18 +219,18 @@ contract CapabilityRegistry_UpdateDONTest is BaseTest { ), 1 ); - s_capabilityRegistry.updateDON(DON_ID, nodes, capabilityConfigs, expectedDONIsPublic, true, F_VALUE); + s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, expectedDONIsPublic, true, F_VALUE); - CapabilityRegistry.DONInfo memory donInfo = s_capabilityRegistry.getDON(DON_ID); + CapabilitiesRegistry.DONInfo memory donInfo = s_CapabilitiesRegistry.getDON(DON_ID); assertEq(donInfo.id, DON_ID); assertEq(donInfo.configCount, expectedConfigCount); assertEq(donInfo.isPublic, false); assertEq(donInfo.capabilityConfigurations.length, capabilityConfigs.length); assertEq(donInfo.capabilityConfigurations[0].capabilityId, s_basicHashedCapabilityId); - (bytes memory capabilityRegistryDONConfig, bytes memory capabilityConfigContractConfig) = s_capabilityRegistry + (bytes memory CapabilitiesRegistryDONConfig, bytes memory capabilityConfigContractConfig) = s_CapabilitiesRegistry .getCapabilityConfigs(DON_ID, s_basicHashedCapabilityId); - assertEq(capabilityRegistryDONConfig, BASIC_CAPABILITY_CONFIG); + assertEq(CapabilitiesRegistryDONConfig, BASIC_CAPABILITY_CONFIG); assertEq(capabilityConfigContractConfig, bytes("")); assertEq(donInfo.nodeP2PIds.length, nodes.length); diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol new file mode 100644 index 00000000000..f6d74a3159e --- /dev/null +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +import {BaseTest} from "./BaseTest.t.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; + +contract CapabilitiesRegistry_UpdateNodeOperatorTest is BaseTest { + event NodeOperatorUpdated(uint32 indexed nodeOperatorId, address indexed admin, string name); + + uint32 private constant TEST_NODE_OPERATOR_ID = 1; + address private constant NEW_NODE_OPERATOR_ADMIN = address(3); + string private constant NEW_NODE_OPERATOR_NAME = "new-node-operator"; + + function setUp() public override { + BaseTest.setUp(); + changePrank(ADMIN); + s_CapabilitiesRegistry.addNodeOperators(_getNodeOperators()); + } + + function test_RevertWhen_CalledByNonAdminAndNonOwner() public { + changePrank(STRANGER); + + CapabilitiesRegistry.NodeOperator[] memory nodeOperators = new CapabilitiesRegistry.NodeOperator[](1); + nodeOperators[0] = CapabilitiesRegistry.NodeOperator({ + admin: NEW_NODE_OPERATOR_ADMIN, + name: NEW_NODE_OPERATOR_NAME + }); + + uint32[] memory nodeOperatorIds = new uint32[](1); + nodeOperatorIds[0] = TEST_NODE_OPERATOR_ID; + + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.AccessForbidden.selector, STRANGER)); + s_CapabilitiesRegistry.updateNodeOperators(nodeOperatorIds, nodeOperators); + } + + function test_RevertWhen_NodeOperatorAdminIsZeroAddress() public { + changePrank(ADMIN); + CapabilitiesRegistry.NodeOperator[] memory nodeOperators = new CapabilitiesRegistry.NodeOperator[](1); + nodeOperators[0] = CapabilitiesRegistry.NodeOperator({admin: address(0), name: NEW_NODE_OPERATOR_NAME}); + + uint32[] memory nodeOperatorIds = new uint32[](1); + nodeOperatorIds[0] = TEST_NODE_OPERATOR_ID; + + vm.expectRevert(CapabilitiesRegistry.InvalidNodeOperatorAdmin.selector); + s_CapabilitiesRegistry.updateNodeOperators(nodeOperatorIds, nodeOperators); + } + + function test_RevertWhen_NodeOperatorIdAndParamLengthsMismatch() public { + changePrank(ADMIN); + CapabilitiesRegistry.NodeOperator[] memory nodeOperators = new CapabilitiesRegistry.NodeOperator[](1); + nodeOperators[0] = CapabilitiesRegistry.NodeOperator({ + admin: NEW_NODE_OPERATOR_ADMIN, + name: NEW_NODE_OPERATOR_NAME + }); + + uint32 invalidNodeOperatorId = 10000; + uint32[] memory nodeOperatorIds = new uint32[](2); + nodeOperatorIds[0] = invalidNodeOperatorId; + vm.expectRevert( + abi.encodeWithSelector(CapabilitiesRegistry.LengthMismatch.selector, nodeOperatorIds.length, nodeOperators.length) + ); + s_CapabilitiesRegistry.updateNodeOperators(nodeOperatorIds, nodeOperators); + } + + function test_RevertWhen_NodeOperatorDoesNotExist() public { + changePrank(ADMIN); + CapabilitiesRegistry.NodeOperator[] memory nodeOperators = new CapabilitiesRegistry.NodeOperator[](1); + nodeOperators[0] = CapabilitiesRegistry.NodeOperator({ + admin: NEW_NODE_OPERATOR_ADMIN, + name: NEW_NODE_OPERATOR_NAME + }); + + uint32 invalidNodeOperatorId = 10000; + uint32[] memory nodeOperatorIds = new uint32[](1); + nodeOperatorIds[0] = invalidNodeOperatorId; + vm.expectRevert( + abi.encodeWithSelector(CapabilitiesRegistry.NodeOperatorDoesNotExist.selector, invalidNodeOperatorId) + ); + s_CapabilitiesRegistry.updateNodeOperators(nodeOperatorIds, nodeOperators); + } + + function test_UpdatesNodeOperator() public { + changePrank(ADMIN); + + CapabilitiesRegistry.NodeOperator[] memory nodeOperators = new CapabilitiesRegistry.NodeOperator[](1); + nodeOperators[0] = CapabilitiesRegistry.NodeOperator({ + admin: NEW_NODE_OPERATOR_ADMIN, + name: NEW_NODE_OPERATOR_NAME + }); + + uint32[] memory nodeOperatorIds = new uint32[](1); + nodeOperatorIds[0] = TEST_NODE_OPERATOR_ID; + + vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); + emit NodeOperatorUpdated(TEST_NODE_OPERATOR_ID, NEW_NODE_OPERATOR_ADMIN, NEW_NODE_OPERATOR_NAME); + s_CapabilitiesRegistry.updateNodeOperators(nodeOperatorIds, nodeOperators); + + CapabilitiesRegistry.NodeOperator memory nodeOperator = s_CapabilitiesRegistry.getNodeOperator( + TEST_NODE_OPERATOR_ID + ); + assertEq(nodeOperator.admin, NEW_NODE_OPERATOR_ADMIN); + assertEq(nodeOperator.name, NEW_NODE_OPERATOR_NAME); + } +} diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodesTest.t.sol new file mode 100644 index 00000000000..d61e76c9106 --- /dev/null +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodesTest.t.sol @@ -0,0 +1,335 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +import {BaseTest} from "./BaseTest.t.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; + +contract CapabilitiesRegistry_UpdateNodesTest is BaseTest { + event NodeUpdated(bytes32 p2pId, uint32 indexed nodeOperatorId, bytes32 signer); + + function setUp() public override { + BaseTest.setUp(); + changePrank(ADMIN); + CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](2); + capabilities[0] = s_basicCapability; + capabilities[1] = s_capabilityWithConfigurationContract; + + s_CapabilitiesRegistry.addNodeOperators(_getNodeOperators()); + s_CapabilitiesRegistry.addCapabilities(capabilities); + + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); + bytes32[] memory hashedCapabilityIds = new bytes32[](2); + hashedCapabilityIds[0] = s_basicHashedCapabilityId; + hashedCapabilityIds[1] = s_capabilityWithConfigurationContractId; + + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, + p2pId: P2P_ID, + signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, + hashedCapabilityIds: hashedCapabilityIds + }); + + changePrank(NODE_OPERATOR_ONE_ADMIN); + s_CapabilitiesRegistry.addNodes(nodes); + + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_TWO_ID, + p2pId: P2P_ID_TWO, + signer: NODE_OPERATOR_TWO_SIGNER_ADDRESS, + hashedCapabilityIds: hashedCapabilityIds + }); + + changePrank(NODE_OPERATOR_TWO_ADMIN); + s_CapabilitiesRegistry.addNodes(nodes); + } + + function test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() public { + changePrank(STRANGER); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); + + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + hashedCapabilityIds[0] = s_basicHashedCapabilityId; + + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, + p2pId: P2P_ID, + signer: NODE_OPERATOR_TWO_SIGNER_ADDRESS, + hashedCapabilityIds: hashedCapabilityIds + }); + + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.AccessForbidden.selector, STRANGER)); + s_CapabilitiesRegistry.updateNodes(nodes); + } + + function test_RevertWhen_NodeDoesNotExist() public { + changePrank(NODE_OPERATOR_ONE_ADMIN); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); + + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + hashedCapabilityIds[0] = s_basicHashedCapabilityId; + + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, + p2pId: INVALID_P2P_ID, + signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, + hashedCapabilityIds: hashedCapabilityIds + }); + + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.NodeDoesNotExist.selector, INVALID_P2P_ID)); + s_CapabilitiesRegistry.updateNodes(nodes); + } + + function test_RevertWhen_P2PIDEmpty() public { + changePrank(NODE_OPERATOR_ONE_ADMIN); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); + + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + hashedCapabilityIds[0] = s_basicHashedCapabilityId; + + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, + p2pId: bytes32(""), + signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, + hashedCapabilityIds: hashedCapabilityIds + }); + + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.NodeDoesNotExist.selector, bytes32(""))); + s_CapabilitiesRegistry.updateNodes(nodes); + } + + function test_RevertWhen_SignerAddressEmpty() public { + changePrank(NODE_OPERATOR_ONE_ADMIN); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); + + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + hashedCapabilityIds[0] = s_basicHashedCapabilityId; + + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, + p2pId: P2P_ID, + signer: bytes32(""), + hashedCapabilityIds: hashedCapabilityIds + }); + + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.InvalidNodeSigner.selector)); + s_CapabilitiesRegistry.updateNodes(nodes); + } + + function test_RevertWhen_NodeSignerAlreadyAssignedToAnotherNode() public { + changePrank(NODE_OPERATOR_ONE_ADMIN); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); + + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + hashedCapabilityIds[0] = s_basicHashedCapabilityId; + + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, + p2pId: P2P_ID, + signer: NODE_OPERATOR_TWO_SIGNER_ADDRESS, + hashedCapabilityIds: hashedCapabilityIds + }); + + vm.expectRevert(CapabilitiesRegistry.InvalidNodeSigner.selector); + s_CapabilitiesRegistry.updateNodes(nodes); + } + + function test_RevertWhen_UpdatingNodeWithoutCapabilities() public { + changePrank(NODE_OPERATOR_ONE_ADMIN); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); + + bytes32[] memory hashedCapabilityIds = new bytes32[](0); + + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, + p2pId: P2P_ID, + signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, + hashedCapabilityIds: hashedCapabilityIds + }); + + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.InvalidNodeCapabilities.selector, hashedCapabilityIds)); + s_CapabilitiesRegistry.updateNodes(nodes); + } + + function test_RevertWhen_AddingNodeWithInvalidCapability() public { + changePrank(NODE_OPERATOR_ONE_ADMIN); + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); + + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + hashedCapabilityIds[0] = s_nonExistentHashedCapabilityId; + + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, + p2pId: P2P_ID, + signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, + hashedCapabilityIds: hashedCapabilityIds + }); + + vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.InvalidNodeCapabilities.selector, hashedCapabilityIds)); + s_CapabilitiesRegistry.updateNodes(nodes); + } + + function test_RevertWhen_RemovingCapabilityRequiredByWorkflowDON() public { + // SETUP: addDON + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ + capabilityId: s_basicHashedCapabilityId, + config: BASIC_CAPABILITY_CONFIG + }); + bytes32[] memory nodeIds = new bytes32[](2); + nodeIds[0] = P2P_ID; + nodeIds[1] = P2P_ID_TWO; + + // SETUP: updateNodes + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + // DON requires s_basicHashedCapabilityId but we are swapping for + // s_capabilityWithConfigurationContractId + hashedCapabilityIds[0] = s_capabilityWithConfigurationContractId; + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, + p2pId: P2P_ID, + signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, + hashedCapabilityIds: hashedCapabilityIds + }); + uint32 workflowDonId = 1; + + // Operations + changePrank(ADMIN); + s_CapabilitiesRegistry.addDON(nodeIds, capabilityConfigs, true, true, 1); + + vm.expectRevert( + abi.encodeWithSelector( + CapabilitiesRegistry.CapabilityRequiredByDON.selector, + s_basicHashedCapabilityId, + workflowDonId + ) + ); + s_CapabilitiesRegistry.updateNodes(nodes); + } + + function test_RevertWhen_RemovingCapabilityRequiredByCapabilityDON() public { + // SETUP: addDON + CapabilitiesRegistry.CapabilityConfiguration[] + memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ + capabilityId: s_basicHashedCapabilityId, + config: BASIC_CAPABILITY_CONFIG + }); + bytes32[] memory nodeIds = new bytes32[](2); + nodeIds[0] = P2P_ID; + nodeIds[1] = P2P_ID_TWO; + + // SETUP: updateNodes + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + // DON requires s_basicHashedCapabilityId but we are swapping for + // s_capabilityWithConfigurationContractId + hashedCapabilityIds[0] = s_capabilityWithConfigurationContractId; + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, + p2pId: P2P_ID, + signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, + hashedCapabilityIds: hashedCapabilityIds + }); + uint32 capabilitiesDonId = 1; + + // Operations + changePrank(ADMIN); + s_CapabilitiesRegistry.addDON(nodeIds, capabilityConfigs, true, false, 1); + + vm.expectRevert( + abi.encodeWithSelector( + CapabilitiesRegistry.CapabilityRequiredByDON.selector, + s_basicHashedCapabilityId, + capabilitiesDonId + ) + ); + s_CapabilitiesRegistry.updateNodes(nodes); + } + + function test_CanUpdateParamsIfNodeSignerAddressNoLongerUsed() public { + changePrank(NODE_OPERATOR_ONE_ADMIN); + + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + hashedCapabilityIds[0] = s_basicHashedCapabilityId; + + // Set node one's signer to another address + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, + p2pId: P2P_ID, + signer: bytes32(abi.encodePacked(address(6666))), + hashedCapabilityIds: hashedCapabilityIds + }); + + s_CapabilitiesRegistry.updateNodes(nodes); + + // Set node two's signer to node one's signer + changePrank(NODE_OPERATOR_TWO_ADMIN); + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_TWO_ID, + p2pId: P2P_ID_TWO, + signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, + hashedCapabilityIds: hashedCapabilityIds + }); + s_CapabilitiesRegistry.updateNodes(nodes); + + CapabilitiesRegistry.NodeInfo memory node = s_CapabilitiesRegistry.getNode(P2P_ID_TWO); + assertEq(node.signer, NODE_OPERATOR_ONE_SIGNER_ADDRESS); + } + + function test_UpdatesNodeParams() public { + changePrank(NODE_OPERATOR_ONE_ADMIN); + + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + hashedCapabilityIds[0] = s_basicHashedCapabilityId; + + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, + p2pId: P2P_ID, + signer: NEW_NODE_SIGNER, + hashedCapabilityIds: hashedCapabilityIds + }); + + vm.expectEmit(address(s_CapabilitiesRegistry)); + emit NodeUpdated(P2P_ID, TEST_NODE_OPERATOR_ONE_ID, NEW_NODE_SIGNER); + s_CapabilitiesRegistry.updateNodes(nodes); + + CapabilitiesRegistry.NodeInfo memory node = s_CapabilitiesRegistry.getNode(P2P_ID); + assertEq(node.nodeOperatorId, TEST_NODE_OPERATOR_ONE_ID); + assertEq(node.p2pId, P2P_ID); + assertEq(node.signer, NEW_NODE_SIGNER); + assertEq(node.hashedCapabilityIds.length, 1); + assertEq(node.hashedCapabilityIds[0], s_basicHashedCapabilityId); + assertEq(node.configCount, 2); + } + + function test_OwnerCanUpdateNodes() public { + changePrank(ADMIN); + + CapabilitiesRegistry.NodeParams[] memory nodes = new CapabilitiesRegistry.NodeParams[](1); + bytes32[] memory hashedCapabilityIds = new bytes32[](1); + hashedCapabilityIds[0] = s_basicHashedCapabilityId; + + nodes[0] = CapabilitiesRegistry.NodeParams({ + nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, + p2pId: P2P_ID, + signer: NEW_NODE_SIGNER, + hashedCapabilityIds: hashedCapabilityIds + }); + + vm.expectEmit(address(s_CapabilitiesRegistry)); + emit NodeUpdated(P2P_ID, TEST_NODE_OPERATOR_ONE_ID, NEW_NODE_SIGNER); + s_CapabilitiesRegistry.updateNodes(nodes); + + CapabilitiesRegistry.NodeInfo memory node = s_CapabilitiesRegistry.getNode(P2P_ID); + assertEq(node.nodeOperatorId, TEST_NODE_OPERATOR_ONE_ID); + assertEq(node.p2pId, P2P_ID); + assertEq(node.signer, NEW_NODE_SIGNER); + assertEq(node.hashedCapabilityIds.length, 1); + assertEq(node.hashedCapabilityIds[0], s_basicHashedCapabilityId); + assertEq(node.configCount, 2); + } +} diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddDONTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddDONTest.t.sol deleted file mode 100644 index f9768f7105c..00000000000 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_AddDONTest.t.sol +++ /dev/null @@ -1,229 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; - -import {BaseTest} from "./BaseTest.t.sol"; -import {ICapabilityConfiguration} from "../interfaces/ICapabilityConfiguration.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; - -contract CapabilityRegistry_AddDONTest is BaseTest { - event ConfigSet(uint32 donId, uint32 configCount); - - function setUp() public override { - BaseTest.setUp(); - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](2); - capabilities[0] = s_basicCapability; - capabilities[1] = s_capabilityWithConfigurationContract; - - s_capabilityRegistry.addNodeOperators(_getNodeOperators()); - s_capabilityRegistry.addCapabilities(capabilities); - - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](3); - bytes32[] memory capabilityIds = new bytes32[](2); - capabilityIds[0] = s_basicHashedCapabilityId; - capabilityIds[1] = s_capabilityWithConfigurationContractId; - - nodes[0] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, - p2pId: P2P_ID, - signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, - hashedCapabilityIds: capabilityIds - }); - - bytes32[] memory nodeTwoCapabilityIds = new bytes32[](1); - nodeTwoCapabilityIds[0] = s_basicHashedCapabilityId; - - nodes[1] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_TWO_ID, - p2pId: P2P_ID_TWO, - signer: NODE_OPERATOR_TWO_SIGNER_ADDRESS, - hashedCapabilityIds: nodeTwoCapabilityIds - }); - - nodes[2] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_THREE_ID, - p2pId: P2P_ID_THREE, - signer: NODE_OPERATOR_THREE_SIGNER_ADDRESS, - hashedCapabilityIds: capabilityIds - }); - - s_capabilityRegistry.addNodes(nodes); - - changePrank(ADMIN); - } - - function test_RevertWhen_CalledByNonAdmin() public { - changePrank(STRANGER); - vm.expectRevert("Only callable by owner"); - bytes32[] memory nodes = new bytes32[](1); - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ - capabilityId: s_basicHashedCapabilityId, - config: BASIC_CAPABILITY_CONFIG - }); - s_capabilityRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); - } - - function test_RevertWhen_NodeDoesNotSupportCapability() public { - bytes32[] memory nodes = new bytes32[](2); - nodes[0] = P2P_ID; - nodes[1] = P2P_ID_TWO; - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ - capabilityId: s_capabilityWithConfigurationContractId, - config: CONFIG_CAPABILITY_CONFIG - }); - vm.expectRevert( - abi.encodeWithSelector( - CapabilityRegistry.NodeDoesNotSupportCapability.selector, - P2P_ID_TWO, - s_capabilityWithConfigurationContractId - ) - ); - s_capabilityRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); - } - - function test_RevertWhen_CapabilityDoesNotExist() public { - bytes32[] memory nodes = new bytes32[](2); - nodes[0] = P2P_ID; - nodes[1] = P2P_ID_TWO; - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ - capabilityId: s_nonExistentHashedCapabilityId, - config: BASIC_CAPABILITY_CONFIG - }); - vm.expectRevert( - abi.encodeWithSelector(CapabilityRegistry.CapabilityDoesNotExist.selector, s_nonExistentHashedCapabilityId) - ); - s_capabilityRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); - } - - function test_RevertWhen_FaultToleranceIsZero() public { - bytes32[] memory nodes = new bytes32[](1); - nodes[0] = P2P_ID; - - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ - capabilityId: s_basicHashedCapabilityId, - config: BASIC_CAPABILITY_CONFIG - }); - - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.InvalidFaultTolerance.selector, 0, 1)); - s_capabilityRegistry.addDON(nodes, capabilityConfigs, true, true, 0); - } - - function test_RevertWhen_DuplicateCapabilityAdded() public { - bytes32[] memory nodes = new bytes32[](2); - nodes[0] = P2P_ID; - nodes[1] = P2P_ID_TWO; - - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](2); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ - capabilityId: s_basicHashedCapabilityId, - config: BASIC_CAPABILITY_CONFIG - }); - capabilityConfigs[1] = CapabilityRegistry.CapabilityConfiguration({ - capabilityId: s_basicHashedCapabilityId, - config: BASIC_CAPABILITY_CONFIG - }); - - vm.expectRevert( - abi.encodeWithSelector(CapabilityRegistry.DuplicateDONCapability.selector, 1, s_basicHashedCapabilityId) - ); - s_capabilityRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); - } - - function test_RevertWhen_DeprecatedCapabilityAdded() public { - bytes32 capabilityId = s_basicHashedCapabilityId; - bytes32[] memory deprecatedCapabilities = new bytes32[](1); - deprecatedCapabilities[0] = capabilityId; - s_capabilityRegistry.deprecateCapabilities(deprecatedCapabilities); - - bytes32[] memory nodes = new bytes32[](2); - nodes[0] = P2P_ID; - nodes[1] = P2P_ID_TWO; - - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ - capabilityId: capabilityId, - config: BASIC_CAPABILITY_CONFIG - }); - - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.CapabilityIsDeprecated.selector, capabilityId)); - s_capabilityRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); - } - - function test_RevertWhen_DuplicateNodeAdded() public { - bytes32[] memory nodes = new bytes32[](2); - nodes[0] = P2P_ID; - nodes[1] = P2P_ID; - - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ - capabilityId: s_basicHashedCapabilityId, - config: BASIC_CAPABILITY_CONFIG - }); - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.DuplicateDONNode.selector, 1, P2P_ID)); - s_capabilityRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); - } - - function test_AddDON() public { - bytes32[] memory nodes = new bytes32[](2); - nodes[0] = P2P_ID; - nodes[1] = P2P_ID_THREE; - - CapabilityRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilityRegistry.CapabilityConfiguration[](2); - capabilityConfigs[0] = CapabilityRegistry.CapabilityConfiguration({ - capabilityId: s_basicHashedCapabilityId, - config: BASIC_CAPABILITY_CONFIG - }); - capabilityConfigs[1] = CapabilityRegistry.CapabilityConfiguration({ - capabilityId: s_capabilityWithConfigurationContractId, - config: CONFIG_CAPABILITY_CONFIG - }); - - vm.expectEmit(true, true, true, true, address(s_capabilityRegistry)); - emit ConfigSet(DON_ID, 1); - vm.expectCall( - address(s_capabilityConfigurationContract), - abi.encodeWithSelector( - ICapabilityConfiguration.beforeCapabilityConfigSet.selector, - nodes, - CONFIG_CAPABILITY_CONFIG, - 1, - DON_ID - ), - 1 - ); - s_capabilityRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); - - CapabilityRegistry.DONInfo memory donInfo = s_capabilityRegistry.getDON(DON_ID); - assertEq(donInfo.id, DON_ID); - assertEq(donInfo.configCount, 1); - assertEq(donInfo.isPublic, true); - assertEq(donInfo.capabilityConfigurations.length, capabilityConfigs.length); - assertEq(donInfo.capabilityConfigurations[0].capabilityId, s_basicHashedCapabilityId); - - (bytes memory capabilityRegistryDONConfig, bytes memory capabilityConfigContractConfig) = s_capabilityRegistry - .getCapabilityConfigs(DON_ID, s_basicHashedCapabilityId); - assertEq(capabilityRegistryDONConfig, BASIC_CAPABILITY_CONFIG); - assertEq(capabilityConfigContractConfig, bytes("")); - - (bytes memory capabilityRegistryDONConfigTwo, bytes memory capabilityConfigContractConfigTwo) = s_capabilityRegistry - .getCapabilityConfigs(DON_ID, s_capabilityWithConfigurationContractId); - assertEq(capabilityRegistryDONConfigTwo, CONFIG_CAPABILITY_CONFIG); - assertEq(capabilityConfigContractConfigTwo, CONFIG_CAPABILITY_CONFIG); - - assertEq(donInfo.nodeP2PIds.length, nodes.length); - assertEq(donInfo.nodeP2PIds[0], P2P_ID); - assertEq(donInfo.nodeP2PIds[1], P2P_ID_THREE); - } -} diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetCapabilitiesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetCapabilitiesTest.t.sol deleted file mode 100644 index e2dff281252..00000000000 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_GetCapabilitiesTest.t.sol +++ /dev/null @@ -1,67 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; - -import {BaseTest} from "./BaseTest.t.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; - -contract CapabilityRegistry_GetCapabilitiesTest is BaseTest { - function setUp() public override { - BaseTest.setUp(); - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](2); - capabilities[0] = s_basicCapability; - capabilities[1] = s_capabilityWithConfigurationContract; - s_capabilityRegistry.addCapabilities(capabilities); - } - - function test_ReturnsCapabilities() public view { - (bytes32[] memory hashedCapabilityIds, CapabilityRegistry.Capability[] memory capabilities) = s_capabilityRegistry - .getCapabilities(); - - assertEq(hashedCapabilityIds.length, 2); - assertEq(hashedCapabilityIds[0], keccak256(abi.encode(capabilities[0].labelledName, capabilities[0].version))); - assertEq(hashedCapabilityIds[1], keccak256(abi.encode(capabilities[1].labelledName, capabilities[1].version))); - - assertEq(capabilities.length, 2); - - assertEq(capabilities[0].labelledName, "data-streams-reports"); - assertEq(capabilities[0].version, "1.0.0"); - assertEq(uint256(capabilities[0].responseType), uint256(CapabilityRegistry.CapabilityResponseType.REPORT)); - assertEq(uint256(capabilities[0].capabilityType), uint256(CapabilityRegistry.CapabilityType.TRIGGER)); - assertEq(capabilities[0].configurationContract, address(0)); - - assertEq(capabilities[1].labelledName, "read-ethereum-mainnet-gas-price"); - assertEq(capabilities[1].version, "1.0.2"); - assertEq( - uint256(capabilities[1].responseType), - uint256(CapabilityRegistry.CapabilityResponseType.OBSERVATION_IDENTICAL) - ); - assertEq(uint256(capabilities[1].capabilityType), uint256(CapabilityRegistry.CapabilityType.ACTION)); - assertEq(capabilities[1].configurationContract, address(s_capabilityConfigurationContract)); - } - - function test_ExcludesDeprecatedCapabilities() public { - bytes32 hashedCapabilityId = s_capabilityRegistry.getHashedCapabilityId( - s_basicCapability.labelledName, - s_basicCapability.version - ); - bytes32[] memory deprecatedCapabilities = new bytes32[](1); - deprecatedCapabilities[0] = hashedCapabilityId; - s_capabilityRegistry.deprecateCapabilities(deprecatedCapabilities); - - (bytes32[] memory hashedCapabilityIds, CapabilityRegistry.Capability[] memory capabilities) = s_capabilityRegistry - .getCapabilities(); - - assertEq(hashedCapabilityIds.length, 1); - assertEq(hashedCapabilityIds[0], keccak256(abi.encode(capabilities[0].labelledName, capabilities[0].version))); - - assertEq(capabilities.length, 1); - - assertEq(capabilities[0].labelledName, "read-ethereum-mainnet-gas-price"); - assertEq(capabilities[0].version, "1.0.2"); - assertEq( - uint256(capabilities[0].responseType), - uint256(CapabilityRegistry.CapabilityResponseType.OBSERVATION_IDENTICAL) - ); - assertEq(capabilities[0].configurationContract, address(s_capabilityConfigurationContract)); - } -} diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_UpdateNodeOperatorsTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilityRegistry_UpdateNodeOperatorsTest.t.sol deleted file mode 100644 index 77d180a784a..00000000000 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_UpdateNodeOperatorsTest.t.sol +++ /dev/null @@ -1,90 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; - -import {BaseTest} from "./BaseTest.t.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; - -contract CapabilityRegistry_UpdateNodeOperatorTest is BaseTest { - event NodeOperatorUpdated(uint32 indexed nodeOperatorId, address indexed admin, string name); - - uint32 private constant TEST_NODE_OPERATOR_ID = 1; - address private constant NEW_NODE_OPERATOR_ADMIN = address(3); - string private constant NEW_NODE_OPERATOR_NAME = "new-node-operator"; - - function setUp() public override { - BaseTest.setUp(); - changePrank(ADMIN); - s_capabilityRegistry.addNodeOperators(_getNodeOperators()); - } - - function test_RevertWhen_CalledByNonAdminAndNonOwner() public { - changePrank(STRANGER); - - CapabilityRegistry.NodeOperator[] memory nodeOperators = new CapabilityRegistry.NodeOperator[](1); - nodeOperators[0] = CapabilityRegistry.NodeOperator({admin: NEW_NODE_OPERATOR_ADMIN, name: NEW_NODE_OPERATOR_NAME}); - - uint32[] memory nodeOperatorIds = new uint32[](1); - nodeOperatorIds[0] = TEST_NODE_OPERATOR_ID; - - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.AccessForbidden.selector, STRANGER)); - s_capabilityRegistry.updateNodeOperators(nodeOperatorIds, nodeOperators); - } - - function test_RevertWhen_NodeOperatorAdminIsZeroAddress() public { - changePrank(ADMIN); - CapabilityRegistry.NodeOperator[] memory nodeOperators = new CapabilityRegistry.NodeOperator[](1); - nodeOperators[0] = CapabilityRegistry.NodeOperator({admin: address(0), name: NEW_NODE_OPERATOR_NAME}); - - uint32[] memory nodeOperatorIds = new uint32[](1); - nodeOperatorIds[0] = TEST_NODE_OPERATOR_ID; - - vm.expectRevert(CapabilityRegistry.InvalidNodeOperatorAdmin.selector); - s_capabilityRegistry.updateNodeOperators(nodeOperatorIds, nodeOperators); - } - - function test_RevertWhen_NodeOperatorIdAndParamLengthsMismatch() public { - changePrank(ADMIN); - CapabilityRegistry.NodeOperator[] memory nodeOperators = new CapabilityRegistry.NodeOperator[](1); - nodeOperators[0] = CapabilityRegistry.NodeOperator({admin: NEW_NODE_OPERATOR_ADMIN, name: NEW_NODE_OPERATOR_NAME}); - - uint32 invalidNodeOperatorId = 10000; - uint32[] memory nodeOperatorIds = new uint32[](2); - nodeOperatorIds[0] = invalidNodeOperatorId; - vm.expectRevert( - abi.encodeWithSelector(CapabilityRegistry.LengthMismatch.selector, nodeOperatorIds.length, nodeOperators.length) - ); - s_capabilityRegistry.updateNodeOperators(nodeOperatorIds, nodeOperators); - } - - function test_RevertWhen_NodeOperatorDoesNotExist() public { - changePrank(ADMIN); - CapabilityRegistry.NodeOperator[] memory nodeOperators = new CapabilityRegistry.NodeOperator[](1); - nodeOperators[0] = CapabilityRegistry.NodeOperator({admin: NEW_NODE_OPERATOR_ADMIN, name: NEW_NODE_OPERATOR_NAME}); - - uint32 invalidNodeOperatorId = 10000; - uint32[] memory nodeOperatorIds = new uint32[](1); - nodeOperatorIds[0] = invalidNodeOperatorId; - vm.expectRevert( - abi.encodeWithSelector(CapabilityRegistry.NodeOperatorDoesNotExist.selector, invalidNodeOperatorId) - ); - s_capabilityRegistry.updateNodeOperators(nodeOperatorIds, nodeOperators); - } - - function test_UpdatesNodeOperator() public { - changePrank(ADMIN); - - CapabilityRegistry.NodeOperator[] memory nodeOperators = new CapabilityRegistry.NodeOperator[](1); - nodeOperators[0] = CapabilityRegistry.NodeOperator({admin: NEW_NODE_OPERATOR_ADMIN, name: NEW_NODE_OPERATOR_NAME}); - - uint32[] memory nodeOperatorIds = new uint32[](1); - nodeOperatorIds[0] = TEST_NODE_OPERATOR_ID; - - vm.expectEmit(true, true, true, true, address(s_capabilityRegistry)); - emit NodeOperatorUpdated(TEST_NODE_OPERATOR_ID, NEW_NODE_OPERATOR_ADMIN, NEW_NODE_OPERATOR_NAME); - s_capabilityRegistry.updateNodeOperators(nodeOperatorIds, nodeOperators); - - CapabilityRegistry.NodeOperator memory nodeOperator = s_capabilityRegistry.getNodeOperator(TEST_NODE_OPERATOR_ID); - assertEq(nodeOperator.admin, NEW_NODE_OPERATOR_ADMIN); - assertEq(nodeOperator.name, NEW_NODE_OPERATOR_NAME); - } -} diff --git a/contracts/src/v0.8/keystone/test/CapabilityRegistry_UpdateNodesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilityRegistry_UpdateNodesTest.t.sol deleted file mode 100644 index da4e811c3ec..00000000000 --- a/contracts/src/v0.8/keystone/test/CapabilityRegistry_UpdateNodesTest.t.sol +++ /dev/null @@ -1,255 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; - -import {BaseTest} from "./BaseTest.t.sol"; -import {CapabilityRegistry} from "../CapabilityRegistry.sol"; - -contract CapabilityRegistry_UpdateNodesTest is BaseTest { - event NodeUpdated(bytes32 p2pId, uint32 indexed nodeOperatorId, bytes32 signer); - - function setUp() public override { - BaseTest.setUp(); - changePrank(ADMIN); - CapabilityRegistry.Capability[] memory capabilities = new CapabilityRegistry.Capability[](2); - capabilities[0] = s_basicCapability; - capabilities[1] = s_capabilityWithConfigurationContract; - - s_capabilityRegistry.addNodeOperators(_getNodeOperators()); - s_capabilityRegistry.addCapabilities(capabilities); - - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); - bytes32[] memory hashedCapabilityIds = new bytes32[](2); - hashedCapabilityIds[0] = s_basicHashedCapabilityId; - hashedCapabilityIds[1] = s_capabilityWithConfigurationContractId; - - nodes[0] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, - p2pId: P2P_ID, - signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, - hashedCapabilityIds: hashedCapabilityIds - }); - - changePrank(NODE_OPERATOR_ONE_ADMIN); - s_capabilityRegistry.addNodes(nodes); - - nodes[0] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_TWO_ID, - p2pId: P2P_ID_TWO, - signer: NODE_OPERATOR_TWO_SIGNER_ADDRESS, - hashedCapabilityIds: hashedCapabilityIds - }); - - changePrank(NODE_OPERATOR_TWO_ADMIN); - s_capabilityRegistry.addNodes(nodes); - } - - function test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() public { - changePrank(STRANGER); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); - - bytes32[] memory hashedCapabilityIds = new bytes32[](1); - hashedCapabilityIds[0] = s_basicHashedCapabilityId; - - nodes[0] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, - p2pId: P2P_ID, - signer: NODE_OPERATOR_TWO_SIGNER_ADDRESS, - hashedCapabilityIds: hashedCapabilityIds - }); - - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.AccessForbidden.selector, STRANGER)); - s_capabilityRegistry.updateNodes(nodes); - } - - function test_RevertWhen_NodeDoesNotExist() public { - changePrank(NODE_OPERATOR_ONE_ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); - - bytes32[] memory hashedCapabilityIds = new bytes32[](1); - hashedCapabilityIds[0] = s_basicHashedCapabilityId; - - nodes[0] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, - p2pId: INVALID_P2P_ID, - signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, - hashedCapabilityIds: hashedCapabilityIds - }); - - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.NodeDoesNotExist.selector, INVALID_P2P_ID)); - s_capabilityRegistry.updateNodes(nodes); - } - - function test_RevertWhen_P2PIDEmpty() public { - changePrank(NODE_OPERATOR_ONE_ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); - - bytes32[] memory hashedCapabilityIds = new bytes32[](1); - hashedCapabilityIds[0] = s_basicHashedCapabilityId; - - nodes[0] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, - p2pId: bytes32(""), - signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, - hashedCapabilityIds: hashedCapabilityIds - }); - - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.NodeDoesNotExist.selector, bytes32(""))); - s_capabilityRegistry.updateNodes(nodes); - } - - function test_RevertWhen_SignerAddressEmpty() public { - changePrank(NODE_OPERATOR_ONE_ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); - - bytes32[] memory hashedCapabilityIds = new bytes32[](1); - hashedCapabilityIds[0] = s_basicHashedCapabilityId; - - nodes[0] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, - p2pId: P2P_ID, - signer: bytes32(""), - hashedCapabilityIds: hashedCapabilityIds - }); - - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.InvalidNodeSigner.selector)); - s_capabilityRegistry.updateNodes(nodes); - } - - function test_RevertWhen_NodeSignerAlreadyAssignedToAnotherNode() public { - changePrank(NODE_OPERATOR_ONE_ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); - - bytes32[] memory hashedCapabilityIds = new bytes32[](1); - hashedCapabilityIds[0] = s_basicHashedCapabilityId; - - nodes[0] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, - p2pId: P2P_ID, - signer: NODE_OPERATOR_TWO_SIGNER_ADDRESS, - hashedCapabilityIds: hashedCapabilityIds - }); - - vm.expectRevert(CapabilityRegistry.InvalidNodeSigner.selector); - s_capabilityRegistry.updateNodes(nodes); - } - - function test_RevertWhen_UpdatingNodeWithoutCapabilities() public { - changePrank(NODE_OPERATOR_ONE_ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); - - bytes32[] memory hashedCapabilityIds = new bytes32[](0); - - nodes[0] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, - p2pId: P2P_ID, - signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, - hashedCapabilityIds: hashedCapabilityIds - }); - - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.InvalidNodeCapabilities.selector, hashedCapabilityIds)); - s_capabilityRegistry.updateNodes(nodes); - } - - function test_RevertWhen_AddingNodeWithInvalidCapability() public { - changePrank(NODE_OPERATOR_ONE_ADMIN); - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); - - bytes32[] memory hashedCapabilityIds = new bytes32[](1); - hashedCapabilityIds[0] = s_nonExistentHashedCapabilityId; - - nodes[0] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, - p2pId: P2P_ID, - signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, - hashedCapabilityIds: hashedCapabilityIds - }); - - vm.expectRevert(abi.encodeWithSelector(CapabilityRegistry.InvalidNodeCapabilities.selector, hashedCapabilityIds)); - s_capabilityRegistry.updateNodes(nodes); - } - - function test_CanUpdateParamsIfNodeSignerAddressNoLongerUsed() public { - changePrank(NODE_OPERATOR_ONE_ADMIN); - - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); - bytes32[] memory hashedCapabilityIds = new bytes32[](1); - hashedCapabilityIds[0] = s_basicHashedCapabilityId; - - // Set node one's signer to another address - nodes[0] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, - p2pId: P2P_ID, - signer: bytes32(abi.encodePacked(address(6666))), - hashedCapabilityIds: hashedCapabilityIds - }); - - s_capabilityRegistry.updateNodes(nodes); - - // Set node two's signer to node one's signer - changePrank(NODE_OPERATOR_TWO_ADMIN); - nodes[0] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_TWO_ID, - p2pId: P2P_ID_TWO, - signer: NODE_OPERATOR_ONE_SIGNER_ADDRESS, - hashedCapabilityIds: hashedCapabilityIds - }); - s_capabilityRegistry.updateNodes(nodes); - - (CapabilityRegistry.NodeInfo memory node, ) = s_capabilityRegistry.getNode(P2P_ID_TWO); - assertEq(node.signer, NODE_OPERATOR_ONE_SIGNER_ADDRESS); - } - - function test_UpdatesNodeInfo() public { - changePrank(NODE_OPERATOR_ONE_ADMIN); - - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); - bytes32[] memory hashedCapabilityIds = new bytes32[](1); - hashedCapabilityIds[0] = s_basicHashedCapabilityId; - - nodes[0] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, - p2pId: P2P_ID, - signer: NEW_NODE_SIGNER, - hashedCapabilityIds: hashedCapabilityIds - }); - - vm.expectEmit(address(s_capabilityRegistry)); - emit NodeUpdated(P2P_ID, TEST_NODE_OPERATOR_ONE_ID, NEW_NODE_SIGNER); - s_capabilityRegistry.updateNodes(nodes); - - (CapabilityRegistry.NodeInfo memory node, uint32 configCount) = s_capabilityRegistry.getNode(P2P_ID); - assertEq(node.nodeOperatorId, TEST_NODE_OPERATOR_ONE_ID); - assertEq(node.p2pId, P2P_ID); - assertEq(node.signer, NEW_NODE_SIGNER); - assertEq(node.hashedCapabilityIds.length, 1); - assertEq(node.hashedCapabilityIds[0], s_basicHashedCapabilityId); - assertEq(configCount, 2); - } - - function test_OwnerCanUpdateNodes() public { - changePrank(ADMIN); - - CapabilityRegistry.NodeInfo[] memory nodes = new CapabilityRegistry.NodeInfo[](1); - bytes32[] memory hashedCapabilityIds = new bytes32[](1); - hashedCapabilityIds[0] = s_basicHashedCapabilityId; - - nodes[0] = CapabilityRegistry.NodeInfo({ - nodeOperatorId: TEST_NODE_OPERATOR_ONE_ID, - p2pId: P2P_ID, - signer: NEW_NODE_SIGNER, - hashedCapabilityIds: hashedCapabilityIds - }); - - vm.expectEmit(address(s_capabilityRegistry)); - emit NodeUpdated(P2P_ID, TEST_NODE_OPERATOR_ONE_ID, NEW_NODE_SIGNER); - s_capabilityRegistry.updateNodes(nodes); - - (CapabilityRegistry.NodeInfo memory node, uint32 configCount) = s_capabilityRegistry.getNode(P2P_ID); - assertEq(node.nodeOperatorId, TEST_NODE_OPERATOR_ONE_ID); - assertEq(node.p2pId, P2P_ID); - assertEq(node.signer, NEW_NODE_SIGNER); - assertEq(node.hashedCapabilityIds.length, 1); - assertEq(node.hashedCapabilityIds[0], s_basicHashedCapabilityId); - assertEq(configCount, 2); - } -} diff --git a/core/capabilities/reader.go b/core/capabilities/reader.go index 0e664a73947..a0b7d3d96d8 100644 --- a/core/capabilities/reader.go +++ b/core/capabilities/reader.go @@ -9,7 +9,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/capabilities" "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink-common/pkg/types" - kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/keystone_capability_registry" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" p2ptypes "github.com/smartcontractkit/chainlink/v2/core/services/p2p/types" evmrelaytypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) @@ -26,9 +26,9 @@ type hashedCapabilityID [32]byte type donID uint32 type state struct { - IDsToDONs map[donID]kcr.CapabilityRegistryDONInfo - IDsToNodes map[p2ptypes.PeerID]kcr.CapabilityRegistryNodeInfo - IDsToCapabilities map[hashedCapabilityID]kcr.CapabilityRegistryCapability + IDsToDONs map[donID]kcr.CapabilitiesRegistryDONInfo + IDsToNodes map[p2ptypes.PeerID]kcr.CapabilitiesRegistryNodeInfo + IDsToCapabilities map[hashedCapabilityID]kcr.CapabilitiesRegistryCapabilityInfo } func (r *remoteRegistryReader) LocalNode(ctx context.Context) (capabilities.Node, error) { @@ -69,36 +69,36 @@ func (r *remoteRegistryReader) LocalNode(ctx context.Context) (capabilities.Node } func (r *remoteRegistryReader) state(ctx context.Context) (state, error) { - dons := []kcr.CapabilityRegistryDONInfo{} - err := r.r.GetLatestValue(ctx, "capabilityRegistry", "getDONs", nil, &dons) + dons := []kcr.CapabilitiesRegistryDONInfo{} + err := r.r.GetLatestValue(ctx, "CapabilitiesRegistry", "getDONs", nil, &dons) if err != nil { return state{}, err } - idsToDONs := map[donID]kcr.CapabilityRegistryDONInfo{} + idsToDONs := map[donID]kcr.CapabilitiesRegistryDONInfo{} for _, d := range dons { idsToDONs[donID(d.Id)] = d } - caps := kcr.GetCapabilities{} - err = r.r.GetLatestValue(ctx, "capabilityRegistry", "getCapabilities", nil, &caps) + caps := []kcr.CapabilitiesRegistryCapabilityInfo{} + err = r.r.GetLatestValue(ctx, "CapabilitiesRegistry", "getCapabilities", nil, &caps) if err != nil { return state{}, err } - idsToCapabilities := map[hashedCapabilityID]kcr.CapabilityRegistryCapability{} - for i, c := range caps.Capabilities { - idsToCapabilities[caps.HashedCapabilityIds[i]] = c + idsToCapabilities := map[hashedCapabilityID]kcr.CapabilitiesRegistryCapabilityInfo{} + for _, c := range caps { + idsToCapabilities[c.HashedId] = c } - nodes := &kcr.GetNodes{} - err = r.r.GetLatestValue(ctx, "capabilityRegistry", "getNodes", nil, &nodes) + nodes := []kcr.CapabilitiesRegistryNodeInfo{} + err = r.r.GetLatestValue(ctx, "CapabilitiesRegistry", "getNodes", nil, &nodes) if err != nil { return state{}, err } - idsToNodes := map[p2ptypes.PeerID]kcr.CapabilityRegistryNodeInfo{} - for _, node := range nodes.NodeInfo { + idsToNodes := map[p2ptypes.PeerID]kcr.CapabilitiesRegistryNodeInfo{} + for _, node := range nodes { idsToNodes[node.P2pId] = node } @@ -112,8 +112,8 @@ type contractReaderFactory interface { func newRemoteRegistryReader(ctx context.Context, lggr logger.Logger, peerWrapper p2ptypes.PeerWrapper, relayer contractReaderFactory, remoteRegistryAddress string) (*remoteRegistryReader, error) { contractReaderConfig := evmrelaytypes.ChainReaderConfig{ Contracts: map[string]evmrelaytypes.ChainContractReader{ - "capabilityRegistry": { - ContractABI: kcr.CapabilityRegistryABI, + "CapabilitiesRegistry": { + ContractABI: kcr.CapabilitiesRegistryABI, Configs: map[string]*evmrelaytypes.ChainReaderDefinition{ "getDONs": { ChainSpecificName: "getDONs", @@ -142,7 +142,7 @@ func newRemoteRegistryReader(ctx context.Context, lggr logger.Logger, peerWrappe err = cr.Bind(ctx, []types.BoundContract{ { Address: remoteRegistryAddress, - Name: "capabilityRegistry", + Name: "CapabilitiesRegistry", }, }) if err != nil { diff --git a/core/capabilities/reader_test.go b/core/capabilities/reader_test.go index 395a08c1e19..cc61628c541 100644 --- a/core/capabilities/reader_test.go +++ b/core/capabilities/reader_test.go @@ -21,7 +21,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/types" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" - kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/keystone_capability_registry" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest" "github.com/smartcontractkit/chainlink/v2/core/logger" @@ -30,13 +30,13 @@ import ( evmrelaytypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) -var writeChainCapability = kcr.CapabilityRegistryCapability{ +var writeChainCapability = kcr.CapabilitiesRegistryCapability{ LabelledName: "write-chain", Version: "1.0.1", ResponseType: uint8(1), } -func startNewChainWithRegistry(t *testing.T) (*kcr.CapabilityRegistry, common.Address, *bind.TransactOpts, *backends.SimulatedBackend) { +func startNewChainWithRegistry(t *testing.T) (*kcr.CapabilitiesRegistry, common.Address, *bind.TransactOpts, *backends.SimulatedBackend) { owner := testutils.MustNewSimTransactor(t) oneEth, _ := new(big.Int).SetString("100000000000000000000", 10) @@ -47,13 +47,13 @@ func startNewChainWithRegistry(t *testing.T) (*kcr.CapabilityRegistry, common.Ad }}, gasLimit) simulatedBackend.Commit() - capabilityRegistryAddress, _, capabilityRegistry, err := kcr.DeployCapabilityRegistry(owner, simulatedBackend) - require.NoError(t, err, "DeployCapabilityRegistry failed") + CapabilitiesRegistryAddress, _, CapabilitiesRegistry, err := kcr.DeployCapabilitiesRegistry(owner, simulatedBackend) + require.NoError(t, err, "DeployCapabilitiesRegistry failed") - fmt.Println("Deployed CapabilityRegistry at", capabilityRegistryAddress.Hex()) + fmt.Println("Deployed CapabilitiesRegistry at", CapabilitiesRegistryAddress.Hex()) simulatedBackend.Commit() - return capabilityRegistry, capabilityRegistryAddress, owner, simulatedBackend + return CapabilitiesRegistry, CapabilitiesRegistryAddress, owner, simulatedBackend } type crFactory struct { @@ -133,14 +133,14 @@ func TestReader_Integration(t *testing.T) { ctx := testutils.Context(t) reg, regAddress, owner, sim := startNewChainWithRegistry(t) - _, err := reg.AddCapabilities(owner, []kcr.CapabilityRegistryCapability{writeChainCapability}) + _, err := reg.AddCapabilities(owner, []kcr.CapabilitiesRegistryCapability{writeChainCapability}) require.NoError(t, err, "AddCapability failed for %s", writeChainCapability.LabelledName) sim.Commit() cid, err := reg.GetHashedCapabilityId(&bind.CallOpts{}, writeChainCapability.LabelledName, writeChainCapability.Version) require.NoError(t, err) - _, err = reg.AddNodeOperators(owner, []kcr.CapabilityRegistryNodeOperator{ + _, err = reg.AddNodeOperators(owner, []kcr.CapabilitiesRegistryNodeOperator{ { Admin: owner.From, Name: "TEST_NOP", @@ -154,25 +154,31 @@ func TestReader_Integration(t *testing.T) { randomWord(), } - nodes := []kcr.CapabilityRegistryNodeInfo{ + signersSet := [][32]byte{ + randomWord(), + randomWord(), + randomWord(), + } + + nodes := []kcr.CapabilitiesRegistryNodeParams{ { // The first NodeOperatorId has id 1 since the id is auto-incrementing. NodeOperatorId: uint32(1), - Signer: randomWord(), + Signer: signersSet[0], P2pId: nodeSet[0], HashedCapabilityIds: [][32]byte{cid}, }, { // The first NodeOperatorId has id 1 since the id is auto-incrementing. NodeOperatorId: uint32(1), - Signer: randomWord(), + Signer: signersSet[1], P2pId: nodeSet[1], HashedCapabilityIds: [][32]byte{cid}, }, { // The first NodeOperatorId has id 1 since the id is auto-incrementing. NodeOperatorId: uint32(1), - Signer: randomWord(), + Signer: signersSet[2], P2pId: nodeSet[2], HashedCapabilityIds: [][32]byte{cid}, }, @@ -180,7 +186,7 @@ func TestReader_Integration(t *testing.T) { _, err = reg.AddNodes(owner, nodes) require.NoError(t, err) - cfgs := []kcr.CapabilityRegistryCapabilityConfiguration{ + cfgs := []kcr.CapabilitiesRegistryCapabilityConfiguration{ { CapabilityId: cid, Config: []byte(`{"hello": "world"}`), @@ -212,10 +218,17 @@ func TestReader_Integration(t *testing.T) { assert.Len(t, s.IDsToCapabilities, 1) gotCap := s.IDsToCapabilities[cid] - assert.Equal(t, writeChainCapability, gotCap) + assert.Equal(t, kcr.CapabilitiesRegistryCapabilityInfo{ + HashedId: cid, + LabelledName: "write-chain", + Version: "1.0.1", + ResponseType: uint8(1), + CapabilityType: uint8(0), + IsDeprecated: false, + }, gotCap) assert.Len(t, s.IDsToDONs, 1) - assert.Equal(t, kcr.CapabilityRegistryDONInfo{ + assert.Equal(t, kcr.CapabilitiesRegistryDONInfo{ Id: 1, // initial Id ConfigCount: 1, // initial Count IsPublic: true, @@ -225,11 +238,44 @@ func TestReader_Integration(t *testing.T) { CapabilityConfigurations: cfgs, }, s.IDsToDONs[1]) + nodesInfo := []kcr.CapabilitiesRegistryNodeInfo{ + { + // The first NodeOperatorId has id 1 since the id is auto-incrementing. + NodeOperatorId: uint32(1), + ConfigCount: 1, + WorkflowDONId: 1, + Signer: signersSet[0], + P2pId: nodeSet[0], + HashedCapabilityIds: [][32]byte{cid}, + CapabilitiesDONIds: []*big.Int{}, + }, + { + // The first NodeOperatorId has id 1 since the id is auto-incrementing. + NodeOperatorId: uint32(1), + ConfigCount: 1, + WorkflowDONId: 1, + Signer: signersSet[1], + P2pId: nodeSet[1], + HashedCapabilityIds: [][32]byte{cid}, + CapabilitiesDONIds: []*big.Int{}, + }, + { + // The first NodeOperatorId has id 1 since the id is auto-incrementing. + NodeOperatorId: uint32(1), + ConfigCount: 1, + WorkflowDONId: 1, + Signer: signersSet[2], + P2pId: nodeSet[2], + HashedCapabilityIds: [][32]byte{cid}, + CapabilitiesDONIds: []*big.Int{}, + }, + } + assert.Len(t, s.IDsToNodes, 3) - assert.Equal(t, map[p2ptypes.PeerID]kcr.CapabilityRegistryNodeInfo{ - nodeSet[0]: nodes[0], - nodeSet[1]: nodes[1], - nodeSet[2]: nodes[2], + assert.Equal(t, map[p2ptypes.PeerID]kcr.CapabilitiesRegistryNodeInfo{ + nodeSet[0]: nodesInfo[0], + nodeSet[1]: nodesInfo[1], + nodeSet[2]: nodesInfo[2], }, s.IDsToNodes) node, err := reader.LocalNode(ctx) diff --git a/core/capabilities/registry.go b/core/capabilities/registry.go index 6a3a4ffb83b..3cfe1d169b7 100644 --- a/core/capabilities/registry.go +++ b/core/capabilities/registry.go @@ -158,6 +158,6 @@ func (r *Registry) Add(ctx context.Context, c capabilities.BaseCapability) error func NewRegistry(lggr logger.Logger) *Registry { return &Registry{ m: map[string]capabilities.BaseCapability{}, - lggr: lggr.Named("CapabilityRegistry"), + lggr: lggr.Named("CapabilitiesRegistry"), } } diff --git a/core/capabilities/syncer.go b/core/capabilities/syncer.go index 50dece12c01..800fb325094 100644 --- a/core/capabilities/syncer.go +++ b/core/capabilities/syncer.go @@ -25,7 +25,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/target" remotetypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/types" "github.com/smartcontractkit/chainlink/v2/core/capabilities/streams" - kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/keystone_capability_registry" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" "github.com/smartcontractkit/chainlink/v2/core/logger" p2ptypes "github.com/smartcontractkit/chainlink/v2/core/services/p2p/types" ) @@ -174,7 +174,7 @@ func (s *registrySyncer) sync(ctx context.Context) error { allPeers[p] = cfg } - publicDONs := []kcr.CapabilityRegistryDONInfo{} + publicDONs := []kcr.CapabilitiesRegistryDONInfo{} for _, d := range readerState.IDsToDONs { if !d.IsPublic { continue @@ -202,8 +202,8 @@ func (s *registrySyncer) sync(ctx context.Context) error { // We'll also construct a set to record what DONs the current node is a part of, // regardless of any modifiers (public/acceptsWorkflows etc). myID := s.peerWrapper.GetPeer().ID() - myWorkflowDONs := []kcr.CapabilityRegistryDONInfo{} - remoteWorkflowDONs := []kcr.CapabilityRegistryDONInfo{} + myWorkflowDONs := []kcr.CapabilitiesRegistryDONInfo{} + remoteWorkflowDONs := []kcr.CapabilitiesRegistryDONInfo{} myDONs := map[uint32]bool{} for _, d := range readerState.IDsToDONs { for _, peerID := range d.NodeP2PIds { @@ -223,8 +223,8 @@ func (s *registrySyncer) sync(ctx context.Context) error { // - remote capability DONs (with IsPublic = true) the current node is a part of. // These need server-side shims. - myCapabilityDONs := []kcr.CapabilityRegistryDONInfo{} - remoteCapabilityDONs := []kcr.CapabilityRegistryDONInfo{} + myCapabilityDONs := []kcr.CapabilitiesRegistryDONInfo{} + remoteCapabilityDONs := []kcr.CapabilitiesRegistryDONInfo{} for _, d := range publicDONs { if len(d.CapabilityConfigurations) > 0 { if myDONs[d.Id] { @@ -267,7 +267,7 @@ func (s *registrySyncer) sync(ctx context.Context) error { return nil } -func signersFor(don kcr.CapabilityRegistryDONInfo, state state) ([][]byte, error) { +func signersFor(don kcr.CapabilitiesRegistryDONInfo, state state) ([][]byte, error) { s := [][]byte{} for _, nodeID := range don.NodeP2PIds { node, ok := state.IDsToNodes[nodeID] @@ -283,7 +283,7 @@ func signersFor(don kcr.CapabilityRegistryDONInfo, state state) ([][]byte, error return s, nil } -func toDONInfo(don kcr.CapabilityRegistryDONInfo) *capabilities.DON { +func toDONInfo(don kcr.CapabilitiesRegistryDONInfo) *capabilities.DON { peerIDs := []p2ptypes.PeerID{} for _, p := range don.NodeP2PIds { peerIDs = append(peerIDs, p) @@ -312,7 +312,7 @@ func toCapabilityType(capabilityType uint8) capabilities.CapabilityType { } } -func (s *registrySyncer) addRemoteCapabilities(ctx context.Context, myDON kcr.CapabilityRegistryDONInfo, remoteDON kcr.CapabilityRegistryDONInfo, state state) error { +func (s *registrySyncer) addRemoteCapabilities(ctx context.Context, myDON kcr.CapabilitiesRegistryDONInfo, remoteDON kcr.CapabilitiesRegistryDONInfo, state state) error { for _, c := range remoteDON.CapabilityConfigurations { capability, ok := state.IDsToCapabilities[c.CapabilityId] if !ok { @@ -399,7 +399,7 @@ type capabilityService interface { services.Service } -func (s *registrySyncer) addToRegistryAndSetDispatcher(ctx context.Context, capabilityInfo kcr.CapabilityRegistryCapability, don kcr.CapabilityRegistryDONInfo, newCapFn func(info capabilities.CapabilityInfo) (capabilityService, error)) error { +func (s *registrySyncer) addToRegistryAndSetDispatcher(ctx context.Context, capabilityInfo kcr.CapabilitiesRegistryCapabilityInfo, don kcr.CapabilitiesRegistryDONInfo, newCapFn func(info capabilities.CapabilityInfo) (capabilityService, error)) error { fullCapID := fmt.Sprintf("%s@%s", capabilityInfo.LabelledName, capabilityInfo.Version) info, err := capabilities.NewRemoteCapabilityInfo( fullCapID, @@ -449,7 +449,7 @@ var ( defaultTargetRequestTimeout = time.Minute ) -func (s *registrySyncer) enableExternalAccess(ctx context.Context, myPeerID p2ptypes.PeerID, don kcr.CapabilityRegistryDONInfo, state state, remoteWorkflowDONs []kcr.CapabilityRegistryDONInfo) error { +func (s *registrySyncer) enableExternalAccess(ctx context.Context, myPeerID p2ptypes.PeerID, don kcr.CapabilitiesRegistryDONInfo, state state, remoteWorkflowDONs []kcr.CapabilitiesRegistryDONInfo) error { idsToDONs := map[string]capabilities.DON{} for _, d := range remoteWorkflowDONs { idsToDONs[fmt.Sprint(d.Id)] = *toDONInfo(d) @@ -520,7 +520,7 @@ type receiverService interface { remotetypes.Receiver } -func (s *registrySyncer) addReceiver(ctx context.Context, capability kcr.CapabilityRegistryCapability, don kcr.CapabilityRegistryDONInfo, newReceiverFn func(capability capabilities.BaseCapability, info capabilities.CapabilityInfo) (receiverService, error)) error { +func (s *registrySyncer) addReceiver(ctx context.Context, capability kcr.CapabilitiesRegistryCapabilityInfo, don kcr.CapabilitiesRegistryDONInfo, newReceiverFn func(capability capabilities.BaseCapability, info capabilities.CapabilityInfo) (receiverService, error)) error { fullCapID := fmt.Sprintf("%s@%s", capability.LabelledName, capability.Version) info, err := capabilities.NewRemoteCapabilityInfo( fullCapID, diff --git a/core/capabilities/syncer_test.go b/core/capabilities/syncer_test.go index f3050167ecf..2c5f871bdb8 100644 --- a/core/capabilities/syncer_test.go +++ b/core/capabilities/syncer_test.go @@ -16,7 +16,7 @@ import ( commonMocks "github.com/smartcontractkit/chainlink-common/pkg/types/mocks" "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" remoteMocks "github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/types/mocks" - kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/keystone_capability_registry" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" p2ptypes "github.com/smartcontractkit/chainlink/v2/core/services/p2p/types" @@ -140,7 +140,7 @@ func TestSyncer_WiresUpExternalCapabilities(t *testing.T) { // no entries should be added to the registry. mr := &mockReader{ s: state{ - IDsToDONs: map[donID]kcr.CapabilityRegistryDONInfo{ + IDsToDONs: map[donID]kcr.CapabilitiesRegistryDONInfo{ donID(dID): { Id: dID, ConfigCount: uint32(0), @@ -148,7 +148,7 @@ func TestSyncer_WiresUpExternalCapabilities(t *testing.T) { IsPublic: true, AcceptsWorkflows: true, NodeP2PIds: nodes, - CapabilityConfigurations: []kcr.CapabilityRegistryCapabilityConfiguration{ + CapabilityConfigurations: []kcr.CapabilitiesRegistryCapabilityConfiguration{ { CapabilityId: triggerCapID, Config: []byte(""), @@ -160,7 +160,7 @@ func TestSyncer_WiresUpExternalCapabilities(t *testing.T) { }, }, }, - IDsToCapabilities: map[hashedCapabilityID]kcr.CapabilityRegistryCapability{ + IDsToCapabilities: map[hashedCapabilityID]kcr.CapabilitiesRegistryCapabilityInfo{ triggerCapID: { LabelledName: "streams-trigger", Version: "1.0.0", @@ -172,7 +172,7 @@ func TestSyncer_WiresUpExternalCapabilities(t *testing.T) { CapabilityType: 3, }, }, - IDsToNodes: map[p2ptypes.PeerID]kcr.CapabilityRegistryNodeInfo{ + IDsToNodes: map[p2ptypes.PeerID]kcr.CapabilitiesRegistryNodeInfo{ nodes[0]: { NodeOperatorId: 1, Signer: randomWord(), @@ -242,7 +242,7 @@ func TestSyncer_IgnoresCapabilitiesForPrivateDON(t *testing.T) { // We expect no action to be taken by the syncer. mr := &mockReader{ s: state{ - IDsToDONs: map[donID]kcr.CapabilityRegistryDONInfo{ + IDsToDONs: map[donID]kcr.CapabilitiesRegistryDONInfo{ donID(dID): { Id: dID, ConfigCount: uint32(0), @@ -250,7 +250,7 @@ func TestSyncer_IgnoresCapabilitiesForPrivateDON(t *testing.T) { IsPublic: false, AcceptsWorkflows: true, NodeP2PIds: nodes, - CapabilityConfigurations: []kcr.CapabilityRegistryCapabilityConfiguration{ + CapabilityConfigurations: []kcr.CapabilitiesRegistryCapabilityConfiguration{ { CapabilityId: triggerCapID, Config: []byte(""), @@ -262,7 +262,7 @@ func TestSyncer_IgnoresCapabilitiesForPrivateDON(t *testing.T) { }, }, }, - IDsToCapabilities: map[hashedCapabilityID]kcr.CapabilityRegistryCapability{ + IDsToCapabilities: map[hashedCapabilityID]kcr.CapabilitiesRegistryCapabilityInfo{ triggerCapID: { LabelledName: "streams-trigger", Version: "1.0.0", @@ -274,7 +274,7 @@ func TestSyncer_IgnoresCapabilitiesForPrivateDON(t *testing.T) { CapabilityType: 3, }, }, - IDsToNodes: map[p2ptypes.PeerID]kcr.CapabilityRegistryNodeInfo{ + IDsToNodes: map[p2ptypes.PeerID]kcr.CapabilitiesRegistryNodeInfo{ nodes[0]: { NodeOperatorId: 1, Signer: randomWord(), @@ -356,7 +356,7 @@ func TestSyncer_WiresUpClientsForPublicWorkflowDON(t *testing.T) { // We expect receivers to be wired up and both capabilities to be added to the registry. mr := &mockReader{ s: state{ - IDsToDONs: map[donID]kcr.CapabilityRegistryDONInfo{ + IDsToDONs: map[donID]kcr.CapabilitiesRegistryDONInfo{ donID(dID): { Id: dID, ConfigCount: uint32(0), @@ -372,7 +372,7 @@ func TestSyncer_WiresUpClientsForPublicWorkflowDON(t *testing.T) { IsPublic: true, AcceptsWorkflows: false, NodeP2PIds: capabilityDonNodes, - CapabilityConfigurations: []kcr.CapabilityRegistryCapabilityConfiguration{ + CapabilityConfigurations: []kcr.CapabilitiesRegistryCapabilityConfiguration{ { CapabilityId: triggerCapID, Config: []byte(""), @@ -384,7 +384,7 @@ func TestSyncer_WiresUpClientsForPublicWorkflowDON(t *testing.T) { }, }, }, - IDsToCapabilities: map[hashedCapabilityID]kcr.CapabilityRegistryCapability{ + IDsToCapabilities: map[hashedCapabilityID]kcr.CapabilitiesRegistryCapabilityInfo{ triggerCapID: { LabelledName: "streams-trigger", Version: "1.0.0", @@ -396,7 +396,7 @@ func TestSyncer_WiresUpClientsForPublicWorkflowDON(t *testing.T) { CapabilityType: 3, }, }, - IDsToNodes: map[p2ptypes.PeerID]kcr.CapabilityRegistryNodeInfo{ + IDsToNodes: map[p2ptypes.PeerID]kcr.CapabilitiesRegistryNodeInfo{ capabilityDonNodes[0]: { NodeOperatorId: 1, Signer: randomWord(), @@ -501,7 +501,7 @@ func TestSyncer_WiresUpClientsForPublicWorkflowDONButIgnoresPrivateCapabilities( // We expect receivers to be wired up and both capabilities to be added to the registry. mr := &mockReader{ s: state{ - IDsToDONs: map[donID]kcr.CapabilityRegistryDONInfo{ + IDsToDONs: map[donID]kcr.CapabilitiesRegistryDONInfo{ donID(dID): { Id: dID, ConfigCount: uint32(0), @@ -517,7 +517,7 @@ func TestSyncer_WiresUpClientsForPublicWorkflowDONButIgnoresPrivateCapabilities( IsPublic: true, AcceptsWorkflows: false, NodeP2PIds: capabilityDonNodes, - CapabilityConfigurations: []kcr.CapabilityRegistryCapabilityConfiguration{ + CapabilityConfigurations: []kcr.CapabilitiesRegistryCapabilityConfiguration{ { CapabilityId: triggerCapID, Config: []byte(""), @@ -531,7 +531,7 @@ func TestSyncer_WiresUpClientsForPublicWorkflowDONButIgnoresPrivateCapabilities( IsPublic: false, AcceptsWorkflows: false, NodeP2PIds: capabilityDonNodes, - CapabilityConfigurations: []kcr.CapabilityRegistryCapabilityConfiguration{ + CapabilityConfigurations: []kcr.CapabilitiesRegistryCapabilityConfiguration{ { CapabilityId: targetCapID, Config: []byte(""), @@ -539,7 +539,7 @@ func TestSyncer_WiresUpClientsForPublicWorkflowDONButIgnoresPrivateCapabilities( }, }, }, - IDsToCapabilities: map[hashedCapabilityID]kcr.CapabilityRegistryCapability{ + IDsToCapabilities: map[hashedCapabilityID]kcr.CapabilitiesRegistryCapabilityInfo{ triggerCapID: { LabelledName: "streams-trigger", Version: "1.0.0", @@ -551,7 +551,7 @@ func TestSyncer_WiresUpClientsForPublicWorkflowDONButIgnoresPrivateCapabilities( CapabilityType: 3, }, }, - IDsToNodes: map[p2ptypes.PeerID]kcr.CapabilityRegistryNodeInfo{ + IDsToNodes: map[p2ptypes.PeerID]kcr.CapabilitiesRegistryNodeInfo{ capabilityDonNodes[0]: { NodeOperatorId: 1, Signer: randomWord(), diff --git a/core/capabilities/targets/mocks/chain_writer.go b/core/capabilities/targets/mocks/chain_writer.go index d8a5a677a11..408c83ca534 100644 --- a/core/capabilities/targets/mocks/chain_writer.go +++ b/core/capabilities/targets/mocks/chain_writer.go @@ -77,7 +77,7 @@ func (_m *ChainWriter) GetTransactionStatus(ctx context.Context, transactionID u } // SubmitTransaction provides a mock function with given fields: ctx, contractName, method, args, transactionID, toAddress, meta, value -func (_m *ChainWriter) SubmitTransaction(ctx context.Context, contractName string, method string, args interface{}, transactionID uuid.UUID, toAddress string, meta *types.TxMeta, value big.Int) error { +func (_m *ChainWriter) SubmitTransaction(ctx context.Context, contractName string, method string, args interface{}, transactionID string, toAddress string, meta *types.TxMeta, value *big.Int) error { ret := _m.Called(ctx, contractName, method, args, transactionID, toAddress, meta, value) if len(ret) == 0 { @@ -85,7 +85,7 @@ func (_m *ChainWriter) SubmitTransaction(ctx context.Context, contractName strin } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, string, interface{}, uuid.UUID, string, *types.TxMeta, big.Int) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, string, string, interface{}, string, string, *types.TxMeta, *big.Int) error); ok { r0 = rf(ctx, contractName, method, args, transactionID, toAddress, meta, value) } else { r0 = ret.Error(0) diff --git a/core/capabilities/targets/write_target.go b/core/capabilities/targets/write_target.go index 02f95ed6a08..de65cb85199 100644 --- a/core/capabilities/targets/write_target.go +++ b/core/capabilities/targets/write_target.go @@ -151,7 +151,7 @@ func (cap *WriteTarget) Execute(ctx context.Context, request capabilities.Capabi meta := commontypes.TxMeta{WorkflowExecutionID: &request.Metadata.WorkflowExecutionID} value := big.NewInt(0) - if err := cap.cw.SubmitTransaction(ctx, "forwarder", "report", req, txID, cap.forwarderAddress, &meta, *value); err != nil { + if err := cap.cw.SubmitTransaction(ctx, "forwarder", "report", req, txID.String(), cap.forwarderAddress, &meta, value); err != nil { return nil, err } cap.lggr.Debugw("Transaction submitted", "request", request, "transaction", txID) diff --git a/core/chains/evm/logpoller/parser.go b/core/chains/evm/logpoller/parser.go index 2e17c92ed60..e08ea93da73 100644 --- a/core/chains/evm/logpoller/parser.go +++ b/core/chains/evm/logpoller/parser.go @@ -21,6 +21,7 @@ const ( timestampFieldName = "block_timestamp" txHashFieldName = "tx_hash" eventSigFieldName = "event_sig" + defaultSort = "block_number DESC, log_index DESC" ) var ( @@ -249,11 +250,15 @@ func (v *pgDSLParser) whereClause(expressions []query.Expression, limiter query. segment := "WHERE evm_chain_id = :evm_chain_id" if len(expressions) > 0 { - exp, err := v.combineExpressions(expressions, query.AND) + exp, hasFinalized, err := v.combineExpressions(expressions, query.AND) if err != nil { return "", err } + if limiter.HasCursorLimit() && !hasFinalized { + return "", errors.New("cursor-base queries limited to only finalized blocks") + } + segment = fmt.Sprintf("%s AND %s", segment, exp) } @@ -268,15 +273,14 @@ func (v *pgDSLParser) whereClause(expressions []query.Expression, limiter query. return "", errors.New("invalid cursor direction") } - block, txHash, logIdx, err := valuesFromCursor(limiter.Limit.Cursor) + block, logIdx, _, err := valuesFromCursor(limiter.Limit.Cursor) if err != nil { return "", err } - segment = fmt.Sprintf("%s AND block_number %s= :cursor_block AND tx_hash %s= :cursor_txhash AND log_index %s :cursor_log_index", segment, op, op, op) + segment = fmt.Sprintf("%s AND (block_number %s :cursor_block_number OR (block_number = :cursor_block_number AND log_index %s :cursor_log_index))", segment, op, op) v.args.withField("cursor_block_number", block). - withField("cursor_txhash", common.HexToHash(txHash)). withField("cursor_log_index", logIdx) } @@ -302,7 +306,7 @@ func (v *pgDSLParser) orderClause(limiter query.LimitAndSort) (string, error) { } if len(sorting) == 0 { - return "", nil + return fmt.Sprintf("ORDER BY %s", defaultSort), nil } sort := make([]string, len(sorting)) @@ -319,7 +323,7 @@ func (v *pgDSLParser) orderClause(limiter query.LimitAndSort) (string, error) { case query.SortByBlock: name = blockFieldName case query.SortBySequence: - sort[idx] = fmt.Sprintf("block_number %s, tx_hash %s, log_index %s", order, order, order) + sort[idx] = fmt.Sprintf("block_number %s, log_index %s, tx_hash %s", order, order, order) continue case query.SortByTimestamp: @@ -352,24 +356,37 @@ func (v *pgDSLParser) getLastExpression() (string, error) { return exp, err } -func (v *pgDSLParser) combineExpressions(expressions []query.Expression, op query.BoolOperator) (string, error) { +func (v *pgDSLParser) combineExpressions(expressions []query.Expression, op query.BoolOperator) (string, bool, error) { grouped := len(expressions) > 1 clauses := make([]string, len(expressions)) + var isFinalized bool + for idx, exp := range expressions { if exp.IsPrimitive() { exp.Primitive.Accept(v) + switch prim := exp.Primitive.(type) { + case *primitives.Confidence: + isFinalized = prim.ConfidenceLevel == primitives.Finalized + case *confirmationsFilter: + isFinalized = prim.Confirmations == evmtypes.Finalized + } + clause, err := v.getLastExpression() if err != nil { - return "", err + return "", isFinalized, err } clauses[idx] = clause } else { - clause, err := v.combineExpressions(exp.BoolExpression.Expressions, exp.BoolExpression.BoolOperator) + clause, fin, err := v.combineExpressions(exp.BoolExpression.Expressions, exp.BoolExpression.BoolOperator) if err != nil { - return "", err + return "", isFinalized, err + } + + if fin { + isFinalized = fin } clauses[idx] = clause @@ -382,7 +399,7 @@ func (v *pgDSLParser) combineExpressions(expressions []query.Expression, op quer output = fmt.Sprintf("(%s)", output) } - return output, nil + return output, isFinalized, nil } func cmpOpToString(op primitives.ComparisonOperator) (string, error) { @@ -415,23 +432,30 @@ func orderToString(dir query.SortDirection) (string, error) { } } -func valuesFromCursor(cursor string) (int64, string, int, error) { +func valuesFromCursor(cursor string) (int64, int, []byte, error) { + partCount := 3 + parts := strings.Split(cursor, "-") - if len(parts) != 3 { - return 0, "", 0, fmt.Errorf("%w: must be composed as block-txhash-logindex", ErrUnexpectedCursorFormat) + if len(parts) != partCount { + return 0, 0, nil, fmt.Errorf("%w: must be composed as block-logindex-txHash", ErrUnexpectedCursorFormat) } block, err := strconv.ParseInt(parts[0], 10, 64) if err != nil { - return 0, "", 0, fmt.Errorf("%w: block number not parsable as int64", ErrUnexpectedCursorFormat) + return 0, 0, nil, fmt.Errorf("%w: block number not parsable as int64", ErrUnexpectedCursorFormat) + } + + logIdx, err := strconv.ParseInt(parts[1], 10, 32) + if err != nil { + return 0, 0, nil, fmt.Errorf("%w: log index not parsable as int", ErrUnexpectedCursorFormat) } - logIdx, err := strconv.ParseInt(parts[2], 10, 32) + txHash, err := hexutil.Decode(parts[2]) if err != nil { - return 0, "", 0, fmt.Errorf("%w: log index not parsable as int", ErrUnexpectedCursorFormat) + return 0, 0, nil, fmt.Errorf("%w: invalid transaction hash: %s", ErrUnexpectedCursorFormat, err.Error()) } - return block, parts[1], int(logIdx), nil + return block, int(logIdx), txHash, nil } type addressFilter struct { diff --git a/core/chains/evm/logpoller/parser_test.go b/core/chains/evm/logpoller/parser_test.go index 521aec14d8c..5e99ec7ba82 100644 --- a/core/chains/evm/logpoller/parser_test.go +++ b/core/chains/evm/logpoller/parser_test.go @@ -10,6 +10,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/types/query" "github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ) func assertArgs(t *testing.T, args *queryArgs, numVals int) { @@ -33,7 +34,7 @@ func TestDSLParser(t *testing.T) { result, args, err := parser.buildQuery(chainID, expressions, limiter) require.NoError(t, err) - assert.Equal(t, "SELECT evm.logs.* FROM evm.logs WHERE evm_chain_id = :evm_chain_id", result) + assert.Equal(t, "SELECT evm.logs.* FROM evm.logs WHERE evm_chain_id = :evm_chain_id ORDER BY "+defaultSort, result) assertArgs(t, args, 1) }) @@ -46,22 +47,25 @@ func TestDSLParser(t *testing.T) { expressions := []query.Expression{ NewAddressFilter(common.HexToAddress("0x42")), NewEventSigFilter(common.HexToHash("0x21")), + NewConfirmationsFilter(types.Finalized), } - limiter := query.NewLimitAndSort(query.CursorLimit("10-0x42-5", query.CursorFollowing, 20)) + limiter := query.NewLimitAndSort(query.CursorLimit("10-5-0x42", query.CursorFollowing, 20)) result, args, err := parser.buildQuery(chainID, expressions, limiter) expected := "SELECT evm.logs.* " + "FROM evm.logs " + "WHERE evm_chain_id = :evm_chain_id " + - "AND (address = :address_0 AND event_sig = :event_sig_0) " + - "AND block_number >= :cursor_block AND tx_hash >= :cursor_txhash AND log_index > :cursor_log_index " + - "ORDER BY block_number ASC, tx_hash ASC, log_index ASC " + + "AND (address = :address_0 AND event_sig = :event_sig_0 " + + "AND block_number <= " + + "(SELECT finalized_block_number FROM evm.log_poller_blocks WHERE evm_chain_id = :evm_chain_id ORDER BY block_number DESC LIMIT 1)) " + + "AND (block_number > :cursor_block_number OR (block_number = :cursor_block_number AND log_index > :cursor_log_index)) " + + "ORDER BY block_number ASC, log_index ASC, tx_hash ASC " + "LIMIT 20" require.NoError(t, err) assert.Equal(t, expected, result) - assertArgs(t, args, 6) + assertArgs(t, args, 5) }) t.Run("query with limit and no order by", func(t *testing.T) { @@ -80,6 +84,7 @@ func TestDSLParser(t *testing.T) { "FROM evm.logs " + "WHERE evm_chain_id = :evm_chain_id " + "AND (address = :address_0 AND event_sig = :event_sig_0) " + + "ORDER BY " + defaultSort + " " + "LIMIT 20" require.NoError(t, err) @@ -100,7 +105,7 @@ func TestDSLParser(t *testing.T) { expected := "SELECT evm.logs.* " + "FROM evm.logs " + "WHERE evm_chain_id = :evm_chain_id " + - "ORDER BY block_number DESC, tx_hash DESC, log_index DESC" + "ORDER BY block_number DESC, log_index DESC, tx_hash DESC" require.NoError(t, err) assert.Equal(t, expected, result) @@ -138,9 +143,8 @@ func TestDSLParser(t *testing.T) { query.TxHash(common.HexToHash("0x84").String()), query.Block(99, primitives.Neq), query.Confidence(primitives.Finalized), - query.Confidence(primitives.Unconfirmed), } - limiter := query.NewLimitAndSort(query.CursorLimit("10-0x42-20", query.CursorPrevious, 20)) + limiter := query.NewLimitAndSort(query.CursorLimit("10-20-0x42", query.CursorPrevious, 20)) result, args, err := parser.buildQuery(chainID, expressions, limiter) expected := "SELECT evm.logs.* " + @@ -150,15 +154,14 @@ func TestDSLParser(t *testing.T) { "AND tx_hash = :tx_hash_0 " + "AND block_number != :block_number_0 " + "AND block_number <= " + - "(SELECT finalized_block_number FROM evm.log_poller_blocks WHERE evm_chain_id = :evm_chain_id ORDER BY block_number DESC LIMIT 1) " + - "AND block_number <= (SELECT greatest(block_number - :confs_0, 0) FROM evm.log_poller_blocks WHERE evm_chain_id = :evm_chain_id ORDER BY block_number DESC LIMIT 1)) " + - "AND block_number <= :cursor_block AND tx_hash <= :cursor_txhash AND log_index < :cursor_log_index " + - "ORDER BY block_number DESC, tx_hash DESC, log_index DESC LIMIT 20" + "(SELECT finalized_block_number FROM evm.log_poller_blocks WHERE evm_chain_id = :evm_chain_id ORDER BY block_number DESC LIMIT 1)) " + + "AND (block_number < :cursor_block_number OR (block_number = :cursor_block_number AND log_index < :cursor_log_index)) " + + "ORDER BY block_number DESC, log_index DESC, tx_hash DESC LIMIT 20" require.NoError(t, err) assert.Equal(t, expected, result) - assertArgs(t, args, 8) + assertArgs(t, args, 6) }) t.Run("query for finality", func(t *testing.T) { @@ -175,7 +178,7 @@ func TestDSLParser(t *testing.T) { expected := "SELECT evm.logs.* " + "FROM evm.logs " + "WHERE evm_chain_id = :evm_chain_id " + - "AND block_number <= (SELECT finalized_block_number FROM evm.log_poller_blocks WHERE evm_chain_id = :evm_chain_id ORDER BY block_number DESC LIMIT 1)" + "AND block_number <= (SELECT finalized_block_number FROM evm.log_poller_blocks WHERE evm_chain_id = :evm_chain_id ORDER BY block_number DESC LIMIT 1) ORDER BY " + defaultSort require.NoError(t, err) assert.Equal(t, expected, result) @@ -194,7 +197,7 @@ func TestDSLParser(t *testing.T) { expected := "SELECT evm.logs.* " + "FROM evm.logs " + "WHERE evm_chain_id = :evm_chain_id " + - "AND block_number <= (SELECT greatest(block_number - :confs_0, 0) FROM evm.log_poller_blocks WHERE evm_chain_id = :evm_chain_id ORDER BY block_number DESC LIMIT 1)" + "AND block_number <= (SELECT greatest(block_number - :confs_0, 0) FROM evm.log_poller_blocks WHERE evm_chain_id = :evm_chain_id ORDER BY block_number DESC LIMIT 1) ORDER BY " + defaultSort require.NoError(t, err) assert.Equal(t, expected, result) @@ -213,7 +216,7 @@ func TestDSLParser(t *testing.T) { expected := "SELECT evm.logs.* " + "FROM evm.logs " + "WHERE evm_chain_id = :evm_chain_id " + - "AND block_number <= (SELECT greatest(block_number - :confs_0, 0) FROM evm.log_poller_blocks WHERE evm_chain_id = :evm_chain_id ORDER BY block_number DESC LIMIT 1)" + "AND block_number <= (SELECT greatest(block_number - :confs_0, 0) FROM evm.log_poller_blocks WHERE evm_chain_id = :evm_chain_id ORDER BY block_number DESC LIMIT 1) ORDER BY " + defaultSort require.NoError(t, err) assert.Equal(t, expected, result) @@ -243,7 +246,7 @@ func TestDSLParser(t *testing.T) { expected := "SELECT evm.logs.* " + "FROM evm.logs " + "WHERE evm_chain_id = :evm_chain_id " + - "AND substring(data from 32*:word_index_0+1 for 32) > :word_value_0" + "AND substring(data from 32*:word_index_0+1 for 32) > :word_value_0 ORDER BY " + defaultSort require.NoError(t, err) assert.Equal(t, expected, result) @@ -268,7 +271,7 @@ func TestDSLParser(t *testing.T) { expected := "SELECT evm.logs.* " + "FROM evm.logs " + "WHERE evm_chain_id = :evm_chain_id " + - "AND topics[:topic_index_0] > :topic_value_0 AND topics[:topic_index_0] < :topic_value_1" + "AND topics[:topic_index_0] > :topic_value_0 AND topics[:topic_index_0] < :topic_value_1 ORDER BY " + defaultSort require.NoError(t, err) assert.Equal(t, expected, result) @@ -306,7 +309,7 @@ func TestDSLParser(t *testing.T) { "WHERE evm_chain_id = :evm_chain_id " + "AND (block_timestamp >= :block_timestamp_0 " + "AND (tx_hash = :tx_hash_0 " + - "OR block_number <= (SELECT greatest(block_number - :confs_0, 0) FROM evm.log_poller_blocks WHERE evm_chain_id = :evm_chain_id ORDER BY block_number DESC LIMIT 1)))" + "OR block_number <= (SELECT greatest(block_number - :confs_0, 0) FROM evm.log_poller_blocks WHERE evm_chain_id = :evm_chain_id ORDER BY block_number DESC LIMIT 1))) ORDER BY " + defaultSort require.NoError(t, err) assert.Equal(t, expected, result) @@ -357,7 +360,7 @@ func TestDSLParser(t *testing.T) { "AND (tx_hash = :tx_hash_0 " + "OR (block_number <= (SELECT greatest(block_number - :confs_0, 0) FROM evm.log_poller_blocks WHERE evm_chain_id = :evm_chain_id ORDER BY block_number DESC LIMIT 1) " + "AND substring(data from 32*:word_index_0+1 for 32) > :word_value_0 " + - "AND substring(data from 32*:word_index_0+1 for 32) <= :word_value_1)))" + "AND substring(data from 32*:word_index_0+1 for 32) <= :word_value_1))) ORDER BY " + defaultSort require.NoError(t, err) assert.Equal(t, expected, result) diff --git a/core/gethwrappers/keystone/generated/capabilities_registry/capabilities_registry.go b/core/gethwrappers/keystone/generated/capabilities_registry/capabilities_registry.go new file mode 100644 index 00000000000..b701f312c70 --- /dev/null +++ b/core/gethwrappers/keystone/generated/capabilities_registry/capabilities_registry.go @@ -0,0 +1,2292 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package capabilities_registry + +import ( + "errors" + "fmt" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" +) + +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +type CapabilitiesRegistryCapability struct { + LabelledName string + Version string + CapabilityType uint8 + ResponseType uint8 + ConfigurationContract common.Address +} + +type CapabilitiesRegistryCapabilityConfiguration struct { + CapabilityId [32]byte + Config []byte +} + +type CapabilitiesRegistryCapabilityInfo struct { + HashedId [32]byte + LabelledName string + Version string + CapabilityType uint8 + ResponseType uint8 + ConfigurationContract common.Address + IsDeprecated bool +} + +type CapabilitiesRegistryDONInfo struct { + Id uint32 + ConfigCount uint32 + F uint8 + IsPublic bool + AcceptsWorkflows bool + NodeP2PIds [][32]byte + CapabilityConfigurations []CapabilitiesRegistryCapabilityConfiguration +} + +type CapabilitiesRegistryNodeInfo struct { + NodeOperatorId uint32 + ConfigCount uint32 + WorkflowDONId uint32 + Signer [32]byte + P2pId [32]byte + HashedCapabilityIds [][32]byte + CapabilitiesDONIds []*big.Int +} + +type CapabilitiesRegistryNodeOperator struct { + Admin common.Address + Name string +} + +type CapabilitiesRegistryNodeParams struct { + NodeOperatorId uint32 + Signer [32]byte + P2pId [32]byte + HashedCapabilityIds [][32]byte +} + +var CapabilitiesRegistryMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"AccessForbidden\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityDoesNotExist\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityIsDeprecated\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"}],\"name\":\"CapabilityRequiredByDON\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"}],\"name\":\"DONDoesNotExist\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"}],\"name\":\"DuplicateDONCapability\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"nodeP2PId\",\"type\":\"bytes32\"}],\"name\":\"DuplicateDONNode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"proposedConfigurationContract\",\"type\":\"address\"}],\"name\":\"InvalidCapabilityConfigurationContractInterface\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"nodeCount\",\"type\":\"uint256\"}],\"name\":\"InvalidFaultTolerance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"hashedCapabilityIds\",\"type\":\"bytes32[]\"}],\"name\":\"InvalidNodeCapabilities\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidNodeOperatorAdmin\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"}],\"name\":\"InvalidNodeP2PId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidNodeSigner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"lengthOne\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lengthTwo\",\"type\":\"uint256\"}],\"name\":\"LengthMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nodeP2PId\",\"type\":\"bytes32\"}],\"name\":\"NodeAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nodeP2PId\",\"type\":\"bytes32\"}],\"name\":\"NodeDoesNotExist\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nodeP2PId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"}],\"name\":\"NodeDoesNotSupportCapability\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"}],\"name\":\"NodeOperatorDoesNotExist\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"nodeP2PId\",\"type\":\"bytes32\"}],\"name\":\"NodePartOfCapabilitiesDON\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"nodeP2PId\",\"type\":\"bytes32\"}],\"name\":\"NodePartOfWorkflowDON\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityConfigured\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"configCount\",\"type\":\"uint32\"}],\"name\":\"ConfigSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signer\",\"type\":\"bytes32\"}],\"name\":\"NodeAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NodeOperatorAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"}],\"name\":\"NodeOperatorRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NodeOperatorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"}],\"name\":\"NodeRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signer\",\"type\":\"bytes32\"}],\"name\":\"NodeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"OwnershipTransferRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"labelledName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"enumCapabilitiesRegistry.CapabilityType\",\"name\":\"capabilityType\",\"type\":\"uint8\"},{\"internalType\":\"enumCapabilitiesRegistry.CapabilityResponseType\",\"name\":\"responseType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"configurationContract\",\"type\":\"address\"}],\"internalType\":\"structCapabilitiesRegistry.Capability[]\",\"name\":\"capabilities\",\"type\":\"tuple[]\"}],\"name\":\"addCapabilities\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"nodes\",\"type\":\"bytes32[]\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"config\",\"type\":\"bytes\"}],\"internalType\":\"structCapabilitiesRegistry.CapabilityConfiguration[]\",\"name\":\"capabilityConfigurations\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"isPublic\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"acceptsWorkflows\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"}],\"name\":\"addDON\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structCapabilitiesRegistry.NodeOperator[]\",\"name\":\"nodeOperators\",\"type\":\"tuple[]\"}],\"name\":\"addNodeOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"signer\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"hashedCapabilityIds\",\"type\":\"bytes32[]\"}],\"internalType\":\"structCapabilitiesRegistry.NodeParams[]\",\"name\":\"nodes\",\"type\":\"tuple[]\"}],\"name\":\"addNodes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"hashedCapabilityIds\",\"type\":\"bytes32[]\"}],\"name\":\"deprecateCapabilities\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCapabilities\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"hashedId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"labelledName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"enumCapabilitiesRegistry.CapabilityType\",\"name\":\"capabilityType\",\"type\":\"uint8\"},{\"internalType\":\"enumCapabilitiesRegistry.CapabilityResponseType\",\"name\":\"responseType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"configurationContract\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isDeprecated\",\"type\":\"bool\"}],\"internalType\":\"structCapabilitiesRegistry.CapabilityInfo[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedId\",\"type\":\"bytes32\"}],\"name\":\"getCapability\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"hashedId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"labelledName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"enumCapabilitiesRegistry.CapabilityType\",\"name\":\"capabilityType\",\"type\":\"uint8\"},{\"internalType\":\"enumCapabilitiesRegistry.CapabilityResponseType\",\"name\":\"responseType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"configurationContract\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isDeprecated\",\"type\":\"bool\"}],\"internalType\":\"structCapabilitiesRegistry.CapabilityInfo\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"}],\"name\":\"getCapabilityConfigs\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"}],\"name\":\"getDON\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"id\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"configCount\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"},{\"internalType\":\"bool\",\"name\":\"isPublic\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"acceptsWorkflows\",\"type\":\"bool\"},{\"internalType\":\"bytes32[]\",\"name\":\"nodeP2PIds\",\"type\":\"bytes32[]\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"config\",\"type\":\"bytes\"}],\"internalType\":\"structCapabilitiesRegistry.CapabilityConfiguration[]\",\"name\":\"capabilityConfigurations\",\"type\":\"tuple[]\"}],\"internalType\":\"structCapabilitiesRegistry.DONInfo\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDONs\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"id\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"configCount\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"},{\"internalType\":\"bool\",\"name\":\"isPublic\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"acceptsWorkflows\",\"type\":\"bool\"},{\"internalType\":\"bytes32[]\",\"name\":\"nodeP2PIds\",\"type\":\"bytes32[]\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"config\",\"type\":\"bytes\"}],\"internalType\":\"structCapabilitiesRegistry.CapabilityConfiguration[]\",\"name\":\"capabilityConfigurations\",\"type\":\"tuple[]\"}],\"internalType\":\"structCapabilitiesRegistry.DONInfo[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"labelledName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"}],\"name\":\"getHashedCapabilityId\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"}],\"name\":\"getNode\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"configCount\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"workflowDONId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"signer\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"hashedCapabilityIds\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint256[]\",\"name\":\"capabilitiesDONIds\",\"type\":\"uint256[]\"}],\"internalType\":\"structCapabilitiesRegistry.NodeInfo\",\"name\":\"nodeInfo\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"}],\"name\":\"getNodeOperator\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structCapabilitiesRegistry.NodeOperator\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNodeOperators\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structCapabilitiesRegistry.NodeOperator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNodes\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"configCount\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"workflowDONId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"signer\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"hashedCapabilityIds\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint256[]\",\"name\":\"capabilitiesDONIds\",\"type\":\"uint256[]\"}],\"internalType\":\"structCapabilitiesRegistry.NodeInfo[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"isCapabilityDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32[]\",\"name\":\"donIds\",\"type\":\"uint32[]\"}],\"name\":\"removeDONs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32[]\",\"name\":\"nodeOperatorIds\",\"type\":\"uint32[]\"}],\"name\":\"removeNodeOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"removedNodeP2PIds\",\"type\":\"bytes32[]\"}],\"name\":\"removeNodes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"typeAndVersion\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32[]\",\"name\":\"nodes\",\"type\":\"bytes32[]\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"config\",\"type\":\"bytes\"}],\"internalType\":\"structCapabilitiesRegistry.CapabilityConfiguration[]\",\"name\":\"capabilityConfigurations\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"isPublic\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"acceptsWorkflows\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"}],\"name\":\"updateDON\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32[]\",\"name\":\"nodeOperatorIds\",\"type\":\"uint32[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structCapabilitiesRegistry.NodeOperator[]\",\"name\":\"nodeOperators\",\"type\":\"tuple[]\"}],\"name\":\"updateNodeOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"signer\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"hashedCapabilityIds\",\"type\":\"bytes32[]\"}],\"internalType\":\"structCapabilitiesRegistry.NodeParams[]\",\"name\":\"nodes\",\"type\":\"tuple[]\"}],\"name\":\"updateNodes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x6080604052600e80546001600160401b0319166401000000011790553480156200002857600080fd5b503380600081620000805760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0384811691909117909155811615620000b357620000b381620000bc565b50505062000167565b336001600160a01b03821603620001165760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640162000077565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b61517380620001776000396000f3fe608060405234801561001057600080fd5b50600436106101ae5760003560e01c80635e65e309116100ee5780638da5cb5b11610097578063d8bc7b6811610071578063d8bc7b68146103f6578063ddbe4f8214610409578063e29581aa1461041e578063f2fde38b1461043357600080fd5b80638da5cb5b1461039b5780639cb7c5f4146103c3578063d59a79f6146103e357600080fd5b806373ac22b4116100c857806373ac22b41461036d57806379ba50971461038057806386fa42461461038857600080fd5b80635e65e3091461033257806366acaa3314610345578063715f52951461035a57600080fd5b8063235374051161015b578063398f377311610135578063398f3773146102cb5780633f2a13c9146102de57806350c946fe146102ff5780635d83d9671461031f57600080fd5b80632353740514610285578063275459f2146102a55780632c01a1e8146102b857600080fd5b80631d05394c1161018c5780631d05394c1461023b578063214502431461025057806322bdbcbc1461026557600080fd5b80630fe5800a146101b357806312570011146101d9578063181f5a77146101fc575b600080fd5b6101c66101c1366004613f39565b610446565b6040519081526020015b60405180910390f35b6101ec6101e7366004613f9d565b61047a565b60405190151581526020016101d0565b604080518082018252601a81527f4361706162696c6974696573526567697374727920312e302e30000000000000602082015290516101d09190614024565b61024e61024936600461407c565b610487565b005b6102586106aa565b6040516101d091906141dc565b610278610273366004614275565b61080f565b6040516101d091906142cd565b610298610293366004614275565b6108fc565b6040516101d091906142e0565b61024e6102b336600461407c565b610940565b61024e6102c636600461407c565b610a17565b61024e6102d936600461407c565b610cbc565b6102f16102ec3660046142f3565b610e84565b6040516101d092919061431d565b61031261030d366004613f9d565b611070565b6040516101d091906143e2565b61024e61032d36600461407c565b61114a565b61024e61034036600461407c565b611247565b61034d61198d565b6040516101d091906143f5565b61024e61036836600461407c565b611b78565b61024e61037b36600461407c565b611c33565b61024e61210f565b61024e610396366004614468565b61220c565b60005460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101d0565b6103d66103d1366004613f9d565b612552565b6040516101d091906145b7565b61024e6103f13660046145e9565b61278d565b61024e61040436600461469e565b612856565b610411612920565b6040516101d09190614743565b610426612a1d565b6040516101d091906147b6565b61024e61044136600461484d565b612b2f565b6000828260405160200161045b92919061431d565b6040516020818303038152906040528051906020012090505b92915050565b6000610474600583612b43565b61048f612b5e565b60005b818110156106a55760008383838181106104ae576104ae614868565b90506020020160208101906104c39190614275565b63ffffffff8181166000908152600d60209081526040808320805464010000000081049095168085526001820190935290832094955093909290916a010000000000000000000090910460ff16905b61051b83612be1565b8110156105c357811561057157600c60006105368584612beb565b8152602081019190915260400160002080547fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff1690556105b3565b6105b18663ffffffff16600c60006105928588612beb90919063ffffffff16565b8152602001908152602001600020600401612bf790919063ffffffff16565b505b6105bc816148c6565b9050610512565b508354640100000000900463ffffffff1660000361061a576040517f2b62be9b00000000000000000000000000000000000000000000000000000000815263ffffffff861660048201526024015b60405180910390fd5b63ffffffff85166000818152600d6020908152604080832080547fffffffffffffffffffffffffffffffffffffffffff00000000000000000000001690558051938452908301919091527ff264aae70bf6a9d90e68e0f9b393f4e7fbea67b063b0f336e0b36c1581703651910160405180910390a150505050508061069e906148c6565b9050610492565b505050565b600e54606090640100000000900463ffffffff1660006106cb6001836148fe565b63ffffffff1667ffffffffffffffff8111156106e9576106e9613dd3565b60405190808252806020026020018201604052801561077057816020015b6040805160e081018252600080825260208083018290529282018190526060808301829052608083019190915260a0820181905260c082015282527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9092019101816107075790505b509050600060015b8363ffffffff168163ffffffff1610156107ec5763ffffffff8082166000908152600d602052604090205416156107dc576107b281612c03565b8383815181106107c4576107c4614868565b6020026020010181905250816107d9906148c6565b91505b6107e58161491b565b9050610778565b506107f86001846148fe565b63ffffffff168114610808578082525b5092915050565b60408051808201909152600081526060602082015263ffffffff82166000908152600b60209081526040918290208251808401909352805473ffffffffffffffffffffffffffffffffffffffff16835260018101805491928401916108739061493e565b80601f016020809104026020016040519081016040528092919081815260200182805461089f9061493e565b80156108ec5780601f106108c1576101008083540402835291602001916108ec565b820191906000526020600020905b8154815290600101906020018083116108cf57829003601f168201915b5050505050815250509050919050565b6040805160e0810182526000808252602082018190529181018290526060808201839052608082019290925260a0810182905260c081019190915261047482612c03565b610948612b5e565b60005b63ffffffff81168211156106a557600083838363ffffffff1681811061097357610973614868565b90506020020160208101906109889190614275565b63ffffffff81166000908152600b6020526040812080547fffffffffffffffffffffffff00000000000000000000000000000000000000001681559192506109d36001830182613d66565b505060405163ffffffff8216907fa59268ca81d40429e65ccea5385b59cf2d3fc6519371dee92f8eb1dae5107a7a90600090a250610a108161491b565b905061094b565b6000805473ffffffffffffffffffffffffffffffffffffffff163314905b82811015610cb6576000848483818110610a5157610a51614868565b602090810292909201356000818152600c90935260409092206001810154929350919050610aae576040517fd82f6adb00000000000000000000000000000000000000000000000000000000815260048101839052602401610611565b6000610abc82600401612be1565b1115610b1157610acf6004820184612beb565b6040517f60a6d89800000000000000000000000000000000000000000000000000000000815263ffffffff909116600482015260248101839052604401610611565b805468010000000000000000900463ffffffff1615610b795780546040517f60b9df730000000000000000000000000000000000000000000000000000000081526801000000000000000090910463ffffffff16600482015260248101839052604401610611565b83158015610bb35750805463ffffffff166000908152600b602052604090205473ffffffffffffffffffffffffffffffffffffffff163314155b15610bec576040517f9473075d000000000000000000000000000000000000000000000000000000008152336004820152602401610611565b6001810154610bfd90600790612bf7565b506002810154610c0f90600990612bf7565b506000828152600c6020526040812080547fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016815560018101829055600281018290559060048201818181610c648282613da0565b5050505050507f5254e609a97bab37b7cc79fe128f85c097bd6015c6e1624ae0ba392eb975320582604051610c9b91815260200190565b60405180910390a1505080610caf906148c6565b9050610a35565b50505050565b610cc4612b5e565b60005b818110156106a5576000838383818110610ce357610ce3614868565b9050602002810190610cf59190614991565b610cfe906149cf565b805190915073ffffffffffffffffffffffffffffffffffffffff16610d4f576040517feeacd93900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600e54604080518082018252835173ffffffffffffffffffffffffffffffffffffffff908116825260208086015181840190815263ffffffff9095166000818152600b909252939020825181547fffffffffffffffffffffffff00000000000000000000000000000000000000001692169190911781559251919290916001820190610ddb9082614a87565b5050600e8054909150600090610df69063ffffffff1661491b565b91906101000a81548163ffffffff021916908363ffffffff160217905550816000015173ffffffffffffffffffffffffffffffffffffffff168163ffffffff167f78e94ca80be2c30abc061b99e7eb8583b1254781734b1e3ce339abb57da2fe8e8460200151604051610e699190614024565b60405180910390a3505080610e7d906148c6565b9050610cc7565b63ffffffff8083166000908152600d60209081526040808320805464010000000090049094168084526001909401825280832085845260030190915281208054606093849390929091610ed69061493e565b80601f0160208091040260200160405190810160405280929190818152602001828054610f029061493e565b8015610f4f5780601f10610f2457610100808354040283529160200191610f4f565b820191906000526020600020905b815481529060010190602001808311610f3257829003601f168201915b5050506000888152600260208190526040909120015492935060609262010000900473ffffffffffffffffffffffffffffffffffffffff16159150611062905057600086815260026020819052604091829020015490517f8318ed5d00000000000000000000000000000000000000000000000000000000815263ffffffff891660048201526201000090910473ffffffffffffffffffffffffffffffffffffffff1690638318ed5d90602401600060405180830381865afa158015611019573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261105f9190810190614ba1565b90505b9093509150505b9250929050565b6040805160e0810182526000808252602082018190529181018290526060808201839052608082019290925260a0810182905260c08101919091526040805160e0810182526000848152600c6020908152838220805463ffffffff8082168652640100000000820481168487018190526801000000000000000090920416858701526001820154606086015260028201546080860152835260030190529190912060a082019061111f90612ed7565b8152602001611142600c6000868152602001908152602001600020600401612ed7565b905292915050565b611152612b5e565b60005b818110156106a557600083838381811061117157611171614868565b90506020020135905061118e816003612b4390919063ffffffff16565b6111c7576040517fe181733f00000000000000000000000000000000000000000000000000000000815260048101829052602401610611565b6111d2600582612ee4565b61120b576040517ff7d7a29400000000000000000000000000000000000000000000000000000000815260048101829052602401610611565b60405181907fdcea1b78b6ddc31592a94607d537543fcaafda6cc52d6d5cc7bbfca1422baf2190600090a250611240816148c6565b9050611155565b6000805473ffffffffffffffffffffffffffffffffffffffff163314905b82811015610cb657600084848381811061128157611281614868565b90506020028101906112939190614c0f565b61129c90614c43565b805163ffffffff166000908152600b602090815260408083208151808301909252805473ffffffffffffffffffffffffffffffffffffffff1682526001810180549596509394919390928401916112f29061493e565b80601f016020809104026020016040519081016040528092919081815260200182805461131e9061493e565b801561136b5780601f106113405761010080835404028352916020019161136b565b820191906000526020600020905b81548152906001019060200180831161134e57829003601f168201915b50505050508152505090508315801561139b5750805173ffffffffffffffffffffffffffffffffffffffff163314155b156113d4576040517f9473075d000000000000000000000000000000000000000000000000000000008152336004820152602401610611565b6040808301516000908152600c6020522060018101546114285782604001516040517fd82f6adb00000000000000000000000000000000000000000000000000000000815260040161061191815260200190565b6020830151611463576040517f8377314600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001810154602084015181146114e457602084015161148490600790612b43565b156114bb576040517f8377314600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602084015160018301556114d0600782612bf7565b5060208401516114e290600790612ee4565b505b6060840151805160000361152657806040517f3748d4c60000000000000000000000000000000000000000000000000000000081526004016106119190614d16565b8254600090849060049061154790640100000000900463ffffffff1661491b565b91906101000a81548163ffffffff021916908363ffffffff1602179055905060005b82518110156116345761159f83828151811061158757611587614868565b60200260200101516003612b4390919063ffffffff16565b6115d757826040517f3748d4c60000000000000000000000000000000000000000000000000000000081526004016106119190614d16565b6116238382815181106115ec576115ec614868565b60200260200101518660030160008563ffffffff1663ffffffff168152602001908152602001600020612ee490919063ffffffff16565b5061162d816148c6565b9050611569565b50835468010000000000000000900463ffffffff16801561179d5763ffffffff8082166000908152600d6020908152604080832080546401000000009004909416835260019093018152828220600201805484518184028101840190955280855292939290918301828280156116c957602002820191906000526020600020905b8154815260200190600101908083116116b5575b5050505050905060005b815181101561179a576117288282815181106116f1576116f1614868565b60200260200101518860030160008763ffffffff1663ffffffff168152602001908152602001600020612b4390919063ffffffff16565b61178a5781818151811061173e5761173e614868565b6020026020010151836040517f03dcd86200000000000000000000000000000000000000000000000000000000815260040161061192919091825263ffffffff16602082015260400190565b611793816148c6565b90506116d3565b50505b60006117ab86600401612ed7565b905060005b81518163ffffffff1610156118f9576000828263ffffffff16815181106117d9576117d9614868565b60209081029190910181015163ffffffff8082166000908152600d8452604080822080546401000000009004909316825260019092018452818120600201805483518187028101870190945280845293955090939192909183018282801561186057602002820191906000526020600020905b81548152602001906001019080831161184c575b5050505050905060005b81518110156118e5576118bf82828151811061188857611888614868565b60200260200101518b60030160008a63ffffffff1663ffffffff168152602001908152602001600020612b4390919063ffffffff16565b6118d55781818151811061173e5761173e614868565b6118de816148c6565b905061186a565b505050806118f29061491b565b90506117b0565b50875186547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff90911690811787556040808a0151600289018190556020808c01518351928352908201527f4b5b465e22eea0c3d40c30e936643245b80d19b2dcf75788c0699fe8d8db645b910160405180910390a2505050505050505080611986906148c6565b9050611265565b600e5460609063ffffffff1660006119a66001836148fe565b63ffffffff1667ffffffffffffffff8111156119c4576119c4613dd3565b604051908082528060200260200182016040528015611a0a57816020015b6040805180820190915260008152606060208201528152602001906001900390816119e25790505b509050600060015b8363ffffffff168163ffffffff161015611b625763ffffffff81166000908152600b602052604090205473ffffffffffffffffffffffffffffffffffffffff1615611b525763ffffffff81166000908152600b60209081526040918290208251808401909352805473ffffffffffffffffffffffffffffffffffffffff1683526001810180549192840191611aa69061493e565b80601f0160208091040260200160405190810160405280929190818152602001828054611ad29061493e565b8015611b1f5780601f10611af457610100808354040283529160200191611b1f565b820191906000526020600020905b815481529060010190602001808311611b0257829003601f168201915b505050505081525050838381518110611b3a57611b3a614868565b602002602001018190525081611b4f906148c6565b91505b611b5b8161491b565b9050611a12565b50600e546107f89060019063ffffffff166148fe565b611b80612b5e565b60005b818110156106a5576000838383818110611b9f57611b9f614868565b9050602002810190611bb19190614d5a565b611bba90614d9d565b90506000611bd082600001518360200151610446565b9050611bdd600382612ee4565b611c16576040517febf5255100000000000000000000000000000000000000000000000000000000815260048101829052602401610611565b611c208183612ef0565b505080611c2c906148c6565b9050611b83565b6000805473ffffffffffffffffffffffffffffffffffffffff163314905b82811015610cb6576000848483818110611c6d57611c6d614868565b9050602002810190611c7f9190614c0f565b611c8890614c43565b805163ffffffff166000908152600b602090815260408083208151808301909252805473ffffffffffffffffffffffffffffffffffffffff168252600181018054959650939491939092840191611cde9061493e565b80601f0160208091040260200160405190810160405280929190818152602001828054611d0a9061493e565b8015611d575780601f10611d2c57610100808354040283529160200191611d57565b820191906000526020600020905b815481529060010190602001808311611d3a57829003601f168201915b50505091909252505081519192505073ffffffffffffffffffffffffffffffffffffffff16611dbd5781516040517fadd9ae1e00000000000000000000000000000000000000000000000000000000815263ffffffff9091166004820152602401610611565b83158015611de25750805173ffffffffffffffffffffffffffffffffffffffff163314155b15611e1b576040517f9473075d000000000000000000000000000000000000000000000000000000008152336004820152602401610611565b6040808301516000908152600c60205220600181015415611e705782604001516040517f5461848300000000000000000000000000000000000000000000000000000000815260040161061191815260200190565b6040830151611eb35782604001516040517f64e2ee9200000000000000000000000000000000000000000000000000000000815260040161061191815260200190565b60208301511580611ed057506020830151611ed090600790612b43565b15611f07576040517f8377314600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608301518051600003611f4957806040517f3748d4c60000000000000000000000000000000000000000000000000000000081526004016106119190614d16565b81548290600490611f6790640100000000900463ffffffff1661491b565b82546101009290920a63ffffffff818102199093169183160217909155825464010000000090041660005b825181101561204557611fb083828151811061158757611587614868565b611fe857826040517f3748d4c60000000000000000000000000000000000000000000000000000000081526004016106119190614d16565b612034838281518110611ffd57611ffd614868565b60200260200101518560030160008563ffffffff1663ffffffff168152602001908152602001600020612ee490919063ffffffff16565b5061203e816148c6565b9050611f92565b50845183547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff9182161784556040860151600285015560208601516001850181905561209b9160079190612ee416565b5060408501516120ad90600990612ee4565b50845160408087015160208089015183519283529082015263ffffffff909216917f74becb12a5e8fd0e98077d02dfba8f647c9670c9df177e42c2418cf17a636f05910160405180910390a2505050505080612108906148c6565b9050611c51565b60015473ffffffffffffffffffffffffffffffffffffffff163314612190576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e6572000000000000000000006044820152606401610611565b60008054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217845560018054909116905560405173ffffffffffffffffffffffffffffffffffffffff90921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b82811461224f576040517fab8b67c60000000000000000000000000000000000000000000000000000000081526004810184905260248101829052604401610611565b6000805473ffffffffffffffffffffffffffffffffffffffff16905b8481101561254a57600086868381811061228757612287614868565b905060200201602081019061229c9190614275565b63ffffffff81166000908152600b6020526040902080549192509073ffffffffffffffffffffffffffffffffffffffff1661230b576040517fadd9ae1e00000000000000000000000000000000000000000000000000000000815263ffffffff83166004820152602401610611565b600086868581811061231f5761231f614868565b90506020028101906123319190614991565b61233a906149cf565b805190915073ffffffffffffffffffffffffffffffffffffffff1661238b576040517feeacd93900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805173ffffffffffffffffffffffffffffffffffffffff1633148015906123c857503373ffffffffffffffffffffffffffffffffffffffff861614155b15612401576040517f9473075d000000000000000000000000000000000000000000000000000000008152336004820152602401610611565b8051825473ffffffffffffffffffffffffffffffffffffffff908116911614158061247d575060208082015160405161243a9201614024565b60405160208183030381529060405280519060200120826001016040516020016124649190614e43565b6040516020818303038152906040528051906020012014155b1561253657805182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602081015160018301906124d79082614a87565b50806000015173ffffffffffffffffffffffffffffffffffffffff168363ffffffff167f86f41145bde5dd7f523305452e4aad3685508c181432ec733d5f345009358a28836020015160405161252d9190614024565b60405180910390a35b50505080612543906148c6565b905061226b565b505050505050565b6125936040805160e0810182526000808252606060208301819052928201839052909182019081526020016000815260006020820181905260409091015290565b6040805160e081018252838152600084815260026020908152929020805491928301916125bf9061493e565b80601f01602080910402602001604051908101604052809291908181526020018280546125eb9061493e565b80156126385780601f1061260d57610100808354040283529160200191612638565b820191906000526020600020905b81548152906001019060200180831161261b57829003601f168201915b505050505081526020016002600085815260200190815260200160002060010180546126639061493e565b80601f016020809104026020016040519081016040528092919081815260200182805461268f9061493e565b80156126dc5780601f106126b1576101008083540402835291602001916126dc565b820191906000526020600020905b8154815290600101906020018083116126bf57829003601f168201915b50505091835250506000848152600260208181526040909220015491019060ff16600381111561270e5761270e6144d4565b815260008481526002602081815260409092200154910190610100900460ff16600181111561273f5761273f6144d4565b81526000848152600260208181526040928390209091015462010000900473ffffffffffffffffffffffffffffffffffffffff169083015201612783600585612b43565b1515905292915050565b612795612b5e565b63ffffffff8089166000908152600d60205260408120546401000000009004909116908190036127f9576040517f2b62be9b00000000000000000000000000000000000000000000000000000000815263ffffffff8a166004820152602401610611565b61284b888888886040518060a001604052808f63ffffffff168152602001876128219061491b565b97508763ffffffff1681526020018a1515815260200189151581526020018860ff16815250613184565b505050505050505050565b61285e612b5e565b600e805460009164010000000090910463ffffffff169060046128808361491b565b82546101009290920a63ffffffff81810219909316918316021790915581166000818152600d602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001684179055815160a08101835292835260019083015286151590820152841515606082015260ff84166080820152909150612916908990899089908990613184565b5050505050505050565b6060600061292e6003612ed7565b90506000815167ffffffffffffffff81111561294c5761294c613dd3565b6040519080825280602002602001820160405280156129be57816020015b6129ab6040805160e0810182526000808252606060208301819052928201839052909182019081526020016000815260006020820181905260409091015290565b81526020019060019003908161296a5790505b50905060005b8251811015610808576129ef8382815181106129e2576129e2614868565b6020026020010151612552565b828281518110612a0157612a01614868565b602002602001018190525080612a16906148c6565b90506129c4565b60606000612a2b6009612ed7565b90506000815167ffffffffffffffff811115612a4957612a49613dd3565b604051908082528060200260200182016040528015612ad057816020015b6040805160e081018252600080825260208083018290529282018190526060808301829052608083019190915260a0820181905260c082015282527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909201910181612a675790505b50905060005b825181101561080857612b01838281518110612af457612af4614868565b6020026020010151611070565b828281518110612b1357612b13614868565b602002602001018190525080612b28906148c6565b9050612ad6565b612b37612b5e565b612b40816139c8565b50565b600081815260018301602052604081205415155b9392505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314612bdf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e6572000000000000000000006044820152606401610611565b565b6000610474825490565b6000612b578383613abd565b6000612b578383613ae7565b6040805160e0810182526000808252602080830182905282840182905260608084018390526080840183905260a0840181905260c084015263ffffffff8581168352600d8252848320805464010000000090049091168084526001909101825284832060028101805487518186028101860190985280885295969295919493909190830182828015612cb457602002820191906000526020600020905b815481526020019060010190808311612ca0575b505050505090506000815167ffffffffffffffff811115612cd757612cd7613dd3565b604051908082528060200260200182016040528015612d1d57816020015b604080518082019091526000815260606020820152815260200190600190039081612cf55790505b50905060005b8151811015612e3e576040518060400160405280848381518110612d4957612d49614868565b60200260200101518152602001856003016000868581518110612d6e57612d6e614868565b602002602001015181526020019081526020016000208054612d8f9061493e565b80601f0160208091040260200160405190810160405280929190818152602001828054612dbb9061493e565b8015612e085780601f10612ddd57610100808354040283529160200191612e08565b820191906000526020600020905b815481529060010190602001808311612deb57829003601f168201915b5050505050815250828281518110612e2257612e22614868565b602002602001018190525080612e37906148c6565b9050612d23565b506040805160e08101825263ffffffff8089166000818152600d6020818152868320548086168752948b168187015260ff680100000000000000008604811697870197909752690100000000000000000085048716151560608701529290915290526a010000000000000000000090049091161515608082015260a08101612ec585612ed7565b81526020019190915295945050505050565b60606000612b5783613bda565b6000612b578383613c36565b608081015173ffffffffffffffffffffffffffffffffffffffff161561303e57608081015173ffffffffffffffffffffffffffffffffffffffff163b1580612fe9575060808101516040517f01ffc9a70000000000000000000000000000000000000000000000000000000081527f78bea72100000000000000000000000000000000000000000000000000000000600482015273ffffffffffffffffffffffffffffffffffffffff909116906301ffc9a790602401602060405180830381865afa158015612fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe79190614eec565b155b1561303e5760808101516040517fabb5e3fd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602401610611565b60008281526002602052604090208151829190819061305d9082614a87565b50602082015160018201906130729082614a87565b5060408201516002820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660018360038111156130b4576130b46144d4565b021790555060608201516002820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101008360018111156130fb576130fb6144d4565b0217905550608091909101516002909101805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117905560405182907f04f0a9bcf3f3a3b42a4d7ca081119755f82ebe43e0d30c8f7292c4fe0dc4a2ae90600090a25050565b805163ffffffff9081166000908152600d602090815260408083208286015190941683526001909301905220608082015160ff1615806131d65750608082015185906131d1906001614f09565b60ff16115b1561321f5760808201516040517f25b4d61800000000000000000000000000000000000000000000000000000000815260ff909116600482015260248101869052604401610611565b6001826020015163ffffffff16111561330f57815163ffffffff166000908152600d60209081526040822090840151600191820191839161326091906148fe565b63ffffffff1663ffffffff168152602001908152602001600020905060005b61328882612be1565b81101561330c576132b7846000015163ffffffff16600c60006105928587600001612beb90919063ffffffff16565b50600c60006132c68484612beb565b8152602081019190915260400160002080547fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff169055613305816148c6565b905061327f565b50505b60005b858110156135515761333f87878381811061332f5761332f614868565b8592602090910201359050612ee4565b6133a057825187878381811061335757613357614868565b6040517f636e405700000000000000000000000000000000000000000000000000000000815263ffffffff90941660048501526020029190910135602483015250604401610611565b8260600151156134f757825163ffffffff16600c60008989858181106133c8576133c8614868565b602090810292909201358352508101919091526040016000205468010000000000000000900463ffffffff16148015906134425750600c600088888481811061341357613413614868565b602090810292909201358352508101919091526040016000205468010000000000000000900463ffffffff1615155b156134a457825187878381811061345b5761345b614868565b6040517f60b9df7300000000000000000000000000000000000000000000000000000000815263ffffffff90941660048501526020029190910135602483015250604401610611565b8251600c60008989858181106134bc576134bc614868565b90506020020135815260200190815260200160002060000160086101000a81548163ffffffff021916908363ffffffff160217905550613541565b825161353f9063ffffffff16600c60008a8a8681811061351957613519614868565b905060200201358152602001908152602001600020600401612ee490919063ffffffff16565b505b61354a816148c6565b9050613312565b5060005b8381101561383d573685858381811061357057613570614868565b90506020028101906135829190614991565b905061359060038235612b43565b6135c9576040517fe181733f00000000000000000000000000000000000000000000000000000000815281356004820152602401610611565b6135d560058235612b43565b1561360f576040517ff7d7a29400000000000000000000000000000000000000000000000000000000815281356004820152602401610611565b803560009081526003840160205260408120805461362c9061493e565b905011156136785783516040517f3927d08000000000000000000000000000000000000000000000000000000000815263ffffffff909116600482015281356024820152604401610611565b60005b8781101561378a5761371f8235600c60008c8c8681811061369e5761369e614868565b9050602002013581526020019081526020016000206003016000600c60008e8e888181106136ce576136ce614868565b90506020020135815260200190815260200160002060000160049054906101000a900463ffffffff1663ffffffff1663ffffffff168152602001908152602001600020612b4390919063ffffffff16565b61377a5788888281811061373557613735614868565b6040517fa7e792500000000000000000000000000000000000000000000000000000000081526020909102929092013560048301525082356024820152604401610611565b613783816148c6565b905061367b565b50600283018054600181018255600091825260209182902083359101556137b390820182614f22565b823560009081526003860160205260409020916137d1919083614f87565b50835160208086015161382c92918435908c908c906137f290880188614f22565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613c8592505050565b50613836816148c6565b9050613555565b50604080830151835163ffffffff9081166000908152600d602090815284822080549415156901000000000000000000027fffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffff90951694909417909355606086015186518316825284822080549115156a0100000000000000000000027fffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffff9092169190911790556080860151865183168252848220805460ff9290921668010000000000000000027fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff909216919091179055918501805186518316845292849020805493909216640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff9093169290921790558351905191517ff264aae70bf6a9d90e68e0f9b393f4e7fbea67b063b0f336e0b36c1581703651926139b8929163ffffffff92831681529116602082015260400190565b60405180910390a1505050505050565b3373ffffffffffffffffffffffffffffffffffffffff821603613a47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c660000000000000000006044820152606401610611565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b6000826000018281548110613ad457613ad4614868565b9060005260206000200154905092915050565b60008181526001830160205260408120548015613bd0576000613b0b6001836150a2565b8554909150600090613b1f906001906150a2565b9050818114613b84576000866000018281548110613b3f57613b3f614868565b9060005260206000200154905080876000018481548110613b6257613b62614868565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613b9557613b956150b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610474565b6000915050610474565b606081600001805480602002602001604051908101604052809291908181526020018280548015613c2a57602002820191906000526020600020905b815481526020019060010190808311613c16575b50505050509050919050565b6000818152600183016020526040812054613c7d57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610474565b506000610474565b6000848152600260208190526040909120015462010000900473ffffffffffffffffffffffffffffffffffffffff161561254a57600084815260026020819052604091829020015490517ffba64a7c0000000000000000000000000000000000000000000000000000000081526201000090910473ffffffffffffffffffffffffffffffffffffffff169063fba64a7c90613d2c908690869086908b908d906004016150e4565b600060405180830381600087803b158015613d4657600080fd5b505af1158015613d5a573d6000803e3d6000fd5b50505050505050505050565b508054613d729061493e565b6000825580601f10613d82575050565b601f016020900490600052602060002090810190612b409190613dba565b5080546000825590600052602060002090810190612b4091905b5b80821115613dcf5760008155600101613dbb565b5090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516080810167ffffffffffffffff81118282101715613e2557613e25613dd3565b60405290565b60405160a0810167ffffffffffffffff81118282101715613e2557613e25613dd3565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613e9557613e95613dd3565b604052919050565b600067ffffffffffffffff821115613eb757613eb7613dd3565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613ef457600080fd5b8135613f07613f0282613e9d565b613e4e565b818152846020838601011115613f1c57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215613f4c57600080fd5b823567ffffffffffffffff80821115613f6457600080fd5b613f7086838701613ee3565b93506020850135915080821115613f8657600080fd5b50613f9385828601613ee3565b9150509250929050565b600060208284031215613faf57600080fd5b5035919050565b60005b83811015613fd1578181015183820152602001613fb9565b50506000910152565b60008151808452613ff2816020860160208601613fb6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000612b576020830184613fda565b60008083601f84011261404957600080fd5b50813567ffffffffffffffff81111561406157600080fd5b6020830191508360208260051b850101111561106957600080fd5b6000806020838503121561408f57600080fd5b823567ffffffffffffffff8111156140a657600080fd5b6140b285828601614037565b90969095509350505050565b600081518084526020808501945080840160005b838110156140ee578151875295820195908201906001016140d2565b509495945050505050565b600081518084526020808501808196508360051b8101915082860160005b85811015614155578284038952815180518552850151604086860181905261414181870183613fda565b9a87019a9550505090840190600101614117565b5091979650505050505050565b600063ffffffff8083511684528060208401511660208501525060ff604083015116604084015260608201511515606084015260808201511515608084015260a082015160e060a08501526141ba60e08501826140be565b905060c083015184820360c08601526141d382826140f9565b95945050505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561424f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845261423d858351614162565b94509285019290850190600101614203565b5092979650505050505050565b803563ffffffff8116811461427057600080fd5b919050565b60006020828403121561428757600080fd5b612b578261425c565b73ffffffffffffffffffffffffffffffffffffffff815116825260006020820151604060208501526142c56040850182613fda565b949350505050565b602081526000612b576020830184614290565b602081526000612b576020830184614162565b6000806040838503121561430657600080fd5b61430f8361425c565b946020939093013593505050565b6040815260006143306040830185613fda565b82810360208401526141d38185613fda565b600063ffffffff808351168452602081818501511681860152816040850151166040860152606084015160608601526080840151608086015260a0840151915060e060a086015261439660e08601836140be565b60c08581015187830391880191909152805180835290830193506000918301905b808310156143d757845182529383019360019290920191908301906143b7565b509695505050505050565b602081526000612b576020830184614342565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561424f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452614456858351614290565b9450928501929085019060010161441c565b6000806000806040858703121561447e57600080fd5b843567ffffffffffffffff8082111561449657600080fd5b6144a288838901614037565b909650945060208701359150808211156144bb57600080fd5b506144c887828801614037565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b805182526000602082015160e0602085015261452260e0850182613fda565b90506040830151848203604086015261453b8282613fda565b915050606083015160048110614553576145536144d4565b606085015260808301516002811061456d5761456d6144d4565b8060808601525060a083015161459b60a086018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c08301516145af60c086018215159052565b509392505050565b602081526000612b576020830184614503565b8015158114612b4057600080fd5b803560ff8116811461427057600080fd5b60008060008060008060008060c0898b03121561460557600080fd5b61460e8961425c565b9750602089013567ffffffffffffffff8082111561462b57600080fd5b6146378c838d01614037565b909950975060408b013591508082111561465057600080fd5b5061465d8b828c01614037565b9096509450506060890135614671816145ca565b92506080890135614681816145ca565b915061468f60a08a016145d8565b90509295985092959890939650565b600080600080600080600060a0888a0312156146b957600080fd5b873567ffffffffffffffff808211156146d157600080fd5b6146dd8b838c01614037565b909950975060208a01359150808211156146f657600080fd5b506147038a828b01614037565b9096509450506040880135614717816145ca565b92506060880135614727816145ca565b9150614735608089016145d8565b905092959891949750929550565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561424f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526147a4858351614503565b9450928501929085019060010161476a565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561424f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452614817858351614342565b945092850192908501906001016147dd565b803573ffffffffffffffffffffffffffffffffffffffff8116811461427057600080fd5b60006020828403121561485f57600080fd5b612b5782614829565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036148f7576148f7614897565b5060010190565b63ffffffff82811682821603908082111561080857610808614897565b600063ffffffff80831681810361493457614934614897565b6001019392505050565b600181811c9082168061495257607f821691505b60208210810361498b577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18336030181126149c557600080fd5b9190910192915050565b6000604082360312156149e157600080fd5b6040516040810167ffffffffffffffff8282108183111715614a0557614a05613dd3565b81604052614a1285614829565b83526020850135915080821115614a2857600080fd5b50614a3536828601613ee3565b60208301525092915050565b601f8211156106a557600081815260208120601f850160051c81016020861015614a685750805b601f850160051c820191505b8181101561254a57828155600101614a74565b815167ffffffffffffffff811115614aa157614aa1613dd3565b614ab581614aaf845461493e565b84614a41565b602080601f831160018114614b085760008415614ad25750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b17855561254a565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b82811015614b5557888601518255948401946001909101908401614b36565b5085821015614b9157878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215614bb357600080fd5b815167ffffffffffffffff811115614bca57600080fd5b8201601f81018413614bdb57600080fd5b8051614be9613f0282613e9d565b818152856020838501011115614bfe57600080fd5b6141d3826020830160208601613fb6565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff818336030181126149c557600080fd5b600060808236031215614c5557600080fd5b614c5d613e02565b614c668361425c565b81526020808401358183015260408401356040830152606084013567ffffffffffffffff80821115614c9757600080fd5b9085019036601f830112614caa57600080fd5b813581811115614cbc57614cbc613dd3565b8060051b9150614ccd848301613e4e565b8181529183018401918481019036841115614ce757600080fd5b938501935b83851015614d0557843582529385019390850190614cec565b606087015250939695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015614d4e57835183529284019291840191600101614d32565b50909695505050505050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff618336030181126149c557600080fd5b80356002811061427057600080fd5b600060a08236031215614daf57600080fd5b614db7613e2b565b823567ffffffffffffffff80821115614dcf57600080fd5b614ddb36838701613ee3565b83526020850135915080821115614df157600080fd5b50614dfe36828601613ee3565b602083015250604083013560048110614e1657600080fd5b6040820152614e2760608401614d8e565b6060820152614e3860808401614829565b608082015292915050565b6000602080835260008454614e578161493e565b80848701526040600180841660008114614e785760018114614eb057614ede565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008516838a01528284151560051b8a01019550614ede565b896000528660002060005b85811015614ed65781548b8201860152908301908801614ebb565b8a0184019650505b509398975050505050505050565b600060208284031215614efe57600080fd5b8151612b57816145ca565b60ff818116838216019081111561047457610474614897565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614f5757600080fd5b83018035915067ffffffffffffffff821115614f7257600080fd5b60200191503681900382131561106957600080fd5b67ffffffffffffffff831115614f9f57614f9f613dd3565b614fb383614fad835461493e565b83614a41565b6000601f8411600181146150055760008515614fcf5750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b17835561509b565b6000838152602090207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0861690835b828110156150545786850135825560209485019460019092019101615034565b508682101561508f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b8181038181111561047457610474614897565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6080815284608082015260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff86111561511d57600080fd5b8560051b808860a0850137820182810360a0908101602085015261514390820187613fda565b91505063ffffffff8085166040840152808416606084015250969550505050505056fea164736f6c6343000813000a", +} + +var CapabilitiesRegistryABI = CapabilitiesRegistryMetaData.ABI + +var CapabilitiesRegistryBin = CapabilitiesRegistryMetaData.Bin + +func DeployCapabilitiesRegistry(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *CapabilitiesRegistry, error) { + parsed, err := CapabilitiesRegistryMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(CapabilitiesRegistryBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &CapabilitiesRegistry{address: address, abi: *parsed, CapabilitiesRegistryCaller: CapabilitiesRegistryCaller{contract: contract}, CapabilitiesRegistryTransactor: CapabilitiesRegistryTransactor{contract: contract}, CapabilitiesRegistryFilterer: CapabilitiesRegistryFilterer{contract: contract}}, nil +} + +type CapabilitiesRegistry struct { + address common.Address + abi abi.ABI + CapabilitiesRegistryCaller + CapabilitiesRegistryTransactor + CapabilitiesRegistryFilterer +} + +type CapabilitiesRegistryCaller struct { + contract *bind.BoundContract +} + +type CapabilitiesRegistryTransactor struct { + contract *bind.BoundContract +} + +type CapabilitiesRegistryFilterer struct { + contract *bind.BoundContract +} + +type CapabilitiesRegistrySession struct { + Contract *CapabilitiesRegistry + CallOpts bind.CallOpts + TransactOpts bind.TransactOpts +} + +type CapabilitiesRegistryCallerSession struct { + Contract *CapabilitiesRegistryCaller + CallOpts bind.CallOpts +} + +type CapabilitiesRegistryTransactorSession struct { + Contract *CapabilitiesRegistryTransactor + TransactOpts bind.TransactOpts +} + +type CapabilitiesRegistryRaw struct { + Contract *CapabilitiesRegistry +} + +type CapabilitiesRegistryCallerRaw struct { + Contract *CapabilitiesRegistryCaller +} + +type CapabilitiesRegistryTransactorRaw struct { + Contract *CapabilitiesRegistryTransactor +} + +func NewCapabilitiesRegistry(address common.Address, backend bind.ContractBackend) (*CapabilitiesRegistry, error) { + abi, err := abi.JSON(strings.NewReader(CapabilitiesRegistryABI)) + if err != nil { + return nil, err + } + contract, err := bindCapabilitiesRegistry(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &CapabilitiesRegistry{address: address, abi: abi, CapabilitiesRegistryCaller: CapabilitiesRegistryCaller{contract: contract}, CapabilitiesRegistryTransactor: CapabilitiesRegistryTransactor{contract: contract}, CapabilitiesRegistryFilterer: CapabilitiesRegistryFilterer{contract: contract}}, nil +} + +func NewCapabilitiesRegistryCaller(address common.Address, caller bind.ContractCaller) (*CapabilitiesRegistryCaller, error) { + contract, err := bindCapabilitiesRegistry(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &CapabilitiesRegistryCaller{contract: contract}, nil +} + +func NewCapabilitiesRegistryTransactor(address common.Address, transactor bind.ContractTransactor) (*CapabilitiesRegistryTransactor, error) { + contract, err := bindCapabilitiesRegistry(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &CapabilitiesRegistryTransactor{contract: contract}, nil +} + +func NewCapabilitiesRegistryFilterer(address common.Address, filterer bind.ContractFilterer) (*CapabilitiesRegistryFilterer, error) { + contract, err := bindCapabilitiesRegistry(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &CapabilitiesRegistryFilterer{contract: contract}, nil +} + +func bindCapabilitiesRegistry(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := CapabilitiesRegistryMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _CapabilitiesRegistry.Contract.CapabilitiesRegistryCaller.contract.Call(opts, result, method, params...) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.CapabilitiesRegistryTransactor.contract.Transfer(opts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.CapabilitiesRegistryTransactor.contract.Transact(opts, method, params...) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _CapabilitiesRegistry.Contract.contract.Call(opts, result, method, params...) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.contract.Transfer(opts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.contract.Transact(opts, method, params...) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCaller) GetCapabilities(opts *bind.CallOpts) ([]CapabilitiesRegistryCapabilityInfo, error) { + var out []interface{} + err := _CapabilitiesRegistry.contract.Call(opts, &out, "getCapabilities") + + if err != nil { + return *new([]CapabilitiesRegistryCapabilityInfo), err + } + + out0 := *abi.ConvertType(out[0], new([]CapabilitiesRegistryCapabilityInfo)).(*[]CapabilitiesRegistryCapabilityInfo) + + return out0, err + +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) GetCapabilities() ([]CapabilitiesRegistryCapabilityInfo, error) { + return _CapabilitiesRegistry.Contract.GetCapabilities(&_CapabilitiesRegistry.CallOpts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCallerSession) GetCapabilities() ([]CapabilitiesRegistryCapabilityInfo, error) { + return _CapabilitiesRegistry.Contract.GetCapabilities(&_CapabilitiesRegistry.CallOpts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCaller) GetCapability(opts *bind.CallOpts, hashedId [32]byte) (CapabilitiesRegistryCapabilityInfo, error) { + var out []interface{} + err := _CapabilitiesRegistry.contract.Call(opts, &out, "getCapability", hashedId) + + if err != nil { + return *new(CapabilitiesRegistryCapabilityInfo), err + } + + out0 := *abi.ConvertType(out[0], new(CapabilitiesRegistryCapabilityInfo)).(*CapabilitiesRegistryCapabilityInfo) + + return out0, err + +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) GetCapability(hashedId [32]byte) (CapabilitiesRegistryCapabilityInfo, error) { + return _CapabilitiesRegistry.Contract.GetCapability(&_CapabilitiesRegistry.CallOpts, hashedId) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCallerSession) GetCapability(hashedId [32]byte) (CapabilitiesRegistryCapabilityInfo, error) { + return _CapabilitiesRegistry.Contract.GetCapability(&_CapabilitiesRegistry.CallOpts, hashedId) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCaller) GetCapabilityConfigs(opts *bind.CallOpts, donId uint32, capabilityId [32]byte) ([]byte, []byte, error) { + var out []interface{} + err := _CapabilitiesRegistry.contract.Call(opts, &out, "getCapabilityConfigs", donId, capabilityId) + + if err != nil { + return *new([]byte), *new([]byte), err + } + + out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) + out1 := *abi.ConvertType(out[1], new([]byte)).(*[]byte) + + return out0, out1, err + +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) GetCapabilityConfigs(donId uint32, capabilityId [32]byte) ([]byte, []byte, error) { + return _CapabilitiesRegistry.Contract.GetCapabilityConfigs(&_CapabilitiesRegistry.CallOpts, donId, capabilityId) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCallerSession) GetCapabilityConfigs(donId uint32, capabilityId [32]byte) ([]byte, []byte, error) { + return _CapabilitiesRegistry.Contract.GetCapabilityConfigs(&_CapabilitiesRegistry.CallOpts, donId, capabilityId) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCaller) GetDON(opts *bind.CallOpts, donId uint32) (CapabilitiesRegistryDONInfo, error) { + var out []interface{} + err := _CapabilitiesRegistry.contract.Call(opts, &out, "getDON", donId) + + if err != nil { + return *new(CapabilitiesRegistryDONInfo), err + } + + out0 := *abi.ConvertType(out[0], new(CapabilitiesRegistryDONInfo)).(*CapabilitiesRegistryDONInfo) + + return out0, err + +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) GetDON(donId uint32) (CapabilitiesRegistryDONInfo, error) { + return _CapabilitiesRegistry.Contract.GetDON(&_CapabilitiesRegistry.CallOpts, donId) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCallerSession) GetDON(donId uint32) (CapabilitiesRegistryDONInfo, error) { + return _CapabilitiesRegistry.Contract.GetDON(&_CapabilitiesRegistry.CallOpts, donId) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCaller) GetDONs(opts *bind.CallOpts) ([]CapabilitiesRegistryDONInfo, error) { + var out []interface{} + err := _CapabilitiesRegistry.contract.Call(opts, &out, "getDONs") + + if err != nil { + return *new([]CapabilitiesRegistryDONInfo), err + } + + out0 := *abi.ConvertType(out[0], new([]CapabilitiesRegistryDONInfo)).(*[]CapabilitiesRegistryDONInfo) + + return out0, err + +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) GetDONs() ([]CapabilitiesRegistryDONInfo, error) { + return _CapabilitiesRegistry.Contract.GetDONs(&_CapabilitiesRegistry.CallOpts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCallerSession) GetDONs() ([]CapabilitiesRegistryDONInfo, error) { + return _CapabilitiesRegistry.Contract.GetDONs(&_CapabilitiesRegistry.CallOpts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCaller) GetHashedCapabilityId(opts *bind.CallOpts, labelledName string, version string) ([32]byte, error) { + var out []interface{} + err := _CapabilitiesRegistry.contract.Call(opts, &out, "getHashedCapabilityId", labelledName, version) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) GetHashedCapabilityId(labelledName string, version string) ([32]byte, error) { + return _CapabilitiesRegistry.Contract.GetHashedCapabilityId(&_CapabilitiesRegistry.CallOpts, labelledName, version) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCallerSession) GetHashedCapabilityId(labelledName string, version string) ([32]byte, error) { + return _CapabilitiesRegistry.Contract.GetHashedCapabilityId(&_CapabilitiesRegistry.CallOpts, labelledName, version) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCaller) GetNode(opts *bind.CallOpts, p2pId [32]byte) (CapabilitiesRegistryNodeInfo, error) { + var out []interface{} + err := _CapabilitiesRegistry.contract.Call(opts, &out, "getNode", p2pId) + + if err != nil { + return *new(CapabilitiesRegistryNodeInfo), err + } + + out0 := *abi.ConvertType(out[0], new(CapabilitiesRegistryNodeInfo)).(*CapabilitiesRegistryNodeInfo) + + return out0, err + +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) GetNode(p2pId [32]byte) (CapabilitiesRegistryNodeInfo, error) { + return _CapabilitiesRegistry.Contract.GetNode(&_CapabilitiesRegistry.CallOpts, p2pId) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCallerSession) GetNode(p2pId [32]byte) (CapabilitiesRegistryNodeInfo, error) { + return _CapabilitiesRegistry.Contract.GetNode(&_CapabilitiesRegistry.CallOpts, p2pId) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCaller) GetNodeOperator(opts *bind.CallOpts, nodeOperatorId uint32) (CapabilitiesRegistryNodeOperator, error) { + var out []interface{} + err := _CapabilitiesRegistry.contract.Call(opts, &out, "getNodeOperator", nodeOperatorId) + + if err != nil { + return *new(CapabilitiesRegistryNodeOperator), err + } + + out0 := *abi.ConvertType(out[0], new(CapabilitiesRegistryNodeOperator)).(*CapabilitiesRegistryNodeOperator) + + return out0, err + +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) GetNodeOperator(nodeOperatorId uint32) (CapabilitiesRegistryNodeOperator, error) { + return _CapabilitiesRegistry.Contract.GetNodeOperator(&_CapabilitiesRegistry.CallOpts, nodeOperatorId) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCallerSession) GetNodeOperator(nodeOperatorId uint32) (CapabilitiesRegistryNodeOperator, error) { + return _CapabilitiesRegistry.Contract.GetNodeOperator(&_CapabilitiesRegistry.CallOpts, nodeOperatorId) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCaller) GetNodeOperators(opts *bind.CallOpts) ([]CapabilitiesRegistryNodeOperator, error) { + var out []interface{} + err := _CapabilitiesRegistry.contract.Call(opts, &out, "getNodeOperators") + + if err != nil { + return *new([]CapabilitiesRegistryNodeOperator), err + } + + out0 := *abi.ConvertType(out[0], new([]CapabilitiesRegistryNodeOperator)).(*[]CapabilitiesRegistryNodeOperator) + + return out0, err + +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) GetNodeOperators() ([]CapabilitiesRegistryNodeOperator, error) { + return _CapabilitiesRegistry.Contract.GetNodeOperators(&_CapabilitiesRegistry.CallOpts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCallerSession) GetNodeOperators() ([]CapabilitiesRegistryNodeOperator, error) { + return _CapabilitiesRegistry.Contract.GetNodeOperators(&_CapabilitiesRegistry.CallOpts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCaller) GetNodes(opts *bind.CallOpts) ([]CapabilitiesRegistryNodeInfo, error) { + var out []interface{} + err := _CapabilitiesRegistry.contract.Call(opts, &out, "getNodes") + + if err != nil { + return *new([]CapabilitiesRegistryNodeInfo), err + } + + out0 := *abi.ConvertType(out[0], new([]CapabilitiesRegistryNodeInfo)).(*[]CapabilitiesRegistryNodeInfo) + + return out0, err + +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) GetNodes() ([]CapabilitiesRegistryNodeInfo, error) { + return _CapabilitiesRegistry.Contract.GetNodes(&_CapabilitiesRegistry.CallOpts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCallerSession) GetNodes() ([]CapabilitiesRegistryNodeInfo, error) { + return _CapabilitiesRegistry.Contract.GetNodes(&_CapabilitiesRegistry.CallOpts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCaller) IsCapabilityDeprecated(opts *bind.CallOpts, hashedCapabilityId [32]byte) (bool, error) { + var out []interface{} + err := _CapabilitiesRegistry.contract.Call(opts, &out, "isCapabilityDeprecated", hashedCapabilityId) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) IsCapabilityDeprecated(hashedCapabilityId [32]byte) (bool, error) { + return _CapabilitiesRegistry.Contract.IsCapabilityDeprecated(&_CapabilitiesRegistry.CallOpts, hashedCapabilityId) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCallerSession) IsCapabilityDeprecated(hashedCapabilityId [32]byte) (bool, error) { + return _CapabilitiesRegistry.Contract.IsCapabilityDeprecated(&_CapabilitiesRegistry.CallOpts, hashedCapabilityId) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _CapabilitiesRegistry.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) Owner() (common.Address, error) { + return _CapabilitiesRegistry.Contract.Owner(&_CapabilitiesRegistry.CallOpts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCallerSession) Owner() (common.Address, error) { + return _CapabilitiesRegistry.Contract.Owner(&_CapabilitiesRegistry.CallOpts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCaller) TypeAndVersion(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _CapabilitiesRegistry.contract.Call(opts, &out, "typeAndVersion") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) TypeAndVersion() (string, error) { + return _CapabilitiesRegistry.Contract.TypeAndVersion(&_CapabilitiesRegistry.CallOpts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryCallerSession) TypeAndVersion() (string, error) { + return _CapabilitiesRegistry.Contract.TypeAndVersion(&_CapabilitiesRegistry.CallOpts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactor) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _CapabilitiesRegistry.contract.Transact(opts, "acceptOwnership") +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) AcceptOwnership() (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.AcceptOwnership(&_CapabilitiesRegistry.TransactOpts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorSession) AcceptOwnership() (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.AcceptOwnership(&_CapabilitiesRegistry.TransactOpts) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactor) AddCapabilities(opts *bind.TransactOpts, capabilities []CapabilitiesRegistryCapability) (*types.Transaction, error) { + return _CapabilitiesRegistry.contract.Transact(opts, "addCapabilities", capabilities) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) AddCapabilities(capabilities []CapabilitiesRegistryCapability) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.AddCapabilities(&_CapabilitiesRegistry.TransactOpts, capabilities) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorSession) AddCapabilities(capabilities []CapabilitiesRegistryCapability) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.AddCapabilities(&_CapabilitiesRegistry.TransactOpts, capabilities) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactor) AddDON(opts *bind.TransactOpts, nodes [][32]byte, capabilityConfigurations []CapabilitiesRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) { + return _CapabilitiesRegistry.contract.Transact(opts, "addDON", nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) AddDON(nodes [][32]byte, capabilityConfigurations []CapabilitiesRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.AddDON(&_CapabilitiesRegistry.TransactOpts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorSession) AddDON(nodes [][32]byte, capabilityConfigurations []CapabilitiesRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.AddDON(&_CapabilitiesRegistry.TransactOpts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactor) AddNodeOperators(opts *bind.TransactOpts, nodeOperators []CapabilitiesRegistryNodeOperator) (*types.Transaction, error) { + return _CapabilitiesRegistry.contract.Transact(opts, "addNodeOperators", nodeOperators) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) AddNodeOperators(nodeOperators []CapabilitiesRegistryNodeOperator) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.AddNodeOperators(&_CapabilitiesRegistry.TransactOpts, nodeOperators) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorSession) AddNodeOperators(nodeOperators []CapabilitiesRegistryNodeOperator) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.AddNodeOperators(&_CapabilitiesRegistry.TransactOpts, nodeOperators) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactor) AddNodes(opts *bind.TransactOpts, nodes []CapabilitiesRegistryNodeParams) (*types.Transaction, error) { + return _CapabilitiesRegistry.contract.Transact(opts, "addNodes", nodes) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) AddNodes(nodes []CapabilitiesRegistryNodeParams) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.AddNodes(&_CapabilitiesRegistry.TransactOpts, nodes) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorSession) AddNodes(nodes []CapabilitiesRegistryNodeParams) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.AddNodes(&_CapabilitiesRegistry.TransactOpts, nodes) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactor) DeprecateCapabilities(opts *bind.TransactOpts, hashedCapabilityIds [][32]byte) (*types.Transaction, error) { + return _CapabilitiesRegistry.contract.Transact(opts, "deprecateCapabilities", hashedCapabilityIds) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) DeprecateCapabilities(hashedCapabilityIds [][32]byte) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.DeprecateCapabilities(&_CapabilitiesRegistry.TransactOpts, hashedCapabilityIds) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorSession) DeprecateCapabilities(hashedCapabilityIds [][32]byte) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.DeprecateCapabilities(&_CapabilitiesRegistry.TransactOpts, hashedCapabilityIds) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactor) RemoveDONs(opts *bind.TransactOpts, donIds []uint32) (*types.Transaction, error) { + return _CapabilitiesRegistry.contract.Transact(opts, "removeDONs", donIds) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) RemoveDONs(donIds []uint32) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.RemoveDONs(&_CapabilitiesRegistry.TransactOpts, donIds) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorSession) RemoveDONs(donIds []uint32) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.RemoveDONs(&_CapabilitiesRegistry.TransactOpts, donIds) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactor) RemoveNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []uint32) (*types.Transaction, error) { + return _CapabilitiesRegistry.contract.Transact(opts, "removeNodeOperators", nodeOperatorIds) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) RemoveNodeOperators(nodeOperatorIds []uint32) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.RemoveNodeOperators(&_CapabilitiesRegistry.TransactOpts, nodeOperatorIds) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorSession) RemoveNodeOperators(nodeOperatorIds []uint32) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.RemoveNodeOperators(&_CapabilitiesRegistry.TransactOpts, nodeOperatorIds) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactor) RemoveNodes(opts *bind.TransactOpts, removedNodeP2PIds [][32]byte) (*types.Transaction, error) { + return _CapabilitiesRegistry.contract.Transact(opts, "removeNodes", removedNodeP2PIds) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) RemoveNodes(removedNodeP2PIds [][32]byte) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.RemoveNodes(&_CapabilitiesRegistry.TransactOpts, removedNodeP2PIds) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorSession) RemoveNodes(removedNodeP2PIds [][32]byte) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.RemoveNodes(&_CapabilitiesRegistry.TransactOpts, removedNodeP2PIds) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactor) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { + return _CapabilitiesRegistry.contract.Transact(opts, "transferOwnership", to) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) TransferOwnership(to common.Address) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.TransferOwnership(&_CapabilitiesRegistry.TransactOpts, to) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorSession) TransferOwnership(to common.Address) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.TransferOwnership(&_CapabilitiesRegistry.TransactOpts, to) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactor) UpdateDON(opts *bind.TransactOpts, donId uint32, nodes [][32]byte, capabilityConfigurations []CapabilitiesRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) { + return _CapabilitiesRegistry.contract.Transact(opts, "updateDON", donId, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) UpdateDON(donId uint32, nodes [][32]byte, capabilityConfigurations []CapabilitiesRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.UpdateDON(&_CapabilitiesRegistry.TransactOpts, donId, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorSession) UpdateDON(donId uint32, nodes [][32]byte, capabilityConfigurations []CapabilitiesRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.UpdateDON(&_CapabilitiesRegistry.TransactOpts, donId, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactor) UpdateNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []uint32, nodeOperators []CapabilitiesRegistryNodeOperator) (*types.Transaction, error) { + return _CapabilitiesRegistry.contract.Transact(opts, "updateNodeOperators", nodeOperatorIds, nodeOperators) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) UpdateNodeOperators(nodeOperatorIds []uint32, nodeOperators []CapabilitiesRegistryNodeOperator) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.UpdateNodeOperators(&_CapabilitiesRegistry.TransactOpts, nodeOperatorIds, nodeOperators) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorSession) UpdateNodeOperators(nodeOperatorIds []uint32, nodeOperators []CapabilitiesRegistryNodeOperator) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.UpdateNodeOperators(&_CapabilitiesRegistry.TransactOpts, nodeOperatorIds, nodeOperators) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactor) UpdateNodes(opts *bind.TransactOpts, nodes []CapabilitiesRegistryNodeParams) (*types.Transaction, error) { + return _CapabilitiesRegistry.contract.Transact(opts, "updateNodes", nodes) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistrySession) UpdateNodes(nodes []CapabilitiesRegistryNodeParams) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.UpdateNodes(&_CapabilitiesRegistry.TransactOpts, nodes) +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryTransactorSession) UpdateNodes(nodes []CapabilitiesRegistryNodeParams) (*types.Transaction, error) { + return _CapabilitiesRegistry.Contract.UpdateNodes(&_CapabilitiesRegistry.TransactOpts, nodes) +} + +type CapabilitiesRegistryCapabilityConfiguredIterator struct { + Event *CapabilitiesRegistryCapabilityConfigured + + contract *bind.BoundContract + event string + + logs chan types.Log + sub ethereum.Subscription + done bool + fail error +} + +func (it *CapabilitiesRegistryCapabilityConfiguredIterator) Next() bool { + + if it.fail != nil { + return false + } + + if it.done { + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryCapabilityConfigured) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryCapabilityConfigured) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +func (it *CapabilitiesRegistryCapabilityConfiguredIterator) Error() error { + return it.fail +} + +func (it *CapabilitiesRegistryCapabilityConfiguredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +type CapabilitiesRegistryCapabilityConfigured struct { + HashedCapabilityId [32]byte + Raw types.Log +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) FilterCapabilityConfigured(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*CapabilitiesRegistryCapabilityConfiguredIterator, error) { + + var hashedCapabilityIdRule []interface{} + for _, hashedCapabilityIdItem := range hashedCapabilityId { + hashedCapabilityIdRule = append(hashedCapabilityIdRule, hashedCapabilityIdItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.FilterLogs(opts, "CapabilityConfigured", hashedCapabilityIdRule) + if err != nil { + return nil, err + } + return &CapabilitiesRegistryCapabilityConfiguredIterator{contract: _CapabilitiesRegistry.contract, event: "CapabilityConfigured", logs: logs, sub: sub}, nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) WatchCapabilityConfigured(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryCapabilityConfigured, hashedCapabilityId [][32]byte) (event.Subscription, error) { + + var hashedCapabilityIdRule []interface{} + for _, hashedCapabilityIdItem := range hashedCapabilityId { + hashedCapabilityIdRule = append(hashedCapabilityIdRule, hashedCapabilityIdItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.WatchLogs(opts, "CapabilityConfigured", hashedCapabilityIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + + event := new(CapabilitiesRegistryCapabilityConfigured) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "CapabilityConfigured", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) ParseCapabilityConfigured(log types.Log) (*CapabilitiesRegistryCapabilityConfigured, error) { + event := new(CapabilitiesRegistryCapabilityConfigured) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "CapabilityConfigured", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +type CapabilitiesRegistryCapabilityDeprecatedIterator struct { + Event *CapabilitiesRegistryCapabilityDeprecated + + contract *bind.BoundContract + event string + + logs chan types.Log + sub ethereum.Subscription + done bool + fail error +} + +func (it *CapabilitiesRegistryCapabilityDeprecatedIterator) Next() bool { + + if it.fail != nil { + return false + } + + if it.done { + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryCapabilityDeprecated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryCapabilityDeprecated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +func (it *CapabilitiesRegistryCapabilityDeprecatedIterator) Error() error { + return it.fail +} + +func (it *CapabilitiesRegistryCapabilityDeprecatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +type CapabilitiesRegistryCapabilityDeprecated struct { + HashedCapabilityId [32]byte + Raw types.Log +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) FilterCapabilityDeprecated(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*CapabilitiesRegistryCapabilityDeprecatedIterator, error) { + + var hashedCapabilityIdRule []interface{} + for _, hashedCapabilityIdItem := range hashedCapabilityId { + hashedCapabilityIdRule = append(hashedCapabilityIdRule, hashedCapabilityIdItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.FilterLogs(opts, "CapabilityDeprecated", hashedCapabilityIdRule) + if err != nil { + return nil, err + } + return &CapabilitiesRegistryCapabilityDeprecatedIterator{contract: _CapabilitiesRegistry.contract, event: "CapabilityDeprecated", logs: logs, sub: sub}, nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) WatchCapabilityDeprecated(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryCapabilityDeprecated, hashedCapabilityId [][32]byte) (event.Subscription, error) { + + var hashedCapabilityIdRule []interface{} + for _, hashedCapabilityIdItem := range hashedCapabilityId { + hashedCapabilityIdRule = append(hashedCapabilityIdRule, hashedCapabilityIdItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.WatchLogs(opts, "CapabilityDeprecated", hashedCapabilityIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + + event := new(CapabilitiesRegistryCapabilityDeprecated) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "CapabilityDeprecated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) ParseCapabilityDeprecated(log types.Log) (*CapabilitiesRegistryCapabilityDeprecated, error) { + event := new(CapabilitiesRegistryCapabilityDeprecated) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "CapabilityDeprecated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +type CapabilitiesRegistryConfigSetIterator struct { + Event *CapabilitiesRegistryConfigSet + + contract *bind.BoundContract + event string + + logs chan types.Log + sub ethereum.Subscription + done bool + fail error +} + +func (it *CapabilitiesRegistryConfigSetIterator) Next() bool { + + if it.fail != nil { + return false + } + + if it.done { + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryConfigSet) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryConfigSet) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +func (it *CapabilitiesRegistryConfigSetIterator) Error() error { + return it.fail +} + +func (it *CapabilitiesRegistryConfigSetIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +type CapabilitiesRegistryConfigSet struct { + DonId uint32 + ConfigCount uint32 + Raw types.Log +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) FilterConfigSet(opts *bind.FilterOpts) (*CapabilitiesRegistryConfigSetIterator, error) { + + logs, sub, err := _CapabilitiesRegistry.contract.FilterLogs(opts, "ConfigSet") + if err != nil { + return nil, err + } + return &CapabilitiesRegistryConfigSetIterator{contract: _CapabilitiesRegistry.contract, event: "ConfigSet", logs: logs, sub: sub}, nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) WatchConfigSet(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryConfigSet) (event.Subscription, error) { + + logs, sub, err := _CapabilitiesRegistry.contract.WatchLogs(opts, "ConfigSet") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + + event := new(CapabilitiesRegistryConfigSet) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "ConfigSet", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) ParseConfigSet(log types.Log) (*CapabilitiesRegistryConfigSet, error) { + event := new(CapabilitiesRegistryConfigSet) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "ConfigSet", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +type CapabilitiesRegistryNodeAddedIterator struct { + Event *CapabilitiesRegistryNodeAdded + + contract *bind.BoundContract + event string + + logs chan types.Log + sub ethereum.Subscription + done bool + fail error +} + +func (it *CapabilitiesRegistryNodeAddedIterator) Next() bool { + + if it.fail != nil { + return false + } + + if it.done { + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryNodeAdded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryNodeAdded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +func (it *CapabilitiesRegistryNodeAddedIterator) Error() error { + return it.fail +} + +func (it *CapabilitiesRegistryNodeAddedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +type CapabilitiesRegistryNodeAdded struct { + P2pId [32]byte + NodeOperatorId uint32 + Signer [32]byte + Raw types.Log +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) FilterNodeAdded(opts *bind.FilterOpts, nodeOperatorId []uint32) (*CapabilitiesRegistryNodeAddedIterator, error) { + + var nodeOperatorIdRule []interface{} + for _, nodeOperatorIdItem := range nodeOperatorId { + nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.FilterLogs(opts, "NodeAdded", nodeOperatorIdRule) + if err != nil { + return nil, err + } + return &CapabilitiesRegistryNodeAddedIterator{contract: _CapabilitiesRegistry.contract, event: "NodeAdded", logs: logs, sub: sub}, nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) WatchNodeAdded(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryNodeAdded, nodeOperatorId []uint32) (event.Subscription, error) { + + var nodeOperatorIdRule []interface{} + for _, nodeOperatorIdItem := range nodeOperatorId { + nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.WatchLogs(opts, "NodeAdded", nodeOperatorIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + + event := new(CapabilitiesRegistryNodeAdded) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "NodeAdded", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) ParseNodeAdded(log types.Log) (*CapabilitiesRegistryNodeAdded, error) { + event := new(CapabilitiesRegistryNodeAdded) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "NodeAdded", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +type CapabilitiesRegistryNodeOperatorAddedIterator struct { + Event *CapabilitiesRegistryNodeOperatorAdded + + contract *bind.BoundContract + event string + + logs chan types.Log + sub ethereum.Subscription + done bool + fail error +} + +func (it *CapabilitiesRegistryNodeOperatorAddedIterator) Next() bool { + + if it.fail != nil { + return false + } + + if it.done { + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryNodeOperatorAdded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryNodeOperatorAdded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +func (it *CapabilitiesRegistryNodeOperatorAddedIterator) Error() error { + return it.fail +} + +func (it *CapabilitiesRegistryNodeOperatorAddedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +type CapabilitiesRegistryNodeOperatorAdded struct { + NodeOperatorId uint32 + Admin common.Address + Name string + Raw types.Log +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) FilterNodeOperatorAdded(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address) (*CapabilitiesRegistryNodeOperatorAddedIterator, error) { + + var nodeOperatorIdRule []interface{} + for _, nodeOperatorIdItem := range nodeOperatorId { + nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) + } + var adminRule []interface{} + for _, adminItem := range admin { + adminRule = append(adminRule, adminItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.FilterLogs(opts, "NodeOperatorAdded", nodeOperatorIdRule, adminRule) + if err != nil { + return nil, err + } + return &CapabilitiesRegistryNodeOperatorAddedIterator{contract: _CapabilitiesRegistry.contract, event: "NodeOperatorAdded", logs: logs, sub: sub}, nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) WatchNodeOperatorAdded(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryNodeOperatorAdded, nodeOperatorId []uint32, admin []common.Address) (event.Subscription, error) { + + var nodeOperatorIdRule []interface{} + for _, nodeOperatorIdItem := range nodeOperatorId { + nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) + } + var adminRule []interface{} + for _, adminItem := range admin { + adminRule = append(adminRule, adminItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.WatchLogs(opts, "NodeOperatorAdded", nodeOperatorIdRule, adminRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + + event := new(CapabilitiesRegistryNodeOperatorAdded) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "NodeOperatorAdded", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) ParseNodeOperatorAdded(log types.Log) (*CapabilitiesRegistryNodeOperatorAdded, error) { + event := new(CapabilitiesRegistryNodeOperatorAdded) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "NodeOperatorAdded", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +type CapabilitiesRegistryNodeOperatorRemovedIterator struct { + Event *CapabilitiesRegistryNodeOperatorRemoved + + contract *bind.BoundContract + event string + + logs chan types.Log + sub ethereum.Subscription + done bool + fail error +} + +func (it *CapabilitiesRegistryNodeOperatorRemovedIterator) Next() bool { + + if it.fail != nil { + return false + } + + if it.done { + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryNodeOperatorRemoved) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryNodeOperatorRemoved) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +func (it *CapabilitiesRegistryNodeOperatorRemovedIterator) Error() error { + return it.fail +} + +func (it *CapabilitiesRegistryNodeOperatorRemovedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +type CapabilitiesRegistryNodeOperatorRemoved struct { + NodeOperatorId uint32 + Raw types.Log +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) FilterNodeOperatorRemoved(opts *bind.FilterOpts, nodeOperatorId []uint32) (*CapabilitiesRegistryNodeOperatorRemovedIterator, error) { + + var nodeOperatorIdRule []interface{} + for _, nodeOperatorIdItem := range nodeOperatorId { + nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.FilterLogs(opts, "NodeOperatorRemoved", nodeOperatorIdRule) + if err != nil { + return nil, err + } + return &CapabilitiesRegistryNodeOperatorRemovedIterator{contract: _CapabilitiesRegistry.contract, event: "NodeOperatorRemoved", logs: logs, sub: sub}, nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) WatchNodeOperatorRemoved(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryNodeOperatorRemoved, nodeOperatorId []uint32) (event.Subscription, error) { + + var nodeOperatorIdRule []interface{} + for _, nodeOperatorIdItem := range nodeOperatorId { + nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.WatchLogs(opts, "NodeOperatorRemoved", nodeOperatorIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + + event := new(CapabilitiesRegistryNodeOperatorRemoved) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "NodeOperatorRemoved", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) ParseNodeOperatorRemoved(log types.Log) (*CapabilitiesRegistryNodeOperatorRemoved, error) { + event := new(CapabilitiesRegistryNodeOperatorRemoved) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "NodeOperatorRemoved", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +type CapabilitiesRegistryNodeOperatorUpdatedIterator struct { + Event *CapabilitiesRegistryNodeOperatorUpdated + + contract *bind.BoundContract + event string + + logs chan types.Log + sub ethereum.Subscription + done bool + fail error +} + +func (it *CapabilitiesRegistryNodeOperatorUpdatedIterator) Next() bool { + + if it.fail != nil { + return false + } + + if it.done { + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryNodeOperatorUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryNodeOperatorUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +func (it *CapabilitiesRegistryNodeOperatorUpdatedIterator) Error() error { + return it.fail +} + +func (it *CapabilitiesRegistryNodeOperatorUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +type CapabilitiesRegistryNodeOperatorUpdated struct { + NodeOperatorId uint32 + Admin common.Address + Name string + Raw types.Log +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) FilterNodeOperatorUpdated(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address) (*CapabilitiesRegistryNodeOperatorUpdatedIterator, error) { + + var nodeOperatorIdRule []interface{} + for _, nodeOperatorIdItem := range nodeOperatorId { + nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) + } + var adminRule []interface{} + for _, adminItem := range admin { + adminRule = append(adminRule, adminItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.FilterLogs(opts, "NodeOperatorUpdated", nodeOperatorIdRule, adminRule) + if err != nil { + return nil, err + } + return &CapabilitiesRegistryNodeOperatorUpdatedIterator{contract: _CapabilitiesRegistry.contract, event: "NodeOperatorUpdated", logs: logs, sub: sub}, nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) WatchNodeOperatorUpdated(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryNodeOperatorUpdated, nodeOperatorId []uint32, admin []common.Address) (event.Subscription, error) { + + var nodeOperatorIdRule []interface{} + for _, nodeOperatorIdItem := range nodeOperatorId { + nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) + } + var adminRule []interface{} + for _, adminItem := range admin { + adminRule = append(adminRule, adminItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.WatchLogs(opts, "NodeOperatorUpdated", nodeOperatorIdRule, adminRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + + event := new(CapabilitiesRegistryNodeOperatorUpdated) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "NodeOperatorUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) ParseNodeOperatorUpdated(log types.Log) (*CapabilitiesRegistryNodeOperatorUpdated, error) { + event := new(CapabilitiesRegistryNodeOperatorUpdated) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "NodeOperatorUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +type CapabilitiesRegistryNodeRemovedIterator struct { + Event *CapabilitiesRegistryNodeRemoved + + contract *bind.BoundContract + event string + + logs chan types.Log + sub ethereum.Subscription + done bool + fail error +} + +func (it *CapabilitiesRegistryNodeRemovedIterator) Next() bool { + + if it.fail != nil { + return false + } + + if it.done { + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryNodeRemoved) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryNodeRemoved) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +func (it *CapabilitiesRegistryNodeRemovedIterator) Error() error { + return it.fail +} + +func (it *CapabilitiesRegistryNodeRemovedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +type CapabilitiesRegistryNodeRemoved struct { + P2pId [32]byte + Raw types.Log +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) FilterNodeRemoved(opts *bind.FilterOpts) (*CapabilitiesRegistryNodeRemovedIterator, error) { + + logs, sub, err := _CapabilitiesRegistry.contract.FilterLogs(opts, "NodeRemoved") + if err != nil { + return nil, err + } + return &CapabilitiesRegistryNodeRemovedIterator{contract: _CapabilitiesRegistry.contract, event: "NodeRemoved", logs: logs, sub: sub}, nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) WatchNodeRemoved(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryNodeRemoved) (event.Subscription, error) { + + logs, sub, err := _CapabilitiesRegistry.contract.WatchLogs(opts, "NodeRemoved") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + + event := new(CapabilitiesRegistryNodeRemoved) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "NodeRemoved", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) ParseNodeRemoved(log types.Log) (*CapabilitiesRegistryNodeRemoved, error) { + event := new(CapabilitiesRegistryNodeRemoved) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "NodeRemoved", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +type CapabilitiesRegistryNodeUpdatedIterator struct { + Event *CapabilitiesRegistryNodeUpdated + + contract *bind.BoundContract + event string + + logs chan types.Log + sub ethereum.Subscription + done bool + fail error +} + +func (it *CapabilitiesRegistryNodeUpdatedIterator) Next() bool { + + if it.fail != nil { + return false + } + + if it.done { + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryNodeUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryNodeUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +func (it *CapabilitiesRegistryNodeUpdatedIterator) Error() error { + return it.fail +} + +func (it *CapabilitiesRegistryNodeUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +type CapabilitiesRegistryNodeUpdated struct { + P2pId [32]byte + NodeOperatorId uint32 + Signer [32]byte + Raw types.Log +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) FilterNodeUpdated(opts *bind.FilterOpts, nodeOperatorId []uint32) (*CapabilitiesRegistryNodeUpdatedIterator, error) { + + var nodeOperatorIdRule []interface{} + for _, nodeOperatorIdItem := range nodeOperatorId { + nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.FilterLogs(opts, "NodeUpdated", nodeOperatorIdRule) + if err != nil { + return nil, err + } + return &CapabilitiesRegistryNodeUpdatedIterator{contract: _CapabilitiesRegistry.contract, event: "NodeUpdated", logs: logs, sub: sub}, nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) WatchNodeUpdated(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryNodeUpdated, nodeOperatorId []uint32) (event.Subscription, error) { + + var nodeOperatorIdRule []interface{} + for _, nodeOperatorIdItem := range nodeOperatorId { + nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.WatchLogs(opts, "NodeUpdated", nodeOperatorIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + + event := new(CapabilitiesRegistryNodeUpdated) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "NodeUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) ParseNodeUpdated(log types.Log) (*CapabilitiesRegistryNodeUpdated, error) { + event := new(CapabilitiesRegistryNodeUpdated) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "NodeUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +type CapabilitiesRegistryOwnershipTransferRequestedIterator struct { + Event *CapabilitiesRegistryOwnershipTransferRequested + + contract *bind.BoundContract + event string + + logs chan types.Log + sub ethereum.Subscription + done bool + fail error +} + +func (it *CapabilitiesRegistryOwnershipTransferRequestedIterator) Next() bool { + + if it.fail != nil { + return false + } + + if it.done { + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryOwnershipTransferRequested) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryOwnershipTransferRequested) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +func (it *CapabilitiesRegistryOwnershipTransferRequestedIterator) Error() error { + return it.fail +} + +func (it *CapabilitiesRegistryOwnershipTransferRequestedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +type CapabilitiesRegistryOwnershipTransferRequested struct { + From common.Address + To common.Address + Raw types.Log +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*CapabilitiesRegistryOwnershipTransferRequestedIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.FilterLogs(opts, "OwnershipTransferRequested", fromRule, toRule) + if err != nil { + return nil, err + } + return &CapabilitiesRegistryOwnershipTransferRequestedIterator{contract: _CapabilitiesRegistry.contract, event: "OwnershipTransferRequested", logs: logs, sub: sub}, nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.WatchLogs(opts, "OwnershipTransferRequested", fromRule, toRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + + event := new(CapabilitiesRegistryOwnershipTransferRequested) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) ParseOwnershipTransferRequested(log types.Log) (*CapabilitiesRegistryOwnershipTransferRequested, error) { + event := new(CapabilitiesRegistryOwnershipTransferRequested) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +type CapabilitiesRegistryOwnershipTransferredIterator struct { + Event *CapabilitiesRegistryOwnershipTransferred + + contract *bind.BoundContract + event string + + logs chan types.Log + sub ethereum.Subscription + done bool + fail error +} + +func (it *CapabilitiesRegistryOwnershipTransferredIterator) Next() bool { + + if it.fail != nil { + return false + } + + if it.done { + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + + select { + case log := <-it.logs: + it.Event = new(CapabilitiesRegistryOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +func (it *CapabilitiesRegistryOwnershipTransferredIterator) Error() error { + return it.fail +} + +func (it *CapabilitiesRegistryOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +type CapabilitiesRegistryOwnershipTransferred struct { + From common.Address + To common.Address + Raw types.Log +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*CapabilitiesRegistryOwnershipTransferredIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.FilterLogs(opts, "OwnershipTransferred", fromRule, toRule) + if err != nil { + return nil, err + } + return &CapabilitiesRegistryOwnershipTransferredIterator{contract: _CapabilitiesRegistry.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _CapabilitiesRegistry.contract.WatchLogs(opts, "OwnershipTransferred", fromRule, toRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + + event := new(CapabilitiesRegistryOwnershipTransferred) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistryFilterer) ParseOwnershipTransferred(log types.Log) (*CapabilitiesRegistryOwnershipTransferred, error) { + event := new(CapabilitiesRegistryOwnershipTransferred) + if err := _CapabilitiesRegistry.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +func (_CapabilitiesRegistry *CapabilitiesRegistry) ParseLog(log types.Log) (generated.AbigenLog, error) { + switch log.Topics[0] { + case _CapabilitiesRegistry.abi.Events["CapabilityConfigured"].ID: + return _CapabilitiesRegistry.ParseCapabilityConfigured(log) + case _CapabilitiesRegistry.abi.Events["CapabilityDeprecated"].ID: + return _CapabilitiesRegistry.ParseCapabilityDeprecated(log) + case _CapabilitiesRegistry.abi.Events["ConfigSet"].ID: + return _CapabilitiesRegistry.ParseConfigSet(log) + case _CapabilitiesRegistry.abi.Events["NodeAdded"].ID: + return _CapabilitiesRegistry.ParseNodeAdded(log) + case _CapabilitiesRegistry.abi.Events["NodeOperatorAdded"].ID: + return _CapabilitiesRegistry.ParseNodeOperatorAdded(log) + case _CapabilitiesRegistry.abi.Events["NodeOperatorRemoved"].ID: + return _CapabilitiesRegistry.ParseNodeOperatorRemoved(log) + case _CapabilitiesRegistry.abi.Events["NodeOperatorUpdated"].ID: + return _CapabilitiesRegistry.ParseNodeOperatorUpdated(log) + case _CapabilitiesRegistry.abi.Events["NodeRemoved"].ID: + return _CapabilitiesRegistry.ParseNodeRemoved(log) + case _CapabilitiesRegistry.abi.Events["NodeUpdated"].ID: + return _CapabilitiesRegistry.ParseNodeUpdated(log) + case _CapabilitiesRegistry.abi.Events["OwnershipTransferRequested"].ID: + return _CapabilitiesRegistry.ParseOwnershipTransferRequested(log) + case _CapabilitiesRegistry.abi.Events["OwnershipTransferred"].ID: + return _CapabilitiesRegistry.ParseOwnershipTransferred(log) + + default: + return nil, fmt.Errorf("abigen wrapper received unknown log topic: %v", log.Topics[0]) + } +} + +func (CapabilitiesRegistryCapabilityConfigured) Topic() common.Hash { + return common.HexToHash("0x04f0a9bcf3f3a3b42a4d7ca081119755f82ebe43e0d30c8f7292c4fe0dc4a2ae") +} + +func (CapabilitiesRegistryCapabilityDeprecated) Topic() common.Hash { + return common.HexToHash("0xdcea1b78b6ddc31592a94607d537543fcaafda6cc52d6d5cc7bbfca1422baf21") +} + +func (CapabilitiesRegistryConfigSet) Topic() common.Hash { + return common.HexToHash("0xf264aae70bf6a9d90e68e0f9b393f4e7fbea67b063b0f336e0b36c1581703651") +} + +func (CapabilitiesRegistryNodeAdded) Topic() common.Hash { + return common.HexToHash("0x74becb12a5e8fd0e98077d02dfba8f647c9670c9df177e42c2418cf17a636f05") +} + +func (CapabilitiesRegistryNodeOperatorAdded) Topic() common.Hash { + return common.HexToHash("0x78e94ca80be2c30abc061b99e7eb8583b1254781734b1e3ce339abb57da2fe8e") +} + +func (CapabilitiesRegistryNodeOperatorRemoved) Topic() common.Hash { + return common.HexToHash("0xa59268ca81d40429e65ccea5385b59cf2d3fc6519371dee92f8eb1dae5107a7a") +} + +func (CapabilitiesRegistryNodeOperatorUpdated) Topic() common.Hash { + return common.HexToHash("0x86f41145bde5dd7f523305452e4aad3685508c181432ec733d5f345009358a28") +} + +func (CapabilitiesRegistryNodeRemoved) Topic() common.Hash { + return common.HexToHash("0x5254e609a97bab37b7cc79fe128f85c097bd6015c6e1624ae0ba392eb9753205") +} + +func (CapabilitiesRegistryNodeUpdated) Topic() common.Hash { + return common.HexToHash("0x4b5b465e22eea0c3d40c30e936643245b80d19b2dcf75788c0699fe8d8db645b") +} + +func (CapabilitiesRegistryOwnershipTransferRequested) Topic() common.Hash { + return common.HexToHash("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278") +} + +func (CapabilitiesRegistryOwnershipTransferred) Topic() common.Hash { + return common.HexToHash("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0") +} + +func (_CapabilitiesRegistry *CapabilitiesRegistry) Address() common.Address { + return _CapabilitiesRegistry.address +} + +type CapabilitiesRegistryInterface interface { + GetCapabilities(opts *bind.CallOpts) ([]CapabilitiesRegistryCapabilityInfo, error) + + GetCapability(opts *bind.CallOpts, hashedId [32]byte) (CapabilitiesRegistryCapabilityInfo, error) + + GetCapabilityConfigs(opts *bind.CallOpts, donId uint32, capabilityId [32]byte) ([]byte, []byte, error) + + GetDON(opts *bind.CallOpts, donId uint32) (CapabilitiesRegistryDONInfo, error) + + GetDONs(opts *bind.CallOpts) ([]CapabilitiesRegistryDONInfo, error) + + GetHashedCapabilityId(opts *bind.CallOpts, labelledName string, version string) ([32]byte, error) + + GetNode(opts *bind.CallOpts, p2pId [32]byte) (CapabilitiesRegistryNodeInfo, error) + + GetNodeOperator(opts *bind.CallOpts, nodeOperatorId uint32) (CapabilitiesRegistryNodeOperator, error) + + GetNodeOperators(opts *bind.CallOpts) ([]CapabilitiesRegistryNodeOperator, error) + + GetNodes(opts *bind.CallOpts) ([]CapabilitiesRegistryNodeInfo, error) + + IsCapabilityDeprecated(opts *bind.CallOpts, hashedCapabilityId [32]byte) (bool, error) + + Owner(opts *bind.CallOpts) (common.Address, error) + + TypeAndVersion(opts *bind.CallOpts) (string, error) + + AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) + + AddCapabilities(opts *bind.TransactOpts, capabilities []CapabilitiesRegistryCapability) (*types.Transaction, error) + + AddDON(opts *bind.TransactOpts, nodes [][32]byte, capabilityConfigurations []CapabilitiesRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) + + AddNodeOperators(opts *bind.TransactOpts, nodeOperators []CapabilitiesRegistryNodeOperator) (*types.Transaction, error) + + AddNodes(opts *bind.TransactOpts, nodes []CapabilitiesRegistryNodeParams) (*types.Transaction, error) + + DeprecateCapabilities(opts *bind.TransactOpts, hashedCapabilityIds [][32]byte) (*types.Transaction, error) + + RemoveDONs(opts *bind.TransactOpts, donIds []uint32) (*types.Transaction, error) + + RemoveNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []uint32) (*types.Transaction, error) + + RemoveNodes(opts *bind.TransactOpts, removedNodeP2PIds [][32]byte) (*types.Transaction, error) + + TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) + + UpdateDON(opts *bind.TransactOpts, donId uint32, nodes [][32]byte, capabilityConfigurations []CapabilitiesRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) + + UpdateNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []uint32, nodeOperators []CapabilitiesRegistryNodeOperator) (*types.Transaction, error) + + UpdateNodes(opts *bind.TransactOpts, nodes []CapabilitiesRegistryNodeParams) (*types.Transaction, error) + + FilterCapabilityConfigured(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*CapabilitiesRegistryCapabilityConfiguredIterator, error) + + WatchCapabilityConfigured(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryCapabilityConfigured, hashedCapabilityId [][32]byte) (event.Subscription, error) + + ParseCapabilityConfigured(log types.Log) (*CapabilitiesRegistryCapabilityConfigured, error) + + FilterCapabilityDeprecated(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*CapabilitiesRegistryCapabilityDeprecatedIterator, error) + + WatchCapabilityDeprecated(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryCapabilityDeprecated, hashedCapabilityId [][32]byte) (event.Subscription, error) + + ParseCapabilityDeprecated(log types.Log) (*CapabilitiesRegistryCapabilityDeprecated, error) + + FilterConfigSet(opts *bind.FilterOpts) (*CapabilitiesRegistryConfigSetIterator, error) + + WatchConfigSet(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryConfigSet) (event.Subscription, error) + + ParseConfigSet(log types.Log) (*CapabilitiesRegistryConfigSet, error) + + FilterNodeAdded(opts *bind.FilterOpts, nodeOperatorId []uint32) (*CapabilitiesRegistryNodeAddedIterator, error) + + WatchNodeAdded(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryNodeAdded, nodeOperatorId []uint32) (event.Subscription, error) + + ParseNodeAdded(log types.Log) (*CapabilitiesRegistryNodeAdded, error) + + FilterNodeOperatorAdded(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address) (*CapabilitiesRegistryNodeOperatorAddedIterator, error) + + WatchNodeOperatorAdded(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryNodeOperatorAdded, nodeOperatorId []uint32, admin []common.Address) (event.Subscription, error) + + ParseNodeOperatorAdded(log types.Log) (*CapabilitiesRegistryNodeOperatorAdded, error) + + FilterNodeOperatorRemoved(opts *bind.FilterOpts, nodeOperatorId []uint32) (*CapabilitiesRegistryNodeOperatorRemovedIterator, error) + + WatchNodeOperatorRemoved(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryNodeOperatorRemoved, nodeOperatorId []uint32) (event.Subscription, error) + + ParseNodeOperatorRemoved(log types.Log) (*CapabilitiesRegistryNodeOperatorRemoved, error) + + FilterNodeOperatorUpdated(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address) (*CapabilitiesRegistryNodeOperatorUpdatedIterator, error) + + WatchNodeOperatorUpdated(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryNodeOperatorUpdated, nodeOperatorId []uint32, admin []common.Address) (event.Subscription, error) + + ParseNodeOperatorUpdated(log types.Log) (*CapabilitiesRegistryNodeOperatorUpdated, error) + + FilterNodeRemoved(opts *bind.FilterOpts) (*CapabilitiesRegistryNodeRemovedIterator, error) + + WatchNodeRemoved(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryNodeRemoved) (event.Subscription, error) + + ParseNodeRemoved(log types.Log) (*CapabilitiesRegistryNodeRemoved, error) + + FilterNodeUpdated(opts *bind.FilterOpts, nodeOperatorId []uint32) (*CapabilitiesRegistryNodeUpdatedIterator, error) + + WatchNodeUpdated(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryNodeUpdated, nodeOperatorId []uint32) (event.Subscription, error) + + ParseNodeUpdated(log types.Log) (*CapabilitiesRegistryNodeUpdated, error) + + FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*CapabilitiesRegistryOwnershipTransferRequestedIterator, error) + + WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) + + ParseOwnershipTransferRequested(log types.Log) (*CapabilitiesRegistryOwnershipTransferRequested, error) + + FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*CapabilitiesRegistryOwnershipTransferredIterator, error) + + WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *CapabilitiesRegistryOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) + + ParseOwnershipTransferred(log types.Log) (*CapabilitiesRegistryOwnershipTransferred, error) + + ParseLog(log types.Log) (generated.AbigenLog, error) + + Address() common.Address +} diff --git a/core/gethwrappers/keystone/generated/keystone_capability_registry/keystone_capability_registry.go b/core/gethwrappers/keystone/generated/keystone_capability_registry/keystone_capability_registry.go deleted file mode 100644 index 6925beaed72..00000000000 --- a/core/gethwrappers/keystone/generated/keystone_capability_registry/keystone_capability_registry.go +++ /dev/null @@ -1,2302 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package keystone_capability_registry - -import ( - "errors" - "fmt" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" -) - -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -type CapabilityRegistryCapability struct { - LabelledName string - Version string - CapabilityType uint8 - ResponseType uint8 - ConfigurationContract common.Address -} - -type CapabilityRegistryCapabilityConfiguration struct { - CapabilityId [32]byte - Config []byte -} - -type CapabilityRegistryDONInfo struct { - Id uint32 - ConfigCount uint32 - F uint8 - IsPublic bool - AcceptsWorkflows bool - NodeP2PIds [][32]byte - CapabilityConfigurations []CapabilityRegistryCapabilityConfiguration -} - -type CapabilityRegistryNodeInfo struct { - NodeOperatorId uint32 - Signer [32]byte - P2pId [32]byte - HashedCapabilityIds [][32]byte -} - -type CapabilityRegistryNodeOperator struct { - Admin common.Address - Name string -} - -var CapabilityRegistryMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"AccessForbidden\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityDoesNotExist\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityIsDeprecated\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"}],\"name\":\"DONDoesNotExist\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"}],\"name\":\"DuplicateDONCapability\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"nodeP2PId\",\"type\":\"bytes32\"}],\"name\":\"DuplicateDONNode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"proposedConfigurationContract\",\"type\":\"address\"}],\"name\":\"InvalidCapabilityConfigurationContractInterface\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"nodeCount\",\"type\":\"uint256\"}],\"name\":\"InvalidFaultTolerance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"hashedCapabilityIds\",\"type\":\"bytes32[]\"}],\"name\":\"InvalidNodeCapabilities\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidNodeOperatorAdmin\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"}],\"name\":\"InvalidNodeP2PId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidNodeSigner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"lengthOne\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lengthTwo\",\"type\":\"uint256\"}],\"name\":\"LengthMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nodeP2PId\",\"type\":\"bytes32\"}],\"name\":\"NodeAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nodeP2PId\",\"type\":\"bytes32\"}],\"name\":\"NodeDoesNotExist\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nodeP2PId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"}],\"name\":\"NodeDoesNotSupportCapability\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"}],\"name\":\"NodeOperatorDoesNotExist\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nodeP2PId\",\"type\":\"bytes32\"}],\"name\":\"NodePartOfDON\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityConfigured\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"CapabilityDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"configCount\",\"type\":\"uint32\"}],\"name\":\"ConfigSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signer\",\"type\":\"bytes32\"}],\"name\":\"NodeAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NodeOperatorAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"}],\"name\":\"NodeOperatorRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NodeOperatorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"}],\"name\":\"NodeRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signer\",\"type\":\"bytes32\"}],\"name\":\"NodeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"OwnershipTransferRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"labelledName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"enumCapabilityRegistry.CapabilityType\",\"name\":\"capabilityType\",\"type\":\"uint8\"},{\"internalType\":\"enumCapabilityRegistry.CapabilityResponseType\",\"name\":\"responseType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"configurationContract\",\"type\":\"address\"}],\"internalType\":\"structCapabilityRegistry.Capability[]\",\"name\":\"capabilities\",\"type\":\"tuple[]\"}],\"name\":\"addCapabilities\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"nodes\",\"type\":\"bytes32[]\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"config\",\"type\":\"bytes\"}],\"internalType\":\"structCapabilityRegistry.CapabilityConfiguration[]\",\"name\":\"capabilityConfigurations\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"isPublic\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"acceptsWorkflows\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"}],\"name\":\"addDON\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structCapabilityRegistry.NodeOperator[]\",\"name\":\"nodeOperators\",\"type\":\"tuple[]\"}],\"name\":\"addNodeOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"signer\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"hashedCapabilityIds\",\"type\":\"bytes32[]\"}],\"internalType\":\"structCapabilityRegistry.NodeInfo[]\",\"name\":\"nodes\",\"type\":\"tuple[]\"}],\"name\":\"addNodes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"hashedCapabilityIds\",\"type\":\"bytes32[]\"}],\"name\":\"deprecateCapabilities\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCapabilities\",\"outputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"hashedCapabilityIds\",\"type\":\"bytes32[]\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"labelledName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"enumCapabilityRegistry.CapabilityType\",\"name\":\"capabilityType\",\"type\":\"uint8\"},{\"internalType\":\"enumCapabilityRegistry.CapabilityResponseType\",\"name\":\"responseType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"configurationContract\",\"type\":\"address\"}],\"internalType\":\"structCapabilityRegistry.Capability[]\",\"name\":\"capabilities\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedId\",\"type\":\"bytes32\"}],\"name\":\"getCapability\",\"outputs\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"labelledName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"enumCapabilityRegistry.CapabilityType\",\"name\":\"capabilityType\",\"type\":\"uint8\"},{\"internalType\":\"enumCapabilityRegistry.CapabilityResponseType\",\"name\":\"responseType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"configurationContract\",\"type\":\"address\"}],\"internalType\":\"structCapabilityRegistry.Capability\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"}],\"name\":\"getCapabilityConfigs\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"}],\"name\":\"getDON\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"id\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"configCount\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"},{\"internalType\":\"bool\",\"name\":\"isPublic\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"acceptsWorkflows\",\"type\":\"bool\"},{\"internalType\":\"bytes32[]\",\"name\":\"nodeP2PIds\",\"type\":\"bytes32[]\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"config\",\"type\":\"bytes\"}],\"internalType\":\"structCapabilityRegistry.CapabilityConfiguration[]\",\"name\":\"capabilityConfigurations\",\"type\":\"tuple[]\"}],\"internalType\":\"structCapabilityRegistry.DONInfo\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDONs\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"id\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"configCount\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"},{\"internalType\":\"bool\",\"name\":\"isPublic\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"acceptsWorkflows\",\"type\":\"bool\"},{\"internalType\":\"bytes32[]\",\"name\":\"nodeP2PIds\",\"type\":\"bytes32[]\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"config\",\"type\":\"bytes\"}],\"internalType\":\"structCapabilityRegistry.CapabilityConfiguration[]\",\"name\":\"capabilityConfigurations\",\"type\":\"tuple[]\"}],\"internalType\":\"structCapabilityRegistry.DONInfo[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"labelledName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"}],\"name\":\"getHashedCapabilityId\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"}],\"name\":\"getNode\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"signer\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"hashedCapabilityIds\",\"type\":\"bytes32[]\"}],\"internalType\":\"structCapabilityRegistry.NodeInfo\",\"name\":\"\",\"type\":\"tuple\"},{\"internalType\":\"uint32\",\"name\":\"configCount\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"}],\"name\":\"getNodeOperator\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structCapabilityRegistry.NodeOperator\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNodeOperators\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structCapabilityRegistry.NodeOperator[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNodes\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"signer\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"hashedCapabilityIds\",\"type\":\"bytes32[]\"}],\"internalType\":\"structCapabilityRegistry.NodeInfo[]\",\"name\":\"nodeInfo\",\"type\":\"tuple[]\"},{\"internalType\":\"uint32[]\",\"name\":\"configCounts\",\"type\":\"uint32[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hashedCapabilityId\",\"type\":\"bytes32\"}],\"name\":\"isCapabilityDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32[]\",\"name\":\"donIds\",\"type\":\"uint32[]\"}],\"name\":\"removeDONs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32[]\",\"name\":\"nodeOperatorIds\",\"type\":\"uint32[]\"}],\"name\":\"removeNodeOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"removedNodeP2PIds\",\"type\":\"bytes32[]\"}],\"name\":\"removeNodes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"typeAndVersion\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"donId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32[]\",\"name\":\"nodes\",\"type\":\"bytes32[]\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"capabilityId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"config\",\"type\":\"bytes\"}],\"internalType\":\"structCapabilityRegistry.CapabilityConfiguration[]\",\"name\":\"capabilityConfigurations\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"isPublic\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"acceptsWorkflows\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"}],\"name\":\"updateDON\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32[]\",\"name\":\"nodeOperatorIds\",\"type\":\"uint32[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structCapabilityRegistry.NodeOperator[]\",\"name\":\"nodeOperators\",\"type\":\"tuple[]\"}],\"name\":\"updateNodeOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"nodeOperatorId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"signer\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"p2pId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"hashedCapabilityIds\",\"type\":\"bytes32[]\"}],\"internalType\":\"structCapabilityRegistry.NodeInfo[]\",\"name\":\"nodes\",\"type\":\"tuple[]\"}],\"name\":\"updateNodes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x6080604052600e80546001600160401b0319166401000000011790553480156200002857600080fd5b503380600081620000805760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0384811691909117909155811615620000b357620000b381620000bc565b50505062000167565b336001600160a01b03821603620001165760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640162000077565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b614e4180620001776000396000f3fe608060405234801561001057600080fd5b50600436106101ae5760003560e01c80635e65e309116100ee5780638da5cb5b11610097578063d8bc7b6811610071578063d8bc7b68146103f7578063ddbe4f821461040a578063e29581aa14610420578063f2fde38b1461043657600080fd5b80638da5cb5b1461039c5780639cb7c5f4146103c4578063d59a79f6146103e457600080fd5b806373ac22b4116100c857806373ac22b41461036e57806379ba50971461038157806386fa42461461038957600080fd5b80635e65e3091461033357806366acaa3314610346578063715f52951461035b57600080fd5b8063235374051161015b578063398f377311610135578063398f3773146102cb5780633f2a13c9146102de57806350c946fe146102ff5780635d83d9671461032057600080fd5b80632353740514610285578063275459f2146102a55780632c01a1e8146102b857600080fd5b80631d05394c1161018c5780631d05394c1461023b578063214502431461025057806322bdbcbc1461026557600080fd5b80630fe5800a146101b357806312570011146101d9578063181f5a77146101fc575b600080fd5b6101c66101c1366004613c55565b610449565b6040519081526020015b60405180910390f35b6101ec6101e7366004613cb9565b61047d565b60405190151581526020016101d0565b604080518082018252601881527f4361706162696c697479526567697374727920312e302e300000000000000000602082015290516101d09190613d40565b61024e610249366004613d98565b61048a565b005b610258610646565b6040516101d09190613ef8565b610278610273366004613f91565b6107ab565b6040516101d09190613fe9565b610298610293366004613f91565b610898565b6040516101d09190613ffc565b61024e6102b3366004613d98565b6108dc565b61024e6102c6366004613d98565b6109b3565b61024e6102d9366004613d98565b610bd6565b6102f16102ec36600461400f565b610d9e565b6040516101d0929190614039565b61031261030d366004613cb9565b610f8a565b6040516101d0929190614097565b61024e61032e366004613d98565b61102f565b61024e610341366004613d98565b61117d565b61034e6115ef565b6040516101d091906140bf565b61024e610369366004613d98565b6117da565b61024e61037c366004613d98565b611895565b61024e611d3a565b61024e610397366004614132565b611e37565b60005460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101d0565b6103d76103d2366004613cb9565b61217d565b6040516101d0919061425a565b61024e6103f236600461428c565b612382565b61024e610405366004614341565b61244b565b610412612515565b6040516101d09291906143e6565b610428612878565b6040516101d0929190614476565b61024e61044436600461454c565b6129e7565b6000828260405160200161045e929190614039565b6040516020818303038152906040528051906020012090505b92915050565b60006104776005836129fb565b610492612a16565b60005b818110156106415760008383838181106104b1576104b1614567565b90506020020160208101906104c69190613f91565b63ffffffff8082166000908152600d60209081526040808320805464010000000090049094168084526001850190925282209394509192905b61050882612a99565b8110156105605761054f8563ffffffff16600c60006105308587612aa390919063ffffffff16565b8152602001908152602001600020600401612aaf90919063ffffffff16565b50610559816145c5565b90506104ff565b508254640100000000900463ffffffff166000036105b7576040517f2b62be9b00000000000000000000000000000000000000000000000000000000815263ffffffff851660048201526024015b60405180910390fd5b63ffffffff84166000818152600d6020908152604080832080547fffffffffffffffffffffffffffffffffffffffffff00000000000000000000001690558051938452908301919091527ff264aae70bf6a9d90e68e0f9b393f4e7fbea67b063b0f336e0b36c1581703651910160405180910390a1505050508061063a906145c5565b9050610495565b505050565b600e54606090640100000000900463ffffffff1660006106676001836145fd565b63ffffffff1667ffffffffffffffff81111561068557610685613aef565b60405190808252806020026020018201604052801561070c57816020015b6040805160e081018252600080825260208083018290529282018190526060808301829052608083019190915260a0820181905260c082015282527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9092019101816106a35790505b509050600060015b8363ffffffff168163ffffffff1610156107885763ffffffff8082166000908152600d602052604090205416156107785761074e81612abb565b83838151811061076057610760614567565b602002602001018190525081610775906145c5565b91505b6107818161461a565b9050610714565b506107946001846145fd565b63ffffffff1681146107a4578082525b5092915050565b60408051808201909152600081526060602082015263ffffffff82166000908152600b60209081526040918290208251808401909352805473ffffffffffffffffffffffffffffffffffffffff168352600181018054919284019161080f9061463d565b80601f016020809104026020016040519081016040528092919081815260200182805461083b9061463d565b80156108885780601f1061085d57610100808354040283529160200191610888565b820191906000526020600020905b81548152906001019060200180831161086b57829003601f168201915b5050505050815250509050919050565b6040805160e0810182526000808252602082018190529181018290526060808201839052608082019290925260a0810182905260c081019190915261047782612abb565b6108e4612a16565b60005b63ffffffff811682111561064157600083838363ffffffff1681811061090f5761090f614567565b90506020020160208101906109249190613f91565b63ffffffff81166000908152600b6020526040812080547fffffffffffffffffffffffff000000000000000000000000000000000000000016815591925061096f6001830182613a82565b505060405163ffffffff8216907fa59268ca81d40429e65ccea5385b59cf2d3fc6519371dee92f8eb1dae5107a7a90600090a2506109ac8161461a565b90506108e7565b6000805473ffffffffffffffffffffffffffffffffffffffff163314905b82811015610bd05760008484838181106109ed576109ed614567565b602090810292909201356000818152600c90935260409092206001810154929350919050610a4a576040517fd82f6adb000000000000000000000000000000000000000000000000000000008152600481018390526024016105ae565b6000610a5882600401612a99565b1115610a93576040517f34a4a3f6000000000000000000000000000000000000000000000000000000008152600481018390526024016105ae565b83158015610acd5750805463ffffffff166000908152600b602052604090205473ffffffffffffffffffffffffffffffffffffffff163314155b15610b06576040517f9473075d0000000000000000000000000000000000000000000000000000000081523360048201526024016105ae565b6001810154610b1790600790612aaf565b506002810154610b2990600990612aaf565b506000828152600c6020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000016815560018101829055600281018290559060048201818181610b7e8282613abc565b5050505050507f5254e609a97bab37b7cc79fe128f85c097bd6015c6e1624ae0ba392eb975320582604051610bb591815260200190565b60405180910390a1505080610bc9906145c5565b90506109d1565b50505050565b610bde612a16565b60005b81811015610641576000838383818110610bfd57610bfd614567565b9050602002810190610c0f9190614690565b610c18906146ce565b805190915073ffffffffffffffffffffffffffffffffffffffff16610c69576040517feeacd93900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600e54604080518082018252835173ffffffffffffffffffffffffffffffffffffffff908116825260208086015181840190815263ffffffff9095166000818152600b909252939020825181547fffffffffffffffffffffffff00000000000000000000000000000000000000001692169190911781559251919290916001820190610cf59082614786565b5050600e8054909150600090610d109063ffffffff1661461a565b91906101000a81548163ffffffff021916908363ffffffff160217905550816000015173ffffffffffffffffffffffffffffffffffffffff168163ffffffff167f78e94ca80be2c30abc061b99e7eb8583b1254781734b1e3ce339abb57da2fe8e8460200151604051610d839190613d40565b60405180910390a3505080610d97906145c5565b9050610be1565b63ffffffff8083166000908152600d60209081526040808320805464010000000090049094168084526001909401825280832085845260030190915281208054606093849390929091610df09061463d565b80601f0160208091040260200160405190810160405280929190818152602001828054610e1c9061463d565b8015610e695780601f10610e3e57610100808354040283529160200191610e69565b820191906000526020600020905b815481529060010190602001808311610e4c57829003601f168201915b5050506000888152600260208190526040909120015492935060609262010000900473ffffffffffffffffffffffffffffffffffffffff16159150610f7c905057600086815260026020819052604091829020015490517f8318ed5d00000000000000000000000000000000000000000000000000000000815263ffffffff891660048201526201000090910473ffffffffffffffffffffffffffffffffffffffff1690638318ed5d90602401600060405180830381865afa158015610f33573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052610f7991908101906148a0565b90505b9093509150505b9250929050565b6040805160808101825260008082526020820181905291810191909152606080820152604080516080810182526000848152600c6020908152838220805463ffffffff80821686526001830154848701526002830154868801526401000000009091041683526003019052918220606082019061100690612d8f565b90526000938452600c602052604090932054929364010000000090930463ffffffff1692915050565b611037612a16565b60005b8181101561064157600083838381811061105657611056614567565b9050602002013590506110738160036129fb90919063ffffffff16565b6110ac576040517fe181733f000000000000000000000000000000000000000000000000000000008152600481018290526024016105ae565b6110b7600582612d9c565b6110f0576040517ff7d7a294000000000000000000000000000000000000000000000000000000008152600481018290526024016105ae565b6000818152600260205260408120906111098282613a82565b611117600183016000613a82565b5060020180547fffffffffffffffffffff0000000000000000000000000000000000000000000016905560405181907fdcea1b78b6ddc31592a94607d537543fcaafda6cc52d6d5cc7bbfca1422baf2190600090a250611176816145c5565b905061103a565b6000805473ffffffffffffffffffffffffffffffffffffffff163314905b82811015610bd05760008484838181106111b7576111b7614567565b90506020028101906111c9919061490e565b6111d290614942565b805163ffffffff166000908152600b602090815260408083208151808301909252805473ffffffffffffffffffffffffffffffffffffffff1682526001810180549596509394919390928401916112289061463d565b80601f01602080910402602001604051908101604052809291908181526020018280546112549061463d565b80156112a15780601f10611276576101008083540402835291602001916112a1565b820191906000526020600020905b81548152906001019060200180831161128457829003601f168201915b5050505050815250509050831580156112d15750805173ffffffffffffffffffffffffffffffffffffffff163314155b1561130a576040517f9473075d0000000000000000000000000000000000000000000000000000000081523360048201526024016105ae565b6040808301516000908152600c60205220600181015461135e5782604001516040517fd82f6adb0000000000000000000000000000000000000000000000000000000081526004016105ae91815260200190565b6020830151158061138e5750826020015181600101541415801561138e5750602083015161138e906007906129fb565b156113c5576040517f8377314600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060830151805160000361140757806040517f3748d4c60000000000000000000000000000000000000000000000000000000081526004016105ae9190614a15565b8154640100000000900463ffffffff168260046114238361461a565b82546101009290920a63ffffffff8181021990931691831602179091558354640100000000900416905060005b825181101561151b5761148683828151811061146e5761146e614567565b602002602001015160036129fb90919063ffffffff16565b6114be57826040517f3748d4c60000000000000000000000000000000000000000000000000000000081526004016105ae9190614a15565b61150a8382815181106114d3576114d3614567565b60200260200101518560030160008563ffffffff1663ffffffff168152602001908152602001600020612d9c90919063ffffffff16565b50611514816145c5565b9050611450565b50845183547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff9091161783556040850151600284015560018301546020860151811461158d57611572600782612aaf565b5060208601516001850181905561158b90600790612d9c565b505b85516040808801516020808a015183519283529082015263ffffffff909216917f4b5b465e22eea0c3d40c30e936643245b80d19b2dcf75788c0699fe8d8db645b910160405180910390a2505050505050806115e8906145c5565b905061119b565b600e5460609063ffffffff1660006116086001836145fd565b63ffffffff1667ffffffffffffffff81111561162657611626613aef565b60405190808252806020026020018201604052801561166c57816020015b6040805180820190915260008152606060208201528152602001906001900390816116445790505b509050600060015b8363ffffffff168163ffffffff1610156117c45763ffffffff81166000908152600b602052604090205473ffffffffffffffffffffffffffffffffffffffff16156117b45763ffffffff81166000908152600b60209081526040918290208251808401909352805473ffffffffffffffffffffffffffffffffffffffff16835260018101805491928401916117089061463d565b80601f01602080910402602001604051908101604052809291908181526020018280546117349061463d565b80156117815780601f1061175657610100808354040283529160200191611781565b820191906000526020600020905b81548152906001019060200180831161176457829003601f168201915b50505050508152505083838151811061179c5761179c614567565b6020026020010181905250816117b1906145c5565b91505b6117bd8161461a565b9050611674565b50600e546107949060019063ffffffff166145fd565b6117e2612a16565b60005b8181101561064157600083838381811061180157611801614567565b90506020028101906118139190614a28565b61181c90614a6b565b9050600061183282600001518360200151610449565b905061183f600382612d9c565b611878576040517febf52551000000000000000000000000000000000000000000000000000000008152600481018290526024016105ae565b6118828183612da8565b50508061188e906145c5565b90506117e5565b6000805473ffffffffffffffffffffffffffffffffffffffff163314905b82811015610bd05760008484838181106118cf576118cf614567565b90506020028101906118e1919061490e565b6118ea90614942565b805163ffffffff166000908152600b602090815260408083208151808301909252805473ffffffffffffffffffffffffffffffffffffffff1682526001810180549596509394919390928401916119409061463d565b80601f016020809104026020016040519081016040528092919081815260200182805461196c9061463d565b80156119b95780601f1061198e576101008083540402835291602001916119b9565b820191906000526020600020905b81548152906001019060200180831161199c57829003601f168201915b50505091909252505081519192505073ffffffffffffffffffffffffffffffffffffffff16611a1f5781516040517fadd9ae1e00000000000000000000000000000000000000000000000000000000815263ffffffff90911660048201526024016105ae565b83158015611a445750805173ffffffffffffffffffffffffffffffffffffffff163314155b15611a7d576040517f9473075d0000000000000000000000000000000000000000000000000000000081523360048201526024016105ae565b6040808301516000908152600c60205220600181015415611ad25782604001516040517f546184830000000000000000000000000000000000000000000000000000000081526004016105ae91815260200190565b6040830151611b155782604001516040517f64e2ee920000000000000000000000000000000000000000000000000000000081526004016105ae91815260200190565b60208301511580611b3257506020830151611b32906007906129fb565b15611b69576040517f8377314600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608301518051600003611bab57806040517f3748d4c60000000000000000000000000000000000000000000000000000000081526004016105ae9190614a15565b81548290600490611bc990640100000000900463ffffffff1661461a565b82546101009290920a63ffffffff818102199093169183160217909155825464010000000090041660005b8251811015611c7057611c1283828151811061146e5761146e614567565b611c4a57826040517f3748d4c60000000000000000000000000000000000000000000000000000000081526004016105ae9190614a15565b611c5f8382815181106114d3576114d3614567565b50611c69816145c5565b9050611bf4565b50845183547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff91821617845560408601516002850155602086015160018501819055611cc69160079190612d9c16565b506040850151611cd890600990612d9c565b50845160408087015160208089015183519283529082015263ffffffff909216917f74becb12a5e8fd0e98077d02dfba8f647c9670c9df177e42c2418cf17a636f05910160405180910390a2505050505080611d33906145c5565b90506118b3565b60015473ffffffffffffffffffffffffffffffffffffffff163314611dbb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e65720000000000000000000060448201526064016105ae565b60008054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217845560018054909116905560405173ffffffffffffffffffffffffffffffffffffffff90921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b828114611e7a576040517fab8b67c600000000000000000000000000000000000000000000000000000000815260048101849052602481018290526044016105ae565b6000805473ffffffffffffffffffffffffffffffffffffffff16905b84811015612175576000868683818110611eb257611eb2614567565b9050602002016020810190611ec79190613f91565b63ffffffff81166000908152600b6020526040902080549192509073ffffffffffffffffffffffffffffffffffffffff16611f36576040517fadd9ae1e00000000000000000000000000000000000000000000000000000000815263ffffffff831660048201526024016105ae565b6000868685818110611f4a57611f4a614567565b9050602002810190611f5c9190614690565b611f65906146ce565b805190915073ffffffffffffffffffffffffffffffffffffffff16611fb6576040517feeacd93900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805173ffffffffffffffffffffffffffffffffffffffff163314801590611ff357503373ffffffffffffffffffffffffffffffffffffffff861614155b1561202c576040517f9473075d0000000000000000000000000000000000000000000000000000000081523360048201526024016105ae565b8051825473ffffffffffffffffffffffffffffffffffffffff90811691161415806120a857506020808201516040516120659201613d40565b604051602081830303815290604052805190602001208260010160405160200161208f9190614b11565b6040516020818303038152906040528051906020012014155b1561216157805182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602081015160018301906121029082614786565b50806000015173ffffffffffffffffffffffffffffffffffffffff168363ffffffff167f86f41145bde5dd7f523305452e4aad3685508c181432ec733d5f345009358a2883602001516040516121589190613d40565b60405180910390a35b5050508061216e906145c5565b9050611e96565b505050505050565b6121ad6040805160a081018252606080825260208201529081016000815260200160008152600060209091015290565b60008281526002602052604090819020815160a081019092528054829082906121d59061463d565b80601f01602080910402602001604051908101604052809291908181526020018280546122019061463d565b801561224e5780601f106122235761010080835404028352916020019161224e565b820191906000526020600020905b81548152906001019060200180831161223157829003601f168201915b505050505081526020016001820180546122679061463d565b80601f01602080910402602001604051908101604052809291908181526020018280546122939061463d565b80156122e05780601f106122b5576101008083540402835291602001916122e0565b820191906000526020600020905b8154815290600101906020018083116122c357829003601f168201915b5050509183525050600282015460209091019060ff1660038111156123075761230761419e565b60038111156123185761231861419e565b81526020016002820160019054906101000a900460ff1660018111156123405761234061419e565b60018111156123515761235161419e565b81526002919091015462010000900473ffffffffffffffffffffffffffffffffffffffff1660209091015292915050565b61238a612a16565b63ffffffff8089166000908152600d60205260408120546401000000009004909116908190036123ee576040517f2b62be9b00000000000000000000000000000000000000000000000000000000815263ffffffff8a1660048201526024016105ae565b612440888888886040518060a001604052808f63ffffffff168152602001876124169061461a565b97508763ffffffff1681526020018a1515815260200189151581526020018860ff1681525061303c565b505050505050505050565b612453612a16565b600e805460009164010000000090910463ffffffff169060046124758361461a565b82546101009290920a63ffffffff81810219909316918316021790915581166000818152600d602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001684179055815160a08101835292835260019083015286151590820152841515606082015260ff8416608082015290915061250b90899089908990899061303c565b5050505050505050565b6060806125226003612d8f565b915060006125306005612a99565b835161253c9190614bba565b90508067ffffffffffffffff81111561255757612557613aef565b6040519080825280602002602001820160405280156125b857816020015b6125a56040805160a081018252606080825260208201529081016000815260200160008152600060209091015290565b8152602001906001900390816125755790505b50915060008167ffffffffffffffff8111156125d6576125d6613aef565b6040519080825280602002602001820160405280156125ff578160200160208202803683370190505b5090506000805b855181101561286e57600086828151811061262357612623614567565b602002602001015190506126418160056129fb90919063ffffffff16565b61285d5760008181526002602052604090819020815160a0810190925280548290829061266d9061463d565b80601f01602080910402602001604051908101604052809291908181526020018280546126999061463d565b80156126e65780601f106126bb576101008083540402835291602001916126e6565b820191906000526020600020905b8154815290600101906020018083116126c957829003601f168201915b505050505081526020016001820180546126ff9061463d565b80601f016020809104026020016040519081016040528092919081815260200182805461272b9061463d565b80156127785780601f1061274d57610100808354040283529160200191612778565b820191906000526020600020905b81548152906001019060200180831161275b57829003601f168201915b5050509183525050600282015460209091019060ff16600381111561279f5761279f61419e565b60038111156127b0576127b061419e565b81526020016002820160019054906101000a900460ff1660018111156127d8576127d861419e565b60018111156127e9576127e961419e565b81526002919091015462010000900473ffffffffffffffffffffffffffffffffffffffff16602090910152865187908590811061282857612828614567565b60200260200101819052508084848151811061284657612846614567565b602090810291909101015261285a836145c5565b92505b50612867816145c5565b9050612606565b5090949293505050565b60608060006128876009612d8f565b9050805167ffffffffffffffff8111156128a3576128a3613aef565b60405190808252806020026020018201604052801561291257816020015b60408051608081018252600080825260208083018290529282015260608082015282527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9092019101816128c15790505b509250805167ffffffffffffffff81111561292f5761292f613aef565b604051908082528060200260200182016040528015612958578160200160208202803683370190505b50915060005b81518110156129e15761298982828151811061297c5761297c614567565b6020026020010151610f8a565b85838151811061299b5761299b614567565b602002602001018584815181106129b4576129b4614567565b602002602001018263ffffffff1663ffffffff168152508290525050806129da906145c5565b905061295e565b50509091565b6129ef612a16565b6129f8816136e4565b50565b600081815260018301602052604081205415155b9392505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314612a97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e65720000000000000000000060448201526064016105ae565b565b6000610477825490565b6000612a0f83836137d9565b6000612a0f8383613803565b6040805160e0810182526000808252602080830182905282840182905260608084018390526080840183905260a0840181905260c084015263ffffffff8581168352600d8252848320805464010000000090049091168084526001909101825284832060028101805487518186028101860190985280885295969295919493909190830182828015612b6c57602002820191906000526020600020905b815481526020019060010190808311612b58575b505050505090506000815167ffffffffffffffff811115612b8f57612b8f613aef565b604051908082528060200260200182016040528015612bd557816020015b604080518082019091526000815260606020820152815260200190600190039081612bad5790505b50905060005b8151811015612cf6576040518060400160405280848381518110612c0157612c01614567565b60200260200101518152602001856003016000868581518110612c2657612c26614567565b602002602001015181526020019081526020016000208054612c479061463d565b80601f0160208091040260200160405190810160405280929190818152602001828054612c739061463d565b8015612cc05780601f10612c9557610100808354040283529160200191612cc0565b820191906000526020600020905b815481529060010190602001808311612ca357829003601f168201915b5050505050815250828281518110612cda57612cda614567565b602002602001018190525080612cef906145c5565b9050612bdb565b506040805160e08101825263ffffffff8089166000818152600d6020818152868320548086168752948b168187015260ff680100000000000000008604811697870197909752690100000000000000000085048716151560608701529290915290526a010000000000000000000090049091161515608082015260a08101612d7d85612d8f565b81526020019190915295945050505050565b60606000612a0f836138f6565b6000612a0f8383613952565b608081015173ffffffffffffffffffffffffffffffffffffffff1615612ef657608081015173ffffffffffffffffffffffffffffffffffffffff163b1580612ea1575060808101516040517f01ffc9a70000000000000000000000000000000000000000000000000000000081527f78bea72100000000000000000000000000000000000000000000000000000000600482015273ffffffffffffffffffffffffffffffffffffffff909116906301ffc9a790602401602060405180830381865afa158015612e7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e9f9190614bcd565b155b15612ef65760808101516040517fabb5e3fd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911660048201526024016105ae565b600082815260026020526040902081518291908190612f159082614786565b5060208201516001820190612f2a9082614786565b5060408201516002820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001836003811115612f6c57612f6c61419e565b021790555060608201516002820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16610100836001811115612fb357612fb361419e565b0217905550608091909101516002909101805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117905560405182907f04f0a9bcf3f3a3b42a4d7ca081119755f82ebe43e0d30c8f7292c4fe0dc4a2ae90600090a25050565b805163ffffffff9081166000908152600d602090815260408083208286015190941683526001909301905220608082015160ff16158061308e575060808201518590613089906001614bea565b60ff16115b156130d75760808201516040517f25b4d61800000000000000000000000000000000000000000000000000000000815260ff9091166004820152602481018690526044016105ae565b6001826020015163ffffffff16111561318357815163ffffffff166000908152600d60209081526040822090840151600191820191839161311891906145fd565b63ffffffff1663ffffffff168152602001908152602001600020905060005b61314082612a99565b8110156131805761316f846000015163ffffffff16600c60006105308587600001612aa390919063ffffffff16565b50613179816145c5565b9050613137565b50505b60005b8581101561326d576131b38787838181106131a3576131a3614567565b8592602090910201359050612d9c565b6132145782518787838181106131cb576131cb614567565b6040517f636e405700000000000000000000000000000000000000000000000000000000815263ffffffff909416600485015260200291909101356024830152506044016105ae565b825161325c9063ffffffff16600c60008a8a8681811061323657613236614567565b905060200201358152602001908152602001600020600401612d9c90919063ffffffff16565b50613266816145c5565b9050613186565b5060005b83811015613559573685858381811061328c5761328c614567565b905060200281019061329e9190614690565b90506132ac600382356129fb565b6132e5576040517fe181733f000000000000000000000000000000000000000000000000000000008152813560048201526024016105ae565b6132f1600582356129fb565b1561332b576040517ff7d7a294000000000000000000000000000000000000000000000000000000008152813560048201526024016105ae565b80356000908152600384016020526040812080546133489061463d565b905011156133945783516040517f3927d08000000000000000000000000000000000000000000000000000000000815263ffffffff9091166004820152813560248201526044016105ae565b60005b878110156134a65761343b8235600c60008c8c868181106133ba576133ba614567565b9050602002013581526020019081526020016000206003016000600c60008e8e888181106133ea576133ea614567565b90506020020135815260200190815260200160002060000160049054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020019081526020016000206129fb90919063ffffffff16565b6134965788888281811061345157613451614567565b6040517fa7e7925000000000000000000000000000000000000000000000000000000000815260209091029290920135600483015250823560248201526044016105ae565b61349f816145c5565b9050613397565b50600283018054600181018255600091825260209182902083359101556134cf90820182614c03565b823560009081526003860160205260409020916134ed919083614c68565b50835160208086015161354892918435908c908c9061350e90880188614c03565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506139a192505050565b50613552816145c5565b9050613271565b50604080830151835163ffffffff9081166000908152600d602090815284822080549415156901000000000000000000027fffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffff90951694909417909355606086015186518316825284822080549115156a0100000000000000000000027fffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffff9092169190911790556080860151865183168252848220805460ff9290921668010000000000000000027fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff909216919091179055918501805186518316845292849020805493909216640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff9093169290921790558351905191517ff264aae70bf6a9d90e68e0f9b393f4e7fbea67b063b0f336e0b36c1581703651926136d4929163ffffffff92831681529116602082015260400190565b60405180910390a1505050505050565b3373ffffffffffffffffffffffffffffffffffffffff821603613763576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c6600000000000000000060448201526064016105ae565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b60008260000182815481106137f0576137f0614567565b9060005260206000200154905092915050565b600081815260018301602052604081205480156138ec576000613827600183614bba565b855490915060009061383b90600190614bba565b90508181146138a057600086600001828154811061385b5761385b614567565b906000526020600020015490508087600001848154811061387e5761387e614567565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806138b1576138b1614d83565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610477565b6000915050610477565b60608160000180548060200260200160405190810160405280929190818152602001828054801561394657602002820191906000526020600020905b815481526020019060010190808311613932575b50505050509050919050565b600081815260018301602052604081205461399957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610477565b506000610477565b6000848152600260208190526040909120015462010000900473ffffffffffffffffffffffffffffffffffffffff161561217557600084815260026020819052604091829020015490517ffba64a7c0000000000000000000000000000000000000000000000000000000081526201000090910473ffffffffffffffffffffffffffffffffffffffff169063fba64a7c90613a48908690869086908b908d90600401614db2565b600060405180830381600087803b158015613a6257600080fd5b505af1158015613a76573d6000803e3d6000fd5b50505050505050505050565b508054613a8e9061463d565b6000825580601f10613a9e575050565b601f0160209004906000526020600020908101906129f89190613ad6565b50805460008255906000526020600020908101906129f891905b5b80821115613aeb5760008155600101613ad7565b5090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516080810167ffffffffffffffff81118282101715613b4157613b41613aef565b60405290565b60405160a0810167ffffffffffffffff81118282101715613b4157613b41613aef565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613bb157613bb1613aef565b604052919050565b600067ffffffffffffffff821115613bd357613bd3613aef565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613c1057600080fd5b8135613c23613c1e82613bb9565b613b6a565b818152846020838601011115613c3857600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215613c6857600080fd5b823567ffffffffffffffff80821115613c8057600080fd5b613c8c86838701613bff565b93506020850135915080821115613ca257600080fd5b50613caf85828601613bff565b9150509250929050565b600060208284031215613ccb57600080fd5b5035919050565b60005b83811015613ced578181015183820152602001613cd5565b50506000910152565b60008151808452613d0e816020860160208601613cd2565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000612a0f6020830184613cf6565b60008083601f840112613d6557600080fd5b50813567ffffffffffffffff811115613d7d57600080fd5b6020830191508360208260051b8501011115610f8357600080fd5b60008060208385031215613dab57600080fd5b823567ffffffffffffffff811115613dc257600080fd5b613dce85828601613d53565b90969095509350505050565b600081518084526020808501945080840160005b83811015613e0a57815187529582019590820190600101613dee565b509495945050505050565b600081518084526020808501808196508360051b8101915082860160005b85811015613e715782840389528151805185528501516040868601819052613e5d81870183613cf6565b9a87019a9550505090840190600101613e33565b5091979650505050505050565b600063ffffffff8083511684528060208401511660208501525060ff604083015116604084015260608201511515606084015260808201511515608084015260a082015160e060a0850152613ed660e0850182613dda565b905060c083015184820360c0860152613eef8282613e15565b95945050505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613f6b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452613f59858351613e7e565b94509285019290850190600101613f1f565b5092979650505050505050565b803563ffffffff81168114613f8c57600080fd5b919050565b600060208284031215613fa357600080fd5b612a0f82613f78565b73ffffffffffffffffffffffffffffffffffffffff81511682526000602082015160406020850152613fe16040850182613cf6565b949350505050565b602081526000612a0f6020830184613fac565b602081526000612a0f6020830184613e7e565b6000806040838503121561402257600080fd5b61402b83613f78565b946020939093013593505050565b60408152600061404c6040830185613cf6565b8281036020840152613eef8185613cf6565b63ffffffff815116825260208101516020830152604081015160408301526000606082015160806060850152613fe16080850182613dda565b6040815260006140aa604083018561405e565b905063ffffffff831660208301529392505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613f6b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452614120858351613fac565b945092850192908501906001016140e6565b6000806000806040858703121561414857600080fd5b843567ffffffffffffffff8082111561416057600080fd5b61416c88838901613d53565b9096509450602087013591508082111561418557600080fd5b5061419287828801613d53565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000815160a084526141e260a0850182613cf6565b9050602083015184820360208601526141fb8282613cf6565b9150506040830151600481106142135761421361419e565b604085015260608301516002811061422d5761422d61419e565b606085015260809283015173ffffffffffffffffffffffffffffffffffffffff1692909301919091525090565b602081526000612a0f60208301846141cd565b80151581146129f857600080fd5b803560ff81168114613f8c57600080fd5b60008060008060008060008060c0898b0312156142a857600080fd5b6142b189613f78565b9750602089013567ffffffffffffffff808211156142ce57600080fd5b6142da8c838d01613d53565b909950975060408b01359150808211156142f357600080fd5b506143008b828c01613d53565b90965094505060608901356143148161426d565b925060808901356143248161426d565b915061433260a08a0161427b565b90509295985092959890939650565b600080600080600080600060a0888a03121561435c57600080fd5b873567ffffffffffffffff8082111561437457600080fd5b6143808b838c01613d53565b909950975060208a013591508082111561439957600080fd5b506143a68a828b01613d53565b90965094505060408801356143ba8161426d565b925060608801356143ca8161426d565b91506143d86080890161427b565b905092959891949750929550565b6040815260006143f96040830185613dda565b6020838203818501528185518084528284019150828160051b85010183880160005b83811015614467577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08784030185526144558383516141cd565b9486019492509085019060010161441b565b50909998505050505050505050565b6000604082016040835280855180835260608501915060608160051b8601019250602080880160005b838110156144eb577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08887030185526144d986835161405e565b9550938201939082019060010161449f565b50508584038187015286518085528782019482019350915060005b82811015613e7157845163ffffffff1684529381019392810192600101614506565b803573ffffffffffffffffffffffffffffffffffffffff81168114613f8c57600080fd5b60006020828403121561455e57600080fd5b612a0f82614528565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036145f6576145f6614596565b5060010190565b63ffffffff8281168282160390808211156107a4576107a4614596565b600063ffffffff80831681810361463357614633614596565b6001019392505050565b600181811c9082168061465157607f821691505b60208210810361468a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18336030181126146c457600080fd5b9190910192915050565b6000604082360312156146e057600080fd5b6040516040810167ffffffffffffffff828210818311171561470457614704613aef565b8160405261471185614528565b8352602085013591508082111561472757600080fd5b5061473436828601613bff565b60208301525092915050565b601f82111561064157600081815260208120601f850160051c810160208610156147675750805b601f850160051c820191505b8181101561217557828155600101614773565b815167ffffffffffffffff8111156147a0576147a0613aef565b6147b4816147ae845461463d565b84614740565b602080601f83116001811461480757600084156147d15750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b178555612175565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b8281101561485457888601518255948401946001909101908401614835565b508582101561489057878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b6000602082840312156148b257600080fd5b815167ffffffffffffffff8111156148c957600080fd5b8201601f810184136148da57600080fd5b80516148e8613c1e82613bb9565b8181528560208385010111156148fd57600080fd5b613eef826020830160208601613cd2565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff818336030181126146c457600080fd5b60006080823603121561495457600080fd5b61495c613b1e565b61496583613f78565b81526020808401358183015260408401356040830152606084013567ffffffffffffffff8082111561499657600080fd5b9085019036601f8301126149a957600080fd5b8135818111156149bb576149bb613aef565b8060051b91506149cc848301613b6a565b81815291830184019184810190368411156149e657600080fd5b938501935b83851015614a04578435825293850193908501906149eb565b606087015250939695505050505050565b602081526000612a0f6020830184613dda565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff618336030181126146c457600080fd5b803560028110613f8c57600080fd5b600060a08236031215614a7d57600080fd5b614a85613b47565b823567ffffffffffffffff80821115614a9d57600080fd5b614aa936838701613bff565b83526020850135915080821115614abf57600080fd5b50614acc36828601613bff565b602083015250604083013560048110614ae457600080fd5b6040820152614af560608401614a5c565b6060820152614b0660808401614528565b608082015292915050565b6000602080835260008454614b258161463d565b80848701526040600180841660008114614b465760018114614b7e57614bac565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008516838a01528284151560051b8a01019550614bac565b896000528660002060005b85811015614ba45781548b8201860152908301908801614b89565b8a0184019650505b509398975050505050505050565b8181038181111561047757610477614596565b600060208284031215614bdf57600080fd5b8151612a0f8161426d565b60ff818116838216019081111561047757610477614596565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614c3857600080fd5b83018035915067ffffffffffffffff821115614c5357600080fd5b602001915036819003821315610f8357600080fd5b67ffffffffffffffff831115614c8057614c80613aef565b614c9483614c8e835461463d565b83614740565b6000601f841160018114614ce65760008515614cb05750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b178355614d7c565b6000838152602090207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0861690835b82811015614d355786850135825560209485019460019092019101614d15565b5086821015614d70577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6080815284608082015260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff861115614deb57600080fd5b8560051b808860a0850137820182810360a09081016020850152614e1190820187613cf6565b91505063ffffffff8085166040840152808416606084015250969550505050505056fea164736f6c6343000813000a", -} - -var CapabilityRegistryABI = CapabilityRegistryMetaData.ABI - -var CapabilityRegistryBin = CapabilityRegistryMetaData.Bin - -func DeployCapabilityRegistry(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *CapabilityRegistry, error) { - parsed, err := CapabilityRegistryMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(CapabilityRegistryBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &CapabilityRegistry{address: address, abi: *parsed, CapabilityRegistryCaller: CapabilityRegistryCaller{contract: contract}, CapabilityRegistryTransactor: CapabilityRegistryTransactor{contract: contract}, CapabilityRegistryFilterer: CapabilityRegistryFilterer{contract: contract}}, nil -} - -type CapabilityRegistry struct { - address common.Address - abi abi.ABI - CapabilityRegistryCaller - CapabilityRegistryTransactor - CapabilityRegistryFilterer -} - -type CapabilityRegistryCaller struct { - contract *bind.BoundContract -} - -type CapabilityRegistryTransactor struct { - contract *bind.BoundContract -} - -type CapabilityRegistryFilterer struct { - contract *bind.BoundContract -} - -type CapabilityRegistrySession struct { - Contract *CapabilityRegistry - CallOpts bind.CallOpts - TransactOpts bind.TransactOpts -} - -type CapabilityRegistryCallerSession struct { - Contract *CapabilityRegistryCaller - CallOpts bind.CallOpts -} - -type CapabilityRegistryTransactorSession struct { - Contract *CapabilityRegistryTransactor - TransactOpts bind.TransactOpts -} - -type CapabilityRegistryRaw struct { - Contract *CapabilityRegistry -} - -type CapabilityRegistryCallerRaw struct { - Contract *CapabilityRegistryCaller -} - -type CapabilityRegistryTransactorRaw struct { - Contract *CapabilityRegistryTransactor -} - -func NewCapabilityRegistry(address common.Address, backend bind.ContractBackend) (*CapabilityRegistry, error) { - abi, err := abi.JSON(strings.NewReader(CapabilityRegistryABI)) - if err != nil { - return nil, err - } - contract, err := bindCapabilityRegistry(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &CapabilityRegistry{address: address, abi: abi, CapabilityRegistryCaller: CapabilityRegistryCaller{contract: contract}, CapabilityRegistryTransactor: CapabilityRegistryTransactor{contract: contract}, CapabilityRegistryFilterer: CapabilityRegistryFilterer{contract: contract}}, nil -} - -func NewCapabilityRegistryCaller(address common.Address, caller bind.ContractCaller) (*CapabilityRegistryCaller, error) { - contract, err := bindCapabilityRegistry(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &CapabilityRegistryCaller{contract: contract}, nil -} - -func NewCapabilityRegistryTransactor(address common.Address, transactor bind.ContractTransactor) (*CapabilityRegistryTransactor, error) { - contract, err := bindCapabilityRegistry(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &CapabilityRegistryTransactor{contract: contract}, nil -} - -func NewCapabilityRegistryFilterer(address common.Address, filterer bind.ContractFilterer) (*CapabilityRegistryFilterer, error) { - contract, err := bindCapabilityRegistry(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &CapabilityRegistryFilterer{contract: contract}, nil -} - -func bindCapabilityRegistry(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := CapabilityRegistryMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -func (_CapabilityRegistry *CapabilityRegistryRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _CapabilityRegistry.Contract.CapabilityRegistryCaller.contract.Call(opts, result, method, params...) -} - -func (_CapabilityRegistry *CapabilityRegistryRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.CapabilityRegistryTransactor.contract.Transfer(opts) -} - -func (_CapabilityRegistry *CapabilityRegistryRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.CapabilityRegistryTransactor.contract.Transact(opts, method, params...) -} - -func (_CapabilityRegistry *CapabilityRegistryCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _CapabilityRegistry.Contract.contract.Call(opts, result, method, params...) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.contract.Transfer(opts) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.contract.Transact(opts, method, params...) -} - -func (_CapabilityRegistry *CapabilityRegistryCaller) GetCapabilities(opts *bind.CallOpts) (GetCapabilities, - - error) { - var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "getCapabilities") - - outstruct := new(GetCapabilities) - if err != nil { - return *outstruct, err - } - - outstruct.HashedCapabilityIds = *abi.ConvertType(out[0], new([][32]byte)).(*[][32]byte) - outstruct.Capabilities = *abi.ConvertType(out[1], new([]CapabilityRegistryCapability)).(*[]CapabilityRegistryCapability) - - return *outstruct, err - -} - -func (_CapabilityRegistry *CapabilityRegistrySession) GetCapabilities() (GetCapabilities, - - error) { - return _CapabilityRegistry.Contract.GetCapabilities(&_CapabilityRegistry.CallOpts) -} - -func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetCapabilities() (GetCapabilities, - - error) { - return _CapabilityRegistry.Contract.GetCapabilities(&_CapabilityRegistry.CallOpts) -} - -func (_CapabilityRegistry *CapabilityRegistryCaller) GetCapability(opts *bind.CallOpts, hashedId [32]byte) (CapabilityRegistryCapability, error) { - var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "getCapability", hashedId) - - if err != nil { - return *new(CapabilityRegistryCapability), err - } - - out0 := *abi.ConvertType(out[0], new(CapabilityRegistryCapability)).(*CapabilityRegistryCapability) - - return out0, err - -} - -func (_CapabilityRegistry *CapabilityRegistrySession) GetCapability(hashedId [32]byte) (CapabilityRegistryCapability, error) { - return _CapabilityRegistry.Contract.GetCapability(&_CapabilityRegistry.CallOpts, hashedId) -} - -func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetCapability(hashedId [32]byte) (CapabilityRegistryCapability, error) { - return _CapabilityRegistry.Contract.GetCapability(&_CapabilityRegistry.CallOpts, hashedId) -} - -func (_CapabilityRegistry *CapabilityRegistryCaller) GetCapabilityConfigs(opts *bind.CallOpts, donId uint32, capabilityId [32]byte) ([]byte, []byte, error) { - var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "getCapabilityConfigs", donId, capabilityId) - - if err != nil { - return *new([]byte), *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - out1 := *abi.ConvertType(out[1], new([]byte)).(*[]byte) - - return out0, out1, err - -} - -func (_CapabilityRegistry *CapabilityRegistrySession) GetCapabilityConfigs(donId uint32, capabilityId [32]byte) ([]byte, []byte, error) { - return _CapabilityRegistry.Contract.GetCapabilityConfigs(&_CapabilityRegistry.CallOpts, donId, capabilityId) -} - -func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetCapabilityConfigs(donId uint32, capabilityId [32]byte) ([]byte, []byte, error) { - return _CapabilityRegistry.Contract.GetCapabilityConfigs(&_CapabilityRegistry.CallOpts, donId, capabilityId) -} - -func (_CapabilityRegistry *CapabilityRegistryCaller) GetDON(opts *bind.CallOpts, donId uint32) (CapabilityRegistryDONInfo, error) { - var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "getDON", donId) - - if err != nil { - return *new(CapabilityRegistryDONInfo), err - } - - out0 := *abi.ConvertType(out[0], new(CapabilityRegistryDONInfo)).(*CapabilityRegistryDONInfo) - - return out0, err - -} - -func (_CapabilityRegistry *CapabilityRegistrySession) GetDON(donId uint32) (CapabilityRegistryDONInfo, error) { - return _CapabilityRegistry.Contract.GetDON(&_CapabilityRegistry.CallOpts, donId) -} - -func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetDON(donId uint32) (CapabilityRegistryDONInfo, error) { - return _CapabilityRegistry.Contract.GetDON(&_CapabilityRegistry.CallOpts, donId) -} - -func (_CapabilityRegistry *CapabilityRegistryCaller) GetDONs(opts *bind.CallOpts) ([]CapabilityRegistryDONInfo, error) { - var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "getDONs") - - if err != nil { - return *new([]CapabilityRegistryDONInfo), err - } - - out0 := *abi.ConvertType(out[0], new([]CapabilityRegistryDONInfo)).(*[]CapabilityRegistryDONInfo) - - return out0, err - -} - -func (_CapabilityRegistry *CapabilityRegistrySession) GetDONs() ([]CapabilityRegistryDONInfo, error) { - return _CapabilityRegistry.Contract.GetDONs(&_CapabilityRegistry.CallOpts) -} - -func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetDONs() ([]CapabilityRegistryDONInfo, error) { - return _CapabilityRegistry.Contract.GetDONs(&_CapabilityRegistry.CallOpts) -} - -func (_CapabilityRegistry *CapabilityRegistryCaller) GetHashedCapabilityId(opts *bind.CallOpts, labelledName string, version string) ([32]byte, error) { - var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "getHashedCapabilityId", labelledName, version) - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -func (_CapabilityRegistry *CapabilityRegistrySession) GetHashedCapabilityId(labelledName string, version string) ([32]byte, error) { - return _CapabilityRegistry.Contract.GetHashedCapabilityId(&_CapabilityRegistry.CallOpts, labelledName, version) -} - -func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetHashedCapabilityId(labelledName string, version string) ([32]byte, error) { - return _CapabilityRegistry.Contract.GetHashedCapabilityId(&_CapabilityRegistry.CallOpts, labelledName, version) -} - -func (_CapabilityRegistry *CapabilityRegistryCaller) GetNode(opts *bind.CallOpts, p2pId [32]byte) (CapabilityRegistryNodeInfo, uint32, error) { - var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "getNode", p2pId) - - if err != nil { - return *new(CapabilityRegistryNodeInfo), *new(uint32), err - } - - out0 := *abi.ConvertType(out[0], new(CapabilityRegistryNodeInfo)).(*CapabilityRegistryNodeInfo) - out1 := *abi.ConvertType(out[1], new(uint32)).(*uint32) - - return out0, out1, err - -} - -func (_CapabilityRegistry *CapabilityRegistrySession) GetNode(p2pId [32]byte) (CapabilityRegistryNodeInfo, uint32, error) { - return _CapabilityRegistry.Contract.GetNode(&_CapabilityRegistry.CallOpts, p2pId) -} - -func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetNode(p2pId [32]byte) (CapabilityRegistryNodeInfo, uint32, error) { - return _CapabilityRegistry.Contract.GetNode(&_CapabilityRegistry.CallOpts, p2pId) -} - -func (_CapabilityRegistry *CapabilityRegistryCaller) GetNodeOperator(opts *bind.CallOpts, nodeOperatorId uint32) (CapabilityRegistryNodeOperator, error) { - var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "getNodeOperator", nodeOperatorId) - - if err != nil { - return *new(CapabilityRegistryNodeOperator), err - } - - out0 := *abi.ConvertType(out[0], new(CapabilityRegistryNodeOperator)).(*CapabilityRegistryNodeOperator) - - return out0, err - -} - -func (_CapabilityRegistry *CapabilityRegistrySession) GetNodeOperator(nodeOperatorId uint32) (CapabilityRegistryNodeOperator, error) { - return _CapabilityRegistry.Contract.GetNodeOperator(&_CapabilityRegistry.CallOpts, nodeOperatorId) -} - -func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetNodeOperator(nodeOperatorId uint32) (CapabilityRegistryNodeOperator, error) { - return _CapabilityRegistry.Contract.GetNodeOperator(&_CapabilityRegistry.CallOpts, nodeOperatorId) -} - -func (_CapabilityRegistry *CapabilityRegistryCaller) GetNodeOperators(opts *bind.CallOpts) ([]CapabilityRegistryNodeOperator, error) { - var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "getNodeOperators") - - if err != nil { - return *new([]CapabilityRegistryNodeOperator), err - } - - out0 := *abi.ConvertType(out[0], new([]CapabilityRegistryNodeOperator)).(*[]CapabilityRegistryNodeOperator) - - return out0, err - -} - -func (_CapabilityRegistry *CapabilityRegistrySession) GetNodeOperators() ([]CapabilityRegistryNodeOperator, error) { - return _CapabilityRegistry.Contract.GetNodeOperators(&_CapabilityRegistry.CallOpts) -} - -func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetNodeOperators() ([]CapabilityRegistryNodeOperator, error) { - return _CapabilityRegistry.Contract.GetNodeOperators(&_CapabilityRegistry.CallOpts) -} - -func (_CapabilityRegistry *CapabilityRegistryCaller) GetNodes(opts *bind.CallOpts) (GetNodes, - - error) { - var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "getNodes") - - outstruct := new(GetNodes) - if err != nil { - return *outstruct, err - } - - outstruct.NodeInfo = *abi.ConvertType(out[0], new([]CapabilityRegistryNodeInfo)).(*[]CapabilityRegistryNodeInfo) - outstruct.ConfigCounts = *abi.ConvertType(out[1], new([]uint32)).(*[]uint32) - - return *outstruct, err - -} - -func (_CapabilityRegistry *CapabilityRegistrySession) GetNodes() (GetNodes, - - error) { - return _CapabilityRegistry.Contract.GetNodes(&_CapabilityRegistry.CallOpts) -} - -func (_CapabilityRegistry *CapabilityRegistryCallerSession) GetNodes() (GetNodes, - - error) { - return _CapabilityRegistry.Contract.GetNodes(&_CapabilityRegistry.CallOpts) -} - -func (_CapabilityRegistry *CapabilityRegistryCaller) IsCapabilityDeprecated(opts *bind.CallOpts, hashedCapabilityId [32]byte) (bool, error) { - var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "isCapabilityDeprecated", hashedCapabilityId) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -func (_CapabilityRegistry *CapabilityRegistrySession) IsCapabilityDeprecated(hashedCapabilityId [32]byte) (bool, error) { - return _CapabilityRegistry.Contract.IsCapabilityDeprecated(&_CapabilityRegistry.CallOpts, hashedCapabilityId) -} - -func (_CapabilityRegistry *CapabilityRegistryCallerSession) IsCapabilityDeprecated(hashedCapabilityId [32]byte) (bool, error) { - return _CapabilityRegistry.Contract.IsCapabilityDeprecated(&_CapabilityRegistry.CallOpts, hashedCapabilityId) -} - -func (_CapabilityRegistry *CapabilityRegistryCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -func (_CapabilityRegistry *CapabilityRegistrySession) Owner() (common.Address, error) { - return _CapabilityRegistry.Contract.Owner(&_CapabilityRegistry.CallOpts) -} - -func (_CapabilityRegistry *CapabilityRegistryCallerSession) Owner() (common.Address, error) { - return _CapabilityRegistry.Contract.Owner(&_CapabilityRegistry.CallOpts) -} - -func (_CapabilityRegistry *CapabilityRegistryCaller) TypeAndVersion(opts *bind.CallOpts) (string, error) { - var out []interface{} - err := _CapabilityRegistry.contract.Call(opts, &out, "typeAndVersion") - - if err != nil { - return *new(string), err - } - - out0 := *abi.ConvertType(out[0], new(string)).(*string) - - return out0, err - -} - -func (_CapabilityRegistry *CapabilityRegistrySession) TypeAndVersion() (string, error) { - return _CapabilityRegistry.Contract.TypeAndVersion(&_CapabilityRegistry.CallOpts) -} - -func (_CapabilityRegistry *CapabilityRegistryCallerSession) TypeAndVersion() (string, error) { - return _CapabilityRegistry.Contract.TypeAndVersion(&_CapabilityRegistry.CallOpts) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactor) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _CapabilityRegistry.contract.Transact(opts, "acceptOwnership") -} - -func (_CapabilityRegistry *CapabilityRegistrySession) AcceptOwnership() (*types.Transaction, error) { - return _CapabilityRegistry.Contract.AcceptOwnership(&_CapabilityRegistry.TransactOpts) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorSession) AcceptOwnership() (*types.Transaction, error) { - return _CapabilityRegistry.Contract.AcceptOwnership(&_CapabilityRegistry.TransactOpts) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactor) AddCapabilities(opts *bind.TransactOpts, capabilities []CapabilityRegistryCapability) (*types.Transaction, error) { - return _CapabilityRegistry.contract.Transact(opts, "addCapabilities", capabilities) -} - -func (_CapabilityRegistry *CapabilityRegistrySession) AddCapabilities(capabilities []CapabilityRegistryCapability) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.AddCapabilities(&_CapabilityRegistry.TransactOpts, capabilities) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorSession) AddCapabilities(capabilities []CapabilityRegistryCapability) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.AddCapabilities(&_CapabilityRegistry.TransactOpts, capabilities) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactor) AddDON(opts *bind.TransactOpts, nodes [][32]byte, capabilityConfigurations []CapabilityRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) { - return _CapabilityRegistry.contract.Transact(opts, "addDON", nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) -} - -func (_CapabilityRegistry *CapabilityRegistrySession) AddDON(nodes [][32]byte, capabilityConfigurations []CapabilityRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.AddDON(&_CapabilityRegistry.TransactOpts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorSession) AddDON(nodes [][32]byte, capabilityConfigurations []CapabilityRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.AddDON(&_CapabilityRegistry.TransactOpts, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactor) AddNodeOperators(opts *bind.TransactOpts, nodeOperators []CapabilityRegistryNodeOperator) (*types.Transaction, error) { - return _CapabilityRegistry.contract.Transact(opts, "addNodeOperators", nodeOperators) -} - -func (_CapabilityRegistry *CapabilityRegistrySession) AddNodeOperators(nodeOperators []CapabilityRegistryNodeOperator) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.AddNodeOperators(&_CapabilityRegistry.TransactOpts, nodeOperators) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorSession) AddNodeOperators(nodeOperators []CapabilityRegistryNodeOperator) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.AddNodeOperators(&_CapabilityRegistry.TransactOpts, nodeOperators) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactor) AddNodes(opts *bind.TransactOpts, nodes []CapabilityRegistryNodeInfo) (*types.Transaction, error) { - return _CapabilityRegistry.contract.Transact(opts, "addNodes", nodes) -} - -func (_CapabilityRegistry *CapabilityRegistrySession) AddNodes(nodes []CapabilityRegistryNodeInfo) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.AddNodes(&_CapabilityRegistry.TransactOpts, nodes) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorSession) AddNodes(nodes []CapabilityRegistryNodeInfo) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.AddNodes(&_CapabilityRegistry.TransactOpts, nodes) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactor) DeprecateCapabilities(opts *bind.TransactOpts, hashedCapabilityIds [][32]byte) (*types.Transaction, error) { - return _CapabilityRegistry.contract.Transact(opts, "deprecateCapabilities", hashedCapabilityIds) -} - -func (_CapabilityRegistry *CapabilityRegistrySession) DeprecateCapabilities(hashedCapabilityIds [][32]byte) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.DeprecateCapabilities(&_CapabilityRegistry.TransactOpts, hashedCapabilityIds) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorSession) DeprecateCapabilities(hashedCapabilityIds [][32]byte) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.DeprecateCapabilities(&_CapabilityRegistry.TransactOpts, hashedCapabilityIds) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactor) RemoveDONs(opts *bind.TransactOpts, donIds []uint32) (*types.Transaction, error) { - return _CapabilityRegistry.contract.Transact(opts, "removeDONs", donIds) -} - -func (_CapabilityRegistry *CapabilityRegistrySession) RemoveDONs(donIds []uint32) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.RemoveDONs(&_CapabilityRegistry.TransactOpts, donIds) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorSession) RemoveDONs(donIds []uint32) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.RemoveDONs(&_CapabilityRegistry.TransactOpts, donIds) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactor) RemoveNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []uint32) (*types.Transaction, error) { - return _CapabilityRegistry.contract.Transact(opts, "removeNodeOperators", nodeOperatorIds) -} - -func (_CapabilityRegistry *CapabilityRegistrySession) RemoveNodeOperators(nodeOperatorIds []uint32) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.RemoveNodeOperators(&_CapabilityRegistry.TransactOpts, nodeOperatorIds) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorSession) RemoveNodeOperators(nodeOperatorIds []uint32) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.RemoveNodeOperators(&_CapabilityRegistry.TransactOpts, nodeOperatorIds) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactor) RemoveNodes(opts *bind.TransactOpts, removedNodeP2PIds [][32]byte) (*types.Transaction, error) { - return _CapabilityRegistry.contract.Transact(opts, "removeNodes", removedNodeP2PIds) -} - -func (_CapabilityRegistry *CapabilityRegistrySession) RemoveNodes(removedNodeP2PIds [][32]byte) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.RemoveNodes(&_CapabilityRegistry.TransactOpts, removedNodeP2PIds) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorSession) RemoveNodes(removedNodeP2PIds [][32]byte) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.RemoveNodes(&_CapabilityRegistry.TransactOpts, removedNodeP2PIds) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactor) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - return _CapabilityRegistry.contract.Transact(opts, "transferOwnership", to) -} - -func (_CapabilityRegistry *CapabilityRegistrySession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.TransferOwnership(&_CapabilityRegistry.TransactOpts, to) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.TransferOwnership(&_CapabilityRegistry.TransactOpts, to) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactor) UpdateDON(opts *bind.TransactOpts, donId uint32, nodes [][32]byte, capabilityConfigurations []CapabilityRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) { - return _CapabilityRegistry.contract.Transact(opts, "updateDON", donId, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) -} - -func (_CapabilityRegistry *CapabilityRegistrySession) UpdateDON(donId uint32, nodes [][32]byte, capabilityConfigurations []CapabilityRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.UpdateDON(&_CapabilityRegistry.TransactOpts, donId, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorSession) UpdateDON(donId uint32, nodes [][32]byte, capabilityConfigurations []CapabilityRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.UpdateDON(&_CapabilityRegistry.TransactOpts, donId, nodes, capabilityConfigurations, isPublic, acceptsWorkflows, f) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactor) UpdateNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []uint32, nodeOperators []CapabilityRegistryNodeOperator) (*types.Transaction, error) { - return _CapabilityRegistry.contract.Transact(opts, "updateNodeOperators", nodeOperatorIds, nodeOperators) -} - -func (_CapabilityRegistry *CapabilityRegistrySession) UpdateNodeOperators(nodeOperatorIds []uint32, nodeOperators []CapabilityRegistryNodeOperator) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.UpdateNodeOperators(&_CapabilityRegistry.TransactOpts, nodeOperatorIds, nodeOperators) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorSession) UpdateNodeOperators(nodeOperatorIds []uint32, nodeOperators []CapabilityRegistryNodeOperator) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.UpdateNodeOperators(&_CapabilityRegistry.TransactOpts, nodeOperatorIds, nodeOperators) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactor) UpdateNodes(opts *bind.TransactOpts, nodes []CapabilityRegistryNodeInfo) (*types.Transaction, error) { - return _CapabilityRegistry.contract.Transact(opts, "updateNodes", nodes) -} - -func (_CapabilityRegistry *CapabilityRegistrySession) UpdateNodes(nodes []CapabilityRegistryNodeInfo) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.UpdateNodes(&_CapabilityRegistry.TransactOpts, nodes) -} - -func (_CapabilityRegistry *CapabilityRegistryTransactorSession) UpdateNodes(nodes []CapabilityRegistryNodeInfo) (*types.Transaction, error) { - return _CapabilityRegistry.Contract.UpdateNodes(&_CapabilityRegistry.TransactOpts, nodes) -} - -type CapabilityRegistryCapabilityConfiguredIterator struct { - Event *CapabilityRegistryCapabilityConfigured - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *CapabilityRegistryCapabilityConfiguredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryCapabilityConfigured) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryCapabilityConfigured) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *CapabilityRegistryCapabilityConfiguredIterator) Error() error { - return it.fail -} - -func (it *CapabilityRegistryCapabilityConfiguredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type CapabilityRegistryCapabilityConfigured struct { - HashedCapabilityId [32]byte - Raw types.Log -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterCapabilityConfigured(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*CapabilityRegistryCapabilityConfiguredIterator, error) { - - var hashedCapabilityIdRule []interface{} - for _, hashedCapabilityIdItem := range hashedCapabilityId { - hashedCapabilityIdRule = append(hashedCapabilityIdRule, hashedCapabilityIdItem) - } - - logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "CapabilityConfigured", hashedCapabilityIdRule) - if err != nil { - return nil, err - } - return &CapabilityRegistryCapabilityConfiguredIterator{contract: _CapabilityRegistry.contract, event: "CapabilityConfigured", logs: logs, sub: sub}, nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchCapabilityConfigured(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryCapabilityConfigured, hashedCapabilityId [][32]byte) (event.Subscription, error) { - - var hashedCapabilityIdRule []interface{} - for _, hashedCapabilityIdItem := range hashedCapabilityId { - hashedCapabilityIdRule = append(hashedCapabilityIdRule, hashedCapabilityIdItem) - } - - logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "CapabilityConfigured", hashedCapabilityIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(CapabilityRegistryCapabilityConfigured) - if err := _CapabilityRegistry.contract.UnpackLog(event, "CapabilityConfigured", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) ParseCapabilityConfigured(log types.Log) (*CapabilityRegistryCapabilityConfigured, error) { - event := new(CapabilityRegistryCapabilityConfigured) - if err := _CapabilityRegistry.contract.UnpackLog(event, "CapabilityConfigured", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type CapabilityRegistryCapabilityDeprecatedIterator struct { - Event *CapabilityRegistryCapabilityDeprecated - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *CapabilityRegistryCapabilityDeprecatedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryCapabilityDeprecated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryCapabilityDeprecated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *CapabilityRegistryCapabilityDeprecatedIterator) Error() error { - return it.fail -} - -func (it *CapabilityRegistryCapabilityDeprecatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type CapabilityRegistryCapabilityDeprecated struct { - HashedCapabilityId [32]byte - Raw types.Log -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterCapabilityDeprecated(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*CapabilityRegistryCapabilityDeprecatedIterator, error) { - - var hashedCapabilityIdRule []interface{} - for _, hashedCapabilityIdItem := range hashedCapabilityId { - hashedCapabilityIdRule = append(hashedCapabilityIdRule, hashedCapabilityIdItem) - } - - logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "CapabilityDeprecated", hashedCapabilityIdRule) - if err != nil { - return nil, err - } - return &CapabilityRegistryCapabilityDeprecatedIterator{contract: _CapabilityRegistry.contract, event: "CapabilityDeprecated", logs: logs, sub: sub}, nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchCapabilityDeprecated(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryCapabilityDeprecated, hashedCapabilityId [][32]byte) (event.Subscription, error) { - - var hashedCapabilityIdRule []interface{} - for _, hashedCapabilityIdItem := range hashedCapabilityId { - hashedCapabilityIdRule = append(hashedCapabilityIdRule, hashedCapabilityIdItem) - } - - logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "CapabilityDeprecated", hashedCapabilityIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(CapabilityRegistryCapabilityDeprecated) - if err := _CapabilityRegistry.contract.UnpackLog(event, "CapabilityDeprecated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) ParseCapabilityDeprecated(log types.Log) (*CapabilityRegistryCapabilityDeprecated, error) { - event := new(CapabilityRegistryCapabilityDeprecated) - if err := _CapabilityRegistry.contract.UnpackLog(event, "CapabilityDeprecated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type CapabilityRegistryConfigSetIterator struct { - Event *CapabilityRegistryConfigSet - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *CapabilityRegistryConfigSetIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryConfigSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryConfigSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *CapabilityRegistryConfigSetIterator) Error() error { - return it.fail -} - -func (it *CapabilityRegistryConfigSetIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type CapabilityRegistryConfigSet struct { - DonId uint32 - ConfigCount uint32 - Raw types.Log -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterConfigSet(opts *bind.FilterOpts) (*CapabilityRegistryConfigSetIterator, error) { - - logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "ConfigSet") - if err != nil { - return nil, err - } - return &CapabilityRegistryConfigSetIterator{contract: _CapabilityRegistry.contract, event: "ConfigSet", logs: logs, sub: sub}, nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchConfigSet(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryConfigSet) (event.Subscription, error) { - - logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "ConfigSet") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(CapabilityRegistryConfigSet) - if err := _CapabilityRegistry.contract.UnpackLog(event, "ConfigSet", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) ParseConfigSet(log types.Log) (*CapabilityRegistryConfigSet, error) { - event := new(CapabilityRegistryConfigSet) - if err := _CapabilityRegistry.contract.UnpackLog(event, "ConfigSet", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type CapabilityRegistryNodeAddedIterator struct { - Event *CapabilityRegistryNodeAdded - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *CapabilityRegistryNodeAddedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryNodeAdded) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryNodeAdded) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *CapabilityRegistryNodeAddedIterator) Error() error { - return it.fail -} - -func (it *CapabilityRegistryNodeAddedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type CapabilityRegistryNodeAdded struct { - P2pId [32]byte - NodeOperatorId uint32 - Signer [32]byte - Raw types.Log -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterNodeAdded(opts *bind.FilterOpts, nodeOperatorId []uint32) (*CapabilityRegistryNodeAddedIterator, error) { - - var nodeOperatorIdRule []interface{} - for _, nodeOperatorIdItem := range nodeOperatorId { - nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) - } - - logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "NodeAdded", nodeOperatorIdRule) - if err != nil { - return nil, err - } - return &CapabilityRegistryNodeAddedIterator{contract: _CapabilityRegistry.contract, event: "NodeAdded", logs: logs, sub: sub}, nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchNodeAdded(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryNodeAdded, nodeOperatorId []uint32) (event.Subscription, error) { - - var nodeOperatorIdRule []interface{} - for _, nodeOperatorIdItem := range nodeOperatorId { - nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) - } - - logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "NodeAdded", nodeOperatorIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(CapabilityRegistryNodeAdded) - if err := _CapabilityRegistry.contract.UnpackLog(event, "NodeAdded", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) ParseNodeAdded(log types.Log) (*CapabilityRegistryNodeAdded, error) { - event := new(CapabilityRegistryNodeAdded) - if err := _CapabilityRegistry.contract.UnpackLog(event, "NodeAdded", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type CapabilityRegistryNodeOperatorAddedIterator struct { - Event *CapabilityRegistryNodeOperatorAdded - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *CapabilityRegistryNodeOperatorAddedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryNodeOperatorAdded) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryNodeOperatorAdded) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *CapabilityRegistryNodeOperatorAddedIterator) Error() error { - return it.fail -} - -func (it *CapabilityRegistryNodeOperatorAddedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type CapabilityRegistryNodeOperatorAdded struct { - NodeOperatorId uint32 - Admin common.Address - Name string - Raw types.Log -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterNodeOperatorAdded(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address) (*CapabilityRegistryNodeOperatorAddedIterator, error) { - - var nodeOperatorIdRule []interface{} - for _, nodeOperatorIdItem := range nodeOperatorId { - nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) - } - var adminRule []interface{} - for _, adminItem := range admin { - adminRule = append(adminRule, adminItem) - } - - logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "NodeOperatorAdded", nodeOperatorIdRule, adminRule) - if err != nil { - return nil, err - } - return &CapabilityRegistryNodeOperatorAddedIterator{contract: _CapabilityRegistry.contract, event: "NodeOperatorAdded", logs: logs, sub: sub}, nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchNodeOperatorAdded(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryNodeOperatorAdded, nodeOperatorId []uint32, admin []common.Address) (event.Subscription, error) { - - var nodeOperatorIdRule []interface{} - for _, nodeOperatorIdItem := range nodeOperatorId { - nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) - } - var adminRule []interface{} - for _, adminItem := range admin { - adminRule = append(adminRule, adminItem) - } - - logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "NodeOperatorAdded", nodeOperatorIdRule, adminRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(CapabilityRegistryNodeOperatorAdded) - if err := _CapabilityRegistry.contract.UnpackLog(event, "NodeOperatorAdded", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) ParseNodeOperatorAdded(log types.Log) (*CapabilityRegistryNodeOperatorAdded, error) { - event := new(CapabilityRegistryNodeOperatorAdded) - if err := _CapabilityRegistry.contract.UnpackLog(event, "NodeOperatorAdded", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type CapabilityRegistryNodeOperatorRemovedIterator struct { - Event *CapabilityRegistryNodeOperatorRemoved - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *CapabilityRegistryNodeOperatorRemovedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryNodeOperatorRemoved) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryNodeOperatorRemoved) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *CapabilityRegistryNodeOperatorRemovedIterator) Error() error { - return it.fail -} - -func (it *CapabilityRegistryNodeOperatorRemovedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type CapabilityRegistryNodeOperatorRemoved struct { - NodeOperatorId uint32 - Raw types.Log -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterNodeOperatorRemoved(opts *bind.FilterOpts, nodeOperatorId []uint32) (*CapabilityRegistryNodeOperatorRemovedIterator, error) { - - var nodeOperatorIdRule []interface{} - for _, nodeOperatorIdItem := range nodeOperatorId { - nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) - } - - logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "NodeOperatorRemoved", nodeOperatorIdRule) - if err != nil { - return nil, err - } - return &CapabilityRegistryNodeOperatorRemovedIterator{contract: _CapabilityRegistry.contract, event: "NodeOperatorRemoved", logs: logs, sub: sub}, nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchNodeOperatorRemoved(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryNodeOperatorRemoved, nodeOperatorId []uint32) (event.Subscription, error) { - - var nodeOperatorIdRule []interface{} - for _, nodeOperatorIdItem := range nodeOperatorId { - nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) - } - - logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "NodeOperatorRemoved", nodeOperatorIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(CapabilityRegistryNodeOperatorRemoved) - if err := _CapabilityRegistry.contract.UnpackLog(event, "NodeOperatorRemoved", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) ParseNodeOperatorRemoved(log types.Log) (*CapabilityRegistryNodeOperatorRemoved, error) { - event := new(CapabilityRegistryNodeOperatorRemoved) - if err := _CapabilityRegistry.contract.UnpackLog(event, "NodeOperatorRemoved", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type CapabilityRegistryNodeOperatorUpdatedIterator struct { - Event *CapabilityRegistryNodeOperatorUpdated - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *CapabilityRegistryNodeOperatorUpdatedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryNodeOperatorUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryNodeOperatorUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *CapabilityRegistryNodeOperatorUpdatedIterator) Error() error { - return it.fail -} - -func (it *CapabilityRegistryNodeOperatorUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type CapabilityRegistryNodeOperatorUpdated struct { - NodeOperatorId uint32 - Admin common.Address - Name string - Raw types.Log -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterNodeOperatorUpdated(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address) (*CapabilityRegistryNodeOperatorUpdatedIterator, error) { - - var nodeOperatorIdRule []interface{} - for _, nodeOperatorIdItem := range nodeOperatorId { - nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) - } - var adminRule []interface{} - for _, adminItem := range admin { - adminRule = append(adminRule, adminItem) - } - - logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "NodeOperatorUpdated", nodeOperatorIdRule, adminRule) - if err != nil { - return nil, err - } - return &CapabilityRegistryNodeOperatorUpdatedIterator{contract: _CapabilityRegistry.contract, event: "NodeOperatorUpdated", logs: logs, sub: sub}, nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchNodeOperatorUpdated(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryNodeOperatorUpdated, nodeOperatorId []uint32, admin []common.Address) (event.Subscription, error) { - - var nodeOperatorIdRule []interface{} - for _, nodeOperatorIdItem := range nodeOperatorId { - nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) - } - var adminRule []interface{} - for _, adminItem := range admin { - adminRule = append(adminRule, adminItem) - } - - logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "NodeOperatorUpdated", nodeOperatorIdRule, adminRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(CapabilityRegistryNodeOperatorUpdated) - if err := _CapabilityRegistry.contract.UnpackLog(event, "NodeOperatorUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) ParseNodeOperatorUpdated(log types.Log) (*CapabilityRegistryNodeOperatorUpdated, error) { - event := new(CapabilityRegistryNodeOperatorUpdated) - if err := _CapabilityRegistry.contract.UnpackLog(event, "NodeOperatorUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type CapabilityRegistryNodeRemovedIterator struct { - Event *CapabilityRegistryNodeRemoved - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *CapabilityRegistryNodeRemovedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryNodeRemoved) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryNodeRemoved) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *CapabilityRegistryNodeRemovedIterator) Error() error { - return it.fail -} - -func (it *CapabilityRegistryNodeRemovedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type CapabilityRegistryNodeRemoved struct { - P2pId [32]byte - Raw types.Log -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterNodeRemoved(opts *bind.FilterOpts) (*CapabilityRegistryNodeRemovedIterator, error) { - - logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "NodeRemoved") - if err != nil { - return nil, err - } - return &CapabilityRegistryNodeRemovedIterator{contract: _CapabilityRegistry.contract, event: "NodeRemoved", logs: logs, sub: sub}, nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchNodeRemoved(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryNodeRemoved) (event.Subscription, error) { - - logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "NodeRemoved") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(CapabilityRegistryNodeRemoved) - if err := _CapabilityRegistry.contract.UnpackLog(event, "NodeRemoved", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) ParseNodeRemoved(log types.Log) (*CapabilityRegistryNodeRemoved, error) { - event := new(CapabilityRegistryNodeRemoved) - if err := _CapabilityRegistry.contract.UnpackLog(event, "NodeRemoved", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type CapabilityRegistryNodeUpdatedIterator struct { - Event *CapabilityRegistryNodeUpdated - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *CapabilityRegistryNodeUpdatedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryNodeUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryNodeUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *CapabilityRegistryNodeUpdatedIterator) Error() error { - return it.fail -} - -func (it *CapabilityRegistryNodeUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type CapabilityRegistryNodeUpdated struct { - P2pId [32]byte - NodeOperatorId uint32 - Signer [32]byte - Raw types.Log -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterNodeUpdated(opts *bind.FilterOpts, nodeOperatorId []uint32) (*CapabilityRegistryNodeUpdatedIterator, error) { - - var nodeOperatorIdRule []interface{} - for _, nodeOperatorIdItem := range nodeOperatorId { - nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) - } - - logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "NodeUpdated", nodeOperatorIdRule) - if err != nil { - return nil, err - } - return &CapabilityRegistryNodeUpdatedIterator{contract: _CapabilityRegistry.contract, event: "NodeUpdated", logs: logs, sub: sub}, nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchNodeUpdated(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryNodeUpdated, nodeOperatorId []uint32) (event.Subscription, error) { - - var nodeOperatorIdRule []interface{} - for _, nodeOperatorIdItem := range nodeOperatorId { - nodeOperatorIdRule = append(nodeOperatorIdRule, nodeOperatorIdItem) - } - - logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "NodeUpdated", nodeOperatorIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(CapabilityRegistryNodeUpdated) - if err := _CapabilityRegistry.contract.UnpackLog(event, "NodeUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) ParseNodeUpdated(log types.Log) (*CapabilityRegistryNodeUpdated, error) { - event := new(CapabilityRegistryNodeUpdated) - if err := _CapabilityRegistry.contract.UnpackLog(event, "NodeUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type CapabilityRegistryOwnershipTransferRequestedIterator struct { - Event *CapabilityRegistryOwnershipTransferRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *CapabilityRegistryOwnershipTransferRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryOwnershipTransferRequested) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryOwnershipTransferRequested) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *CapabilityRegistryOwnershipTransferRequestedIterator) Error() error { - return it.fail -} - -func (it *CapabilityRegistryOwnershipTransferRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type CapabilityRegistryOwnershipTransferRequested struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*CapabilityRegistryOwnershipTransferRequestedIterator, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return &CapabilityRegistryOwnershipTransferRequestedIterator{contract: _CapabilityRegistry.contract, event: "OwnershipTransferRequested", logs: logs, sub: sub}, nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(CapabilityRegistryOwnershipTransferRequested) - if err := _CapabilityRegistry.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) ParseOwnershipTransferRequested(log types.Log) (*CapabilityRegistryOwnershipTransferRequested, error) { - event := new(CapabilityRegistryOwnershipTransferRequested) - if err := _CapabilityRegistry.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type CapabilityRegistryOwnershipTransferredIterator struct { - Event *CapabilityRegistryOwnershipTransferred - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *CapabilityRegistryOwnershipTransferredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(CapabilityRegistryOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *CapabilityRegistryOwnershipTransferredIterator) Error() error { - return it.fail -} - -func (it *CapabilityRegistryOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type CapabilityRegistryOwnershipTransferred struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*CapabilityRegistryOwnershipTransferredIterator, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _CapabilityRegistry.contract.FilterLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return &CapabilityRegistryOwnershipTransferredIterator{contract: _CapabilityRegistry.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _CapabilityRegistry.contract.WatchLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(CapabilityRegistryOwnershipTransferred) - if err := _CapabilityRegistry.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_CapabilityRegistry *CapabilityRegistryFilterer) ParseOwnershipTransferred(log types.Log) (*CapabilityRegistryOwnershipTransferred, error) { - event := new(CapabilityRegistryOwnershipTransferred) - if err := _CapabilityRegistry.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type GetCapabilities struct { - HashedCapabilityIds [][32]byte - Capabilities []CapabilityRegistryCapability -} -type GetNodes struct { - NodeInfo []CapabilityRegistryNodeInfo - ConfigCounts []uint32 -} - -func (_CapabilityRegistry *CapabilityRegistry) ParseLog(log types.Log) (generated.AbigenLog, error) { - switch log.Topics[0] { - case _CapabilityRegistry.abi.Events["CapabilityConfigured"].ID: - return _CapabilityRegistry.ParseCapabilityConfigured(log) - case _CapabilityRegistry.abi.Events["CapabilityDeprecated"].ID: - return _CapabilityRegistry.ParseCapabilityDeprecated(log) - case _CapabilityRegistry.abi.Events["ConfigSet"].ID: - return _CapabilityRegistry.ParseConfigSet(log) - case _CapabilityRegistry.abi.Events["NodeAdded"].ID: - return _CapabilityRegistry.ParseNodeAdded(log) - case _CapabilityRegistry.abi.Events["NodeOperatorAdded"].ID: - return _CapabilityRegistry.ParseNodeOperatorAdded(log) - case _CapabilityRegistry.abi.Events["NodeOperatorRemoved"].ID: - return _CapabilityRegistry.ParseNodeOperatorRemoved(log) - case _CapabilityRegistry.abi.Events["NodeOperatorUpdated"].ID: - return _CapabilityRegistry.ParseNodeOperatorUpdated(log) - case _CapabilityRegistry.abi.Events["NodeRemoved"].ID: - return _CapabilityRegistry.ParseNodeRemoved(log) - case _CapabilityRegistry.abi.Events["NodeUpdated"].ID: - return _CapabilityRegistry.ParseNodeUpdated(log) - case _CapabilityRegistry.abi.Events["OwnershipTransferRequested"].ID: - return _CapabilityRegistry.ParseOwnershipTransferRequested(log) - case _CapabilityRegistry.abi.Events["OwnershipTransferred"].ID: - return _CapabilityRegistry.ParseOwnershipTransferred(log) - - default: - return nil, fmt.Errorf("abigen wrapper received unknown log topic: %v", log.Topics[0]) - } -} - -func (CapabilityRegistryCapabilityConfigured) Topic() common.Hash { - return common.HexToHash("0x04f0a9bcf3f3a3b42a4d7ca081119755f82ebe43e0d30c8f7292c4fe0dc4a2ae") -} - -func (CapabilityRegistryCapabilityDeprecated) Topic() common.Hash { - return common.HexToHash("0xdcea1b78b6ddc31592a94607d537543fcaafda6cc52d6d5cc7bbfca1422baf21") -} - -func (CapabilityRegistryConfigSet) Topic() common.Hash { - return common.HexToHash("0xf264aae70bf6a9d90e68e0f9b393f4e7fbea67b063b0f336e0b36c1581703651") -} - -func (CapabilityRegistryNodeAdded) Topic() common.Hash { - return common.HexToHash("0x74becb12a5e8fd0e98077d02dfba8f647c9670c9df177e42c2418cf17a636f05") -} - -func (CapabilityRegistryNodeOperatorAdded) Topic() common.Hash { - return common.HexToHash("0x78e94ca80be2c30abc061b99e7eb8583b1254781734b1e3ce339abb57da2fe8e") -} - -func (CapabilityRegistryNodeOperatorRemoved) Topic() common.Hash { - return common.HexToHash("0xa59268ca81d40429e65ccea5385b59cf2d3fc6519371dee92f8eb1dae5107a7a") -} - -func (CapabilityRegistryNodeOperatorUpdated) Topic() common.Hash { - return common.HexToHash("0x86f41145bde5dd7f523305452e4aad3685508c181432ec733d5f345009358a28") -} - -func (CapabilityRegistryNodeRemoved) Topic() common.Hash { - return common.HexToHash("0x5254e609a97bab37b7cc79fe128f85c097bd6015c6e1624ae0ba392eb9753205") -} - -func (CapabilityRegistryNodeUpdated) Topic() common.Hash { - return common.HexToHash("0x4b5b465e22eea0c3d40c30e936643245b80d19b2dcf75788c0699fe8d8db645b") -} - -func (CapabilityRegistryOwnershipTransferRequested) Topic() common.Hash { - return common.HexToHash("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278") -} - -func (CapabilityRegistryOwnershipTransferred) Topic() common.Hash { - return common.HexToHash("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0") -} - -func (_CapabilityRegistry *CapabilityRegistry) Address() common.Address { - return _CapabilityRegistry.address -} - -type CapabilityRegistryInterface interface { - GetCapabilities(opts *bind.CallOpts) (GetCapabilities, - - error) - - GetCapability(opts *bind.CallOpts, hashedId [32]byte) (CapabilityRegistryCapability, error) - - GetCapabilityConfigs(opts *bind.CallOpts, donId uint32, capabilityId [32]byte) ([]byte, []byte, error) - - GetDON(opts *bind.CallOpts, donId uint32) (CapabilityRegistryDONInfo, error) - - GetDONs(opts *bind.CallOpts) ([]CapabilityRegistryDONInfo, error) - - GetHashedCapabilityId(opts *bind.CallOpts, labelledName string, version string) ([32]byte, error) - - GetNode(opts *bind.CallOpts, p2pId [32]byte) (CapabilityRegistryNodeInfo, uint32, error) - - GetNodeOperator(opts *bind.CallOpts, nodeOperatorId uint32) (CapabilityRegistryNodeOperator, error) - - GetNodeOperators(opts *bind.CallOpts) ([]CapabilityRegistryNodeOperator, error) - - GetNodes(opts *bind.CallOpts) (GetNodes, - - error) - - IsCapabilityDeprecated(opts *bind.CallOpts, hashedCapabilityId [32]byte) (bool, error) - - Owner(opts *bind.CallOpts) (common.Address, error) - - TypeAndVersion(opts *bind.CallOpts) (string, error) - - AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) - - AddCapabilities(opts *bind.TransactOpts, capabilities []CapabilityRegistryCapability) (*types.Transaction, error) - - AddDON(opts *bind.TransactOpts, nodes [][32]byte, capabilityConfigurations []CapabilityRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) - - AddNodeOperators(opts *bind.TransactOpts, nodeOperators []CapabilityRegistryNodeOperator) (*types.Transaction, error) - - AddNodes(opts *bind.TransactOpts, nodes []CapabilityRegistryNodeInfo) (*types.Transaction, error) - - DeprecateCapabilities(opts *bind.TransactOpts, hashedCapabilityIds [][32]byte) (*types.Transaction, error) - - RemoveDONs(opts *bind.TransactOpts, donIds []uint32) (*types.Transaction, error) - - RemoveNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []uint32) (*types.Transaction, error) - - RemoveNodes(opts *bind.TransactOpts, removedNodeP2PIds [][32]byte) (*types.Transaction, error) - - TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) - - UpdateDON(opts *bind.TransactOpts, donId uint32, nodes [][32]byte, capabilityConfigurations []CapabilityRegistryCapabilityConfiguration, isPublic bool, acceptsWorkflows bool, f uint8) (*types.Transaction, error) - - UpdateNodeOperators(opts *bind.TransactOpts, nodeOperatorIds []uint32, nodeOperators []CapabilityRegistryNodeOperator) (*types.Transaction, error) - - UpdateNodes(opts *bind.TransactOpts, nodes []CapabilityRegistryNodeInfo) (*types.Transaction, error) - - FilterCapabilityConfigured(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*CapabilityRegistryCapabilityConfiguredIterator, error) - - WatchCapabilityConfigured(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryCapabilityConfigured, hashedCapabilityId [][32]byte) (event.Subscription, error) - - ParseCapabilityConfigured(log types.Log) (*CapabilityRegistryCapabilityConfigured, error) - - FilterCapabilityDeprecated(opts *bind.FilterOpts, hashedCapabilityId [][32]byte) (*CapabilityRegistryCapabilityDeprecatedIterator, error) - - WatchCapabilityDeprecated(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryCapabilityDeprecated, hashedCapabilityId [][32]byte) (event.Subscription, error) - - ParseCapabilityDeprecated(log types.Log) (*CapabilityRegistryCapabilityDeprecated, error) - - FilterConfigSet(opts *bind.FilterOpts) (*CapabilityRegistryConfigSetIterator, error) - - WatchConfigSet(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryConfigSet) (event.Subscription, error) - - ParseConfigSet(log types.Log) (*CapabilityRegistryConfigSet, error) - - FilterNodeAdded(opts *bind.FilterOpts, nodeOperatorId []uint32) (*CapabilityRegistryNodeAddedIterator, error) - - WatchNodeAdded(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryNodeAdded, nodeOperatorId []uint32) (event.Subscription, error) - - ParseNodeAdded(log types.Log) (*CapabilityRegistryNodeAdded, error) - - FilterNodeOperatorAdded(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address) (*CapabilityRegistryNodeOperatorAddedIterator, error) - - WatchNodeOperatorAdded(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryNodeOperatorAdded, nodeOperatorId []uint32, admin []common.Address) (event.Subscription, error) - - ParseNodeOperatorAdded(log types.Log) (*CapabilityRegistryNodeOperatorAdded, error) - - FilterNodeOperatorRemoved(opts *bind.FilterOpts, nodeOperatorId []uint32) (*CapabilityRegistryNodeOperatorRemovedIterator, error) - - WatchNodeOperatorRemoved(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryNodeOperatorRemoved, nodeOperatorId []uint32) (event.Subscription, error) - - ParseNodeOperatorRemoved(log types.Log) (*CapabilityRegistryNodeOperatorRemoved, error) - - FilterNodeOperatorUpdated(opts *bind.FilterOpts, nodeOperatorId []uint32, admin []common.Address) (*CapabilityRegistryNodeOperatorUpdatedIterator, error) - - WatchNodeOperatorUpdated(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryNodeOperatorUpdated, nodeOperatorId []uint32, admin []common.Address) (event.Subscription, error) - - ParseNodeOperatorUpdated(log types.Log) (*CapabilityRegistryNodeOperatorUpdated, error) - - FilterNodeRemoved(opts *bind.FilterOpts) (*CapabilityRegistryNodeRemovedIterator, error) - - WatchNodeRemoved(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryNodeRemoved) (event.Subscription, error) - - ParseNodeRemoved(log types.Log) (*CapabilityRegistryNodeRemoved, error) - - FilterNodeUpdated(opts *bind.FilterOpts, nodeOperatorId []uint32) (*CapabilityRegistryNodeUpdatedIterator, error) - - WatchNodeUpdated(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryNodeUpdated, nodeOperatorId []uint32) (event.Subscription, error) - - ParseNodeUpdated(log types.Log) (*CapabilityRegistryNodeUpdated, error) - - FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*CapabilityRegistryOwnershipTransferRequestedIterator, error) - - WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferRequested(log types.Log) (*CapabilityRegistryOwnershipTransferRequested, error) - - FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*CapabilityRegistryOwnershipTransferredIterator, error) - - WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *CapabilityRegistryOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferred(log types.Log) (*CapabilityRegistryOwnershipTransferred, error) - - ParseLog(log types.Log) (generated.AbigenLog, error) - - Address() common.Address -} diff --git a/core/gethwrappers/keystone/generation/generated-wrapper-dependency-versions-do-not-edit.txt b/core/gethwrappers/keystone/generation/generated-wrapper-dependency-versions-do-not-edit.txt index eca45db5753..1839ed8cb85 100644 --- a/core/gethwrappers/keystone/generation/generated-wrapper-dependency-versions-do-not-edit.txt +++ b/core/gethwrappers/keystone/generation/generated-wrapper-dependency-versions-do-not-edit.txt @@ -1,4 +1,4 @@ GETH_VERSION: 1.13.8 +capabilities_registry: ../../../contracts/solc/v0.8.19/CapabilitiesRegistry/CapabilitiesRegistry.abi ../../../contracts/solc/v0.8.19/CapabilitiesRegistry/CapabilitiesRegistry.bin 010d0b7796300bfe2ab4bc7098d1bebbaf124bd75c5e8e36310dbef8bf532a17 forwarder: ../../../contracts/solc/v0.8.19/KeystoneForwarder/KeystoneForwarder.abi ../../../contracts/solc/v0.8.19/KeystoneForwarder/KeystoneForwarder.bin bd15b7c5cecc87d44cac0b8414627cfb2c0e1cdd554df60a50dcb682f9a05129 -keystone_capability_registry: ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.abi ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.bin cc978f3a11c405f0559cf1d371ed8a1553d9b9975e8b3915a142cc781d280823 ocr3_capability: ../../../contracts/solc/v0.8.19/OCR3Capability/OCR3Capability.abi ../../../contracts/solc/v0.8.19/OCR3Capability/OCR3Capability.bin 144f23145878b95d1672e4919874eddeeaa38ce520d0edbe72c6677e39bb4741 diff --git a/core/gethwrappers/keystone/go_generate.go b/core/gethwrappers/keystone/go_generate.go index 679b678b8f2..e506e5d0bd0 100644 --- a/core/gethwrappers/keystone/go_generate.go +++ b/core/gethwrappers/keystone/go_generate.go @@ -6,4 +6,4 @@ package gethwrappers //go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/KeystoneForwarder/KeystoneForwarder.abi ../../../contracts/solc/v0.8.19/KeystoneForwarder/KeystoneForwarder.bin KeystoneForwarder forwarder //go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/OCR3Capability/OCR3Capability.abi ../../../contracts/solc/v0.8.19/OCR3Capability/OCR3Capability.bin OCR3Capability ocr3_capability -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.abi ../../../contracts/solc/v0.8.19/CapabilityRegistry/CapabilityRegistry.bin CapabilityRegistry keystone_capability_registry +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/CapabilitiesRegistry/CapabilitiesRegistry.abi ../../../contracts/solc/v0.8.19/CapabilitiesRegistry/CapabilitiesRegistry.bin CapabilitiesRegistry capabilities_registry diff --git a/core/scripts/go.mod b/core/scripts/go.mod index a4c4744da88..4da575d57c7 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -24,7 +24,7 @@ require ( github.com/prometheus/client_golang v1.17.0 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614120734-7fa0ab584458 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240617140013-160ae09880da github.com/smartcontractkit/chainlink-vrf v0.0.0-20240222010609-cd67d123c772 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 4c1230e1f41..d44756a8e1d 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1212,8 +1212,8 @@ github.com/smartcontractkit/chain-selectors v1.0.10 h1:t9kJeE6B6G+hKD0GYR4kGJSCq github.com/smartcontractkit/chain-selectors v1.0.10/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8= github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614120734-7fa0ab584458 h1:+7LQmbMNaLXej+0ajbTxUfTt4w/ILODpmrOETQ5rTCI= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614120734-7fa0ab584458/go.mod h1:L32xvCpk84Nglit64OhySPMP1tM3TTBK7Tw0qZl7Sd4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240617140013-160ae09880da h1:s3wq2II/FQ1YNcPWnvp44A7Nc874bkMicrkXNpNNHs4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240617140013-160ae09880da/go.mod h1:L32xvCpk84Nglit64OhySPMP1tM3TTBK7Tw0qZl7Sd4= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d h1:5tgMC5Gi2UAOKZ+m28W8ubjLeR0pQCAcrz6eQ0rW510= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d/go.mod h1:0UNuO3nDt9MFsZPaHJBEUolxVkN0iC69j1ccDp95e8k= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 h1:xFSv8561jsLtF6gYZr/zW2z5qUUAkcFkApin2mnbYTo= diff --git a/core/services/chainlink/relayer_chain_interoperators_test.go b/core/services/chainlink/relayer_chain_interoperators_test.go index c2baa1edcde..5152a042280 100644 --- a/core/services/chainlink/relayer_chain_interoperators_test.go +++ b/core/services/chainlink/relayer_chain_interoperators_test.go @@ -368,6 +368,9 @@ func TestCoreRelayerChainInteroperators(t *testing.T) { expectedChainCnt, expectedNodeCnt = tt.expectedSolanaChainCnt, tt.expectedSolanaNodeCnt case types.NetworkStarkNet: expectedChainCnt, expectedNodeCnt = tt.expectedStarknetChainCnt, tt.expectedStarknetNodeCnt + case types.NetworkAptos: + t.Skip("aptos doesn't need a CoreRelayerChainInteroperator") + default: require.Fail(t, "untested relay network", relayNetwork) } diff --git a/core/services/job/orm.go b/core/services/job/orm.go index 4ef847c6225..d08fce1b85d 100644 --- a/core/services/job/orm.go +++ b/core/services/job/orm.go @@ -600,6 +600,9 @@ func validateKeyStoreMatchForRelay(ctx context.Context, network string, keyStore if err != nil { return errors.Errorf("no Starknet key matching: %q", key) } + case types.NetworkAptos: + // TODO BCI-2953 + return nil } return nil } diff --git a/core/services/ocr2/plugins/mercury/integration_test.go b/core/services/ocr2/plugins/mercury/integration_test.go index 680b05bd4d4..7be5177f765 100644 --- a/core/services/ocr2/plugins/mercury/integration_test.go +++ b/core/services/ocr2/plugins/mercury/integration_test.go @@ -184,15 +184,17 @@ func integration_MercuryV1(t *testing.T) { bootstrapNode := Node{App: appBootstrap, KeyBundle: bootstrapKb} logObservers = append(logObservers, observedLogs) - // Commit blocks to finality depth to ensure LogPoller has finalized blocks to read from - ch, err := bootstrapNode.App.GetRelayers().LegacyEVMChains().Get(testutils.SimulatedChainID.String()) - require.NoError(t, err) - finalityDepth := ch.Config().EVM().FinalityDepth() - for i := 0; i < int(finalityDepth); i++ { - backend.Commit() - } - - fromBlock := int(finalityDepth) // cannot use zero, start from finality depth + // cannot use zero, start from finality depth + fromBlock := func() int { + // Commit blocks to finality depth to ensure LogPoller has finalized blocks to read from + ch, err := bootstrapNode.App.GetRelayers().LegacyEVMChains().Get(testutils.SimulatedChainID.String()) + require.NoError(t, err) + finalityDepth := ch.Config().EVM().FinalityDepth() + for i := 0; i < int(finalityDepth); i++ { + backend.Commit() + } + return int(finalityDepth) + }() // Set up n oracles var ( @@ -225,8 +227,7 @@ func integration_MercuryV1(t *testing.T) { createBridge := func(name string, i int, p *big.Int, borm bridges.ORM) (bridgeName string) { bridge := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - var b []byte - b, err = io.ReadAll(req.Body) + b, err := io.ReadAll(req.Body) require.NoError(t, err) require.Equal(t, `{"data":{"from":"ETH","to":"USD"}}`, string(b)) diff --git a/core/services/ocr2/plugins/ocr2keeper/integration_test.go b/core/services/ocr2/plugins/ocr2keeper/integration_test.go index 1c9c6025391..2ce9ff3d243 100644 --- a/core/services/ocr2/plugins/ocr2keeper/integration_test.go +++ b/core/services/ocr2/plugins/ocr2keeper/integration_test.go @@ -201,6 +201,11 @@ func getUpkeepIdFromTx(t *testing.T, registry *keeper_registry_wrapper2_0.Keeper } func TestIntegration_KeeperPluginBasic(t *testing.T) { + testutils.SkipFlakey(t, "https://smartcontract-it.atlassian.net/browse/AUTO-11072") + runKeeperPluginBasic(t) +} + +func runKeeperPluginBasic(t *testing.T) { g := gomega.NewWithT(t) lggr := logger.TestLogger(t) diff --git a/core/services/relay/evm/chain_writer.go b/core/services/relay/evm/chain_writer.go index 52bea212b51..12c2f2d35f5 100644 --- a/core/services/relay/evm/chain_writer.go +++ b/core/services/relay/evm/chain_writer.go @@ -86,7 +86,7 @@ type chainWriter struct { // Note: The codec that ChainWriter uses to encode the parameters for the contract ABI cannot handle // `nil` values, including for slices. Until the bug is fixed we need to ensure that there are no // `nil` values passed in the request. -func (w *chainWriter) SubmitTransaction(ctx context.Context, contract, method string, args any, transactionID uuid.UUID, toAddress string, meta *commontypes.TxMeta, value big.Int) error { +func (w *chainWriter) SubmitTransaction(ctx context.Context, contract, method string, args any, transactionID string, toAddress string, meta *commontypes.TxMeta, value *big.Int) error { if !common.IsHexAddress(toAddress) { return fmt.Errorf("toAddress is not a valid ethereum address: %v", toAddress) } diff --git a/core/services/relay/evm/evmtesting/run_tests.go b/core/services/relay/evm/evmtesting/run_tests.go index 2c492966729..3058784b30a 100644 --- a/core/services/relay/evm/evmtesting/run_tests.go +++ b/core/services/relay/evm/evmtesting/run_tests.go @@ -39,7 +39,7 @@ func RunChainReaderEvmTests[T TestingT[T]](t T, it *EVMChainReaderInterfaceTeste require.Eventually(t, func() bool { return cr.GetLatestValue(ctx, AnyContractName, triggerWithDynamicTopic, input, output) == nil - }, it.MaxWaitTimeForEvents(), time.Millisecond*10) + }, it.MaxWaitTimeForEvents(), 100*time.Millisecond) assert.Equal(t, &anyString, rOutput.FieldByName("Field").Interface()) topic, err := abi.MakeTopics([]any{anyString}) diff --git a/core/services/standardcapabilities/standard_capabilities.go b/core/services/standardcapabilities/standard_capabilities.go index 67ee8e10902..a8d007d5df8 100644 --- a/core/services/standardcapabilities/standard_capabilities.go +++ b/core/services/standardcapabilities/standard_capabilities.go @@ -14,15 +14,15 @@ import ( type standardCapabilities struct { services.StateMachine - log logger.Logger - spec *job.StandardCapabilitiesSpec - pluginRegistrar plugins.RegistrarConfig - telemetryService core.TelemetryService - store core.KeyValueStore - capabilityRegistry core.CapabilitiesRegistry - errorLog core.ErrorLog - pipelineRunner core.PipelineRunnerService - relayerSet core.RelayerSet + log logger.Logger + spec *job.StandardCapabilitiesSpec + pluginRegistrar plugins.RegistrarConfig + telemetryService core.TelemetryService + store core.KeyValueStore + CapabilitiesRegistry core.CapabilitiesRegistry + errorLog core.ErrorLog + pipelineRunner core.PipelineRunnerService + relayerSet core.RelayerSet capabilitiesLoop *loop.StandardCapabilitiesService } @@ -31,20 +31,20 @@ func newStandardCapabilities(log logger.Logger, spec *job.StandardCapabilitiesSp pluginRegistrar plugins.RegistrarConfig, telemetryService core.TelemetryService, store core.KeyValueStore, - capabilityRegistry core.CapabilitiesRegistry, + CapabilitiesRegistry core.CapabilitiesRegistry, errorLog core.ErrorLog, pipelineRunner core.PipelineRunnerService, relayerSet core.RelayerSet) *standardCapabilities { return &standardCapabilities{ - log: log, - spec: spec, - pluginRegistrar: pluginRegistrar, - telemetryService: telemetryService, - store: store, - capabilityRegistry: capabilityRegistry, - errorLog: errorLog, - pipelineRunner: pipelineRunner, - relayerSet: relayerSet, + log: log, + spec: spec, + pluginRegistrar: pluginRegistrar, + telemetryService: telemetryService, + store: store, + CapabilitiesRegistry: CapabilitiesRegistry, + errorLog: errorLog, + pipelineRunner: pipelineRunner, + relayerSet: relayerSet, } } @@ -72,7 +72,7 @@ func (s *standardCapabilities) Start(ctx context.Context) error { return fmt.Errorf("error waiting for standard capabilities service to start: %v", err) } - if err = s.capabilitiesLoop.Service.Initialise(ctx, s.spec.Config, s.telemetryService, s.store, s.capabilityRegistry, s.errorLog, + if err = s.capabilitiesLoop.Service.Initialise(ctx, s.spec.Config, s.telemetryService, s.store, s.CapabilitiesRegistry, s.errorLog, s.pipelineRunner, s.relayerSet); err != nil { return fmt.Errorf("error initialising standard capabilities service: %v", err) } diff --git a/go.md b/go.md index dd17f5207bd..dda7192c1a1 100644 --- a/go.md +++ b/go.md @@ -3,9 +3,13 @@ flowchart LR subgraph chains chainlink-cosmos - chainlink-evm chainlink-solana chainlink-starknet/relayer + subgraph chainlink-integrations + direction LR + chainlink-integrations/evm/relayer + chainlink-integrations/common + end end subgraph products diff --git a/go.mod b/go.mod index 0ddf7caf26d..00d3a167d2e 100644 --- a/go.mod +++ b/go.mod @@ -72,7 +72,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chain-selectors v1.0.10 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614120734-7fa0ab584458 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240617140013-160ae09880da github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240522213638-159fb2d99917 diff --git a/go.sum b/go.sum index e9dc9d81303..c479b1a5e8c 100644 --- a/go.sum +++ b/go.sum @@ -1171,8 +1171,8 @@ github.com/smartcontractkit/chain-selectors v1.0.10 h1:t9kJeE6B6G+hKD0GYR4kGJSCq github.com/smartcontractkit/chain-selectors v1.0.10/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8= github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614120734-7fa0ab584458 h1:+7LQmbMNaLXej+0ajbTxUfTt4w/ILODpmrOETQ5rTCI= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614120734-7fa0ab584458/go.mod h1:L32xvCpk84Nglit64OhySPMP1tM3TTBK7Tw0qZl7Sd4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240617140013-160ae09880da h1:s3wq2II/FQ1YNcPWnvp44A7Nc874bkMicrkXNpNNHs4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240617140013-160ae09880da/go.mod h1:L32xvCpk84Nglit64OhySPMP1tM3TTBK7Tw0qZl7Sd4= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d h1:5tgMC5Gi2UAOKZ+m28W8ubjLeR0pQCAcrz6eQ0rW510= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d/go.mod h1:0UNuO3nDt9MFsZPaHJBEUolxVkN0iC69j1ccDp95e8k= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 h1:xFSv8561jsLtF6gYZr/zW2z5qUUAkcFkApin2mnbYTo= diff --git a/integration-tests/Makefile b/integration-tests/Makefile index af3307dd395..5b3b3a2aae2 100644 --- a/integration-tests/Makefile +++ b/integration-tests/Makefile @@ -158,6 +158,16 @@ test_soak_ocr_reorg_2: . ./scripts/check_base64_env_var.sh go test -v -count=1 -run ^TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled$$ ./soak +.PHONY: test_soak_ocr_gas_spike +test_soak_ocr_gas_spike: + . ./scripts/check_base64_env_var.sh + go test -v -count=1 -run ^TestOCRSoak_GasSpike$$ ./soak + +.PHONY: test_soak_ocr_gas_limit_change +test_soak_ocr_gas_limit_change: + . ./scripts/check_base64_env_var.sh + go test -v -count=1 -run ^TestOCRSoak_ChangeBlockGasLimit$$ ./soak + .PHONY: test_soak_forwarder_ocr test_soak_forwarder_ocr: . ./scripts/check_base64_env_var.sh diff --git a/integration-tests/go.mod b/integration-tests/go.mod index f0991c1f715..a4cef0a8dad 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -27,8 +27,8 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614120734-7fa0ab584458 - github.com/smartcontractkit/chainlink-testing-framework v1.30.5 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240617140013-160ae09880da + github.com/smartcontractkit/chainlink-testing-framework v1.30.9 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c @@ -50,7 +50,6 @@ require ( exclude github.com/hashicorp/consul v1.2.1 replace ( - // Pin K8s versions as their updates are highly disruptive and go mod keeps wanting to update them k8s.io/api => k8s.io/api v0.25.11 k8s.io/client-go => k8s.io/client-go v0.25.11 k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20230303024457-afdc3dddf62d diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 016fca4c4a9..56792b551cf 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1512,8 +1512,8 @@ github.com/smartcontractkit/chain-selectors v1.0.10 h1:t9kJeE6B6G+hKD0GYR4kGJSCq github.com/smartcontractkit/chain-selectors v1.0.10/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8= github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614120734-7fa0ab584458 h1:+7LQmbMNaLXej+0ajbTxUfTt4w/ILODpmrOETQ5rTCI= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614120734-7fa0ab584458/go.mod h1:L32xvCpk84Nglit64OhySPMP1tM3TTBK7Tw0qZl7Sd4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240617140013-160ae09880da h1:s3wq2II/FQ1YNcPWnvp44A7Nc874bkMicrkXNpNNHs4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240617140013-160ae09880da/go.mod h1:L32xvCpk84Nglit64OhySPMP1tM3TTBK7Tw0qZl7Sd4= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d h1:5tgMC5Gi2UAOKZ+m28W8ubjLeR0pQCAcrz6eQ0rW510= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d/go.mod h1:0UNuO3nDt9MFsZPaHJBEUolxVkN0iC69j1ccDp95e8k= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 h1:xFSv8561jsLtF6gYZr/zW2z5qUUAkcFkApin2mnbYTo= @@ -1524,8 +1524,8 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240605170242-555ff582f36 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240605170242-555ff582f36a/go.mod h1:QqcZSwLgEIn7YraAIRmomnBMAuVFephiHrIWVlkWbFI= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240531021326-99118e47f696 h1:h1E87+z+JcUEfvbJVF56SnZA/YUFE5ewUE61MaR/Ewg= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240531021326-99118e47f696/go.mod h1:OiWUTrrpSLLTMh7FINWjEh6mmDJCVPaC4yEsDCVaWdU= -github.com/smartcontractkit/chainlink-testing-framework v1.30.5 h1:RBeQkaUH095L/hOH6JbfScAo4jkI0osBp8kgULnGwos= -github.com/smartcontractkit/chainlink-testing-framework v1.30.5/go.mod h1:E6uNEZhZZid9PHv6/Kq5Vn63GlO61ZcKB+/f0DKo3Q4= +github.com/smartcontractkit/chainlink-testing-framework v1.30.9 h1:U8TqnPn2pfe+jSojeZL58sXBgfHFBHRsnm3izLthaYw= +github.com/smartcontractkit/chainlink-testing-framework v1.30.9/go.mod h1:E6uNEZhZZid9PHv6/Kq5Vn63GlO61ZcKB+/f0DKo3Q4= github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240328204215-ac91f55f1449 h1:fX/xmGm1GBsD1ZZnooNT+eWA0hiTAqFlHzOC5CY4dy8= github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240328204215-ac91f55f1449/go.mod h1:DC8sQMyTlI/44UCTL8QWFwb0bYNoXCfjwCv2hMivYZU= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 7fb29e4060b..f65a0839f7c 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -16,8 +16,8 @@ require ( github.com/rs/zerolog v1.30.0 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614120734-7fa0ab584458 - github.com/smartcontractkit/chainlink-testing-framework v1.30.5 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240617140013-160ae09880da + github.com/smartcontractkit/chainlink-testing-framework v1.30.9 github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240214231432-4ad5eb95178c github.com/smartcontractkit/chainlink/v2 v2.9.0-beta0.0.20240216210048-da02459ddad8 github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 5dd5443f52f..c9e3c2f2a14 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1502,8 +1502,8 @@ github.com/smartcontractkit/chain-selectors v1.0.10 h1:t9kJeE6B6G+hKD0GYR4kGJSCq github.com/smartcontractkit/chain-selectors v1.0.10/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8= github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614120734-7fa0ab584458 h1:+7LQmbMNaLXej+0ajbTxUfTt4w/ILODpmrOETQ5rTCI= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614120734-7fa0ab584458/go.mod h1:L32xvCpk84Nglit64OhySPMP1tM3TTBK7Tw0qZl7Sd4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240617140013-160ae09880da h1:s3wq2II/FQ1YNcPWnvp44A7Nc874bkMicrkXNpNNHs4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240617140013-160ae09880da/go.mod h1:L32xvCpk84Nglit64OhySPMP1tM3TTBK7Tw0qZl7Sd4= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d h1:5tgMC5Gi2UAOKZ+m28W8ubjLeR0pQCAcrz6eQ0rW510= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d/go.mod h1:0UNuO3nDt9MFsZPaHJBEUolxVkN0iC69j1ccDp95e8k= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 h1:xFSv8561jsLtF6gYZr/zW2z5qUUAkcFkApin2mnbYTo= @@ -1514,8 +1514,8 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240605170242-555ff582f36 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240605170242-555ff582f36a/go.mod h1:QqcZSwLgEIn7YraAIRmomnBMAuVFephiHrIWVlkWbFI= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240531021326-99118e47f696 h1:h1E87+z+JcUEfvbJVF56SnZA/YUFE5ewUE61MaR/Ewg= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240531021326-99118e47f696/go.mod h1:OiWUTrrpSLLTMh7FINWjEh6mmDJCVPaC4yEsDCVaWdU= -github.com/smartcontractkit/chainlink-testing-framework v1.30.5 h1:RBeQkaUH095L/hOH6JbfScAo4jkI0osBp8kgULnGwos= -github.com/smartcontractkit/chainlink-testing-framework v1.30.5/go.mod h1:E6uNEZhZZid9PHv6/Kq5Vn63GlO61ZcKB+/f0DKo3Q4= +github.com/smartcontractkit/chainlink-testing-framework v1.30.9 h1:U8TqnPn2pfe+jSojeZL58sXBgfHFBHRsnm3izLthaYw= +github.com/smartcontractkit/chainlink-testing-framework v1.30.9/go.mod h1:E6uNEZhZZid9PHv6/Kq5Vn63GlO61ZcKB+/f0DKo3Q4= github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240328204215-ac91f55f1449 h1:fX/xmGm1GBsD1ZZnooNT+eWA0hiTAqFlHzOC5CY4dy8= github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240328204215-ac91f55f1449/go.mod h1:DC8sQMyTlI/44UCTL8QWFwb0bYNoXCfjwCv2hMivYZU= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/integration-tests/soak/ocr_test.go b/integration-tests/soak/ocr_test.go index f8120d2ae0f..789c7de8e3b 100644 --- a/integration-tests/soak/ocr_test.go +++ b/integration-tests/soak/ocr_test.go @@ -37,6 +37,19 @@ func TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled(t *testing.T) { runOCRSoakTest(t, config, "") } +func TestOCRSoak_GasSpike(t *testing.T) { + config, err := tc.GetConfig(t.Name(), tc.OCR) + require.NoError(t, err, "Error getting config") + runOCRSoakTest(t, config, "") +} + +// TestOCRSoak_ChangeBlockGasLimit changes next block gas limit and sets it to percentage of last gasUsed in previous block creating congestion +func TestOCRSoak_ChangeBlockGasLimit(t *testing.T) { + config, err := tc.GetConfig(t.Name(), tc.OCR) + require.NoError(t, err, "Error getting config") + runOCRSoakTest(t, config, "") +} + func runOCRSoakTest(t *testing.T, config tc.TestConfig, customNetworkTOML string) { l := logging.GetTestLogger(t) diff --git a/integration-tests/testconfig/ocr/ocr.toml b/integration-tests/testconfig/ocr/ocr.toml index 30fc9655bf9..6c5745807b4 100644 --- a/integration-tests/testconfig/ocr/ocr.toml +++ b/integration-tests/testconfig/ocr/ocr.toml @@ -135,4 +135,40 @@ test_duration="15m" [TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.OCR.Soak] ocr_version="1" number_of_contracts=2 -time_between_rounds="1m" \ No newline at end of file +time_between_rounds="1m" + +# OCR soak test configuration with gas spike on Anvil network +[TestOCRSoak_GasSpike.Common] +chainlink_node_funding = 100 +[TestOCRSoak_GasSpike.OCR.Common] +test_duration="15m" +[TestOCRSoak_GasSpike.OCR.Soak] +ocr_version="1" +number_of_contracts=2 +time_between_rounds="1m" +[TestOCRSoak_GasSpike.Network] +selected_networks=["Anvil"] +[TestOCRSoak_GasSpike.Network.AnvilConfigs.anvil.GasSpikeSimulation] +enabled = true +start_gas_price = 2000000000 +gas_rise_percentage = 0.7 +gas_spike = true +delay_create = "1m" +duration = "3m" + +# OCR soak test configuration with change to gas limit on Anvil network +[TestOCRSoak_ChangeBlockGasLimit.Common] +chainlink_node_funding = 100 +[TestOCRSoak_ChangeBlockGasLimit.OCR.Common] +test_duration="15m" +[TestOCRSoak_ChangeBlockGasLimit.OCR.Soak] +ocr_version="1" +number_of_contracts=2 +time_between_rounds="1m" +[TestOCRSoak_ChangeBlockGasLimit.Network] +selected_networks=["Anvil"] +[TestOCRSoak_ChangeBlockGasLimit.Network.AnvilConfigs.anvil.GasLimitSimulation] +enabled = true +next_gas_limit_percentage = 0.5 +delay_create = "1m" +duration = "3m" \ No newline at end of file diff --git a/integration-tests/testsetups/ocr.go b/integration-tests/testsetups/ocr.go index 02f4db9c51b..fcff17874ec 100644 --- a/integration-tests/testsetups/ocr.go +++ b/integration-tests/testsetups/ocr.go @@ -83,8 +83,10 @@ type OCRSoakTest struct { ocrV2Instances []contracts.OffchainAggregatorV2 ocrV2InstanceMap map[string]contracts.OffchainAggregatorV2 // address : instance - rpcNetwork blockchain.EVMNetwork // network configuration for the blockchain node - reorgHappened bool // flag to indicate if a reorg happened during the test + rpcNetwork blockchain.EVMNetwork // network configuration for the blockchain node + reorgHappened bool // flag to indicate if a reorg happened during the test + gasSpikeSimulationHappened bool // flag to indicate if a gas spike simulation happened during the test + gasLimitSimulationHappened bool // flag to indicate if a gas limit simulation happened during the test } // NewOCRSoakTest creates a new OCR soak test to setup and run @@ -208,6 +210,7 @@ func (o *OCRSoakTest) DeployEnvironment(customChainlinkNetworkTOML string, ocrTe } else { // Test is running locally, set forwarded URL of Anvil blockchain node o.rpcNetwork.URLs = []string{anvilChart.ForwardedWSURL} + o.rpcNetwork.HTTPURLs = []string{anvilChart.ForwardedHTTPURL} } } else if o.rpcNetwork.Simulated && o.rpcNetwork.Name == blockchain.SimulatedEVMNetwork.Name { if testEnv.Cfg.InsideK8s { @@ -585,10 +588,10 @@ func (o *OCRSoakTest) testLoop(testDuration time.Duration, newValue int) { err := o.observeOCREvents() require.NoError(o.t, err, "Error subscribing to OCR events") + n := o.Config.GetNetworkConfig() + // Schedule blockchain re-org if needed // Reorg only avaible for Simulated Geth - var reorgCh <-chan time.Time - n := o.Config.GetNetworkConfig() if n.IsSimulatedGethSelected() && n.GethReorgConfig.Enabled { var reorgDelay time.Duration if n.GethReorgConfig.DelayCreate.Duration > testDuration { @@ -598,7 +601,47 @@ func (o *OCRSoakTest) testLoop(testDuration time.Duration, newValue int) { } else { reorgDelay = n.GethReorgConfig.DelayCreate.Duration } - reorgCh = time.After(reorgDelay) + time.AfterFunc(reorgDelay, func() { + if !o.reorgHappened { + o.startGethBlockchainReorg(o.rpcNetwork, n.GethReorgConfig) + } + }) + } + + // Schedule gas simulations if needed + // Gas simulation only available for Anvil + if o.rpcNetwork.Name == "Anvil" { + ac := o.Config.GetNetworkConfig().AnvilConfigs["ANVIL"] + if ac != nil && ac.GasSpikeSimulation.Enabled { + var delay time.Duration + if ac.GasSpikeSimulation.DelayCreate.Duration > testDuration { + // This may happen when test is resumed and the reorg delay is longer than the time left + o.log.Warn().Msg("Gas spike simulation delay is longer than test duration, gas simulation scheduled immediately") + delay = 0 + } else { + delay = ac.GasSpikeSimulation.DelayCreate.Duration + } + time.AfterFunc(delay, func() { + if !o.gasSpikeSimulationHappened { + o.startAnvilGasSpikeSimulation(o.rpcNetwork, ac.GasSpikeSimulation) + } + }) + } + if ac != nil && ac.GasLimitSimulation.Enabled { + var delay time.Duration + if ac.GasLimitSimulation.DelayCreate.Duration > testDuration { + // This may happen when test is resumed and the reorg delay is longer than the time left + o.log.Warn().Msg("Gas limit simulation delay is longer than test duration, gas simulation scheduled immediately") + delay = 0 + } else { + delay = ac.GasLimitSimulation.DelayCreate.Duration + } + time.AfterFunc(delay, func() { + if !o.gasLimitSimulationHappened { + o.startAnvilGasLimitSimulation(o.rpcNetwork, ac.GasLimitSimulation) + } + }) + } } for { @@ -634,12 +677,6 @@ func (o *OCRSoakTest) testLoop(testDuration time.Duration, newValue int) { newValue = rand.Intn(256) + 1 // #nosec G404 - kudos to you if you actually find a way to exploit this } lastValue = newValue - - // Schedule blockchain re-org if needed - case <-reorgCh: - if !o.reorgHappened { - o.startBlockchainReorg(o.Config.GetNetworkConfig().GethReorgConfig.Depth) - } } } } @@ -655,22 +692,54 @@ func (o *OCRSoakTest) complete() { o.TestReporter.RecordEvents(o.ocrRoundStates, o.testIssues) } -func (o *OCRSoakTest) startBlockchainReorg(depth int) { - if !o.Config.GetNetworkConfig().IsSimulatedGethSelected() { - require.FailNow(o.t, "Reorg only available for Simulated Geth") - return - } - - client := ctf_client.NewRPCClient(o.rpcNetwork.HTTPURLs[0]) +func (o *OCRSoakTest) startGethBlockchainReorg(network blockchain.EVMNetwork, conf ctf_config.ReorgConfig) { + client := ctf_client.NewRPCClient(network.HTTPURLs[0]) o.log.Info(). Str("URL", client.URL). - Int("depth", depth). + Int("Depth", conf.Depth). Msg("Starting blockchain reorg on Simulated Geth chain") - err := client.GethSetHead(depth) + err := client.GethSetHead(conf.Depth) require.NoError(o.t, err, "Error starting blockchain reorg on Simulated Geth chain") o.reorgHappened = true } +func (o *OCRSoakTest) startAnvilGasSpikeSimulation(network blockchain.EVMNetwork, conf ctf_config.GasSpikeSimulationConfig) { + client := ctf_client.NewRPCClient(network.HTTPURLs[0]) + o.log.Info(). + Str("URL", client.URL). + Any("GasSpikeSimulationConfig", conf). + Msg("Starting gas spike simulation on Anvil chain") + err := client.ModulateBaseFeeOverDuration(o.log, conf.StartGasPrice, conf.GasRisePercentage, conf.Duration.Duration, conf.GasSpike) + require.NoError(o.t, err, "Error starting gas simulation on Anvil chain") + o.gasSpikeSimulationHappened = true +} + +func (o *OCRSoakTest) startAnvilGasLimitSimulation(network blockchain.EVMNetwork, conf ctf_config.GasLimitSimulationConfig) { + client := ctf_client.NewRPCClient(network.HTTPURLs[0]) + latestBlock, err := o.seth.Client.BlockByNumber(context.Background(), nil) + require.NoError(o.t, err) + newGasLimit := int64(math.Ceil(float64(latestBlock.GasUsed()) * conf.NextGasLimitPercentage)) + o.log.Info(). + Str("URL", client.URL). + Any("GasLimitSimulationConfig", conf). + Uint64("LatestBlock", latestBlock.Number().Uint64()). + Uint64("LatestGasUsed", latestBlock.GasUsed()). + Uint64("LatestGasLimit", latestBlock.GasLimit()). + Int64("NewGasLimit", newGasLimit). + Msg("Starting new gas limit simulation on Anvil chain") + err = client.AnvilSetBlockGasLimit([]interface{}{newGasLimit}) + require.NoError(o.t, err, "Error starting gas simulation on Anvil chain") + time.Sleep(conf.Duration.Duration) + o.log.Info(). + Str("URL", client.URL). + Any("GasLimitSimulationConfig", conf). + Uint64("LatestGasLimit", latestBlock.GasLimit()). + Msg("Returning to old gas limit simulation on Anvil chain") + err = client.AnvilSetBlockGasLimit([]interface{}{latestBlock.GasLimit()}) + require.NoError(o.t, err, "Error starting gas simulation on Anvil chain") + o.gasLimitSimulationHappened = true +} + // setFilterQuery to look for all events that happened func (o *OCRSoakTest) setFilterQuery() { ocrAddresses := o.getContractAddresses() diff --git a/tools/bin/modgraph b/tools/bin/modgraph index b61264cb021..4d8ad108c65 100755 --- a/tools/bin/modgraph +++ b/tools/bin/modgraph @@ -9,9 +9,13 @@ echo "# smartcontractkit Go modules flowchart LR subgraph chains chainlink-cosmos - chainlink-evm chainlink-solana chainlink-starknet/relayer + subgraph chainlink-integrations + direction LR + chainlink-integrations/evm/relayer + chainlink-integrations/common + end end subgraph products