From 685681e1b3b44ec9dadd4756ec6f0407ffda8afe Mon Sep 17 00:00:00 2001 From: Chris Cushman <104409744+vreff@users.noreply.github.com> Date: Wed, 3 Jul 2024 17:27:42 -0400 Subject: [PATCH] Remove ocr2vrf (#13472) * Remove ocr2vrf * Fix merge conflicts * Update core/services/ocr2/delegate.go * Remove dkg-related items * Fix tests * Fix wrappers gen * fix help file * Add changeset * fix merge conflicts * fix merge conflicts 2 --- .changeset/bright-crabs-live.md | 7 + .github/CODEOWNERS | 2 - contracts/GNUmakefile | 12 - .../scripts/native_solc_compile_all_ocr2vrf | 42 - core/cmd/app.go | 2 - core/cmd/dkgencrypt_keys_commands.go | 60 - core/cmd/dkgencrypt_keys_commands_test.go | 178 - core/cmd/dkgsign_keys_commands.go | 60 - core/cmd/dkgsign_keys_commands_test.go | 176 - core/cmd/ocr2vrf_configure_commands.go | 509 --- .../gethwrappers/ocr2vrf/generated/dkg/dkg.go | 1274 ------ .../load_test_beacon_consumer.go | 1422 ------ .../generated/vrf_beacon/vrf_beacon.go | 2846 ------------ .../vrf_beacon_consumer.go | 1034 ----- .../vrf_coordinator/vrf_coordinator.go | 3870 ----------------- ...rapper-dependency-versions-do-not-edit.txt | 7 - core/gethwrappers/ocr2vrf/go_generate.go | 10 - core/internal/cltest/cltest.go | 22 +- core/internal/mocks/go_generate.go | 2 - core/scripts/go.mod | 4 +- core/scripts/go.sum | 4 - core/scripts/ocr2vrf/main.go | 455 -- core/scripts/ocr2vrf/readiness/main.go | 214 - core/scripts/ocr2vrf/setup_dkg.go | 101 - core/scripts/ocr2vrf/setup_ocr2vrf.go | 572 --- core/scripts/ocr2vrf/util.go | 619 --- core/scripts/ocr2vrf/verify.go | 181 - core/services/chainlink/application.go | 2 - core/services/job/models.go | 2 +- core/services/job/spawner_test.go | 4 +- core/services/keystore/dkgencrypt.go | 164 - core/services/keystore/dkgencrypt_test.go | 130 - core/services/keystore/dkgsign.go | 164 - core/services/keystore/dkgsign_test.go | 129 - .../keystore/keys/dkgencryptkey/export.go | 44 - .../keys/dkgencryptkey/export_test.go | 19 - .../keystore/keys/dkgencryptkey/key.go | 116 - .../keystore/keys/dkgencryptkey/key_test.go | 58 - .../keystore/keys/dkgsignkey/export.go | 46 - .../keystore/keys/dkgsignkey/export_test.go | 19 - core/services/keystore/keys/dkgsignkey/key.go | 92 - .../keystore/keys/dkgsignkey/key_test.go | 58 - .../keystore/keys/dkgsignkey/utils.go | 39 - core/services/keystore/keystoretest.go | 2 - core/services/keystore/master.go | 40 +- core/services/keystore/mocks/dkg_encrypt.go | 238 - core/services/keystore/mocks/dkg_sign.go | 238 - core/services/keystore/mocks/master.go | 40 - core/services/keystore/models.go | 56 +- core/services/keystore/models_test.go | 30 +- core/services/ocr2/delegate.go | 272 +- core/services/ocr2/delegate_test.go | 23 - .../ocr2/plugins/dkg/config/config.go | 28 - .../ocr2/plugins/dkg/config/config_test.go | 64 - .../services/ocr2/plugins/dkg/key_consumer.go | 24 - .../ocr2/plugins/dkg/onchain_contract.go | 90 - .../ocr2/plugins/dkg/persistence/db.go | 224 - .../ocr2/plugins/dkg/persistence/db_test.go | 183 - .../ocr2/plugins/dkg/persistence/models.go | 9 - core/services/ocr2/plugins/dkg/plugin.go | 96 - .../ocr2/plugins/ocr2vrf/config/config.go | 57 - .../ocr2vrf/coordinator/coordinator.go | 1156 ----- .../ocr2vrf/coordinator/coordinator_test.go | 1787 -------- .../plugins/ocr2vrf/coordinator/interfaces.go | 31 - .../ocr2vrf/coordinator/mocks/vrf_beacon.go | 2179 ---------- .../mocks/vrf_beacon_coordinator.go | 184 - .../coordinator/mocks/vrf_coordinator.go | 3093 ------------- .../plugins/ocr2vrf/coordinator/ocr_cache.go | 121 - .../ocr2vrf/coordinator/ocr_cache_test.go | 163 - .../plugins/ocr2vrf/coordinator/router.go | 82 - .../ocr2vrf/coordinator/router_test.go | 130 - .../plugins/ocr2vrf/coordinator/topics.go | 28 - .../internal/ocr2vrf_integration_test.go | 883 ---- .../juelsfeecoin/link_eth_price_provider.go | 109 - .../link_eth_price_provider_test.go | 91 - .../reasonable_gas_price_provider.go | 42 - .../reasonable_gas_price_test.go | 22 - .../reportserializer/report_serializer.go | 61 - .../report_serializer_test.go | 44 - core/services/ocr2/validate/validate.go | 69 - core/services/ocr2/validate/validate_test.go | 257 -- core/services/relay/evm/ocr2vrf.go | 178 - core/services/synchronization/common.go | 1 - .../telemetry_ingress_batch_client_test.go | 19 +- core/web/auth/auth_test.go | 5 - core/web/dkgencrypt_keys_controller.go | 17 - core/web/dkgencrypt_keys_controller_test.go | 109 - core/web/dkgsign_keys_controller.go | 17 - core/web/dkgsign_keys_controller_test.go | 109 - core/web/presenters/dkgencrypt_key.go | 38 - core/web/presenters/dkgsign_key.go | 38 - core/web/router.go | 2 - go.md | 3 - go.mod | 2 - go.sum | 3 - .../ocr2vrf_actions/ocr2vrf_config_helpers.go | 338 -- .../ocr2vrf_constants/ocr2vrf_constants.go | 31 - .../actions/ocr2vrf_actions/ocr2vrf_models.go | 37 - .../actions/ocr2vrf_actions/ocr2vrf_steps.go | 363 -- integration-tests/chaos/ocr2vrf_chaos_test.go | 230 - integration-tests/client/chainlink.go | 56 - integration-tests/client/chainlink_models.go | 44 - .../contracts/contract_vrf_models.go | 43 - .../contracts/ethereum_ocr2vrf_contracts.go | 523 --- .../contracts/ethereum_vrfv2plus_contracts.go | 29 + integration-tests/go.mod | 3 +- integration-tests/go.sum | 3 - integration-tests/load/go.mod | 1 - integration-tests/load/go.sum | 3 - integration-tests/smoke/ocr2vrf_test.go | 195 - integration-tests/testconfig/configs_embed.go | 1 - .../testconfig/ocr2vrf/example.toml | 167 - .../testconfig/ocr2vrf/ocr2vrf.toml | 93 - integration-tests/testconfig/testconfig.go | 14 +- testdata/scripts/help-all/help-all.txtar | 12 - testdata/scripts/keys/dkgencrypt/help.txtar | 20 - testdata/scripts/keys/dkgsign/help.txtar | 20 - testdata/scripts/keys/help.txtar | 22 +- 118 files changed, 93 insertions(+), 29713 deletions(-) create mode 100644 .changeset/bright-crabs-live.md delete mode 100755 contracts/scripts/native_solc_compile_all_ocr2vrf delete mode 100644 core/cmd/dkgencrypt_keys_commands.go delete mode 100644 core/cmd/dkgencrypt_keys_commands_test.go delete mode 100644 core/cmd/dkgsign_keys_commands.go delete mode 100644 core/cmd/dkgsign_keys_commands_test.go delete mode 100644 core/cmd/ocr2vrf_configure_commands.go delete mode 100644 core/gethwrappers/ocr2vrf/generated/dkg/dkg.go delete mode 100644 core/gethwrappers/ocr2vrf/generated/load_test_beacon_consumer/load_test_beacon_consumer.go delete mode 100644 core/gethwrappers/ocr2vrf/generated/vrf_beacon/vrf_beacon.go delete mode 100644 core/gethwrappers/ocr2vrf/generated/vrf_beacon_consumer/vrf_beacon_consumer.go delete mode 100644 core/gethwrappers/ocr2vrf/generated/vrf_coordinator/vrf_coordinator.go delete mode 100644 core/gethwrappers/ocr2vrf/generation/generated-wrapper-dependency-versions-do-not-edit.txt delete mode 100644 core/gethwrappers/ocr2vrf/go_generate.go delete mode 100644 core/scripts/ocr2vrf/main.go delete mode 100644 core/scripts/ocr2vrf/readiness/main.go delete mode 100644 core/scripts/ocr2vrf/setup_dkg.go delete mode 100644 core/scripts/ocr2vrf/setup_ocr2vrf.go delete mode 100644 core/scripts/ocr2vrf/util.go delete mode 100644 core/scripts/ocr2vrf/verify.go delete mode 100644 core/services/keystore/dkgencrypt.go delete mode 100644 core/services/keystore/dkgencrypt_test.go delete mode 100644 core/services/keystore/dkgsign.go delete mode 100644 core/services/keystore/dkgsign_test.go delete mode 100644 core/services/keystore/keys/dkgencryptkey/export.go delete mode 100644 core/services/keystore/keys/dkgencryptkey/export_test.go delete mode 100644 core/services/keystore/keys/dkgencryptkey/key.go delete mode 100644 core/services/keystore/keys/dkgencryptkey/key_test.go delete mode 100644 core/services/keystore/keys/dkgsignkey/export.go delete mode 100644 core/services/keystore/keys/dkgsignkey/export_test.go delete mode 100644 core/services/keystore/keys/dkgsignkey/key.go delete mode 100644 core/services/keystore/keys/dkgsignkey/key_test.go delete mode 100644 core/services/keystore/keys/dkgsignkey/utils.go delete mode 100644 core/services/keystore/mocks/dkg_encrypt.go delete mode 100644 core/services/keystore/mocks/dkg_sign.go delete mode 100644 core/services/ocr2/plugins/dkg/config/config.go delete mode 100644 core/services/ocr2/plugins/dkg/config/config_test.go delete mode 100644 core/services/ocr2/plugins/dkg/key_consumer.go delete mode 100644 core/services/ocr2/plugins/dkg/onchain_contract.go delete mode 100644 core/services/ocr2/plugins/dkg/persistence/db.go delete mode 100644 core/services/ocr2/plugins/dkg/persistence/db_test.go delete mode 100644 core/services/ocr2/plugins/dkg/persistence/models.go delete mode 100644 core/services/ocr2/plugins/dkg/plugin.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/config/config.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/coordinator/interfaces.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/coordinator/mocks/vrf_beacon.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/coordinator/mocks/vrf_beacon_coordinator.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/coordinator/mocks/vrf_coordinator.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/coordinator/ocr_cache.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/coordinator/ocr_cache_test.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/coordinator/router.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/coordinator/router_test.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/coordinator/topics.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/internal/ocr2vrf_integration_test.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/juelsfeecoin/link_eth_price_provider.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/juelsfeecoin/link_eth_price_provider_test.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_provider.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_test.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/reportserializer/report_serializer.go delete mode 100644 core/services/ocr2/plugins/ocr2vrf/reportserializer/report_serializer_test.go delete mode 100644 core/services/relay/evm/ocr2vrf.go delete mode 100644 core/web/dkgencrypt_keys_controller.go delete mode 100644 core/web/dkgencrypt_keys_controller_test.go delete mode 100644 core/web/dkgsign_keys_controller.go delete mode 100644 core/web/dkgsign_keys_controller_test.go delete mode 100644 core/web/presenters/dkgencrypt_key.go delete mode 100644 core/web/presenters/dkgsign_key.go delete mode 100644 integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go delete mode 100644 integration-tests/actions/ocr2vrf_actions/ocr2vrf_constants/ocr2vrf_constants.go delete mode 100644 integration-tests/actions/ocr2vrf_actions/ocr2vrf_models.go delete mode 100644 integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go delete mode 100644 integration-tests/chaos/ocr2vrf_chaos_test.go delete mode 100644 integration-tests/contracts/ethereum_ocr2vrf_contracts.go delete mode 100644 integration-tests/smoke/ocr2vrf_test.go delete mode 100644 integration-tests/testconfig/ocr2vrf/example.toml delete mode 100644 integration-tests/testconfig/ocr2vrf/ocr2vrf.toml delete mode 100644 testdata/scripts/keys/dkgencrypt/help.txtar delete mode 100644 testdata/scripts/keys/dkgsign/help.txtar diff --git a/.changeset/bright-crabs-live.md b/.changeset/bright-crabs-live.md new file mode 100644 index 00000000000..7e21431ee24 --- /dev/null +++ b/.changeset/bright-crabs-live.md @@ -0,0 +1,7 @@ +--- +"chainlink": minor +--- + +Remove ocr2vrf + +#removed all ocr2vrf and dkg OCR2 plugin materials. \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 61e66baf4f4..c7eb22991b5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -34,8 +34,6 @@ /core/services/pipeline/task.vrf.go @smartcontractkit/vrf-team /core/services/pipeline/task.vrfv2.go @smartcontractkit/vrf-team /core/services/pipeline/task.vrfv2plus.go @smartcontractkit/vrf-team -/core/services/ocr2/plugins/dkg @smartcontractkit/vrf-team -/core/services/ocr2/plugins/ocr2vrf @smartcontractkit/vrf-team # Keeper/Automation-related services /core/services/keeper @smartcontractkit/keepers diff --git a/contracts/GNUmakefile b/contracts/GNUmakefile index 69666024d9c..c3e69464698 100644 --- a/contracts/GNUmakefile +++ b/contracts/GNUmakefile @@ -73,18 +73,6 @@ wrappers-all: pnpmdep mockery abigen ## Recompiles solidity contracts and their # go_generate contains a call to compile all contracts before generating wrappers go generate ../core/gethwrappers/go_generate.go -# Custom wrapper generation for OCR2VRF as their contracts do not exist in this repo -.PHONY: go-solidity-wrappers-ocr2vrf -go-solidity-wrappers-ocr2vrf: pnpmdep abigen ## Recompiles OCR2VRF solidity contracts and their go wrappers. - ./scripts/native_solc_compile_all_ocr2vrf - # replace the go:generate_disabled directive with the regular go:generate directive - sed -i '' 's/go:generate_disabled/go:generate/g' ../core/gethwrappers/ocr2vrf/go_generate.go - go generate ../core/gethwrappers/ocr2vrf - go generate ../core/internal/mocks - # put the go:generate_disabled directive back - sed -i '' 's/go:generate/go:generate_disabled/g' ../core/gethwrappers/ocr2vrf/go_generate.go - - help: @echo "" @echo " .__ .__ .__ .__ __" diff --git a/contracts/scripts/native_solc_compile_all_ocr2vrf b/contracts/scripts/native_solc_compile_all_ocr2vrf deleted file mode 100755 index 755edd34f56..00000000000 --- a/contracts/scripts/native_solc_compile_all_ocr2vrf +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash - -set -e - -echo " ┌──────────────────────────────────────────────┐" -echo " │ Compiling OCR2 VRF contracts... │" -echo " └──────────────────────────────────────────────┘" - -SOLC_VERSION="0.8.19" -OPTIMIZE_RUNS=1000000 -# The VRF contracts are not contained in the `chainlink` repository. -# Change me. -FOLDER="ocr2vrf-origin" - -echo "Compiling OCR2VRF contracts..." - -SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" -ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1; cd ../../ && pwd -P )" -python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt - -solc-select install $SOLC_VERSION -solc-select use $SOLC_VERSION -export SOLC_VERSION=$SOLC_VERSION - - -compileContract () { - local contract - contract=$(basename "$1" ".sol") - - solc --overwrite --optimize --optimize-runs "$2" --metadata-hash none \ - -o "$ROOT"/contracts/solc/v0.8.19/"$contract" \ - --abi --bin \ - --allow-paths "$ROOT"/../$FOLDER/contracts \ - "$ROOT"/"$1" -} - -# OCR2VRF -compileContract ../$FOLDER/contracts/DKG.sol $OPTIMIZE_RUNS -compileContract ../$FOLDER/contracts/VRFBeacon.sol $OPTIMIZE_RUNS -compileContract ../$FOLDER/contracts/VRFCoordinator.sol 1 -compileContract ../$FOLDER/contracts/test/TestBeaconVRFConsumer.sol $OPTIMIZE_RUNS -compileContract ../$FOLDER/contracts/test/LoadTestBeaconVRFConsumer.sol $OPTIMIZE_RUNS diff --git a/core/cmd/app.go b/core/cmd/app.go index 94acfc4d74f..1ccb3da9a01 100644 --- a/core/cmd/app.go +++ b/core/cmd/app.go @@ -195,8 +195,6 @@ func NewApp(s *Shell) *cli.App { keysCommand("Solana", NewSolanaKeysClient(s)), keysCommand("StarkNet", NewStarkNetKeysClient(s)), keysCommand("Aptos", NewAptosKeysClient(s)), - keysCommand("DKGSign", NewDKGSignKeysClient(s)), - keysCommand("DKGEncrypt", NewDKGEncryptKeysClient(s)), initVRFKeysSubCmd(s), }, diff --git a/core/cmd/dkgencrypt_keys_commands.go b/core/cmd/dkgencrypt_keys_commands.go deleted file mode 100644 index ddcc80a33be..00000000000 --- a/core/cmd/dkgencrypt_keys_commands.go +++ /dev/null @@ -1,60 +0,0 @@ -package cmd - -import ( - "github.com/smartcontractkit/chainlink-common/pkg/utils" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgsignkey" - "github.com/smartcontractkit/chainlink/v2/core/web/presenters" -) - -type DKGEncryptKeyPresenter struct { - JAID - presenters.DKGEncryptKeyResource -} - -var _ TableRenderer = DKGEncryptKeyPresenter{} -var _ TableRenderer = DKGEncryptKeyPresenters{} - -// RenderTable implements TableRenderer -func (p DKGEncryptKeyPresenter) RenderTable(rt RendererTable) error { - headers := []string{"ID", "Public key"} - rows := [][]string{p.ToRow()} - - if _, err := rt.Write([]byte("🔑 DKGEncrypt Keys\n")); err != nil { - return err - } - renderList(headers, rows, rt.Writer) - - return utils.JustError(rt.Write([]byte("\n"))) -} - -func (p *DKGEncryptKeyPresenter) ToRow() []string { - row := []string{ - p.ID, - p.PublicKey, - } - - return row -} - -type DKGEncryptKeyPresenters []DKGEncryptKeyPresenter - -// RenderTable implements TableRenderer -func (ps DKGEncryptKeyPresenters) RenderTable(rt RendererTable) error { - headers := []string{"ID", "Public key"} - rows := [][]string{} - - for _, p := range ps { - rows = append(rows, p.ToRow()) - } - - if _, err := rt.Write([]byte("🔑 DKGEncrypt Keys\n")); err != nil { - return err - } - renderList(headers, rows, rt.Writer) - - return utils.JustError(rt.Write([]byte("\n"))) -} - -func NewDKGEncryptKeysClient(s *Shell) KeysClient { - return newKeysClient[dkgsignkey.Key, DKGEncryptKeyPresenter, DKGEncryptKeyPresenters]("DKGEncrypt", s) -} diff --git a/core/cmd/dkgencrypt_keys_commands_test.go b/core/cmd/dkgencrypt_keys_commands_test.go deleted file mode 100644 index 7b0de4f7774..00000000000 --- a/core/cmd/dkgencrypt_keys_commands_test.go +++ /dev/null @@ -1,178 +0,0 @@ -package cmd_test - -import ( - "bytes" - "context" - "flag" - "fmt" - "os" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/urfave/cli" - - "github.com/smartcontractkit/chainlink-common/pkg/utils" - "github.com/smartcontractkit/chainlink/v2/core/cmd" - "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" - "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgencryptkey" - "github.com/smartcontractkit/chainlink/v2/core/web/presenters" -) - -func TestDKGEncryptKeyPresenter_RenderTable(t *testing.T) { - t.Parallel() - - var ( - id = "1" - pubKey = "somepubkey" - buffer = bytes.NewBufferString("") - r = cmd.RendererTable{Writer: buffer} - ) - - p := cmd.DKGEncryptKeyPresenter{ - JAID: cmd.JAID{ID: id}, - DKGEncryptKeyResource: presenters.DKGEncryptKeyResource{ - JAID: presenters.NewJAID(id), - PublicKey: pubKey, - }, - } - - // Render a single resource - require.NoError(t, p.RenderTable(r)) - - output := buffer.String() - assert.Contains(t, output, id) - assert.Contains(t, output, pubKey) - - // Render many resources - buffer.Reset() - ps := cmd.DKGEncryptKeyPresenters{p} - require.NoError(t, ps.RenderTable(r)) - - output = buffer.String() - assert.Contains(t, output, id) - assert.Contains(t, output, pubKey) -} - -func TestShell_DKGEncryptKeys(t *testing.T) { - app := startNewApplicationV2(t, nil) - ks := app.GetKeyStore().DKGEncrypt() - cleanup := func() { - ctx := context.Background() - keys, err := ks.GetAll() - assert.NoError(t, err) - for _, key := range keys { - assert.NoError(t, utils.JustError(ks.Delete(ctx, key.ID()))) - } - requireDKGEncryptKeyCount(t, app, 0) - } - - t.Run("ListDKGEncryptKeys", func(tt *testing.T) { - defer cleanup() - ctx := testutils.Context(t) - client, r := app.NewShellAndRenderer() - key, err := app.GetKeyStore().DKGEncrypt().Create(ctx) - assert.NoError(tt, err) - requireDKGEncryptKeyCount(t, app, 1) - assert.Nil(t, cmd.NewDKGEncryptKeysClient(client).ListKeys(cltest.EmptyCLIContext())) - assert.Equal(t, 1, len(r.Renders)) - keys := *r.Renders[0].(*cmd.DKGEncryptKeyPresenters) - assert.True(t, key.PublicKeyString() == keys[0].PublicKey) - }) - - t.Run("CreateDKGEncryptKey", func(tt *testing.T) { - defer cleanup() - client, _ := app.NewShellAndRenderer() - assert.NoError(tt, cmd.NewDKGEncryptKeysClient(client).CreateKey(nilContext)) - keys, err := app.GetKeyStore().DKGEncrypt().GetAll() - assert.NoError(tt, err) - assert.Len(t, keys, 1) - }) - - t.Run("DeleteDKGEncryptKey", func(tt *testing.T) { - defer cleanup() - ctx := testutils.Context(t) - client, _ := app.NewShellAndRenderer() - key, err := app.GetKeyStore().DKGEncrypt().Create(ctx) - assert.NoError(tt, err) - requireDKGEncryptKeyCount(tt, app, 1) - set := flag.NewFlagSet("test", 0) - flagSetApplyFromAction(cmd.NewDKGEncryptKeysClient(client).DeleteKey, set, "") - - require.NoError(tt, set.Set("yes", "true")) - - strID := key.ID() - err = set.Parse([]string{strID}) - require.NoError(t, err) - c := cli.NewContext(nil, set, nil) - err = cmd.NewDKGEncryptKeysClient(client).DeleteKey(c) - assert.NoError(tt, err) - requireDKGEncryptKeyCount(tt, app, 0) - }) - - t.Run("ImportExportDKGEncryptKey", func(tt *testing.T) { - defer cleanup() - defer deleteKeyExportFile(tt) - ctx := testutils.Context(t) - client, _ := app.NewShellAndRenderer() - - _, err := app.GetKeyStore().DKGEncrypt().Create(ctx) - require.NoError(tt, err) - - keys := requireDKGEncryptKeyCount(tt, app, 1) - key := keys[0] - t.Log("key id:", key.ID()) - keyName := keyNameForTest(t) - - // Export test invalid id - set := flag.NewFlagSet("test DKGEncrypt export", 0) - flagSetApplyFromAction(cmd.NewDKGEncryptKeysClient(client).ExportKey, set, "") - - require.NoError(tt, set.Parse([]string{"0"})) - require.NoError(tt, set.Set("new-password", "../internal/fixtures/incorrect_password.txt")) - require.NoError(tt, set.Set("output", keyName)) - - c := cli.NewContext(nil, set, nil) - err = cmd.NewDKGEncryptKeysClient(client).ExportKey(c) - require.Error(tt, err, "Error exporting") - require.Error(tt, utils.JustError(os.Stat(keyName))) - - // Export test - set = flag.NewFlagSet("test DKGEncrypt export", 0) - flagSetApplyFromAction(cmd.NewDKGEncryptKeysClient(client).ExportKey, set, "") - - require.NoError(tt, set.Parse([]string{fmt.Sprint(key.ID())})) - require.NoError(tt, set.Set("new-password", "../internal/fixtures/incorrect_password.txt")) - require.NoError(tt, set.Set("output", keyName)) - - c = cli.NewContext(nil, set, nil) - - require.NoError(tt, cmd.NewDKGEncryptKeysClient(client).ExportKey(c)) - require.NoError(tt, utils.JustError(os.Stat(keyName))) - - require.NoError(tt, utils.JustError(app.GetKeyStore().DKGEncrypt().Delete(ctx, key.ID()))) - requireDKGEncryptKeyCount(tt, app, 0) - - //Import test - set = flag.NewFlagSet("test DKGEncrypt import", 0) - flagSetApplyFromAction(cmd.NewDKGEncryptKeysClient(client).ImportKey, set, "") - - require.NoError(tt, set.Parse([]string{keyName})) - require.NoError(tt, set.Set("old-password", "../internal/fixtures/incorrect_password.txt")) - - c = cli.NewContext(nil, set, nil) - require.NoError(tt, cmd.NewDKGEncryptKeysClient(client).ImportKey(c)) - - requireDKGEncryptKeyCount(tt, app, 1) - }) -} - -func requireDKGEncryptKeyCount(t *testing.T, app chainlink.Application, length int) []dkgencryptkey.Key { - t.Helper() - keys, err := app.GetKeyStore().DKGEncrypt().GetAll() - require.NoError(t, err) - require.Len(t, keys, length) - return keys -} diff --git a/core/cmd/dkgsign_keys_commands.go b/core/cmd/dkgsign_keys_commands.go deleted file mode 100644 index b0435450e32..00000000000 --- a/core/cmd/dkgsign_keys_commands.go +++ /dev/null @@ -1,60 +0,0 @@ -package cmd - -import ( - "github.com/smartcontractkit/chainlink-common/pkg/utils" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgsignkey" - "github.com/smartcontractkit/chainlink/v2/core/web/presenters" -) - -type DKGSignKeyPresenter struct { - JAID - presenters.DKGSignKeyResource -} - -var _ TableRenderer = DKGSignKeyPresenter{} -var _ TableRenderer = DKGSignKeyPresenters{} - -// RenderTable implements TableRenderer -func (p DKGSignKeyPresenter) RenderTable(rt RendererTable) error { - headers := []string{"ID", "Public key"} - rows := [][]string{p.ToRow()} - - if _, err := rt.Write([]byte("🔑 DKGSign Keys\n")); err != nil { - return err - } - renderList(headers, rows, rt.Writer) - - return utils.JustError(rt.Write([]byte("\n"))) -} - -func (p *DKGSignKeyPresenter) ToRow() []string { - row := []string{ - p.ID, - p.PublicKey, - } - - return row -} - -type DKGSignKeyPresenters []DKGSignKeyPresenter - -// RenderTable implements TableRenderer -func (ps DKGSignKeyPresenters) RenderTable(rt RendererTable) error { - headers := []string{"ID", "Public key"} - rows := [][]string{} - - for _, p := range ps { - rows = append(rows, p.ToRow()) - } - - if _, err := rt.Write([]byte("🔑 DKGSign Keys\n")); err != nil { - return err - } - renderList(headers, rows, rt.Writer) - - return utils.JustError(rt.Write([]byte("\n"))) -} - -func NewDKGSignKeysClient(s *Shell) KeysClient { - return newKeysClient[dkgsignkey.Key, DKGSignKeyPresenter, DKGSignKeyPresenters]("DKGSign", s) -} diff --git a/core/cmd/dkgsign_keys_commands_test.go b/core/cmd/dkgsign_keys_commands_test.go deleted file mode 100644 index 777e8a0a3c3..00000000000 --- a/core/cmd/dkgsign_keys_commands_test.go +++ /dev/null @@ -1,176 +0,0 @@ -package cmd_test - -import ( - "bytes" - "context" - "flag" - "fmt" - "os" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/urfave/cli" - - "github.com/smartcontractkit/chainlink-common/pkg/utils" - "github.com/smartcontractkit/chainlink/v2/core/cmd" - "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" - "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgsignkey" - "github.com/smartcontractkit/chainlink/v2/core/web/presenters" -) - -func TestDKGSignKeyPresenter_RenderTable(t *testing.T) { - t.Parallel() - - var ( - id = "1" - pubKey = "somepubkey" - buffer = bytes.NewBufferString("") - r = cmd.RendererTable{Writer: buffer} - ) - - p := cmd.DKGSignKeyPresenter{ - JAID: cmd.JAID{ID: id}, - DKGSignKeyResource: presenters.DKGSignKeyResource{ - JAID: presenters.NewJAID(id), - PublicKey: pubKey, - }, - } - - // Render a single resource - require.NoError(t, p.RenderTable(r)) - - output := buffer.String() - assert.Contains(t, output, id) - assert.Contains(t, output, pubKey) - - // Render many resources - buffer.Reset() - ps := cmd.DKGSignKeyPresenters{p} - require.NoError(t, ps.RenderTable(r)) - - output = buffer.String() - assert.Contains(t, output, id) - assert.Contains(t, output, pubKey) -} - -func TestShell_DKGSignKeys(t *testing.T) { - app := startNewApplicationV2(t, nil) - ks := app.GetKeyStore().DKGSign() - cleanup := func() { - ctx := context.Background() - keys, err := ks.GetAll() - assert.NoError(t, err) - for _, key := range keys { - assert.NoError(t, utils.JustError(ks.Delete(ctx, key.ID()))) - } - requireDKGSignKeyCount(t, app, 0) - } - - t.Run("ListDKGSignKeys", func(tt *testing.T) { - defer cleanup() - ctx := testutils.Context(t) - client, r := app.NewShellAndRenderer() - key, err := app.GetKeyStore().DKGSign().Create(ctx) - assert.NoError(tt, err) - requireDKGSignKeyCount(t, app, 1) - assert.Nil(t, cmd.NewDKGSignKeysClient(client).ListKeys(cltest.EmptyCLIContext())) - assert.Equal(t, 1, len(r.Renders)) - keys := *r.Renders[0].(*cmd.DKGSignKeyPresenters) - assert.True(t, key.PublicKeyString() == keys[0].PublicKey) - }) - - t.Run("CreateDKGSignKey", func(tt *testing.T) { - defer cleanup() - client, _ := app.NewShellAndRenderer() - assert.NoError(tt, cmd.NewDKGSignKeysClient(client).CreateKey(nilContext)) - keys, err := app.GetKeyStore().DKGSign().GetAll() - assert.NoError(tt, err) - assert.Len(t, keys, 1) - }) - - t.Run("DeleteDKGSignKey", func(tt *testing.T) { - defer cleanup() - ctx := testutils.Context(t) - client, _ := app.NewShellAndRenderer() - key, err := app.GetKeyStore().DKGSign().Create(ctx) - assert.NoError(tt, err) - requireDKGSignKeyCount(tt, app, 1) - set := flag.NewFlagSet("test", 0) - flagSetApplyFromAction(cmd.NewDKGSignKeysClient(client).DeleteKey, set, "") - - require.NoError(tt, set.Set("yes", "true")) - strID := key.ID() - err = set.Parse([]string{strID}) - require.NoError(t, err) - c := cli.NewContext(nil, set, nil) - err = cmd.NewDKGSignKeysClient(client).DeleteKey(c) - assert.NoError(tt, err) - requireDKGSignKeyCount(tt, app, 0) - }) - - t.Run("ImportExportDKGSignKey", func(tt *testing.T) { - defer cleanup() - defer deleteKeyExportFile(tt) - ctx := testutils.Context(t) - client, _ := app.NewShellAndRenderer() - - _, err := app.GetKeyStore().DKGSign().Create(ctx) - require.NoError(tt, err) - - keys := requireDKGSignKeyCount(tt, app, 1) - key := keys[0] - t.Log("key id:", key.ID()) - keyName := keyNameForTest(t) - - // Export test invalid id - set := flag.NewFlagSet("test DKGSign export", 0) - flagSetApplyFromAction(cmd.NewDKGSignKeysClient(client).ExportKey, set, "") - - require.NoError(tt, set.Parse([]string{"0"})) - require.NoError(tt, set.Set("new-password", "../internal/fixtures/incorrect_password.txt")) - require.NoError(tt, set.Set("output", keyName)) - - c := cli.NewContext(nil, set, nil) - err = cmd.NewDKGSignKeysClient(client).ExportKey(c) - require.Error(tt, err) - require.Error(tt, utils.JustError(os.Stat(keyName))) - - // Export test - set = flag.NewFlagSet("test DKGSign export", 0) - flagSetApplyFromAction(cmd.NewDKGSignKeysClient(client).ExportKey, set, "") - - require.NoError(tt, set.Parse([]string{fmt.Sprint(key.ID())})) - require.NoError(tt, set.Set("new-password", "../internal/fixtures/incorrect_password.txt")) - require.NoError(tt, set.Set("output", keyName)) - - c = cli.NewContext(nil, set, nil) - - require.NoError(tt, cmd.NewDKGSignKeysClient(client).ExportKey(c)) - require.NoError(tt, utils.JustError(os.Stat(keyName))) - - require.NoError(tt, utils.JustError(app.GetKeyStore().DKGSign().Delete(ctx, key.ID()))) - requireDKGSignKeyCount(tt, app, 0) - - set = flag.NewFlagSet("test DKGSign import", 0) - flagSetApplyFromAction(cmd.NewDKGSignKeysClient(client).ImportKey, set, "") - - require.NoError(tt, set.Parse([]string{keyName})) - require.NoError(tt, set.Set("old-password", "../internal/fixtures/incorrect_password.txt")) - - c = cli.NewContext(nil, set, nil) - require.NoError(tt, cmd.NewDKGSignKeysClient(client).ImportKey(c)) - - requireDKGSignKeyCount(tt, app, 1) - }) -} - -func requireDKGSignKeyCount(t *testing.T, app chainlink.Application, length int) []dkgsignkey.Key { - t.Helper() - keys, err := app.GetKeyStore().DKGSign().GetAll() - require.NoError(t, err) - require.Len(t, keys, length) - return keys -} diff --git a/core/cmd/ocr2vrf_configure_commands.go b/core/cmd/ocr2vrf_configure_commands.go deleted file mode 100644 index 7f5b0321480..00000000000 --- a/core/cmd/ocr2vrf_configure_commands.go +++ /dev/null @@ -1,509 +0,0 @@ -package cmd - -import ( - "context" - "encoding/hex" - "fmt" - "math/big" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/pelletier/go-toml" - "github.com/pkg/errors" - "github.com/urfave/cli" - - "github.com/jmoiron/sqlx" - - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" - ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/authorized_forwarder" - "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" - "github.com/smartcontractkit/chainlink/v2/core/services/pg" - "github.com/smartcontractkit/chainlink/v2/core/static" - "github.com/smartcontractkit/chainlink/v2/core/utils" -) - -type SetupOCR2VRFNodePayload struct { - OnChainPublicKey string - OffChainPublicKey string - ConfigPublicKey string - PeerID string - Transmitter string - DkgEncrypt string - DkgSign string - SendingKeys []string -} - -type dkgTemplateArgs struct { - contractID string - ocrKeyBundleID string - p2pv2BootstrapperPeerID string - p2pv2BootstrapperPort string - transmitterID string - useForwarder bool - chainID int64 - encryptionPublicKey string - keyID string - signingPublicKey string -} - -type ocr2vrfTemplateArgs struct { - dkgTemplateArgs - vrfBeaconAddress string - vrfCoordinatorAddress string - linkEthFeedAddress string - sendingKeys []string -} - -const DKGTemplate = ` -# DKGSpec -type = "offchainreporting2" -schemaVersion = 1 -name = "ocr2" -maxTaskDuration = "30s" -contractID = "%s" -ocrKeyBundleID = "%s" -relay = "evm" -pluginType = "dkg" -transmitterID = "%s" -forwardingAllowed = %t -%s - -[relayConfig] -chainID = %d - -[pluginConfig] -EncryptionPublicKey = "%s" -KeyID = "%s" -SigningPublicKey = "%s" -` - -const OCR2VRFTemplate = ` -type = "offchainreporting2" -schemaVersion = 1 -name = "ocr2vrf-chainID-%d" -maxTaskDuration = "30s" -contractID = "%s" -ocrKeyBundleID = "%s" -relay = "evm" -pluginType = "ocr2vrf" -transmitterID = "%s" -forwardingAllowed = %t -%s - -[relayConfig] -chainID = %d -sendingKeys = [%s] - -[pluginConfig] -dkgEncryptionPublicKey = "%s" -dkgSigningPublicKey = "%s" -dkgKeyID = "%s" -dkgContractAddress = "%s" - -vrfCoordinatorAddress = "%s" -linkEthFeedAddress = "%s" -` - -const BootstrapTemplate = ` -type = "bootstrap" -schemaVersion = 1 -name = "bootstrap-chainID-%d" -id = "1" -contractID = "%s" -relay = "evm" - -[relayConfig] -chainID = %d -` - -const forwarderAdditionalEOACount = 4 - -func (s *Shell) ConfigureOCR2VRFNode(c *cli.Context, owner *bind.TransactOpts, ec *ethclient.Client) (*SetupOCR2VRFNodePayload, error) { - ctx := s.ctx() - lggr := logger.Sugared(s.Logger.Named("ConfigureOCR2VRFNode")) - lggr.Infow( - fmt.Sprintf("Configuring Chainlink Node for job type %s %s at commit %s", c.String("job-type"), static.Version, static.Sha), - "Version", static.Version, "SHA", static.Sha) - - var pwd, vrfpwd *string - if passwordFile := c.String("password"); passwordFile != "" { - p, err := utils.PasswordFromFile(passwordFile) - if err != nil { - return nil, errors.Wrap(err, "error reading password from file") - } - pwd = &p - } - if vrfPasswordFile := c.String("vrfpassword"); len(vrfPasswordFile) != 0 { - p, err := utils.PasswordFromFile(vrfPasswordFile) - if err != nil { - return nil, errors.Wrapf(err, "error reading VRF password from vrfpassword file \"%s\"", vrfPasswordFile) - } - vrfpwd = &p - } - - s.Config.SetPasswords(pwd, vrfpwd) - - err := s.Config.Validate() - if err != nil { - return nil, s.errorOut(errors.Wrap(err, "config validation failed")) - } - - cfg := s.Config - ldb := pg.NewLockedDB(cfg.AppID(), cfg.Database(), cfg.Database().Lock(), lggr) - - if err = ldb.Open(ctx); err != nil { - return nil, s.errorOut(errors.Wrap(err, "opening db")) - } - defer lggr.ErrorIfFn(ldb.Close, "Error closing db") - - app, err := s.AppFactory.NewApplication(ctx, s.Config, lggr, ldb.DB()) - if err != nil { - return nil, s.errorOut(errors.Wrap(err, "fatal error instantiating application")) - } - - chainID := c.Int64("chainID") - - // Initialize keystore and generate keys. - keyStore := app.GetKeyStore() - err = setupKeystore(ctx, s, app, keyStore) - if err != nil { - return nil, s.errorOut(err) - } - - // Start application. - err = app.Start(ctx) - if err != nil { - return nil, s.errorOut(err) - } - - // Close application. - defer lggr.ErrorIfFn(app.Stop, "Failed to Stop application") - - // Initialize transmitter settings. - var sendingKeys []string - var sendingKeysAddresses []common.Address - useForwarder := c.Bool("use-forwarder") - ethKeys, err := app.GetKeyStore().Eth().EnabledKeysForChain(ctx, big.NewInt(chainID)) - if err != nil { - return nil, s.errorOut(err) - } - transmitterID := ethKeys[0].Address.String() - - // Populate sendingKeys with current ETH keys. - for _, k := range ethKeys { - sendingKeys = append(sendingKeys, k.Address.String()) - sendingKeysAddresses = append(sendingKeysAddresses, k.Address) - } - - if useForwarder { - // Add extra sending keys if using a forwarder. - sendingKeys, sendingKeysAddresses, err = s.appendForwarders(ctx, chainID, app.GetKeyStore().Eth(), sendingKeys, sendingKeysAddresses) - if err != nil { - return nil, err - } - err = s.authorizeForwarder(c, ldb.DB(), chainID, ec, owner, sendingKeysAddresses) - if err != nil { - return nil, err - } - } - - // Get all configuration parameters. - keyID := c.String("keyID") - dkgEncrypt, _ := app.GetKeyStore().DKGEncrypt().GetAll() - dkgSign, _ := app.GetKeyStore().DKGSign().GetAll() - dkgEncryptKey := dkgEncrypt[0].PublicKeyString() - dkgSignKey := dkgSign[0].PublicKeyString() - p2p, _ := app.GetKeyStore().P2P().GetAll() - ocr2List, _ := app.GetKeyStore().OCR2().GetAll() - peerID := p2p[0].PeerID().Raw() - if !c.Bool("isBootstrapper") { - peerID = c.String("bootstrapperPeerID") - } - - // Find the EVM OCR2 bundle. - var ocr2 ocr2key.KeyBundle - for _, ocr2Item := range ocr2List { - if ocr2Item.ChainType() == chaintype.EVM { - ocr2 = ocr2Item - } - } - if ocr2 == nil { - return nil, s.errorOut(errors.Wrap(job.ErrNoSuchKeyBundle, "evm OCR2 key bundle not found")) - } - offChainPublicKey := ocr2.OffchainPublicKey() - configPublicKey := ocr2.ConfigEncryptionPublicKey() - - if c.Bool("isBootstrapper") { - // Set up bootstrapper job if bootstrapper. - err = createBootstrapperJob(ctx, lggr, c, app) - } else if c.String("job-type") == "DKG" { - // Set up DKG job. - err = createDKGJob(ctx, lggr, app, dkgTemplateArgs{ - contractID: c.String("contractID"), - ocrKeyBundleID: ocr2.ID(), - p2pv2BootstrapperPeerID: peerID, - p2pv2BootstrapperPort: c.String("bootstrapPort"), - transmitterID: transmitterID, - useForwarder: useForwarder, - chainID: chainID, - encryptionPublicKey: dkgEncryptKey, - keyID: keyID, - signingPublicKey: dkgSignKey, - }) - } else if c.String("job-type") == "OCR2VRF" { - // Set up OCR2VRF job. - err = createOCR2VRFJob(ctx, lggr, app, ocr2vrfTemplateArgs{ - dkgTemplateArgs: dkgTemplateArgs{ - contractID: c.String("dkg-address"), - ocrKeyBundleID: ocr2.ID(), - p2pv2BootstrapperPeerID: peerID, - p2pv2BootstrapperPort: c.String("bootstrapPort"), - transmitterID: transmitterID, - useForwarder: useForwarder, - chainID: chainID, - encryptionPublicKey: dkgEncryptKey, - keyID: keyID, - signingPublicKey: dkgSignKey, - }, - vrfBeaconAddress: c.String("vrf-beacon-address"), - vrfCoordinatorAddress: c.String("vrf-coordinator-address"), - linkEthFeedAddress: c.String("link-eth-feed-address"), - sendingKeys: sendingKeys, - }) - } else { - err = fmt.Errorf("unknown job type: %s", c.String("job-type")) - } - - if err != nil { - return nil, err - } - - return &SetupOCR2VRFNodePayload{ - OnChainPublicKey: ocr2.OnChainPublicKey(), - OffChainPublicKey: hex.EncodeToString(offChainPublicKey[:]), - ConfigPublicKey: hex.EncodeToString(configPublicKey[:]), - PeerID: p2p[0].PeerID().Raw(), - Transmitter: transmitterID, - DkgEncrypt: dkgEncryptKey, - DkgSign: dkgSignKey, - SendingKeys: sendingKeys, - }, nil -} - -func (s *Shell) appendForwarders(ctx context.Context, chainID int64, ks keystore.Eth, sendingKeys []string, sendingKeysAddresses []common.Address) ([]string, []common.Address, error) { - for i := 0; i < forwarderAdditionalEOACount; i++ { - // Create the sending key in the keystore. - k, err := ks.Create(ctx) - if err != nil { - return nil, nil, err - } - - // Enable the sending key for the current chain. - err = ks.Enable(ctx, k.Address, big.NewInt(chainID)) - if err != nil { - return nil, nil, err - } - - sendingKeys = append(sendingKeys, k.Address.String()) - sendingKeysAddresses = append(sendingKeysAddresses, k.Address) - } - - return sendingKeys, sendingKeysAddresses, nil -} - -func (s *Shell) authorizeForwarder(c *cli.Context, db *sqlx.DB, chainID int64, ec *ethclient.Client, owner *bind.TransactOpts, sendingKeysAddresses []common.Address) error { - ctx := s.ctx() - // Replace the transmitter ID with the forwarder address. - forwarderAddress := c.String("forwarder-address") - - // We have to set the authorized senders on-chain here, otherwise the job spawner will fail as the - // forwarder will not be recognized. - ctx, cancel := context.WithTimeout(ctx, 300*time.Second) - defer cancel() - f, err := authorized_forwarder.NewAuthorizedForwarder(common.HexToAddress(forwarderAddress), ec) - if err != nil { - return err - } - tx, err := f.SetAuthorizedSenders(owner, sendingKeysAddresses) - if err != nil { - return err - } - _, err = bind.WaitMined(ctx, ec, tx) - if err != nil { - return err - } - - // Create forwarder for management in forwarder_manager.go. - orm := forwarders.NewORM(db) - _, err = orm.CreateForwarder(ctx, common.HexToAddress(forwarderAddress), *ubig.NewI(chainID)) - if err != nil { - return err - } - - return nil -} - -func setupKeystore(ctx context.Context, cli *Shell, app chainlink.Application, keyStore keystore.Master) error { - if err := cli.KeyStoreAuthenticator.authenticate(ctx, keyStore, cli.Config.Password()); err != nil { - return errors.Wrap(err, "error authenticating keystore") - } - - if cli.Config.EVMEnabled() { - chains, err := app.GetRelayers().LegacyEVMChains().List() - if err != nil { - return fmt.Errorf("failed to get legacy evm chains") - } - for _, ch := range chains { - if err = keyStore.Eth().EnsureKeys(ctx, ch.ID()); err != nil { - return errors.Wrap(err, "failed to ensure keystore keys") - } - } - } - - var enabledChains []chaintype.ChainType - if cli.Config.EVMEnabled() { - enabledChains = append(enabledChains, chaintype.EVM) - } - if cli.Config.CosmosEnabled() { - enabledChains = append(enabledChains, chaintype.Cosmos) - } - if cli.Config.SolanaEnabled() { - enabledChains = append(enabledChains, chaintype.Solana) - } - if cli.Config.StarkNetEnabled() { - enabledChains = append(enabledChains, chaintype.StarkNet) - } - - if err := keyStore.OCR2().EnsureKeys(ctx, enabledChains...); err != nil { - return errors.Wrap(err, "failed to ensure ocr key") - } - - if err := keyStore.DKGSign().EnsureKey(ctx); err != nil { - return errors.Wrap(err, "failed to ensure dkgsign key") - } - - if err := keyStore.DKGEncrypt().EnsureKey(ctx); err != nil { - return errors.Wrap(err, "failed to ensure dkgencrypt key") - } - - if err := keyStore.P2P().EnsureKey(ctx); err != nil { - return errors.Wrap(err, "failed to ensure p2p key") - } - - return nil -} - -func createBootstrapperJob(ctx context.Context, lggr logger.Logger, c *cli.Context, app chainlink.Application) error { - sp := fmt.Sprintf(BootstrapTemplate, - c.Int64("chainID"), - c.String("contractID"), - c.Int64("chainID"), - ) - var jb job.Job - err := toml.Unmarshal([]byte(sp), &jb) - if err != nil { - return errors.Wrap(err, "failed to unmarshal job spec") - } - var os job.BootstrapSpec - err = toml.Unmarshal([]byte(sp), &os) - if err != nil { - return errors.Wrap(err, "failed to unmarshal job spec") - } - jb.BootstrapSpec = &os - - err = app.AddJobV2(ctx, &jb) - if err != nil { - return errors.Wrap(err, "failed to add job") - } - lggr.Info("bootstrap spec:", sp) - - // Give a cooldown - time.Sleep(time.Second) - - return nil -} - -func createDKGJob(ctx context.Context, lggr logger.Logger, app chainlink.Application, args dkgTemplateArgs) error { - sp := fmt.Sprintf(DKGTemplate, - args.contractID, - args.ocrKeyBundleID, - args.transmitterID, - args.useForwarder, - fmt.Sprintf(`p2pv2Bootstrappers = ["%s@127.0.0.1:%s"]`, args.p2pv2BootstrapperPeerID, args.p2pv2BootstrapperPort), - args.chainID, - args.encryptionPublicKey, - args.keyID, - args.signingPublicKey, - ) - - var jb job.Job - err := toml.Unmarshal([]byte(sp), &jb) - if err != nil { - return errors.Wrap(err, "failed to unmarshal job spec") - } - var os job.OCR2OracleSpec - err = toml.Unmarshal([]byte(sp), &os) - if err != nil { - return errors.Wrap(err, "failed to unmarshal job spec") - } - jb.OCR2OracleSpec = &os - - err = app.AddJobV2(ctx, &jb) - if err != nil { - return errors.Wrap(err, "failed to add job") - } - lggr.Info("dkg spec:", sp) - - return nil -} - -func createOCR2VRFJob(ctx context.Context, lggr logger.Logger, app chainlink.Application, args ocr2vrfTemplateArgs) error { - var sendingKeysString = fmt.Sprintf(`"%s"`, args.sendingKeys[0]) - for x := 1; x < len(args.sendingKeys); x++ { - sendingKeysString = fmt.Sprintf(`%s,"%s"`, sendingKeysString, args.sendingKeys[x]) - } - sp := fmt.Sprintf(OCR2VRFTemplate, - args.chainID, - args.vrfBeaconAddress, - args.ocrKeyBundleID, - args.transmitterID, - args.useForwarder, - fmt.Sprintf(`p2pv2Bootstrappers = ["%s@127.0.0.1:%s"]`, args.p2pv2BootstrapperPeerID, args.p2pv2BootstrapperPort), - args.chainID, - sendingKeysString, - args.encryptionPublicKey, - args.signingPublicKey, - args.keyID, - args.contractID, - args.vrfCoordinatorAddress, - args.linkEthFeedAddress, - ) - - var jb job.Job - err := toml.Unmarshal([]byte(sp), &jb) - if err != nil { - return errors.Wrap(err, "failed to unmarshal job spec") - } - var os job.OCR2OracleSpec - err = toml.Unmarshal([]byte(sp), &os) - if err != nil { - return errors.Wrap(err, "failed to unmarshal job spec") - } - jb.OCR2OracleSpec = &os - - err = app.AddJobV2(ctx, &jb) - if err != nil { - return errors.Wrap(err, "failed to add job") - } - lggr.Info("ocr2vrf spec:", sp) - - return nil -} diff --git a/core/gethwrappers/ocr2vrf/generated/dkg/dkg.go b/core/gethwrappers/ocr2vrf/generated/dkg/dkg.go deleted file mode 100644 index 7a18b7f55bd..00000000000 --- a/core/gethwrappers/ocr2vrf/generated/dkg/dkg.go +++ /dev/null @@ -1,1274 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package dkg - -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 KeyDataStructKeyData struct { - PublicKey []byte - Hashes [][32]byte -} - -var DKGMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expectedLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"actualLength\",\"type\":\"uint256\"}],\"name\":\"CalldataLengthMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"expected\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"actual\",\"type\":\"bytes32\"}],\"name\":\"ConfigDigestMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncorrectNumberOfFaultyOracles\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expectedNumSignatures\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rsLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ssLength\",\"type\":\"uint256\"}],\"name\":\"IncorrectNumberOfSignatures\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"expectedLength\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"actualLength\",\"type\":\"uint256\"}],\"name\":\"InvalidOnchainConfigLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"}],\"name\":\"InvalidSigner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"InvalidTransmitter\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"KeyIDCopyFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonUniqueSignature\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"numFaultyOracles\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"numSigners\",\"type\":\"uint256\"}],\"name\":\"NumberOfFaultyOraclesTooHigh\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"repeatedSignerAddress\",\"type\":\"address\"}],\"name\":\"RepeatedSigner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"repeatedTransmitterAddress\",\"type\":\"address\"}],\"name\":\"RepeatedTransmitter\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numSigners\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numTransmitters\",\"type\":\"uint256\"}],\"name\":\"SignersTransmittersMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"maxOracles\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"providedOracles\",\"type\":\"uint256\"}],\"name\":\"TooManyOracles\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousConfigBlockNumber\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"configCount\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"signers\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"transmitters\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"onchainConfig\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"offchainConfigVersion\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"offchainConfig\",\"type\":\"bytes\"}],\"name\":\"ConfigSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contractDKGClient\",\"name\":\"client\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"errorData\",\"type\":\"bytes\"}],\"name\":\"DKGClientError\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"keyID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"publicKey\",\"type\":\"bytes\"},{\"internalType\":\"bytes32[]\",\"name\":\"hashes\",\"type\":\"bytes32[]\"}],\"indexed\":false,\"internalType\":\"structKeyDataStruct.KeyData\",\"name\":\"key\",\"type\":\"tuple\"}],\"name\":\"KeyGenerated\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"}],\"name\":\"Transmitted\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"keyID\",\"type\":\"bytes32\"},{\"internalType\":\"contractDKGClient\",\"name\":\"clientAddress\",\"type\":\"address\"}],\"name\":\"addClient\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_keyID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_configDigest\",\"type\":\"bytes32\"}],\"name\":\"getKey\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"publicKey\",\"type\":\"bytes\"},{\"internalType\":\"bytes32[]\",\"name\":\"hashes\",\"type\":\"bytes32[]\"}],\"internalType\":\"structKeyDataStruct.KeyData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestConfigDetails\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"configCount\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"blockNumber\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestConfigDigestAndEpoch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"scanLogs\",\"type\":\"bool\"},{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"keyID\",\"type\":\"bytes32\"},{\"internalType\":\"contractDKGClient\",\"name\":\"clientAddress\",\"type\":\"address\"}],\"name\":\"removeClient\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_signers\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_transmitters\",\"type\":\"address[]\"},{\"internalType\":\"uint8\",\"name\":\"_f\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"_onchainConfig\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"_offchainConfigVersion\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"_offchainConfig\",\"type\":\"bytes\"}],\"name\":\"setConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[3]\",\"name\":\"reportContext\",\"type\":\"bytes32[3]\"},{\"internalType\":\"bytes\",\"name\":\"report\",\"type\":\"bytes\"},{\"internalType\":\"bytes32[]\",\"name\":\"rs\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"ss\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32\",\"name\":\"rawVs\",\"type\":\"bytes32\"}],\"name\":\"transmit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"typeAndVersion\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", - Bin: "0x60806040523480156200001157600080fd5b503380600081620000695760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b03848116919091179091558116156200009c576200009c81620000a5565b50505062000150565b336001600160a01b03821603620000ff5760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640162000060565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b612b8080620001606000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80638da5cb5b11610081578063c3105a6b1161005b578063c3105a6b146101db578063e3d0e712146101fb578063f2fde38b1461020e57600080fd5b80638da5cb5b14610176578063afcb95d71461019e578063b1dc65a4146101c857600080fd5b806379ba5097116100b257806379ba50971461012b5780637bf1ffc51461013357806381ff70481461014657600080fd5b8063181f5a77146100ce5780635429a79e14610116575b600080fd5b604080518082018252600981527f444b4720302e302e3100000000000000000000000000000000000000000000006020820152905161010d9190611fc8565b60405180910390f35b610129610124366004612004565b610221565b005b6101296104b0565b610129610141366004612004565b6105b2565b6007546005546040805163ffffffff8085168252640100000000909404909316602084015282015260600161010d565b60005460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010d565b6005546004546040805160008152602081019390935263ffffffff9091169082015260600161010d565b6101296101d6366004612080565b61061e565b6101ee6101e9366004612165565b610761565b60405161010d9190612187565b6101296102093660046123dd565b61088a565b61012961021c3660046124aa565b6111ec565b610229611200565b60008281526002602090815260408083208054825181850281018501909352808352919290919083018282801561029657602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161026b575b505050505090506000815167ffffffffffffffff8111156102b9576102b961220d565b6040519080825280602002602001820160405280156102e2578160200160208202803683370190505b5090506000805b83518110156103b9578473ffffffffffffffffffffffffffffffffffffffff1684828151811061031b5761031b6124c7565b602002602001015173ffffffffffffffffffffffffffffffffffffffff161461039957848361034a8484612525565b8151811061035a5761035a6124c7565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506103a7565b816103a381612538565b9250505b806103b181612538565b9150506102e9565b5060008184516103c99190612525565b67ffffffffffffffff8111156103e1576103e161220d565b60405190808252806020026020018201604052801561040a578160200160208202803683370190505b50905060005b82855161041d9190612525565b81101561048757838181518110610436576104366124c7565b6020026020010151828281518110610450576104506124c7565b73ffffffffffffffffffffffffffffffffffffffff909216602092830291909101909101528061047f81612538565b915050610410565b50600086815260026020908152604090912082516104a792840190611e61565b50505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff163314610536576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e65720000000000000000000060448201526064015b60405180910390fd5b60008054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217845560018054909116905560405173ffffffffffffffffffffffffffffffffffffffff90921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6105ba611200565b600091825260026020908152604083208054600181018255908452922090910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055565b60005a604080516020601f8b018190048102820181019092528981529192508a3591818c01359161066e9184918491908e908e908190840183828082843760009201919091525061128392505050565b6040805183815263ffffffff600884901c1660208201527fb04e63db38c49950639fa09d29872f21f5d49d614f3a969d8adf3d4b52e41a62910160405180910390a16040805160608101825260055480825260065460ff808216602085015261010090910416928201929092529083146107215780516040517f93df584c00000000000000000000000000000000000000000000000000000000815260048101919091526024810184905260440161052d565b61072f8b8b8b8b8b8b611512565b6107408c8c8c8c8c8c8c8c89611599565b50505063ffffffff811061075657610756612570565b505050505050505050565b604080518082019091526060808252602082015260008381526003602090815260408083208584529091529081902081518083019092528054829082906107a79061259f565b80601f01602080910402602001604051908101604052809291908181526020018280546107d39061259f565b80156108205780601f106107f557610100808354040283529160200191610820565b820191906000526020600020905b81548152906001019060200180831161080357829003601f168201915b505050505081526020016001820180548060200260200160405190810160405280929190818152602001828054801561087857602002820191906000526020600020905b815481526020019060010190808311610864575b50505050508152505090505b92915050565b8551855185601f8311156108d4576040517f809fc428000000000000000000000000000000000000000000000000000000008152601f60048201526024810184905260440161052d565b818314610917576040517f988a0804000000000000000000000000000000000000000000000000000000008152600481018490526024810183905260440161052d565b6109228160036125f2565b60ff168311610969576040517ffda9db7800000000000000000000000000000000000000000000000000000000815260ff821660048201526024810184905260440161052d565b8060ff166000036109a6576040517fe77dba5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109ae611200565b6040805160c0810182528a8152602081018a905260ff8916918101919091526060810187905267ffffffffffffffff8616608082015260a081018590525b60095415610ba157600954600090610a0690600190612525565b9050600060098281548110610a1d57610a1d6124c7565b6000918252602082200154600a805473ffffffffffffffffffffffffffffffffffffffff90921693509084908110610a5757610a576124c7565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff85811684526008909252604080842080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000090811690915592909116808452922080549091169055600980549192509080610ad757610ad7612615565b60008281526020902081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055019055600a805480610b4057610b40612615565b60008281526020902081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055019055506109ec915050565b60005b81515181101561101c5760006008600084600001518481518110610bca57610bca6124c7565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff16825281019190915260400160002054610100900460ff166002811115610c1457610c14612644565b14610c84578151805182908110610c2d57610c2d6124c7565b60200260200101516040517f7451f83e00000000000000000000000000000000000000000000000000000000815260040161052d919073ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b6040805180820190915260ff82168152600160208201528251805160089160009185908110610cb557610cb56124c7565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff168252818101929092526040016000208251815460ff9091167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0082168117835592840151919283917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001617610100836002811115610d5657610d56612644565b021790555060009150610d669050565b6008600084602001518481518110610d8057610d806124c7565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff16825281019190915260400160002054610100900460ff166002811115610dca57610dca612644565b14610e3c5781602001518181518110610de557610de56124c7565b60200260200101516040517fe8d2989900000000000000000000000000000000000000000000000000000000815260040161052d919073ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b6040805180820190915260ff821681526020810160028152506008600084602001518481518110610e6f57610e6f6124c7565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff168252818101929092526040016000208251815460ff9091167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0082168117835592840151919283917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001617610100836002811115610f1057610f10612644565b021790555050825180516009925083908110610f2e57610f2e6124c7565b602090810291909101810151825460018101845560009384529282902090920180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909316929092179091558201518051600a919083908110610faa57610faa6124c7565b60209081029190910181015182546001810184556000938452919092200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9092169190911790558061101481612538565b915050610ba4565b506040810151600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff909216919091179055600754640100000000900463ffffffff1661106c611a2f565b6007805463ffffffff928316640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff8216811783556001936000926110bd928692908116911617612673565b92506101000a81548163ffffffff021916908363ffffffff160217905550600061111e4630600760009054906101000a900463ffffffff1663ffffffff1686600001518760200151886040015189606001518a608001518b60a00151611ac6565b6005819055835180516006805460ff909216610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff9092169190911790556007546020860151604080880151606089015160808a015160a08b015193519798507f1591690b8638f5fb2dbec82ac741805ac5da8b45dc5263f4875b0496fdce4e05976111c3978b978b9763ffffffff9091169691959094909390929091906126e1565b60405180910390a16111de8360400151846060015183611b71565b505050505050505050505050565b6111f4611200565b6111fd81611d6c565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314611281576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015260640161052d565b565b60006060808380602001905181019061129c9190612777565b60408051808201825283815260208082018490526000868152600282528381208054855181850281018501909652808652979a509598509396509094929391929083018282801561132357602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116112f8575b5050505050905060005b815181101561144d57818181518110611348576113486124c7565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1663bf2732c7846040518263ffffffff1660e01b81526004016113889190612187565b600060405180830381600087803b1580156113a257600080fd5b505af19250505080156113b3575060015b61143b573d8080156113e1576040519150601f19603f3d011682016040523d82523d6000602084013e6113e6565b606091505b507f116391732f5df106193bda7cedf1728f3b07b62f6cdcdd611c9eeec44efcae5483838151811061141a5761141a6124c7565b602002602001015182604051611431929190612875565b60405180910390a1505b8061144581612538565b91505061132d565b5060008581526003602090815260408083208b845290915290208251839190819061147890826128fb565b5060208281015180516114919260018501920190611eeb565b5090505084887fc8db841f5b2231ccf7190311f440aa197b161e369f3b40b023508160cc555656846040516114c69190612187565b60405180910390a350506004805460089690961c63ffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000909616959095179094555050505050565b600061151f826020612a15565b61152a856020612a15565b61153688610144612a2c565b6115409190612a2c565b61154a9190612a2c565b611555906000612a2c565b90503681146104a7576040517ff7b94f0a0000000000000000000000000000000000000000000000000000000081526004810182905236602482015260440161052d565b60006002826020015183604001516115b19190612a3f565b6115bb9190612a58565b6115c6906001612a3f565b60408051600180825281830190925260ff929092169250600091906020820181803683370190505090508160f81b81600081518110611607576116076124c7565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535086821415806116455750868514155b1561168d576040517fe307bd5700000000000000000000000000000000000000000000000000000000815260048101839052602481018890526044810186905260640161052d565b3360009081526008602090815260408083208151808301909252805460ff808216845292939192918401916101009091041660028111156116d0576116d0612644565b60028111156116e1576116e1612644565b90525090506002816020015160028111156116fe576116fe612644565b1415806117465750600a816000015160ff1681548110611720576117206124c7565b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff163314155b1561177f576040517f2d0f0c0f00000000000000000000000000000000000000000000000000000000815233600482015260240161052d565b50505060008888604051611794929190612aa1565b6040519081900381206117ab918c90602001612ab1565b6040516020818303038152906040528051906020012090506117cb611f26565b604080518082019091526000808252602082015260005b88811015611a20576000600185888460208110611801576118016124c7565b61180e91901a601b612a3f565b8d8d86818110611820576118206124c7565b905060200201358c8c87818110611839576118396124c7565b9050602002013560405160008152602001604052604051611876949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa158015611898573d6000803e3d6000fd5b5050604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081015173ffffffffffffffffffffffffffffffffffffffff811660009081526008602090815290849020838501909452835460ff8082168552929650929450840191610100900416600281111561191857611918612644565b600281111561192957611929612644565b905250925060018360200151600281111561194657611946612644565b14611995576040517fbf18af4300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260240161052d565b8251849060ff16601f81106119ac576119ac6124c7565b6020020151156119e8576040517f21cf3b4400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600184846000015160ff16601f8110611a0357611a036124c7565b911515602090920201525080611a1881612538565b9150506117e2565b50505050505050505050505050565b60004661a4b1811480611a44575062066eed81145b15611abf57606473ffffffffffffffffffffffffffffffffffffffff1663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab99190612ac5565b91505090565b4391505090565b6000808a8a8a8a8a8a8a8a8a604051602001611aea99989796959493929190612ade565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101207dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167e01000000000000000000000000000000000000000000000000000000000000179150509998505050505050505050565b6000808351602014611bbc5783516040517f1625adfe00000000000000000000000000000000000000000000000000000000815260206004820152602481019190915260440161052d565b60208401519150808203611bfc576040517faf5e77d000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051808201909152606080825260208201526000838152600360209081526040808320878452909152902081518291908190611c3a90826128fb565b506020828101518051611c539260018501920190611eeb565b505050600083815260026020908152604080832080548251818502810185019093528083529192909190830182828015611cc357602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611c98575b5050505050905060005b8151811015611d6257818181518110611ce857611ce86124c7565b602002602001015173ffffffffffffffffffffffffffffffffffffffff166355e487496040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611d3757600080fd5b505af1158015611d4b573d6000803e3d6000fd5b505050508080611d5a90612538565b915050611ccd565b5050505050505050565b3373ffffffffffffffffffffffffffffffffffffffff821603611deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640161052d565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b828054828255906000526020600020908101928215611edb579160200282015b82811115611edb57825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611e81565b50611ee7929150611f45565b5090565b828054828255906000526020600020908101928215611edb579160200282015b82811115611edb578251825591602001919060010190611f0b565b604051806103e00160405280601f906020820280368337509192915050565b5b80821115611ee75760008155600101611f46565b60005b83811015611f75578181015183820152602001611f5d565b50506000910152565b60008151808452611f96816020860160208601611f5a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000611fdb6020830184611f7e565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff811681146111fd57600080fd5b6000806040838503121561201757600080fd5b82359150602083013561202981611fe2565b809150509250929050565b60008083601f84011261204657600080fd5b50813567ffffffffffffffff81111561205e57600080fd5b6020830191508360208260051b850101111561207957600080fd5b9250929050565b60008060008060008060008060e0898b03121561209c57600080fd5b606089018a8111156120ad57600080fd5b8998503567ffffffffffffffff808211156120c757600080fd5b818b0191508b601f8301126120db57600080fd5b8135818111156120ea57600080fd5b8c60208285010111156120fc57600080fd5b6020830199508098505060808b013591508082111561211a57600080fd5b6121268c838d01612034565b909750955060a08b013591508082111561213f57600080fd5b5061214c8b828c01612034565b999c989b50969995989497949560c00135949350505050565b6000806040838503121561217857600080fd5b50508035926020909101359150565b6000602080835283516040828501526121a36060850182611f7e565b858301518582037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0016040870152805180835290840192506000918401905b8083101561220257835182529284019260019290920191908401906121e2565b509695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156122835761228361220d565b604052919050565b600067ffffffffffffffff8211156122a5576122a561220d565b5060051b60200190565b600082601f8301126122c057600080fd5b813560206122d56122d08361228b565b61223c565b82815260059290921b840181019181810190868411156122f457600080fd5b8286015b8481101561220257803561230b81611fe2565b83529183019183016122f8565b803560ff8116811461232957600080fd5b919050565b600067ffffffffffffffff8211156123485761234861220d565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f83011261238557600080fd5b81356123936122d08261232e565b8181528460208386010111156123a857600080fd5b816020850160208301376000918101602001919091529392505050565b803567ffffffffffffffff8116811461232957600080fd5b60008060008060008060c087890312156123f657600080fd5b863567ffffffffffffffff8082111561240e57600080fd5b61241a8a838b016122af565b9750602089013591508082111561243057600080fd5b61243c8a838b016122af565b965061244a60408a01612318565b9550606089013591508082111561246057600080fd5b61246c8a838b01612374565b945061247a60808a016123c5565b935060a089013591508082111561249057600080fd5b5061249d89828a01612374565b9150509295509295509295565b6000602082840312156124bc57600080fd5b8135611fdb81611fe2565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b81810381811115610884576108846124f6565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612569576125696124f6565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600181811c908216806125b357607f821691505b6020821081036125ec577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60ff818116838216029081169081811461260e5761260e6124f6565b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b63ffffffff81811683821601908082111561260e5761260e6124f6565b600081518084526020808501945080840160005b838110156126d657815173ffffffffffffffffffffffffffffffffffffffff16875295820195908201906001016126a4565b509495945050505050565b600061012063ffffffff808d1684528b6020850152808b166040850152508060608401526127118184018a612690565b905082810360808401526127258189612690565b905060ff871660a084015282810360c08401526127428187611f7e565b905067ffffffffffffffff851660e08401528281036101008401526127678185611f7e565b9c9b505050505050505050505050565b60008060006060848603121561278c57600080fd5b8351925060208085015167ffffffffffffffff808211156127ac57600080fd5b818701915087601f8301126127c057600080fd5b81516127ce6122d08261232e565b81815289858386010111156127e257600080fd5b6127f182868301878701611f5a565b60408901519096509250508082111561280957600080fd5b508501601f8101871361281b57600080fd5b80516128296122d08261228b565b81815260059190911b8201830190838101908983111561284857600080fd5b928401925b828410156128665783518252928401929084019061284d565b80955050505050509250925092565b73ffffffffffffffffffffffffffffffffffffffff831681526040602082015260006128a46040830184611f7e565b949350505050565b601f8211156128f657600081815260208120601f850160051c810160208610156128d35750805b601f850160051c820191505b818110156128f2578281556001016128df565b5050505b505050565b815167ffffffffffffffff8111156129155761291561220d565b61292981612923845461259f565b846128ac565b602080601f83116001811461297c57600084156129465750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b1785556128f2565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b828110156129c9578886015182559484019460019091019084016129aa565b5085821015612a0557878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b8082028115828204841417610884576108846124f6565b80820180821115610884576108846124f6565b60ff8181168382160190811115610884576108846124f6565b600060ff831680612a92577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8060ff84160491505092915050565b8183823760009101908152919050565b828152606082602083013760800192915050565b600060208284031215612ad757600080fd5b5051919050565b60006101208b835273ffffffffffffffffffffffffffffffffffffffff8b16602084015267ffffffffffffffff808b166040850152816060850152612b258285018b612690565b91508382036080850152612b39828a612690565b915060ff881660a085015283820360c0850152612b568288611f7e565b90861660e085015283810361010085015290506127678185611f7e56fea164736f6c6343000813000a", -} - -var DKGABI = DKGMetaData.ABI - -var DKGBin = DKGMetaData.Bin - -func DeployDKG(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *DKG, error) { - parsed, err := DKGMetaData.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(DKGBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &DKG{DKGCaller: DKGCaller{contract: contract}, DKGTransactor: DKGTransactor{contract: contract}, DKGFilterer: DKGFilterer{contract: contract}}, nil -} - -type DKG struct { - address common.Address - abi abi.ABI - DKGCaller - DKGTransactor - DKGFilterer -} - -type DKGCaller struct { - contract *bind.BoundContract -} - -type DKGTransactor struct { - contract *bind.BoundContract -} - -type DKGFilterer struct { - contract *bind.BoundContract -} - -type DKGSession struct { - Contract *DKG - CallOpts bind.CallOpts - TransactOpts bind.TransactOpts -} - -type DKGCallerSession struct { - Contract *DKGCaller - CallOpts bind.CallOpts -} - -type DKGTransactorSession struct { - Contract *DKGTransactor - TransactOpts bind.TransactOpts -} - -type DKGRaw struct { - Contract *DKG -} - -type DKGCallerRaw struct { - Contract *DKGCaller -} - -type DKGTransactorRaw struct { - Contract *DKGTransactor -} - -func NewDKG(address common.Address, backend bind.ContractBackend) (*DKG, error) { - abi, err := abi.JSON(strings.NewReader(DKGABI)) - if err != nil { - return nil, err - } - contract, err := bindDKG(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &DKG{address: address, abi: abi, DKGCaller: DKGCaller{contract: contract}, DKGTransactor: DKGTransactor{contract: contract}, DKGFilterer: DKGFilterer{contract: contract}}, nil -} - -func NewDKGCaller(address common.Address, caller bind.ContractCaller) (*DKGCaller, error) { - contract, err := bindDKG(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &DKGCaller{contract: contract}, nil -} - -func NewDKGTransactor(address common.Address, transactor bind.ContractTransactor) (*DKGTransactor, error) { - contract, err := bindDKG(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &DKGTransactor{contract: contract}, nil -} - -func NewDKGFilterer(address common.Address, filterer bind.ContractFilterer) (*DKGFilterer, error) { - contract, err := bindDKG(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &DKGFilterer{contract: contract}, nil -} - -func bindDKG(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := DKGMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -func (_DKG *DKGRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _DKG.Contract.DKGCaller.contract.Call(opts, result, method, params...) -} - -func (_DKG *DKGRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _DKG.Contract.DKGTransactor.contract.Transfer(opts) -} - -func (_DKG *DKGRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _DKG.Contract.DKGTransactor.contract.Transact(opts, method, params...) -} - -func (_DKG *DKGCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _DKG.Contract.contract.Call(opts, result, method, params...) -} - -func (_DKG *DKGTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _DKG.Contract.contract.Transfer(opts) -} - -func (_DKG *DKGTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _DKG.Contract.contract.Transact(opts, method, params...) -} - -func (_DKG *DKGCaller) GetKey(opts *bind.CallOpts, _keyID [32]byte, _configDigest [32]byte) (KeyDataStructKeyData, error) { - var out []interface{} - err := _DKG.contract.Call(opts, &out, "getKey", _keyID, _configDigest) - - if err != nil { - return *new(KeyDataStructKeyData), err - } - - out0 := *abi.ConvertType(out[0], new(KeyDataStructKeyData)).(*KeyDataStructKeyData) - - return out0, err - -} - -func (_DKG *DKGSession) GetKey(_keyID [32]byte, _configDigest [32]byte) (KeyDataStructKeyData, error) { - return _DKG.Contract.GetKey(&_DKG.CallOpts, _keyID, _configDigest) -} - -func (_DKG *DKGCallerSession) GetKey(_keyID [32]byte, _configDigest [32]byte) (KeyDataStructKeyData, error) { - return _DKG.Contract.GetKey(&_DKG.CallOpts, _keyID, _configDigest) -} - -func (_DKG *DKGCaller) LatestConfigDetails(opts *bind.CallOpts) (LatestConfigDetails, - - error) { - var out []interface{} - err := _DKG.contract.Call(opts, &out, "latestConfigDetails") - - outstruct := new(LatestConfigDetails) - if err != nil { - return *outstruct, err - } - - outstruct.ConfigCount = *abi.ConvertType(out[0], new(uint32)).(*uint32) - outstruct.BlockNumber = *abi.ConvertType(out[1], new(uint32)).(*uint32) - outstruct.ConfigDigest = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte) - - return *outstruct, err - -} - -func (_DKG *DKGSession) LatestConfigDetails() (LatestConfigDetails, - - error) { - return _DKG.Contract.LatestConfigDetails(&_DKG.CallOpts) -} - -func (_DKG *DKGCallerSession) LatestConfigDetails() (LatestConfigDetails, - - error) { - return _DKG.Contract.LatestConfigDetails(&_DKG.CallOpts) -} - -func (_DKG *DKGCaller) LatestConfigDigestAndEpoch(opts *bind.CallOpts) (LatestConfigDigestAndEpoch, - - error) { - var out []interface{} - err := _DKG.contract.Call(opts, &out, "latestConfigDigestAndEpoch") - - outstruct := new(LatestConfigDigestAndEpoch) - if err != nil { - return *outstruct, err - } - - outstruct.ScanLogs = *abi.ConvertType(out[0], new(bool)).(*bool) - outstruct.ConfigDigest = *abi.ConvertType(out[1], new([32]byte)).(*[32]byte) - outstruct.Epoch = *abi.ConvertType(out[2], new(uint32)).(*uint32) - - return *outstruct, err - -} - -func (_DKG *DKGSession) LatestConfigDigestAndEpoch() (LatestConfigDigestAndEpoch, - - error) { - return _DKG.Contract.LatestConfigDigestAndEpoch(&_DKG.CallOpts) -} - -func (_DKG *DKGCallerSession) LatestConfigDigestAndEpoch() (LatestConfigDigestAndEpoch, - - error) { - return _DKG.Contract.LatestConfigDigestAndEpoch(&_DKG.CallOpts) -} - -func (_DKG *DKGCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _DKG.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 (_DKG *DKGSession) Owner() (common.Address, error) { - return _DKG.Contract.Owner(&_DKG.CallOpts) -} - -func (_DKG *DKGCallerSession) Owner() (common.Address, error) { - return _DKG.Contract.Owner(&_DKG.CallOpts) -} - -func (_DKG *DKGCaller) TypeAndVersion(opts *bind.CallOpts) (string, error) { - var out []interface{} - err := _DKG.contract.Call(opts, &out, "typeAndVersion") - - if err != nil { - return *new(string), err - } - - out0 := *abi.ConvertType(out[0], new(string)).(*string) - - return out0, err - -} - -func (_DKG *DKGSession) TypeAndVersion() (string, error) { - return _DKG.Contract.TypeAndVersion(&_DKG.CallOpts) -} - -func (_DKG *DKGCallerSession) TypeAndVersion() (string, error) { - return _DKG.Contract.TypeAndVersion(&_DKG.CallOpts) -} - -func (_DKG *DKGTransactor) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _DKG.contract.Transact(opts, "acceptOwnership") -} - -func (_DKG *DKGSession) AcceptOwnership() (*types.Transaction, error) { - return _DKG.Contract.AcceptOwnership(&_DKG.TransactOpts) -} - -func (_DKG *DKGTransactorSession) AcceptOwnership() (*types.Transaction, error) { - return _DKG.Contract.AcceptOwnership(&_DKG.TransactOpts) -} - -func (_DKG *DKGTransactor) AddClient(opts *bind.TransactOpts, keyID [32]byte, clientAddress common.Address) (*types.Transaction, error) { - return _DKG.contract.Transact(opts, "addClient", keyID, clientAddress) -} - -func (_DKG *DKGSession) AddClient(keyID [32]byte, clientAddress common.Address) (*types.Transaction, error) { - return _DKG.Contract.AddClient(&_DKG.TransactOpts, keyID, clientAddress) -} - -func (_DKG *DKGTransactorSession) AddClient(keyID [32]byte, clientAddress common.Address) (*types.Transaction, error) { - return _DKG.Contract.AddClient(&_DKG.TransactOpts, keyID, clientAddress) -} - -func (_DKG *DKGTransactor) RemoveClient(opts *bind.TransactOpts, keyID [32]byte, clientAddress common.Address) (*types.Transaction, error) { - return _DKG.contract.Transact(opts, "removeClient", keyID, clientAddress) -} - -func (_DKG *DKGSession) RemoveClient(keyID [32]byte, clientAddress common.Address) (*types.Transaction, error) { - return _DKG.Contract.RemoveClient(&_DKG.TransactOpts, keyID, clientAddress) -} - -func (_DKG *DKGTransactorSession) RemoveClient(keyID [32]byte, clientAddress common.Address) (*types.Transaction, error) { - return _DKG.Contract.RemoveClient(&_DKG.TransactOpts, keyID, clientAddress) -} - -func (_DKG *DKGTransactor) SetConfig(opts *bind.TransactOpts, _signers []common.Address, _transmitters []common.Address, _f uint8, _onchainConfig []byte, _offchainConfigVersion uint64, _offchainConfig []byte) (*types.Transaction, error) { - return _DKG.contract.Transact(opts, "setConfig", _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig) -} - -func (_DKG *DKGSession) SetConfig(_signers []common.Address, _transmitters []common.Address, _f uint8, _onchainConfig []byte, _offchainConfigVersion uint64, _offchainConfig []byte) (*types.Transaction, error) { - return _DKG.Contract.SetConfig(&_DKG.TransactOpts, _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig) -} - -func (_DKG *DKGTransactorSession) SetConfig(_signers []common.Address, _transmitters []common.Address, _f uint8, _onchainConfig []byte, _offchainConfigVersion uint64, _offchainConfig []byte) (*types.Transaction, error) { - return _DKG.Contract.SetConfig(&_DKG.TransactOpts, _signers, _transmitters, _f, _onchainConfig, _offchainConfigVersion, _offchainConfig) -} - -func (_DKG *DKGTransactor) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - return _DKG.contract.Transact(opts, "transferOwnership", to) -} - -func (_DKG *DKGSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _DKG.Contract.TransferOwnership(&_DKG.TransactOpts, to) -} - -func (_DKG *DKGTransactorSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _DKG.Contract.TransferOwnership(&_DKG.TransactOpts, to) -} - -func (_DKG *DKGTransactor) Transmit(opts *bind.TransactOpts, reportContext [3][32]byte, report []byte, rs [][32]byte, ss [][32]byte, rawVs [32]byte) (*types.Transaction, error) { - return _DKG.contract.Transact(opts, "transmit", reportContext, report, rs, ss, rawVs) -} - -func (_DKG *DKGSession) Transmit(reportContext [3][32]byte, report []byte, rs [][32]byte, ss [][32]byte, rawVs [32]byte) (*types.Transaction, error) { - return _DKG.Contract.Transmit(&_DKG.TransactOpts, reportContext, report, rs, ss, rawVs) -} - -func (_DKG *DKGTransactorSession) Transmit(reportContext [3][32]byte, report []byte, rs [][32]byte, ss [][32]byte, rawVs [32]byte) (*types.Transaction, error) { - return _DKG.Contract.Transmit(&_DKG.TransactOpts, reportContext, report, rs, ss, rawVs) -} - -type DKGConfigSetIterator struct { - Event *DKGConfigSet - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *DKGConfigSetIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(DKGConfigSet) - 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(DKGConfigSet) - 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 *DKGConfigSetIterator) Error() error { - return it.fail -} - -func (it *DKGConfigSetIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type DKGConfigSet struct { - PreviousConfigBlockNumber uint32 - ConfigDigest [32]byte - ConfigCount uint64 - Signers []common.Address - Transmitters []common.Address - F uint8 - OnchainConfig []byte - OffchainConfigVersion uint64 - OffchainConfig []byte - Raw types.Log -} - -func (_DKG *DKGFilterer) FilterConfigSet(opts *bind.FilterOpts) (*DKGConfigSetIterator, error) { - - logs, sub, err := _DKG.contract.FilterLogs(opts, "ConfigSet") - if err != nil { - return nil, err - } - return &DKGConfigSetIterator{contract: _DKG.contract, event: "ConfigSet", logs: logs, sub: sub}, nil -} - -func (_DKG *DKGFilterer) WatchConfigSet(opts *bind.WatchOpts, sink chan<- *DKGConfigSet) (event.Subscription, error) { - - logs, sub, err := _DKG.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(DKGConfigSet) - if err := _DKG.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 (_DKG *DKGFilterer) ParseConfigSet(log types.Log) (*DKGConfigSet, error) { - event := new(DKGConfigSet) - if err := _DKG.contract.UnpackLog(event, "ConfigSet", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type DKGDKGClientErrorIterator struct { - Event *DKGDKGClientError - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *DKGDKGClientErrorIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(DKGDKGClientError) - 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(DKGDKGClientError) - 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 *DKGDKGClientErrorIterator) Error() error { - return it.fail -} - -func (it *DKGDKGClientErrorIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type DKGDKGClientError struct { - Client common.Address - ErrorData []byte - Raw types.Log -} - -func (_DKG *DKGFilterer) FilterDKGClientError(opts *bind.FilterOpts) (*DKGDKGClientErrorIterator, error) { - - logs, sub, err := _DKG.contract.FilterLogs(opts, "DKGClientError") - if err != nil { - return nil, err - } - return &DKGDKGClientErrorIterator{contract: _DKG.contract, event: "DKGClientError", logs: logs, sub: sub}, nil -} - -func (_DKG *DKGFilterer) WatchDKGClientError(opts *bind.WatchOpts, sink chan<- *DKGDKGClientError) (event.Subscription, error) { - - logs, sub, err := _DKG.contract.WatchLogs(opts, "DKGClientError") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(DKGDKGClientError) - if err := _DKG.contract.UnpackLog(event, "DKGClientError", 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 (_DKG *DKGFilterer) ParseDKGClientError(log types.Log) (*DKGDKGClientError, error) { - event := new(DKGDKGClientError) - if err := _DKG.contract.UnpackLog(event, "DKGClientError", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type DKGKeyGeneratedIterator struct { - Event *DKGKeyGenerated - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *DKGKeyGeneratedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(DKGKeyGenerated) - 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(DKGKeyGenerated) - 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 *DKGKeyGeneratedIterator) Error() error { - return it.fail -} - -func (it *DKGKeyGeneratedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type DKGKeyGenerated struct { - ConfigDigest [32]byte - KeyID [32]byte - Key KeyDataStructKeyData - Raw types.Log -} - -func (_DKG *DKGFilterer) FilterKeyGenerated(opts *bind.FilterOpts, configDigest [][32]byte, keyID [][32]byte) (*DKGKeyGeneratedIterator, error) { - - var configDigestRule []interface{} - for _, configDigestItem := range configDigest { - configDigestRule = append(configDigestRule, configDigestItem) - } - var keyIDRule []interface{} - for _, keyIDItem := range keyID { - keyIDRule = append(keyIDRule, keyIDItem) - } - - logs, sub, err := _DKG.contract.FilterLogs(opts, "KeyGenerated", configDigestRule, keyIDRule) - if err != nil { - return nil, err - } - return &DKGKeyGeneratedIterator{contract: _DKG.contract, event: "KeyGenerated", logs: logs, sub: sub}, nil -} - -func (_DKG *DKGFilterer) WatchKeyGenerated(opts *bind.WatchOpts, sink chan<- *DKGKeyGenerated, configDigest [][32]byte, keyID [][32]byte) (event.Subscription, error) { - - var configDigestRule []interface{} - for _, configDigestItem := range configDigest { - configDigestRule = append(configDigestRule, configDigestItem) - } - var keyIDRule []interface{} - for _, keyIDItem := range keyID { - keyIDRule = append(keyIDRule, keyIDItem) - } - - logs, sub, err := _DKG.contract.WatchLogs(opts, "KeyGenerated", configDigestRule, keyIDRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(DKGKeyGenerated) - if err := _DKG.contract.UnpackLog(event, "KeyGenerated", 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 (_DKG *DKGFilterer) ParseKeyGenerated(log types.Log) (*DKGKeyGenerated, error) { - event := new(DKGKeyGenerated) - if err := _DKG.contract.UnpackLog(event, "KeyGenerated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type DKGOwnershipTransferRequestedIterator struct { - Event *DKGOwnershipTransferRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *DKGOwnershipTransferRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(DKGOwnershipTransferRequested) - 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(DKGOwnershipTransferRequested) - 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 *DKGOwnershipTransferRequestedIterator) Error() error { - return it.fail -} - -func (it *DKGOwnershipTransferRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type DKGOwnershipTransferRequested struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_DKG *DKGFilterer) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*DKGOwnershipTransferRequestedIterator, 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 := _DKG.contract.FilterLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return &DKGOwnershipTransferRequestedIterator{contract: _DKG.contract, event: "OwnershipTransferRequested", logs: logs, sub: sub}, nil -} - -func (_DKG *DKGFilterer) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *DKGOwnershipTransferRequested, 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 := _DKG.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(DKGOwnershipTransferRequested) - if err := _DKG.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 (_DKG *DKGFilterer) ParseOwnershipTransferRequested(log types.Log) (*DKGOwnershipTransferRequested, error) { - event := new(DKGOwnershipTransferRequested) - if err := _DKG.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type DKGOwnershipTransferredIterator struct { - Event *DKGOwnershipTransferred - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *DKGOwnershipTransferredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(DKGOwnershipTransferred) - 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(DKGOwnershipTransferred) - 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 *DKGOwnershipTransferredIterator) Error() error { - return it.fail -} - -func (it *DKGOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type DKGOwnershipTransferred struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_DKG *DKGFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*DKGOwnershipTransferredIterator, 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 := _DKG.contract.FilterLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return &DKGOwnershipTransferredIterator{contract: _DKG.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -func (_DKG *DKGFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *DKGOwnershipTransferred, 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 := _DKG.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(DKGOwnershipTransferred) - if err := _DKG.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 (_DKG *DKGFilterer) ParseOwnershipTransferred(log types.Log) (*DKGOwnershipTransferred, error) { - event := new(DKGOwnershipTransferred) - if err := _DKG.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type DKGTransmittedIterator struct { - Event *DKGTransmitted - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *DKGTransmittedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(DKGTransmitted) - 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(DKGTransmitted) - 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 *DKGTransmittedIterator) Error() error { - return it.fail -} - -func (it *DKGTransmittedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type DKGTransmitted struct { - ConfigDigest [32]byte - Epoch uint32 - Raw types.Log -} - -func (_DKG *DKGFilterer) FilterTransmitted(opts *bind.FilterOpts) (*DKGTransmittedIterator, error) { - - logs, sub, err := _DKG.contract.FilterLogs(opts, "Transmitted") - if err != nil { - return nil, err - } - return &DKGTransmittedIterator{contract: _DKG.contract, event: "Transmitted", logs: logs, sub: sub}, nil -} - -func (_DKG *DKGFilterer) WatchTransmitted(opts *bind.WatchOpts, sink chan<- *DKGTransmitted) (event.Subscription, error) { - - logs, sub, err := _DKG.contract.WatchLogs(opts, "Transmitted") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(DKGTransmitted) - if err := _DKG.contract.UnpackLog(event, "Transmitted", 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 (_DKG *DKGFilterer) ParseTransmitted(log types.Log) (*DKGTransmitted, error) { - event := new(DKGTransmitted) - if err := _DKG.contract.UnpackLog(event, "Transmitted", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type LatestConfigDetails struct { - ConfigCount uint32 - BlockNumber uint32 - ConfigDigest [32]byte -} -type LatestConfigDigestAndEpoch struct { - ScanLogs bool - ConfigDigest [32]byte - Epoch uint32 -} - -func (_DKG *DKG) ParseLog(log types.Log) (generated.AbigenLog, error) { - switch log.Topics[0] { - case _DKG.abi.Events["ConfigSet"].ID: - return _DKG.ParseConfigSet(log) - case _DKG.abi.Events["DKGClientError"].ID: - return _DKG.ParseDKGClientError(log) - case _DKG.abi.Events["KeyGenerated"].ID: - return _DKG.ParseKeyGenerated(log) - case _DKG.abi.Events["OwnershipTransferRequested"].ID: - return _DKG.ParseOwnershipTransferRequested(log) - case _DKG.abi.Events["OwnershipTransferred"].ID: - return _DKG.ParseOwnershipTransferred(log) - case _DKG.abi.Events["Transmitted"].ID: - return _DKG.ParseTransmitted(log) - - default: - return nil, fmt.Errorf("abigen wrapper received unknown log topic: %v", log.Topics[0]) - } -} - -func (DKGConfigSet) Topic() common.Hash { - return common.HexToHash("0x1591690b8638f5fb2dbec82ac741805ac5da8b45dc5263f4875b0496fdce4e05") -} - -func (DKGDKGClientError) Topic() common.Hash { - return common.HexToHash("0x116391732f5df106193bda7cedf1728f3b07b62f6cdcdd611c9eeec44efcae54") -} - -func (DKGKeyGenerated) Topic() common.Hash { - return common.HexToHash("0xc8db841f5b2231ccf7190311f440aa197b161e369f3b40b023508160cc555656") -} - -func (DKGOwnershipTransferRequested) Topic() common.Hash { - return common.HexToHash("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278") -} - -func (DKGOwnershipTransferred) Topic() common.Hash { - return common.HexToHash("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0") -} - -func (DKGTransmitted) Topic() common.Hash { - return common.HexToHash("0xb04e63db38c49950639fa09d29872f21f5d49d614f3a969d8adf3d4b52e41a62") -} - -func (_DKG *DKG) Address() common.Address { - return _DKG.address -} - -type DKGInterface interface { - GetKey(opts *bind.CallOpts, _keyID [32]byte, _configDigest [32]byte) (KeyDataStructKeyData, error) - - LatestConfigDetails(opts *bind.CallOpts) (LatestConfigDetails, - - error) - - LatestConfigDigestAndEpoch(opts *bind.CallOpts) (LatestConfigDigestAndEpoch, - - error) - - Owner(opts *bind.CallOpts) (common.Address, error) - - TypeAndVersion(opts *bind.CallOpts) (string, error) - - AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) - - AddClient(opts *bind.TransactOpts, keyID [32]byte, clientAddress common.Address) (*types.Transaction, error) - - RemoveClient(opts *bind.TransactOpts, keyID [32]byte, clientAddress common.Address) (*types.Transaction, error) - - SetConfig(opts *bind.TransactOpts, _signers []common.Address, _transmitters []common.Address, _f uint8, _onchainConfig []byte, _offchainConfigVersion uint64, _offchainConfig []byte) (*types.Transaction, error) - - TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) - - Transmit(opts *bind.TransactOpts, reportContext [3][32]byte, report []byte, rs [][32]byte, ss [][32]byte, rawVs [32]byte) (*types.Transaction, error) - - FilterConfigSet(opts *bind.FilterOpts) (*DKGConfigSetIterator, error) - - WatchConfigSet(opts *bind.WatchOpts, sink chan<- *DKGConfigSet) (event.Subscription, error) - - ParseConfigSet(log types.Log) (*DKGConfigSet, error) - - FilterDKGClientError(opts *bind.FilterOpts) (*DKGDKGClientErrorIterator, error) - - WatchDKGClientError(opts *bind.WatchOpts, sink chan<- *DKGDKGClientError) (event.Subscription, error) - - ParseDKGClientError(log types.Log) (*DKGDKGClientError, error) - - FilterKeyGenerated(opts *bind.FilterOpts, configDigest [][32]byte, keyID [][32]byte) (*DKGKeyGeneratedIterator, error) - - WatchKeyGenerated(opts *bind.WatchOpts, sink chan<- *DKGKeyGenerated, configDigest [][32]byte, keyID [][32]byte) (event.Subscription, error) - - ParseKeyGenerated(log types.Log) (*DKGKeyGenerated, error) - - FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*DKGOwnershipTransferRequestedIterator, error) - - WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *DKGOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferRequested(log types.Log) (*DKGOwnershipTransferRequested, error) - - FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*DKGOwnershipTransferredIterator, error) - - WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *DKGOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferred(log types.Log) (*DKGOwnershipTransferred, error) - - FilterTransmitted(opts *bind.FilterOpts) (*DKGTransmittedIterator, error) - - WatchTransmitted(opts *bind.WatchOpts, sink chan<- *DKGTransmitted) (event.Subscription, error) - - ParseTransmitted(log types.Log) (*DKGTransmitted, error) - - ParseLog(log types.Log) (generated.AbigenLog, error) - - Address() common.Address -} diff --git a/core/gethwrappers/ocr2vrf/generated/load_test_beacon_consumer/load_test_beacon_consumer.go b/core/gethwrappers/ocr2vrf/generated/load_test_beacon_consumer/load_test_beacon_consumer.go deleted file mode 100644 index 32bf1e66219..00000000000 --- a/core/gethwrappers/ocr2vrf/generated/load_test_beacon_consumer/load_test_beacon_consumer.go +++ /dev/null @@ -1,1422 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package load_test_beacon_consumer - -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 -) - -var LoadTestBeaconVRFConsumerMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"coordinator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"shouldFail\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"beaconPeriodBlocks\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"MustBeCoordinator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MustBeOwnerOrCoordinator\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"coordinator\",\"type\":\"address\"}],\"name\":\"CoordinatorUpdated\",\"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\":[],\"name\":\"fail\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"reqID\",\"type\":\"uint256\"}],\"name\":\"getFulfillmentDurationByRequestID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"reqID\",\"type\":\"uint256\"}],\"name\":\"getRawFulfillmentDurationByRequestID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"i_beaconPeriodBlocks\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingRequests\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"randomWords\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"arguments\",\"type\":\"bytes\"}],\"name\":\"rawFulfillRandomWords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestHeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"reset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"s_ReceivedRandomnessByRequestID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_arguments\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_averageFulfillmentInMillions\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_fastestFulfillment\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"s_fulfillmentDurationInBlocks\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_gasAvailable\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_mostRecentRequestID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"s_myBeaconRequests\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"slotNumber\",\"type\":\"uint32\"},{\"internalType\":\"uint24\",\"name\":\"confirmationDelay\",\"type\":\"uint24\"},{\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"s_randomWords\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"s_rawFulfillmentDurationInBlocks\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"s_requestIDs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"s_requestOutputHeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint24\",\"name\":\"\",\"type\":\"uint24\"}],\"name\":\"s_requestsIDs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_resetCounter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_slowestFulfillment\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_slowestRequestID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_subId\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_totalFulfilled\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_totalRequests\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"coordinator\",\"type\":\"address\"}],\"name\":\"setCoordinator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"shouldFail\",\"type\":\"bool\"}],\"name\":\"setFail\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"reqId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"internalType\":\"uint24\",\"name\":\"delay\",\"type\":\"uint24\"},{\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"}],\"name\":\"storeBeaconRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"}],\"name\":\"testRedeemRandomness\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"internalType\":\"uint24\",\"name\":\"confirmationDelayArg\",\"type\":\"uint24\"}],\"name\":\"testRequestRandomness\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"internalType\":\"uint24\",\"name\":\"confDelay\",\"type\":\"uint24\"},{\"internalType\":\"uint32\",\"name\":\"callbackGasLimit\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"arguments\",\"type\":\"bytes\"}],\"name\":\"testRequestRandomnessFulfillment\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"internalType\":\"uint24\",\"name\":\"confirmationDelayArg\",\"type\":\"uint24\"},{\"internalType\":\"uint32\",\"name\":\"callbackGasLimit\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"arguments\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"}],\"name\":\"testRequestRandomnessFulfillmentBatch\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60806040526000600d556000600e556103e7600f556000601055600060115560006012553480156200003057600080fd5b5060405162001f6138038062001f618339810160408190526200005391620001d0565b828282823380600081620000ae5760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0384811691909117909155811615620000e157620000e18162000125565b5050600280546001600160a01b0319166001600160a01b03939093169290921790915550600b805460ff191692151592909217909155600c55506200022792505050565b336001600160a01b038216036200017f5760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c660000000000000000006044820152606401620000a5565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b600080600060608486031215620001e657600080fd5b83516001600160a01b0381168114620001fe57600080fd5b602085015190935080151581146200021557600080fd5b80925050604084015190509250925092565b611d2a80620002376000396000f3fe608060405234801561001057600080fd5b50600436106102775760003560e01c806379ba509711610160578063d0705f04116100d8578063f2fde38b1161008c578063f6eaffc811610071578063f6eaffc8146105bc578063fc7fea37146105cf578063ffe97ca4146105d857600080fd5b8063f2fde38b1461057e578063f371829b1461059157600080fd5b8063d826f88f116100bd578063d826f88f1461055a578063ea7502ab14610562578063f08c5daa1461057557600080fd5b8063d0705f0414610534578063d21ea8fd1461054757600080fd5b80638ea981171161012f578063a9cc471811610114578063a9cc4718146104fb578063c6d6130114610518578063cd0593df1461052b57600080fd5b80638ea98117146104a95780639d769402146104bc57600080fd5b806379ba5097146104675780638866c6bd1461046f5780638d0e3165146104785780638da5cb5b1461048157600080fd5b80635a947873116101f35780636df57cc3116101c2578063737144bc116101a7578063737144bc1461044057806374dba124146104495780637716cdaa1461045257600080fd5b80636df57cc314610400578063706da1ca1461041357600080fd5b80635a947873146103b05780635f15cccc146103c3578063601201d3146103ee578063689b77ab146103f757600080fd5b80632b1a21301161024a578063341867a21161022f578063341867a21461035b578063353e0f60146103705780634a0aee291461039b57600080fd5b80632b1a21301461031d5780632fe8fa311461033057600080fd5b80631591950a1461027c5780631757f11c146102ba578063195e0d75146102c35780631e87f20e146102f0575b600080fd5b6102a761028a366004611503565b601560209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b6102a7600e5481565b6102a76102d1366004611525565b6012546000908152601860209081526040808320938352929052205490565b6102a76102fe366004611525565b6012546000908152601760209081526040808320938352929052205490565b6102a761032b366004611503565b61068b565b6102a761033e366004611503565b601760209081526000928352604080842090915290825290205481565b61036e610369366004611503565b6106bc565b005b6102a761037e366004611503565b601660209081526000928352604080842090915290825290205481565b6103a36107b1565b6040516102b1919061153e565b6103a36103be3660046116cc565b6108c1565b6102a76103d136600461174d565b600460209081526000928352604080842090915290825290205481565b6102a760115481565b6102a760085481565b61036e61040e366004611779565b610a1f565b6009546104279067ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016102b1565b6102a7600d5481565b6102a7600f5481565b61045a610b5a565b6040516102b19190611823565b61036e610be8565b6102a760105481565b6102a760135481565b60005460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102b1565b61036e6104b736600461183d565b610cea565b61036e6104ca366004611873565b600b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b600b546105089060ff1681565b60405190151581526020016102b1565b6102a7610526366004611895565b610dd0565b6102a7600c5481565b6102a7610542366004611503565b610eda565b61036e6105553660046118f5565b610ef6565b61036e610f57565b6102a76105703660046119be565b610f8d565b6102a7600a5481565b61036e61058c36600461183d565b61109d565b6102a761059f366004611503565b601860209081526000928352604080842090915290825290205481565b6102a76105ca366004611525565b6110b1565b6102a760125481565b6106416105e6366004611525565b60056020526000908152604090205463ffffffff811690640100000000810462ffffff1690670100000000000000810461ffff16906901000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1684565b6040805163ffffffff909516855262ffffff909316602085015261ffff9091169183019190915273ffffffffffffffffffffffffffffffffffffffff1660608201526080016102b1565b601460205281600052604060002081815481106106a757600080fd5b90600052602060002001600091509150505481565b60025460408051602081018252600080825291517facfc6cdd000000000000000000000000000000000000000000000000000000008152919273ffffffffffffffffffffffffffffffffffffffff169163acfc6cdd916107229187918791600401611a37565b6000604051808303816000875af1158015610741573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526107879190810190611a5f565b600083815260066020908152604090912082519293506107ab9290918401906114a3565b50505050565b6012546000908152601460205260408120546060919067ffffffffffffffff8111156107df576107df6115c0565b604051908082528060200260200182016040528015610808578160200160208202803683370190505b5090506000805b6012546000908152601460205260409020548110156108b957601254600090815260146020526040812080548390811061084b5761084b611af0565b600091825260208083209091015460125483526017825260408084208285529092529082205490925090036108a6578084848151811061088d5761088d611af0565b6020908102919091010152826108a281611b4e565b9350505b50806108b181611b4e565b91505061080f565b508152919050565b606060008267ffffffffffffffff8111156108de576108de6115c0565b604051908082528060200260200182016040528015610907578160200160208202803683370190505b5090506000600c546109176110d2565b6109219190611bb5565b9050600081600c546109316110d2565b61093b9190611bc9565b6109459190611be2565b905060005b85811015610a105760006109618c8c8c8c8c610f8d565b60108054919250600061097383611b4e565b90915550506012546000908152601560209081526040808320848452909152902083905561099f6110d2565b60128054600090815260166020908152604080832086845282528083209490945591548152601482529182208054600181018255908352912001819055845181908690849081106109f2576109f2611af0565b60209081029190910101525080610a0881611b4e565b91505061094a565b50919998505050505050505050565b600083815260046020908152604080832062ffffff861684529091528120859055600c54610a4d9085611bf5565b6040805160808101825263ffffffff928316815262ffffff958616602080830191825261ffff968716838501908152306060850190815260009b8c526005909252939099209151825491519351995173ffffffffffffffffffffffffffffffffffffffff166901000000000000000000027fffffff0000000000000000000000000000000000000000ffffffffffffffffff9a90971667010000000000000002999099167fffffff00000000000000000000000000000000000000000000ffffffffffffff93909716640100000000027fffffffffffffffffffffffffffffffffffffffffffffffffff000000000000009091169890931697909717919091171692909217179092555050565b60078054610b6790611c09565b80601f0160208091040260200160405190810160405280929190818152602001828054610b9390611c09565b8015610be05780601f10610bb557610100808354040283529160200191610be0565b820191906000526020600020905b815481529060010190602001808311610bc357829003601f168201915b505050505081565b60015473ffffffffffffffffffffffffffffffffffffffff163314610c6e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e65720000000000000000000060448201526064015b60405180910390fd5b60008054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217845560018054909116905560405173ffffffffffffffffffffffffffffffffffffffff90921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b60005473ffffffffffffffffffffffffffffffffffffffff163314801590610d2a575060025473ffffffffffffffffffffffffffffffffffffffff163314155b15610d61576040517fd4e06fd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fc258faa9a17ddfdf4130b4acff63a289202e7d5f9e42f366add65368575486bc90600090a250565b600080600c54610dde6110d2565b610de89190611bb5565b9050600081600c54610df86110d2565b610e029190611bc9565b610e0c9190611be2565b60025460408051602081018252600080825291517f4ffac83a000000000000000000000000000000000000000000000000000000008152939450909273ffffffffffffffffffffffffffffffffffffffff90921691634ffac83a91610e7a918a918c918b9190600401611c5c565b6020604051808303816000875af1158015610e99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebd9190611c94565b9050610ecb8183878a610a1f565b60088190559695505050505050565b600660205281600052604060002081815481106106a757600080fd5b60025473ffffffffffffffffffffffffffffffffffffffff163314610f47576040517f66bf9c7200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610f52838383611169565b505050565b6000600d819055600e8190556103e7600f556010819055601181905560138190556012805491610f8683611b4e565b9190505550565b600080600c54610f9b6110d2565b610fa59190611bb5565b9050600081600c54610fb56110d2565b610fbf9190611bc9565b610fc99190611be2565b60025460408051602081018252600080825291517fdb972c8b000000000000000000000000000000000000000000000000000000008152939450909273ffffffffffffffffffffffffffffffffffffffff9092169163db972c8b9161103b918d918d918d918d918d9190600401611cad565b6020604051808303816000875af115801561105a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107e9190611c94565b905061108c8183898b610a1f565b600881905598975050505050505050565b6110a561132b565b6110ae816113ae565b50565b600381815481106110c157600080fd5b600091825260209091200154905081565b60004661a4b18114806110e7575062066eed81145b1561116257606473ffffffffffffffffffffffffffffffffffffffff1663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611138573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115c9190611c94565b91505090565b4391505090565b600b5460ff16156111d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f206661696c656420696e2066756c66696c6c52616e646f6d576f7264730000006044820152606401610c65565b600083815260066020908152604090912083516111f5928501906114a3565b50601254600090815260156020908152604080832086845290915281205461121b6110d2565b6112259190611be2565b60125460009081526016602090815260408083208884529091528120549192509061124e6110d2565b6112589190611be2565b9050600061126983620f4240611d06565b9050600e5483111561128057600e83905560138690555b600f54831061129157600f54611293565b825b600f556011546112a357806112d6565b6011546112b1906001611bc9565b81601154600d546112c29190611d06565b6112cc9190611bc9565b6112d69190611bf5565b600d55601180549060006112e983611b4e565b90915550506012805460009081526017602090815260408083208a84528252808320969096559154815260188252848120978152969052509320929092555050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146113ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e6572000000000000000000006044820152606401610c65565b565b3373ffffffffffffffffffffffffffffffffffffffff82160361142d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c660000000000000000006044820152606401610c65565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b8280548282559060005260206000209081019282156114de579160200282015b828111156114de5782518255916020019190600101906114c3565b506114ea9291506114ee565b5090565b5b808211156114ea57600081556001016114ef565b6000806040838503121561151657600080fd5b50508035926020909101359150565b60006020828403121561153757600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b818110156115765783518352928401929184019160010161155a565b50909695505050505050565b803561ffff8116811461159457600080fd5b919050565b803562ffffff8116811461159457600080fd5b803563ffffffff8116811461159457600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611636576116366115c0565b604052919050565b600082601f83011261164f57600080fd5b813567ffffffffffffffff811115611669576116696115c0565b61169a60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016115ef565b8181528460208386010111156116af57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060c087890312156116e557600080fd5b863595506116f560208801611582565b945061170360408801611599565b9350611711606088016115ac565b9250608087013567ffffffffffffffff81111561172d57600080fd5b61173989828a0161163e565b92505060a087013590509295509295509295565b6000806040838503121561176057600080fd5b8235915061177060208401611599565b90509250929050565b6000806000806080858703121561178f57600080fd5b84359350602085013592506117a660408601611599565b91506117b460608601611582565b905092959194509250565b6000815180845260005b818110156117e5576020818501810151868301820152016117c9565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b60208152600061183660208301846117bf565b9392505050565b60006020828403121561184f57600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461183657600080fd5b60006020828403121561188557600080fd5b8135801515811461183657600080fd5b6000806000606084860312156118aa57600080fd5b6118b384611582565b9250602084013591506118c860408501611599565b90509250925092565b600067ffffffffffffffff8211156118eb576118eb6115c0565b5060051b60200190565b60008060006060848603121561190a57600080fd5b8335925060208085013567ffffffffffffffff8082111561192a57600080fd5b818701915087601f83011261193e57600080fd5b813561195161194c826118d1565b6115ef565b81815260059190911b8301840190848101908a83111561197057600080fd5b938501935b8285101561198e57843582529385019390850190611975565b9650505060408701359250808311156119a657600080fd5b50506119b48682870161163e565b9150509250925092565b600080600080600060a086880312156119d657600080fd5b853594506119e660208701611582565b93506119f460408701611599565b9250611a02606087016115ac565b9150608086013567ffffffffffffffff811115611a1e57600080fd5b611a2a8882890161163e565b9150509295509295909350565b838152826020820152606060408201526000611a5660608301846117bf565b95945050505050565b60006020808385031215611a7257600080fd5b825167ffffffffffffffff811115611a8957600080fd5b8301601f81018513611a9a57600080fd5b8051611aa861194c826118d1565b81815260059190911b82018301908381019087831115611ac757600080fd5b928401925b82841015611ae557835182529284019290840190611acc565b979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611b7f57611b7f611b1f565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082611bc457611bc4611b86565b500690565b80820180821115611bdc57611bdc611b1f565b92915050565b81810381811115611bdc57611bdc611b1f565b600082611c0457611c04611b86565b500490565b600181811c90821680611c1d57607f821691505b602082108103611c56577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b84815261ffff8416602082015262ffffff83166040820152608060608201526000611c8a60808301846117bf565b9695505050505050565b600060208284031215611ca657600080fd5b5051919050565b86815261ffff8616602082015262ffffff8516604082015263ffffffff8416606082015260c060808201526000611ce760c08301856117bf565b82810360a0840152611cf981856117bf565b9998505050505050505050565b8082028115828204841417611bdc57611bdc611b1f56fea164736f6c6343000813000a", -} - -var LoadTestBeaconVRFConsumerABI = LoadTestBeaconVRFConsumerMetaData.ABI - -var LoadTestBeaconVRFConsumerBin = LoadTestBeaconVRFConsumerMetaData.Bin - -func DeployLoadTestBeaconVRFConsumer(auth *bind.TransactOpts, backend bind.ContractBackend, coordinator common.Address, shouldFail bool, beaconPeriodBlocks *big.Int) (common.Address, *types.Transaction, *LoadTestBeaconVRFConsumer, error) { - parsed, err := LoadTestBeaconVRFConsumerMetaData.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(LoadTestBeaconVRFConsumerBin), backend, coordinator, shouldFail, beaconPeriodBlocks) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &LoadTestBeaconVRFConsumer{LoadTestBeaconVRFConsumerCaller: LoadTestBeaconVRFConsumerCaller{contract: contract}, LoadTestBeaconVRFConsumerTransactor: LoadTestBeaconVRFConsumerTransactor{contract: contract}, LoadTestBeaconVRFConsumerFilterer: LoadTestBeaconVRFConsumerFilterer{contract: contract}}, nil -} - -type LoadTestBeaconVRFConsumer struct { - address common.Address - abi abi.ABI - LoadTestBeaconVRFConsumerCaller - LoadTestBeaconVRFConsumerTransactor - LoadTestBeaconVRFConsumerFilterer -} - -type LoadTestBeaconVRFConsumerCaller struct { - contract *bind.BoundContract -} - -type LoadTestBeaconVRFConsumerTransactor struct { - contract *bind.BoundContract -} - -type LoadTestBeaconVRFConsumerFilterer struct { - contract *bind.BoundContract -} - -type LoadTestBeaconVRFConsumerSession struct { - Contract *LoadTestBeaconVRFConsumer - CallOpts bind.CallOpts - TransactOpts bind.TransactOpts -} - -type LoadTestBeaconVRFConsumerCallerSession struct { - Contract *LoadTestBeaconVRFConsumerCaller - CallOpts bind.CallOpts -} - -type LoadTestBeaconVRFConsumerTransactorSession struct { - Contract *LoadTestBeaconVRFConsumerTransactor - TransactOpts bind.TransactOpts -} - -type LoadTestBeaconVRFConsumerRaw struct { - Contract *LoadTestBeaconVRFConsumer -} - -type LoadTestBeaconVRFConsumerCallerRaw struct { - Contract *LoadTestBeaconVRFConsumerCaller -} - -type LoadTestBeaconVRFConsumerTransactorRaw struct { - Contract *LoadTestBeaconVRFConsumerTransactor -} - -func NewLoadTestBeaconVRFConsumer(address common.Address, backend bind.ContractBackend) (*LoadTestBeaconVRFConsumer, error) { - abi, err := abi.JSON(strings.NewReader(LoadTestBeaconVRFConsumerABI)) - if err != nil { - return nil, err - } - contract, err := bindLoadTestBeaconVRFConsumer(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &LoadTestBeaconVRFConsumer{address: address, abi: abi, LoadTestBeaconVRFConsumerCaller: LoadTestBeaconVRFConsumerCaller{contract: contract}, LoadTestBeaconVRFConsumerTransactor: LoadTestBeaconVRFConsumerTransactor{contract: contract}, LoadTestBeaconVRFConsumerFilterer: LoadTestBeaconVRFConsumerFilterer{contract: contract}}, nil -} - -func NewLoadTestBeaconVRFConsumerCaller(address common.Address, caller bind.ContractCaller) (*LoadTestBeaconVRFConsumerCaller, error) { - contract, err := bindLoadTestBeaconVRFConsumer(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &LoadTestBeaconVRFConsumerCaller{contract: contract}, nil -} - -func NewLoadTestBeaconVRFConsumerTransactor(address common.Address, transactor bind.ContractTransactor) (*LoadTestBeaconVRFConsumerTransactor, error) { - contract, err := bindLoadTestBeaconVRFConsumer(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &LoadTestBeaconVRFConsumerTransactor{contract: contract}, nil -} - -func NewLoadTestBeaconVRFConsumerFilterer(address common.Address, filterer bind.ContractFilterer) (*LoadTestBeaconVRFConsumerFilterer, error) { - contract, err := bindLoadTestBeaconVRFConsumer(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &LoadTestBeaconVRFConsumerFilterer{contract: contract}, nil -} - -func bindLoadTestBeaconVRFConsumer(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := LoadTestBeaconVRFConsumerMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _LoadTestBeaconVRFConsumer.Contract.LoadTestBeaconVRFConsumerCaller.contract.Call(opts, result, method, params...) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.LoadTestBeaconVRFConsumerTransactor.contract.Transfer(opts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.LoadTestBeaconVRFConsumerTransactor.contract.Transact(opts, method, params...) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _LoadTestBeaconVRFConsumer.Contract.contract.Call(opts, result, method, params...) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.contract.Transfer(opts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.contract.Transact(opts, method, params...) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) Fail(opts *bind.CallOpts) (bool, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "fail") - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) Fail() (bool, error) { - return _LoadTestBeaconVRFConsumer.Contract.Fail(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) Fail() (bool, error) { - return _LoadTestBeaconVRFConsumer.Contract.Fail(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) GetFulfillmentDurationByRequestID(opts *bind.CallOpts, reqID *big.Int) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "getFulfillmentDurationByRequestID", reqID) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) GetFulfillmentDurationByRequestID(reqID *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.GetFulfillmentDurationByRequestID(&_LoadTestBeaconVRFConsumer.CallOpts, reqID) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) GetFulfillmentDurationByRequestID(reqID *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.GetFulfillmentDurationByRequestID(&_LoadTestBeaconVRFConsumer.CallOpts, reqID) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) GetRawFulfillmentDurationByRequestID(opts *bind.CallOpts, reqID *big.Int) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "getRawFulfillmentDurationByRequestID", reqID) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) GetRawFulfillmentDurationByRequestID(reqID *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.GetRawFulfillmentDurationByRequestID(&_LoadTestBeaconVRFConsumer.CallOpts, reqID) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) GetRawFulfillmentDurationByRequestID(reqID *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.GetRawFulfillmentDurationByRequestID(&_LoadTestBeaconVRFConsumer.CallOpts, reqID) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) IBeaconPeriodBlocks(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "i_beaconPeriodBlocks") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) IBeaconPeriodBlocks() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.IBeaconPeriodBlocks(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) IBeaconPeriodBlocks() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.IBeaconPeriodBlocks(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.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 (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) Owner() (common.Address, error) { - return _LoadTestBeaconVRFConsumer.Contract.Owner(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) Owner() (common.Address, error) { - return _LoadTestBeaconVRFConsumer.Contract.Owner(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) PendingRequests(opts *bind.CallOpts) ([]*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "pendingRequests") - - if err != nil { - return *new([]*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) PendingRequests() ([]*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.PendingRequests(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) PendingRequests() ([]*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.PendingRequests(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) RequestHeights(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "requestHeights", arg0, arg1) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) RequestHeights(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.RequestHeights(&_LoadTestBeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) RequestHeights(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.RequestHeights(&_LoadTestBeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SReceivedRandomnessByRequestID(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_ReceivedRandomnessByRequestID", arg0, arg1) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SReceivedRandomnessByRequestID(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SReceivedRandomnessByRequestID(&_LoadTestBeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SReceivedRandomnessByRequestID(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SReceivedRandomnessByRequestID(&_LoadTestBeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SArguments(opts *bind.CallOpts) ([]byte, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_arguments") - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SArguments() ([]byte, error) { - return _LoadTestBeaconVRFConsumer.Contract.SArguments(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SArguments() ([]byte, error) { - return _LoadTestBeaconVRFConsumer.Contract.SArguments(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SAverageFulfillmentInMillions(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_averageFulfillmentInMillions") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SAverageFulfillmentInMillions() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SAverageFulfillmentInMillions(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SAverageFulfillmentInMillions() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SAverageFulfillmentInMillions(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SFastestFulfillment(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_fastestFulfillment") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SFastestFulfillment() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SFastestFulfillment(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SFastestFulfillment() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SFastestFulfillment(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SFulfillmentDurationInBlocks(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_fulfillmentDurationInBlocks", arg0, arg1) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SFulfillmentDurationInBlocks(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SFulfillmentDurationInBlocks(&_LoadTestBeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SFulfillmentDurationInBlocks(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SFulfillmentDurationInBlocks(&_LoadTestBeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SGasAvailable(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_gasAvailable") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SGasAvailable() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SGasAvailable(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SGasAvailable() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SGasAvailable(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SMostRecentRequestID(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_mostRecentRequestID") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SMostRecentRequestID() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SMostRecentRequestID(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SMostRecentRequestID() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SMostRecentRequestID(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SMyBeaconRequests(opts *bind.CallOpts, arg0 *big.Int) (SMyBeaconRequests, - - error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_myBeaconRequests", arg0) - - outstruct := new(SMyBeaconRequests) - if err != nil { - return *outstruct, err - } - - outstruct.SlotNumber = *abi.ConvertType(out[0], new(uint32)).(*uint32) - outstruct.ConfirmationDelay = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.NumWords = *abi.ConvertType(out[2], new(uint16)).(*uint16) - outstruct.Requester = *abi.ConvertType(out[3], new(common.Address)).(*common.Address) - - return *outstruct, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SMyBeaconRequests(arg0 *big.Int) (SMyBeaconRequests, - - error) { - return _LoadTestBeaconVRFConsumer.Contract.SMyBeaconRequests(&_LoadTestBeaconVRFConsumer.CallOpts, arg0) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SMyBeaconRequests(arg0 *big.Int) (SMyBeaconRequests, - - error) { - return _LoadTestBeaconVRFConsumer.Contract.SMyBeaconRequests(&_LoadTestBeaconVRFConsumer.CallOpts, arg0) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SRandomWords(opts *bind.CallOpts, arg0 *big.Int) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_randomWords", arg0) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SRandomWords(arg0 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SRandomWords(&_LoadTestBeaconVRFConsumer.CallOpts, arg0) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SRandomWords(arg0 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SRandomWords(&_LoadTestBeaconVRFConsumer.CallOpts, arg0) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SRawFulfillmentDurationInBlocks(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_rawFulfillmentDurationInBlocks", arg0, arg1) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SRawFulfillmentDurationInBlocks(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SRawFulfillmentDurationInBlocks(&_LoadTestBeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SRawFulfillmentDurationInBlocks(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SRawFulfillmentDurationInBlocks(&_LoadTestBeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SRequestIDs(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_requestIDs", arg0, arg1) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SRequestIDs(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SRequestIDs(&_LoadTestBeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SRequestIDs(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SRequestIDs(&_LoadTestBeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SRequestOutputHeights(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_requestOutputHeights", arg0, arg1) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SRequestOutputHeights(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SRequestOutputHeights(&_LoadTestBeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SRequestOutputHeights(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SRequestOutputHeights(&_LoadTestBeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SRequestsIDs(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_requestsIDs", arg0, arg1) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SRequestsIDs(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SRequestsIDs(&_LoadTestBeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SRequestsIDs(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SRequestsIDs(&_LoadTestBeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SResetCounter(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_resetCounter") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SResetCounter() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SResetCounter(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SResetCounter() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SResetCounter(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SSlowestFulfillment(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_slowestFulfillment") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SSlowestFulfillment() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SSlowestFulfillment(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SSlowestFulfillment() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SSlowestFulfillment(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SSlowestRequestID(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_slowestRequestID") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SSlowestRequestID() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SSlowestRequestID(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SSlowestRequestID() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.SSlowestRequestID(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) SSubId(opts *bind.CallOpts) (uint64, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_subId") - - if err != nil { - return *new(uint64), err - } - - out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SSubId() (uint64, error) { - return _LoadTestBeaconVRFConsumer.Contract.SSubId(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) SSubId() (uint64, error) { - return _LoadTestBeaconVRFConsumer.Contract.SSubId(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) STotalFulfilled(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_totalFulfilled") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) STotalFulfilled() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.STotalFulfilled(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) STotalFulfilled() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.STotalFulfilled(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCaller) STotalRequests(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _LoadTestBeaconVRFConsumer.contract.Call(opts, &out, "s_totalRequests") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) STotalRequests() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.STotalRequests(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerCallerSession) STotalRequests() (*big.Int, error) { - return _LoadTestBeaconVRFConsumer.Contract.STotalRequests(&_LoadTestBeaconVRFConsumer.CallOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactor) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.contract.Transact(opts, "acceptOwnership") -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) AcceptOwnership() (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.AcceptOwnership(&_LoadTestBeaconVRFConsumer.TransactOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactorSession) AcceptOwnership() (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.AcceptOwnership(&_LoadTestBeaconVRFConsumer.TransactOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactor) RawFulfillRandomWords(opts *bind.TransactOpts, requestID *big.Int, randomWords []*big.Int, arguments []byte) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.contract.Transact(opts, "rawFulfillRandomWords", requestID, randomWords, arguments) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) RawFulfillRandomWords(requestID *big.Int, randomWords []*big.Int, arguments []byte) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.RawFulfillRandomWords(&_LoadTestBeaconVRFConsumer.TransactOpts, requestID, randomWords, arguments) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactorSession) RawFulfillRandomWords(requestID *big.Int, randomWords []*big.Int, arguments []byte) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.RawFulfillRandomWords(&_LoadTestBeaconVRFConsumer.TransactOpts, requestID, randomWords, arguments) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactor) Reset(opts *bind.TransactOpts) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.contract.Transact(opts, "reset") -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) Reset() (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.Reset(&_LoadTestBeaconVRFConsumer.TransactOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactorSession) Reset() (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.Reset(&_LoadTestBeaconVRFConsumer.TransactOpts) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactor) SetCoordinator(opts *bind.TransactOpts, coordinator common.Address) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.contract.Transact(opts, "setCoordinator", coordinator) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SetCoordinator(coordinator common.Address) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.SetCoordinator(&_LoadTestBeaconVRFConsumer.TransactOpts, coordinator) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactorSession) SetCoordinator(coordinator common.Address) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.SetCoordinator(&_LoadTestBeaconVRFConsumer.TransactOpts, coordinator) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactor) SetFail(opts *bind.TransactOpts, shouldFail bool) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.contract.Transact(opts, "setFail", shouldFail) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) SetFail(shouldFail bool) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.SetFail(&_LoadTestBeaconVRFConsumer.TransactOpts, shouldFail) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactorSession) SetFail(shouldFail bool) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.SetFail(&_LoadTestBeaconVRFConsumer.TransactOpts, shouldFail) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactor) StoreBeaconRequest(opts *bind.TransactOpts, reqId *big.Int, height *big.Int, delay *big.Int, numWords uint16) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.contract.Transact(opts, "storeBeaconRequest", reqId, height, delay, numWords) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) StoreBeaconRequest(reqId *big.Int, height *big.Int, delay *big.Int, numWords uint16) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.StoreBeaconRequest(&_LoadTestBeaconVRFConsumer.TransactOpts, reqId, height, delay, numWords) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactorSession) StoreBeaconRequest(reqId *big.Int, height *big.Int, delay *big.Int, numWords uint16) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.StoreBeaconRequest(&_LoadTestBeaconVRFConsumer.TransactOpts, reqId, height, delay, numWords) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactor) TestRedeemRandomness(opts *bind.TransactOpts, subID *big.Int, requestID *big.Int) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.contract.Transact(opts, "testRedeemRandomness", subID, requestID) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) TestRedeemRandomness(subID *big.Int, requestID *big.Int) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.TestRedeemRandomness(&_LoadTestBeaconVRFConsumer.TransactOpts, subID, requestID) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactorSession) TestRedeemRandomness(subID *big.Int, requestID *big.Int) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.TestRedeemRandomness(&_LoadTestBeaconVRFConsumer.TransactOpts, subID, requestID) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactor) TestRequestRandomness(opts *bind.TransactOpts, numWords uint16, subID *big.Int, confirmationDelayArg *big.Int) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.contract.Transact(opts, "testRequestRandomness", numWords, subID, confirmationDelayArg) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) TestRequestRandomness(numWords uint16, subID *big.Int, confirmationDelayArg *big.Int) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.TestRequestRandomness(&_LoadTestBeaconVRFConsumer.TransactOpts, numWords, subID, confirmationDelayArg) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactorSession) TestRequestRandomness(numWords uint16, subID *big.Int, confirmationDelayArg *big.Int) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.TestRequestRandomness(&_LoadTestBeaconVRFConsumer.TransactOpts, numWords, subID, confirmationDelayArg) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactor) TestRequestRandomnessFulfillment(opts *bind.TransactOpts, subID *big.Int, numWords uint16, confDelay *big.Int, callbackGasLimit uint32, arguments []byte) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.contract.Transact(opts, "testRequestRandomnessFulfillment", subID, numWords, confDelay, callbackGasLimit, arguments) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) TestRequestRandomnessFulfillment(subID *big.Int, numWords uint16, confDelay *big.Int, callbackGasLimit uint32, arguments []byte) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.TestRequestRandomnessFulfillment(&_LoadTestBeaconVRFConsumer.TransactOpts, subID, numWords, confDelay, callbackGasLimit, arguments) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactorSession) TestRequestRandomnessFulfillment(subID *big.Int, numWords uint16, confDelay *big.Int, callbackGasLimit uint32, arguments []byte) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.TestRequestRandomnessFulfillment(&_LoadTestBeaconVRFConsumer.TransactOpts, subID, numWords, confDelay, callbackGasLimit, arguments) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactor) TestRequestRandomnessFulfillmentBatch(opts *bind.TransactOpts, subID *big.Int, numWords uint16, confirmationDelayArg *big.Int, callbackGasLimit uint32, arguments []byte, batchSize *big.Int) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.contract.Transact(opts, "testRequestRandomnessFulfillmentBatch", subID, numWords, confirmationDelayArg, callbackGasLimit, arguments, batchSize) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) TestRequestRandomnessFulfillmentBatch(subID *big.Int, numWords uint16, confirmationDelayArg *big.Int, callbackGasLimit uint32, arguments []byte, batchSize *big.Int) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.TestRequestRandomnessFulfillmentBatch(&_LoadTestBeaconVRFConsumer.TransactOpts, subID, numWords, confirmationDelayArg, callbackGasLimit, arguments, batchSize) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactorSession) TestRequestRandomnessFulfillmentBatch(subID *big.Int, numWords uint16, confirmationDelayArg *big.Int, callbackGasLimit uint32, arguments []byte, batchSize *big.Int) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.TestRequestRandomnessFulfillmentBatch(&_LoadTestBeaconVRFConsumer.TransactOpts, subID, numWords, confirmationDelayArg, callbackGasLimit, arguments, batchSize) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactor) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.contract.Transact(opts, "transferOwnership", to) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.TransferOwnership(&_LoadTestBeaconVRFConsumer.TransactOpts, to) -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerTransactorSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _LoadTestBeaconVRFConsumer.Contract.TransferOwnership(&_LoadTestBeaconVRFConsumer.TransactOpts, to) -} - -type LoadTestBeaconVRFConsumerCoordinatorUpdatedIterator struct { - Event *LoadTestBeaconVRFConsumerCoordinatorUpdated - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *LoadTestBeaconVRFConsumerCoordinatorUpdatedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(LoadTestBeaconVRFConsumerCoordinatorUpdated) - 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(LoadTestBeaconVRFConsumerCoordinatorUpdated) - 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 *LoadTestBeaconVRFConsumerCoordinatorUpdatedIterator) Error() error { - return it.fail -} - -func (it *LoadTestBeaconVRFConsumerCoordinatorUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type LoadTestBeaconVRFConsumerCoordinatorUpdated struct { - Coordinator common.Address - Raw types.Log -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerFilterer) FilterCoordinatorUpdated(opts *bind.FilterOpts, coordinator []common.Address) (*LoadTestBeaconVRFConsumerCoordinatorUpdatedIterator, error) { - - var coordinatorRule []interface{} - for _, coordinatorItem := range coordinator { - coordinatorRule = append(coordinatorRule, coordinatorItem) - } - - logs, sub, err := _LoadTestBeaconVRFConsumer.contract.FilterLogs(opts, "CoordinatorUpdated", coordinatorRule) - if err != nil { - return nil, err - } - return &LoadTestBeaconVRFConsumerCoordinatorUpdatedIterator{contract: _LoadTestBeaconVRFConsumer.contract, event: "CoordinatorUpdated", logs: logs, sub: sub}, nil -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerFilterer) WatchCoordinatorUpdated(opts *bind.WatchOpts, sink chan<- *LoadTestBeaconVRFConsumerCoordinatorUpdated, coordinator []common.Address) (event.Subscription, error) { - - var coordinatorRule []interface{} - for _, coordinatorItem := range coordinator { - coordinatorRule = append(coordinatorRule, coordinatorItem) - } - - logs, sub, err := _LoadTestBeaconVRFConsumer.contract.WatchLogs(opts, "CoordinatorUpdated", coordinatorRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(LoadTestBeaconVRFConsumerCoordinatorUpdated) - if err := _LoadTestBeaconVRFConsumer.contract.UnpackLog(event, "CoordinatorUpdated", 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 (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerFilterer) ParseCoordinatorUpdated(log types.Log) (*LoadTestBeaconVRFConsumerCoordinatorUpdated, error) { - event := new(LoadTestBeaconVRFConsumerCoordinatorUpdated) - if err := _LoadTestBeaconVRFConsumer.contract.UnpackLog(event, "CoordinatorUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type LoadTestBeaconVRFConsumerOwnershipTransferRequestedIterator struct { - Event *LoadTestBeaconVRFConsumerOwnershipTransferRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *LoadTestBeaconVRFConsumerOwnershipTransferRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(LoadTestBeaconVRFConsumerOwnershipTransferRequested) - 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(LoadTestBeaconVRFConsumerOwnershipTransferRequested) - 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 *LoadTestBeaconVRFConsumerOwnershipTransferRequestedIterator) Error() error { - return it.fail -} - -func (it *LoadTestBeaconVRFConsumerOwnershipTransferRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type LoadTestBeaconVRFConsumerOwnershipTransferRequested struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerFilterer) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*LoadTestBeaconVRFConsumerOwnershipTransferRequestedIterator, 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 := _LoadTestBeaconVRFConsumer.contract.FilterLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return &LoadTestBeaconVRFConsumerOwnershipTransferRequestedIterator{contract: _LoadTestBeaconVRFConsumer.contract, event: "OwnershipTransferRequested", logs: logs, sub: sub}, nil -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerFilterer) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *LoadTestBeaconVRFConsumerOwnershipTransferRequested, 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 := _LoadTestBeaconVRFConsumer.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(LoadTestBeaconVRFConsumerOwnershipTransferRequested) - if err := _LoadTestBeaconVRFConsumer.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 (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerFilterer) ParseOwnershipTransferRequested(log types.Log) (*LoadTestBeaconVRFConsumerOwnershipTransferRequested, error) { - event := new(LoadTestBeaconVRFConsumerOwnershipTransferRequested) - if err := _LoadTestBeaconVRFConsumer.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type LoadTestBeaconVRFConsumerOwnershipTransferredIterator struct { - Event *LoadTestBeaconVRFConsumerOwnershipTransferred - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *LoadTestBeaconVRFConsumerOwnershipTransferredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(LoadTestBeaconVRFConsumerOwnershipTransferred) - 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(LoadTestBeaconVRFConsumerOwnershipTransferred) - 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 *LoadTestBeaconVRFConsumerOwnershipTransferredIterator) Error() error { - return it.fail -} - -func (it *LoadTestBeaconVRFConsumerOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type LoadTestBeaconVRFConsumerOwnershipTransferred struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*LoadTestBeaconVRFConsumerOwnershipTransferredIterator, 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 := _LoadTestBeaconVRFConsumer.contract.FilterLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return &LoadTestBeaconVRFConsumerOwnershipTransferredIterator{contract: _LoadTestBeaconVRFConsumer.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *LoadTestBeaconVRFConsumerOwnershipTransferred, 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 := _LoadTestBeaconVRFConsumer.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(LoadTestBeaconVRFConsumerOwnershipTransferred) - if err := _LoadTestBeaconVRFConsumer.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 (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumerFilterer) ParseOwnershipTransferred(log types.Log) (*LoadTestBeaconVRFConsumerOwnershipTransferred, error) { - event := new(LoadTestBeaconVRFConsumerOwnershipTransferred) - if err := _LoadTestBeaconVRFConsumer.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type SMyBeaconRequests struct { - SlotNumber uint32 - ConfirmationDelay *big.Int - NumWords uint16 - Requester common.Address -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumer) ParseLog(log types.Log) (generated.AbigenLog, error) { - switch log.Topics[0] { - case _LoadTestBeaconVRFConsumer.abi.Events["CoordinatorUpdated"].ID: - return _LoadTestBeaconVRFConsumer.ParseCoordinatorUpdated(log) - case _LoadTestBeaconVRFConsumer.abi.Events["OwnershipTransferRequested"].ID: - return _LoadTestBeaconVRFConsumer.ParseOwnershipTransferRequested(log) - case _LoadTestBeaconVRFConsumer.abi.Events["OwnershipTransferred"].ID: - return _LoadTestBeaconVRFConsumer.ParseOwnershipTransferred(log) - - default: - return nil, fmt.Errorf("abigen wrapper received unknown log topic: %v", log.Topics[0]) - } -} - -func (LoadTestBeaconVRFConsumerCoordinatorUpdated) Topic() common.Hash { - return common.HexToHash("0xc258faa9a17ddfdf4130b4acff63a289202e7d5f9e42f366add65368575486bc") -} - -func (LoadTestBeaconVRFConsumerOwnershipTransferRequested) Topic() common.Hash { - return common.HexToHash("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278") -} - -func (LoadTestBeaconVRFConsumerOwnershipTransferred) Topic() common.Hash { - return common.HexToHash("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0") -} - -func (_LoadTestBeaconVRFConsumer *LoadTestBeaconVRFConsumer) Address() common.Address { - return _LoadTestBeaconVRFConsumer.address -} - -type LoadTestBeaconVRFConsumerInterface interface { - Fail(opts *bind.CallOpts) (bool, error) - - GetFulfillmentDurationByRequestID(opts *bind.CallOpts, reqID *big.Int) (*big.Int, error) - - GetRawFulfillmentDurationByRequestID(opts *bind.CallOpts, reqID *big.Int) (*big.Int, error) - - IBeaconPeriodBlocks(opts *bind.CallOpts) (*big.Int, error) - - Owner(opts *bind.CallOpts) (common.Address, error) - - PendingRequests(opts *bind.CallOpts) ([]*big.Int, error) - - RequestHeights(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) - - SReceivedRandomnessByRequestID(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) - - SArguments(opts *bind.CallOpts) ([]byte, error) - - SAverageFulfillmentInMillions(opts *bind.CallOpts) (*big.Int, error) - - SFastestFulfillment(opts *bind.CallOpts) (*big.Int, error) - - SFulfillmentDurationInBlocks(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) - - SGasAvailable(opts *bind.CallOpts) (*big.Int, error) - - SMostRecentRequestID(opts *bind.CallOpts) (*big.Int, error) - - SMyBeaconRequests(opts *bind.CallOpts, arg0 *big.Int) (SMyBeaconRequests, - - error) - - SRandomWords(opts *bind.CallOpts, arg0 *big.Int) (*big.Int, error) - - SRawFulfillmentDurationInBlocks(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) - - SRequestIDs(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) - - SRequestOutputHeights(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) - - SRequestsIDs(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) - - SResetCounter(opts *bind.CallOpts) (*big.Int, error) - - SSlowestFulfillment(opts *bind.CallOpts) (*big.Int, error) - - SSlowestRequestID(opts *bind.CallOpts) (*big.Int, error) - - SSubId(opts *bind.CallOpts) (uint64, error) - - STotalFulfilled(opts *bind.CallOpts) (*big.Int, error) - - STotalRequests(opts *bind.CallOpts) (*big.Int, error) - - AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) - - RawFulfillRandomWords(opts *bind.TransactOpts, requestID *big.Int, randomWords []*big.Int, arguments []byte) (*types.Transaction, error) - - Reset(opts *bind.TransactOpts) (*types.Transaction, error) - - SetCoordinator(opts *bind.TransactOpts, coordinator common.Address) (*types.Transaction, error) - - SetFail(opts *bind.TransactOpts, shouldFail bool) (*types.Transaction, error) - - StoreBeaconRequest(opts *bind.TransactOpts, reqId *big.Int, height *big.Int, delay *big.Int, numWords uint16) (*types.Transaction, error) - - TestRedeemRandomness(opts *bind.TransactOpts, subID *big.Int, requestID *big.Int) (*types.Transaction, error) - - TestRequestRandomness(opts *bind.TransactOpts, numWords uint16, subID *big.Int, confirmationDelayArg *big.Int) (*types.Transaction, error) - - TestRequestRandomnessFulfillment(opts *bind.TransactOpts, subID *big.Int, numWords uint16, confDelay *big.Int, callbackGasLimit uint32, arguments []byte) (*types.Transaction, error) - - TestRequestRandomnessFulfillmentBatch(opts *bind.TransactOpts, subID *big.Int, numWords uint16, confirmationDelayArg *big.Int, callbackGasLimit uint32, arguments []byte, batchSize *big.Int) (*types.Transaction, error) - - TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) - - FilterCoordinatorUpdated(opts *bind.FilterOpts, coordinator []common.Address) (*LoadTestBeaconVRFConsumerCoordinatorUpdatedIterator, error) - - WatchCoordinatorUpdated(opts *bind.WatchOpts, sink chan<- *LoadTestBeaconVRFConsumerCoordinatorUpdated, coordinator []common.Address) (event.Subscription, error) - - ParseCoordinatorUpdated(log types.Log) (*LoadTestBeaconVRFConsumerCoordinatorUpdated, error) - - FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*LoadTestBeaconVRFConsumerOwnershipTransferRequestedIterator, error) - - WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *LoadTestBeaconVRFConsumerOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferRequested(log types.Log) (*LoadTestBeaconVRFConsumerOwnershipTransferRequested, error) - - FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*LoadTestBeaconVRFConsumerOwnershipTransferredIterator, error) - - WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *LoadTestBeaconVRFConsumerOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferred(log types.Log) (*LoadTestBeaconVRFConsumerOwnershipTransferred, error) - - ParseLog(log types.Log) (generated.AbigenLog, error) - - Address() common.Address -} diff --git a/core/gethwrappers/ocr2vrf/generated/vrf_beacon/vrf_beacon.go b/core/gethwrappers/ocr2vrf/generated/vrf_beacon/vrf_beacon.go deleted file mode 100644 index b44019de548..00000000000 --- a/core/gethwrappers/ocr2vrf/generated/vrf_beacon/vrf_beacon.go +++ /dev/null @@ -1,2846 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package vrf_beacon - -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 ECCArithmeticG1Point struct { - P [2]*big.Int -} - -type KeyDataStructKeyData struct { - PublicKey []byte - Hashes [][32]byte -} - -type VRFBeaconReportReport struct { - Outputs []VRFBeaconTypesVRFOutput - JuelsPerFeeCoin *big.Int - ReasonableGasPrice uint64 - RecentBlockHeight uint64 - RecentBlockHash [32]byte -} - -type VRFBeaconTypesCallback struct { - RequestID *big.Int - NumWords uint16 - Requester common.Address - Arguments []byte - GasAllowance *big.Int - SubID *big.Int - GasPrice *big.Int - WeiPerUnitLink *big.Int -} - -type VRFBeaconTypesCostedCallback struct { - Callback VRFBeaconTypesCallback - Price *big.Int -} - -type VRFBeaconTypesOutputServed struct { - Height uint64 - ConfirmationDelay *big.Int - ProofG1X *big.Int - ProofG1Y *big.Int -} - -type VRFBeaconTypesVRFOutput struct { - BlockHeight uint64 - ConfirmationDelay *big.Int - VrfOutput ECCArithmeticG1Point - Callbacks []VRFBeaconTypesCostedCallback - ShouldStore bool -} - -var VRFBeaconMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"contractIVRFCoordinatorProducerAPI\",\"name\":\"coordinator\",\"type\":\"address\"},{\"internalType\":\"contractDKG\",\"name\":\"keyProvider\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"keyID\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expectedLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"actualLength\",\"type\":\"uint256\"}],\"name\":\"CalldataLengthMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotAcceptPayeeship\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"expected\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"actual\",\"type\":\"bytes32\"}],\"name\":\"ConfigDigestMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DuplicateSigners\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"providedHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"onchainHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"blockHeight\",\"type\":\"uint64\"}],\"name\":\"HistoryDomainSeparatorWrong\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncorrectNumberOfFaultyOracles\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numTransmitters\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numPayees\",\"type\":\"uint256\"}],\"name\":\"IncorrectNumberOfPayees\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"expectedNumSignatures\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"rsLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ssLength\",\"type\":\"uint256\"}],\"name\":\"IncorrectNumberOfSignatures\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"actualBalance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requiredBalance\",\"type\":\"uint256\"}],\"name\":\"InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPayee\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyProvider\",\"type\":\"address\"}],\"name\":\"KeyInfoMustComeFromProvider\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LeftGasExceedsInitialGas\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MustBeOwnerOrBillingAdmin\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"numFaultyOracles\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"numSigners\",\"type\":\"uint256\"}],\"name\":\"NumberOfFaultyOraclesTooHigh\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"config\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"expectedLength\",\"type\":\"uint256\"}],\"name\":\"OnchainConfigHasWrongLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"}],\"name\":\"OnlyActiveSigners\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"OnlyActiveTransmitters\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyCurrentPayee\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"existingPayee\",\"type\":\"address\"}],\"name\":\"PayeeAlreadySet\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"repeatedSignerAddress\",\"type\":\"address\"}],\"name\":\"RepeatedSigner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"repeatedTransmitterAddress\",\"type\":\"address\"}],\"name\":\"RepeatedTransmitter\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReportDoesNotContainNewOutputs\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numSigners\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numTransmitters\",\"type\":\"uint256\"}],\"name\":\"SignersTransmittersMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"maxOracles\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"providedOracles\",\"type\":\"uint256\"}],\"name\":\"TooManyOracles\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"ocrVersion\",\"type\":\"uint64\"}],\"name\":\"UnknownConfigVersion\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"BillingAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"maximumGasPrice\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"reasonableGasPrice\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"observationPayment\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"transmissionPayment\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint24\",\"name\":\"accountingGas\",\"type\":\"uint24\"}],\"name\":\"BillingSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousConfigBlockNumber\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"configCount\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"signers\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"transmitters\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"onchainConfig\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"offchainConfigVersion\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"offchainConfig\",\"type\":\"bytes\"}],\"name\":\"ConfigSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"uint192\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"reasonableGasPrice\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"NewTransmission\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"payee\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"name\":\"OraclePaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"recentBlockHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"uint192\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"reasonableGasPrice\",\"type\":\"uint64\"},{\"components\":[{\"internalType\":\"uint64\",\"name\":\"height\",\"type\":\"uint64\"},{\"internalType\":\"uint24\",\"name\":\"confirmationDelay\",\"type\":\"uint24\"},{\"internalType\":\"uint256\",\"name\":\"proofG1X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"proofG1Y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structVRFBeaconTypes.OutputServed[]\",\"name\":\"outputsServed\",\"type\":\"tuple[]\"}],\"name\":\"OutputsServed\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"current\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"proposed\",\"type\":\"address\"}],\"name\":\"PayeeshipTransferRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previous\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"PayeeshipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"requestIDs\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"successfulFulfillment\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes[]\",\"name\":\"truncatedErrorData\",\"type\":\"bytes[]\"},{\"indexed\":false,\"internalType\":\"uint96[]\",\"name\":\"subBalances\",\"type\":\"uint96[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"subIDs\",\"type\":\"uint256[]\"}],\"name\":\"RandomWordsFulfilled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"nextBeaconOutputHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint24\",\"name\":\"confDelay\",\"type\":\"uint24\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"gasAllowance\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gasPrice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weiPerUnitLink\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"arguments\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"costJuels\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newSubBalance\",\"type\":\"uint256\"}],\"name\":\"RandomnessFulfillmentRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"}],\"name\":\"RandomnessRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"nextBeaconOutputHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint24\",\"name\":\"confDelay\",\"type\":\"uint24\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"costJuels\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newSubBalance\",\"type\":\"uint256\"}],\"name\":\"RandomnessRequested\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"NUM_CONF_DELAYS\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"uint64\",\"name\":\"blockHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint24\",\"name\":\"confirmationDelay\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"p\",\"type\":\"uint256[2]\"}],\"internalType\":\"structECCArithmetic.G1Point\",\"name\":\"vrfOutput\",\"type\":\"tuple\"},{\"components\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"},{\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"arguments\",\"type\":\"bytes\"},{\"internalType\":\"uint96\",\"name\":\"gasAllowance\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasPrice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"weiPerUnitLink\",\"type\":\"uint256\"}],\"internalType\":\"structVRFBeaconTypes.Callback\",\"name\":\"callback\",\"type\":\"tuple\"},{\"internalType\":\"uint96\",\"name\":\"price\",\"type\":\"uint96\"}],\"internalType\":\"structVRFBeaconTypes.CostedCallback[]\",\"name\":\"callbacks\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"shouldStore\",\"type\":\"bool\"}],\"internalType\":\"structVRFBeaconTypes.VRFOutput[]\",\"name\":\"outputs\",\"type\":\"tuple[]\"},{\"internalType\":\"uint192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"uint192\"},{\"internalType\":\"uint64\",\"name\":\"reasonableGasPrice\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"recentBlockHeight\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"recentBlockHash\",\"type\":\"bytes32\"}],\"internalType\":\"structVRFBeaconReport.Report\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"exposeType\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"maximumGasPrice\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"reasonableGasPrice\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"observationPayment\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"transmissionPayment\",\"type\":\"uint64\"},{\"internalType\":\"uint24\",\"name\":\"accountingGas\",\"type\":\"uint24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBillingAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"i_coordinator\",\"outputs\":[{\"internalType\":\"contractIVRFCoordinatorProducerAPI\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"i_link\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"publicKey\",\"type\":\"bytes\"},{\"internalType\":\"bytes32[]\",\"name\":\"hashes\",\"type\":\"bytes32[]\"}],\"internalType\":\"structKeyDataStruct.KeyData\",\"name\":\"kd\",\"type\":\"tuple\"}],\"name\":\"keyGenerated\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestConfigDetails\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"configCount\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"blockNumber\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestConfigDigestAndEpoch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"scanLogs\",\"type\":\"bool\"},{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"newKeyRequested\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"owedPayment\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_keyID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_keyProvider\",\"outputs\":[{\"internalType\":\"contractDKG\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_provingKeyHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"maximumGasPrice\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"reasonableGasPrice\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"observationPayment\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"transmissionPayment\",\"type\":\"uint64\"},{\"internalType\":\"uint24\",\"name\":\"accountingGas\",\"type\":\"uint24\"}],\"name\":\"setBilling\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"_billingAccessController\",\"type\":\"address\"}],\"name\":\"setBillingAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"signers\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"transmitters\",\"type\":\"address[]\"},{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"onchainConfig\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"offchainConfigVersion\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"offchainConfig\",\"type\":\"bytes\"}],\"name\":\"setConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"transmitters\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"payees\",\"type\":\"address[]\"}],\"name\":\"setPayees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"proposed\",\"type\":\"address\"}],\"name\":\"transferPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[3]\",\"name\":\"reportContext\",\"type\":\"bytes32[3]\"},{\"internalType\":\"bytes\",\"name\":\"report\",\"type\":\"bytes\"},{\"internalType\":\"bytes32[]\",\"name\":\"rs\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"ss\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32\",\"name\":\"rawVs\",\"type\":\"bytes32\"}],\"name\":\"transmit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"typeAndVersion\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"withdrawPayment\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60e06040523480156200001157600080fd5b5060405162004dfe38038062004dfe8339810160408190526200003491620001c7565b8181858581813380600081620000915760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0384811691909117909155811615620000c457620000c48162000103565b5050506001600160a01b03918216608052811660a052600e80546001600160a01b03191695909116949094179093555060c05250620002219350505050565b336001600160a01b038216036200015d5760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640162000088565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b6001600160a01b0381168114620001c457600080fd5b50565b60008060008060808587031215620001de57600080fd5b8451620001eb81620001ae565b6020860151909450620001fe81620001ae565b60408601519093506200021181620001ae565b6060959095015193969295505050565b60805160a05160c051614b28620002d660003960006104810152600081816103820152818161114e015281816112260152818161131c0152818161141d015281816114bb01528181612216015281816122ee015281816124650152818161275a01528181612b8301528181612c5b0152818161316501526136cd01526000818161032b015281816112540152818161144a0152818161231c015281816124c301528181612c8901526130500152614b286000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c8063afcb95d7116100f9578063d09dc33911610097578063e53bbc9a11610071578063e53bbc9a146104c7578063eb5dcd6c146104da578063f2fde38b146104ed578063fbffd2c11461050057600080fd5b8063d09dc339146104a3578063d57fc45a146104ab578063e3d0e712146104b457600080fd5b8063bf2732c7116100d3578063bf2732c714610438578063c10753291461044b578063c4c92b371461045e578063cc31f7dd1461047c57600080fd5b8063afcb95d7146103e8578063b121e14714610412578063b1dc65a41461042557600080fd5b806379ba5097116101665780638a1b1772116101405780638a1b17721461037d5780638ac28d5a146103a45780638da5cb5b146103b75780639c849b30146103d557600080fd5b806379ba50971461031e5780637d253aff1461032657806381ff70481461034d57600080fd5b806329937268116101a257806329937268146102415780632f7527cc146102b757806355e48749146102d15780635f27026f146102d957600080fd5b806305aeed58146101c95780630eafb25b146101dc578063181f5a7714610202575b600080fd5b6101da6101d73660046137f7565b50565b005b6101ef6101ea366004613854565b610513565b6040519081526020015b60405180910390f35b604080518082018252600f81527f565246426561636f6e20312e302e300000000000000000000000000000000000602082015290516101f991906138df565b60025460035460408051610100840467ffffffffffffffff9081168252690100000000000000000085048116602083015271010000000000000000000000000000000000909404841691810191909152918116606083015268010000000000000000900462ffffff16608082015260a0016101f9565b6102bf600881565b60405160ff90911681526020016101f9565b6101da61059f565b600e546102f99073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101f9565b6101da61061c565b6102f97f000000000000000000000000000000000000000000000000000000000000000081565b6004546005546040805163ffffffff808516825264010000000090940490931660208401528201526060016101f9565b6102f97f000000000000000000000000000000000000000000000000000000000000000081565b6101da6103b2366004613854565b610719565b60005473ffffffffffffffffffffffffffffffffffffffff166102f9565b6101da6103e336600461393e565b610782565b6005546006546040805160008152602081019390935263ffffffff909116908201526060016101f9565b6101da610420366004613854565b6109d4565b6101da6104333660046139ec565b610acc565b6101da610446366004613c89565b610f87565b6101da610459366004613d56565b611046565b600d5473ffffffffffffffffffffffffffffffffffffffff166102f9565b6101ef7f000000000000000000000000000000000000000000000000000000000000000081565b6101ef6113e0565b6101ef600f5481565b6101da6104c2366004613db9565b611573565b6101da6104d5366004613eb8565b611dc9565b6101da6104e8366004613f29565b61201b565b6101da6104fb366004613854565b612174565b6101da61050e366004613854565b612185565b73ffffffffffffffffffffffffffffffffffffffff811660009081526007602090815260408083208151606081018352905460ff80821615158084526101008304909116948301949094526201000090046bffffffffffffffffffffffff1691810191909152906105875750600092915050565b604001516bffffffffffffffffffffffff1692915050565b600e5473ffffffffffffffffffffffffffffffffffffffff16338114610614576040517f292f4fb500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff821660248201526044015b60405180910390fd5b506000600f55565b60015473ffffffffffffffffffffffffffffffffffffffff16331461069d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e657200000000000000000000604482015260640161060b565b60008054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217845560018054909116905560405173ffffffffffffffffffffffffffffffffffffffff90921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b73ffffffffffffffffffffffffffffffffffffffff8181166000908152600b6020526040902054163314610779576040517fdce38c2400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101d781612196565b61078a612569565b8281146107cd576040517f36d20459000000000000000000000000000000000000000000000000000000008152600481018490526024810182905260440161060b565b60005b838110156109cd5760008585838181106107ec576107ec613f62565b90506020020160208101906108019190613854565b9050600084848481811061081757610817613f62565b905060200201602081019061082c9190613854565b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600b602052604090205491925016801580158161089257508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156108e9576040517febdf175600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff80861660048301528316602482015260440161060b565b73ffffffffffffffffffffffffffffffffffffffff8481166000908152600b6020526040902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016858316908117909155908316146109b6578273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f78af32efdcad432315431e9b03d27e6cd98fb79c405fdc5af7c1714d9c0f75b360405160405180910390a45b5050505080806109c590613fc0565b9150506107d0565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff8181166000908152600c6020526040902054163314610a34576040517f9d12ec4f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8181166000818152600b602090815260408083208054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217909355600c909452828520805490921690915590519416939092849290917f78af32efdcad432315431e9b03d27e6cd98fb79c405fdc5af7c1714d9c0f75b39190a45050565b60005a6040805160c08101825260025460ff808216835267ffffffffffffffff61010083048116602080860191909152690100000000000000000084048216858701527101000000000000000000000000000000000090930481166060850152600354908116608085015262ffffff680100000000000000009091041660a08401523360009081526007835293909320549394509092908c01359116610ba0576040517fb1c1f68e00000000000000000000000000000000000000000000000000000000815233600482015260240161060b565b6005548b3514610bea576005546040517f93df584c00000000000000000000000000000000000000000000000000000000815260048101919091528b35602482015260440161060b565b610bf88a8a8a8a8a8a6125ec565b8151610c05906001613ff8565b60ff1687141580610c165750868514155b15610c6e578151610c28906001613ff8565b6040517ffc33647500000000000000000000000000000000000000000000000000000000815260ff9091166004820152602481018890526044810186905260640161060b565b60008a8a604051610c80929190614011565b604051908190038120610c97918e90602001614021565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152828252805160209182012083830190925260008084529083018190529092509060005b8a811015610e885760006001858a8460208110610d0457610d04613f62565b610d1191901a601b613ff8565b8f8f86818110610d2357610d23613f62565b905060200201358e8e87818110610d3c57610d3c613f62565b9050602002013560405160008152602001604052604051610d79949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa158015610d9b573d6000803e3d6000fd5b5050604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081015173ffffffffffffffffffffffffffffffffffffffff811660009081526008602090815290849020838501909452925460ff8082161515808552610100909204169383019390935290955092509050610e61576040517f20fb74ee00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260240161060b565b826020015160080260ff166001901b84019350508080610e8090613fc0565b915050610ce5565b5081827e010101010101010101010101010101010101010101010101010101010101011614610ee3576040517fc103be2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5060009150819050610f328d826020020135848e8e8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061267c92505050565b600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff600888901c161790559092509050610f7884838388336128c6565b50505050505050505050505050565b600e5473ffffffffffffffffffffffffffffffffffffffff16338114610ff7576040517f292f4fb500000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8216602482015260440161060b565b81516040516110099190602001614035565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190528051602090910120600f555050565b60005473ffffffffffffffffffffffffffffffffffffffff1633148015906111075750600d546040517f6b14daf800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690636b14daf8906110c4903390600090369060040161409a565b602060405180830381865afa1580156110e1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110591906140da565b155b1561113e576040517fc04ecc2800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611148612a24565b905060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663597d2f3c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111db91906140f5565b905060006111e9828461410e565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301529192506000917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa15801561129b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112bf91906140f5565b905081811015611305576040517fcf479181000000000000000000000000000000000000000000000000000000008152600481018290526024810183905260440161060b565b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001663f99b1d688761135561134f8686614121565b89612b1f565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff90921660048301526024820152604401600060405180830381600087803b1580156113c057600080fd5b505af11580156113d4573d6000803e3d6000fd5b50505050505050505050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000008116600483015260009182917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611491573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b591906140f5565b905060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663597d2f3c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611524573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061154891906140f5565b90506000611554612a24565b9050816115618285614134565b61156b9190614134565b935050505090565b888787601f8311156115bb576040517f809fc428000000000000000000000000000000000000000000000000000000008152601f60048201526024810184905260440161060b565b8183146115fe576040517f988a0804000000000000000000000000000000000000000000000000000000008152600481018490526024810183905260440161060b565b61160981600361415b565b60ff168311611650576040517ffda9db7800000000000000000000000000000000000000000000000000000000815260ff821660048201526024810184905260440161060b565b61165c8160ff16612b39565b611664612569565b60006040518060c001604052808f8f80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505081526020018d8d8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050509082525060ff8c1660208083019190915260408051601f8d0183900483028101830182528c8152920191908c908c908190840183828082843760009201919091525050509082525067ffffffffffffffff891660208083019190915260408051601f8a01839004830281018301825289815292019190899089908190840183828082843760009201919091525050509152509050611786612b73565b60095460005b8181101561187f576000600982815481106117a9576117a9613f62565b6000918252602082200154600a805473ffffffffffffffffffffffffffffffffffffffff909216935090849081106117e3576117e3613f62565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff948516835260088252604080842080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000016905594168252600790529190912080547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000169055508061187781613fc0565b91505061178c565b5061188c6009600061373a565b611898600a600061373a565b60005b825151811015611c215760086000846000015183815181106118bf576118bf613f62565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff1682528101919091526040016000205460ff161561196357825180518290811061190c5761190c613f62565b60200260200101516040517f7451f83e00000000000000000000000000000000000000000000000000000000815260040161060b919073ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b604080518082019091526001815260ff82166020820152835180516008916000918590811061199457611994613f62565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff16825281810192909252604001600090812083518154948401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00009095169015157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff161761010060ff90951694909402939093179092558401518051600792919084908110611a4657611a46613f62565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff1682528101919091526040016000205460ff1615611aec5782602001518181518110611a9557611a95613f62565b60200260200101516040517fe8d2989900000000000000000000000000000000000000000000000000000000815260040161060b919073ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b60405180606001604052806001151581526020018260ff16815260200160006bffffffffffffffffffffffff168152506007600085602001518481518110611b3657611b36613f62565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff168252818101929092526040908101600020835181549385015194909201516bffffffffffffffffffffffff1662010000027fffffffffffffffffffffffffffffffffffff000000000000000000000000ffff60ff95909516610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff931515939093167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000090941693909317919091179290921617905580611c1981613fc0565b91505061189b565b5081518051611c3891600991602090910190613758565b506020808301518051611c4f92600a920190613758565b506040820151600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff909216919091179055600454640100000000900463ffffffff16611c9f6131d5565b6004805463ffffffff928316640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff82168117909255600092611ced9281169116176001614177565b905080600460006101000a81548163ffffffff021916908363ffffffff1602179055506000611d4146308463ffffffff16886000015189602001518a604001518b606001518c608001518d60a0015161326c565b9050806005819055507f1591690b8638f5fb2dbec82ac741805ac5da8b45dc5263f4875b0496fdce4e058360055484886000015189602001518a604001518b606001518c608001518d60a00151604051611da3999897969594939291906141e5565b60405180910390a1611db58d8d613317565b505050505050505050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314801590611e8a5750600d546040517f6b14daf800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690636b14daf890611e47903390600090369060040161409a565b602060405180830381865afa158015611e64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8891906140da565b155b15611ec1576040517fc04ecc2800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611ec9612b73565b6002805467ffffffffffffffff8581167101000000000000000000000000000000000081027fffffffffffffff0000000000000000ffffffffffffffffffffffffffffffffff898416690100000000000000000081027fffffffffffffffffffffffffffffff0000000000000000ffffffffffffffffff8d87166101008102919091167fffffffffffffffffffffffffffffff00000000000000000000000000000000ff909816979097171791909116919091179094556003805462ffffff87166801000000000000000081027fffffffffffffffffffffffffffffffffffffffffff00000000000000000000009092169489169485179190911790915560408051948552602085019590955293830152606082015260808101919091527f49275ddcdfc9c0519b3d094308c8bf675f06070a754ce90c152163cb6e66e8a09060a00160405180910390a15050505050565b73ffffffffffffffffffffffffffffffffffffffff8281166000908152600b602052604090205416331461207b576040517fdce38c2400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811633036120ca576040517fb387a23800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600c6020526040902080548383167fffffffffffffffffffffffff00000000000000000000000000000000000000008216811790925590911690811461216f5760405173ffffffffffffffffffffffffffffffffffffffff8084169133918616907f84f7c7c80bb8ed2279b4aab5f61cd05e6374073d38f46d7f32de8c30e9e3836790600090a45b505050565b61217c612569565b6101d781613325565b61218d612569565b6101d78161341a565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600760209081526040918290208251606081018452905460ff80821615158084526101008304909116938301939093526201000090046bffffffffffffffffffffffff1692810192909252612205575050565b600061221083610513565b905060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663597d2f3c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561227f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a391906140f5565b905060006122b1828461410e565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301529192506000917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015612363573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061238791906140f5565b9050818110156123cd576040517fcf479181000000000000000000000000000000000000000000000000000000008152600481018290526024810183905260440161060b565b83156125615773ffffffffffffffffffffffffffffffffffffffff8681166000908152600b602090815260408083205460079092529182902080547fffffffffffffffffffffffffffffffffffff000000000000000000000000ffff16905590517ff99b1d680000000000000000000000000000000000000000000000000000000081529082166004820181905260248201879052917f0000000000000000000000000000000000000000000000000000000000000000169063f99b1d6890604401600060405180830381600087803b1580156124a957600080fd5b505af11580156124bd573d6000803e3d6000fd5b505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fd0b1dac935d85bd54cf0a33b0d41d39f8cf53a968465fc7ea2377526b8ac712c8860405161255791815260200190565b60405180910390a4505b505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146125ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015260640161060b565b565b60006125f982602061427b565b61260485602061427b565b6126108861014461410e565b61261a919061410e565b612624919061410e565b61262f90600061410e565b9050368114612673576040517ff7b94f0a0000000000000000000000000000000000000000000000000000000081526004810182905236602482015260440161060b565b50505050505050565b60008060008380602001905181019061269591906144bf565b905060006126a682606001516134c2565b90508082608001511461270957608082015160608301516040517faed0afe500000000000000000000000000000000000000000000000000000000815260048101929092526024820183905267ffffffffffffffff16604482015260640161060b565b81516020830151604080850151606086015191517f76f2e3f400000000000000000000000000000000000000000000000000000000815260009473ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016946376f2e3f4946127929492939192916004016147fa565b6020604051808303816000875af11580156127b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d591906140da565b90508061280e576040517f69c920fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8664ffffffffff167ffc3c7a7927e878a0fca37c904953c3c75cee3ca1d1640184a0ab1c65eec6274333856020015186604001518c6040516128a5949392919073ffffffffffffffffffffffffffffffffffffffff94909416845277ffffffffffffffffffffffffffffffffffffffffffffffff92909216602084015267ffffffffffffffff166040830152606082015260800190565b60405180910390a28260200151836040015194509450505050935093915050565b60006128f23a67ffffffffffffffff8616156128e257856128e8565b87604001515b88602001516135a5565b90506010360260005a9050600061291b8663ffffffff1685858c60a0015162ffffff16866135f6565b90506000670de0b6b3a764000077ffffffffffffffffffffffffffffffffffffffffffffffff8a16830273ffffffffffffffffffffffffffffffffffffffff881660009081526007602052604090205460808d01519290910492506201000090046bffffffffffffffffffffffff9081169167ffffffffffffffff16828401019081168211156129b157505050505050506109cd565b73ffffffffffffffffffffffffffffffffffffffff8816600090815260076020526040902080546bffffffffffffffffffffffff90921662010000027fffffffffffffffffffffffffffffffffffff000000000000000000000000ffff9092169190911790555050505050505050505050565b600080600a805480602002602001604051908101604052809291908181526020018280548015612a8a57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311612a5f575b505083519394506000925050505b81811015612b195760076000848381518110612ab657612ab6613f62565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff16825281019190915260400160002054612b05906201000090046bffffffffffffffffffffffff168561410e565b935080612b1181613fc0565b915050612a98565b50505090565b600081831015612b30575081612b33565b50805b92915050565b806000036101d7576040517fe77dba5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000612b7d612a24565b905060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663597d2f3c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612bec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c1091906140f5565b90506000612c1e828461410e565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301529192506000917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015612cd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cf491906140f5565b905081811015612d3a576040517fcf479181000000000000000000000000000000000000000000000000000000008152600481018290526024810183905260440161060b565b6000600a805480602002602001604051908101604052809291908181526020018280548015612d9f57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311612d74575b5050505050905060008151905060008167ffffffffffffffff811115612dc757612dc7613aa3565b604051908082528060200260200182016040528015612df0578160200160208202803683370190505b50905060008267ffffffffffffffff811115612e0e57612e0e613aa3565b604051908082528060200260200182016040528015612e37578160200160208202803683370190505b5090506000805b8481101561311157600060076000888481518110612e5e57612e5e613f62565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160029054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff169050600060076000898581518110612ee457612ee4613f62565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff16825281019190915260400160002080546bffffffffffffffffffffffff9290921662010000027fffffffffffffffffffffffffffffffffffff000000000000000000000000ffff909216919091179055808015613107576000600b60008a8681518110612f7557612f75613f62565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905080878681518110612fed57612fed613f62565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508186868151811061303a5761303a613f62565b60200260200101818152505084806001019550507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff168a86815181106130ae576130ae613f62565b602002602001015173ffffffffffffffffffffffffffffffffffffffff167fd0b1dac935d85bd54cf0a33b0d41d39f8cf53a968465fc7ea2377526b8ac712c856040516130fd91815260200190565b60405180910390a4505b5050600101612e3e565b5081518114613121578082528083525b8151156131ca576040517f73433a2f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906373433a2f9061319c908690869060040161496a565b600060405180830381600087803b1580156131b657600080fd5b505af1158015610f78573d6000803e3d6000fd5b505050505050505050565b60004661a4b18114806131ea575062066eed81145b1561326557606473ffffffffffffffffffffffffffffffffffffffff1663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561323b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061325f91906140f5565b91505090565b4391505090565b6000808a8a8a8a8a8a8a8a8a604051602001613290999897969594939291906149c1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101207dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167e01000000000000000000000000000000000000000000000000000000000000179150509998505050505050505050565b613321828261363e565b5050565b3373ffffffffffffffffffffffffffffffffffffffff8216036133a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640161060b565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b600d5473ffffffffffffffffffffffffffffffffffffffff908116908216811461332157600d80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84811691821790925560408051928416835260208301919091527f793cb73064f3c8cde7e187ae515511e6e56d1ee89bf08b82fa60fb70f8d48912910160405180910390a15050565b60004661a4b18114806134d7575062066eed81145b15613595576101008367ffffffffffffffff166134f26131d5565b6134fc9190614121565b111561350b5750600092915050565b6040517f2b407a8200000000000000000000000000000000000000000000000000000000815267ffffffffffffffff84166004820152606490632b407a8290602401602060405180830381865afa15801561356a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061358e91906140f5565b9392505050565b505067ffffffffffffffff164090565b60008367ffffffffffffffff84168110156135d9576002858567ffffffffffffffff1603816135d6576135d661493b565b04015b6135ed818467ffffffffffffffff16612b1f565b95945050505050565b600081861015613632576040517f3fef97df00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50909303019091010290565b610100818114613680578282826040517f418a179b00000000000000000000000000000000000000000000000000000000815260040161060b93929190614a56565b600061368e83850185614a7a565b90506040517f8eef585f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690638eef585f90613702908490600401614ae4565b600060405180830381600087803b15801561371c57600080fd5b505af1158015613730573d6000803e3d6000fd5b5050505050505050565b50805460008255906000526020600020908101906101d791906137e2565b8280548282559060005260206000209081019282156137d2579160200282015b828111156137d257825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190613778565b506137de9291506137e2565b5090565b5b808211156137de57600081556001016137e3565b60006020828403121561380957600080fd5b813567ffffffffffffffff81111561382057600080fd5b820160a0818503121561358e57600080fd5b73ffffffffffffffffffffffffffffffffffffffff811681146101d757600080fd5b60006020828403121561386657600080fd5b813561358e81613832565b60005b8381101561388c578181015183820152602001613874565b50506000910152565b600081518084526138ad816020860160208601613871565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061358e6020830184613895565b60008083601f84011261390457600080fd5b50813567ffffffffffffffff81111561391c57600080fd5b6020830191508360208260051b850101111561393757600080fd5b9250929050565b6000806000806040858703121561395457600080fd5b843567ffffffffffffffff8082111561396c57600080fd5b613978888389016138f2565b9096509450602087013591508082111561399157600080fd5b5061399e878288016138f2565b95989497509550505050565b60008083601f8401126139bc57600080fd5b50813567ffffffffffffffff8111156139d457600080fd5b60208301915083602082850101111561393757600080fd5b60008060008060008060008060e0898b031215613a0857600080fd5b606089018a811115613a1957600080fd5b8998503567ffffffffffffffff80821115613a3357600080fd5b613a3f8c838d016139aa565b909950975060808b0135915080821115613a5857600080fd5b613a648c838d016138f2565b909750955060a08b0135915080821115613a7d57600080fd5b50613a8a8b828c016138f2565b999c989b50969995989497949560c00135949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715613af557613af5613aa3565b60405290565b604051610100810167ffffffffffffffff81118282101715613af557613af5613aa3565b60405160a0810167ffffffffffffffff81118282101715613af557613af5613aa3565b6040516020810167ffffffffffffffff81118282101715613af557613af5613aa3565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613bac57613bac613aa3565b604052919050565b600067ffffffffffffffff821115613bce57613bce613aa3565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600067ffffffffffffffff821115613c1457613c14613aa3565b5060051b60200190565b600082601f830112613c2f57600080fd5b81356020613c44613c3f83613bfa565b613b65565b82815260059290921b84018101918181019086841115613c6357600080fd5b8286015b84811015613c7e5780358352918301918301613c67565b509695505050505050565b60006020808385031215613c9c57600080fd5b823567ffffffffffffffff80821115613cb457600080fd5b9084019060408287031215613cc857600080fd5b613cd0613ad2565b823582811115613cdf57600080fd5b8301601f81018813613cf057600080fd5b8035613cfe613c3f82613bb4565b8181528987838501011115613d1257600080fd5b818784018883013760008783830101528084525050508383013582811115613d3957600080fd5b613d4588828601613c1e565b948201949094529695505050505050565b60008060408385031215613d6957600080fd5b8235613d7481613832565b946020939093013593505050565b803560ff81168114613d9357600080fd5b919050565b67ffffffffffffffff811681146101d757600080fd5b8035613d9381613d98565b60008060008060008060008060008060c08b8d031215613dd857600080fd5b8a3567ffffffffffffffff80821115613df057600080fd5b613dfc8e838f016138f2565b909c509a5060208d0135915080821115613e1557600080fd5b613e218e838f016138f2565b909a509850889150613e3560408e01613d82565b975060608d0135915080821115613e4b57600080fd5b613e578e838f016139aa565b9097509550859150613e6b60808e01613dae565b945060a08d0135915080821115613e8157600080fd5b50613e8e8d828e016139aa565b915080935050809150509295989b9194979a5092959850565b62ffffff811681146101d757600080fd5b600080600080600060a08688031215613ed057600080fd5b8535613edb81613d98565b94506020860135613eeb81613d98565b93506040860135613efb81613d98565b92506060860135613f0b81613d98565b91506080860135613f1b81613ea7565b809150509295509295909350565b60008060408385031215613f3c57600080fd5b8235613f4781613832565b91506020830135613f5781613832565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613ff157613ff1613f91565b5060010190565b60ff8181168382160190811115612b3357612b33613f91565b8183823760009101908152919050565b828152606082602083013760800192915050565b60008251614047818460208701613871565b9190910192915050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff841681526040602082015260006135ed604083018486614051565b80518015158114613d9357600080fd5b6000602082840312156140ec57600080fd5b61358e826140ca565b60006020828403121561410757600080fd5b5051919050565b80820180821115612b3357612b33613f91565b81810381811115612b3357612b33613f91565b818103600083128015838313168383128216171561415457614154613f91565b5092915050565b60ff818116838216029081169081811461415457614154613f91565b63ffffffff81811683821601908082111561415457614154613f91565b600081518084526020808501945080840160005b838110156141da57815173ffffffffffffffffffffffffffffffffffffffff16875295820195908201906001016141a8565b509495945050505050565b600061012063ffffffff808d1684528b6020850152808b166040850152508060608401526142158184018a614194565b905082810360808401526142298189614194565b905060ff871660a084015282810360c08401526142468187613895565b905067ffffffffffffffff851660e084015282810361010084015261426b8185613895565b9c9b505050505050505050505050565b8082028115828204841417612b3357612b33613f91565b8051613d9381613d98565b805161ffff81168114613d9357600080fd5b8051613d9381613832565b600082601f8301126142cb57600080fd5b81516142d9613c3f82613bb4565b8181528460208386010111156142ee57600080fd5b6142ff826020830160208701613871565b949350505050565b80516bffffffffffffffffffffffff81168114613d9357600080fd5b600082601f83011261433457600080fd5b81516020614344613c3f83613bfa565b82815260059290921b8401810191818101908684111561436357600080fd5b8286015b84811015613c7e57805167ffffffffffffffff8082111561438757600080fd5b908801907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06040838c03820112156143be57600080fd5b6143c6613ad2565b87840151838111156143d757600080fd5b8401610100818e03840112156143ec57600080fd5b6143f4613afb565b92508881015183526144086040820161429d565b89840152614418606082016142af565b604084015260808101518481111561442f57600080fd5b61443d8e8b838501016142ba565b60608501525061444f60a08201614307565b608084015260c081015160a084015260e081015160c084015261010081015160e08401525081815261448360408501614307565b818901528652505050918301918301614367565b805177ffffffffffffffffffffffffffffffffffffffffffffffff81168114613d9357600080fd5b6000602082840312156144d157600080fd5b815167ffffffffffffffff808211156144e957600080fd5b9083019060a082860312156144fd57600080fd5b614505613b1f565b82518281111561451457600080fd5b8301601f8101871361452557600080fd5b8051614533613c3f82613bfa565b8082825260208201915060208360051b85010192508983111561455557600080fd5b602084015b838110156146a25780518781111561457157600080fd5b850160c0818d037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00112156145a557600080fd5b6145ad613b1f565b60208201516145bb81613d98565b815260408201516145cb81613ea7565b60208201526040828e037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa001121561460257600080fd5b61460a613b42565b8d607f84011261461957600080fd5b614621613ad2565b808f60a08601111561463257600080fd5b606085015b60a08601811015614652578051835260209283019201614637565b50825250604082015260a08201518981111561466d57600080fd5b61467c8e602083860101614323565b60608301525061468e60c083016140ca565b60808201528452506020928301920161455a565b508452506146b591505060208401614497565b60208201526146c660408401614292565b60408201526146d760608401614292565b60608201526080830151608082015280935050505092915050565b600081518084526020808501808196508360051b8101915082860160005b858110156147ed57828403895281516040815181875280518288015287810151606061ffff8216818a01528383015193506080915073ffffffffffffffffffffffffffffffffffffffff8416828a01528083015193505061010060a081818b015261477f6101408b0186613895565b9284015192945060c06147a18b8201856bffffffffffffffffffffffff169052565b9084015160e08b81019190915290840151918a01919091529091015161012088015250908601516bffffffffffffffffffffffff16948601949094529784019790840190600101614710565b5091979650505050505050565b6000608080830181845280885180835260a092508286019150828160051b8701016020808c016000805b858110156148df578a85037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600187528251805167ffffffffffffffff1686528481015162ffffff16858701526040808201515160c091859089015b600282101561489e57825181529188019160019190910190880161487f565b5050506060820151818c8901526148b7828901826146f2565b928c0151801515898d01529291506148cc9050565b9785019795505091830191600101614824565b50505081965061490a8189018c77ffffffffffffffffffffffffffffffffffffffffffffffff169052565b505050505050614926604083018567ffffffffffffffff169052565b67ffffffffffffffff831660608301526135ed565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60408152600061497d6040830185614194565b82810360208481019190915284518083528582019282019060005b818110156149b457845183529383019391830191600101614998565b5090979650505050505050565b60006101208b835273ffffffffffffffffffffffffffffffffffffffff8b16602084015267ffffffffffffffff808b166040850152816060850152614a088285018b614194565b91508382036080850152614a1c828a614194565b915060ff881660a085015283820360c0850152614a398288613895565b90861660e0850152838103610100850152905061426b8185613895565b604081526000614a6a604083018587614051565b9050826020830152949350505050565b6000610100808385031215614a8e57600080fd5b83601f840112614a9d57600080fd5b614aa5613afb565b908301908085831115614ab757600080fd5b845b83811015614ada578035614acc81613ea7565b835260209283019201614ab9565b5095945050505050565b6101008101818360005b6008811015614b1257815162ffffff16835260209283019290910190600101614aee565b5050509291505056fea164736f6c6343000813000a", -} - -var VRFBeaconABI = VRFBeaconMetaData.ABI - -var VRFBeaconBin = VRFBeaconMetaData.Bin - -func DeployVRFBeacon(auth *bind.TransactOpts, backend bind.ContractBackend, link common.Address, coordinator common.Address, keyProvider common.Address, keyID [32]byte) (common.Address, *types.Transaction, *VRFBeacon, error) { - parsed, err := VRFBeaconMetaData.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(VRFBeaconBin), backend, link, coordinator, keyProvider, keyID) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &VRFBeacon{VRFBeaconCaller: VRFBeaconCaller{contract: contract}, VRFBeaconTransactor: VRFBeaconTransactor{contract: contract}, VRFBeaconFilterer: VRFBeaconFilterer{contract: contract}}, nil -} - -type VRFBeacon struct { - address common.Address - abi abi.ABI - VRFBeaconCaller - VRFBeaconTransactor - VRFBeaconFilterer -} - -type VRFBeaconCaller struct { - contract *bind.BoundContract -} - -type VRFBeaconTransactor struct { - contract *bind.BoundContract -} - -type VRFBeaconFilterer struct { - contract *bind.BoundContract -} - -type VRFBeaconSession struct { - Contract *VRFBeacon - CallOpts bind.CallOpts - TransactOpts bind.TransactOpts -} - -type VRFBeaconCallerSession struct { - Contract *VRFBeaconCaller - CallOpts bind.CallOpts -} - -type VRFBeaconTransactorSession struct { - Contract *VRFBeaconTransactor - TransactOpts bind.TransactOpts -} - -type VRFBeaconRaw struct { - Contract *VRFBeacon -} - -type VRFBeaconCallerRaw struct { - Contract *VRFBeaconCaller -} - -type VRFBeaconTransactorRaw struct { - Contract *VRFBeaconTransactor -} - -func NewVRFBeacon(address common.Address, backend bind.ContractBackend) (*VRFBeacon, error) { - abi, err := abi.JSON(strings.NewReader(VRFBeaconABI)) - if err != nil { - return nil, err - } - contract, err := bindVRFBeacon(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &VRFBeacon{address: address, abi: abi, VRFBeaconCaller: VRFBeaconCaller{contract: contract}, VRFBeaconTransactor: VRFBeaconTransactor{contract: contract}, VRFBeaconFilterer: VRFBeaconFilterer{contract: contract}}, nil -} - -func NewVRFBeaconCaller(address common.Address, caller bind.ContractCaller) (*VRFBeaconCaller, error) { - contract, err := bindVRFBeacon(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &VRFBeaconCaller{contract: contract}, nil -} - -func NewVRFBeaconTransactor(address common.Address, transactor bind.ContractTransactor) (*VRFBeaconTransactor, error) { - contract, err := bindVRFBeacon(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &VRFBeaconTransactor{contract: contract}, nil -} - -func NewVRFBeaconFilterer(address common.Address, filterer bind.ContractFilterer) (*VRFBeaconFilterer, error) { - contract, err := bindVRFBeacon(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &VRFBeaconFilterer{contract: contract}, nil -} - -func bindVRFBeacon(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := VRFBeaconMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -func (_VRFBeacon *VRFBeaconRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _VRFBeacon.Contract.VRFBeaconCaller.contract.Call(opts, result, method, params...) -} - -func (_VRFBeacon *VRFBeaconRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _VRFBeacon.Contract.VRFBeaconTransactor.contract.Transfer(opts) -} - -func (_VRFBeacon *VRFBeaconRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _VRFBeacon.Contract.VRFBeaconTransactor.contract.Transact(opts, method, params...) -} - -func (_VRFBeacon *VRFBeaconCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _VRFBeacon.Contract.contract.Call(opts, result, method, params...) -} - -func (_VRFBeacon *VRFBeaconTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _VRFBeacon.Contract.contract.Transfer(opts) -} - -func (_VRFBeacon *VRFBeaconTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _VRFBeacon.Contract.contract.Transact(opts, method, params...) -} - -func (_VRFBeacon *VRFBeaconCaller) NUMCONFDELAYS(opts *bind.CallOpts) (uint8, error) { - var out []interface{} - err := _VRFBeacon.contract.Call(opts, &out, "NUM_CONF_DELAYS") - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -func (_VRFBeacon *VRFBeaconSession) NUMCONFDELAYS() (uint8, error) { - return _VRFBeacon.Contract.NUMCONFDELAYS(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCallerSession) NUMCONFDELAYS() (uint8, error) { - return _VRFBeacon.Contract.NUMCONFDELAYS(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCaller) GetBilling(opts *bind.CallOpts) (GetBilling, - - error) { - var out []interface{} - err := _VRFBeacon.contract.Call(opts, &out, "getBilling") - - outstruct := new(GetBilling) - if err != nil { - return *outstruct, err - } - - outstruct.MaximumGasPrice = *abi.ConvertType(out[0], new(uint64)).(*uint64) - outstruct.ReasonableGasPrice = *abi.ConvertType(out[1], new(uint64)).(*uint64) - outstruct.ObservationPayment = *abi.ConvertType(out[2], new(uint64)).(*uint64) - outstruct.TransmissionPayment = *abi.ConvertType(out[3], new(uint64)).(*uint64) - outstruct.AccountingGas = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) - - return *outstruct, err - -} - -func (_VRFBeacon *VRFBeaconSession) GetBilling() (GetBilling, - - error) { - return _VRFBeacon.Contract.GetBilling(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCallerSession) GetBilling() (GetBilling, - - error) { - return _VRFBeacon.Contract.GetBilling(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCaller) GetBillingAccessController(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _VRFBeacon.contract.Call(opts, &out, "getBillingAccessController") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -func (_VRFBeacon *VRFBeaconSession) GetBillingAccessController() (common.Address, error) { - return _VRFBeacon.Contract.GetBillingAccessController(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCallerSession) GetBillingAccessController() (common.Address, error) { - return _VRFBeacon.Contract.GetBillingAccessController(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCaller) ICoordinator(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _VRFBeacon.contract.Call(opts, &out, "i_coordinator") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -func (_VRFBeacon *VRFBeaconSession) ICoordinator() (common.Address, error) { - return _VRFBeacon.Contract.ICoordinator(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCallerSession) ICoordinator() (common.Address, error) { - return _VRFBeacon.Contract.ICoordinator(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCaller) ILink(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _VRFBeacon.contract.Call(opts, &out, "i_link") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -func (_VRFBeacon *VRFBeaconSession) ILink() (common.Address, error) { - return _VRFBeacon.Contract.ILink(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCallerSession) ILink() (common.Address, error) { - return _VRFBeacon.Contract.ILink(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCaller) LatestConfigDetails(opts *bind.CallOpts) (LatestConfigDetails, - - error) { - var out []interface{} - err := _VRFBeacon.contract.Call(opts, &out, "latestConfigDetails") - - outstruct := new(LatestConfigDetails) - if err != nil { - return *outstruct, err - } - - outstruct.ConfigCount = *abi.ConvertType(out[0], new(uint32)).(*uint32) - outstruct.BlockNumber = *abi.ConvertType(out[1], new(uint32)).(*uint32) - outstruct.ConfigDigest = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte) - - return *outstruct, err - -} - -func (_VRFBeacon *VRFBeaconSession) LatestConfigDetails() (LatestConfigDetails, - - error) { - return _VRFBeacon.Contract.LatestConfigDetails(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCallerSession) LatestConfigDetails() (LatestConfigDetails, - - error) { - return _VRFBeacon.Contract.LatestConfigDetails(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCaller) LatestConfigDigestAndEpoch(opts *bind.CallOpts) (LatestConfigDigestAndEpoch, - - error) { - var out []interface{} - err := _VRFBeacon.contract.Call(opts, &out, "latestConfigDigestAndEpoch") - - outstruct := new(LatestConfigDigestAndEpoch) - if err != nil { - return *outstruct, err - } - - outstruct.ScanLogs = *abi.ConvertType(out[0], new(bool)).(*bool) - outstruct.ConfigDigest = *abi.ConvertType(out[1], new([32]byte)).(*[32]byte) - outstruct.Epoch = *abi.ConvertType(out[2], new(uint32)).(*uint32) - - return *outstruct, err - -} - -func (_VRFBeacon *VRFBeaconSession) LatestConfigDigestAndEpoch() (LatestConfigDigestAndEpoch, - - error) { - return _VRFBeacon.Contract.LatestConfigDigestAndEpoch(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCallerSession) LatestConfigDigestAndEpoch() (LatestConfigDigestAndEpoch, - - error) { - return _VRFBeacon.Contract.LatestConfigDigestAndEpoch(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCaller) LinkAvailableForPayment(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _VRFBeacon.contract.Call(opts, &out, "linkAvailableForPayment") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_VRFBeacon *VRFBeaconSession) LinkAvailableForPayment() (*big.Int, error) { - return _VRFBeacon.Contract.LinkAvailableForPayment(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCallerSession) LinkAvailableForPayment() (*big.Int, error) { - return _VRFBeacon.Contract.LinkAvailableForPayment(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCaller) OwedPayment(opts *bind.CallOpts, transmitterAddress common.Address) (*big.Int, error) { - var out []interface{} - err := _VRFBeacon.contract.Call(opts, &out, "owedPayment", transmitterAddress) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_VRFBeacon *VRFBeaconSession) OwedPayment(transmitterAddress common.Address) (*big.Int, error) { - return _VRFBeacon.Contract.OwedPayment(&_VRFBeacon.CallOpts, transmitterAddress) -} - -func (_VRFBeacon *VRFBeaconCallerSession) OwedPayment(transmitterAddress common.Address) (*big.Int, error) { - return _VRFBeacon.Contract.OwedPayment(&_VRFBeacon.CallOpts, transmitterAddress) -} - -func (_VRFBeacon *VRFBeaconCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _VRFBeacon.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 (_VRFBeacon *VRFBeaconSession) Owner() (common.Address, error) { - return _VRFBeacon.Contract.Owner(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCallerSession) Owner() (common.Address, error) { - return _VRFBeacon.Contract.Owner(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCaller) SKeyID(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _VRFBeacon.contract.Call(opts, &out, "s_keyID") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -func (_VRFBeacon *VRFBeaconSession) SKeyID() ([32]byte, error) { - return _VRFBeacon.Contract.SKeyID(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCallerSession) SKeyID() ([32]byte, error) { - return _VRFBeacon.Contract.SKeyID(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCaller) SKeyProvider(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _VRFBeacon.contract.Call(opts, &out, "s_keyProvider") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -func (_VRFBeacon *VRFBeaconSession) SKeyProvider() (common.Address, error) { - return _VRFBeacon.Contract.SKeyProvider(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCallerSession) SKeyProvider() (common.Address, error) { - return _VRFBeacon.Contract.SKeyProvider(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCaller) SProvingKeyHash(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _VRFBeacon.contract.Call(opts, &out, "s_provingKeyHash") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -func (_VRFBeacon *VRFBeaconSession) SProvingKeyHash() ([32]byte, error) { - return _VRFBeacon.Contract.SProvingKeyHash(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCallerSession) SProvingKeyHash() ([32]byte, error) { - return _VRFBeacon.Contract.SProvingKeyHash(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCaller) TypeAndVersion(opts *bind.CallOpts) (string, error) { - var out []interface{} - err := _VRFBeacon.contract.Call(opts, &out, "typeAndVersion") - - if err != nil { - return *new(string), err - } - - out0 := *abi.ConvertType(out[0], new(string)).(*string) - - return out0, err - -} - -func (_VRFBeacon *VRFBeaconSession) TypeAndVersion() (string, error) { - return _VRFBeacon.Contract.TypeAndVersion(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconCallerSession) TypeAndVersion() (string, error) { - return _VRFBeacon.Contract.TypeAndVersion(&_VRFBeacon.CallOpts) -} - -func (_VRFBeacon *VRFBeaconTransactor) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _VRFBeacon.contract.Transact(opts, "acceptOwnership") -} - -func (_VRFBeacon *VRFBeaconSession) AcceptOwnership() (*types.Transaction, error) { - return _VRFBeacon.Contract.AcceptOwnership(&_VRFBeacon.TransactOpts) -} - -func (_VRFBeacon *VRFBeaconTransactorSession) AcceptOwnership() (*types.Transaction, error) { - return _VRFBeacon.Contract.AcceptOwnership(&_VRFBeacon.TransactOpts) -} - -func (_VRFBeacon *VRFBeaconTransactor) AcceptPayeeship(opts *bind.TransactOpts, transmitter common.Address) (*types.Transaction, error) { - return _VRFBeacon.contract.Transact(opts, "acceptPayeeship", transmitter) -} - -func (_VRFBeacon *VRFBeaconSession) AcceptPayeeship(transmitter common.Address) (*types.Transaction, error) { - return _VRFBeacon.Contract.AcceptPayeeship(&_VRFBeacon.TransactOpts, transmitter) -} - -func (_VRFBeacon *VRFBeaconTransactorSession) AcceptPayeeship(transmitter common.Address) (*types.Transaction, error) { - return _VRFBeacon.Contract.AcceptPayeeship(&_VRFBeacon.TransactOpts, transmitter) -} - -func (_VRFBeacon *VRFBeaconTransactor) ExposeType(opts *bind.TransactOpts, arg0 VRFBeaconReportReport) (*types.Transaction, error) { - return _VRFBeacon.contract.Transact(opts, "exposeType", arg0) -} - -func (_VRFBeacon *VRFBeaconSession) ExposeType(arg0 VRFBeaconReportReport) (*types.Transaction, error) { - return _VRFBeacon.Contract.ExposeType(&_VRFBeacon.TransactOpts, arg0) -} - -func (_VRFBeacon *VRFBeaconTransactorSession) ExposeType(arg0 VRFBeaconReportReport) (*types.Transaction, error) { - return _VRFBeacon.Contract.ExposeType(&_VRFBeacon.TransactOpts, arg0) -} - -func (_VRFBeacon *VRFBeaconTransactor) KeyGenerated(opts *bind.TransactOpts, kd KeyDataStructKeyData) (*types.Transaction, error) { - return _VRFBeacon.contract.Transact(opts, "keyGenerated", kd) -} - -func (_VRFBeacon *VRFBeaconSession) KeyGenerated(kd KeyDataStructKeyData) (*types.Transaction, error) { - return _VRFBeacon.Contract.KeyGenerated(&_VRFBeacon.TransactOpts, kd) -} - -func (_VRFBeacon *VRFBeaconTransactorSession) KeyGenerated(kd KeyDataStructKeyData) (*types.Transaction, error) { - return _VRFBeacon.Contract.KeyGenerated(&_VRFBeacon.TransactOpts, kd) -} - -func (_VRFBeacon *VRFBeaconTransactor) NewKeyRequested(opts *bind.TransactOpts) (*types.Transaction, error) { - return _VRFBeacon.contract.Transact(opts, "newKeyRequested") -} - -func (_VRFBeacon *VRFBeaconSession) NewKeyRequested() (*types.Transaction, error) { - return _VRFBeacon.Contract.NewKeyRequested(&_VRFBeacon.TransactOpts) -} - -func (_VRFBeacon *VRFBeaconTransactorSession) NewKeyRequested() (*types.Transaction, error) { - return _VRFBeacon.Contract.NewKeyRequested(&_VRFBeacon.TransactOpts) -} - -func (_VRFBeacon *VRFBeaconTransactor) SetBilling(opts *bind.TransactOpts, maximumGasPrice uint64, reasonableGasPrice uint64, observationPayment uint64, transmissionPayment uint64, accountingGas *big.Int) (*types.Transaction, error) { - return _VRFBeacon.contract.Transact(opts, "setBilling", maximumGasPrice, reasonableGasPrice, observationPayment, transmissionPayment, accountingGas) -} - -func (_VRFBeacon *VRFBeaconSession) SetBilling(maximumGasPrice uint64, reasonableGasPrice uint64, observationPayment uint64, transmissionPayment uint64, accountingGas *big.Int) (*types.Transaction, error) { - return _VRFBeacon.Contract.SetBilling(&_VRFBeacon.TransactOpts, maximumGasPrice, reasonableGasPrice, observationPayment, transmissionPayment, accountingGas) -} - -func (_VRFBeacon *VRFBeaconTransactorSession) SetBilling(maximumGasPrice uint64, reasonableGasPrice uint64, observationPayment uint64, transmissionPayment uint64, accountingGas *big.Int) (*types.Transaction, error) { - return _VRFBeacon.Contract.SetBilling(&_VRFBeacon.TransactOpts, maximumGasPrice, reasonableGasPrice, observationPayment, transmissionPayment, accountingGas) -} - -func (_VRFBeacon *VRFBeaconTransactor) SetBillingAccessController(opts *bind.TransactOpts, _billingAccessController common.Address) (*types.Transaction, error) { - return _VRFBeacon.contract.Transact(opts, "setBillingAccessController", _billingAccessController) -} - -func (_VRFBeacon *VRFBeaconSession) SetBillingAccessController(_billingAccessController common.Address) (*types.Transaction, error) { - return _VRFBeacon.Contract.SetBillingAccessController(&_VRFBeacon.TransactOpts, _billingAccessController) -} - -func (_VRFBeacon *VRFBeaconTransactorSession) SetBillingAccessController(_billingAccessController common.Address) (*types.Transaction, error) { - return _VRFBeacon.Contract.SetBillingAccessController(&_VRFBeacon.TransactOpts, _billingAccessController) -} - -func (_VRFBeacon *VRFBeaconTransactor) SetConfig(opts *bind.TransactOpts, signers []common.Address, transmitters []common.Address, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte) (*types.Transaction, error) { - return _VRFBeacon.contract.Transact(opts, "setConfig", signers, transmitters, f, onchainConfig, offchainConfigVersion, offchainConfig) -} - -func (_VRFBeacon *VRFBeaconSession) SetConfig(signers []common.Address, transmitters []common.Address, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte) (*types.Transaction, error) { - return _VRFBeacon.Contract.SetConfig(&_VRFBeacon.TransactOpts, signers, transmitters, f, onchainConfig, offchainConfigVersion, offchainConfig) -} - -func (_VRFBeacon *VRFBeaconTransactorSession) SetConfig(signers []common.Address, transmitters []common.Address, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte) (*types.Transaction, error) { - return _VRFBeacon.Contract.SetConfig(&_VRFBeacon.TransactOpts, signers, transmitters, f, onchainConfig, offchainConfigVersion, offchainConfig) -} - -func (_VRFBeacon *VRFBeaconTransactor) SetPayees(opts *bind.TransactOpts, transmitters []common.Address, payees []common.Address) (*types.Transaction, error) { - return _VRFBeacon.contract.Transact(opts, "setPayees", transmitters, payees) -} - -func (_VRFBeacon *VRFBeaconSession) SetPayees(transmitters []common.Address, payees []common.Address) (*types.Transaction, error) { - return _VRFBeacon.Contract.SetPayees(&_VRFBeacon.TransactOpts, transmitters, payees) -} - -func (_VRFBeacon *VRFBeaconTransactorSession) SetPayees(transmitters []common.Address, payees []common.Address) (*types.Transaction, error) { - return _VRFBeacon.Contract.SetPayees(&_VRFBeacon.TransactOpts, transmitters, payees) -} - -func (_VRFBeacon *VRFBeaconTransactor) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - return _VRFBeacon.contract.Transact(opts, "transferOwnership", to) -} - -func (_VRFBeacon *VRFBeaconSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _VRFBeacon.Contract.TransferOwnership(&_VRFBeacon.TransactOpts, to) -} - -func (_VRFBeacon *VRFBeaconTransactorSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _VRFBeacon.Contract.TransferOwnership(&_VRFBeacon.TransactOpts, to) -} - -func (_VRFBeacon *VRFBeaconTransactor) TransferPayeeship(opts *bind.TransactOpts, transmitter common.Address, proposed common.Address) (*types.Transaction, error) { - return _VRFBeacon.contract.Transact(opts, "transferPayeeship", transmitter, proposed) -} - -func (_VRFBeacon *VRFBeaconSession) TransferPayeeship(transmitter common.Address, proposed common.Address) (*types.Transaction, error) { - return _VRFBeacon.Contract.TransferPayeeship(&_VRFBeacon.TransactOpts, transmitter, proposed) -} - -func (_VRFBeacon *VRFBeaconTransactorSession) TransferPayeeship(transmitter common.Address, proposed common.Address) (*types.Transaction, error) { - return _VRFBeacon.Contract.TransferPayeeship(&_VRFBeacon.TransactOpts, transmitter, proposed) -} - -func (_VRFBeacon *VRFBeaconTransactor) Transmit(opts *bind.TransactOpts, reportContext [3][32]byte, report []byte, rs [][32]byte, ss [][32]byte, rawVs [32]byte) (*types.Transaction, error) { - return _VRFBeacon.contract.Transact(opts, "transmit", reportContext, report, rs, ss, rawVs) -} - -func (_VRFBeacon *VRFBeaconSession) Transmit(reportContext [3][32]byte, report []byte, rs [][32]byte, ss [][32]byte, rawVs [32]byte) (*types.Transaction, error) { - return _VRFBeacon.Contract.Transmit(&_VRFBeacon.TransactOpts, reportContext, report, rs, ss, rawVs) -} - -func (_VRFBeacon *VRFBeaconTransactorSession) Transmit(reportContext [3][32]byte, report []byte, rs [][32]byte, ss [][32]byte, rawVs [32]byte) (*types.Transaction, error) { - return _VRFBeacon.Contract.Transmit(&_VRFBeacon.TransactOpts, reportContext, report, rs, ss, rawVs) -} - -func (_VRFBeacon *VRFBeaconTransactor) WithdrawFunds(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) { - return _VRFBeacon.contract.Transact(opts, "withdrawFunds", recipient, amount) -} - -func (_VRFBeacon *VRFBeaconSession) WithdrawFunds(recipient common.Address, amount *big.Int) (*types.Transaction, error) { - return _VRFBeacon.Contract.WithdrawFunds(&_VRFBeacon.TransactOpts, recipient, amount) -} - -func (_VRFBeacon *VRFBeaconTransactorSession) WithdrawFunds(recipient common.Address, amount *big.Int) (*types.Transaction, error) { - return _VRFBeacon.Contract.WithdrawFunds(&_VRFBeacon.TransactOpts, recipient, amount) -} - -func (_VRFBeacon *VRFBeaconTransactor) WithdrawPayment(opts *bind.TransactOpts, transmitter common.Address) (*types.Transaction, error) { - return _VRFBeacon.contract.Transact(opts, "withdrawPayment", transmitter) -} - -func (_VRFBeacon *VRFBeaconSession) WithdrawPayment(transmitter common.Address) (*types.Transaction, error) { - return _VRFBeacon.Contract.WithdrawPayment(&_VRFBeacon.TransactOpts, transmitter) -} - -func (_VRFBeacon *VRFBeaconTransactorSession) WithdrawPayment(transmitter common.Address) (*types.Transaction, error) { - return _VRFBeacon.Contract.WithdrawPayment(&_VRFBeacon.TransactOpts, transmitter) -} - -type VRFBeaconBillingAccessControllerSetIterator struct { - Event *VRFBeaconBillingAccessControllerSet - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFBeaconBillingAccessControllerSetIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFBeaconBillingAccessControllerSet) - 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(VRFBeaconBillingAccessControllerSet) - 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 *VRFBeaconBillingAccessControllerSetIterator) Error() error { - return it.fail -} - -func (it *VRFBeaconBillingAccessControllerSetIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFBeaconBillingAccessControllerSet struct { - Old common.Address - Current common.Address - Raw types.Log -} - -func (_VRFBeacon *VRFBeaconFilterer) FilterBillingAccessControllerSet(opts *bind.FilterOpts) (*VRFBeaconBillingAccessControllerSetIterator, error) { - - logs, sub, err := _VRFBeacon.contract.FilterLogs(opts, "BillingAccessControllerSet") - if err != nil { - return nil, err - } - return &VRFBeaconBillingAccessControllerSetIterator{contract: _VRFBeacon.contract, event: "BillingAccessControllerSet", logs: logs, sub: sub}, nil -} - -func (_VRFBeacon *VRFBeaconFilterer) WatchBillingAccessControllerSet(opts *bind.WatchOpts, sink chan<- *VRFBeaconBillingAccessControllerSet) (event.Subscription, error) { - - logs, sub, err := _VRFBeacon.contract.WatchLogs(opts, "BillingAccessControllerSet") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFBeaconBillingAccessControllerSet) - if err := _VRFBeacon.contract.UnpackLog(event, "BillingAccessControllerSet", 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 (_VRFBeacon *VRFBeaconFilterer) ParseBillingAccessControllerSet(log types.Log) (*VRFBeaconBillingAccessControllerSet, error) { - event := new(VRFBeaconBillingAccessControllerSet) - if err := _VRFBeacon.contract.UnpackLog(event, "BillingAccessControllerSet", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFBeaconBillingSetIterator struct { - Event *VRFBeaconBillingSet - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFBeaconBillingSetIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFBeaconBillingSet) - 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(VRFBeaconBillingSet) - 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 *VRFBeaconBillingSetIterator) Error() error { - return it.fail -} - -func (it *VRFBeaconBillingSetIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFBeaconBillingSet struct { - MaximumGasPrice uint64 - ReasonableGasPrice uint64 - ObservationPayment uint64 - TransmissionPayment uint64 - AccountingGas *big.Int - Raw types.Log -} - -func (_VRFBeacon *VRFBeaconFilterer) FilterBillingSet(opts *bind.FilterOpts) (*VRFBeaconBillingSetIterator, error) { - - logs, sub, err := _VRFBeacon.contract.FilterLogs(opts, "BillingSet") - if err != nil { - return nil, err - } - return &VRFBeaconBillingSetIterator{contract: _VRFBeacon.contract, event: "BillingSet", logs: logs, sub: sub}, nil -} - -func (_VRFBeacon *VRFBeaconFilterer) WatchBillingSet(opts *bind.WatchOpts, sink chan<- *VRFBeaconBillingSet) (event.Subscription, error) { - - logs, sub, err := _VRFBeacon.contract.WatchLogs(opts, "BillingSet") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFBeaconBillingSet) - if err := _VRFBeacon.contract.UnpackLog(event, "BillingSet", 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 (_VRFBeacon *VRFBeaconFilterer) ParseBillingSet(log types.Log) (*VRFBeaconBillingSet, error) { - event := new(VRFBeaconBillingSet) - if err := _VRFBeacon.contract.UnpackLog(event, "BillingSet", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFBeaconConfigSetIterator struct { - Event *VRFBeaconConfigSet - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFBeaconConfigSetIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFBeaconConfigSet) - 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(VRFBeaconConfigSet) - 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 *VRFBeaconConfigSetIterator) Error() error { - return it.fail -} - -func (it *VRFBeaconConfigSetIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFBeaconConfigSet struct { - PreviousConfigBlockNumber uint32 - ConfigDigest [32]byte - ConfigCount uint64 - Signers []common.Address - Transmitters []common.Address - F uint8 - OnchainConfig []byte - OffchainConfigVersion uint64 - OffchainConfig []byte - Raw types.Log -} - -func (_VRFBeacon *VRFBeaconFilterer) FilterConfigSet(opts *bind.FilterOpts) (*VRFBeaconConfigSetIterator, error) { - - logs, sub, err := _VRFBeacon.contract.FilterLogs(opts, "ConfigSet") - if err != nil { - return nil, err - } - return &VRFBeaconConfigSetIterator{contract: _VRFBeacon.contract, event: "ConfigSet", logs: logs, sub: sub}, nil -} - -func (_VRFBeacon *VRFBeaconFilterer) WatchConfigSet(opts *bind.WatchOpts, sink chan<- *VRFBeaconConfigSet) (event.Subscription, error) { - - logs, sub, err := _VRFBeacon.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(VRFBeaconConfigSet) - if err := _VRFBeacon.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 (_VRFBeacon *VRFBeaconFilterer) ParseConfigSet(log types.Log) (*VRFBeaconConfigSet, error) { - event := new(VRFBeaconConfigSet) - if err := _VRFBeacon.contract.UnpackLog(event, "ConfigSet", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFBeaconNewTransmissionIterator struct { - Event *VRFBeaconNewTransmission - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFBeaconNewTransmissionIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFBeaconNewTransmission) - 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(VRFBeaconNewTransmission) - 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 *VRFBeaconNewTransmissionIterator) Error() error { - return it.fail -} - -func (it *VRFBeaconNewTransmissionIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFBeaconNewTransmission struct { - EpochAndRound *big.Int - Transmitter common.Address - JuelsPerFeeCoin *big.Int - ReasonableGasPrice uint64 - ConfigDigest [32]byte - Raw types.Log -} - -func (_VRFBeacon *VRFBeaconFilterer) FilterNewTransmission(opts *bind.FilterOpts, epochAndRound []*big.Int) (*VRFBeaconNewTransmissionIterator, error) { - - var epochAndRoundRule []interface{} - for _, epochAndRoundItem := range epochAndRound { - epochAndRoundRule = append(epochAndRoundRule, epochAndRoundItem) - } - - logs, sub, err := _VRFBeacon.contract.FilterLogs(opts, "NewTransmission", epochAndRoundRule) - if err != nil { - return nil, err - } - return &VRFBeaconNewTransmissionIterator{contract: _VRFBeacon.contract, event: "NewTransmission", logs: logs, sub: sub}, nil -} - -func (_VRFBeacon *VRFBeaconFilterer) WatchNewTransmission(opts *bind.WatchOpts, sink chan<- *VRFBeaconNewTransmission, epochAndRound []*big.Int) (event.Subscription, error) { - - var epochAndRoundRule []interface{} - for _, epochAndRoundItem := range epochAndRound { - epochAndRoundRule = append(epochAndRoundRule, epochAndRoundItem) - } - - logs, sub, err := _VRFBeacon.contract.WatchLogs(opts, "NewTransmission", epochAndRoundRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFBeaconNewTransmission) - if err := _VRFBeacon.contract.UnpackLog(event, "NewTransmission", 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 (_VRFBeacon *VRFBeaconFilterer) ParseNewTransmission(log types.Log) (*VRFBeaconNewTransmission, error) { - event := new(VRFBeaconNewTransmission) - if err := _VRFBeacon.contract.UnpackLog(event, "NewTransmission", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFBeaconOraclePaidIterator struct { - Event *VRFBeaconOraclePaid - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFBeaconOraclePaidIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFBeaconOraclePaid) - 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(VRFBeaconOraclePaid) - 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 *VRFBeaconOraclePaidIterator) Error() error { - return it.fail -} - -func (it *VRFBeaconOraclePaidIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFBeaconOraclePaid struct { - Transmitter common.Address - Payee common.Address - Amount *big.Int - LinkToken common.Address - Raw types.Log -} - -func (_VRFBeacon *VRFBeaconFilterer) FilterOraclePaid(opts *bind.FilterOpts, transmitter []common.Address, payee []common.Address, linkToken []common.Address) (*VRFBeaconOraclePaidIterator, error) { - - var transmitterRule []interface{} - for _, transmitterItem := range transmitter { - transmitterRule = append(transmitterRule, transmitterItem) - } - var payeeRule []interface{} - for _, payeeItem := range payee { - payeeRule = append(payeeRule, payeeItem) - } - - var linkTokenRule []interface{} - for _, linkTokenItem := range linkToken { - linkTokenRule = append(linkTokenRule, linkTokenItem) - } - - logs, sub, err := _VRFBeacon.contract.FilterLogs(opts, "OraclePaid", transmitterRule, payeeRule, linkTokenRule) - if err != nil { - return nil, err - } - return &VRFBeaconOraclePaidIterator{contract: _VRFBeacon.contract, event: "OraclePaid", logs: logs, sub: sub}, nil -} - -func (_VRFBeacon *VRFBeaconFilterer) WatchOraclePaid(opts *bind.WatchOpts, sink chan<- *VRFBeaconOraclePaid, transmitter []common.Address, payee []common.Address, linkToken []common.Address) (event.Subscription, error) { - - var transmitterRule []interface{} - for _, transmitterItem := range transmitter { - transmitterRule = append(transmitterRule, transmitterItem) - } - var payeeRule []interface{} - for _, payeeItem := range payee { - payeeRule = append(payeeRule, payeeItem) - } - - var linkTokenRule []interface{} - for _, linkTokenItem := range linkToken { - linkTokenRule = append(linkTokenRule, linkTokenItem) - } - - logs, sub, err := _VRFBeacon.contract.WatchLogs(opts, "OraclePaid", transmitterRule, payeeRule, linkTokenRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFBeaconOraclePaid) - if err := _VRFBeacon.contract.UnpackLog(event, "OraclePaid", 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 (_VRFBeacon *VRFBeaconFilterer) ParseOraclePaid(log types.Log) (*VRFBeaconOraclePaid, error) { - event := new(VRFBeaconOraclePaid) - if err := _VRFBeacon.contract.UnpackLog(event, "OraclePaid", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFBeaconOutputsServedIterator struct { - Event *VRFBeaconOutputsServed - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFBeaconOutputsServedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFBeaconOutputsServed) - 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(VRFBeaconOutputsServed) - 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 *VRFBeaconOutputsServedIterator) Error() error { - return it.fail -} - -func (it *VRFBeaconOutputsServedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFBeaconOutputsServed struct { - RecentBlockHeight uint64 - JuelsPerFeeCoin *big.Int - ReasonableGasPrice uint64 - OutputsServed []VRFBeaconTypesOutputServed - Raw types.Log -} - -func (_VRFBeacon *VRFBeaconFilterer) FilterOutputsServed(opts *bind.FilterOpts) (*VRFBeaconOutputsServedIterator, error) { - - logs, sub, err := _VRFBeacon.contract.FilterLogs(opts, "OutputsServed") - if err != nil { - return nil, err - } - return &VRFBeaconOutputsServedIterator{contract: _VRFBeacon.contract, event: "OutputsServed", logs: logs, sub: sub}, nil -} - -func (_VRFBeacon *VRFBeaconFilterer) WatchOutputsServed(opts *bind.WatchOpts, sink chan<- *VRFBeaconOutputsServed) (event.Subscription, error) { - - logs, sub, err := _VRFBeacon.contract.WatchLogs(opts, "OutputsServed") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFBeaconOutputsServed) - if err := _VRFBeacon.contract.UnpackLog(event, "OutputsServed", 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 (_VRFBeacon *VRFBeaconFilterer) ParseOutputsServed(log types.Log) (*VRFBeaconOutputsServed, error) { - event := new(VRFBeaconOutputsServed) - if err := _VRFBeacon.contract.UnpackLog(event, "OutputsServed", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFBeaconOwnershipTransferRequestedIterator struct { - Event *VRFBeaconOwnershipTransferRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFBeaconOwnershipTransferRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFBeaconOwnershipTransferRequested) - 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(VRFBeaconOwnershipTransferRequested) - 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 *VRFBeaconOwnershipTransferRequestedIterator) Error() error { - return it.fail -} - -func (it *VRFBeaconOwnershipTransferRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFBeaconOwnershipTransferRequested struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_VRFBeacon *VRFBeaconFilterer) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*VRFBeaconOwnershipTransferRequestedIterator, 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 := _VRFBeacon.contract.FilterLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return &VRFBeaconOwnershipTransferRequestedIterator{contract: _VRFBeacon.contract, event: "OwnershipTransferRequested", logs: logs, sub: sub}, nil -} - -func (_VRFBeacon *VRFBeaconFilterer) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *VRFBeaconOwnershipTransferRequested, 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 := _VRFBeacon.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(VRFBeaconOwnershipTransferRequested) - if err := _VRFBeacon.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 (_VRFBeacon *VRFBeaconFilterer) ParseOwnershipTransferRequested(log types.Log) (*VRFBeaconOwnershipTransferRequested, error) { - event := new(VRFBeaconOwnershipTransferRequested) - if err := _VRFBeacon.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFBeaconOwnershipTransferredIterator struct { - Event *VRFBeaconOwnershipTransferred - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFBeaconOwnershipTransferredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFBeaconOwnershipTransferred) - 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(VRFBeaconOwnershipTransferred) - 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 *VRFBeaconOwnershipTransferredIterator) Error() error { - return it.fail -} - -func (it *VRFBeaconOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFBeaconOwnershipTransferred struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_VRFBeacon *VRFBeaconFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*VRFBeaconOwnershipTransferredIterator, 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 := _VRFBeacon.contract.FilterLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return &VRFBeaconOwnershipTransferredIterator{contract: _VRFBeacon.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -func (_VRFBeacon *VRFBeaconFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *VRFBeaconOwnershipTransferred, 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 := _VRFBeacon.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(VRFBeaconOwnershipTransferred) - if err := _VRFBeacon.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 (_VRFBeacon *VRFBeaconFilterer) ParseOwnershipTransferred(log types.Log) (*VRFBeaconOwnershipTransferred, error) { - event := new(VRFBeaconOwnershipTransferred) - if err := _VRFBeacon.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFBeaconPayeeshipTransferRequestedIterator struct { - Event *VRFBeaconPayeeshipTransferRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFBeaconPayeeshipTransferRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFBeaconPayeeshipTransferRequested) - 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(VRFBeaconPayeeshipTransferRequested) - 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 *VRFBeaconPayeeshipTransferRequestedIterator) Error() error { - return it.fail -} - -func (it *VRFBeaconPayeeshipTransferRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFBeaconPayeeshipTransferRequested struct { - Transmitter common.Address - Current common.Address - Proposed common.Address - Raw types.Log -} - -func (_VRFBeacon *VRFBeaconFilterer) FilterPayeeshipTransferRequested(opts *bind.FilterOpts, transmitter []common.Address, current []common.Address, proposed []common.Address) (*VRFBeaconPayeeshipTransferRequestedIterator, error) { - - var transmitterRule []interface{} - for _, transmitterItem := range transmitter { - transmitterRule = append(transmitterRule, transmitterItem) - } - var currentRule []interface{} - for _, currentItem := range current { - currentRule = append(currentRule, currentItem) - } - var proposedRule []interface{} - for _, proposedItem := range proposed { - proposedRule = append(proposedRule, proposedItem) - } - - logs, sub, err := _VRFBeacon.contract.FilterLogs(opts, "PayeeshipTransferRequested", transmitterRule, currentRule, proposedRule) - if err != nil { - return nil, err - } - return &VRFBeaconPayeeshipTransferRequestedIterator{contract: _VRFBeacon.contract, event: "PayeeshipTransferRequested", logs: logs, sub: sub}, nil -} - -func (_VRFBeacon *VRFBeaconFilterer) WatchPayeeshipTransferRequested(opts *bind.WatchOpts, sink chan<- *VRFBeaconPayeeshipTransferRequested, transmitter []common.Address, current []common.Address, proposed []common.Address) (event.Subscription, error) { - - var transmitterRule []interface{} - for _, transmitterItem := range transmitter { - transmitterRule = append(transmitterRule, transmitterItem) - } - var currentRule []interface{} - for _, currentItem := range current { - currentRule = append(currentRule, currentItem) - } - var proposedRule []interface{} - for _, proposedItem := range proposed { - proposedRule = append(proposedRule, proposedItem) - } - - logs, sub, err := _VRFBeacon.contract.WatchLogs(opts, "PayeeshipTransferRequested", transmitterRule, currentRule, proposedRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFBeaconPayeeshipTransferRequested) - if err := _VRFBeacon.contract.UnpackLog(event, "PayeeshipTransferRequested", 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 (_VRFBeacon *VRFBeaconFilterer) ParsePayeeshipTransferRequested(log types.Log) (*VRFBeaconPayeeshipTransferRequested, error) { - event := new(VRFBeaconPayeeshipTransferRequested) - if err := _VRFBeacon.contract.UnpackLog(event, "PayeeshipTransferRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFBeaconPayeeshipTransferredIterator struct { - Event *VRFBeaconPayeeshipTransferred - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFBeaconPayeeshipTransferredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFBeaconPayeeshipTransferred) - 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(VRFBeaconPayeeshipTransferred) - 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 *VRFBeaconPayeeshipTransferredIterator) Error() error { - return it.fail -} - -func (it *VRFBeaconPayeeshipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFBeaconPayeeshipTransferred struct { - Transmitter common.Address - Previous common.Address - Current common.Address - Raw types.Log -} - -func (_VRFBeacon *VRFBeaconFilterer) FilterPayeeshipTransferred(opts *bind.FilterOpts, transmitter []common.Address, previous []common.Address, current []common.Address) (*VRFBeaconPayeeshipTransferredIterator, error) { - - var transmitterRule []interface{} - for _, transmitterItem := range transmitter { - transmitterRule = append(transmitterRule, transmitterItem) - } - var previousRule []interface{} - for _, previousItem := range previous { - previousRule = append(previousRule, previousItem) - } - var currentRule []interface{} - for _, currentItem := range current { - currentRule = append(currentRule, currentItem) - } - - logs, sub, err := _VRFBeacon.contract.FilterLogs(opts, "PayeeshipTransferred", transmitterRule, previousRule, currentRule) - if err != nil { - return nil, err - } - return &VRFBeaconPayeeshipTransferredIterator{contract: _VRFBeacon.contract, event: "PayeeshipTransferred", logs: logs, sub: sub}, nil -} - -func (_VRFBeacon *VRFBeaconFilterer) WatchPayeeshipTransferred(opts *bind.WatchOpts, sink chan<- *VRFBeaconPayeeshipTransferred, transmitter []common.Address, previous []common.Address, current []common.Address) (event.Subscription, error) { - - var transmitterRule []interface{} - for _, transmitterItem := range transmitter { - transmitterRule = append(transmitterRule, transmitterItem) - } - var previousRule []interface{} - for _, previousItem := range previous { - previousRule = append(previousRule, previousItem) - } - var currentRule []interface{} - for _, currentItem := range current { - currentRule = append(currentRule, currentItem) - } - - logs, sub, err := _VRFBeacon.contract.WatchLogs(opts, "PayeeshipTransferred", transmitterRule, previousRule, currentRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFBeaconPayeeshipTransferred) - if err := _VRFBeacon.contract.UnpackLog(event, "PayeeshipTransferred", 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 (_VRFBeacon *VRFBeaconFilterer) ParsePayeeshipTransferred(log types.Log) (*VRFBeaconPayeeshipTransferred, error) { - event := new(VRFBeaconPayeeshipTransferred) - if err := _VRFBeacon.contract.UnpackLog(event, "PayeeshipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFBeaconRandomWordsFulfilledIterator struct { - Event *VRFBeaconRandomWordsFulfilled - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFBeaconRandomWordsFulfilledIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFBeaconRandomWordsFulfilled) - 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(VRFBeaconRandomWordsFulfilled) - 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 *VRFBeaconRandomWordsFulfilledIterator) Error() error { - return it.fail -} - -func (it *VRFBeaconRandomWordsFulfilledIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFBeaconRandomWordsFulfilled struct { - RequestIDs []*big.Int - SuccessfulFulfillment []byte - TruncatedErrorData [][]byte - SubBalances []*big.Int - SubIDs []*big.Int - Raw types.Log -} - -func (_VRFBeacon *VRFBeaconFilterer) FilterRandomWordsFulfilled(opts *bind.FilterOpts) (*VRFBeaconRandomWordsFulfilledIterator, error) { - - logs, sub, err := _VRFBeacon.contract.FilterLogs(opts, "RandomWordsFulfilled") - if err != nil { - return nil, err - } - return &VRFBeaconRandomWordsFulfilledIterator{contract: _VRFBeacon.contract, event: "RandomWordsFulfilled", logs: logs, sub: sub}, nil -} - -func (_VRFBeacon *VRFBeaconFilterer) WatchRandomWordsFulfilled(opts *bind.WatchOpts, sink chan<- *VRFBeaconRandomWordsFulfilled) (event.Subscription, error) { - - logs, sub, err := _VRFBeacon.contract.WatchLogs(opts, "RandomWordsFulfilled") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFBeaconRandomWordsFulfilled) - if err := _VRFBeacon.contract.UnpackLog(event, "RandomWordsFulfilled", 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 (_VRFBeacon *VRFBeaconFilterer) ParseRandomWordsFulfilled(log types.Log) (*VRFBeaconRandomWordsFulfilled, error) { - event := new(VRFBeaconRandomWordsFulfilled) - if err := _VRFBeacon.contract.UnpackLog(event, "RandomWordsFulfilled", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFBeaconRandomnessFulfillmentRequestedIterator struct { - Event *VRFBeaconRandomnessFulfillmentRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFBeaconRandomnessFulfillmentRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFBeaconRandomnessFulfillmentRequested) - 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(VRFBeaconRandomnessFulfillmentRequested) - 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 *VRFBeaconRandomnessFulfillmentRequestedIterator) Error() error { - return it.fail -} - -func (it *VRFBeaconRandomnessFulfillmentRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFBeaconRandomnessFulfillmentRequested struct { - RequestID *big.Int - Requester common.Address - NextBeaconOutputHeight uint64 - ConfDelay *big.Int - SubID *big.Int - NumWords uint16 - GasAllowance uint32 - GasPrice *big.Int - WeiPerUnitLink *big.Int - Arguments []byte - CostJuels *big.Int - NewSubBalance *big.Int - Raw types.Log -} - -func (_VRFBeacon *VRFBeaconFilterer) FilterRandomnessFulfillmentRequested(opts *bind.FilterOpts, requestID []*big.Int) (*VRFBeaconRandomnessFulfillmentRequestedIterator, error) { - - var requestIDRule []interface{} - for _, requestIDItem := range requestID { - requestIDRule = append(requestIDRule, requestIDItem) - } - - logs, sub, err := _VRFBeacon.contract.FilterLogs(opts, "RandomnessFulfillmentRequested", requestIDRule) - if err != nil { - return nil, err - } - return &VRFBeaconRandomnessFulfillmentRequestedIterator{contract: _VRFBeacon.contract, event: "RandomnessFulfillmentRequested", logs: logs, sub: sub}, nil -} - -func (_VRFBeacon *VRFBeaconFilterer) WatchRandomnessFulfillmentRequested(opts *bind.WatchOpts, sink chan<- *VRFBeaconRandomnessFulfillmentRequested, requestID []*big.Int) (event.Subscription, error) { - - var requestIDRule []interface{} - for _, requestIDItem := range requestID { - requestIDRule = append(requestIDRule, requestIDItem) - } - - logs, sub, err := _VRFBeacon.contract.WatchLogs(opts, "RandomnessFulfillmentRequested", requestIDRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFBeaconRandomnessFulfillmentRequested) - if err := _VRFBeacon.contract.UnpackLog(event, "RandomnessFulfillmentRequested", 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 (_VRFBeacon *VRFBeaconFilterer) ParseRandomnessFulfillmentRequested(log types.Log) (*VRFBeaconRandomnessFulfillmentRequested, error) { - event := new(VRFBeaconRandomnessFulfillmentRequested) - if err := _VRFBeacon.contract.UnpackLog(event, "RandomnessFulfillmentRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFBeaconRandomnessRedeemedIterator struct { - Event *VRFBeaconRandomnessRedeemed - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFBeaconRandomnessRedeemedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFBeaconRandomnessRedeemed) - 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(VRFBeaconRandomnessRedeemed) - 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 *VRFBeaconRandomnessRedeemedIterator) Error() error { - return it.fail -} - -func (it *VRFBeaconRandomnessRedeemedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFBeaconRandomnessRedeemed struct { - RequestID *big.Int - Requester common.Address - SubID *big.Int - Raw types.Log -} - -func (_VRFBeacon *VRFBeaconFilterer) FilterRandomnessRedeemed(opts *bind.FilterOpts, requestID []*big.Int, requester []common.Address) (*VRFBeaconRandomnessRedeemedIterator, error) { - - var requestIDRule []interface{} - for _, requestIDItem := range requestID { - requestIDRule = append(requestIDRule, requestIDItem) - } - var requesterRule []interface{} - for _, requesterItem := range requester { - requesterRule = append(requesterRule, requesterItem) - } - - logs, sub, err := _VRFBeacon.contract.FilterLogs(opts, "RandomnessRedeemed", requestIDRule, requesterRule) - if err != nil { - return nil, err - } - return &VRFBeaconRandomnessRedeemedIterator{contract: _VRFBeacon.contract, event: "RandomnessRedeemed", logs: logs, sub: sub}, nil -} - -func (_VRFBeacon *VRFBeaconFilterer) WatchRandomnessRedeemed(opts *bind.WatchOpts, sink chan<- *VRFBeaconRandomnessRedeemed, requestID []*big.Int, requester []common.Address) (event.Subscription, error) { - - var requestIDRule []interface{} - for _, requestIDItem := range requestID { - requestIDRule = append(requestIDRule, requestIDItem) - } - var requesterRule []interface{} - for _, requesterItem := range requester { - requesterRule = append(requesterRule, requesterItem) - } - - logs, sub, err := _VRFBeacon.contract.WatchLogs(opts, "RandomnessRedeemed", requestIDRule, requesterRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFBeaconRandomnessRedeemed) - if err := _VRFBeacon.contract.UnpackLog(event, "RandomnessRedeemed", 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 (_VRFBeacon *VRFBeaconFilterer) ParseRandomnessRedeemed(log types.Log) (*VRFBeaconRandomnessRedeemed, error) { - event := new(VRFBeaconRandomnessRedeemed) - if err := _VRFBeacon.contract.UnpackLog(event, "RandomnessRedeemed", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFBeaconRandomnessRequestedIterator struct { - Event *VRFBeaconRandomnessRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFBeaconRandomnessRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFBeaconRandomnessRequested) - 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(VRFBeaconRandomnessRequested) - 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 *VRFBeaconRandomnessRequestedIterator) Error() error { - return it.fail -} - -func (it *VRFBeaconRandomnessRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFBeaconRandomnessRequested struct { - RequestID *big.Int - Requester common.Address - NextBeaconOutputHeight uint64 - ConfDelay *big.Int - SubID *big.Int - NumWords uint16 - CostJuels *big.Int - NewSubBalance *big.Int - Raw types.Log -} - -func (_VRFBeacon *VRFBeaconFilterer) FilterRandomnessRequested(opts *bind.FilterOpts, requestID []*big.Int) (*VRFBeaconRandomnessRequestedIterator, error) { - - var requestIDRule []interface{} - for _, requestIDItem := range requestID { - requestIDRule = append(requestIDRule, requestIDItem) - } - - logs, sub, err := _VRFBeacon.contract.FilterLogs(opts, "RandomnessRequested", requestIDRule) - if err != nil { - return nil, err - } - return &VRFBeaconRandomnessRequestedIterator{contract: _VRFBeacon.contract, event: "RandomnessRequested", logs: logs, sub: sub}, nil -} - -func (_VRFBeacon *VRFBeaconFilterer) WatchRandomnessRequested(opts *bind.WatchOpts, sink chan<- *VRFBeaconRandomnessRequested, requestID []*big.Int) (event.Subscription, error) { - - var requestIDRule []interface{} - for _, requestIDItem := range requestID { - requestIDRule = append(requestIDRule, requestIDItem) - } - - logs, sub, err := _VRFBeacon.contract.WatchLogs(opts, "RandomnessRequested", requestIDRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFBeaconRandomnessRequested) - if err := _VRFBeacon.contract.UnpackLog(event, "RandomnessRequested", 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 (_VRFBeacon *VRFBeaconFilterer) ParseRandomnessRequested(log types.Log) (*VRFBeaconRandomnessRequested, error) { - event := new(VRFBeaconRandomnessRequested) - if err := _VRFBeacon.contract.UnpackLog(event, "RandomnessRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type GetBilling struct { - MaximumGasPrice uint64 - ReasonableGasPrice uint64 - ObservationPayment uint64 - TransmissionPayment uint64 - AccountingGas *big.Int -} -type LatestConfigDetails struct { - ConfigCount uint32 - BlockNumber uint32 - ConfigDigest [32]byte -} -type LatestConfigDigestAndEpoch struct { - ScanLogs bool - ConfigDigest [32]byte - Epoch uint32 -} - -func (_VRFBeacon *VRFBeacon) ParseLog(log types.Log) (generated.AbigenLog, error) { - switch log.Topics[0] { - case _VRFBeacon.abi.Events["BillingAccessControllerSet"].ID: - return _VRFBeacon.ParseBillingAccessControllerSet(log) - case _VRFBeacon.abi.Events["BillingSet"].ID: - return _VRFBeacon.ParseBillingSet(log) - case _VRFBeacon.abi.Events["ConfigSet"].ID: - return _VRFBeacon.ParseConfigSet(log) - case _VRFBeacon.abi.Events["NewTransmission"].ID: - return _VRFBeacon.ParseNewTransmission(log) - case _VRFBeacon.abi.Events["OraclePaid"].ID: - return _VRFBeacon.ParseOraclePaid(log) - case _VRFBeacon.abi.Events["OutputsServed"].ID: - return _VRFBeacon.ParseOutputsServed(log) - case _VRFBeacon.abi.Events["OwnershipTransferRequested"].ID: - return _VRFBeacon.ParseOwnershipTransferRequested(log) - case _VRFBeacon.abi.Events["OwnershipTransferred"].ID: - return _VRFBeacon.ParseOwnershipTransferred(log) - case _VRFBeacon.abi.Events["PayeeshipTransferRequested"].ID: - return _VRFBeacon.ParsePayeeshipTransferRequested(log) - case _VRFBeacon.abi.Events["PayeeshipTransferred"].ID: - return _VRFBeacon.ParsePayeeshipTransferred(log) - case _VRFBeacon.abi.Events["RandomWordsFulfilled"].ID: - return _VRFBeacon.ParseRandomWordsFulfilled(log) - case _VRFBeacon.abi.Events["RandomnessFulfillmentRequested"].ID: - return _VRFBeacon.ParseRandomnessFulfillmentRequested(log) - case _VRFBeacon.abi.Events["RandomnessRedeemed"].ID: - return _VRFBeacon.ParseRandomnessRedeemed(log) - case _VRFBeacon.abi.Events["RandomnessRequested"].ID: - return _VRFBeacon.ParseRandomnessRequested(log) - - default: - return nil, fmt.Errorf("abigen wrapper received unknown log topic: %v", log.Topics[0]) - } -} - -func (VRFBeaconBillingAccessControllerSet) Topic() common.Hash { - return common.HexToHash("0x793cb73064f3c8cde7e187ae515511e6e56d1ee89bf08b82fa60fb70f8d48912") -} - -func (VRFBeaconBillingSet) Topic() common.Hash { - return common.HexToHash("0x49275ddcdfc9c0519b3d094308c8bf675f06070a754ce90c152163cb6e66e8a0") -} - -func (VRFBeaconConfigSet) Topic() common.Hash { - return common.HexToHash("0x1591690b8638f5fb2dbec82ac741805ac5da8b45dc5263f4875b0496fdce4e05") -} - -func (VRFBeaconNewTransmission) Topic() common.Hash { - return common.HexToHash("0xfc3c7a7927e878a0fca37c904953c3c75cee3ca1d1640184a0ab1c65eec62743") -} - -func (VRFBeaconOraclePaid) Topic() common.Hash { - return common.HexToHash("0xd0b1dac935d85bd54cf0a33b0d41d39f8cf53a968465fc7ea2377526b8ac712c") -} - -func (VRFBeaconOutputsServed) Topic() common.Hash { - return common.HexToHash("0xf10ea936d00579b4c52035ee33bf46929646b3aa87554c565d8fb2c7aa549c44") -} - -func (VRFBeaconOwnershipTransferRequested) Topic() common.Hash { - return common.HexToHash("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278") -} - -func (VRFBeaconOwnershipTransferred) Topic() common.Hash { - return common.HexToHash("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0") -} - -func (VRFBeaconPayeeshipTransferRequested) Topic() common.Hash { - return common.HexToHash("0x84f7c7c80bb8ed2279b4aab5f61cd05e6374073d38f46d7f32de8c30e9e38367") -} - -func (VRFBeaconPayeeshipTransferred) Topic() common.Hash { - return common.HexToHash("0x78af32efdcad432315431e9b03d27e6cd98fb79c405fdc5af7c1714d9c0f75b3") -} - -func (VRFBeaconRandomWordsFulfilled) Topic() common.Hash { - return common.HexToHash("0x8f79f730779e875ce76c428039cc2052b5b5918c2a55c598fab251c1198aec54") -} - -func (VRFBeaconRandomnessFulfillmentRequested) Topic() common.Hash { - return common.HexToHash("0x01872fb9c7d6d68af06a17347935e04412da302a377224c205e672c26e18c37f") -} - -func (VRFBeaconRandomnessRedeemed) Topic() common.Hash { - return common.HexToHash("0x16f3f633197fafab10a5df69e6f3f2f7f20092f08d8d47de0a91c0f4b96a1a25") -} - -func (VRFBeaconRandomnessRequested) Topic() common.Hash { - return common.HexToHash("0xb7933fba96b6b452eb44f99fdc08052a45dff82363d59abaff0456931c3d2459") -} - -func (_VRFBeacon *VRFBeacon) Address() common.Address { - return _VRFBeacon.address -} - -type VRFBeaconInterface interface { - NUMCONFDELAYS(opts *bind.CallOpts) (uint8, error) - - GetBilling(opts *bind.CallOpts) (GetBilling, - - error) - - GetBillingAccessController(opts *bind.CallOpts) (common.Address, error) - - ICoordinator(opts *bind.CallOpts) (common.Address, error) - - ILink(opts *bind.CallOpts) (common.Address, error) - - LatestConfigDetails(opts *bind.CallOpts) (LatestConfigDetails, - - error) - - LatestConfigDigestAndEpoch(opts *bind.CallOpts) (LatestConfigDigestAndEpoch, - - error) - - LinkAvailableForPayment(opts *bind.CallOpts) (*big.Int, error) - - OwedPayment(opts *bind.CallOpts, transmitterAddress common.Address) (*big.Int, error) - - Owner(opts *bind.CallOpts) (common.Address, error) - - SKeyID(opts *bind.CallOpts) ([32]byte, error) - - SKeyProvider(opts *bind.CallOpts) (common.Address, error) - - SProvingKeyHash(opts *bind.CallOpts) ([32]byte, error) - - TypeAndVersion(opts *bind.CallOpts) (string, error) - - AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) - - AcceptPayeeship(opts *bind.TransactOpts, transmitter common.Address) (*types.Transaction, error) - - ExposeType(opts *bind.TransactOpts, arg0 VRFBeaconReportReport) (*types.Transaction, error) - - KeyGenerated(opts *bind.TransactOpts, kd KeyDataStructKeyData) (*types.Transaction, error) - - NewKeyRequested(opts *bind.TransactOpts) (*types.Transaction, error) - - SetBilling(opts *bind.TransactOpts, maximumGasPrice uint64, reasonableGasPrice uint64, observationPayment uint64, transmissionPayment uint64, accountingGas *big.Int) (*types.Transaction, error) - - SetBillingAccessController(opts *bind.TransactOpts, _billingAccessController common.Address) (*types.Transaction, error) - - SetConfig(opts *bind.TransactOpts, signers []common.Address, transmitters []common.Address, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte) (*types.Transaction, error) - - SetPayees(opts *bind.TransactOpts, transmitters []common.Address, payees []common.Address) (*types.Transaction, error) - - TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) - - TransferPayeeship(opts *bind.TransactOpts, transmitter common.Address, proposed common.Address) (*types.Transaction, error) - - Transmit(opts *bind.TransactOpts, reportContext [3][32]byte, report []byte, rs [][32]byte, ss [][32]byte, rawVs [32]byte) (*types.Transaction, error) - - WithdrawFunds(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) - - WithdrawPayment(opts *bind.TransactOpts, transmitter common.Address) (*types.Transaction, error) - - FilterBillingAccessControllerSet(opts *bind.FilterOpts) (*VRFBeaconBillingAccessControllerSetIterator, error) - - WatchBillingAccessControllerSet(opts *bind.WatchOpts, sink chan<- *VRFBeaconBillingAccessControllerSet) (event.Subscription, error) - - ParseBillingAccessControllerSet(log types.Log) (*VRFBeaconBillingAccessControllerSet, error) - - FilterBillingSet(opts *bind.FilterOpts) (*VRFBeaconBillingSetIterator, error) - - WatchBillingSet(opts *bind.WatchOpts, sink chan<- *VRFBeaconBillingSet) (event.Subscription, error) - - ParseBillingSet(log types.Log) (*VRFBeaconBillingSet, error) - - FilterConfigSet(opts *bind.FilterOpts) (*VRFBeaconConfigSetIterator, error) - - WatchConfigSet(opts *bind.WatchOpts, sink chan<- *VRFBeaconConfigSet) (event.Subscription, error) - - ParseConfigSet(log types.Log) (*VRFBeaconConfigSet, error) - - FilterNewTransmission(opts *bind.FilterOpts, epochAndRound []*big.Int) (*VRFBeaconNewTransmissionIterator, error) - - WatchNewTransmission(opts *bind.WatchOpts, sink chan<- *VRFBeaconNewTransmission, epochAndRound []*big.Int) (event.Subscription, error) - - ParseNewTransmission(log types.Log) (*VRFBeaconNewTransmission, error) - - FilterOraclePaid(opts *bind.FilterOpts, transmitter []common.Address, payee []common.Address, linkToken []common.Address) (*VRFBeaconOraclePaidIterator, error) - - WatchOraclePaid(opts *bind.WatchOpts, sink chan<- *VRFBeaconOraclePaid, transmitter []common.Address, payee []common.Address, linkToken []common.Address) (event.Subscription, error) - - ParseOraclePaid(log types.Log) (*VRFBeaconOraclePaid, error) - - FilterOutputsServed(opts *bind.FilterOpts) (*VRFBeaconOutputsServedIterator, error) - - WatchOutputsServed(opts *bind.WatchOpts, sink chan<- *VRFBeaconOutputsServed) (event.Subscription, error) - - ParseOutputsServed(log types.Log) (*VRFBeaconOutputsServed, error) - - FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*VRFBeaconOwnershipTransferRequestedIterator, error) - - WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *VRFBeaconOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferRequested(log types.Log) (*VRFBeaconOwnershipTransferRequested, error) - - FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*VRFBeaconOwnershipTransferredIterator, error) - - WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *VRFBeaconOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferred(log types.Log) (*VRFBeaconOwnershipTransferred, error) - - FilterPayeeshipTransferRequested(opts *bind.FilterOpts, transmitter []common.Address, current []common.Address, proposed []common.Address) (*VRFBeaconPayeeshipTransferRequestedIterator, error) - - WatchPayeeshipTransferRequested(opts *bind.WatchOpts, sink chan<- *VRFBeaconPayeeshipTransferRequested, transmitter []common.Address, current []common.Address, proposed []common.Address) (event.Subscription, error) - - ParsePayeeshipTransferRequested(log types.Log) (*VRFBeaconPayeeshipTransferRequested, error) - - FilterPayeeshipTransferred(opts *bind.FilterOpts, transmitter []common.Address, previous []common.Address, current []common.Address) (*VRFBeaconPayeeshipTransferredIterator, error) - - WatchPayeeshipTransferred(opts *bind.WatchOpts, sink chan<- *VRFBeaconPayeeshipTransferred, transmitter []common.Address, previous []common.Address, current []common.Address) (event.Subscription, error) - - ParsePayeeshipTransferred(log types.Log) (*VRFBeaconPayeeshipTransferred, error) - - FilterRandomWordsFulfilled(opts *bind.FilterOpts) (*VRFBeaconRandomWordsFulfilledIterator, error) - - WatchRandomWordsFulfilled(opts *bind.WatchOpts, sink chan<- *VRFBeaconRandomWordsFulfilled) (event.Subscription, error) - - ParseRandomWordsFulfilled(log types.Log) (*VRFBeaconRandomWordsFulfilled, error) - - FilterRandomnessFulfillmentRequested(opts *bind.FilterOpts, requestID []*big.Int) (*VRFBeaconRandomnessFulfillmentRequestedIterator, error) - - WatchRandomnessFulfillmentRequested(opts *bind.WatchOpts, sink chan<- *VRFBeaconRandomnessFulfillmentRequested, requestID []*big.Int) (event.Subscription, error) - - ParseRandomnessFulfillmentRequested(log types.Log) (*VRFBeaconRandomnessFulfillmentRequested, error) - - FilterRandomnessRedeemed(opts *bind.FilterOpts, requestID []*big.Int, requester []common.Address) (*VRFBeaconRandomnessRedeemedIterator, error) - - WatchRandomnessRedeemed(opts *bind.WatchOpts, sink chan<- *VRFBeaconRandomnessRedeemed, requestID []*big.Int, requester []common.Address) (event.Subscription, error) - - ParseRandomnessRedeemed(log types.Log) (*VRFBeaconRandomnessRedeemed, error) - - FilterRandomnessRequested(opts *bind.FilterOpts, requestID []*big.Int) (*VRFBeaconRandomnessRequestedIterator, error) - - WatchRandomnessRequested(opts *bind.WatchOpts, sink chan<- *VRFBeaconRandomnessRequested, requestID []*big.Int) (event.Subscription, error) - - ParseRandomnessRequested(log types.Log) (*VRFBeaconRandomnessRequested, error) - - ParseLog(log types.Log) (generated.AbigenLog, error) - - Address() common.Address -} diff --git a/core/gethwrappers/ocr2vrf/generated/vrf_beacon_consumer/vrf_beacon_consumer.go b/core/gethwrappers/ocr2vrf/generated/vrf_beacon_consumer/vrf_beacon_consumer.go deleted file mode 100644 index edc4ec6556d..00000000000 --- a/core/gethwrappers/ocr2vrf/generated/vrf_beacon_consumer/vrf_beacon_consumer.go +++ /dev/null @@ -1,1034 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package vrf_beacon_consumer - -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 -) - -var BeaconVRFConsumerMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"coordinator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"shouldFail\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"beaconPeriodBlocks\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"MustBeCoordinator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MustBeOwnerOrCoordinator\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"coordinator\",\"type\":\"address\"}],\"name\":\"CoordinatorUpdated\",\"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\":[],\"name\":\"fail\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"i_beaconPeriodBlocks\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"randomWords\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"arguments\",\"type\":\"bytes\"}],\"name\":\"rawFulfillRandomWords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"s_ReceivedRandomnessByRequestID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_arguments\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_gasAvailable\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_mostRecentRequestID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"s_myBeaconRequests\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"slotNumber\",\"type\":\"uint32\"},{\"internalType\":\"uint24\",\"name\":\"confirmationDelay\",\"type\":\"uint24\"},{\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"s_randomWords\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint24\",\"name\":\"\",\"type\":\"uint24\"}],\"name\":\"s_requestsIDs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_subId\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"coordinator\",\"type\":\"address\"}],\"name\":\"setCoordinator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"shouldFail\",\"type\":\"bool\"}],\"name\":\"setFail\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"reqId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"internalType\":\"uint24\",\"name\":\"delay\",\"type\":\"uint24\"},{\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"}],\"name\":\"storeBeaconRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"}],\"name\":\"testRedeemRandomness\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"internalType\":\"uint24\",\"name\":\"confirmationDelayArg\",\"type\":\"uint24\"}],\"name\":\"testRequestRandomness\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"internalType\":\"uint24\",\"name\":\"confDelay\",\"type\":\"uint24\"},{\"internalType\":\"uint32\",\"name\":\"callbackGasLimit\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"arguments\",\"type\":\"bytes\"}],\"name\":\"testRequestRandomnessFulfillment\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60806040523480156200001157600080fd5b50604051620018db380380620018db8339810160408190526200003491620001aa565b8233806000816200008c5760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0384811691909117909155811615620000bf57620000bf81620000ff565b5050600280546001600160a01b0319166001600160a01b03939093169290921790915550600b805460ff191692151592909217909155600c555062000201565b336001600160a01b03821603620001595760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640162000083565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b600080600060608486031215620001c057600080fd5b83516001600160a01b0381168114620001d857600080fd5b60208501519093508015158114620001ef57600080fd5b80925050604084015190509250925092565b6116ca80620002116000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c8063a9cc4718116100cd578063ea7502ab11610081578063f2fde38b11610066578063f2fde38b1461031f578063f6eaffc814610332578063ffe97ca41461034557600080fd5b8063ea7502ab14610303578063f08c5daa1461031657600080fd5b8063cd0593df116100b2578063cd0593df146102d4578063d0705f04146102dd578063d21ea8fd146102f057600080fd5b8063a9cc4718146102a4578063c6d61301146102c157600080fd5b80637716cdaa116101245780638da5cb5b116101095780638da5cb5b1461022a5780638ea98117146102525780639d7694021461026557600080fd5b80637716cdaa1461020d57806379ba50971461022257600080fd5b8063689b77ab11610155578063689b77ab146101c45780636df57cc3146101cd578063706da1ca146101e057600080fd5b8063341867a2146101715780635f15cccc14610186575b600080fd5b61018461017f366004610e87565b6103f8565b005b6101b1610194366004610ec1565b600460209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b6101b160085481565b6101846101db366004610eff565b6104ed565b6009546101f49067ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101bb565b610215610628565b6040516101bb9190610fa9565b6101846106b6565b60005460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101bb565b610184610260366004610fc3565b6107b8565b610184610273366004610ff9565b600b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b600b546102b19060ff1681565b60405190151581526020016101bb565b6101b16102cf36600461101b565b61089e565b6101b1600c5481565b6101b16102eb366004610e87565b6109a8565b6101846102fe366004611187565b6109d9565b6101b1610311366004611250565b610a3a565b6101b1600a5481565b61018461032d366004610fc3565b610b4a565b6101b16103403660046112d4565b610b5e565b6103ae6103533660046112d4565b60056020526000908152604090205463ffffffff811690640100000000810462ffffff1690670100000000000000810461ffff16906901000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1684565b6040805163ffffffff909516855262ffffff909316602085015261ffff9091169183019190915273ffffffffffffffffffffffffffffffffffffffff1660608201526080016101bb565b60025460408051602081018252600080825291517facfc6cdd000000000000000000000000000000000000000000000000000000008152919273ffffffffffffffffffffffffffffffffffffffff169163acfc6cdd9161045e91879187916004016112ed565b6000604051808303816000875af115801561047d573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526104c39190810190611315565b600083815260066020908152604090912082519293506104e7929091840190610e27565b50505050565b600083815260046020908152604080832062ffffff861684529091528120859055600c5461051b9085611404565b6040805160808101825263ffffffff928316815262ffffff958616602080830191825261ffff968716838501908152306060850190815260009b8c526005909252939099209151825491519351995173ffffffffffffffffffffffffffffffffffffffff166901000000000000000000027fffffff0000000000000000000000000000000000000000ffffffffffffffffff9a90971667010000000000000002999099167fffffff00000000000000000000000000000000000000000000ffffffffffffff93909716640100000000027fffffffffffffffffffffffffffffffffffffffffffffffffff000000000000009091169890931697909717919091171692909217179092555050565b6007805461063590611418565b80601f016020809104026020016040519081016040528092919081815260200182805461066190611418565b80156106ae5780601f10610683576101008083540402835291602001916106ae565b820191906000526020600020905b81548152906001019060200180831161069157829003601f168201915b505050505081565b60015473ffffffffffffffffffffffffffffffffffffffff16331461073c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e65720000000000000000000060448201526064015b60405180910390fd5b60008054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217845560018054909116905560405173ffffffffffffffffffffffffffffffffffffffff90921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b60005473ffffffffffffffffffffffffffffffffffffffff1633148015906107f8575060025473ffffffffffffffffffffffffffffffffffffffff163314155b1561082f576040517fd4e06fd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fc258faa9a17ddfdf4130b4acff63a289202e7d5f9e42f366add65368575486bc90600090a250565b600080600c546108ac610b7f565b6108b6919061146b565b9050600081600c546108c6610b7f565b6108d0919061147f565b6108da9190611498565b60025460408051602081018252600080825291517f4ffac83a000000000000000000000000000000000000000000000000000000008152939450909273ffffffffffffffffffffffffffffffffffffffff90921691634ffac83a91610948918a918c918b91906004016114ab565b6020604051808303816000875af1158015610967573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098b91906114e3565b90506109998183878a6104ed565b60088190559695505050505050565b600660205281600052604060002081815481106109c457600080fd5b90600052602060002001600091509150505481565b60025473ffffffffffffffffffffffffffffffffffffffff163314610a2a576040517f66bf9c7200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a35838383610c16565b505050565b600080600c54610a48610b7f565b610a52919061146b565b9050600081600c54610a62610b7f565b610a6c919061147f565b610a769190611498565b60025460408051602081018252600080825291517fdb972c8b000000000000000000000000000000000000000000000000000000008152939450909273ffffffffffffffffffffffffffffffffffffffff9092169163db972c8b91610ae8918d918d918d918d918d91906004016114fc565b6020604051808303816000875af1158015610b07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2b91906114e3565b9050610b398183898b6104ed565b600881905598975050505050505050565b610b52610caf565b610b5b81610d32565b50565b60038181548110610b6e57600080fd5b600091825260209091200154905081565b60004661a4b1811480610b94575062066eed81145b15610c0f57606473ffffffffffffffffffffffffffffffffffffffff1663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610be5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0991906114e3565b91505090565b4391505090565b600b5460ff1615610c83576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f206661696c656420696e2066756c66696c6c52616e646f6d576f7264730000006044820152606401610733565b60008381526006602090815260409091208351610ca292850190610e27565b5060076104e782826115a3565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e6572000000000000000000006044820152606401610733565b565b3373ffffffffffffffffffffffffffffffffffffffff821603610db1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c660000000000000000006044820152606401610733565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b828054828255906000526020600020908101928215610e62579160200282015b82811115610e62578251825591602001919060010190610e47565b50610e6e929150610e72565b5090565b5b80821115610e6e5760008155600101610e73565b60008060408385031215610e9a57600080fd5b50508035926020909101359150565b803562ffffff81168114610ebc57600080fd5b919050565b60008060408385031215610ed457600080fd5b82359150610ee460208401610ea9565b90509250929050565b803561ffff81168114610ebc57600080fd5b60008060008060808587031215610f1557600080fd5b8435935060208501359250610f2c60408601610ea9565b9150610f3a60608601610eed565b905092959194509250565b6000815180845260005b81811015610f6b57602081850181015186830182015201610f4f565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b602081526000610fbc6020830184610f45565b9392505050565b600060208284031215610fd557600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610fbc57600080fd5b60006020828403121561100b57600080fd5b81358015158114610fbc57600080fd5b60008060006060848603121561103057600080fd5b61103984610eed565b92506020840135915061104e60408501610ea9565b90509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156110cd576110cd611057565b604052919050565b600067ffffffffffffffff8211156110ef576110ef611057565b5060051b60200190565b600082601f83011261110a57600080fd5b813567ffffffffffffffff81111561112457611124611057565b61115560207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611086565b81815284602083860101111561116a57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561119c57600080fd5b8335925060208085013567ffffffffffffffff808211156111bc57600080fd5b818701915087601f8301126111d057600080fd5b81356111e36111de826110d5565b611086565b81815260059190911b8301840190848101908a83111561120257600080fd5b938501935b8285101561122057843582529385019390850190611207565b96505050604087013592508083111561123857600080fd5b5050611246868287016110f9565b9150509250925092565b600080600080600060a0868803121561126857600080fd5b8535945061127860208701610eed565b935061128660408701610ea9565b9250606086013563ffffffff8116811461129f57600080fd5b9150608086013567ffffffffffffffff8111156112bb57600080fd5b6112c7888289016110f9565b9150509295509295909350565b6000602082840312156112e657600080fd5b5035919050565b83815282602082015260606040820152600061130c6060830184610f45565b95945050505050565b6000602080838503121561132857600080fd5b825167ffffffffffffffff81111561133f57600080fd5b8301601f8101851361135057600080fd5b805161135e6111de826110d5565b81815260059190911b8201830190838101908783111561137d57600080fd5b928401925b8284101561139b57835182529284019290840190611382565b979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082611413576114136113a6565b500490565b600181811c9082168061142c57607f821691505b602082108103611465577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60008261147a5761147a6113a6565b500690565b80820180821115611492576114926113d5565b92915050565b81810381811115611492576114926113d5565b84815261ffff8416602082015262ffffff831660408201526080606082015260006114d96080830184610f45565b9695505050505050565b6000602082840312156114f557600080fd5b5051919050565b86815261ffff8616602082015262ffffff8516604082015263ffffffff8416606082015260c06080820152600061153660c0830185610f45565b82810360a08401526115488185610f45565b9998505050505050505050565b601f821115610a3557600081815260208120601f850160051c8101602086101561157c5750805b601f850160051c820191505b8181101561159b57828155600101611588565b505050505050565b815167ffffffffffffffff8111156115bd576115bd611057565b6115d1816115cb8454611418565b84611555565b602080601f83116001811461162457600084156115ee5750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b17855561159b565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b8281101561167157888601518255948401946001909101908401611652565b50858210156116ad57878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b0190555056fea164736f6c6343000813000a", -} - -var BeaconVRFConsumerABI = BeaconVRFConsumerMetaData.ABI - -var BeaconVRFConsumerBin = BeaconVRFConsumerMetaData.Bin - -func DeployBeaconVRFConsumer(auth *bind.TransactOpts, backend bind.ContractBackend, coordinator common.Address, shouldFail bool, beaconPeriodBlocks *big.Int) (common.Address, *types.Transaction, *BeaconVRFConsumer, error) { - parsed, err := BeaconVRFConsumerMetaData.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(BeaconVRFConsumerBin), backend, coordinator, shouldFail, beaconPeriodBlocks) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &BeaconVRFConsumer{BeaconVRFConsumerCaller: BeaconVRFConsumerCaller{contract: contract}, BeaconVRFConsumerTransactor: BeaconVRFConsumerTransactor{contract: contract}, BeaconVRFConsumerFilterer: BeaconVRFConsumerFilterer{contract: contract}}, nil -} - -type BeaconVRFConsumer struct { - address common.Address - abi abi.ABI - BeaconVRFConsumerCaller - BeaconVRFConsumerTransactor - BeaconVRFConsumerFilterer -} - -type BeaconVRFConsumerCaller struct { - contract *bind.BoundContract -} - -type BeaconVRFConsumerTransactor struct { - contract *bind.BoundContract -} - -type BeaconVRFConsumerFilterer struct { - contract *bind.BoundContract -} - -type BeaconVRFConsumerSession struct { - Contract *BeaconVRFConsumer - CallOpts bind.CallOpts - TransactOpts bind.TransactOpts -} - -type BeaconVRFConsumerCallerSession struct { - Contract *BeaconVRFConsumerCaller - CallOpts bind.CallOpts -} - -type BeaconVRFConsumerTransactorSession struct { - Contract *BeaconVRFConsumerTransactor - TransactOpts bind.TransactOpts -} - -type BeaconVRFConsumerRaw struct { - Contract *BeaconVRFConsumer -} - -type BeaconVRFConsumerCallerRaw struct { - Contract *BeaconVRFConsumerCaller -} - -type BeaconVRFConsumerTransactorRaw struct { - Contract *BeaconVRFConsumerTransactor -} - -func NewBeaconVRFConsumer(address common.Address, backend bind.ContractBackend) (*BeaconVRFConsumer, error) { - abi, err := abi.JSON(strings.NewReader(BeaconVRFConsumerABI)) - if err != nil { - return nil, err - } - contract, err := bindBeaconVRFConsumer(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &BeaconVRFConsumer{address: address, abi: abi, BeaconVRFConsumerCaller: BeaconVRFConsumerCaller{contract: contract}, BeaconVRFConsumerTransactor: BeaconVRFConsumerTransactor{contract: contract}, BeaconVRFConsumerFilterer: BeaconVRFConsumerFilterer{contract: contract}}, nil -} - -func NewBeaconVRFConsumerCaller(address common.Address, caller bind.ContractCaller) (*BeaconVRFConsumerCaller, error) { - contract, err := bindBeaconVRFConsumer(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &BeaconVRFConsumerCaller{contract: contract}, nil -} - -func NewBeaconVRFConsumerTransactor(address common.Address, transactor bind.ContractTransactor) (*BeaconVRFConsumerTransactor, error) { - contract, err := bindBeaconVRFConsumer(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &BeaconVRFConsumerTransactor{contract: contract}, nil -} - -func NewBeaconVRFConsumerFilterer(address common.Address, filterer bind.ContractFilterer) (*BeaconVRFConsumerFilterer, error) { - contract, err := bindBeaconVRFConsumer(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &BeaconVRFConsumerFilterer{contract: contract}, nil -} - -func bindBeaconVRFConsumer(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := BeaconVRFConsumerMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _BeaconVRFConsumer.Contract.BeaconVRFConsumerCaller.contract.Call(opts, result, method, params...) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.BeaconVRFConsumerTransactor.contract.Transfer(opts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.BeaconVRFConsumerTransactor.contract.Transact(opts, method, params...) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _BeaconVRFConsumer.Contract.contract.Call(opts, result, method, params...) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.contract.Transfer(opts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.contract.Transact(opts, method, params...) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCaller) Fail(opts *bind.CallOpts) (bool, error) { - var out []interface{} - err := _BeaconVRFConsumer.contract.Call(opts, &out, "fail") - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) Fail() (bool, error) { - return _BeaconVRFConsumer.Contract.Fail(&_BeaconVRFConsumer.CallOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCallerSession) Fail() (bool, error) { - return _BeaconVRFConsumer.Contract.Fail(&_BeaconVRFConsumer.CallOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCaller) IBeaconPeriodBlocks(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _BeaconVRFConsumer.contract.Call(opts, &out, "i_beaconPeriodBlocks") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) IBeaconPeriodBlocks() (*big.Int, error) { - return _BeaconVRFConsumer.Contract.IBeaconPeriodBlocks(&_BeaconVRFConsumer.CallOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCallerSession) IBeaconPeriodBlocks() (*big.Int, error) { - return _BeaconVRFConsumer.Contract.IBeaconPeriodBlocks(&_BeaconVRFConsumer.CallOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _BeaconVRFConsumer.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 (_BeaconVRFConsumer *BeaconVRFConsumerSession) Owner() (common.Address, error) { - return _BeaconVRFConsumer.Contract.Owner(&_BeaconVRFConsumer.CallOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCallerSession) Owner() (common.Address, error) { - return _BeaconVRFConsumer.Contract.Owner(&_BeaconVRFConsumer.CallOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCaller) SReceivedRandomnessByRequestID(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - var out []interface{} - err := _BeaconVRFConsumer.contract.Call(opts, &out, "s_ReceivedRandomnessByRequestID", arg0, arg1) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) SReceivedRandomnessByRequestID(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _BeaconVRFConsumer.Contract.SReceivedRandomnessByRequestID(&_BeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCallerSession) SReceivedRandomnessByRequestID(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _BeaconVRFConsumer.Contract.SReceivedRandomnessByRequestID(&_BeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCaller) SArguments(opts *bind.CallOpts) ([]byte, error) { - var out []interface{} - err := _BeaconVRFConsumer.contract.Call(opts, &out, "s_arguments") - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) SArguments() ([]byte, error) { - return _BeaconVRFConsumer.Contract.SArguments(&_BeaconVRFConsumer.CallOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCallerSession) SArguments() ([]byte, error) { - return _BeaconVRFConsumer.Contract.SArguments(&_BeaconVRFConsumer.CallOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCaller) SGasAvailable(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _BeaconVRFConsumer.contract.Call(opts, &out, "s_gasAvailable") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) SGasAvailable() (*big.Int, error) { - return _BeaconVRFConsumer.Contract.SGasAvailable(&_BeaconVRFConsumer.CallOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCallerSession) SGasAvailable() (*big.Int, error) { - return _BeaconVRFConsumer.Contract.SGasAvailable(&_BeaconVRFConsumer.CallOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCaller) SMostRecentRequestID(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _BeaconVRFConsumer.contract.Call(opts, &out, "s_mostRecentRequestID") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) SMostRecentRequestID() (*big.Int, error) { - return _BeaconVRFConsumer.Contract.SMostRecentRequestID(&_BeaconVRFConsumer.CallOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCallerSession) SMostRecentRequestID() (*big.Int, error) { - return _BeaconVRFConsumer.Contract.SMostRecentRequestID(&_BeaconVRFConsumer.CallOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCaller) SMyBeaconRequests(opts *bind.CallOpts, arg0 *big.Int) (SMyBeaconRequests, - - error) { - var out []interface{} - err := _BeaconVRFConsumer.contract.Call(opts, &out, "s_myBeaconRequests", arg0) - - outstruct := new(SMyBeaconRequests) - if err != nil { - return *outstruct, err - } - - outstruct.SlotNumber = *abi.ConvertType(out[0], new(uint32)).(*uint32) - outstruct.ConfirmationDelay = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.NumWords = *abi.ConvertType(out[2], new(uint16)).(*uint16) - outstruct.Requester = *abi.ConvertType(out[3], new(common.Address)).(*common.Address) - - return *outstruct, err - -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) SMyBeaconRequests(arg0 *big.Int) (SMyBeaconRequests, - - error) { - return _BeaconVRFConsumer.Contract.SMyBeaconRequests(&_BeaconVRFConsumer.CallOpts, arg0) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCallerSession) SMyBeaconRequests(arg0 *big.Int) (SMyBeaconRequests, - - error) { - return _BeaconVRFConsumer.Contract.SMyBeaconRequests(&_BeaconVRFConsumer.CallOpts, arg0) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCaller) SRandomWords(opts *bind.CallOpts, arg0 *big.Int) (*big.Int, error) { - var out []interface{} - err := _BeaconVRFConsumer.contract.Call(opts, &out, "s_randomWords", arg0) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) SRandomWords(arg0 *big.Int) (*big.Int, error) { - return _BeaconVRFConsumer.Contract.SRandomWords(&_BeaconVRFConsumer.CallOpts, arg0) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCallerSession) SRandomWords(arg0 *big.Int) (*big.Int, error) { - return _BeaconVRFConsumer.Contract.SRandomWords(&_BeaconVRFConsumer.CallOpts, arg0) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCaller) SRequestsIDs(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - var out []interface{} - err := _BeaconVRFConsumer.contract.Call(opts, &out, "s_requestsIDs", arg0, arg1) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) SRequestsIDs(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _BeaconVRFConsumer.Contract.SRequestsIDs(&_BeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCallerSession) SRequestsIDs(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { - return _BeaconVRFConsumer.Contract.SRequestsIDs(&_BeaconVRFConsumer.CallOpts, arg0, arg1) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCaller) SSubId(opts *bind.CallOpts) (uint64, error) { - var out []interface{} - err := _BeaconVRFConsumer.contract.Call(opts, &out, "s_subId") - - if err != nil { - return *new(uint64), err - } - - out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) - - return out0, err - -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) SSubId() (uint64, error) { - return _BeaconVRFConsumer.Contract.SSubId(&_BeaconVRFConsumer.CallOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerCallerSession) SSubId() (uint64, error) { - return _BeaconVRFConsumer.Contract.SSubId(&_BeaconVRFConsumer.CallOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactor) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _BeaconVRFConsumer.contract.Transact(opts, "acceptOwnership") -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) AcceptOwnership() (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.AcceptOwnership(&_BeaconVRFConsumer.TransactOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactorSession) AcceptOwnership() (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.AcceptOwnership(&_BeaconVRFConsumer.TransactOpts) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactor) RawFulfillRandomWords(opts *bind.TransactOpts, requestID *big.Int, randomWords []*big.Int, arguments []byte) (*types.Transaction, error) { - return _BeaconVRFConsumer.contract.Transact(opts, "rawFulfillRandomWords", requestID, randomWords, arguments) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) RawFulfillRandomWords(requestID *big.Int, randomWords []*big.Int, arguments []byte) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.RawFulfillRandomWords(&_BeaconVRFConsumer.TransactOpts, requestID, randomWords, arguments) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactorSession) RawFulfillRandomWords(requestID *big.Int, randomWords []*big.Int, arguments []byte) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.RawFulfillRandomWords(&_BeaconVRFConsumer.TransactOpts, requestID, randomWords, arguments) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactor) SetCoordinator(opts *bind.TransactOpts, coordinator common.Address) (*types.Transaction, error) { - return _BeaconVRFConsumer.contract.Transact(opts, "setCoordinator", coordinator) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) SetCoordinator(coordinator common.Address) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.SetCoordinator(&_BeaconVRFConsumer.TransactOpts, coordinator) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactorSession) SetCoordinator(coordinator common.Address) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.SetCoordinator(&_BeaconVRFConsumer.TransactOpts, coordinator) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactor) SetFail(opts *bind.TransactOpts, shouldFail bool) (*types.Transaction, error) { - return _BeaconVRFConsumer.contract.Transact(opts, "setFail", shouldFail) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) SetFail(shouldFail bool) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.SetFail(&_BeaconVRFConsumer.TransactOpts, shouldFail) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactorSession) SetFail(shouldFail bool) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.SetFail(&_BeaconVRFConsumer.TransactOpts, shouldFail) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactor) StoreBeaconRequest(opts *bind.TransactOpts, reqId *big.Int, height *big.Int, delay *big.Int, numWords uint16) (*types.Transaction, error) { - return _BeaconVRFConsumer.contract.Transact(opts, "storeBeaconRequest", reqId, height, delay, numWords) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) StoreBeaconRequest(reqId *big.Int, height *big.Int, delay *big.Int, numWords uint16) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.StoreBeaconRequest(&_BeaconVRFConsumer.TransactOpts, reqId, height, delay, numWords) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactorSession) StoreBeaconRequest(reqId *big.Int, height *big.Int, delay *big.Int, numWords uint16) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.StoreBeaconRequest(&_BeaconVRFConsumer.TransactOpts, reqId, height, delay, numWords) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactor) TestRedeemRandomness(opts *bind.TransactOpts, subID *big.Int, requestID *big.Int) (*types.Transaction, error) { - return _BeaconVRFConsumer.contract.Transact(opts, "testRedeemRandomness", subID, requestID) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) TestRedeemRandomness(subID *big.Int, requestID *big.Int) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.TestRedeemRandomness(&_BeaconVRFConsumer.TransactOpts, subID, requestID) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactorSession) TestRedeemRandomness(subID *big.Int, requestID *big.Int) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.TestRedeemRandomness(&_BeaconVRFConsumer.TransactOpts, subID, requestID) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactor) TestRequestRandomness(opts *bind.TransactOpts, numWords uint16, subID *big.Int, confirmationDelayArg *big.Int) (*types.Transaction, error) { - return _BeaconVRFConsumer.contract.Transact(opts, "testRequestRandomness", numWords, subID, confirmationDelayArg) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) TestRequestRandomness(numWords uint16, subID *big.Int, confirmationDelayArg *big.Int) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.TestRequestRandomness(&_BeaconVRFConsumer.TransactOpts, numWords, subID, confirmationDelayArg) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactorSession) TestRequestRandomness(numWords uint16, subID *big.Int, confirmationDelayArg *big.Int) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.TestRequestRandomness(&_BeaconVRFConsumer.TransactOpts, numWords, subID, confirmationDelayArg) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactor) TestRequestRandomnessFulfillment(opts *bind.TransactOpts, subID *big.Int, numWords uint16, confDelay *big.Int, callbackGasLimit uint32, arguments []byte) (*types.Transaction, error) { - return _BeaconVRFConsumer.contract.Transact(opts, "testRequestRandomnessFulfillment", subID, numWords, confDelay, callbackGasLimit, arguments) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) TestRequestRandomnessFulfillment(subID *big.Int, numWords uint16, confDelay *big.Int, callbackGasLimit uint32, arguments []byte) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.TestRequestRandomnessFulfillment(&_BeaconVRFConsumer.TransactOpts, subID, numWords, confDelay, callbackGasLimit, arguments) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactorSession) TestRequestRandomnessFulfillment(subID *big.Int, numWords uint16, confDelay *big.Int, callbackGasLimit uint32, arguments []byte) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.TestRequestRandomnessFulfillment(&_BeaconVRFConsumer.TransactOpts, subID, numWords, confDelay, callbackGasLimit, arguments) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactor) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - return _BeaconVRFConsumer.contract.Transact(opts, "transferOwnership", to) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.TransferOwnership(&_BeaconVRFConsumer.TransactOpts, to) -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerTransactorSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _BeaconVRFConsumer.Contract.TransferOwnership(&_BeaconVRFConsumer.TransactOpts, to) -} - -type BeaconVRFConsumerCoordinatorUpdatedIterator struct { - Event *BeaconVRFConsumerCoordinatorUpdated - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *BeaconVRFConsumerCoordinatorUpdatedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(BeaconVRFConsumerCoordinatorUpdated) - 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(BeaconVRFConsumerCoordinatorUpdated) - 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 *BeaconVRFConsumerCoordinatorUpdatedIterator) Error() error { - return it.fail -} - -func (it *BeaconVRFConsumerCoordinatorUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type BeaconVRFConsumerCoordinatorUpdated struct { - Coordinator common.Address - Raw types.Log -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerFilterer) FilterCoordinatorUpdated(opts *bind.FilterOpts, coordinator []common.Address) (*BeaconVRFConsumerCoordinatorUpdatedIterator, error) { - - var coordinatorRule []interface{} - for _, coordinatorItem := range coordinator { - coordinatorRule = append(coordinatorRule, coordinatorItem) - } - - logs, sub, err := _BeaconVRFConsumer.contract.FilterLogs(opts, "CoordinatorUpdated", coordinatorRule) - if err != nil { - return nil, err - } - return &BeaconVRFConsumerCoordinatorUpdatedIterator{contract: _BeaconVRFConsumer.contract, event: "CoordinatorUpdated", logs: logs, sub: sub}, nil -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerFilterer) WatchCoordinatorUpdated(opts *bind.WatchOpts, sink chan<- *BeaconVRFConsumerCoordinatorUpdated, coordinator []common.Address) (event.Subscription, error) { - - var coordinatorRule []interface{} - for _, coordinatorItem := range coordinator { - coordinatorRule = append(coordinatorRule, coordinatorItem) - } - - logs, sub, err := _BeaconVRFConsumer.contract.WatchLogs(opts, "CoordinatorUpdated", coordinatorRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(BeaconVRFConsumerCoordinatorUpdated) - if err := _BeaconVRFConsumer.contract.UnpackLog(event, "CoordinatorUpdated", 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 (_BeaconVRFConsumer *BeaconVRFConsumerFilterer) ParseCoordinatorUpdated(log types.Log) (*BeaconVRFConsumerCoordinatorUpdated, error) { - event := new(BeaconVRFConsumerCoordinatorUpdated) - if err := _BeaconVRFConsumer.contract.UnpackLog(event, "CoordinatorUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type BeaconVRFConsumerOwnershipTransferRequestedIterator struct { - Event *BeaconVRFConsumerOwnershipTransferRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *BeaconVRFConsumerOwnershipTransferRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(BeaconVRFConsumerOwnershipTransferRequested) - 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(BeaconVRFConsumerOwnershipTransferRequested) - 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 *BeaconVRFConsumerOwnershipTransferRequestedIterator) Error() error { - return it.fail -} - -func (it *BeaconVRFConsumerOwnershipTransferRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type BeaconVRFConsumerOwnershipTransferRequested struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerFilterer) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*BeaconVRFConsumerOwnershipTransferRequestedIterator, 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 := _BeaconVRFConsumer.contract.FilterLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return &BeaconVRFConsumerOwnershipTransferRequestedIterator{contract: _BeaconVRFConsumer.contract, event: "OwnershipTransferRequested", logs: logs, sub: sub}, nil -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerFilterer) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *BeaconVRFConsumerOwnershipTransferRequested, 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 := _BeaconVRFConsumer.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(BeaconVRFConsumerOwnershipTransferRequested) - if err := _BeaconVRFConsumer.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 (_BeaconVRFConsumer *BeaconVRFConsumerFilterer) ParseOwnershipTransferRequested(log types.Log) (*BeaconVRFConsumerOwnershipTransferRequested, error) { - event := new(BeaconVRFConsumerOwnershipTransferRequested) - if err := _BeaconVRFConsumer.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type BeaconVRFConsumerOwnershipTransferredIterator struct { - Event *BeaconVRFConsumerOwnershipTransferred - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *BeaconVRFConsumerOwnershipTransferredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(BeaconVRFConsumerOwnershipTransferred) - 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(BeaconVRFConsumerOwnershipTransferred) - 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 *BeaconVRFConsumerOwnershipTransferredIterator) Error() error { - return it.fail -} - -func (it *BeaconVRFConsumerOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type BeaconVRFConsumerOwnershipTransferred struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*BeaconVRFConsumerOwnershipTransferredIterator, 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 := _BeaconVRFConsumer.contract.FilterLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return &BeaconVRFConsumerOwnershipTransferredIterator{contract: _BeaconVRFConsumer.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -func (_BeaconVRFConsumer *BeaconVRFConsumerFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *BeaconVRFConsumerOwnershipTransferred, 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 := _BeaconVRFConsumer.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(BeaconVRFConsumerOwnershipTransferred) - if err := _BeaconVRFConsumer.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 (_BeaconVRFConsumer *BeaconVRFConsumerFilterer) ParseOwnershipTransferred(log types.Log) (*BeaconVRFConsumerOwnershipTransferred, error) { - event := new(BeaconVRFConsumerOwnershipTransferred) - if err := _BeaconVRFConsumer.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type SMyBeaconRequests struct { - SlotNumber uint32 - ConfirmationDelay *big.Int - NumWords uint16 - Requester common.Address -} - -func (_BeaconVRFConsumer *BeaconVRFConsumer) ParseLog(log types.Log) (generated.AbigenLog, error) { - switch log.Topics[0] { - case _BeaconVRFConsumer.abi.Events["CoordinatorUpdated"].ID: - return _BeaconVRFConsumer.ParseCoordinatorUpdated(log) - case _BeaconVRFConsumer.abi.Events["OwnershipTransferRequested"].ID: - return _BeaconVRFConsumer.ParseOwnershipTransferRequested(log) - case _BeaconVRFConsumer.abi.Events["OwnershipTransferred"].ID: - return _BeaconVRFConsumer.ParseOwnershipTransferred(log) - - default: - return nil, fmt.Errorf("abigen wrapper received unknown log topic: %v", log.Topics[0]) - } -} - -func (BeaconVRFConsumerCoordinatorUpdated) Topic() common.Hash { - return common.HexToHash("0xc258faa9a17ddfdf4130b4acff63a289202e7d5f9e42f366add65368575486bc") -} - -func (BeaconVRFConsumerOwnershipTransferRequested) Topic() common.Hash { - return common.HexToHash("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278") -} - -func (BeaconVRFConsumerOwnershipTransferred) Topic() common.Hash { - return common.HexToHash("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0") -} - -func (_BeaconVRFConsumer *BeaconVRFConsumer) Address() common.Address { - return _BeaconVRFConsumer.address -} - -type BeaconVRFConsumerInterface interface { - Fail(opts *bind.CallOpts) (bool, error) - - IBeaconPeriodBlocks(opts *bind.CallOpts) (*big.Int, error) - - Owner(opts *bind.CallOpts) (common.Address, error) - - SReceivedRandomnessByRequestID(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) - - SArguments(opts *bind.CallOpts) ([]byte, error) - - SGasAvailable(opts *bind.CallOpts) (*big.Int, error) - - SMostRecentRequestID(opts *bind.CallOpts) (*big.Int, error) - - SMyBeaconRequests(opts *bind.CallOpts, arg0 *big.Int) (SMyBeaconRequests, - - error) - - SRandomWords(opts *bind.CallOpts, arg0 *big.Int) (*big.Int, error) - - SRequestsIDs(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) - - SSubId(opts *bind.CallOpts) (uint64, error) - - AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) - - RawFulfillRandomWords(opts *bind.TransactOpts, requestID *big.Int, randomWords []*big.Int, arguments []byte) (*types.Transaction, error) - - SetCoordinator(opts *bind.TransactOpts, coordinator common.Address) (*types.Transaction, error) - - SetFail(opts *bind.TransactOpts, shouldFail bool) (*types.Transaction, error) - - StoreBeaconRequest(opts *bind.TransactOpts, reqId *big.Int, height *big.Int, delay *big.Int, numWords uint16) (*types.Transaction, error) - - TestRedeemRandomness(opts *bind.TransactOpts, subID *big.Int, requestID *big.Int) (*types.Transaction, error) - - TestRequestRandomness(opts *bind.TransactOpts, numWords uint16, subID *big.Int, confirmationDelayArg *big.Int) (*types.Transaction, error) - - TestRequestRandomnessFulfillment(opts *bind.TransactOpts, subID *big.Int, numWords uint16, confDelay *big.Int, callbackGasLimit uint32, arguments []byte) (*types.Transaction, error) - - TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) - - FilterCoordinatorUpdated(opts *bind.FilterOpts, coordinator []common.Address) (*BeaconVRFConsumerCoordinatorUpdatedIterator, error) - - WatchCoordinatorUpdated(opts *bind.WatchOpts, sink chan<- *BeaconVRFConsumerCoordinatorUpdated, coordinator []common.Address) (event.Subscription, error) - - ParseCoordinatorUpdated(log types.Log) (*BeaconVRFConsumerCoordinatorUpdated, error) - - FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*BeaconVRFConsumerOwnershipTransferRequestedIterator, error) - - WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *BeaconVRFConsumerOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferRequested(log types.Log) (*BeaconVRFConsumerOwnershipTransferRequested, error) - - FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*BeaconVRFConsumerOwnershipTransferredIterator, error) - - WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *BeaconVRFConsumerOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferred(log types.Log) (*BeaconVRFConsumerOwnershipTransferred, error) - - ParseLog(log types.Log) (generated.AbigenLog, error) - - Address() common.Address -} diff --git a/core/gethwrappers/ocr2vrf/generated/vrf_coordinator/vrf_coordinator.go b/core/gethwrappers/ocr2vrf/generated/vrf_coordinator/vrf_coordinator.go deleted file mode 100644 index f20d5494452..00000000000 --- a/core/gethwrappers/ocr2vrf/generated/vrf_coordinator/vrf_coordinator.go +++ /dev/null @@ -1,3870 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package vrf_coordinator - -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 ECCArithmeticG1Point struct { - P [2]*big.Int -} - -type VRFBeaconTypesCallback struct { - RequestID *big.Int - NumWords uint16 - Requester common.Address - Arguments []byte - GasAllowance *big.Int - SubID *big.Int - GasPrice *big.Int - WeiPerUnitLink *big.Int -} - -type VRFBeaconTypesCoordinatorConfig struct { - UseReasonableGasPrice bool - ReentrancyLock bool - Paused bool - PremiumPercentage uint8 - UnusedGasPenaltyPercent uint8 - StalenessSeconds uint32 - RedeemableRequestGasOverhead uint32 - CallbackRequestGasOverhead uint32 - ReasonableGasPriceStalenessBlocks uint32 - FallbackWeiPerUnitLink *big.Int -} - -type VRFBeaconTypesCostedCallback struct { - Callback VRFBeaconTypesCallback - Price *big.Int -} - -type VRFBeaconTypesOutputServed struct { - Height uint64 - ConfirmationDelay *big.Int - ProofG1X *big.Int - ProofG1Y *big.Int -} - -type VRFBeaconTypesVRFOutput struct { - BlockHeight uint64 - ConfirmationDelay *big.Int - VrfOutput ECCArithmeticG1Point - Callbacks []VRFBeaconTypesCostedCallback - ShouldStore bool -} - -type VRFCoordinatorCallbackConfig struct { - MaxCallbackGasLimit uint32 - MaxCallbackArgumentsLength uint32 -} - -var VRFCoordinatorMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"beaconPeriodBlocksArg\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BeaconPeriodMustBePositive\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestHeight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"earliestAllowed\",\"type\":\"uint256\"}],\"name\":\"BlockTooRecent\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint16[10]\",\"name\":\"confirmationDelays\",\"type\":\"uint16[10]\"},{\"internalType\":\"uint8\",\"name\":\"violatingIndex\",\"type\":\"uint8\"}],\"name\":\"ConfirmationDelaysNotIncreasing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ContractPaused\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"coordinatorAddress\",\"type\":\"address\"}],\"name\":\"CoordinatorAlreadyRegistered\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"coordinatorAddress\",\"type\":\"address\"}],\"name\":\"CoordinatorNotRegistered\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasAllowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLeft\",\"type\":\"uint256\"}],\"name\":\"GasAllowanceExceedsGasLeft\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"reportHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"separatorHeight\",\"type\":\"uint64\"}],\"name\":\"HistoryDomainSeparatorTooOld\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"actualBalance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requiredBalance\",\"type\":\"uint256\"}],\"name\":\"InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"expectedLength\",\"type\":\"uint16\"},{\"internalType\":\"uint256\",\"name\":\"actualLength\",\"type\":\"uint256\"}],\"name\":\"InvalidCalldata\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"consumer\",\"type\":\"address\"}],\"name\":\"InvalidConsumer\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidCoordinatorConfig\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidJuelsConversion\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numRecipients\",\"type\":\"uint256\"}],\"name\":\"InvalidNumberOfRecipients\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestedSubID\",\"type\":\"uint256\"}],\"name\":\"InvalidSubscription\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"requestedVersion\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"coordinatorVersion\",\"type\":\"uint8\"}],\"name\":\"MigrationVersionMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MustBeProducer\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"proposedOwner\",\"type\":\"address\"}],\"name\":\"MustBeRequestedOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"MustBeSubOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativePaymentGiven\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoWordsRequested\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint16[10]\",\"name\":\"confDelays\",\"type\":\"uint16[10]\"}],\"name\":\"NonZeroDelayAfterZeroDelay\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnMigrationNotSupported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyCallableFromLink\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PendingRequestExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"producer\",\"type\":\"address\"}],\"name\":\"ProducerAlreadyInitialized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestHeight\",\"type\":\"uint256\"}],\"name\":\"RandomnessNotAvailable\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestHeight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"confDelay\",\"type\":\"uint256\"}],\"name\":\"RandomnessSeedNotFoundForCallbacks\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numRecipients\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numPayments\",\"type\":\"uint256\"}],\"name\":\"RecipientsPaymentsMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Reentrant\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"expected\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"actual\",\"type\":\"address\"}],\"name\":\"ResponseMustBeRetrievedByRequester\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyConsumers\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManyRequestsReplaceContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooManySlotsReplaceContract\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requested\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"max\",\"type\":\"uint256\"}],\"name\":\"TooManyWords\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockHeight\",\"type\":\"uint256\"}],\"name\":\"UniverseHasEndedBangBangBang\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"maxCallbackGasLimit\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"maxCallbackArgumentsLength\",\"type\":\"uint32\"}],\"indexed\":false,\"internalType\":\"structVRFCoordinator.CallbackConfig\",\"name\":\"newConfig\",\"type\":\"tuple\"}],\"name\":\"CallbackConfigSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"useReasonableGasPrice\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"reentrancyLock\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"paused\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"premiumPercentage\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"unusedGasPenaltyPercent\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"stalenessSeconds\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"redeemableRequestGasOverhead\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"callbackRequestGasOverhead\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceStalenessBlocks\",\"type\":\"uint32\"},{\"internalType\":\"uint96\",\"name\":\"fallbackWeiPerUnitLink\",\"type\":\"uint96\"}],\"indexed\":false,\"internalType\":\"structVRFBeaconTypes.CoordinatorConfig\",\"name\":\"coordinatorConfig\",\"type\":\"tuple\"}],\"name\":\"CoordinatorConfigSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"coordinatorAddress\",\"type\":\"address\"}],\"name\":\"CoordinatorDeregistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"coordinatorAddress\",\"type\":\"address\"}],\"name\":\"CoordinatorRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint8\",\"name\":\"newVersion\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newCoordinator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"}],\"name\":\"MigrationCompleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"recentBlockHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"uint192\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"reasonableGasPrice\",\"type\":\"uint64\"},{\"components\":[{\"internalType\":\"uint64\",\"name\":\"height\",\"type\":\"uint64\"},{\"internalType\":\"uint24\",\"name\":\"confirmationDelay\",\"type\":\"uint24\"},{\"internalType\":\"uint256\",\"name\":\"proofG1X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"proofG1Y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structVRFBeaconTypes.OutputServed[]\",\"name\":\"outputsServed\",\"type\":\"tuple[]\"}],\"name\":\"OutputsServed\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"paused\",\"type\":\"bool\"}],\"name\":\"PauseFlagChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"requestIDs\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"successfulFulfillment\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes[]\",\"name\":\"truncatedErrorData\",\"type\":\"bytes[]\"},{\"indexed\":false,\"internalType\":\"uint96[]\",\"name\":\"subBalances\",\"type\":\"uint96[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"subIDs\",\"type\":\"uint256[]\"}],\"name\":\"RandomWordsFulfilled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"nextBeaconOutputHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint24\",\"name\":\"confDelay\",\"type\":\"uint24\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"gasAllowance\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gasPrice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weiPerUnitLink\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"arguments\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"costJuels\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newSubBalance\",\"type\":\"uint256\"}],\"name\":\"RandomnessFulfillmentRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"}],\"name\":\"RandomnessRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"nextBeaconOutputHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint24\",\"name\":\"confDelay\",\"type\":\"uint24\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"costJuels\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newSubBalance\",\"type\":\"uint256\"}],\"name\":\"RandomnessRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"subId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"SubscriptionCanceled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"subId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"consumer\",\"type\":\"address\"}],\"name\":\"SubscriptionConsumerAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"subId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"consumer\",\"type\":\"address\"}],\"name\":\"SubscriptionConsumerRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"subId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"SubscriptionCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"subId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldBalance\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newBalance\",\"type\":\"uint256\"}],\"name\":\"SubscriptionFunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"subId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"SubscriptionOwnerTransferRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"subId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"SubscriptionOwnerTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MAX_CONSUMERS\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_NUM_WORDS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NUM_CONF_DELAYS\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subId\",\"type\":\"uint256\"}],\"name\":\"acceptSubscriptionOwnerTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"consumer\",\"type\":\"address\"}],\"name\":\"addConsumer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"recipients\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"paymentsInJuels\",\"type\":\"uint256[]\"}],\"name\":\"batchTransferLink\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"cancelSubscription\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"createSubscription\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"deregisterMigratableCoordinator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"name\":\"getCallbackMemo\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getConfirmationDelays\",\"outputs\":[{\"internalType\":\"uint24[8]\",\"name\":\"\",\"type\":\"uint24[8]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"getFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"callbackGasLimit\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"arguments\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"getFulfillmentFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subId\",\"type\":\"uint256\"}],\"name\":\"getSubscription\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"balance\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"pendingFulfillments\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"consumers\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSubscriptionLinkBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"i_beaconPeriodBlocks\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"i_link\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractIVRFMigration\",\"name\":\"newCoordinator\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"encodedRequest\",\"type\":\"bytes\"}],\"name\":\"migrate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"migrationVersion\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onMigration\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onTokenTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint64\",\"name\":\"blockHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint24\",\"name\":\"confirmationDelay\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"p\",\"type\":\"uint256[2]\"}],\"internalType\":\"structECCArithmetic.G1Point\",\"name\":\"vrfOutput\",\"type\":\"tuple\"},{\"components\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"},{\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"arguments\",\"type\":\"bytes\"},{\"internalType\":\"uint96\",\"name\":\"gasAllowance\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasPrice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"weiPerUnitLink\",\"type\":\"uint256\"}],\"internalType\":\"structVRFBeaconTypes.Callback\",\"name\":\"callback\",\"type\":\"tuple\"},{\"internalType\":\"uint96\",\"name\":\"price\",\"type\":\"uint96\"}],\"internalType\":\"structVRFBeaconTypes.CostedCallback[]\",\"name\":\"callbacks\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"shouldStore\",\"type\":\"bool\"}],\"internalType\":\"structVRFBeaconTypes.VRFOutput[]\",\"name\":\"vrfOutputs\",\"type\":\"tuple[]\"},{\"internalType\":\"uint192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"uint192\"},{\"internalType\":\"uint64\",\"name\":\"reasonableGasPrice\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"blockHeight\",\"type\":\"uint64\"}],\"name\":\"processVRFOutputs\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"containsNewOutputs\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestID\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"redeemRandomness\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"randomness\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"registerMigratableCoordinator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"consumer\",\"type\":\"address\"}],\"name\":\"removeConsumer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"internalType\":\"uint24\",\"name\":\"confDelay\",\"type\":\"uint24\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"requestRandomness\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subID\",\"type\":\"uint256\"},{\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"internalType\":\"uint24\",\"name\":\"confDelay\",\"type\":\"uint24\"},{\"internalType\":\"uint32\",\"name\":\"callbackGasLimit\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"arguments\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"requestRandomnessFulfillment\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"subId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"requestSubscriptionOwnerTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_callbackConfig\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maxCallbackGasLimit\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"maxCallbackArgumentsLength\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_coordinatorConfig\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"useReasonableGasPrice\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"reentrancyLock\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"paused\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"premiumPercentage\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"unusedGasPenaltyPercent\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"stalenessSeconds\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"redeemableRequestGasOverhead\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"callbackRequestGasOverhead\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceStalenessBlocks\",\"type\":\"uint32\"},{\"internalType\":\"uint96\",\"name\":\"fallbackWeiPerUnitLink\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"s_pendingRequests\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"slotNumber\",\"type\":\"uint32\"},{\"internalType\":\"uint24\",\"name\":\"confirmationDelay\",\"type\":\"uint24\"},{\"internalType\":\"uint16\",\"name\":\"numWords\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_producer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"maxCallbackGasLimit\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"maxCallbackArgumentsLength\",\"type\":\"uint32\"}],\"internalType\":\"structVRFCoordinator.CallbackConfig\",\"name\":\"config\",\"type\":\"tuple\"}],\"name\":\"setCallbackConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint24[8]\",\"name\":\"confDelays\",\"type\":\"uint24[8]\"}],\"name\":\"setConfirmationDelays\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"useReasonableGasPrice\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"reentrancyLock\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"paused\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"premiumPercentage\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"unusedGasPenaltyPercent\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"stalenessSeconds\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"redeemableRequestGasOverhead\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"callbackRequestGasOverhead\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceStalenessBlocks\",\"type\":\"uint32\"},{\"internalType\":\"uint96\",\"name\":\"fallbackWeiPerUnitLink\",\"type\":\"uint96\"}],\"internalType\":\"structVRFBeaconTypes.CoordinatorConfig\",\"name\":\"coordinatorConfig\",\"type\":\"tuple\"}],\"name\":\"setCoordinatorConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"pause\",\"type\":\"bool\"}],\"name\":\"setPauseFlag\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"producer\",\"type\":\"address\"}],\"name\":\"setProducer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"juelsAmount\",\"type\":\"uint256\"}],\"name\":\"transferLink\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60c06040523480156200001157600080fd5b50604051620062f5380380620062f5833981016040819052620000349162000239565b8033806000816200008c5760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0384811691909117909155811615620000bf57620000bf816200018e565b5050506001600160a01b03166080908152604080519182018152600080835260208301819052908201819052662386f26fc10000606090920191909152642386f26fc160b01b6006556004805463ffffffff60281b191668ffffffff00000000001790558290036200014457604051632abc297960e01b815260040160405180910390fd5b60a0829052600e805465ffffffffffff16906000620001638362000278565b91906101000a81548165ffffffffffff021916908365ffffffffffff160217905550505050620002ac565b336001600160a01b03821603620001e85760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640162000083565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b600080604083850312156200024d57600080fd5b825160208401519092506001600160a01b03811681146200026d57600080fd5b809150509250929050565b600065ffffffffffff808316818103620002a257634e487b7160e01b600052601160045260246000fd5b6001019392505050565b60805160a051615fdd620003186000396000818161075f01528181611ca301528181613cb301528181613ce201528181613d1a015261430e01526000818161047501528181610bb501528181611a410152818161237b01528181612d610152612df60152615fdd6000f3fe6080604052600436106101d65760003560e01c806304104edb146101db5780630ae09540146101fd57806316f6ee9a1461021d578063294daa491461025d5780632b38bafc1461027f5780632f7527cc1461029f5780633e79167f146102b457806340d6bb82146102d457806347c3e2cb146102ea5780634ffac83a14610385578063597d2f3c146103985780635d06b4ab146103b657806364d51a2a146103d657806373433a2f146103fe57806376f2e3f41461041e57806379ba50971461044e5780637d253aff1461046357806385c64e11146104a45780638c7cba66146104c65780638da5cb5b146104e65780638da92e71146105045780638eef585f146105245780639e20103614610544578063a21a23e414610564578063a4c0ed3614610579578063acfc6cdd14610599578063b2a7cac5146105c6578063b79fa6f7146105e6578063bd58017f146106cd578063bec4c08c146106ed578063c3fbb6fd1461070d578063cb6317971461072d578063cd0593df1461074d578063ce3f471914610781578063dac83d29146107a1578063db972c8b146107c1578063dc311dd3146107d4578063e30afa4a14610804578063f2fde38b14610849578063f99b1d6814610869578063f9c45ced14610889575b600080fd5b3480156101e757600080fd5b506101fb6101f6366004614abd565b6108a9565b005b34801561020957600080fd5b506101fb610218366004614ae1565b610a5e565b34801561022957600080fd5b5061024a610238366004614b11565b6000908152600c602052604090205490565b6040519081526020015b60405180910390f35b34801561026957600080fd5b5060015b60405160ff9091168152602001610254565b34801561028b57600080fd5b506101fb61029a366004614abd565b610cc0565b3480156102ab57600080fd5b5061026d600881565b3480156102c057600080fd5b506101fb6102cf366004614b2a565b610d21565b3480156102e057600080fd5b5061024a6103e881565b3480156102f657600080fd5b50610348610305366004614b11565b60106020526000908152604090205463ffffffff811690600160201b810462ffffff1690600160381b810461ffff1690600160481b90046001600160a01b031684565b6040805163ffffffff909516855262ffffff909316602085015261ffff909116918301919091526001600160a01b03166060820152608001610254565b61024a610393366004614cac565b610dd2565b3480156103a457600080fd5b506002546001600160601b031661024a565b3480156103c257600080fd5b506101fb6103d1366004614abd565b610f7e565b3480156103e257600080fd5b506103eb606481565b60405161ffff9091168152602001610254565b34801561040a57600080fd5b506101fb610419366004614d57565b61102a565b34801561042a57600080fd5b5061043e610439366004614dd9565b611115565b6040519015158152602001610254565b34801561045a57600080fd5b506101fb611453565b34801561046f57600080fd5b506104977f000000000000000000000000000000000000000000000000000000000000000081565b6040516102549190614e5b565b3480156104b057600080fd5b506104b96114fd565b6040516102549190614e6f565b3480156104d257600080fd5b506101fb6104e1366004614ec3565b611562565b3480156104f257600080fd5b506000546001600160a01b0316610497565b34801561051057600080fd5b506101fb61051f366004614f1d565b6115d6565b34801561053057600080fd5b506101fb61053f366004614f3a565b611640565b34801561055057600080fd5b5061024a61055f366004614f65565b61167c565b34801561057057600080fd5b5061024a61179d565b34801561058557600080fd5b506101fb610594366004615019565b6119e3565b3480156105a557600080fd5b506105b96105b4366004615068565b611bce565b60405161025491906150f2565b3480156105d257600080fd5b506101fb6105e1366004614b11565b611dd2565b3480156105f257600080fd5b506004546005546106629160ff80821692610100830482169262010000810483169263010000008204811692600160201b83049091169163ffffffff600160281b8204811692600160481b8304821692600160681b8104831692600160881b90910416906001600160601b03168a565b604080519a15158b5298151560208b01529615159789019790975260ff948516606089015292909316608087015263ffffffff90811660a087015291821660c0860152811660e08501529091166101008301526001600160601b031661012082015261014001610254565b3480156106d957600080fd5b50600a54610497906001600160a01b031681565b3480156106f957600080fd5b506101fb610708366004614ae1565b611f03565b34801561071957600080fd5b506101fb610728366004615105565b6120bf565b34801561073957600080fd5b506101fb610748366004614ae1565b6125ac565b34801561075957600080fd5b5061024a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561078d57600080fd5b506101fb61079c366004615159565b612899565b3480156107ad57600080fd5b506101fb6107bc366004614ae1565b6128b2565b61024a6107cf36600461519a565b6129c3565b3480156107e057600080fd5b506107f46107ef366004614b11565b612c21565b6040516102549493929190615272565b34801561081057600080fd5b50600b5461082c9063ffffffff80821691600160201b90041682565b6040805163ffffffff938416815292909116602083015201610254565b34801561085557600080fd5b506101fb610864366004614abd565b612d0e565b34801561087557600080fd5b506101fb6108843660046152be565b612d1f565b34801561089557600080fd5b5061024a6108a43660046152ea565b612e88565b6108b1612f9f565b60095460005b81811015610a3657826001600160a01b0316600982815481106108dc576108dc615330565b6000918252602090912001546001600160a01b031603610a2457600961090360018461535c565b8154811061091357610913615330565b600091825260209091200154600980546001600160a01b03909216918390811061093f5761093f615330565b600091825260209091200180546001600160a01b0319166001600160a01b039290921691909117905582600961097660018561535c565b8154811061098657610986615330565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060098054806109c5576109c561536f565b600082815260209020810160001990810180546001600160a01b03191690550190556040517ff80a1a97fd42251f3c33cda98635e7399253033a6774fe37cd3f650b5282af3790610a17908590614e5b565b60405180910390a1505050565b80610a2e81615385565b9150506108b7565b5081604051635428d44960e01b8152600401610a529190614e5b565b60405180910390fd5b50565b60008281526007602052604090205482906001600160a01b031680610a995760405163c5171ee960e01b815260048101839052602401610a52565b336001600160a01b03821614610ac45780604051636c51fda960e11b8152600401610a529190614e5b565b600454610100900460ff1615610aed5760405163769dd35360e11b815260040160405180910390fd5b600084815260086020526040902054600160601b90046001600160401b031615610b2a57604051631685ecdd60e31b815260040160405180910390fd5b6000848152600860209081526040918290208251808401909352546001600160601b038116808452600160601b9091046001600160401b031691830191909152610b7386612ff4565b600280546001600160601b03169082906000610b8f838561539e565b92506101000a8154816001600160601b0302191690836001600160601b031602179055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb87846001600160601b03166040518363ffffffff1660e01b8152600401610c0a9291906153c5565b6020604051808303816000875af1158015610c29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4d91906153de565b610c7d5760405163cf47918160e01b81526001600160601b03808316600483015283166024820152604401610a52565b867f3784f77e8e883de95b5d47cd713ced01229fa74d118c0a462224bcb0516d43f18784604051610caf9291906153fb565b60405180910390a250505050505050565b610cc8612f9f565b600a546001600160a01b031615610cff57600a5460405163ea6d390560e01b8152610a52916001600160a01b031690600401614e5b565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b610d29612f9f565b6064610d3b60a0830160808401615437565b60ff161180610d555750610d556040820160208301614f1d565b80610d6b5750610d6b6060820160408301614f1d565b15610d895760405163b0e7bd8360e01b815260040160405180910390fd5b806004610d96828261549d565b9050507e28d3a46e95e67def989d41c66eb331add9809460b95b5fb4eb006157728fc581604051610dc79190615670565b60405180910390a150565b60045460009062010000900460ff1615610dff5760405163ab35696f60e01b815260040160405180910390fd5b600454610100900460ff1615610e285760405163769dd35360e11b815260040160405180910390fd5b3415610e4957604051630b829bad60e21b8152346004820152602401610a52565b6000806000610e5a88338989613143565b925092509250600080610e6d338b61328e565b600087815260106020908152604091829020885181548a8401518b8601516060808e015163ffffffff90951666ffffffffffffff1990941693909317600160201b62ffffff9384160217600160381b600160e81b031916600160381b61ffff92831602600160481b600160e81b03191617600160481b6001600160a01b03909516949094029390931790935584513381526001600160401b038b1694810194909452918e169383019390935281018e9052908c16608082015260a081018390526001600160601b03821660c0820152919350915085907fb7933fba96b6b452eb44f99fdc08052a45dff82363d59abaff0456931c3d24599060e00160405180910390a2509298975050505050505050565b610f86612f9f565b610f8f8161346a565b15610faf578060405163ac8a27ef60e01b8152600401610a529190614e5b565b600980546001810182556000919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b0319166001600160a01b0383161790556040517fb7cabbfc11e66731fc77de0444614282023bcbd41d16781c753a431d0af0162590610dc7908390614e5b565b600a546001600160a01b0316331461105557604051634bea32db60e11b815260040160405180910390fd5b828015806110635750601f81115b1561108457604051634ecc4fef60e01b815260048101829052602401610a52565b8082146110a85760405163339f8a9d60e01b8152610a529082908490600401615758565b60005b8181101561110d576110fb8686838181106110c8576110c8615330565b90506020020160208101906110dd9190614abd565b8585848181106110ef576110ef615330565b90506020020135612d1f565b8061110581615385565b9150506110ab565b505050505050565b600a546000906001600160a01b0316331461114357604051634bea32db60e11b815260040160405180910390fd5b60045462010000900460ff161561116d5760405163ab35696f60e01b815260040160405180910390fd5b6001600160c01b038416156111aa57600680546001600160601b038616600160a01b02600160201b600160a01b0390911663ffffffff4216171790555b6001600160401b038316156111ff5760068054436001600160401b03908116600160201b02600160201b600160601b0319918716600160601b0291909116600160201b600160a01b0319909216919091171790555b600080866001600160401b0381111561121a5761121a614b68565b60405190808252806020026020018201604052801561125357816020015b6112406148f6565b8152602001906001900390816112385790505b50905060005b8781101561135557600089898381811061127557611275615330565b90506020028101906112879190615766565b611290906158ea565b9050600061129f82888b6134d3565b905085806112aa5750805b604083015151519096501515806112c957506040820151516020015115155b15611340576040805160808101825283516001600160401b0316815260208085015162ffffff168183015284830180515151938301939093529151519091015160608201528451859061ffff881690811061132657611326615330565b6020026020010181905250848061133c906159d0565b9550505b5050808061134d90615385565b915050611259565b5060008261ffff166001600160401b0381111561137457611374614b68565b6040519080825280602002602001820160405280156113ad57816020015b61139a6148f6565b8152602001906001900390816113925790505b50905060005b8361ffff16811015611409578281815181106113d1576113d1615330565b60200260200101518282815181106113eb576113eb615330565b6020026020010181905250808061140190615385565b9150506113b3565b507ff10ea936d00579b4c52035ee33bf46929646b3aa87554c565d8fb2c7aa549c448588888460405161143f94939291906159f1565b60405180910390a150505095945050505050565b6001546001600160a01b031633146114a65760405162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b6044820152606401610a52565b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b61150561492c565b6040805161010081019182905290600f90600890826000855b82829054906101000a900462ffffff1662ffffff168152602001906003019060208260020104928301926001038202915080841161151e5790505050505050905090565b61156a612f9f565b8051600b80546020808501805163ffffffff908116600160201b026001600160401b031990941695811695861793909317909355604080519485529251909116908301527f0cc54509a45ab33cd67614d4a2892c083ecf8fb43b9d29f6ea8130b9023e51df9101610dc7565b6115de612f9f565b60045460ff6201000090910416151581151514610a5b5760048054821515620100000262ff0000199091161790556040517f49ba7c1de2d8853088b6270e43df2118516b217f38b917dd2b80dea360860fbe90610dc790831515815260200190565b600a546001600160a01b0316331461166b57604051634bea32db60e11b815260040160405180910390fd5b611678600f82600861494b565b5050565b604080516101408101825260045460ff80821615158352610100808304821615156020808601919091526201000084048316151585870152630100000084048316606080870191909152600160201b808604909416608080880191909152600160281b860463ffffffff90811660a0890152600160481b8704811660c0890152600160681b8704811660e0890152600160881b9096048616938701939093526005546001600160601b039081166101208801528751938401885260065480871685526001600160401b03958104861693850193909352600160601b830490941696830196909652600160a01b90049091169381019390935260009283926117889288169187919061366b565b50506001600160601b03169695505050505050565b600454600090610100900460ff16156117c95760405163769dd35360e11b815260040160405180910390fd5b60045462010000900460ff16156117f35760405163ab35696f60e01b815260040160405180910390fd5b60003361180160014361535c565b6001546040516001600160601b0319606094851b81166020830152924060348201523090931b90911660548301526001600160c01b0319600160a01b90910460c01b16606882015260700160408051808303601f19018152919052805160209091012060018054919250600160a01b9091046001600160401b031690601461188883615a86565b91906101000a8154816001600160401b0302191690836001600160401b03160217905550506000806001600160401b038111156118c7576118c7614b68565b6040519080825280602002602001820160405280156118f0578160200160208202803683370190505b5060408051808201825260008082526020808301828152878352600882528483209351845491516001600160601b039091166001600160a01b031992831617600160601b6001600160401b039092169190910217909355835160608101855233815280820183815281860187815289855260078452959093208151815486166001600160a01b03918216178255935160018201805490961694169390931790935592518051949550919390926119ad9260028501929101906149e9565b505060405133915083907f1d3015d7ba850fa198dc7b1a3f5d42779313a681035f77c8c03764c61005518d90600090a350905090565b600454610100900460ff1615611a0c5760405163769dd35360e11b815260040160405180910390fd5b60045462010000900460ff1615611a365760405163ab35696f60e01b815260040160405180910390fd5b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611a7f576040516344b0e3c360e01b815260040160405180910390fd5b60208114611aa557604051636865567560e01b8152610a52906020908390600401615aaa565b6000611ab382840184614b11565b6000818152600760205260409020549091506001600160a01b0316611aee5760405163c5171ee960e01b815260048101829052602401610a52565b600081815260086020526040812080546001600160601b031691869190611b158385615abe565b92506101000a8154816001600160601b0302191690836001600160601b0316021790555084600260008282829054906101000a90046001600160601b0316611b5d9190615abe565b92506101000a8154816001600160601b0302191690836001600160601b03160217905550817f1ced9348ff549fceab2ac57cd3a9de38edaaab274b725ee82c23e8fc8c4eec7a828784611bb09190615ade565b604051611bbe929190615758565b60405180910390a2505050505050565b600454606090610100900460ff1615611bfa5760405163769dd35360e11b815260040160405180910390fd5b60008381526010602081815260408084208151608081018352815463ffffffff8116825262ffffff600160201b8204168286015261ffff600160381b820416938201939093526001600160a01b03600160481b8404811660608301908152968a9052949093526001600160e81b031990911690559151163314611c9857806060015133604051638e30e82360e01b8152600401610a52929190615af1565b8051600090611cce907f00000000000000000000000000000000000000000000000000000000000000009063ffffffff16615b0b565b90506000611cda613715565b90506000836020015162ffffff1682611cf3919061535c565b9050808310611d385782846020015162ffffff1684611d129190615ade565b611d1d906001615ade565b6040516315ad27c360e01b8152600401610a52929190615758565b6001600160401b03831115611d63576040516302c6ef8160e11b815260048101849052602401610a52565b604051888152339088907f16f3f633197fafab10a5df69e6f3f2f7f20092f08d8d47de0a91c0f4b96a1a259060200160405180910390a3611dc68785600d6000611db1888a6020015161379f565b815260200190815260200160002054866137ae565b98975050505050505050565b600454610100900460ff1615611dfb5760405163769dd35360e11b815260040160405180910390fd5b6000818152600760205260409020546001600160a01b0316611e335760405163c5171ee960e01b815260048101829052602401610a52565b6000818152600760205260409020600101546001600160a01b03163314611e8a576000818152600760205260409081902060010154905163d084e97560e01b8152610a52916001600160a01b031690600401614e5b565b6000818152600760205260409081902080546001600160a01b031980821633908117845560019093018054909116905591516001600160a01b039092169183917fd4114ab6e9af9f597c52041f32d62dc57c5c4e4c0d4427006069635e216c938691611ef7918591615af1565b60405180910390a25050565b60008281526007602052604090205482906001600160a01b031680611f3e5760405163c5171ee960e01b815260048101839052602401610a52565b336001600160a01b03821614611f695780604051636c51fda960e11b8152600401610a529190614e5b565b600454610100900460ff1615611f925760405163769dd35360e11b815260040160405180910390fd5b60045462010000900460ff1615611fbc5760405163ab35696f60e01b815260040160405180910390fd5b60008481526007602052604090206002015460631901611fef576040516305a48e0f60e01b815260040160405180910390fd5b60036000611ffd8587613967565b815260208101919091526040016000205460ff166120b9576001600360006120258688613967565b815260208082019290925260409081016000908120805460ff191694151594909417909355868352600782528083206002018054600181018255908452919092200180546001600160a01b0319166001600160a01b0386161790555184907f1e980d04aa7648e205713e5e8ea3808672ac163d10936d36f91b2c88ac1575e1906120b0908690614e5b565b60405180910390a25b50505050565b600454610100900460ff16156120e85760405163769dd35360e11b815260040160405180910390fd5b6120f18361346a565b6121105782604051635428d44960e01b8152600401610a529190614e5b565b604081146121355760408051636865567560e01b8152610a5291908390600401615aaa565b600061214382840184615b22565b90506000806000806121588560200151612c21565b9350935093509350816001600160a01b0316336001600160a01b0316146121945781604051636c51fda960e11b8152600401610a529190614e5b565b876001600160a01b031663294daa496040518163ffffffff1660e01b8152600401602060405180830381865afa1580156121d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121f69190615b5c565b60ff16856000015160ff1614612293578460000151886001600160a01b031663294daa496040518163ffffffff1660e01b8152600401602060405180830381865afa158015612249573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226d9190615b5c565b60405163e7aada9560e01b815260ff928316600482015291166024820152604401610a52565b6001600160401b038316156122bb57604051631685ecdd60e31b815260040160405180910390fd5b60006040518060a001604052806122d0600190565b60ff16815260200187602001518152602001846001600160a01b03168152602001838152602001866001600160601b031681525090506000816040516020016123199190615b79565b60405160208183030381529060405290506123378760200151612ff4565b600280548791906000906123559084906001600160601b031661539e565b92506101000a8154816001600160601b0302191690836001600160601b031602179055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb8b886040518363ffffffff1660e01b81526004016123c79291906153fb565b6020604051808303816000875af11580156123e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061240a91906153de565b61244b5760405162461bcd60e51b8152602060048201526012602482015271696e73756666696369656e742066756e647360701b6044820152606401610a52565b60405163ce3f471960e01b81526001600160a01b038b169063ce3f471990612477908490600401615c25565b600060405180830381600087803b15801561249157600080fd5b505af11580156124a5573d6000803e3d6000fd5b50506004805461ff00191661010017905550600090505b835181101561254f578381815181106124d7576124d7615330565b60200260200101516001600160a01b0316638ea981178c6040518263ffffffff1660e01b815260040161250a9190614e5b565b600060405180830381600087803b15801561252457600080fd5b505af1158015612538573d6000803e3d6000fd5b50505050808061254790615385565b9150506124bc565b506004805461ff00191690556020870151875160405160ff909116907fbd89b747474d3fc04664dfbd1d56ae7ffbe46ee097cdb9979c13916bb76269ce90612598908e90614e5b565b60405180910390a350505050505050505050565b60008281526007602052604090205482906001600160a01b0316806125e75760405163c5171ee960e01b815260048101839052602401610a52565b336001600160a01b038216146126125780604051636c51fda960e11b8152600401610a529190614e5b565b600454610100900460ff161561263b5760405163769dd35360e11b815260040160405180910390fd5b600084815260086020526040902054600160601b90046001600160401b03161561267857604051631685ecdd60e31b815260040160405180910390fd5b600360006126868587613967565b815260208101919091526040016000205460ff166126bb5783836040516379bfd40160e01b8152600401610a52929190615c38565b60008481526007602090815260408083206002018054825181850281018501909352808352919290919083018282801561271e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612700575b50505050509050600060018251612735919061535c565b905060005b825181101561284057856001600160a01b031683828151811061275f5761275f615330565b60200260200101516001600160a01b03160361282e57600083838151811061278957612789615330565b6020026020010151905080600760008a815260200190815260200160002060020183815481106127bb576127bb615330565b600091825260208083209190910180546001600160a01b0319166001600160a01b0394909416939093179092558981526007909152604090206002018054806128065761280661536f565b600082815260209020810160001990810180546001600160a01b031916905501905550612840565b8061283881615385565b91505061273a565b506003600061284f8789613967565b815260208101919091526040908101600020805460ff191690555186907f32158c6058347c1601b2d12bc696ac6901d8a9a9aa3ba10c27ab0a983e8425a790611bbe908890614e5b565b604051632cb6686f60e01b815260040160405180910390fd5b60008281526007602052604090205482906001600160a01b0316806128ed5760405163c5171ee960e01b815260048101839052602401610a52565b336001600160a01b038216146129185780604051636c51fda960e11b8152600401610a529190614e5b565b600454610100900460ff16156129415760405163769dd35360e11b815260040160405180910390fd5b6000848152600760205260409020600101546001600160a01b038481169116146120b9576000848152600760205260409081902060010180546001600160a01b0319166001600160a01b0386161790555184907f21a4dad170a6bf476c31bbcf4a16628295b0e450672eec25d7c93308e05344a1906120b09033908790615af1565b60045460009062010000900460ff16156129f05760405163ab35696f60e01b815260040160405180910390fd5b600454610100900460ff1615612a195760405163769dd35360e11b815260040160405180910390fd5b3415612a3a57604051630b829bad60e21b8152346004820152602401610a52565b600080612a4989338a8a613143565b925050915060006040518061010001604052808481526020018a61ffff168152602001336001600160a01b031681526020018781526020018863ffffffff166001600160601b031681526020018b81526020016000815260200160008152509050600080612ab68361397d565b60c087019190915260e08601919091526040519193509150612ae29085908c908f908790602001615c4f565b60405160208183030381529060405280519060200120600c6000878152602001908152602001600020819055506000604051806101600160405280878152602001336001600160a01b03168152602001866001600160401b031681526020018c62ffffff1681526020018e81526020018d61ffff1681526020018b63ffffffff1681526020018581526020018a8152602001848152602001836001600160601b0316815250905080600001517f01872fb9c7d6d68af06a17347935e04412da302a377224c205e672c26e18c37f82602001518360400151846060015185608001518660a001518760c001518860e0015160c001518960e0015160e001518a61010001518b61012001518c6101400151604051612c089b9a99989796959493929190615d02565b60405180910390a250939b9a5050505050505050505050565b600081815260076020526040812054819081906060906001600160a01b0316612c605760405163c5171ee960e01b815260048101869052602401610a52565b60008581526008602090815260408083205460078352928190208054600290910180548351818602810186019094528084526001600160601b03861695600160601b90046001600160401b0316946001600160a01b03909316939192839190830182828015612cf857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612cda575b5050505050905093509350935093509193509193565b612d16612f9f565b610a5b81613bb4565b600a546001600160a01b03163314612d4a57604051634bea32db60e11b815260040160405180910390fd5b60405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90612d9890859085906004016153c5565b6020604051808303816000875af1158015612db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ddb91906153de565b611678576040516370a0823160e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190612e2b903090600401614e5b565b602060405180830381865afa158015612e48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6c9190615d98565b8160405163cf47918160e01b8152600401610a52929190615758565b604080516101408101825260045460ff80821615158352610100808304821615156020808601919091526201000084048316151585870152630100000084048316606080870191909152600160201b80860490941660808088019190915263ffffffff600160281b8704811660a0890152600160481b8704811660c0890152600160681b8704811660e0890152600160881b9096048616938701939093526005546001600160601b039081166101208801528751938401885260065495861684526001600160401b03948604851692840192909252600160601b850490931695820195909552600160a01b90920490931692810192909252600091612f8d9190613c57565b6001600160601b031690505b92915050565b6000546001600160a01b03163314612ff25760405162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b6044820152606401610a52565b565b6000818152600760209081526040808320815160608101835281546001600160a01b0390811682526001830154168185015260028201805484518187028101870186528181529295939486019383018282801561307a57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161305c575b505050505081525050905060005b8160400151518110156130ea57600360006130c0846040015184815181106130b2576130b2615330565b602002602001015186613967565b81526020810191909152604001600020805460ff19169055806130e281615385565b915050613088565b50600082815260076020526040812080546001600160a01b031990811682556001820180549091169055906131226002830182614a3e565b505050600090815260086020526040902080546001600160a01b0319169055565b600061314d614a5c565b60006103e88561ffff16111561317c57846103e8604051634a90778560e01b8152600401610a52929190615aaa565b8461ffff166000036131a1576040516308fad2a760e01b815260040160405180910390fd5b6000806131ac613c9d565b600e54919350915065ffffffffffff1660006132178b8b84604080513060208201529081018490526001600160a01b038316606082015265ffffffffffff8216608082015260009060a00160408051601f198184030181529190528051602090910120949350505050565b9050613224826001615db1565b600e805465ffffffffffff9290921665ffffffffffff199092169190911790556040805160808101825263ffffffff909416845262ffffff8916602085015261ffff8a16908401526001600160a01b038a1660608401529550909350909150509450945094915050565b604080516080808201835260065463ffffffff8082168452600160201b8083046001600160401b03908116602080880191909152600160601b850490911686880152600160a01b9093046001600160601b0390811660608088019190915287516101408101895260045460ff808216151583526101008083048216151598840198909852620100008204811615159a83019a909a52630100000081048a169282019290925292810490971694820194909452600160281b8604821660a0820152600160481b8604821660c0820152600160681b8604821660e0820152600160881b9095041690840152600554166101208301526000918291906003836133948888613967565b815260208101919091526040016000205460ff166133c95784866040516379bfd40160e01b8152600401610a52929190615c38565b60006133d58284613c57565b600087815260086020526040902080546001600160601b0392831693509091168281101561342457815460405163cf47918160e01b8152610a52916001600160601b0316908590600401615dd0565b81546001600160601b0319908116918490036001600160601b038181169390931790935560028054918216918316859003909216179055909450925050505b9250929050565b6000805b6009548110156134ca57826001600160a01b03166009828154811061349557613495615330565b6000918252602090912001546001600160a01b0316036134b85750600192915050565b806134c281615385565b91505061346e565b50600092915050565b6000826001600160401b031684600001516001600160401b0316111561352257835160405163012d824d60e01b81526001600160401b0380861660048301529091166024820152604401610a52565b606084015151604080860151905160009161353f91602001615de9565b60405160208183030381529060405280519060200120905085604001516000015160006002811061357257613572615330565b602002015115801561358b575060408601515160200151155b156135c557600d60006135af88600001516001600160401b0316896020015161379f565b8152602001908152602001600020549050613648565b856080015115613648576000600d60006135f089600001516001600160401b03168a6020015161379f565b81526020810191909152604001600020549050806136425781600d60006136288a600001516001600160401b03168b6020015161379f565b815260208101919091526040016000205560019350613646565b8091505b505b6000613655838389613d70565b905083806136605750805b979650505050505050565b60008060008061367b8686614189565b6001600160401b031690506000613693826010615b0b565b9050600060146136a4836015615b0b565b6136ae9190615e29565b89516136ba9190615b0b565b838960e0015163ffffffff168c6136d19190615abe565b6001600160601b03166136e49190615b0b565b6136ee9190615ade565b90506000806137008360008c8c614202565b909d909c50949a509398505050505050505050565b60004661a4b181148061372a575062066eed81145b156137985760646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561376e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137929190615d98565b91505090565b4391505090565b62ffffff1660189190911b1790565b6060826137e05760405163220a34e960e11b8152600481018690526001600160401b0383166024820152604401610a52565b604080516020808201889052865163ffffffff168284015286015162ffffff166060808301919091529186015161ffff166080820152908501516001600160a01b031660a082015260c0810184905260009060e0016040516020818303038152906040528051906020012090506103e8856040015161ffff1611156138825784604001516103e8604051634a90778560e01b8152600401610a52929190615aaa565b6000856040015161ffff166001600160401b038111156138a4576138a4614b68565b6040519080825280602002602001820160405280156138cd578160200160208202803683370190505b50905060005b866040015161ffff168161ffff16101561395c57828160405160200161391092919091825260f01b6001600160f01b031916602082015260220190565b6040516020818303038152906040528051906020012060001c828261ffff168151811061393f5761393f615330565b602090810291909101015280613954816159d0565b9150506138d3565b509695505050505050565b60a081901b6001600160a01b0383161792915050565b6000806000806003600061399987604001518860a00151613967565b815260208101919091526040016000205460ff166139d6578460a0015185604001516040516379bfd40160e01b8152600401610a52929190615c38565b604080516080808201835260065463ffffffff80821684526001600160401b03600160201b8084048216602080880191909152600160601b8504909216868801526001600160601b03600160a01b909404841660608088019190915287516101408101895260045460ff808216151583526101008083048216151596840196909652620100008204811615159a83019a909a52630100000081048a168284015292830490981688870152600160281b8204841660a0890152600160481b8204841660c0890152600160681b8204841660e0890152600160881b90910490921690860152600554909116610120850152908801519088015191929160009182918291613ae291868861366b565b60a08d0151600090815260086020526040902080546001600160601b0394851697509295509093509116841115613b3a57805460405163cf47918160e01b8152610a52916001600160601b0316908690600401615dd0565b80546001600160601b0360016001600160401b03600160601b8085048216929092011602818116828416178790038083166001600160601b03199283166001600160a01b03199095169490941793909317909355600280548083168890039092169190931617909155929a91995097509095509350505050565b336001600160a01b03821603613c065760405162461bcd60e51b815260206004820152601760248201527621b0b73737ba103a3930b739b332b9103a379039b2b63360491b6044820152606401610a52565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b600080613c648484614189565b8460c0015163ffffffff16613c799190615e3d565b6001600160401b031690506000613c938260008787614202565b5095945050505050565b6000806000613caa613715565b90506000613cd87f000000000000000000000000000000000000000000000000000000000000000083615e60565b9050600081613d077f000000000000000000000000000000000000000000000000000000000000000085615ade565b613d11919061535c565b90506000613d3f7f000000000000000000000000000000000000000000000000000000000000000083615e29565b905063ffffffff8110613d65576040516307b2a52360e41b815260040160405180910390fd5b909590945092505050565b6000806040518060c00160405280866001600160401b03811115613d9657613d96614b68565b604051908082528060200260200182016040528015613dbf578160200160208202803683370190505b508152602001866001600160401b03811115613ddd57613ddd614b68565b6040519080825280601f01601f191660200182016040528015613e07576020820181803683370190505b508152602001866001600160401b03811115613e2557613e25614b68565b604051908082528060200260200182016040528015613e5857816020015b6060815260200190600190039081613e435790505b50815260006020820152604001866001600160401b03811115613e7d57613e7d614b68565b604051908082528060200260200182016040528015613ea6578160200160208202803683370190505b508152602001866001600160401b03811115613ec457613ec4614b68565b604051908082528060200260200182016040528015613eed578160200160208202803683370190505b509052905060005b8581101561406c57600084606001518281518110613f1557613f15615330565b60200260200101519050600080600080613f3989600001518a602001518c8861424d565b93509350935093508315613f8d57828760400151886060015161ffff1681518110613f6657613f66615330565b602090810291909101015260608701805190613f81826159d0565b61ffff16905250613fc0565b600160f81b87602001518781518110613fa857613fa8615330565b60200101906001600160f81b031916908160001a9053505b8780613fca575080155b85515188518051929a50909188908110613fe657613fe6615330565b602002602001018181525050818760800151878151811061400957614009615330565b60200260200101906001600160601b031690816001600160601b031681525050846000015160a001518760a00151878151811061404857614048615330565b6020026020010181815250505050505050808061406490615385565b915050613ef5565b5060608301515115614181576000816060015161ffff166001600160401b0381111561409a5761409a614b68565b6040519080825280602002602001820160405280156140cd57816020015b60608152602001906001900390816140b85790505b50905060005b826060015161ffff1681101561413157826040015181815181106140f9576140f9615330565b602002602001015182828151811061411357614113615330565b6020026020010181905250808061412990615385565b9150506140d3565b5081516020830151608084015160a08501516040517f8f79f730779e875ce76c428039cc2052b5b5918c2a55c598fab251c1198aec549461417794909390928792615ead565b60405180910390a1505b509392505050565b815160009080156141a6575060408201516001600160401b031615155b156141fa5761010083015163ffffffff16431080806141e757506101008401516141d69063ffffffff164361535c565b83602001516001600160401b031610155b156141f85750506040810151612f99565b505b503a92915050565b600080600060648560600151606461421a9190615f50565b6142279060ff1689615b0b565b6142319190615e29565b905061423f818787876145bc565b925092505094509492505050565b805160a09081015160009081526008602090815260408083208551948501519151939460609486948594859261428b928e928e929091879101615c4f565b60408051601f19818403018152918152815160209283012084516000908152600c90935291205490915081146142fe5750505460408051808201909152601081526f756e6b6e6f776e2063616c6c6261636b60801b60208201526001955093506001600160601b031691508390506145b1565b50614307614a5c565b600061433c7f00000000000000000000000000000000000000000000000000000000000000006001600160401b038e16615e29565b6040805160808101825263ffffffff909216825262ffffff8d1660208084019190915285015161ffff16828201528401516001600160a01b0316606082015291508990506143d0575050604080518082019091526016815275756e617661696c61626c652072616e646f6d6e65737360501b60208201529054600195509093506001600160601b03169150600090506145b1565b60006143e28360000151838c8f6137ae565b606080840151855191860151604051939450909260009263d21ea8fd60e01b9261441192879190602401615f69565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526004805461ff00191661010017905590506000805a9050600061447c8e60000151608001516001600160601b0316896040015186614630565b9093509050806144b1578d516080015160405163aad1598360e01b8152610a52916001600160601b0316908490600401615758565b506000610bb85a6144c29190615ade565b6004805461ff00191690559050818110156144eb576144eb6144e4828461535c565b8f5161466f565b8854600160601b90046001600160401b031689600c61450983615f94565b82546001600160401b039182166101009390930a92830291909202199091161790555087516000908152600c60205260408120558261457f5760408051808201909152601081526f195e1958dd5d1a5bdb8819985a5b195960821b60208201528954600191906001600160601b0316600061459f565b604080516020810190915260008082528a549091906001600160601b0316825b9c509c509c509c505050505050505050505b945094509450949050565b6000808085156145cc57856145d6565b6145d6858561489b565b90506000816145ed89670de0b6b3a7640000615b0b565b6145f79190615e29565b9050676765c793fa10079d601b1b8111156146245760405162de437160e81b815260040160405180910390fd5b97909650945050505050565b6000805a610bb8811061466657610bb881039050856040820482031115614666576000808551602087016000898bf19250600191505b50935093915050565b80608001516001600160601b0316821115614688575050565b6004546000906064906146a590600160201b900460ff1682615fb7565b60ff168360c001518585608001516001600160601b03166146c6919061535c565b6146d09190615b0b565b6146da9190615b0b565b6146e49190615e29565b60e080840151604080516101408101825260045460ff80821615158352610100808304821615156020808601919091526201000084048316151585870152630100000084048316606080870191909152600160201b80860490941660808088019190915263ffffffff600160281b8704811660a0890152600160481b8704811660c0890152600160681b870481169a88019a909a52600160881b9095048916928601929092526005546001600160601b039081166101208701528651948501875260065498891685526001600160401b03938904841691850191909152600160601b880490921694830194909452600160a01b909504909416918401919091529293506000926147f792859291906145bc565b5060a08401516000908152600860205260408120805492935083929091906148299084906001600160601b0316615abe565b92506101000a8154816001600160601b0302191690836001600160601b0316021790555080600260008282829054906101000a90046001600160601b03166148719190615abe565b92506101000a8154816001600160601b0302191690836001600160601b0316021790555050505050565b60a0820151606082015160009190600163ffffffff831611908180156148d7575084516148ce9063ffffffff164261535c565b8363ffffffff16105b156148e457506101208501515b6001600160601b031695945050505050565b604051806080016040528060006001600160401b03168152602001600062ffffff16815260200160008152602001600081525090565b6040518061010001604052806008906020820280368337509192915050565b6001830191839082156149d95791602002820160005b838211156149a857833562ffffff1683826101000a81548162ffffff021916908362ffffff1602179055509260200192600301602081600201049283019260010302614961565b80156149d75782816101000a81549062ffffff02191690556003016020816002010492830192600103026149a8565b505b506149e5929150614a83565b5090565b8280548282559060005260206000209081019282156149d9579160200282015b828111156149d957825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614a09565b5080546000825590600052602060002090810190610a5b9190614a83565b60408051608081018252600080825260208201819052918101829052606081019190915290565b5b808211156149e55760008155600101614a84565b6001600160a01b0381168114610a5b57600080fd5b8035614ab881614a98565b919050565b600060208284031215614acf57600080fd5b8135614ada81614a98565b9392505050565b60008060408385031215614af457600080fd5b823591506020830135614b0681614a98565b809150509250929050565b600060208284031215614b2357600080fd5b5035919050565b60006101408284031215614b3d57600080fd5b50919050565b803561ffff81168114614ab857600080fd5b803562ffffff81168114614ab857600080fd5b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715614ba057614ba0614b68565b60405290565b60405161010081016001600160401b0381118282101715614ba057614ba0614b68565b60405160a081016001600160401b0381118282101715614ba057614ba0614b68565b604051602081016001600160401b0381118282101715614ba057614ba0614b68565b604051601f8201601f191681016001600160401b0381118282101715614c3557614c35614b68565b604052919050565b600082601f830112614c4e57600080fd5b81356001600160401b03811115614c6757614c67614b68565b614c7a601f8201601f1916602001614c0d565b818152846020838601011115614c8f57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215614cc257600080fd5b84359350614cd260208601614b43565b9250614ce060408601614b55565b915060608501356001600160401b03811115614cfb57600080fd5b614d0787828801614c3d565b91505092959194509250565b60008083601f840112614d2557600080fd5b5081356001600160401b03811115614d3c57600080fd5b6020830191508360208260051b850101111561346357600080fd5b60008060008060408587031215614d6d57600080fd5b84356001600160401b0380821115614d8457600080fd5b614d9088838901614d13565b90965094506020870135915080821115614da957600080fd5b50614db687828801614d13565b95989497509550505050565b80356001600160401b0381168114614ab857600080fd5b600080600080600060808688031215614df157600080fd5b85356001600160401b03811115614e0757600080fd5b614e1388828901614d13565b90965094505060208601356001600160c01b0381168114614e3357600080fd5b9250614e4160408701614dc2565b9150614e4f60608701614dc2565b90509295509295909350565b6001600160a01b0391909116815260200190565b6101008101818360005b6008811015614e9d57815162ffffff16835260209283019290910190600101614e79565b50505092915050565b63ffffffff81168114610a5b57600080fd5b8035614ab881614ea6565b600060408284031215614ed557600080fd5b614edd614b7e565b8235614ee881614ea6565b81526020830135614ef881614ea6565b60208201529392505050565b8015158114610a5b57600080fd5b8035614ab881614f04565b600060208284031215614f2f57600080fd5b8135614ada81614f04565b6000610100808385031215614f4e57600080fd5b838184011115614f5d57600080fd5b509092915050565b60008060008060808587031215614f7b57600080fd5b843593506020850135614f8d81614ea6565b925060408501356001600160401b0380821115614fa957600080fd5b614fb588838901614c3d565b93506060870135915080821115614fcb57600080fd5b50614d0787828801614c3d565b60008083601f840112614fea57600080fd5b5081356001600160401b0381111561500157600080fd5b60208301915083602082850101111561346357600080fd5b6000806000806060858703121561502f57600080fd5b843561503a81614a98565b93506020850135925060408501356001600160401b0381111561505c57600080fd5b614db687828801614fd8565b60008060006060848603121561507d57600080fd5b833592506020840135915060408401356001600160401b038111156150a157600080fd5b6150ad86828701614c3d565b9150509250925092565b600081518084526020808501945080840160005b838110156150e7578151875295820195908201906001016150cb565b509495945050505050565b602081526000614ada60208301846150b7565b60008060006040848603121561511a57600080fd5b833561512581614a98565b925060208401356001600160401b0381111561514057600080fd5b61514c86828701614fd8565b9497909650939450505050565b6000806020838503121561516c57600080fd5b82356001600160401b0381111561518257600080fd5b61518e85828601614fd8565b90969095509350505050565b60008060008060008060c087890312156151b357600080fd5b863595506151c360208801614b43565b94506151d160408801614b55565b935060608701356151e181614ea6565b925060808701356001600160401b03808211156151fd57600080fd5b6152098a838b01614c3d565b935060a089013591508082111561521f57600080fd5b5061522c89828a01614c3d565b9150509295509295509295565b600081518084526020808501945080840160005b838110156150e75781516001600160a01b03168752958201959082019060010161524d565b6001600160601b03851681526001600160401b03841660208201526001600160a01b03831660408201526080606082018190526000906152b490830184615239565b9695505050505050565b600080604083850312156152d157600080fd5b82356152dc81614a98565b946020939093013593505050565b600080604083850312156152fd57600080fd5b8235915060208301356001600160401b0381111561531a57600080fd5b61532685828601614c3d565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115612f9957612f99615346565b634e487b7160e01b600052603160045260246000fd5b60006001820161539757615397615346565b5060010190565b6001600160601b038281168282160390808211156153be576153be615346565b5092915050565b6001600160a01b03929092168252602082015260400190565b6000602082840312156153f057600080fd5b8151614ada81614f04565b6001600160a01b039290921682526001600160601b0316602082015260400190565b60ff81168114610a5b57600080fd5b8035614ab88161541d565b60006020828403121561544957600080fd5b8135614ada8161541d565b60008135612f9981614f04565b60008135612f998161541d565b60008135612f9981614ea6565b6001600160601b0381168114610a5b57600080fd5b60008135612f998161547b565b81356154a881614f04565b815490151560ff1660ff19919091161781556154e36154c960208401615454565b82805461ff00191691151560081b61ff0016919091179055565b61550e6154f260408401615454565b82805462ff0000191691151560101b62ff000016919091179055565b61553761551d60608401615461565b825463ff000000191660189190911b63ff00000016178255565b61556461554660808401615461565b82805460ff60201b191660209290921b60ff60201b16919091179055565b61559761557360a0840161546e565b82805463ffffffff60281b191660289290921b63ffffffff60281b16919091179055565b6155ca6155a660c0840161546e565b82805463ffffffff60481b191660489290921b63ffffffff60481b16919091179055565b6155fd6155d960e0840161546e565b82805463ffffffff60681b191660689290921b63ffffffff60681b16919091179055565b61563161560d610100840161546e565b82805463ffffffff60881b191660889290921b63ffffffff60881b16919091179055565b6116786156416101208401615490565b6001830180546001600160601b0319166001600160601b0392909216919091179055565b8035614ab88161547b565b61014081016156888261568285614f12565b15159052565b61569460208401614f12565b151560208301526156a760408401614f12565b151560408301526156ba6060840161542c565b60ff1660608301526156ce6080840161542c565b60ff1660808301526156e260a08401614eb8565b63ffffffff1660a08301526156f960c08401614eb8565b63ffffffff1660c083015261571060e08401614eb8565b63ffffffff1660e0830152610100615729848201614eb8565b63ffffffff1690830152610120615741848201615665565b6001600160601b038116848301525b505092915050565b918252602082015260400190565b6000823560be1983360301811261577c57600080fd5b9190910192915050565b600082601f83011261579757600080fd5b813560206001600160401b03808311156157b3576157b3614b68565b8260051b6157c2838201614c0d565b93845285810183019383810190888611156157dc57600080fd5b84880192505b85831015611dc6578235848111156157f957600080fd5b8801601f196040828c038201121561581057600080fd5b615818614b7e565b878301358781111561582957600080fd5b8301610100818e038401121561583e57600080fd5b615846614ba6565b925088810135835261585a60408201614b43565b8984015261586a60608201614aad565b604084015260808101358881111561588157600080fd5b61588f8e8b83850101614c3d565b6060850152506158a160a08201615665565b608084015260c081013560a084015260e081013560c084015261010081013560e0840152508181526158d560408401615665565b818901528452505091840191908401906157e2565b600081360360c08112156158fd57600080fd5b615905614bc9565b61590e84614dc2565b8152602061591d818601614b55565b828201526040603f198401121561593357600080fd5b61593b614beb565b925036605f86011261594c57600080fd5b615954614b7e565b80608087013681111561596657600080fd5b604088015b81811015615982578035845292840192840161596b565b50908552604084019490945250509035906001600160401b038211156159a757600080fd5b6159b336838601615786565b60608201526159c460a08501614f12565b60808201529392505050565b600061ffff8083168181036159e7576159e7615346565b6001019392505050565b6000608080830160018060401b038089168552602060018060c01b038916818701526040828916818801526060858189015284895180875260a08a019150848b01965060005b81811015615a735787518051881684528681015162ffffff16878501528581015186850152840151848401529685019691880191600101615a37565b50909d9c50505050505050505050505050565b60006001600160401b038281166002600160401b031981016159e7576159e7615346565b61ffff929092168252602082015260400190565b6001600160601b038181168382160190808211156153be576153be615346565b80820180821115612f9957612f99615346565b6001600160a01b0392831681529116602082015260400190565b8082028115828204841417612f9957612f99615346565b600060408284031215615b3457600080fd5b615b3c614b7e565b8235615b478161541d565b81526020928301359281019290925250919050565b600060208284031215615b6e57600080fd5b8151614ada8161541d565b6020815260ff82511660208201526020820151604082015260018060a01b0360408301511660608201526000606083015160a06080840152615bbe60c0840182615239565b608094909401516001600160601b031660a093909301929092525090919050565b6000815180845260005b81811015615c0557602081850181015186830182015201615be9565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000614ada6020830184615bdf565b9182526001600160a01b0316602082015260400190565b60018060401b038516815262ffffff84166020820152826040820152608060608201528151608082015261ffff60208301511660a082015260018060a01b0360408301511660c0820152600060608301516101008060e0850152615cb7610180850183615bdf565b91506080850151615cd2828601826001600160601b03169052565b505060a084015161012084015260c084015161014084015260e08401516101608401528091505095945050505050565b6001600160a01b038c1681526001600160401b038b16602082015262ffffff8a1660408201526060810189905261ffff8816608082015263ffffffff871660a082015260c0810186905260e081018590526101606101008201819052600090615d6d83820187615bdf565b61012084019590955250506001600160601b0391909116610140909101529998505050505050505050565b600060208284031215615daa57600080fd5b5051919050565b65ffffffffffff8181168382160190808211156153be576153be615346565b6001600160601b03929092168252602082015260400190565b815160408201908260005b6002811015614e9d578251825260209283019290910190600101615df4565b634e487b7160e01b600052601260045260246000fd5b600082615e3857615e38615e13565b500490565b6001600160401b0381811683821602808216919082811461575057615750615346565b600082615e6f57615e6f615e13565b500690565b600081518084526020808501945080840160005b838110156150e75781516001600160601b031687529582019590820190600101615e88565b60a081526000615ec060a08301886150b7565b602083820381850152615ed38289615bdf565b915083820360408501528187518084528284019150828160051b850101838a0160005b83811015615f2457601f19878403018552615f12838351615bdf565b94860194925090850190600101615ef6565b50508681036060880152615f38818a615e74565b9450505050508281036080840152611dc681856150b7565b60ff8181168382160190811115612f9957612f99615346565b838152606060208201526000615f8260608301856150b7565b82810360408401526152b48185615bdf565b60006001600160401b03821680615fad57615fad615346565b6000190192915050565b60ff8281168282160390811115612f9957612f9961534656fea164736f6c6343000813000a", -} - -var VRFCoordinatorABI = VRFCoordinatorMetaData.ABI - -var VRFCoordinatorBin = VRFCoordinatorMetaData.Bin - -func DeployVRFCoordinator(auth *bind.TransactOpts, backend bind.ContractBackend, beaconPeriodBlocksArg *big.Int, linkToken common.Address) (common.Address, *types.Transaction, *VRFCoordinator, error) { - parsed, err := VRFCoordinatorMetaData.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(VRFCoordinatorBin), backend, beaconPeriodBlocksArg, linkToken) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &VRFCoordinator{VRFCoordinatorCaller: VRFCoordinatorCaller{contract: contract}, VRFCoordinatorTransactor: VRFCoordinatorTransactor{contract: contract}, VRFCoordinatorFilterer: VRFCoordinatorFilterer{contract: contract}}, nil -} - -type VRFCoordinator struct { - address common.Address - abi abi.ABI - VRFCoordinatorCaller - VRFCoordinatorTransactor - VRFCoordinatorFilterer -} - -type VRFCoordinatorCaller struct { - contract *bind.BoundContract -} - -type VRFCoordinatorTransactor struct { - contract *bind.BoundContract -} - -type VRFCoordinatorFilterer struct { - contract *bind.BoundContract -} - -type VRFCoordinatorSession struct { - Contract *VRFCoordinator - CallOpts bind.CallOpts - TransactOpts bind.TransactOpts -} - -type VRFCoordinatorCallerSession struct { - Contract *VRFCoordinatorCaller - CallOpts bind.CallOpts -} - -type VRFCoordinatorTransactorSession struct { - Contract *VRFCoordinatorTransactor - TransactOpts bind.TransactOpts -} - -type VRFCoordinatorRaw struct { - Contract *VRFCoordinator -} - -type VRFCoordinatorCallerRaw struct { - Contract *VRFCoordinatorCaller -} - -type VRFCoordinatorTransactorRaw struct { - Contract *VRFCoordinatorTransactor -} - -func NewVRFCoordinator(address common.Address, backend bind.ContractBackend) (*VRFCoordinator, error) { - abi, err := abi.JSON(strings.NewReader(VRFCoordinatorABI)) - if err != nil { - return nil, err - } - contract, err := bindVRFCoordinator(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &VRFCoordinator{address: address, abi: abi, VRFCoordinatorCaller: VRFCoordinatorCaller{contract: contract}, VRFCoordinatorTransactor: VRFCoordinatorTransactor{contract: contract}, VRFCoordinatorFilterer: VRFCoordinatorFilterer{contract: contract}}, nil -} - -func NewVRFCoordinatorCaller(address common.Address, caller bind.ContractCaller) (*VRFCoordinatorCaller, error) { - contract, err := bindVRFCoordinator(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &VRFCoordinatorCaller{contract: contract}, nil -} - -func NewVRFCoordinatorTransactor(address common.Address, transactor bind.ContractTransactor) (*VRFCoordinatorTransactor, error) { - contract, err := bindVRFCoordinator(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &VRFCoordinatorTransactor{contract: contract}, nil -} - -func NewVRFCoordinatorFilterer(address common.Address, filterer bind.ContractFilterer) (*VRFCoordinatorFilterer, error) { - contract, err := bindVRFCoordinator(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &VRFCoordinatorFilterer{contract: contract}, nil -} - -func bindVRFCoordinator(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := VRFCoordinatorMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -func (_VRFCoordinator *VRFCoordinatorRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _VRFCoordinator.Contract.VRFCoordinatorCaller.contract.Call(opts, result, method, params...) -} - -func (_VRFCoordinator *VRFCoordinatorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _VRFCoordinator.Contract.VRFCoordinatorTransactor.contract.Transfer(opts) -} - -func (_VRFCoordinator *VRFCoordinatorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _VRFCoordinator.Contract.VRFCoordinatorTransactor.contract.Transact(opts, method, params...) -} - -func (_VRFCoordinator *VRFCoordinatorCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _VRFCoordinator.Contract.contract.Call(opts, result, method, params...) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _VRFCoordinator.Contract.contract.Transfer(opts) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _VRFCoordinator.Contract.contract.Transact(opts, method, params...) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) MAXCONSUMERS(opts *bind.CallOpts) (uint16, error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "MAX_CONSUMERS") - - if err != nil { - return *new(uint16), err - } - - out0 := *abi.ConvertType(out[0], new(uint16)).(*uint16) - - return out0, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) MAXCONSUMERS() (uint16, error) { - return _VRFCoordinator.Contract.MAXCONSUMERS(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) MAXCONSUMERS() (uint16, error) { - return _VRFCoordinator.Contract.MAXCONSUMERS(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) MAXNUMWORDS(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "MAX_NUM_WORDS") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) MAXNUMWORDS() (*big.Int, error) { - return _VRFCoordinator.Contract.MAXNUMWORDS(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) MAXNUMWORDS() (*big.Int, error) { - return _VRFCoordinator.Contract.MAXNUMWORDS(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) NUMCONFDELAYS(opts *bind.CallOpts) (uint8, error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "NUM_CONF_DELAYS") - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) NUMCONFDELAYS() (uint8, error) { - return _VRFCoordinator.Contract.NUMCONFDELAYS(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) NUMCONFDELAYS() (uint8, error) { - return _VRFCoordinator.Contract.NUMCONFDELAYS(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) GetCallbackMemo(opts *bind.CallOpts, requestId *big.Int) ([32]byte, error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "getCallbackMemo", requestId) - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) GetCallbackMemo(requestId *big.Int) ([32]byte, error) { - return _VRFCoordinator.Contract.GetCallbackMemo(&_VRFCoordinator.CallOpts, requestId) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) GetCallbackMemo(requestId *big.Int) ([32]byte, error) { - return _VRFCoordinator.Contract.GetCallbackMemo(&_VRFCoordinator.CallOpts, requestId) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) GetConfirmationDelays(opts *bind.CallOpts) ([8]*big.Int, error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "getConfirmationDelays") - - if err != nil { - return *new([8]*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new([8]*big.Int)).(*[8]*big.Int) - - return out0, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) GetConfirmationDelays() ([8]*big.Int, error) { - return _VRFCoordinator.Contract.GetConfirmationDelays(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) GetConfirmationDelays() ([8]*big.Int, error) { - return _VRFCoordinator.Contract.GetConfirmationDelays(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) GetFee(opts *bind.CallOpts, arg0 *big.Int, arg1 []byte) (*big.Int, error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "getFee", arg0, arg1) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) GetFee(arg0 *big.Int, arg1 []byte) (*big.Int, error) { - return _VRFCoordinator.Contract.GetFee(&_VRFCoordinator.CallOpts, arg0, arg1) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) GetFee(arg0 *big.Int, arg1 []byte) (*big.Int, error) { - return _VRFCoordinator.Contract.GetFee(&_VRFCoordinator.CallOpts, arg0, arg1) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) GetFulfillmentFee(opts *bind.CallOpts, arg0 *big.Int, callbackGasLimit uint32, arguments []byte, arg3 []byte) (*big.Int, error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "getFulfillmentFee", arg0, callbackGasLimit, arguments, arg3) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) GetFulfillmentFee(arg0 *big.Int, callbackGasLimit uint32, arguments []byte, arg3 []byte) (*big.Int, error) { - return _VRFCoordinator.Contract.GetFulfillmentFee(&_VRFCoordinator.CallOpts, arg0, callbackGasLimit, arguments, arg3) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) GetFulfillmentFee(arg0 *big.Int, callbackGasLimit uint32, arguments []byte, arg3 []byte) (*big.Int, error) { - return _VRFCoordinator.Contract.GetFulfillmentFee(&_VRFCoordinator.CallOpts, arg0, callbackGasLimit, arguments, arg3) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) GetSubscription(opts *bind.CallOpts, subId *big.Int) (GetSubscription, - - error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "getSubscription", subId) - - outstruct := new(GetSubscription) - if err != nil { - return *outstruct, err - } - - outstruct.Balance = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.PendingFulfillments = *abi.ConvertType(out[1], new(uint64)).(*uint64) - outstruct.Owner = *abi.ConvertType(out[2], new(common.Address)).(*common.Address) - outstruct.Consumers = *abi.ConvertType(out[3], new([]common.Address)).(*[]common.Address) - - return *outstruct, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) GetSubscription(subId *big.Int) (GetSubscription, - - error) { - return _VRFCoordinator.Contract.GetSubscription(&_VRFCoordinator.CallOpts, subId) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) GetSubscription(subId *big.Int) (GetSubscription, - - error) { - return _VRFCoordinator.Contract.GetSubscription(&_VRFCoordinator.CallOpts, subId) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) GetSubscriptionLinkBalance(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "getSubscriptionLinkBalance") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) GetSubscriptionLinkBalance() (*big.Int, error) { - return _VRFCoordinator.Contract.GetSubscriptionLinkBalance(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) GetSubscriptionLinkBalance() (*big.Int, error) { - return _VRFCoordinator.Contract.GetSubscriptionLinkBalance(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) IBeaconPeriodBlocks(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "i_beaconPeriodBlocks") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) IBeaconPeriodBlocks() (*big.Int, error) { - return _VRFCoordinator.Contract.IBeaconPeriodBlocks(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) IBeaconPeriodBlocks() (*big.Int, error) { - return _VRFCoordinator.Contract.IBeaconPeriodBlocks(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) ILink(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "i_link") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) ILink() (common.Address, error) { - return _VRFCoordinator.Contract.ILink(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) ILink() (common.Address, error) { - return _VRFCoordinator.Contract.ILink(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) MigrationVersion(opts *bind.CallOpts) (uint8, error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "migrationVersion") - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) MigrationVersion() (uint8, error) { - return _VRFCoordinator.Contract.MigrationVersion(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) MigrationVersion() (uint8, error) { - return _VRFCoordinator.Contract.MigrationVersion(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) OnMigration(opts *bind.CallOpts, arg0 []byte) error { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "onMigration", arg0) - - if err != nil { - return err - } - - return err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) OnMigration(arg0 []byte) error { - return _VRFCoordinator.Contract.OnMigration(&_VRFCoordinator.CallOpts, arg0) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) OnMigration(arg0 []byte) error { - return _VRFCoordinator.Contract.OnMigration(&_VRFCoordinator.CallOpts, arg0) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _VRFCoordinator.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 (_VRFCoordinator *VRFCoordinatorSession) Owner() (common.Address, error) { - return _VRFCoordinator.Contract.Owner(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) Owner() (common.Address, error) { - return _VRFCoordinator.Contract.Owner(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) SCallbackConfig(opts *bind.CallOpts) (SCallbackConfig, - - error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "s_callbackConfig") - - outstruct := new(SCallbackConfig) - if err != nil { - return *outstruct, err - } - - outstruct.MaxCallbackGasLimit = *abi.ConvertType(out[0], new(uint32)).(*uint32) - outstruct.MaxCallbackArgumentsLength = *abi.ConvertType(out[1], new(uint32)).(*uint32) - - return *outstruct, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) SCallbackConfig() (SCallbackConfig, - - error) { - return _VRFCoordinator.Contract.SCallbackConfig(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) SCallbackConfig() (SCallbackConfig, - - error) { - return _VRFCoordinator.Contract.SCallbackConfig(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) SCoordinatorConfig(opts *bind.CallOpts) (SCoordinatorConfig, - - error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "s_coordinatorConfig") - - outstruct := new(SCoordinatorConfig) - if err != nil { - return *outstruct, err - } - - outstruct.UseReasonableGasPrice = *abi.ConvertType(out[0], new(bool)).(*bool) - outstruct.ReentrancyLock = *abi.ConvertType(out[1], new(bool)).(*bool) - outstruct.Paused = *abi.ConvertType(out[2], new(bool)).(*bool) - outstruct.PremiumPercentage = *abi.ConvertType(out[3], new(uint8)).(*uint8) - outstruct.UnusedGasPenaltyPercent = *abi.ConvertType(out[4], new(uint8)).(*uint8) - outstruct.StalenessSeconds = *abi.ConvertType(out[5], new(uint32)).(*uint32) - outstruct.RedeemableRequestGasOverhead = *abi.ConvertType(out[6], new(uint32)).(*uint32) - outstruct.CallbackRequestGasOverhead = *abi.ConvertType(out[7], new(uint32)).(*uint32) - outstruct.ReasonableGasPriceStalenessBlocks = *abi.ConvertType(out[8], new(uint32)).(*uint32) - outstruct.FallbackWeiPerUnitLink = *abi.ConvertType(out[9], new(*big.Int)).(**big.Int) - - return *outstruct, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) SCoordinatorConfig() (SCoordinatorConfig, - - error) { - return _VRFCoordinator.Contract.SCoordinatorConfig(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) SCoordinatorConfig() (SCoordinatorConfig, - - error) { - return _VRFCoordinator.Contract.SCoordinatorConfig(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) SPendingRequests(opts *bind.CallOpts, arg0 *big.Int) (SPendingRequests, - - error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "s_pendingRequests", arg0) - - outstruct := new(SPendingRequests) - if err != nil { - return *outstruct, err - } - - outstruct.SlotNumber = *abi.ConvertType(out[0], new(uint32)).(*uint32) - outstruct.ConfirmationDelay = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.NumWords = *abi.ConvertType(out[2], new(uint16)).(*uint16) - outstruct.Requester = *abi.ConvertType(out[3], new(common.Address)).(*common.Address) - - return *outstruct, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) SPendingRequests(arg0 *big.Int) (SPendingRequests, - - error) { - return _VRFCoordinator.Contract.SPendingRequests(&_VRFCoordinator.CallOpts, arg0) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) SPendingRequests(arg0 *big.Int) (SPendingRequests, - - error) { - return _VRFCoordinator.Contract.SPendingRequests(&_VRFCoordinator.CallOpts, arg0) -} - -func (_VRFCoordinator *VRFCoordinatorCaller) SProducer(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _VRFCoordinator.contract.Call(opts, &out, "s_producer") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -func (_VRFCoordinator *VRFCoordinatorSession) SProducer() (common.Address, error) { - return _VRFCoordinator.Contract.SProducer(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorCallerSession) SProducer() (common.Address, error) { - return _VRFCoordinator.Contract.SProducer(&_VRFCoordinator.CallOpts) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "acceptOwnership") -} - -func (_VRFCoordinator *VRFCoordinatorSession) AcceptOwnership() (*types.Transaction, error) { - return _VRFCoordinator.Contract.AcceptOwnership(&_VRFCoordinator.TransactOpts) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) AcceptOwnership() (*types.Transaction, error) { - return _VRFCoordinator.Contract.AcceptOwnership(&_VRFCoordinator.TransactOpts) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) AcceptSubscriptionOwnerTransfer(opts *bind.TransactOpts, subId *big.Int) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "acceptSubscriptionOwnerTransfer", subId) -} - -func (_VRFCoordinator *VRFCoordinatorSession) AcceptSubscriptionOwnerTransfer(subId *big.Int) (*types.Transaction, error) { - return _VRFCoordinator.Contract.AcceptSubscriptionOwnerTransfer(&_VRFCoordinator.TransactOpts, subId) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) AcceptSubscriptionOwnerTransfer(subId *big.Int) (*types.Transaction, error) { - return _VRFCoordinator.Contract.AcceptSubscriptionOwnerTransfer(&_VRFCoordinator.TransactOpts, subId) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) AddConsumer(opts *bind.TransactOpts, subId *big.Int, consumer common.Address) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "addConsumer", subId, consumer) -} - -func (_VRFCoordinator *VRFCoordinatorSession) AddConsumer(subId *big.Int, consumer common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.AddConsumer(&_VRFCoordinator.TransactOpts, subId, consumer) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) AddConsumer(subId *big.Int, consumer common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.AddConsumer(&_VRFCoordinator.TransactOpts, subId, consumer) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) BatchTransferLink(opts *bind.TransactOpts, recipients []common.Address, paymentsInJuels []*big.Int) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "batchTransferLink", recipients, paymentsInJuels) -} - -func (_VRFCoordinator *VRFCoordinatorSession) BatchTransferLink(recipients []common.Address, paymentsInJuels []*big.Int) (*types.Transaction, error) { - return _VRFCoordinator.Contract.BatchTransferLink(&_VRFCoordinator.TransactOpts, recipients, paymentsInJuels) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) BatchTransferLink(recipients []common.Address, paymentsInJuels []*big.Int) (*types.Transaction, error) { - return _VRFCoordinator.Contract.BatchTransferLink(&_VRFCoordinator.TransactOpts, recipients, paymentsInJuels) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) CancelSubscription(opts *bind.TransactOpts, subId *big.Int, to common.Address) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "cancelSubscription", subId, to) -} - -func (_VRFCoordinator *VRFCoordinatorSession) CancelSubscription(subId *big.Int, to common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.CancelSubscription(&_VRFCoordinator.TransactOpts, subId, to) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) CancelSubscription(subId *big.Int, to common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.CancelSubscription(&_VRFCoordinator.TransactOpts, subId, to) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) CreateSubscription(opts *bind.TransactOpts) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "createSubscription") -} - -func (_VRFCoordinator *VRFCoordinatorSession) CreateSubscription() (*types.Transaction, error) { - return _VRFCoordinator.Contract.CreateSubscription(&_VRFCoordinator.TransactOpts) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) CreateSubscription() (*types.Transaction, error) { - return _VRFCoordinator.Contract.CreateSubscription(&_VRFCoordinator.TransactOpts) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) DeregisterMigratableCoordinator(opts *bind.TransactOpts, target common.Address) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "deregisterMigratableCoordinator", target) -} - -func (_VRFCoordinator *VRFCoordinatorSession) DeregisterMigratableCoordinator(target common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.DeregisterMigratableCoordinator(&_VRFCoordinator.TransactOpts, target) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) DeregisterMigratableCoordinator(target common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.DeregisterMigratableCoordinator(&_VRFCoordinator.TransactOpts, target) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) Migrate(opts *bind.TransactOpts, newCoordinator common.Address, encodedRequest []byte) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "migrate", newCoordinator, encodedRequest) -} - -func (_VRFCoordinator *VRFCoordinatorSession) Migrate(newCoordinator common.Address, encodedRequest []byte) (*types.Transaction, error) { - return _VRFCoordinator.Contract.Migrate(&_VRFCoordinator.TransactOpts, newCoordinator, encodedRequest) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) Migrate(newCoordinator common.Address, encodedRequest []byte) (*types.Transaction, error) { - return _VRFCoordinator.Contract.Migrate(&_VRFCoordinator.TransactOpts, newCoordinator, encodedRequest) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) OnTokenTransfer(opts *bind.TransactOpts, arg0 common.Address, amount *big.Int, data []byte) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "onTokenTransfer", arg0, amount, data) -} - -func (_VRFCoordinator *VRFCoordinatorSession) OnTokenTransfer(arg0 common.Address, amount *big.Int, data []byte) (*types.Transaction, error) { - return _VRFCoordinator.Contract.OnTokenTransfer(&_VRFCoordinator.TransactOpts, arg0, amount, data) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) OnTokenTransfer(arg0 common.Address, amount *big.Int, data []byte) (*types.Transaction, error) { - return _VRFCoordinator.Contract.OnTokenTransfer(&_VRFCoordinator.TransactOpts, arg0, amount, data) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) ProcessVRFOutputs(opts *bind.TransactOpts, vrfOutputs []VRFBeaconTypesVRFOutput, juelsPerFeeCoin *big.Int, reasonableGasPrice uint64, blockHeight uint64) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "processVRFOutputs", vrfOutputs, juelsPerFeeCoin, reasonableGasPrice, blockHeight) -} - -func (_VRFCoordinator *VRFCoordinatorSession) ProcessVRFOutputs(vrfOutputs []VRFBeaconTypesVRFOutput, juelsPerFeeCoin *big.Int, reasonableGasPrice uint64, blockHeight uint64) (*types.Transaction, error) { - return _VRFCoordinator.Contract.ProcessVRFOutputs(&_VRFCoordinator.TransactOpts, vrfOutputs, juelsPerFeeCoin, reasonableGasPrice, blockHeight) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) ProcessVRFOutputs(vrfOutputs []VRFBeaconTypesVRFOutput, juelsPerFeeCoin *big.Int, reasonableGasPrice uint64, blockHeight uint64) (*types.Transaction, error) { - return _VRFCoordinator.Contract.ProcessVRFOutputs(&_VRFCoordinator.TransactOpts, vrfOutputs, juelsPerFeeCoin, reasonableGasPrice, blockHeight) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) RedeemRandomness(opts *bind.TransactOpts, subID *big.Int, requestID *big.Int, arg2 []byte) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "redeemRandomness", subID, requestID, arg2) -} - -func (_VRFCoordinator *VRFCoordinatorSession) RedeemRandomness(subID *big.Int, requestID *big.Int, arg2 []byte) (*types.Transaction, error) { - return _VRFCoordinator.Contract.RedeemRandomness(&_VRFCoordinator.TransactOpts, subID, requestID, arg2) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) RedeemRandomness(subID *big.Int, requestID *big.Int, arg2 []byte) (*types.Transaction, error) { - return _VRFCoordinator.Contract.RedeemRandomness(&_VRFCoordinator.TransactOpts, subID, requestID, arg2) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) RegisterMigratableCoordinator(opts *bind.TransactOpts, target common.Address) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "registerMigratableCoordinator", target) -} - -func (_VRFCoordinator *VRFCoordinatorSession) RegisterMigratableCoordinator(target common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.RegisterMigratableCoordinator(&_VRFCoordinator.TransactOpts, target) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) RegisterMigratableCoordinator(target common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.RegisterMigratableCoordinator(&_VRFCoordinator.TransactOpts, target) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) RemoveConsumer(opts *bind.TransactOpts, subId *big.Int, consumer common.Address) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "removeConsumer", subId, consumer) -} - -func (_VRFCoordinator *VRFCoordinatorSession) RemoveConsumer(subId *big.Int, consumer common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.RemoveConsumer(&_VRFCoordinator.TransactOpts, subId, consumer) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) RemoveConsumer(subId *big.Int, consumer common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.RemoveConsumer(&_VRFCoordinator.TransactOpts, subId, consumer) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) RequestRandomness(opts *bind.TransactOpts, subID *big.Int, numWords uint16, confDelay *big.Int, arg3 []byte) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "requestRandomness", subID, numWords, confDelay, arg3) -} - -func (_VRFCoordinator *VRFCoordinatorSession) RequestRandomness(subID *big.Int, numWords uint16, confDelay *big.Int, arg3 []byte) (*types.Transaction, error) { - return _VRFCoordinator.Contract.RequestRandomness(&_VRFCoordinator.TransactOpts, subID, numWords, confDelay, arg3) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) RequestRandomness(subID *big.Int, numWords uint16, confDelay *big.Int, arg3 []byte) (*types.Transaction, error) { - return _VRFCoordinator.Contract.RequestRandomness(&_VRFCoordinator.TransactOpts, subID, numWords, confDelay, arg3) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) RequestRandomnessFulfillment(opts *bind.TransactOpts, subID *big.Int, numWords uint16, confDelay *big.Int, callbackGasLimit uint32, arguments []byte, arg5 []byte) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "requestRandomnessFulfillment", subID, numWords, confDelay, callbackGasLimit, arguments, arg5) -} - -func (_VRFCoordinator *VRFCoordinatorSession) RequestRandomnessFulfillment(subID *big.Int, numWords uint16, confDelay *big.Int, callbackGasLimit uint32, arguments []byte, arg5 []byte) (*types.Transaction, error) { - return _VRFCoordinator.Contract.RequestRandomnessFulfillment(&_VRFCoordinator.TransactOpts, subID, numWords, confDelay, callbackGasLimit, arguments, arg5) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) RequestRandomnessFulfillment(subID *big.Int, numWords uint16, confDelay *big.Int, callbackGasLimit uint32, arguments []byte, arg5 []byte) (*types.Transaction, error) { - return _VRFCoordinator.Contract.RequestRandomnessFulfillment(&_VRFCoordinator.TransactOpts, subID, numWords, confDelay, callbackGasLimit, arguments, arg5) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) RequestSubscriptionOwnerTransfer(opts *bind.TransactOpts, subId *big.Int, newOwner common.Address) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "requestSubscriptionOwnerTransfer", subId, newOwner) -} - -func (_VRFCoordinator *VRFCoordinatorSession) RequestSubscriptionOwnerTransfer(subId *big.Int, newOwner common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.RequestSubscriptionOwnerTransfer(&_VRFCoordinator.TransactOpts, subId, newOwner) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) RequestSubscriptionOwnerTransfer(subId *big.Int, newOwner common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.RequestSubscriptionOwnerTransfer(&_VRFCoordinator.TransactOpts, subId, newOwner) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) SetCallbackConfig(opts *bind.TransactOpts, config VRFCoordinatorCallbackConfig) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "setCallbackConfig", config) -} - -func (_VRFCoordinator *VRFCoordinatorSession) SetCallbackConfig(config VRFCoordinatorCallbackConfig) (*types.Transaction, error) { - return _VRFCoordinator.Contract.SetCallbackConfig(&_VRFCoordinator.TransactOpts, config) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) SetCallbackConfig(config VRFCoordinatorCallbackConfig) (*types.Transaction, error) { - return _VRFCoordinator.Contract.SetCallbackConfig(&_VRFCoordinator.TransactOpts, config) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) SetConfirmationDelays(opts *bind.TransactOpts, confDelays [8]*big.Int) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "setConfirmationDelays", confDelays) -} - -func (_VRFCoordinator *VRFCoordinatorSession) SetConfirmationDelays(confDelays [8]*big.Int) (*types.Transaction, error) { - return _VRFCoordinator.Contract.SetConfirmationDelays(&_VRFCoordinator.TransactOpts, confDelays) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) SetConfirmationDelays(confDelays [8]*big.Int) (*types.Transaction, error) { - return _VRFCoordinator.Contract.SetConfirmationDelays(&_VRFCoordinator.TransactOpts, confDelays) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) SetCoordinatorConfig(opts *bind.TransactOpts, coordinatorConfig VRFBeaconTypesCoordinatorConfig) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "setCoordinatorConfig", coordinatorConfig) -} - -func (_VRFCoordinator *VRFCoordinatorSession) SetCoordinatorConfig(coordinatorConfig VRFBeaconTypesCoordinatorConfig) (*types.Transaction, error) { - return _VRFCoordinator.Contract.SetCoordinatorConfig(&_VRFCoordinator.TransactOpts, coordinatorConfig) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) SetCoordinatorConfig(coordinatorConfig VRFBeaconTypesCoordinatorConfig) (*types.Transaction, error) { - return _VRFCoordinator.Contract.SetCoordinatorConfig(&_VRFCoordinator.TransactOpts, coordinatorConfig) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) SetPauseFlag(opts *bind.TransactOpts, pause bool) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "setPauseFlag", pause) -} - -func (_VRFCoordinator *VRFCoordinatorSession) SetPauseFlag(pause bool) (*types.Transaction, error) { - return _VRFCoordinator.Contract.SetPauseFlag(&_VRFCoordinator.TransactOpts, pause) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) SetPauseFlag(pause bool) (*types.Transaction, error) { - return _VRFCoordinator.Contract.SetPauseFlag(&_VRFCoordinator.TransactOpts, pause) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) SetProducer(opts *bind.TransactOpts, producer common.Address) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "setProducer", producer) -} - -func (_VRFCoordinator *VRFCoordinatorSession) SetProducer(producer common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.SetProducer(&_VRFCoordinator.TransactOpts, producer) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) SetProducer(producer common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.SetProducer(&_VRFCoordinator.TransactOpts, producer) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) TransferLink(opts *bind.TransactOpts, recipient common.Address, juelsAmount *big.Int) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "transferLink", recipient, juelsAmount) -} - -func (_VRFCoordinator *VRFCoordinatorSession) TransferLink(recipient common.Address, juelsAmount *big.Int) (*types.Transaction, error) { - return _VRFCoordinator.Contract.TransferLink(&_VRFCoordinator.TransactOpts, recipient, juelsAmount) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) TransferLink(recipient common.Address, juelsAmount *big.Int) (*types.Transaction, error) { - return _VRFCoordinator.Contract.TransferLink(&_VRFCoordinator.TransactOpts, recipient, juelsAmount) -} - -func (_VRFCoordinator *VRFCoordinatorTransactor) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - return _VRFCoordinator.contract.Transact(opts, "transferOwnership", to) -} - -func (_VRFCoordinator *VRFCoordinatorSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.TransferOwnership(&_VRFCoordinator.TransactOpts, to) -} - -func (_VRFCoordinator *VRFCoordinatorTransactorSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _VRFCoordinator.Contract.TransferOwnership(&_VRFCoordinator.TransactOpts, to) -} - -type VRFCoordinatorCallbackConfigSetIterator struct { - Event *VRFCoordinatorCallbackConfigSet - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorCallbackConfigSetIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorCallbackConfigSet) - 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(VRFCoordinatorCallbackConfigSet) - 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 *VRFCoordinatorCallbackConfigSetIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorCallbackConfigSetIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorCallbackConfigSet struct { - NewConfig VRFCoordinatorCallbackConfig - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterCallbackConfigSet(opts *bind.FilterOpts) (*VRFCoordinatorCallbackConfigSetIterator, error) { - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "CallbackConfigSet") - if err != nil { - return nil, err - } - return &VRFCoordinatorCallbackConfigSetIterator{contract: _VRFCoordinator.contract, event: "CallbackConfigSet", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchCallbackConfigSet(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorCallbackConfigSet) (event.Subscription, error) { - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "CallbackConfigSet") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorCallbackConfigSet) - if err := _VRFCoordinator.contract.UnpackLog(event, "CallbackConfigSet", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseCallbackConfigSet(log types.Log) (*VRFCoordinatorCallbackConfigSet, error) { - event := new(VRFCoordinatorCallbackConfigSet) - if err := _VRFCoordinator.contract.UnpackLog(event, "CallbackConfigSet", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorCoordinatorConfigSetIterator struct { - Event *VRFCoordinatorCoordinatorConfigSet - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorCoordinatorConfigSetIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorCoordinatorConfigSet) - 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(VRFCoordinatorCoordinatorConfigSet) - 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 *VRFCoordinatorCoordinatorConfigSetIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorCoordinatorConfigSetIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorCoordinatorConfigSet struct { - CoordinatorConfig VRFBeaconTypesCoordinatorConfig - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterCoordinatorConfigSet(opts *bind.FilterOpts) (*VRFCoordinatorCoordinatorConfigSetIterator, error) { - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "CoordinatorConfigSet") - if err != nil { - return nil, err - } - return &VRFCoordinatorCoordinatorConfigSetIterator{contract: _VRFCoordinator.contract, event: "CoordinatorConfigSet", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchCoordinatorConfigSet(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorCoordinatorConfigSet) (event.Subscription, error) { - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "CoordinatorConfigSet") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorCoordinatorConfigSet) - if err := _VRFCoordinator.contract.UnpackLog(event, "CoordinatorConfigSet", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseCoordinatorConfigSet(log types.Log) (*VRFCoordinatorCoordinatorConfigSet, error) { - event := new(VRFCoordinatorCoordinatorConfigSet) - if err := _VRFCoordinator.contract.UnpackLog(event, "CoordinatorConfigSet", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorCoordinatorDeregisteredIterator struct { - Event *VRFCoordinatorCoordinatorDeregistered - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorCoordinatorDeregisteredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorCoordinatorDeregistered) - 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(VRFCoordinatorCoordinatorDeregistered) - 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 *VRFCoordinatorCoordinatorDeregisteredIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorCoordinatorDeregisteredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorCoordinatorDeregistered struct { - CoordinatorAddress common.Address - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterCoordinatorDeregistered(opts *bind.FilterOpts) (*VRFCoordinatorCoordinatorDeregisteredIterator, error) { - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "CoordinatorDeregistered") - if err != nil { - return nil, err - } - return &VRFCoordinatorCoordinatorDeregisteredIterator{contract: _VRFCoordinator.contract, event: "CoordinatorDeregistered", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchCoordinatorDeregistered(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorCoordinatorDeregistered) (event.Subscription, error) { - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "CoordinatorDeregistered") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorCoordinatorDeregistered) - if err := _VRFCoordinator.contract.UnpackLog(event, "CoordinatorDeregistered", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseCoordinatorDeregistered(log types.Log) (*VRFCoordinatorCoordinatorDeregistered, error) { - event := new(VRFCoordinatorCoordinatorDeregistered) - if err := _VRFCoordinator.contract.UnpackLog(event, "CoordinatorDeregistered", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorCoordinatorRegisteredIterator struct { - Event *VRFCoordinatorCoordinatorRegistered - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorCoordinatorRegisteredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorCoordinatorRegistered) - 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(VRFCoordinatorCoordinatorRegistered) - 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 *VRFCoordinatorCoordinatorRegisteredIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorCoordinatorRegisteredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorCoordinatorRegistered struct { - CoordinatorAddress common.Address - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterCoordinatorRegistered(opts *bind.FilterOpts) (*VRFCoordinatorCoordinatorRegisteredIterator, error) { - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "CoordinatorRegistered") - if err != nil { - return nil, err - } - return &VRFCoordinatorCoordinatorRegisteredIterator{contract: _VRFCoordinator.contract, event: "CoordinatorRegistered", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchCoordinatorRegistered(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorCoordinatorRegistered) (event.Subscription, error) { - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "CoordinatorRegistered") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorCoordinatorRegistered) - if err := _VRFCoordinator.contract.UnpackLog(event, "CoordinatorRegistered", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseCoordinatorRegistered(log types.Log) (*VRFCoordinatorCoordinatorRegistered, error) { - event := new(VRFCoordinatorCoordinatorRegistered) - if err := _VRFCoordinator.contract.UnpackLog(event, "CoordinatorRegistered", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorMigrationCompletedIterator struct { - Event *VRFCoordinatorMigrationCompleted - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorMigrationCompletedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorMigrationCompleted) - 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(VRFCoordinatorMigrationCompleted) - 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 *VRFCoordinatorMigrationCompletedIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorMigrationCompletedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorMigrationCompleted struct { - NewVersion uint8 - NewCoordinator common.Address - SubID *big.Int - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterMigrationCompleted(opts *bind.FilterOpts, newVersion []uint8, subID []*big.Int) (*VRFCoordinatorMigrationCompletedIterator, error) { - - var newVersionRule []interface{} - for _, newVersionItem := range newVersion { - newVersionRule = append(newVersionRule, newVersionItem) - } - - var subIDRule []interface{} - for _, subIDItem := range subID { - subIDRule = append(subIDRule, subIDItem) - } - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "MigrationCompleted", newVersionRule, subIDRule) - if err != nil { - return nil, err - } - return &VRFCoordinatorMigrationCompletedIterator{contract: _VRFCoordinator.contract, event: "MigrationCompleted", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchMigrationCompleted(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorMigrationCompleted, newVersion []uint8, subID []*big.Int) (event.Subscription, error) { - - var newVersionRule []interface{} - for _, newVersionItem := range newVersion { - newVersionRule = append(newVersionRule, newVersionItem) - } - - var subIDRule []interface{} - for _, subIDItem := range subID { - subIDRule = append(subIDRule, subIDItem) - } - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "MigrationCompleted", newVersionRule, subIDRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorMigrationCompleted) - if err := _VRFCoordinator.contract.UnpackLog(event, "MigrationCompleted", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseMigrationCompleted(log types.Log) (*VRFCoordinatorMigrationCompleted, error) { - event := new(VRFCoordinatorMigrationCompleted) - if err := _VRFCoordinator.contract.UnpackLog(event, "MigrationCompleted", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorOutputsServedIterator struct { - Event *VRFCoordinatorOutputsServed - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorOutputsServedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorOutputsServed) - 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(VRFCoordinatorOutputsServed) - 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 *VRFCoordinatorOutputsServedIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorOutputsServedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorOutputsServed struct { - RecentBlockHeight uint64 - JuelsPerFeeCoin *big.Int - ReasonableGasPrice uint64 - OutputsServed []VRFBeaconTypesOutputServed - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterOutputsServed(opts *bind.FilterOpts) (*VRFCoordinatorOutputsServedIterator, error) { - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "OutputsServed") - if err != nil { - return nil, err - } - return &VRFCoordinatorOutputsServedIterator{contract: _VRFCoordinator.contract, event: "OutputsServed", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchOutputsServed(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorOutputsServed) (event.Subscription, error) { - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "OutputsServed") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorOutputsServed) - if err := _VRFCoordinator.contract.UnpackLog(event, "OutputsServed", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseOutputsServed(log types.Log) (*VRFCoordinatorOutputsServed, error) { - event := new(VRFCoordinatorOutputsServed) - if err := _VRFCoordinator.contract.UnpackLog(event, "OutputsServed", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorOwnershipTransferRequestedIterator struct { - Event *VRFCoordinatorOwnershipTransferRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorOwnershipTransferRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorOwnershipTransferRequested) - 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(VRFCoordinatorOwnershipTransferRequested) - 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 *VRFCoordinatorOwnershipTransferRequestedIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorOwnershipTransferRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorOwnershipTransferRequested struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*VRFCoordinatorOwnershipTransferRequestedIterator, 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 := _VRFCoordinator.contract.FilterLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return &VRFCoordinatorOwnershipTransferRequestedIterator{contract: _VRFCoordinator.contract, event: "OwnershipTransferRequested", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorOwnershipTransferRequested, 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 := _VRFCoordinator.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(VRFCoordinatorOwnershipTransferRequested) - if err := _VRFCoordinator.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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseOwnershipTransferRequested(log types.Log) (*VRFCoordinatorOwnershipTransferRequested, error) { - event := new(VRFCoordinatorOwnershipTransferRequested) - if err := _VRFCoordinator.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorOwnershipTransferredIterator struct { - Event *VRFCoordinatorOwnershipTransferred - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorOwnershipTransferredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorOwnershipTransferred) - 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(VRFCoordinatorOwnershipTransferred) - 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 *VRFCoordinatorOwnershipTransferredIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorOwnershipTransferred struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*VRFCoordinatorOwnershipTransferredIterator, 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 := _VRFCoordinator.contract.FilterLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return &VRFCoordinatorOwnershipTransferredIterator{contract: _VRFCoordinator.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorOwnershipTransferred, 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 := _VRFCoordinator.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(VRFCoordinatorOwnershipTransferred) - if err := _VRFCoordinator.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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseOwnershipTransferred(log types.Log) (*VRFCoordinatorOwnershipTransferred, error) { - event := new(VRFCoordinatorOwnershipTransferred) - if err := _VRFCoordinator.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorPauseFlagChangedIterator struct { - Event *VRFCoordinatorPauseFlagChanged - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorPauseFlagChangedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorPauseFlagChanged) - 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(VRFCoordinatorPauseFlagChanged) - 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 *VRFCoordinatorPauseFlagChangedIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorPauseFlagChangedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorPauseFlagChanged struct { - Paused bool - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterPauseFlagChanged(opts *bind.FilterOpts) (*VRFCoordinatorPauseFlagChangedIterator, error) { - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "PauseFlagChanged") - if err != nil { - return nil, err - } - return &VRFCoordinatorPauseFlagChangedIterator{contract: _VRFCoordinator.contract, event: "PauseFlagChanged", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchPauseFlagChanged(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorPauseFlagChanged) (event.Subscription, error) { - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "PauseFlagChanged") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorPauseFlagChanged) - if err := _VRFCoordinator.contract.UnpackLog(event, "PauseFlagChanged", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParsePauseFlagChanged(log types.Log) (*VRFCoordinatorPauseFlagChanged, error) { - event := new(VRFCoordinatorPauseFlagChanged) - if err := _VRFCoordinator.contract.UnpackLog(event, "PauseFlagChanged", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorRandomWordsFulfilledIterator struct { - Event *VRFCoordinatorRandomWordsFulfilled - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorRandomWordsFulfilledIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorRandomWordsFulfilled) - 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(VRFCoordinatorRandomWordsFulfilled) - 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 *VRFCoordinatorRandomWordsFulfilledIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorRandomWordsFulfilledIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorRandomWordsFulfilled struct { - RequestIDs []*big.Int - SuccessfulFulfillment []byte - TruncatedErrorData [][]byte - SubBalances []*big.Int - SubIDs []*big.Int - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterRandomWordsFulfilled(opts *bind.FilterOpts) (*VRFCoordinatorRandomWordsFulfilledIterator, error) { - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "RandomWordsFulfilled") - if err != nil { - return nil, err - } - return &VRFCoordinatorRandomWordsFulfilledIterator{contract: _VRFCoordinator.contract, event: "RandomWordsFulfilled", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchRandomWordsFulfilled(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorRandomWordsFulfilled) (event.Subscription, error) { - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "RandomWordsFulfilled") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorRandomWordsFulfilled) - if err := _VRFCoordinator.contract.UnpackLog(event, "RandomWordsFulfilled", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseRandomWordsFulfilled(log types.Log) (*VRFCoordinatorRandomWordsFulfilled, error) { - event := new(VRFCoordinatorRandomWordsFulfilled) - if err := _VRFCoordinator.contract.UnpackLog(event, "RandomWordsFulfilled", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorRandomnessFulfillmentRequestedIterator struct { - Event *VRFCoordinatorRandomnessFulfillmentRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorRandomnessFulfillmentRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorRandomnessFulfillmentRequested) - 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(VRFCoordinatorRandomnessFulfillmentRequested) - 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 *VRFCoordinatorRandomnessFulfillmentRequestedIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorRandomnessFulfillmentRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorRandomnessFulfillmentRequested struct { - RequestID *big.Int - Requester common.Address - NextBeaconOutputHeight uint64 - ConfDelay *big.Int - SubID *big.Int - NumWords uint16 - GasAllowance uint32 - GasPrice *big.Int - WeiPerUnitLink *big.Int - Arguments []byte - CostJuels *big.Int - NewSubBalance *big.Int - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterRandomnessFulfillmentRequested(opts *bind.FilterOpts, requestID []*big.Int) (*VRFCoordinatorRandomnessFulfillmentRequestedIterator, error) { - - var requestIDRule []interface{} - for _, requestIDItem := range requestID { - requestIDRule = append(requestIDRule, requestIDItem) - } - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "RandomnessFulfillmentRequested", requestIDRule) - if err != nil { - return nil, err - } - return &VRFCoordinatorRandomnessFulfillmentRequestedIterator{contract: _VRFCoordinator.contract, event: "RandomnessFulfillmentRequested", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchRandomnessFulfillmentRequested(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorRandomnessFulfillmentRequested, requestID []*big.Int) (event.Subscription, error) { - - var requestIDRule []interface{} - for _, requestIDItem := range requestID { - requestIDRule = append(requestIDRule, requestIDItem) - } - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "RandomnessFulfillmentRequested", requestIDRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorRandomnessFulfillmentRequested) - if err := _VRFCoordinator.contract.UnpackLog(event, "RandomnessFulfillmentRequested", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseRandomnessFulfillmentRequested(log types.Log) (*VRFCoordinatorRandomnessFulfillmentRequested, error) { - event := new(VRFCoordinatorRandomnessFulfillmentRequested) - if err := _VRFCoordinator.contract.UnpackLog(event, "RandomnessFulfillmentRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorRandomnessRedeemedIterator struct { - Event *VRFCoordinatorRandomnessRedeemed - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorRandomnessRedeemedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorRandomnessRedeemed) - 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(VRFCoordinatorRandomnessRedeemed) - 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 *VRFCoordinatorRandomnessRedeemedIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorRandomnessRedeemedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorRandomnessRedeemed struct { - RequestID *big.Int - Requester common.Address - SubID *big.Int - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterRandomnessRedeemed(opts *bind.FilterOpts, requestID []*big.Int, requester []common.Address) (*VRFCoordinatorRandomnessRedeemedIterator, error) { - - var requestIDRule []interface{} - for _, requestIDItem := range requestID { - requestIDRule = append(requestIDRule, requestIDItem) - } - var requesterRule []interface{} - for _, requesterItem := range requester { - requesterRule = append(requesterRule, requesterItem) - } - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "RandomnessRedeemed", requestIDRule, requesterRule) - if err != nil { - return nil, err - } - return &VRFCoordinatorRandomnessRedeemedIterator{contract: _VRFCoordinator.contract, event: "RandomnessRedeemed", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchRandomnessRedeemed(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorRandomnessRedeemed, requestID []*big.Int, requester []common.Address) (event.Subscription, error) { - - var requestIDRule []interface{} - for _, requestIDItem := range requestID { - requestIDRule = append(requestIDRule, requestIDItem) - } - var requesterRule []interface{} - for _, requesterItem := range requester { - requesterRule = append(requesterRule, requesterItem) - } - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "RandomnessRedeemed", requestIDRule, requesterRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorRandomnessRedeemed) - if err := _VRFCoordinator.contract.UnpackLog(event, "RandomnessRedeemed", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseRandomnessRedeemed(log types.Log) (*VRFCoordinatorRandomnessRedeemed, error) { - event := new(VRFCoordinatorRandomnessRedeemed) - if err := _VRFCoordinator.contract.UnpackLog(event, "RandomnessRedeemed", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorRandomnessRequestedIterator struct { - Event *VRFCoordinatorRandomnessRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorRandomnessRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorRandomnessRequested) - 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(VRFCoordinatorRandomnessRequested) - 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 *VRFCoordinatorRandomnessRequestedIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorRandomnessRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorRandomnessRequested struct { - RequestID *big.Int - Requester common.Address - NextBeaconOutputHeight uint64 - ConfDelay *big.Int - SubID *big.Int - NumWords uint16 - CostJuels *big.Int - NewSubBalance *big.Int - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterRandomnessRequested(opts *bind.FilterOpts, requestID []*big.Int) (*VRFCoordinatorRandomnessRequestedIterator, error) { - - var requestIDRule []interface{} - for _, requestIDItem := range requestID { - requestIDRule = append(requestIDRule, requestIDItem) - } - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "RandomnessRequested", requestIDRule) - if err != nil { - return nil, err - } - return &VRFCoordinatorRandomnessRequestedIterator{contract: _VRFCoordinator.contract, event: "RandomnessRequested", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchRandomnessRequested(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorRandomnessRequested, requestID []*big.Int) (event.Subscription, error) { - - var requestIDRule []interface{} - for _, requestIDItem := range requestID { - requestIDRule = append(requestIDRule, requestIDItem) - } - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "RandomnessRequested", requestIDRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorRandomnessRequested) - if err := _VRFCoordinator.contract.UnpackLog(event, "RandomnessRequested", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseRandomnessRequested(log types.Log) (*VRFCoordinatorRandomnessRequested, error) { - event := new(VRFCoordinatorRandomnessRequested) - if err := _VRFCoordinator.contract.UnpackLog(event, "RandomnessRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorSubscriptionCanceledIterator struct { - Event *VRFCoordinatorSubscriptionCanceled - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorSubscriptionCanceledIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorSubscriptionCanceled) - 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(VRFCoordinatorSubscriptionCanceled) - 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 *VRFCoordinatorSubscriptionCanceledIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorSubscriptionCanceledIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorSubscriptionCanceled struct { - SubId *big.Int - To common.Address - Amount *big.Int - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterSubscriptionCanceled(opts *bind.FilterOpts, subId []*big.Int) (*VRFCoordinatorSubscriptionCanceledIterator, error) { - - var subIdRule []interface{} - for _, subIdItem := range subId { - subIdRule = append(subIdRule, subIdItem) - } - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "SubscriptionCanceled", subIdRule) - if err != nil { - return nil, err - } - return &VRFCoordinatorSubscriptionCanceledIterator{contract: _VRFCoordinator.contract, event: "SubscriptionCanceled", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchSubscriptionCanceled(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorSubscriptionCanceled, subId []*big.Int) (event.Subscription, error) { - - var subIdRule []interface{} - for _, subIdItem := range subId { - subIdRule = append(subIdRule, subIdItem) - } - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "SubscriptionCanceled", subIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorSubscriptionCanceled) - if err := _VRFCoordinator.contract.UnpackLog(event, "SubscriptionCanceled", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseSubscriptionCanceled(log types.Log) (*VRFCoordinatorSubscriptionCanceled, error) { - event := new(VRFCoordinatorSubscriptionCanceled) - if err := _VRFCoordinator.contract.UnpackLog(event, "SubscriptionCanceled", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorSubscriptionConsumerAddedIterator struct { - Event *VRFCoordinatorSubscriptionConsumerAdded - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorSubscriptionConsumerAddedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorSubscriptionConsumerAdded) - 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(VRFCoordinatorSubscriptionConsumerAdded) - 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 *VRFCoordinatorSubscriptionConsumerAddedIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorSubscriptionConsumerAddedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorSubscriptionConsumerAdded struct { - SubId *big.Int - Consumer common.Address - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterSubscriptionConsumerAdded(opts *bind.FilterOpts, subId []*big.Int) (*VRFCoordinatorSubscriptionConsumerAddedIterator, error) { - - var subIdRule []interface{} - for _, subIdItem := range subId { - subIdRule = append(subIdRule, subIdItem) - } - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "SubscriptionConsumerAdded", subIdRule) - if err != nil { - return nil, err - } - return &VRFCoordinatorSubscriptionConsumerAddedIterator{contract: _VRFCoordinator.contract, event: "SubscriptionConsumerAdded", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchSubscriptionConsumerAdded(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorSubscriptionConsumerAdded, subId []*big.Int) (event.Subscription, error) { - - var subIdRule []interface{} - for _, subIdItem := range subId { - subIdRule = append(subIdRule, subIdItem) - } - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "SubscriptionConsumerAdded", subIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorSubscriptionConsumerAdded) - if err := _VRFCoordinator.contract.UnpackLog(event, "SubscriptionConsumerAdded", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseSubscriptionConsumerAdded(log types.Log) (*VRFCoordinatorSubscriptionConsumerAdded, error) { - event := new(VRFCoordinatorSubscriptionConsumerAdded) - if err := _VRFCoordinator.contract.UnpackLog(event, "SubscriptionConsumerAdded", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorSubscriptionConsumerRemovedIterator struct { - Event *VRFCoordinatorSubscriptionConsumerRemoved - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorSubscriptionConsumerRemovedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorSubscriptionConsumerRemoved) - 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(VRFCoordinatorSubscriptionConsumerRemoved) - 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 *VRFCoordinatorSubscriptionConsumerRemovedIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorSubscriptionConsumerRemovedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorSubscriptionConsumerRemoved struct { - SubId *big.Int - Consumer common.Address - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterSubscriptionConsumerRemoved(opts *bind.FilterOpts, subId []*big.Int) (*VRFCoordinatorSubscriptionConsumerRemovedIterator, error) { - - var subIdRule []interface{} - for _, subIdItem := range subId { - subIdRule = append(subIdRule, subIdItem) - } - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "SubscriptionConsumerRemoved", subIdRule) - if err != nil { - return nil, err - } - return &VRFCoordinatorSubscriptionConsumerRemovedIterator{contract: _VRFCoordinator.contract, event: "SubscriptionConsumerRemoved", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchSubscriptionConsumerRemoved(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorSubscriptionConsumerRemoved, subId []*big.Int) (event.Subscription, error) { - - var subIdRule []interface{} - for _, subIdItem := range subId { - subIdRule = append(subIdRule, subIdItem) - } - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "SubscriptionConsumerRemoved", subIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorSubscriptionConsumerRemoved) - if err := _VRFCoordinator.contract.UnpackLog(event, "SubscriptionConsumerRemoved", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseSubscriptionConsumerRemoved(log types.Log) (*VRFCoordinatorSubscriptionConsumerRemoved, error) { - event := new(VRFCoordinatorSubscriptionConsumerRemoved) - if err := _VRFCoordinator.contract.UnpackLog(event, "SubscriptionConsumerRemoved", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorSubscriptionCreatedIterator struct { - Event *VRFCoordinatorSubscriptionCreated - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorSubscriptionCreatedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorSubscriptionCreated) - 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(VRFCoordinatorSubscriptionCreated) - 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 *VRFCoordinatorSubscriptionCreatedIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorSubscriptionCreatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorSubscriptionCreated struct { - SubId *big.Int - Owner common.Address - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterSubscriptionCreated(opts *bind.FilterOpts, subId []*big.Int, owner []common.Address) (*VRFCoordinatorSubscriptionCreatedIterator, error) { - - var subIdRule []interface{} - for _, subIdItem := range subId { - subIdRule = append(subIdRule, subIdItem) - } - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "SubscriptionCreated", subIdRule, ownerRule) - if err != nil { - return nil, err - } - return &VRFCoordinatorSubscriptionCreatedIterator{contract: _VRFCoordinator.contract, event: "SubscriptionCreated", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchSubscriptionCreated(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorSubscriptionCreated, subId []*big.Int, owner []common.Address) (event.Subscription, error) { - - var subIdRule []interface{} - for _, subIdItem := range subId { - subIdRule = append(subIdRule, subIdItem) - } - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "SubscriptionCreated", subIdRule, ownerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorSubscriptionCreated) - if err := _VRFCoordinator.contract.UnpackLog(event, "SubscriptionCreated", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseSubscriptionCreated(log types.Log) (*VRFCoordinatorSubscriptionCreated, error) { - event := new(VRFCoordinatorSubscriptionCreated) - if err := _VRFCoordinator.contract.UnpackLog(event, "SubscriptionCreated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorSubscriptionFundedIterator struct { - Event *VRFCoordinatorSubscriptionFunded - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorSubscriptionFundedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorSubscriptionFunded) - 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(VRFCoordinatorSubscriptionFunded) - 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 *VRFCoordinatorSubscriptionFundedIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorSubscriptionFundedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorSubscriptionFunded struct { - SubId *big.Int - OldBalance *big.Int - NewBalance *big.Int - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterSubscriptionFunded(opts *bind.FilterOpts, subId []*big.Int) (*VRFCoordinatorSubscriptionFundedIterator, error) { - - var subIdRule []interface{} - for _, subIdItem := range subId { - subIdRule = append(subIdRule, subIdItem) - } - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "SubscriptionFunded", subIdRule) - if err != nil { - return nil, err - } - return &VRFCoordinatorSubscriptionFundedIterator{contract: _VRFCoordinator.contract, event: "SubscriptionFunded", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchSubscriptionFunded(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorSubscriptionFunded, subId []*big.Int) (event.Subscription, error) { - - var subIdRule []interface{} - for _, subIdItem := range subId { - subIdRule = append(subIdRule, subIdItem) - } - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "SubscriptionFunded", subIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorSubscriptionFunded) - if err := _VRFCoordinator.contract.UnpackLog(event, "SubscriptionFunded", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseSubscriptionFunded(log types.Log) (*VRFCoordinatorSubscriptionFunded, error) { - event := new(VRFCoordinatorSubscriptionFunded) - if err := _VRFCoordinator.contract.UnpackLog(event, "SubscriptionFunded", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorSubscriptionOwnerTransferRequestedIterator struct { - Event *VRFCoordinatorSubscriptionOwnerTransferRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorSubscriptionOwnerTransferRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorSubscriptionOwnerTransferRequested) - 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(VRFCoordinatorSubscriptionOwnerTransferRequested) - 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 *VRFCoordinatorSubscriptionOwnerTransferRequestedIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorSubscriptionOwnerTransferRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorSubscriptionOwnerTransferRequested struct { - SubId *big.Int - From common.Address - To common.Address - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterSubscriptionOwnerTransferRequested(opts *bind.FilterOpts, subId []*big.Int) (*VRFCoordinatorSubscriptionOwnerTransferRequestedIterator, error) { - - var subIdRule []interface{} - for _, subIdItem := range subId { - subIdRule = append(subIdRule, subIdItem) - } - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "SubscriptionOwnerTransferRequested", subIdRule) - if err != nil { - return nil, err - } - return &VRFCoordinatorSubscriptionOwnerTransferRequestedIterator{contract: _VRFCoordinator.contract, event: "SubscriptionOwnerTransferRequested", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchSubscriptionOwnerTransferRequested(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorSubscriptionOwnerTransferRequested, subId []*big.Int) (event.Subscription, error) { - - var subIdRule []interface{} - for _, subIdItem := range subId { - subIdRule = append(subIdRule, subIdItem) - } - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "SubscriptionOwnerTransferRequested", subIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorSubscriptionOwnerTransferRequested) - if err := _VRFCoordinator.contract.UnpackLog(event, "SubscriptionOwnerTransferRequested", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseSubscriptionOwnerTransferRequested(log types.Log) (*VRFCoordinatorSubscriptionOwnerTransferRequested, error) { - event := new(VRFCoordinatorSubscriptionOwnerTransferRequested) - if err := _VRFCoordinator.contract.UnpackLog(event, "SubscriptionOwnerTransferRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type VRFCoordinatorSubscriptionOwnerTransferredIterator struct { - Event *VRFCoordinatorSubscriptionOwnerTransferred - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *VRFCoordinatorSubscriptionOwnerTransferredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(VRFCoordinatorSubscriptionOwnerTransferred) - 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(VRFCoordinatorSubscriptionOwnerTransferred) - 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 *VRFCoordinatorSubscriptionOwnerTransferredIterator) Error() error { - return it.fail -} - -func (it *VRFCoordinatorSubscriptionOwnerTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type VRFCoordinatorSubscriptionOwnerTransferred struct { - SubId *big.Int - From common.Address - To common.Address - Raw types.Log -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) FilterSubscriptionOwnerTransferred(opts *bind.FilterOpts, subId []*big.Int) (*VRFCoordinatorSubscriptionOwnerTransferredIterator, error) { - - var subIdRule []interface{} - for _, subIdItem := range subId { - subIdRule = append(subIdRule, subIdItem) - } - - logs, sub, err := _VRFCoordinator.contract.FilterLogs(opts, "SubscriptionOwnerTransferred", subIdRule) - if err != nil { - return nil, err - } - return &VRFCoordinatorSubscriptionOwnerTransferredIterator{contract: _VRFCoordinator.contract, event: "SubscriptionOwnerTransferred", logs: logs, sub: sub}, nil -} - -func (_VRFCoordinator *VRFCoordinatorFilterer) WatchSubscriptionOwnerTransferred(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorSubscriptionOwnerTransferred, subId []*big.Int) (event.Subscription, error) { - - var subIdRule []interface{} - for _, subIdItem := range subId { - subIdRule = append(subIdRule, subIdItem) - } - - logs, sub, err := _VRFCoordinator.contract.WatchLogs(opts, "SubscriptionOwnerTransferred", subIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(VRFCoordinatorSubscriptionOwnerTransferred) - if err := _VRFCoordinator.contract.UnpackLog(event, "SubscriptionOwnerTransferred", 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 (_VRFCoordinator *VRFCoordinatorFilterer) ParseSubscriptionOwnerTransferred(log types.Log) (*VRFCoordinatorSubscriptionOwnerTransferred, error) { - event := new(VRFCoordinatorSubscriptionOwnerTransferred) - if err := _VRFCoordinator.contract.UnpackLog(event, "SubscriptionOwnerTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type GetSubscription struct { - Balance *big.Int - PendingFulfillments uint64 - Owner common.Address - Consumers []common.Address -} -type SCallbackConfig struct { - MaxCallbackGasLimit uint32 - MaxCallbackArgumentsLength uint32 -} -type SCoordinatorConfig struct { - UseReasonableGasPrice bool - ReentrancyLock bool - Paused bool - PremiumPercentage uint8 - UnusedGasPenaltyPercent uint8 - StalenessSeconds uint32 - RedeemableRequestGasOverhead uint32 - CallbackRequestGasOverhead uint32 - ReasonableGasPriceStalenessBlocks uint32 - FallbackWeiPerUnitLink *big.Int -} -type SPendingRequests struct { - SlotNumber uint32 - ConfirmationDelay *big.Int - NumWords uint16 - Requester common.Address -} - -func (_VRFCoordinator *VRFCoordinator) ParseLog(log types.Log) (generated.AbigenLog, error) { - switch log.Topics[0] { - case _VRFCoordinator.abi.Events["CallbackConfigSet"].ID: - return _VRFCoordinator.ParseCallbackConfigSet(log) - case _VRFCoordinator.abi.Events["CoordinatorConfigSet"].ID: - return _VRFCoordinator.ParseCoordinatorConfigSet(log) - case _VRFCoordinator.abi.Events["CoordinatorDeregistered"].ID: - return _VRFCoordinator.ParseCoordinatorDeregistered(log) - case _VRFCoordinator.abi.Events["CoordinatorRegistered"].ID: - return _VRFCoordinator.ParseCoordinatorRegistered(log) - case _VRFCoordinator.abi.Events["MigrationCompleted"].ID: - return _VRFCoordinator.ParseMigrationCompleted(log) - case _VRFCoordinator.abi.Events["OutputsServed"].ID: - return _VRFCoordinator.ParseOutputsServed(log) - case _VRFCoordinator.abi.Events["OwnershipTransferRequested"].ID: - return _VRFCoordinator.ParseOwnershipTransferRequested(log) - case _VRFCoordinator.abi.Events["OwnershipTransferred"].ID: - return _VRFCoordinator.ParseOwnershipTransferred(log) - case _VRFCoordinator.abi.Events["PauseFlagChanged"].ID: - return _VRFCoordinator.ParsePauseFlagChanged(log) - case _VRFCoordinator.abi.Events["RandomWordsFulfilled"].ID: - return _VRFCoordinator.ParseRandomWordsFulfilled(log) - case _VRFCoordinator.abi.Events["RandomnessFulfillmentRequested"].ID: - return _VRFCoordinator.ParseRandomnessFulfillmentRequested(log) - case _VRFCoordinator.abi.Events["RandomnessRedeemed"].ID: - return _VRFCoordinator.ParseRandomnessRedeemed(log) - case _VRFCoordinator.abi.Events["RandomnessRequested"].ID: - return _VRFCoordinator.ParseRandomnessRequested(log) - case _VRFCoordinator.abi.Events["SubscriptionCanceled"].ID: - return _VRFCoordinator.ParseSubscriptionCanceled(log) - case _VRFCoordinator.abi.Events["SubscriptionConsumerAdded"].ID: - return _VRFCoordinator.ParseSubscriptionConsumerAdded(log) - case _VRFCoordinator.abi.Events["SubscriptionConsumerRemoved"].ID: - return _VRFCoordinator.ParseSubscriptionConsumerRemoved(log) - case _VRFCoordinator.abi.Events["SubscriptionCreated"].ID: - return _VRFCoordinator.ParseSubscriptionCreated(log) - case _VRFCoordinator.abi.Events["SubscriptionFunded"].ID: - return _VRFCoordinator.ParseSubscriptionFunded(log) - case _VRFCoordinator.abi.Events["SubscriptionOwnerTransferRequested"].ID: - return _VRFCoordinator.ParseSubscriptionOwnerTransferRequested(log) - case _VRFCoordinator.abi.Events["SubscriptionOwnerTransferred"].ID: - return _VRFCoordinator.ParseSubscriptionOwnerTransferred(log) - - default: - return nil, fmt.Errorf("abigen wrapper received unknown log topic: %v", log.Topics[0]) - } -} - -func (VRFCoordinatorCallbackConfigSet) Topic() common.Hash { - return common.HexToHash("0x0cc54509a45ab33cd67614d4a2892c083ecf8fb43b9d29f6ea8130b9023e51df") -} - -func (VRFCoordinatorCoordinatorConfigSet) Topic() common.Hash { - return common.HexToHash("0x0028d3a46e95e67def989d41c66eb331add9809460b95b5fb4eb006157728fc5") -} - -func (VRFCoordinatorCoordinatorDeregistered) Topic() common.Hash { - return common.HexToHash("0xf80a1a97fd42251f3c33cda98635e7399253033a6774fe37cd3f650b5282af37") -} - -func (VRFCoordinatorCoordinatorRegistered) Topic() common.Hash { - return common.HexToHash("0xb7cabbfc11e66731fc77de0444614282023bcbd41d16781c753a431d0af01625") -} - -func (VRFCoordinatorMigrationCompleted) Topic() common.Hash { - return common.HexToHash("0xbd89b747474d3fc04664dfbd1d56ae7ffbe46ee097cdb9979c13916bb76269ce") -} - -func (VRFCoordinatorOutputsServed) Topic() common.Hash { - return common.HexToHash("0xf10ea936d00579b4c52035ee33bf46929646b3aa87554c565d8fb2c7aa549c44") -} - -func (VRFCoordinatorOwnershipTransferRequested) Topic() common.Hash { - return common.HexToHash("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278") -} - -func (VRFCoordinatorOwnershipTransferred) Topic() common.Hash { - return common.HexToHash("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0") -} - -func (VRFCoordinatorPauseFlagChanged) Topic() common.Hash { - return common.HexToHash("0x49ba7c1de2d8853088b6270e43df2118516b217f38b917dd2b80dea360860fbe") -} - -func (VRFCoordinatorRandomWordsFulfilled) Topic() common.Hash { - return common.HexToHash("0x8f79f730779e875ce76c428039cc2052b5b5918c2a55c598fab251c1198aec54") -} - -func (VRFCoordinatorRandomnessFulfillmentRequested) Topic() common.Hash { - return common.HexToHash("0x01872fb9c7d6d68af06a17347935e04412da302a377224c205e672c26e18c37f") -} - -func (VRFCoordinatorRandomnessRedeemed) Topic() common.Hash { - return common.HexToHash("0x16f3f633197fafab10a5df69e6f3f2f7f20092f08d8d47de0a91c0f4b96a1a25") -} - -func (VRFCoordinatorRandomnessRequested) Topic() common.Hash { - return common.HexToHash("0xb7933fba96b6b452eb44f99fdc08052a45dff82363d59abaff0456931c3d2459") -} - -func (VRFCoordinatorSubscriptionCanceled) Topic() common.Hash { - return common.HexToHash("0x3784f77e8e883de95b5d47cd713ced01229fa74d118c0a462224bcb0516d43f1") -} - -func (VRFCoordinatorSubscriptionConsumerAdded) Topic() common.Hash { - return common.HexToHash("0x1e980d04aa7648e205713e5e8ea3808672ac163d10936d36f91b2c88ac1575e1") -} - -func (VRFCoordinatorSubscriptionConsumerRemoved) Topic() common.Hash { - return common.HexToHash("0x32158c6058347c1601b2d12bc696ac6901d8a9a9aa3ba10c27ab0a983e8425a7") -} - -func (VRFCoordinatorSubscriptionCreated) Topic() common.Hash { - return common.HexToHash("0x1d3015d7ba850fa198dc7b1a3f5d42779313a681035f77c8c03764c61005518d") -} - -func (VRFCoordinatorSubscriptionFunded) Topic() common.Hash { - return common.HexToHash("0x1ced9348ff549fceab2ac57cd3a9de38edaaab274b725ee82c23e8fc8c4eec7a") -} - -func (VRFCoordinatorSubscriptionOwnerTransferRequested) Topic() common.Hash { - return common.HexToHash("0x21a4dad170a6bf476c31bbcf4a16628295b0e450672eec25d7c93308e05344a1") -} - -func (VRFCoordinatorSubscriptionOwnerTransferred) Topic() common.Hash { - return common.HexToHash("0xd4114ab6e9af9f597c52041f32d62dc57c5c4e4c0d4427006069635e216c9386") -} - -func (_VRFCoordinator *VRFCoordinator) Address() common.Address { - return _VRFCoordinator.address -} - -type VRFCoordinatorInterface interface { - MAXCONSUMERS(opts *bind.CallOpts) (uint16, error) - - MAXNUMWORDS(opts *bind.CallOpts) (*big.Int, error) - - NUMCONFDELAYS(opts *bind.CallOpts) (uint8, error) - - GetCallbackMemo(opts *bind.CallOpts, requestId *big.Int) ([32]byte, error) - - GetConfirmationDelays(opts *bind.CallOpts) ([8]*big.Int, error) - - GetFee(opts *bind.CallOpts, arg0 *big.Int, arg1 []byte) (*big.Int, error) - - GetFulfillmentFee(opts *bind.CallOpts, arg0 *big.Int, callbackGasLimit uint32, arguments []byte, arg3 []byte) (*big.Int, error) - - GetSubscription(opts *bind.CallOpts, subId *big.Int) (GetSubscription, - - error) - - GetSubscriptionLinkBalance(opts *bind.CallOpts) (*big.Int, error) - - IBeaconPeriodBlocks(opts *bind.CallOpts) (*big.Int, error) - - ILink(opts *bind.CallOpts) (common.Address, error) - - MigrationVersion(opts *bind.CallOpts) (uint8, error) - - OnMigration(opts *bind.CallOpts, arg0 []byte) error - - Owner(opts *bind.CallOpts) (common.Address, error) - - SCallbackConfig(opts *bind.CallOpts) (SCallbackConfig, - - error) - - SCoordinatorConfig(opts *bind.CallOpts) (SCoordinatorConfig, - - error) - - SPendingRequests(opts *bind.CallOpts, arg0 *big.Int) (SPendingRequests, - - error) - - SProducer(opts *bind.CallOpts) (common.Address, error) - - AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) - - AcceptSubscriptionOwnerTransfer(opts *bind.TransactOpts, subId *big.Int) (*types.Transaction, error) - - AddConsumer(opts *bind.TransactOpts, subId *big.Int, consumer common.Address) (*types.Transaction, error) - - BatchTransferLink(opts *bind.TransactOpts, recipients []common.Address, paymentsInJuels []*big.Int) (*types.Transaction, error) - - CancelSubscription(opts *bind.TransactOpts, subId *big.Int, to common.Address) (*types.Transaction, error) - - CreateSubscription(opts *bind.TransactOpts) (*types.Transaction, error) - - DeregisterMigratableCoordinator(opts *bind.TransactOpts, target common.Address) (*types.Transaction, error) - - Migrate(opts *bind.TransactOpts, newCoordinator common.Address, encodedRequest []byte) (*types.Transaction, error) - - OnTokenTransfer(opts *bind.TransactOpts, arg0 common.Address, amount *big.Int, data []byte) (*types.Transaction, error) - - ProcessVRFOutputs(opts *bind.TransactOpts, vrfOutputs []VRFBeaconTypesVRFOutput, juelsPerFeeCoin *big.Int, reasonableGasPrice uint64, blockHeight uint64) (*types.Transaction, error) - - RedeemRandomness(opts *bind.TransactOpts, subID *big.Int, requestID *big.Int, arg2 []byte) (*types.Transaction, error) - - RegisterMigratableCoordinator(opts *bind.TransactOpts, target common.Address) (*types.Transaction, error) - - RemoveConsumer(opts *bind.TransactOpts, subId *big.Int, consumer common.Address) (*types.Transaction, error) - - RequestRandomness(opts *bind.TransactOpts, subID *big.Int, numWords uint16, confDelay *big.Int, arg3 []byte) (*types.Transaction, error) - - RequestRandomnessFulfillment(opts *bind.TransactOpts, subID *big.Int, numWords uint16, confDelay *big.Int, callbackGasLimit uint32, arguments []byte, arg5 []byte) (*types.Transaction, error) - - RequestSubscriptionOwnerTransfer(opts *bind.TransactOpts, subId *big.Int, newOwner common.Address) (*types.Transaction, error) - - SetCallbackConfig(opts *bind.TransactOpts, config VRFCoordinatorCallbackConfig) (*types.Transaction, error) - - SetConfirmationDelays(opts *bind.TransactOpts, confDelays [8]*big.Int) (*types.Transaction, error) - - SetCoordinatorConfig(opts *bind.TransactOpts, coordinatorConfig VRFBeaconTypesCoordinatorConfig) (*types.Transaction, error) - - SetPauseFlag(opts *bind.TransactOpts, pause bool) (*types.Transaction, error) - - SetProducer(opts *bind.TransactOpts, producer common.Address) (*types.Transaction, error) - - TransferLink(opts *bind.TransactOpts, recipient common.Address, juelsAmount *big.Int) (*types.Transaction, error) - - TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) - - FilterCallbackConfigSet(opts *bind.FilterOpts) (*VRFCoordinatorCallbackConfigSetIterator, error) - - WatchCallbackConfigSet(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorCallbackConfigSet) (event.Subscription, error) - - ParseCallbackConfigSet(log types.Log) (*VRFCoordinatorCallbackConfigSet, error) - - FilterCoordinatorConfigSet(opts *bind.FilterOpts) (*VRFCoordinatorCoordinatorConfigSetIterator, error) - - WatchCoordinatorConfigSet(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorCoordinatorConfigSet) (event.Subscription, error) - - ParseCoordinatorConfigSet(log types.Log) (*VRFCoordinatorCoordinatorConfigSet, error) - - FilterCoordinatorDeregistered(opts *bind.FilterOpts) (*VRFCoordinatorCoordinatorDeregisteredIterator, error) - - WatchCoordinatorDeregistered(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorCoordinatorDeregistered) (event.Subscription, error) - - ParseCoordinatorDeregistered(log types.Log) (*VRFCoordinatorCoordinatorDeregistered, error) - - FilterCoordinatorRegistered(opts *bind.FilterOpts) (*VRFCoordinatorCoordinatorRegisteredIterator, error) - - WatchCoordinatorRegistered(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorCoordinatorRegistered) (event.Subscription, error) - - ParseCoordinatorRegistered(log types.Log) (*VRFCoordinatorCoordinatorRegistered, error) - - FilterMigrationCompleted(opts *bind.FilterOpts, newVersion []uint8, subID []*big.Int) (*VRFCoordinatorMigrationCompletedIterator, error) - - WatchMigrationCompleted(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorMigrationCompleted, newVersion []uint8, subID []*big.Int) (event.Subscription, error) - - ParseMigrationCompleted(log types.Log) (*VRFCoordinatorMigrationCompleted, error) - - FilterOutputsServed(opts *bind.FilterOpts) (*VRFCoordinatorOutputsServedIterator, error) - - WatchOutputsServed(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorOutputsServed) (event.Subscription, error) - - ParseOutputsServed(log types.Log) (*VRFCoordinatorOutputsServed, error) - - FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*VRFCoordinatorOwnershipTransferRequestedIterator, error) - - WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferRequested(log types.Log) (*VRFCoordinatorOwnershipTransferRequested, error) - - FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*VRFCoordinatorOwnershipTransferredIterator, error) - - WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferred(log types.Log) (*VRFCoordinatorOwnershipTransferred, error) - - FilterPauseFlagChanged(opts *bind.FilterOpts) (*VRFCoordinatorPauseFlagChangedIterator, error) - - WatchPauseFlagChanged(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorPauseFlagChanged) (event.Subscription, error) - - ParsePauseFlagChanged(log types.Log) (*VRFCoordinatorPauseFlagChanged, error) - - FilterRandomWordsFulfilled(opts *bind.FilterOpts) (*VRFCoordinatorRandomWordsFulfilledIterator, error) - - WatchRandomWordsFulfilled(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorRandomWordsFulfilled) (event.Subscription, error) - - ParseRandomWordsFulfilled(log types.Log) (*VRFCoordinatorRandomWordsFulfilled, error) - - FilterRandomnessFulfillmentRequested(opts *bind.FilterOpts, requestID []*big.Int) (*VRFCoordinatorRandomnessFulfillmentRequestedIterator, error) - - WatchRandomnessFulfillmentRequested(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorRandomnessFulfillmentRequested, requestID []*big.Int) (event.Subscription, error) - - ParseRandomnessFulfillmentRequested(log types.Log) (*VRFCoordinatorRandomnessFulfillmentRequested, error) - - FilterRandomnessRedeemed(opts *bind.FilterOpts, requestID []*big.Int, requester []common.Address) (*VRFCoordinatorRandomnessRedeemedIterator, error) - - WatchRandomnessRedeemed(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorRandomnessRedeemed, requestID []*big.Int, requester []common.Address) (event.Subscription, error) - - ParseRandomnessRedeemed(log types.Log) (*VRFCoordinatorRandomnessRedeemed, error) - - FilterRandomnessRequested(opts *bind.FilterOpts, requestID []*big.Int) (*VRFCoordinatorRandomnessRequestedIterator, error) - - WatchRandomnessRequested(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorRandomnessRequested, requestID []*big.Int) (event.Subscription, error) - - ParseRandomnessRequested(log types.Log) (*VRFCoordinatorRandomnessRequested, error) - - FilterSubscriptionCanceled(opts *bind.FilterOpts, subId []*big.Int) (*VRFCoordinatorSubscriptionCanceledIterator, error) - - WatchSubscriptionCanceled(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorSubscriptionCanceled, subId []*big.Int) (event.Subscription, error) - - ParseSubscriptionCanceled(log types.Log) (*VRFCoordinatorSubscriptionCanceled, error) - - FilterSubscriptionConsumerAdded(opts *bind.FilterOpts, subId []*big.Int) (*VRFCoordinatorSubscriptionConsumerAddedIterator, error) - - WatchSubscriptionConsumerAdded(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorSubscriptionConsumerAdded, subId []*big.Int) (event.Subscription, error) - - ParseSubscriptionConsumerAdded(log types.Log) (*VRFCoordinatorSubscriptionConsumerAdded, error) - - FilterSubscriptionConsumerRemoved(opts *bind.FilterOpts, subId []*big.Int) (*VRFCoordinatorSubscriptionConsumerRemovedIterator, error) - - WatchSubscriptionConsumerRemoved(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorSubscriptionConsumerRemoved, subId []*big.Int) (event.Subscription, error) - - ParseSubscriptionConsumerRemoved(log types.Log) (*VRFCoordinatorSubscriptionConsumerRemoved, error) - - FilterSubscriptionCreated(opts *bind.FilterOpts, subId []*big.Int, owner []common.Address) (*VRFCoordinatorSubscriptionCreatedIterator, error) - - WatchSubscriptionCreated(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorSubscriptionCreated, subId []*big.Int, owner []common.Address) (event.Subscription, error) - - ParseSubscriptionCreated(log types.Log) (*VRFCoordinatorSubscriptionCreated, error) - - FilterSubscriptionFunded(opts *bind.FilterOpts, subId []*big.Int) (*VRFCoordinatorSubscriptionFundedIterator, error) - - WatchSubscriptionFunded(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorSubscriptionFunded, subId []*big.Int) (event.Subscription, error) - - ParseSubscriptionFunded(log types.Log) (*VRFCoordinatorSubscriptionFunded, error) - - FilterSubscriptionOwnerTransferRequested(opts *bind.FilterOpts, subId []*big.Int) (*VRFCoordinatorSubscriptionOwnerTransferRequestedIterator, error) - - WatchSubscriptionOwnerTransferRequested(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorSubscriptionOwnerTransferRequested, subId []*big.Int) (event.Subscription, error) - - ParseSubscriptionOwnerTransferRequested(log types.Log) (*VRFCoordinatorSubscriptionOwnerTransferRequested, error) - - FilterSubscriptionOwnerTransferred(opts *bind.FilterOpts, subId []*big.Int) (*VRFCoordinatorSubscriptionOwnerTransferredIterator, error) - - WatchSubscriptionOwnerTransferred(opts *bind.WatchOpts, sink chan<- *VRFCoordinatorSubscriptionOwnerTransferred, subId []*big.Int) (event.Subscription, error) - - ParseSubscriptionOwnerTransferred(log types.Log) (*VRFCoordinatorSubscriptionOwnerTransferred, error) - - ParseLog(log types.Log) (generated.AbigenLog, error) - - Address() common.Address -} diff --git a/core/gethwrappers/ocr2vrf/generation/generated-wrapper-dependency-versions-do-not-edit.txt b/core/gethwrappers/ocr2vrf/generation/generated-wrapper-dependency-versions-do-not-edit.txt deleted file mode 100644 index ce0b1a09702..00000000000 --- a/core/gethwrappers/ocr2vrf/generation/generated-wrapper-dependency-versions-do-not-edit.txt +++ /dev/null @@ -1,7 +0,0 @@ -GETH_VERSION: 1.12.0 -dkg: ../../../contracts/solc/v0.8.19/DKG.abi ../../../contracts/solc/v0.8.19/DKG.bin 02549733c46e50ba393c2521e39d4ec55b6a5d9a66baf4406b1a515b20470425 -load_test_beacon_consumer: ../../../contracts/solc/v0.8.19/LoadTestBeaconVRFConsumer.abi ../../../contracts/solc/v0.8.19/LoadTestBeaconVRFConsumer.bin 7306576bc1db6c0a4f0a8a83dd4c08e3078afa73b72858f7d1eaa410d1128fd2 -vrf_beacon: ../../../contracts/solc/v0.8.19/VRFBeacon.abi ../../../contracts/solc/v0.8.19/VRFBeacon.bin 63107992adf02024afccbe77fdf973777548dcd4d9af1484c8449aca6de30f4c -vrf_beacon_consumer: ../../../contracts/solc/v0.8.19/BeaconVRFConsumer.abi ../../../contracts/solc/v0.8.19/BeaconVRFConsumer.bin 520f1c24e4d926a4eb6c9504506b55b79a35ae8cc65ee02d28309a7d5b735a53 -vrf_beacon_coordinator: ../../../contracts/solc/v0.8.15/VRFBeaconCoordinator.abi ../../../contracts/solc/v0.8.15/VRFBeaconCoordinator.bin 08da747a3488fcd318ddc0db75fd0df7c07a100b2e19061f0efcb12a7180ecde -vrf_coordinator: ../../../contracts/solc/v0.8.19/VRFCoordinator.abi ../../../contracts/solc/v0.8.19/VRFCoordinator.bin 295bec795ab8c1ef08b6b27a67bab7f06233660e8a2f389211e470cc2b58c5ea diff --git a/core/gethwrappers/ocr2vrf/go_generate.go b/core/gethwrappers/ocr2vrf/go_generate.go deleted file mode 100644 index 475bf7e8f67..00000000000 --- a/core/gethwrappers/ocr2vrf/go_generate.go +++ /dev/null @@ -1,10 +0,0 @@ -// Package gethwrappers provides tools for wrapping solidity contracts with -// golang packages, using abigen. -package gethwrappers - -// OCR2VRF - remove the _disabled tag to run these locally. -//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/DKG.abi ../../../contracts/solc/v0.8.19/DKG.bin DKG dkg -//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/VRFCoordinator.abi ../../../contracts/solc/v0.8.19/VRFCoordinator.bin VRFCoordinator vrf_coordinator -//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/VRFBeacon.abi ../../../contracts/solc/v0.8.19/VRFBeacon.bin VRFBeacon vrf_beacon -//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/BeaconVRFConsumer.abi ../../../contracts/solc/v0.8.19/BeaconVRFConsumer.bin BeaconVRFConsumer vrf_beacon_consumer -//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/LoadTestBeaconVRFConsumer.abi ../../../contracts/solc/v0.8.19/LoadTestBeaconVRFConsumer.bin LoadTestBeaconVRFConsumer load_test_beacon_consumer diff --git a/core/internal/cltest/cltest.go b/core/internal/cltest/cltest.go index 724af71b4af..508dde86a05 100644 --- a/core/internal/cltest/cltest.go +++ b/core/internal/cltest/cltest.go @@ -69,8 +69,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/aptoskey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/cosmoskey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/csakey" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgencryptkey" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgsignkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocrkey" @@ -120,17 +118,15 @@ var ( DefaultP2PPeerID p2pkey.PeerID FixtureChainID = *testutils.FixtureChainID - DefaultCosmosKey = cosmoskey.MustNewInsecure(keystest.NewRandReaderFromSeed(KeyBigIntSeed)) - DefaultCSAKey = csakey.MustNewV2XXXTestingOnly(big.NewInt(KeyBigIntSeed)) - DefaultOCRKey = ocrkey.MustNewV2XXXTestingOnly(big.NewInt(KeyBigIntSeed)) - DefaultOCR2Key = ocr2key.MustNewInsecure(keystest.NewRandReaderFromSeed(KeyBigIntSeed), "evm") - DefaultP2PKey = p2pkey.MustNewV2XXXTestingOnly(big.NewInt(KeyBigIntSeed)) - DefaultSolanaKey = solkey.MustNewInsecure(keystest.NewRandReaderFromSeed(KeyBigIntSeed)) - DefaultStarkNetKey = starkkey.MustNewInsecure(keystest.NewRandReaderFromSeed(KeyBigIntSeed)) - DefaultAptosKey = aptoskey.MustNewInsecure(keystest.NewRandReaderFromSeed(KeyBigIntSeed)) - DefaultVRFKey = vrfkey.MustNewV2XXXTestingOnly(big.NewInt(KeyBigIntSeed)) - DefaultDKGSignKey = dkgsignkey.MustNewXXXTestingOnly(big.NewInt(KeyBigIntSeed)) - DefaultDKGEncryptKey = dkgencryptkey.MustNewXXXTestingOnly(big.NewInt(KeyBigIntSeed)) + DefaultCosmosKey = cosmoskey.MustNewInsecure(keystest.NewRandReaderFromSeed(KeyBigIntSeed)) + DefaultCSAKey = csakey.MustNewV2XXXTestingOnly(big.NewInt(KeyBigIntSeed)) + DefaultOCRKey = ocrkey.MustNewV2XXXTestingOnly(big.NewInt(KeyBigIntSeed)) + DefaultOCR2Key = ocr2key.MustNewInsecure(keystest.NewRandReaderFromSeed(KeyBigIntSeed), "evm") + DefaultP2PKey = p2pkey.MustNewV2XXXTestingOnly(big.NewInt(KeyBigIntSeed)) + DefaultSolanaKey = solkey.MustNewInsecure(keystest.NewRandReaderFromSeed(KeyBigIntSeed)) + DefaultStarkNetKey = starkkey.MustNewInsecure(keystest.NewRandReaderFromSeed(KeyBigIntSeed)) + DefaultAptosKey = aptoskey.MustNewInsecure(keystest.NewRandReaderFromSeed(KeyBigIntSeed)) + DefaultVRFKey = vrfkey.MustNewV2XXXTestingOnly(big.NewInt(KeyBigIntSeed)) ) func init() { diff --git a/core/internal/mocks/go_generate.go b/core/internal/mocks/go_generate.go index f3f5f0ae2ca..07a16c2b6cc 100644 --- a/core/internal/mocks/go_generate.go +++ b/core/internal/mocks/go_generate.go @@ -4,5 +4,3 @@ package mocks //go:generate mockery --quiet --srcpkg github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/flags_wrapper --name FlagsInterface --output . --case=underscore --structname Flags --filename flags.go //go:generate mockery --quiet --srcpkg github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/aggregator_v3_interface --name AggregatorV3InterfaceInterface --output ../../services/vrf/mocks/ --case=underscore --structname AggregatorV3Interface --filename aggregator_v3_interface.go //go:generate mockery --quiet --srcpkg github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_coordinator_v2 --name VRFCoordinatorV2Interface --output ../../services/vrf/mocks/ --case=underscore --structname VRFCoordinatorV2Interface --filename vrf_coordinator_v2.go -//go:generate mockery --quiet --srcpkg github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon --name VRFBeaconInterface --output ../../services/ocr2/plugins/ocr2vrf/coordinator/mocks --case=underscore --structname VRFBeaconInterface --filename vrf_beacon.go -//go:generate mockery --quiet --srcpkg github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_coordinator --name VRFCoordinatorInterface --output ../../services/ocr2/plugins/ocr2vrf/coordinator/mocks --case=underscore --structname VRFCoordinatorInterface --filename vrf_coordinator.go diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 3f8027c50e7..5bbaddddabe 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -25,7 +25,6 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-common v0.1.7-0.20240702120320-563bf07487fe - 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-20240702141926-063ceef8c42e github.com/spf13/cobra v1.8.0 @@ -34,7 +33,6 @@ require ( github.com/umbracle/ethgo v0.1.3 github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722 github.com/urfave/cli v1.22.14 - go.dedis.ch/kyber/v3 v3.1.0 google.golang.org/protobuf v1.33.0 k8s.io/api v0.30.0 k8s.io/apimachinery v0.30.0 @@ -272,7 +270,6 @@ require ( github.com/sethvargo/go-retry v0.2.4 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/shirou/gopsutil/v3 v3.24.3 // indirect - github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/chain-selectors v1.0.10 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240621143432-85370a54b141 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240702144807-761f63e7b527 // indirect @@ -315,6 +312,7 @@ require ( github.com/zondax/hid v0.9.1 // indirect github.com/zondax/ledger-go v0.14.1 // indirect go.dedis.ch/fixbuf v1.0.3 // indirect + go.dedis.ch/kyber/v3 v3.1.0 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.mongodb.org/mongo-driver v1.15.0 // indirect go.opencensus.io v0.24.0 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index d6e824797a4..b8d4bada6ff 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1225,8 +1225,6 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240703132526-6362ffb9640 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240703132526-6362ffb96401/go.mod h1:NbXXQaNFskVMYRut0MvBlcHu/vDgipGMwYjamvjVB9Y= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240625074951-06ab5e670dba h1:YNSlhK5mobyAaw02LPGgIEuS3lXyCTXcc6oaV2L6uUI= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240625074951-06ab5e670dba/go.mod h1:UVFRacRkP7O7TQAzFmR52v5mUlxf+G1ovMlCQAB/cHU= -github.com/smartcontractkit/chainlink-vrf v0.0.0-20240222010609-cd67d123c772 h1:LQmRsrzzaYYN3wEU1l5tWiccznhvbyGnu2N+wHSXZAo= -github.com/smartcontractkit/chainlink-vrf v0.0.0-20240222010609-cd67d123c772/go.mod h1:Kn1Hape05UzFZ7bOUnm3GVsHzP0TNrVmpfXYNHdqGGs= github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16 h1:TFe+FvzxClblt6qRfqEhUfa4kFQx5UobuoFGO2W4mMo= github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= @@ -1414,7 +1412,6 @@ go.dedis.ch/kyber/v3 v3.1.0 h1:ghu+kiRgM5JyD9TJ0hTIxTLQlJBR/ehjWvWwYW3XsC0= go.dedis.ch/kyber/v3 v3.1.0/go.mod h1:kXy7p3STAurkADD+/aZcsznZGKVHEqbtmdIzvPfrs1U= go.dedis.ch/protobuf v1.0.5/go.mod h1:eIV4wicvi6JK0q/QnfIEGeSFNG0ZeB24kzut5+HaRLo= go.dedis.ch/protobuf v1.0.7/go.mod h1:pv5ysfkDX/EawiPqcW3ikOxsL5t+BqnV6xHSmE79KI4= -go.dedis.ch/protobuf v1.0.11 h1:FTYVIEzY/bfl37lu3pR4lIj+F9Vp1jE8oh91VmxKgLo= go.dedis.ch/protobuf v1.0.11/go.mod h1:97QR256dnkimeNdfmURz0wAMNVbd1VmLXhG1CrTYrJ4= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= @@ -1716,7 +1713,6 @@ golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/core/scripts/ocr2vrf/main.go b/core/scripts/ocr2vrf/main.go deleted file mode 100644 index e7da4589951..00000000000 --- a/core/scripts/ocr2vrf/main.go +++ /dev/null @@ -1,455 +0,0 @@ -package main - -import ( - "context" - "flag" - "fmt" - "math/big" - "os" - "strings" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/shopspring/decimal" - - ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" - - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" -) - -type commonSetConfigArgs struct { - onchainPubKeys string - offchainPubKeys string - configPubKeys string - peerIDs string - transmitters string - schedule string - f uint - deltaProgress time.Duration - deltaResend time.Duration - deltaRound time.Duration - deltaGrace time.Duration - deltaStage time.Duration - maxRounds uint8 - maxDurationQuery time.Duration - maxDurationObservation time.Duration - maxDurationReport time.Duration - maxDurationAccept time.Duration - maxDurationTransmit time.Duration -} - -type dkgSetConfigArgs struct { - commonSetConfigArgs - dkgEncryptionPubKeys string - dkgSigningPubKeys string - keyID string -} - -type vrfBeaconSetConfigArgs struct { - commonSetConfigArgs - confDelays string - coordinatorConfig ocr2vrftypes.CoordinatorConfig -} - -func main() { - e := helpers.SetupEnv(false) - - switch os.Args[1] { - case "dkg-deploy": - deployDKG(e) - case "coordinator-deploy": - cmd := flag.NewFlagSet("coordinator-deploy", flag.ExitOnError) - beaconPeriodBlocks := cmd.Int64("beacon-period-blocks", 1, "beacon period in number of blocks") - linkAddress := cmd.String("link-address", "", "link contract address") - linkEthFeed := cmd.String("link-eth-feed", "", "link/eth feed address") - helpers.ParseArgs(cmd, os.Args[2:], "beacon-period-blocks", "link-address", "link-eth-feed") - deployVRFCoordinator(e, big.NewInt(*beaconPeriodBlocks), *linkAddress, *linkEthFeed) - case "beacon-deploy": - cmd := flag.NewFlagSet("beacon-deploy", flag.ExitOnError) - coordinatorAddress := cmd.String("coordinator-address", "", "coordinator contract address") - linkAddress := cmd.String("link-address", "", "link contract address") - dkgAddress := cmd.String("dkg-address", "", "dkg contract address") - keyID := cmd.String("key-id", "", "key ID") - helpers.ParseArgs(cmd, os.Args[2:], "beacon-deploy", "coordinator-address", "link-address", "dkg-address", "key-id") - deployVRFBeacon(e, *coordinatorAddress, *linkAddress, *dkgAddress, *keyID) - case "dkg-add-client": - cmd := flag.NewFlagSet("dkg-add-client", flag.ExitOnError) - dkgAddress := cmd.String("dkg-address", "", "DKG contract address") - keyID := cmd.String("key-id", "", "key ID") - clientAddress := cmd.String("client-address", "", "client address") - helpers.ParseArgs(cmd, os.Args[2:], "dkg-address", "key-id", "client-address") - addClientToDKG(e, *dkgAddress, *keyID, *clientAddress) - case "dkg-remove-client": - cmd := flag.NewFlagSet("dkg-add-client", flag.ExitOnError) - dkgAddress := cmd.String("dkg-address", "", "DKG contract address") - keyID := cmd.String("key-id", "", "key ID") - clientAddress := cmd.String("client-address", "", "client address") - helpers.ParseArgs(cmd, os.Args[2:], "dkg-address", "key-id", "client-address") - removeClientFromDKG(e, *dkgAddress, *keyID, *clientAddress) - case "dkg-set-config": - cmd := flag.NewFlagSet("dkg-set-config", flag.ExitOnError) - dkgAddress := cmd.String("dkg-address", "", "DKG contract address") - keyID := cmd.String("key-id", "", "key ID") - onchainPubKeys := cmd.String("onchain-pub-keys", "", "comma-separated list of OCR on-chain pubkeys") - offchainPubKeys := cmd.String("offchain-pub-keys", "", "comma-separated list of OCR off-chain pubkeys") - configPubKeys := cmd.String("config-pub-keys", "", "comma-separated list of OCR config pubkeys") - peerIDs := cmd.String("peer-ids", "", "comma-separated list of peer IDs") - transmitters := cmd.String("transmitters", "", "comma-separated list transmitters") - dkgEncryptionPubKeys := cmd.String("dkg-encryption-pub-keys", "", "comma-separated list of DKG encryption pubkeys") - dkgSigningPubKeys := cmd.String("dkg-signing-pub-keys", "", "comma-separated list of DKG signing pubkeys") - schedule := cmd.String("schedule", "", "comma-separted list of transmission schedule") - f := cmd.Uint("f", 1, "number of faulty oracles") - deltaProgress := cmd.Duration("delta-progress", 30*time.Second, "duration of delta progress") - deltaResend := cmd.Duration("delta-resend", 10*time.Second, "duration of delta resend") - deltaRound := cmd.Duration("delta-round", 10*time.Second, "duration of delta round") - deltaGrace := cmd.Duration("delta-grace", 20*time.Second, "duration of delta grace") - deltaStage := cmd.Duration("delta-stage", 20*time.Second, "duration of delta stage") - maxRounds := cmd.Uint("max-rounds", 3, "maximum number of rounds") - maxDurationQuery := cmd.Duration("max-duration-query", 10*time.Millisecond, "maximum duration of query") - maxDurationObservation := cmd.Duration("max-duration-observation", 10*time.Second, "maximum duration of observation method") - maxDurationReport := cmd.Duration("max-duration-report", 10*time.Second, "maximum duration of report method") - maxDurationAccept := cmd.Duration("max-duration-accept", 10*time.Millisecond, "maximum duration of shouldAcceptFinalizedReport method") - maxDurationTransmit := cmd.Duration("max-duration-transmit", 1*time.Second, "maximum duration of shouldTransmitAcceptedReport method") - - helpers.ParseArgs(cmd, - os.Args[2:], - "dkg-address", - "key-id", - "onchain-pub-keys", - "offchain-pub-keys", - "config-pub-keys", - "peer-ids", - "transmitters", - "dkg-encryption-pub-keys", - "dkg-signing-pub-keys", - "schedule") - - commands := dkgSetConfigArgs{ - commonSetConfigArgs: commonSetConfigArgs{ - onchainPubKeys: *onchainPubKeys, - offchainPubKeys: *offchainPubKeys, - configPubKeys: *configPubKeys, - peerIDs: *peerIDs, - transmitters: *transmitters, - schedule: *schedule, - f: *f, - deltaProgress: *deltaProgress, - deltaResend: *deltaResend, - deltaRound: *deltaRound, - deltaGrace: *deltaGrace, - deltaStage: *deltaStage, - maxRounds: uint8(*maxRounds), - maxDurationQuery: *maxDurationQuery, - maxDurationObservation: *maxDurationObservation, - maxDurationReport: *maxDurationReport, - maxDurationAccept: *maxDurationAccept, - maxDurationTransmit: *maxDurationTransmit, - }, - dkgEncryptionPubKeys: *dkgEncryptionPubKeys, - dkgSigningPubKeys: *dkgSigningPubKeys, - keyID: *keyID, - } - - setDKGConfig(e, *dkgAddress, commands) - case "beacon-set-config": - cmd := flag.NewFlagSet("beacon-set-config", flag.ExitOnError) - beaconAddress := cmd.String("beacon-address", "", "VRF beacon contract address") - confDelays := cmd.String("conf-delays", "1,2,3,4,5,6,7,8", "comma-separted list of 8 confirmation delays") - onchainPubKeys := cmd.String("onchain-pub-keys", "", "comma-separated list of OCR on-chain pubkeys") - offchainPubKeys := cmd.String("offchain-pub-keys", "", "comma-separated list of OCR off-chain pubkeys") - configPubKeys := cmd.String("config-pub-keys", "", "comma-separated list of OCR config pubkeys") - peerIDs := cmd.String("peer-ids", "", "comma-separated list of peer IDs") - transmitters := cmd.String("transmitters", "", "comma-separated list transmitters") - schedule := cmd.String("schedule", "", "comma-separted list of transmission schedule") - f := cmd.Uint("f", 1, "number of faulty oracles") - // TODO: Adjust default delta* and maxDuration* values below after benchmarking latency - deltaProgress := cmd.Duration("delta-progress", 30*time.Second, "duration of delta progress") - deltaResend := cmd.Duration("delta-resend", 10*time.Second, "duration of delta resend") - deltaRound := cmd.Duration("delta-round", 10*time.Second, "duration of delta round") - deltaGrace := cmd.Duration("delta-grace", 20*time.Second, "duration of delta grace") - deltaStage := cmd.Duration("delta-stage", 20*time.Second, "duration of delta stage") - cacheEvictionWindowSeconds := cmd.Int64("cache-eviction-window", 60, "cache eviction window, in seconds") - batchGasLimit := cmd.Int64("batch-gas-limit", 5_000_000, "batch gas limit") - coordinatorOverhead := cmd.Int64("coordinator-overhead", 50_000, "coordinator overhead") - callbackOverhead := cmd.Int64("callback-overhead", 50_000, "callback overhead") - blockGasOverhead := cmd.Int64("block-gas-overhead", 50_000, "block gas overhead") - lookbackBlocks := cmd.Uint64("lookback-blocks", 1000, "lookback blocks") - maxRounds := cmd.Uint("max-rounds", 3, "maximum number of rounds") - maxDurationQuery := cmd.Duration("max-duration-query", 10*time.Millisecond, "maximum duration of query") - maxDurationObservation := cmd.Duration("max-duration-observation", 10*time.Second, "maximum duration of observation method") - maxDurationReport := cmd.Duration("max-duration-report", 10*time.Second, "maximum duration of report method") - maxDurationAccept := cmd.Duration("max-duration-accept", 5*time.Second, "maximum duration of shouldAcceptFinalizedReport method") - maxDurationTransmit := cmd.Duration("max-duration-transmit", 1*time.Second, "maximum duration of shouldTransmitAcceptedReport method") - - helpers.ParseArgs(cmd, - os.Args[2:], - "beacon-address", - "onchain-pub-keys", - "offchain-pub-keys", - "config-pub-keys", - "peer-ids", - "transmitters", - "schedule") - - commands := vrfBeaconSetConfigArgs{ - commonSetConfigArgs: commonSetConfigArgs{ - onchainPubKeys: *onchainPubKeys, - offchainPubKeys: *offchainPubKeys, - configPubKeys: *configPubKeys, - peerIDs: *peerIDs, - transmitters: *transmitters, - schedule: *schedule, - f: *f, - deltaProgress: *deltaProgress, - deltaResend: *deltaResend, - deltaRound: *deltaRound, - deltaGrace: *deltaGrace, - deltaStage: *deltaStage, - maxRounds: uint8(*maxRounds), - maxDurationQuery: *maxDurationQuery, - maxDurationObservation: *maxDurationObservation, - maxDurationReport: *maxDurationReport, - maxDurationAccept: *maxDurationAccept, - maxDurationTransmit: *maxDurationTransmit, - }, - confDelays: *confDelays, - coordinatorConfig: ocr2vrftypes.CoordinatorConfig{ - CacheEvictionWindowSeconds: *cacheEvictionWindowSeconds, - BatchGasLimit: *batchGasLimit, - CoordinatorOverhead: *coordinatorOverhead, - CallbackOverhead: *callbackOverhead, - BlockGasOverhead: *blockGasOverhead, - LookbackBlocks: *lookbackBlocks, - }, - } - - commands.setVRFBeaconConfig(e, *beaconAddress) - case "coordinator-set-producer": - cmd := flag.NewFlagSet("coordinator-set-producer", flag.ExitOnError) - coordinatorAddress := cmd.String("coordinator-address", "", "VRF coordinator contract address") - beaconAddress := cmd.String("beacon-address", "", "VRF beacon contract address") - helpers.ParseArgs(cmd, os.Args[2:], "coordinator-address", "beacon-address") - setProducer(e, *coordinatorAddress, *beaconAddress) - case "coordinator-request-randomness": - cmd := flag.NewFlagSet("coordinator-request-randomness", flag.ExitOnError) - coordinatorAddress := cmd.String("coordinator-address", "", "VRF coordinator contract address") - numWords := cmd.Uint("num-words", 1, "number of words to request") - subID := cmd.String("sub-id", "", "subscription ID") - confDelay := cmd.Int64("conf-delay", 1, "confirmation delay") - helpers.ParseArgs(cmd, os.Args[2:], "coordinator-address", "sub-id") - requestRandomness( - e, - *coordinatorAddress, - uint16(*numWords), - decimal.RequireFromString(*subID).BigInt(), - big.NewInt(*confDelay)) - case "coordinator-redeem-randomness": - cmd := flag.NewFlagSet("coordinator-redeem-randomness", flag.ExitOnError) - coordinatorAddress := cmd.String("coordinator-address", "", "VRF coordinator contract address") - subID := cmd.String("sub-id", "", "subscription ID") - requestID := cmd.Int64("request-id", 0, "request ID") - helpers.ParseArgs(cmd, os.Args[2:], "coordinator-address", "sub-id", "request-id") - redeemRandomness( - e, - *coordinatorAddress, - decimal.RequireFromString(*subID).BigInt(), - big.NewInt(*requestID)) - case "beacon-info": - cmd := flag.NewFlagSet("beacon-info", flag.ExitOnError) - beaconAddress := cmd.String("beacon-address", "", "VRF beacon contract address") - helpers.ParseArgs(cmd, os.Args[2:], "beacon-address") - beacon := newVRFBeacon(common.HexToAddress(*beaconAddress), e.Ec) - keyID, err := beacon.SKeyID(nil) - helpers.PanicErr(err) - fmt.Println("beacon key id:", hexutil.Encode(keyID[:])) - keyHash, err := beacon.SProvingKeyHash(nil) - helpers.PanicErr(err) - fmt.Println("beacon proving key hash:", hexutil.Encode(keyHash[:])) - case "coordinator-create-sub": - cmd := flag.NewFlagSet("coordinator-create-sub", flag.ExitOnError) - coordinatorAddress := cmd.String("coordinator-address", "", "VRF coordinator contract address") - helpers.ParseArgs(cmd, os.Args[2:], "coordinator-address") - createSubscription(e, *coordinatorAddress) - case "coordinator-add-consumer": - cmd := flag.NewFlagSet("coordinator-add-consumer", flag.ExitOnError) - coordinatorAddress := cmd.String("coordinator-address", "", "VRF coordinator contract address") - consumerAddress := cmd.String("consumer-address", "", "VRF consumer contract address") - subId := cmd.String("sub-id", "", "subscription ID") - helpers.ParseArgs(cmd, os.Args[2:], "coordinator-address", "consumer-address") - addConsumer(e, *coordinatorAddress, *consumerAddress, decimal.RequireFromString(*subId).BigInt()) - case "coordinator-get-sub": - cmd := flag.NewFlagSet("coordinator-get-sub", flag.ExitOnError) - coordinatorAddress := cmd.String("coordinator-address", "", "VRF coordinator contract address") - subId := cmd.String("sub-id", "", "subscription ID") - helpers.ParseArgs(cmd, os.Args[2:], "coordinator-address") - sub := getSubscription(e, *coordinatorAddress, decimal.RequireFromString(*subId).BigInt()) - fmt.Println("subscription ID:", *subId) - fmt.Println("balance:", sub.Balance) - fmt.Println("consumers:", sub.Consumers) - fmt.Println("owner:", sub.Owner) - case "link-balance": - cmd := flag.NewFlagSet("link-balance", flag.ExitOnError) - linkAddress := cmd.String("link-address", "", "link address") - helpers.ParseArgs(cmd, os.Args[2:], "link-address") - - l, err := link_token_interface.NewLinkToken(common.HexToAddress(*linkAddress), e.Ec) - helpers.PanicErr(err) - - bal, err := l.BalanceOf(nil, e.Owner.From) - helpers.PanicErr(err) - fmt.Println("link balance of", e.Owner.From, "is", assets.NewWei(bal).String()) - case "get-balances": - cmd := flag.NewFlagSet("get-balances", flag.ExitOnError) - addresses := cmd.String("addresses", "", "comma-separated list of addresses") - helpers.ParseArgs(cmd, os.Args[2:], "addresses") - - for _, account := range strings.Split(*addresses, ",") { - bal, err := e.Ec.BalanceAt(context.Background(), common.HexToAddress(account), nil) - helpers.PanicErr(err) - - fmt.Println("ETH balance of", account, "is", assets.NewWei(bal).String()) - } - case "coordinator-fund-sub": - cmd := flag.NewFlagSet("coordinator-fund-sub", flag.ExitOnError) - coordinatorAddress := cmd.String("coordinator-address", "", "VRF coordinator contract address") - linkAddress := cmd.String("link-address", "", "link-address") - fundingAmount := cmd.String("funding-amount", "5e18", "funding amount in juels. can use scientific notation, e.g 10e18 for 10 LINK") // 5 LINK - subID := cmd.String("sub-id", "", "subscription ID") - helpers.ParseArgs(cmd, os.Args[2:], "coordinator-address", "link-address") - eoaFundSubscription(e, *coordinatorAddress, *linkAddress, decimal.RequireFromString(*fundingAmount).BigInt(), decimal.RequireFromString(*subID).BigInt()) - case "beacon-set-payees": - cmd := flag.NewFlagSet("beacon-set-payees", flag.ExitOnError) - beaconAddress := cmd.String("beacon-address", "", "VRF beacon contract address") - transmitters := cmd.String("transmitters", "", "comma-separated list of transmitters") - payees := cmd.String("payees", "", "comma-separated list of payees") - helpers.ParseArgs(cmd, os.Args[2:], "beacon-address", "transmitters", "payees") - setPayees(e, *beaconAddress, helpers.ParseAddressSlice(*transmitters), helpers.ParseAddressSlice(*payees)) - case "consumer-deploy": - cmd := flag.NewFlagSet("consumer-deploy", flag.ExitOnError) - coordinatorAddress := cmd.String("coordinator-address", "", "VRF coordinator address") - shouldFail := cmd.Bool("should-fail", false, "shouldFail flag") - beaconPeriodBlocks := cmd.Int64("beacon-period-blocks", 1, "beacon period in number of blocks") - helpers.ParseArgs(cmd, os.Args[2:], "coordinator-address", "beacon-period-blocks") - deployVRFBeaconCoordinatorConsumer(e, *coordinatorAddress, *shouldFail, big.NewInt(*beaconPeriodBlocks)) - case "consumer-request-randomness": - cmd := flag.NewFlagSet("consumer-request-randomness", flag.ExitOnError) - consumerAddress := cmd.String("consumer-address", "", "VRF coordinator consumer address") - numWords := cmd.Uint("num-words", 1, "number of words to request") - subID := cmd.String("sub-id", "", "subscription ID") - confDelay := cmd.Int64("conf-delay", 1, "confirmation delay") - helpers.ParseArgs(cmd, os.Args[2:], "consumer-address", "sub-id") - requestRandomnessFromConsumer(e, *consumerAddress, uint16(*numWords), decimal.RequireFromString(*subID).BigInt(), big.NewInt(*confDelay)) - case "consumer-redeem-randomness": - cmd := flag.NewFlagSet("consumer-redeem-randomness", flag.ExitOnError) - consumerAddress := cmd.String("consumer-address", "", "VRF coordinator consumer address") - subID := cmd.String("sub-id", "", "subscription ID") - requestID := cmd.String("request-id", "0", "request ID") - numWords := cmd.Int64("num-words", 1, "number of words to print after redeeming") - helpers.ParseArgs(cmd, os.Args[2:], "consumer-address", "request-id") - reqIdInt := decimal.RequireFromString(*requestID).BigInt() - redeemRandomnessFromConsumer(e, *consumerAddress, decimal.RequireFromString(*subID).BigInt(), reqIdInt, *numWords) - case "consumer-request-callback": - cmd := flag.NewFlagSet("consumer-request-callback", flag.ExitOnError) - consumerAddress := cmd.String("consumer-address", "", "VRF coordinator consumer address") - numWords := cmd.Uint("num-words", 1, "number of words to request") - subID := cmd.String("sub-id", "", "subscription ID") - confDelay := cmd.Int64("conf-delay", 1, "confirmation delay") - callbackGasLimit := cmd.Uint("cb-gas-limit", 100_000, "callback gas limit") - helpers.ParseArgs(cmd, os.Args[2:], "consumer-address") - requestRandomnessCallback( - e, - *consumerAddress, - uint16(*numWords), - decimal.RequireFromString(*subID).BigInt(), - big.NewInt(*confDelay), - uint32(*callbackGasLimit), - nil, // test consumer doesn't use any args - ) - case "consumer-read-randomness": - cmd := flag.NewFlagSet("consumer-read-randomness", flag.ExitOnError) - consumerAddress := cmd.String("consumer-address", "", "VRF coordinator consumer address") - requestID := cmd.String("request-id", "", "VRF request ID") - numWords := cmd.Int("num-words", 1, "number of words to fetch") - helpers.ParseArgs(cmd, os.Args[2:], "consumer-address") - readRandomness(e, *consumerAddress, decimal.RequireFromString(*requestID).BigInt(), *numWords) - case "consumer-request-callback-batch": - cmd := flag.NewFlagSet("consumer-request-callback", flag.ExitOnError) - consumerAddress := cmd.String("consumer-address", "", "VRF beacon consumer address") - numWords := cmd.Uint("num-words", 1, "number of words to request") - subID := cmd.String("sub-id", "", "subscription ID") - confDelay := cmd.Int64("conf-delay", 1, "confirmation delay") - batchSize := cmd.Int64("batch-size", 1, "batch size") - callbackGasLimit := cmd.Uint("cb-gas-limit", 200_000, "callback gas limit") - helpers.ParseArgs(cmd, os.Args[2:], "consumer-address") - requestRandomnessCallbackBatch( - e, - *consumerAddress, - uint16(*numWords), - decimal.RequireFromString(*subID).BigInt(), - big.NewInt(*confDelay), - uint32(*callbackGasLimit), - nil, // test consumer doesn't use any args, - big.NewInt(*batchSize), - ) - case "consumer-request-callback-batch-load-test": - cmd := flag.NewFlagSet("consumer-request-callback-load-test", flag.ExitOnError) - consumerAddress := cmd.String("consumer-address", "", "VRF beacon batch consumer address") - numWords := cmd.Uint("num-words", 1, "number of words to request") - subID := cmd.String("sub-id", "", "subscription ID") - confDelay := cmd.Int64("conf-delay", 1, "confirmation delay") - batchSize := cmd.Int64("batch-size", 1, "batch size") - batchCount := cmd.Int64("batch-count", 1, "number of batches to run") - callbackGasLimit := cmd.Uint("cb-gas-limit", 200_000, "callback gas limit") - helpers.ParseArgs(cmd, os.Args[2:], "consumer-address") - - for i := int64(0); i < *batchCount; i++ { - requestRandomnessCallbackBatch( - e, - *consumerAddress, - uint16(*numWords), - decimal.RequireFromString(*subID).BigInt(), - big.NewInt(*confDelay), - uint32(*callbackGasLimit), - nil, // test consumer doesn't use any args, - big.NewInt(*batchSize), - ) - } - case "deploy-load-test-consumer": - cmd := flag.NewFlagSet("deploy-load-test-consumer", flag.ExitOnError) - coordinatorAddress := cmd.String("coordinator-address", "", "coordinator address") - beaconPeriodBlocks := cmd.Int64("beacon-period-blocks", 1, "beacon period in number of blocks") - helpers.ParseArgs(cmd, os.Args[2:], "coordinator-address", "beacon-period-blocks") - - deployLoadTestVRFBeaconCoordinatorConsumer(e, *coordinatorAddress, false, big.NewInt(*beaconPeriodBlocks)) - case "get-load-test-results": - cmd := flag.NewFlagSet("get-load-test-results", flag.ExitOnError) - consumerAddress := cmd.String("consumer-address", "", "Load test contract address") - helpers.ParseArgs(cmd, os.Args[2:], "consumer-address") - - printLoadtestResults(e, *consumerAddress) - case "verify-beacon-randomness": - cmd := flag.NewFlagSet("verify-randomness", flag.ExitOnError) - dkgAddress := cmd.String("dkg-address", "", "DKG contract address") - beaconAddress := cmd.String("beacon-address", "", "VRF beacon contract address") - coordinatorAddress := cmd.String("coordinator-address", "", "VRF coordinator contract address") - height := cmd.Uint64("height", 0, "block height of VRF beacon output") - confDelay := cmd.Uint64("conf-delay", 1, "confirmation delay of VRF beacon output") - searchWindow := cmd.Uint64("search-window", 200, "search space size for beacon transmission. Number of blocks after beacon height") - helpers.ParseArgs(cmd, os.Args[2:], "dkg-address", "coordinator-address", "beacon-address", "height", "conf-delay") - - verifyBeaconRandomness(e, *dkgAddress, *beaconAddress, *coordinatorAddress, *height, *confDelay, *searchWindow) - case "dkg-setup": - setupDKGNodes(e) - case "ocr2vrf-setup": - setupOCR2VRFNodes(e) - case "ocr2vrf-setup-infra-forwarder": - setupOCR2VRFNodesForInfraWithForwarder(e) - case "ocr2vrf-fund-nodes": - fundOCR2VRFNodes(e) - default: - panic("unrecognized subcommand: " + os.Args[1]) - } -} diff --git a/core/scripts/ocr2vrf/readiness/main.go b/core/scripts/ocr2vrf/readiness/main.go deleted file mode 100644 index 9b43009d2f2..00000000000 --- a/core/scripts/ocr2vrf/readiness/main.go +++ /dev/null @@ -1,214 +0,0 @@ -package main - -import ( - "bytes" - "encoding/json" - "flag" - "fmt" - "io" - "os" - "strings" - - "github.com/urfave/cli" - - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - clcmd "github.com/smartcontractkit/chainlink/v2/core/cmd" - "github.com/smartcontractkit/chainlink/v2/core/web/presenters" -) - -func newApp(remoteNodeURL string, writer io.Writer) (*clcmd.Shell, *cli.App) { - prompter := clcmd.NewTerminalPrompter() - client := &clcmd.Shell{ - Renderer: clcmd.RendererJSON{Writer: writer}, - AppFactory: clcmd.ChainlinkAppFactory{}, - KeyStoreAuthenticator: clcmd.TerminalKeyStoreAuthenticator{Prompter: prompter}, - FallbackAPIInitializer: clcmd.NewPromptingAPIInitializer(prompter), - Runner: clcmd.ChainlinkRunner{}, - PromptingSessionRequestBuilder: clcmd.NewPromptingSessionRequestBuilder(prompter), - ChangePasswordPrompter: clcmd.NewChangePasswordPrompter(), - PasswordPrompter: clcmd.NewPasswordPrompter(), - } - app := clcmd.NewApp(client) - fs := flag.NewFlagSet("blah", flag.ContinueOnError) - fs.Bool("json", true, "") - fs.String("remote-node-url", remoteNodeURL, "") - helpers.PanicErr(app.Before(cli.NewContext(nil, fs, nil))) - // overwrite renderer since it's set to stdout after Before() is called - client.Renderer = clcmd.RendererJSON{Writer: writer} - return client, app -} - -var ( - remoteNodeURLs = flag.String("remote-node-urls", "", "remote node URL") - checkMarkEmoji = "✅" - xEmoji = "❌" - infoEmoji = "ℹ️" -) - -type ocr2Bundle struct { - ID string `json:"id"` - ChainType string `json:"chainType"` - OnchainPublicKey string `json:"onchainPublicKey"` - OffchainPublicKey string `json:"offchainPublicKey"` - ConfigPublicKey string `json:"configPublicKey"` -} - -func main() { - flag.Parse() - - if remoteNodeURLs == nil { - fmt.Println("flag -remote-node-urls required") - os.Exit(1) - } - - urls := strings.Split(*remoteNodeURLs, ",") - var ( - allDKGSignKeys []string - allDKGEncryptKeys []string - allOCR2KeyIDs []string - allOCR2OffchainPubkeys []string - allOCR2OnchainPubkeys []string - allOCR2ConfigPubkeys []string - allETHKeys []string - allPeerIDs []string - ) - for _, remoteNodeURL := range urls { - output := &bytes.Buffer{} - client, app := newApp(remoteNodeURL, output) - - // login first to establish the session - fmt.Println("logging in to:", remoteNodeURL) - loginFs := flag.NewFlagSet("test", flag.ContinueOnError) - loginFs.String("file", "", "") - loginFs.Bool("bypass-version-check", true, "") - loginCtx := cli.NewContext(app, loginFs, nil) - err := client.RemoteLogin(loginCtx) - helpers.PanicErr(err) - output.Reset() - fmt.Println() - - // check for DKG signing keys - err = clcmd.NewDKGSignKeysClient(client).ListKeys(&cli.Context{ - App: app, - }) - helpers.PanicErr(err) - var dkgSignKeys []presenters.DKGSignKeyResource - helpers.PanicErr(json.Unmarshal(output.Bytes(), &dkgSignKeys)) - switch len(dkgSignKeys) { - case 1: - fmt.Println(checkMarkEmoji, "found 1 DKG sign key on", remoteNodeURL) - case 0: - fmt.Println(xEmoji, "did not find any DKG sign keys on", remoteNodeURL, ", please create one") - default: - fmt.Println(infoEmoji, "found more than 1 DKG sign key on", remoteNodeURL, ", consider removing all but one") - } - output.Reset() - fmt.Println() - - // check for DKG encryption keys - err = clcmd.NewDKGEncryptKeysClient(client).ListKeys(&cli.Context{ - App: app, - }) - helpers.PanicErr(err) - var dkgEncryptKeys []presenters.DKGEncryptKeyResource - helpers.PanicErr(json.Unmarshal(output.Bytes(), &dkgEncryptKeys)) - switch len(dkgEncryptKeys) { - case 1: - fmt.Println(checkMarkEmoji, "found 1 DKG encrypt key on", remoteNodeURL) - case 0: - fmt.Println(xEmoji, "did not find any DKG encrypt keys on", remoteNodeURL, ", please create one") - default: - fmt.Println(infoEmoji, "found more than 1 DKG encrypt key on", remoteNodeURL, ", consider removing all but one") - } - output.Reset() - fmt.Println() - - // check for OCR2 keys - err = client.ListOCR2KeyBundles(&cli.Context{ - App: app, - }) - helpers.PanicErr(err) - var ocr2Keys []ocr2Bundle - helpers.PanicErr(json.Unmarshal(output.Bytes(), &ocr2Keys)) - ethBundle := func() *ocr2Bundle { - for _, b := range ocr2Keys { - if b.ChainType == "evm" { - return &b - } - } - return nil - }() - if ethBundle != nil { - fmt.Println(checkMarkEmoji, "found ocr evm key bundle on", remoteNodeURL) - } else { - fmt.Println(xEmoji, "did not find ocr evm key bundle on", remoteNodeURL, ", please create one") - } - output.Reset() - fmt.Println() - - // check for ETH keys - err = client.ListETHKeys(&cli.Context{ - App: app, - }) - helpers.PanicErr(err) - var ethKeys []presenters.ETHKeyResource - helpers.PanicErr(json.Unmarshal(output.Bytes(), ðKeys)) - switch { - case len(ethKeys) >= 5: - fmt.Println(checkMarkEmoji, "found", len(ethKeys), "eth keys on", remoteNodeURL) - case len(ethKeys) < 5: - fmt.Println(xEmoji, "found only", len(ethKeys), "eth keys on", remoteNodeURL, ", consider creating more") - } - output.Reset() - fmt.Println() - - // check for peer ids - err = client.ListP2PKeys(&cli.Context{ - App: app, - }) - helpers.PanicErr(err) - var p2pKeys []presenters.P2PKeyResource - helpers.PanicErr(json.Unmarshal(output.Bytes(), &p2pKeys)) - switch len(p2pKeys) { - case 1: - fmt.Println(checkMarkEmoji, "found P2P key on", remoteNodeURL) - case 0: - fmt.Println(xEmoji, "no P2P keys found on", remoteNodeURL, ", please create one") - default: - fmt.Println(infoEmoji, "found", len(p2pKeys), "P2P keys on", remoteNodeURL, ", consider removing all but one") - } - output.Reset() - fmt.Println() - - for _, dkgSign := range dkgSignKeys { - allDKGSignKeys = append(allDKGSignKeys, dkgSign.PublicKey) - } - for _, dkgEncrypt := range dkgEncryptKeys { - allDKGEncryptKeys = append(allDKGEncryptKeys, dkgEncrypt.PublicKey) - } - for _, ocr2Bundle := range ocr2Keys { - if ocr2Bundle.ChainType == "evm" { - allOCR2KeyIDs = append(allOCR2KeyIDs, ocr2Bundle.ID) - allOCR2ConfigPubkeys = append(allOCR2ConfigPubkeys, strings.TrimPrefix(ocr2Bundle.ConfigPublicKey, "ocr2cfg_evm_")) - allOCR2OffchainPubkeys = append(allOCR2OffchainPubkeys, strings.TrimPrefix(ocr2Bundle.OffchainPublicKey, "ocr2off_evm_")) - allOCR2OnchainPubkeys = append(allOCR2OnchainPubkeys, strings.TrimPrefix(ocr2Bundle.OnchainPublicKey, "ocr2on_evm_")) - } - } - for _, ethKey := range ethKeys { - allETHKeys = append(allETHKeys, ethKey.Address) - } - for _, peerKey := range p2pKeys { - allPeerIDs = append(allPeerIDs, strings.TrimPrefix(peerKey.PeerID, "p2p_")) - } - } - - fmt.Println("------------- NODE INFORMATION -------------") - fmt.Println("DKG sign keys:", strings.Join(allDKGSignKeys, ",")) - fmt.Println("DKG encrypt keys:", strings.Join(allDKGEncryptKeys, ",")) - fmt.Println("OCR2 key IDs:", strings.Join(allOCR2KeyIDs, ",")) - fmt.Println("OCR2 config public keys:", strings.Join(allOCR2ConfigPubkeys, ",")) - fmt.Println("OCR2 onchain public keys:", strings.Join(allOCR2OnchainPubkeys, ",")) - fmt.Println("OCR2 offchain public keys:", strings.Join(allOCR2OffchainPubkeys, ",")) - fmt.Println("ETH addresses:", strings.Join(allETHKeys, ",")) - fmt.Println("Peer IDs:", strings.Join(allPeerIDs, ",")) -} diff --git a/core/scripts/ocr2vrf/setup_dkg.go b/core/scripts/ocr2vrf/setup_dkg.go deleted file mode 100644 index 834e9177f21..00000000000 --- a/core/scripts/ocr2vrf/setup_dkg.go +++ /dev/null @@ -1,101 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "math/big" - "os" - "strings" - - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" -) - -func setupDKGNodes(e helpers.Environment) { - // Websocket URL & HTTP url required. - wsUrl := os.Getenv("ETH_URL") - httpUrl := os.Getenv("ETH_HTTP_URL") - if len(wsUrl) == 0 || len(httpUrl) == 0 { - fmt.Println("ETH_URL & ETH_HTTP_URL are required for this script.") - os.Exit(1) - } - - cmd := flag.NewFlagSet("dkg-setup", flag.ExitOnError) - keyID := cmd.String("key-id", "aee00d81f822f882b6fe28489822f59ebb21ea95c0ae21d9f67c0239461148fc", "key ID") - apiFile := cmd.String("api", "../../../tools/secrets/apicredentials", "api credentials file") - passwordFile := cmd.String("password", "../../../tools/secrets/password.txt", "password file") - databasePrefix := cmd.String("database-prefix", "postgres://postgres:postgres_password_padded_for_security@localhost:5432/dkg-test", "database prefix") - databaseSuffixes := cmd.String("database-suffixes", "sslmode=disable", "database parameters to be added") - nodeCount := cmd.Int("node-count", 6, "number of nodes") - fundingAmount := cmd.Int64("funding-amount", 10000000000000000, "amount to fund nodes") // .1 ETH - helpers.ParseArgs(cmd, os.Args[2:]) - - if *nodeCount < 6 { - fmt.Println("Node count too low for DKG job, need at least 6.") - os.Exit(1) - } - - //Deploy DKG contract. - // uncomment for faster txs - // e.Owner.GasPrice = e.Owner.GasPrice.Mul(e.Owner.GasPrice, big.NewInt(2)) - dkgAddress := deployDKG(e).String() - - // Initialize dkg-set-config arguments. - onChainPublicKeys := []string{} - offChainPublicKeys := []string{} - configPublicKeys := []string{} - peerIDs := []string{} - transmitters := []string{} - dkgEncrypters := []string{} - dkgSigners := []string{} - - // Iterate through all nodes and create jobs. - for i := 0; i < *nodeCount; i++ { - flagSet := flag.NewFlagSet("run-dkg-job-creation", flag.ExitOnError) - flagSet.String("api", *apiFile, "api file") - flagSet.String("password", *passwordFile, "password file") - flagSet.String("bootstrapPort", fmt.Sprintf("%d", 8000), "port of bootstrap") - flagSet.String("job-type", string(jobTypeDKG), "the job type") - flagSet.String("keyID", *keyID, "") - flagSet.String("contractID", dkgAddress, "the contract address of the DKG") - flagSet.Int64("chainID", e.ChainID, "the chain ID") - flagSet.Bool("dangerWillRobinson", true, "for resetting databases") - flagSet.Bool("isBootstrapper", i == 0, "is first node") - bootstrapperPeerID := "" - if len(peerIDs) != 0 { - bootstrapperPeerID = peerIDs[0] - } - flagSet.String("bootstrapperPeerID", bootstrapperPeerID, "peerID of first node") - - // Setup DKG node. - payload := SetupNode(e, flagSet, i, *databasePrefix, *databaseSuffixes, false, true, wsUrl, httpUrl) - - // Append arguments for dkg-set-config command. - onChainPublicKeys = append(onChainPublicKeys, payload.OnChainPublicKey) - offChainPublicKeys = append(offChainPublicKeys, payload.OffChainPublicKey) - configPublicKeys = append(configPublicKeys, payload.ConfigPublicKey) - peerIDs = append(peerIDs, payload.PeerID) - transmitters = append(transmitters, payload.Transmitter) - dkgEncrypters = append(dkgEncrypters, payload.DkgEncrypt) - dkgSigners = append(dkgSigners, payload.DkgSign) - } - - // Fund transmitters with funding amount. - helpers.FundNodes(e, transmitters, big.NewInt(*fundingAmount)) - - // Construct and print dkg-set-config command. - fmt.Println("Generated setConfig Command:") - command := fmt.Sprintf( - "go run . dkg-set-config --dkg-address %s -key-id %s -onchain-pub-keys %s -offchain-pub-keys %s -config-pub-keys %s -peer-ids %s -transmitters %s -dkg-encryption-pub-keys %s -dkg-signing-pub-keys %s -schedule 1,1,1,1,1", - dkgAddress, - *keyID, - strings.Join(onChainPublicKeys[1:], ","), - strings.Join(offChainPublicKeys[1:], ","), - strings.Join(configPublicKeys[1:], ","), - strings.Join(peerIDs[1:], ","), - strings.Join(transmitters[1:], ","), - strings.Join(dkgEncrypters[1:], ","), - strings.Join(dkgSigners[1:], ","), - ) - - fmt.Println(command) -} diff --git a/core/scripts/ocr2vrf/setup_ocr2vrf.go b/core/scripts/ocr2vrf/setup_ocr2vrf.go deleted file mode 100644 index 35d529b0262..00000000000 --- a/core/scripts/ocr2vrf/setup_ocr2vrf.go +++ /dev/null @@ -1,572 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "math/big" - "os" - "strings" - - "github.com/ethereum/go-ethereum/common" - "github.com/shopspring/decimal" - "github.com/urfave/cli" - - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - "github.com/smartcontractkit/chainlink/v2/core/cmd" -) - -type jobType string - -const ( - jobTypeDKG jobType = "DKG" - jobTypeOCR2VRF jobType = "OCR2VRF" -) - -func fundOCR2VRFNodes(e helpers.Environment) { - fs := flag.NewFlagSet("ocr2vrf-setup", flag.ExitOnError) - ethSendingKeysString := fs.String("eth-sending-keys", "", "eth sending keys") - fundingAmount := fs.String("funding-amount", "1e18", "funding amount in wei. can use scientific notation, e.g 10e18 for 10 ether") // 1 ETH - helpers.ParseArgs(fs, os.Args[2:], "eth-sending-keys") - - flatSendingKeys := strings.Split(*ethSendingKeysString, ",") - helpers.FundNodes(e, flatSendingKeys, decimal.RequireFromString(*fundingAmount).BigInt()) -} - -func setupOCR2VRFNodes(e helpers.Environment) { - // Websocket URL & HTTP url required. - wsUrl := os.Getenv("ETH_URL") - httpUrl := os.Getenv("ETH_HTTP_URL") - if len(wsUrl) == 0 || len(httpUrl) == 0 { - fmt.Println("ETH_URL & ETH_HTTP_URL are required for this script.") - os.Exit(1) - } - - fs := flag.NewFlagSet("ocr2vrf-setup", flag.ExitOnError) - - keyID := fs.String("key-id", "aee00d81f822f882b6fe28489822f59ebb21ea95c0ae21d9f67c0239461148fc", "key ID") - linkAddress := fs.String("link-address", "", "LINK token address") - linkEthFeed := fs.String("link-eth-feed", "", "LINK-ETH feed address") - useForwarder := fs.Bool("use-forwarder", false, "boolean to use the forwarder") - confDelays := fs.String("conf-delays", "1,2,3,4,5,6,7,8", "8 confirmation delays") - weiPerUnitLink := fs.String("wei-per-unit-link", "6e16", "wei per unit link price for feed") - beaconPeriodBlocks := fs.Int64("beacon-period-blocks", 3, "beacon period in blocks") - subscriptionBalanceString := fs.String("subscription-balance", "1e19", "amount to fund subscription") - maxCallbackGasLimit := fs.Uint("max-cb-gas-limit", 2.5e6, "max callback gas limit") - maxCallbackArgumentsLength := fs.Uint("max-cb-args-length", 32*10 /* 10 EVM words */, "max callback arguments length") - - apiFile := fs.String("api", "../../../tools/secrets/apicredentials", "api credentials file") - passwordFile := fs.String("password", "../../../tools/secrets/password.txt", "password file") - databasePrefix := fs.String("database-prefix", "postgres://postgres:postgres_password_padded_for_security@localhost:5432/ocr2vrf-test", "database prefix") - databaseSuffixes := fs.String("database-suffixes", "sslmode=disable", "database parameters to be added") - nodeCount := fs.Int("node-count", 6, "number of nodes") - fundingAmount := fs.Int64("funding-amount", 1e17, "amount to fund nodes") // .1 ETH - resetDatabase := fs.Bool("reset-database", true, "boolean to reset database") - - helpers.ParseArgs(fs, os.Args[2:]) - - if *nodeCount < 6 { - fmt.Println("Node count too low for OCR2VRF job, need at least 6.") - os.Exit(1) - } - - delays := helpers.ParseIntSlice(*confDelays) - if len(delays) != 8 { - fmt.Println("confDelays must have a length of 8") - os.Exit(1) - } - - var link common.Address - if *linkAddress == "" { - link = helpers.DeployLinkToken(e) - } else { - link = common.HexToAddress(*linkAddress) - } - - // Deploy DKG and VRF contracts, and add VRF - // as a consumer of DKG events. - fmt.Println("Deploying DKG contract...") - dkgAddress := deployDKG(e) - - // Deploy a new feed if needed - var feedAddress common.Address - if *linkEthFeed == "" { - fmt.Println("Deploying LINK-ETH feed...") - feedAddress = helpers.DeployLinkEthFeed(e, *linkAddress, decimal.RequireFromString(*weiPerUnitLink).BigInt()) - } else { - feedAddress = common.HexToAddress(*linkEthFeed) - } - - fmt.Println("Deploying VRF coordinator...") - vrfCoordinatorAddress, vrfCoordinator := deployVRFCoordinator(e, big.NewInt(*beaconPeriodBlocks), link.String(), feedAddress.String()) - - fmt.Println("Configuring VRF coordinator...") - configureVRFCoordinator(e, vrfCoordinator, uint32(*maxCallbackGasLimit), uint32(*maxCallbackArgumentsLength)) - - fmt.Println("Deploying VRF beacon...") - vrfBeaconAddress := deployVRFBeacon(e, vrfCoordinatorAddress.String(), link.String(), dkgAddress.String(), *keyID) - - fmt.Println("Adding VRF Beacon as DKG client...") - addClientToDKG(e, dkgAddress.String(), *keyID, vrfBeaconAddress.String()) - - fmt.Println("Adding VRF Beacon as producer in VRF Coordinator") - setProducer(e, vrfCoordinatorAddress.String(), vrfBeaconAddress.String()) - - fmt.Println("Deploying beacon consumer...") - consumerAddress := deployVRFBeaconCoordinatorConsumer(e, vrfCoordinatorAddress.String(), false, big.NewInt(*beaconPeriodBlocks)) - - fmt.Println("Creating subscription...") - createSubscription(e, vrfCoordinatorAddress.String()) - subID := findSubscriptionID(e, vrfCoordinatorAddress.String()) - - fmt.Println("Adding consumer to subscription...") - addConsumer(e, vrfCoordinatorAddress.String(), consumerAddress.String(), subID) - - subscriptionBalance := decimal.RequireFromString(*subscriptionBalanceString).BigInt() - if subscriptionBalance.Cmp(big.NewInt(0)) > 0 { - fmt.Println("\nFunding subscription with", subscriptionBalance, "juels...") - eoaFundSubscription(e, vrfCoordinatorAddress.String(), link.String(), subscriptionBalance, subID) - } else { - fmt.Println("Subscription", subID, "NOT getting funded. You must fund the subscription in order to use it!") - } - - var forwarderAddresses []common.Address - var forwarderAddressesStrings []string - // If using the forwarder, set up a forwarder for each node. - if *useForwarder { - fmt.Println("Deploying transaction forwarders...") - for i := 0; i < *nodeCount-1; i++ { - // Deploy an authorized forwarder, and add it to the list of forwarders. - f := deployAuthorizedForwarder(e, link, e.Owner.From) - forwarderAddresses = append(forwarderAddresses, f) - forwarderAddressesStrings = append(forwarderAddressesStrings, f.String()) - } - fmt.Printf("ForwarderAddresses : %v", forwarderAddressesStrings) - } - - fmt.Println("Deploying batch beacon consumer...") - loadTestConsumerAddress := deployLoadTestVRFBeaconCoordinatorConsumer(e, vrfCoordinatorAddress.String(), false, big.NewInt(*beaconPeriodBlocks)) - addConsumer(e, vrfCoordinatorAddress.String(), loadTestConsumerAddress.String(), subID) - - fmt.Println("Configuring nodes with OCR2VRF jobs...") - var ( - onChainPublicKeys []string - offChainPublicKeys []string - configPublicKeys []string - peerIDs []string - transmitters []string - dkgEncrypters []string - dkgSigners []string - sendingKeys [][]string - ) - - for i := 0; i < *nodeCount; i++ { - flagSet := flag.NewFlagSet("run-ocr2vrf-job-creation", flag.ExitOnError) - flagSet.String("api", *apiFile, "api file") - flagSet.String("password", *passwordFile, "password file") - flagSet.String("vrfpassword", *passwordFile, "vrf password file") - flagSet.String("bootstrapPort", fmt.Sprintf("%d", 8000), "port of bootstrap") - flagSet.Int64("chainID", e.ChainID, "the chain ID") - flagSet.Bool("applyInitServerConfig", true, "override for using initServerConfig in App.Before") - - flagSet.String("job-type", string(jobTypeOCR2VRF), "the job type") - - // used by bootstrap template instantiation - flagSet.String("contractID", dkgAddress.String(), "the contract to get peers from") - - // DKG args - flagSet.String("keyID", *keyID, "") - flagSet.String("dkg-address", dkgAddress.String(), "the contract address of the DKG") - - // VRF args - flagSet.String("vrf-beacon-address", vrfBeaconAddress.String(), "the contract address of the VRF Beacon") - flagSet.String("vrf-coordinator-address", vrfCoordinatorAddress.String(), "the contract address of the VRF Coordinator") - flagSet.String("link-eth-feed-address", feedAddress.Hex(), "link eth feed address") - - // Apply forwarder args if using the forwarder. - if i > 0 && *useForwarder { - flagSet.Bool("use-forwarder", *useForwarder, "use a transaction forwarder") - flagSet.String("forwarder-address", forwarderAddressesStrings[i-1], "transaction forwarder address") - } - - flagSet.Bool("dangerWillRobinson", *resetDatabase, "for resetting databases") - flagSet.Bool("isBootstrapper", i == 0, "is first node") - bootstrapperPeerID := "" - if len(peerIDs) != 0 { - bootstrapperPeerID = peerIDs[0] - } - flagSet.String("bootstrapperPeerID", bootstrapperPeerID, "peerID of first node") - - payload := SetupNode(e, flagSet, i, *databasePrefix, *databaseSuffixes, *useForwarder, *resetDatabase, wsUrl, httpUrl) - - onChainPublicKeys = append(onChainPublicKeys, payload.OnChainPublicKey) - offChainPublicKeys = append(offChainPublicKeys, payload.OffChainPublicKey) - configPublicKeys = append(configPublicKeys, payload.ConfigPublicKey) - peerIDs = append(peerIDs, payload.PeerID) - transmitters = append(transmitters, payload.Transmitter) - dkgEncrypters = append(dkgEncrypters, payload.DkgEncrypt) - dkgSigners = append(dkgSigners, payload.DkgSign) - sendingKeys = append(sendingKeys, payload.SendingKeys) - } - - var nodesToFund []string - - // If using the forwarder, set up a forwarder for each node. - if *useForwarder { - fmt.Println("Setting authorized senders...") - for i, f := range forwarderAddresses { - // Convert the sending strings for a transmitter to addresses. - var sendinKeysAddresses []common.Address - sendingKeysStrings := sendingKeys[i+1] - for _, s := range sendingKeysStrings { - sendinKeysAddresses = append(sendinKeysAddresses, common.HexToAddress(s)) - } - - // Set authorized senders for the corresponding forwarder. - setAuthorizedSenders(e, f, sendinKeysAddresses) - - // Fund the sending keys. - nodesToFund = append(nodesToFund, sendingKeysStrings...) - - // Set the authorized forwarder as the OCR transmitter. - transmitters[i+1] = f.String() - } - } else { - nodesToFund = append(nodesToFund, transmitters[1:]...) - } - - var payees []common.Address - var reportTransmitters []common.Address // all transmitters excluding bootstrap - for _, t := range transmitters[1:] { - payees = append(payees, e.Owner.From) - reportTransmitters = append(reportTransmitters, common.HexToAddress(t)) - } - - fmt.Printf("Setting EOA: %s as payee for transmitters: %v \n", e.Owner.From, reportTransmitters) - setPayees(e, vrfBeaconAddress.String(), reportTransmitters, payees) - - fmt.Println("Funding transmitters...") - helpers.FundNodes(e, nodesToFund, big.NewInt(*fundingAmount)) - - printStandardCommands( - dkgAddress, - vrfBeaconAddress, - consumerAddress, - loadTestConsumerAddress, - keyID, - confDelays, - onChainPublicKeys[1:], - offChainPublicKeys[1:], - configPublicKeys[1:], - peerIDs[1:], - transmitters[1:], - dkgEncrypters[1:], - dkgSigners[1:], - subID.String(), - ) -} - -func setupOCR2VRFNodesForInfraWithForwarder(e helpers.Environment) { - fs := flag.NewFlagSet("ocr2vrf-setup-infra", flag.ExitOnError) - - keyID := fs.String("key-id", "aee00d81f822f882b6fe28489822f59ebb21ea95c0ae21d9f67c0239461148fc", "key ID") - linkAddress := fs.String("link-address", "", "LINK token address") - linkEthFeed := fs.String("link-eth-feed", "", "LINK-ETH feed address") - confDelays := fs.String("conf-delays", "1,2,3,4,5,6,7,8", "8 confirmation delays") - beaconPeriodBlocks := fs.Int64("beacon-period-blocks", 3, "beacon period in blocks") - subscriptionBalanceString := fs.String("subscription-balance", "1e19", "amount to fund subscription") - - peerIDsString := fs.String("peer-ids", "", "peer ids") - dkgSignersString := fs.String("dkg-sign-keys", "", "dkg signing keys") - dkgEncryptersString := fs.String("dkg-encrypt-keys", "", "dkg encrypt keys") - ocr2KeyBundleIDsString := fs.String("key-bundle-ids", "", "ocr2 key bundle ids") - onChainPublicKeysString := fs.String("on-chain-public-keys", "", "ocr2 on-chain public keys") - offChainPublicKeysString := fs.String("off-chain-public-keys", "", "ocr2 off-chain public keys") - configPublicKeysString := fs.String("config-public-keys", "", "ocr2 config public keys") - ethSendingKeysString := fs.String("eth-sending-keys", "", "eth sending keys") - - nodeCount := fs.Int("node-count", 6, "number of nodes") - fundingAmount := fs.Int64("funding-amount", 1e17, "amount to fund nodes") // .1 ETH - - helpers.ParseArgs( - fs, - os.Args[2:], - "link-address", - "link-eth-feed", - "dkg-sign-keys", - "dkg-encrypt-keys", - "key-bundle-ids", - "on-chain-public-keys", - "off-chain-public-keys", - "config-public-keys", - "eth-sending-keys", - "peer-ids", - ) - - peerIDs := strings.Split(*peerIDsString, ",") - dkgSigners := strings.Split(*dkgSignersString, ",") - dkgEncrypters := strings.Split(*dkgEncryptersString, ",") - ocr2KeyBundleIDs := strings.Split(*ocr2KeyBundleIDsString, ",") - onChainPublicKeys := strings.Split(*onChainPublicKeysString, ",") - offChainPublicKeys := strings.Split(*offChainPublicKeysString, ",") - configPublicKeys := strings.Split(*configPublicKeysString, ",") - - var sendingKeys [][]string - flatSendingKeys := strings.Split(*ethSendingKeysString, ",") - sendingKeysPerNode := len(flatSendingKeys) / (*nodeCount - 1) - for i := 0; i < *nodeCount-1; i++ { - sendingKeys = append(sendingKeys, flatSendingKeys[i*sendingKeysPerNode:i*sendingKeysPerNode+sendingKeysPerNode]) - } - - if *nodeCount < 6 { - fmt.Println("Node count too low for OCR2VRF job, need at least 6.") - os.Exit(1) - } - - delays := helpers.ParseIntSlice(*confDelays) - if len(delays) != 8 { - fmt.Println("confDelays must have a length of 8") - os.Exit(1) - } - - link := common.HexToAddress(*linkAddress) - feedAddress := common.HexToAddress(*linkEthFeed) - - // Deploy DKG and VRF contracts, and add VRF - // as a consumer of DKG events. - fmt.Println("Deploying DKG contract...") - dkgAddress := deployDKG(e) - - fmt.Println("Deploying VRF coordinator...") - vrfCoordinatorAddress, _ := deployVRFCoordinator(e, big.NewInt(*beaconPeriodBlocks), link.String(), feedAddress.String()) - - fmt.Println("Deploying VRF beacon...") - vrfBeaconAddress := deployVRFBeacon(e, vrfCoordinatorAddress.String(), link.String(), dkgAddress.String(), *keyID) - - fmt.Println("Adding VRF Beacon as DKG client...") - addClientToDKG(e, dkgAddress.String(), *keyID, vrfBeaconAddress.String()) - - fmt.Println("Adding VRF Beacon as producer in VRF Coordinator") - setProducer(e, vrfCoordinatorAddress.String(), vrfBeaconAddress.String()) - - fmt.Println("Deploying beacon consumer...") - consumerAddress := deployVRFBeaconCoordinatorConsumer(e, vrfCoordinatorAddress.String(), false, big.NewInt(*beaconPeriodBlocks)) - - fmt.Println("Creating subscription...") - createSubscription(e, vrfCoordinatorAddress.String()) - - subID := findSubscriptionID(e, vrfCoordinatorAddress.String()) - - fmt.Println("Adding consumer to subscription...") - addConsumer(e, vrfCoordinatorAddress.String(), consumerAddress.String(), subID) - - subscriptionBalance := decimal.RequireFromString(*subscriptionBalanceString).BigInt() - if subscriptionBalance.Cmp(big.NewInt(0)) > 0 { - fmt.Println("\nFunding subscription with", subscriptionBalance, "juels...") - eoaFundSubscription(e, vrfCoordinatorAddress.String(), link.String(), subscriptionBalance, subID) - } else { - fmt.Println("Subscription", subID, "NOT getting funded. You must fund the subscription in order to use it!") - } - - var forwarderAddresses []common.Address - var forwarderAddressesStrings []string - var nodesToFund []string - var transmitters []string - - // Set up a forwarder for each node. - fmt.Println("Deploying transaction forwarders...") - for i := 0; i < *nodeCount-1; i++ { - // Deploy an authorized forwarder, and add it to the list of forwarders. - f := deployAuthorizedForwarder(e, link, e.Owner.From) - forwarderAddresses = append(forwarderAddresses, f) - forwarderAddressesStrings = append(forwarderAddressesStrings, f.String()) - } - - // Assign the sending keys to the deployed forwarders. - fmt.Printf("ForwarderAddresses : %v\n", forwarderAddressesStrings) - for i, f := range forwarderAddresses { - // Convert the sending strings for a transmitter to addresses. - var sendinKeysAddresses []common.Address - sendingKeysStrings := sendingKeys[i] - for _, s := range sendingKeysStrings { - sendinKeysAddresses = append(sendinKeysAddresses, common.HexToAddress(s)) - } - - // Set authorized senders for the corresponding forwarder. - setAuthorizedSenders(e, f, sendinKeysAddresses) - - // Fund the sending keys. - nodesToFund = append(nodesToFund, sendingKeysStrings...) - - // Set the authorized forwarder as the OCR transmitter. - transmitters = append(transmitters, f.String()) - } - - var payees []common.Address - var reportTransmitters []common.Address - for _, t := range transmitters { - payees = append(payees, e.Owner.From) - reportTransmitters = append(reportTransmitters, common.HexToAddress(t)) - } - - fmt.Printf("Setting EOA: %s as payee for transmitters: %v \n", e.Owner.From, reportTransmitters) - setPayees(e, vrfBeaconAddress.String(), reportTransmitters, payees) - - fmt.Println("Funding transmitters...") - helpers.FundNodes(e, nodesToFund, big.NewInt(*fundingAmount)) - - fmt.Println("Deploying batch beacon consumer...") - loadTestConsumerAddress := deployLoadTestVRFBeaconCoordinatorConsumer(e, vrfCoordinatorAddress.String(), false, big.NewInt(*beaconPeriodBlocks)) - addConsumer(e, vrfCoordinatorAddress.String(), loadTestConsumerAddress.String(), subID) - - for i := 0; i < *nodeCount; i++ { - // Apply forwarder args if using the forwarder. - if i > 0 { - adjustedIndex := i - 1 - vrfJob := fmt.Sprintf( - cmd.OCR2VRFTemplate, - e.ChainID, - vrfBeaconAddress.String(), - ocr2KeyBundleIDs[adjustedIndex], - forwarderAddresses[adjustedIndex].String(), - true, // forwardingAllowed - "", // P2P Bootstrapper - e.ChainID, - sendingKeys[adjustedIndex], - dkgEncrypters[adjustedIndex], - dkgSigners[adjustedIndex], - *keyID, - dkgAddress.String(), - vrfCoordinatorAddress.String(), - *linkEthFeed, - ) - fmt.Printf("VRF JOB FOR NODE %d:\n%v\n", i-1, vrfJob) // zero-based index to match infra. - } else { - bootstrapJob := fmt.Sprintf(cmd.BootstrapTemplate, e.ChainID, dkgAddress.String(), e.ChainID) - fmt.Printf("VRF BOOTSTRAP JOB:\n%v\n", bootstrapJob) - } - } - printStandardCommands( - dkgAddress, - vrfBeaconAddress, - consumerAddress, - loadTestConsumerAddress, - keyID, - confDelays, - onChainPublicKeys, - offChainPublicKeys, - configPublicKeys, - peerIDs, - transmitters, - dkgEncrypters, - dkgSigners, - subID.String(), - ) -} - -func printStandardCommands( - dkgAddress common.Address, - vrfBeaconAddress common.Address, - consumerAddress common.Address, - loadTestConsumerAddress common.Address, - keyID *string, - confDelays *string, - onChainPublicKeys []string, - offChainPublicKeys []string, - configPublicKeys []string, - peerIDs []string, - transmitters []string, - dkgEncrypters []string, - dkgSigners []string, - subID string, -) { - fmt.Println("Generated dkg setConfig command:") - dkgCommand := fmt.Sprintf( - "go run . dkg-set-config -dkg-address %s -key-id %s -onchain-pub-keys %s -offchain-pub-keys %s -config-pub-keys %s -peer-ids %s -transmitters %s -dkg-encryption-pub-keys %s -dkg-signing-pub-keys %s -schedule 1,1,1,1,1", - dkgAddress.String(), - *keyID, - strings.Join(onChainPublicKeys, ","), - strings.Join(offChainPublicKeys, ","), - strings.Join(configPublicKeys, ","), - strings.Join(peerIDs, ","), - strings.Join(transmitters, ","), - strings.Join(dkgEncrypters, ","), - strings.Join(dkgSigners, ","), - ) - fmt.Println(dkgCommand) - - fmt.Println() - fmt.Println("Generated vrf setConfig command:") - vrfCommand := fmt.Sprintf( - "go run . beacon-set-config -beacon-address %s -conf-delays %s -onchain-pub-keys %s -offchain-pub-keys %s -config-pub-keys %s -peer-ids %s -transmitters %s -schedule 1,1,1,1,1", - vrfBeaconAddress.String(), - *confDelays, - strings.Join(onChainPublicKeys, ","), - strings.Join(offChainPublicKeys, ","), - strings.Join(configPublicKeys, ","), - strings.Join(peerIDs, ","), - strings.Join(transmitters, ","), - ) - fmt.Println(vrfCommand) - - fmt.Println() - fmt.Println("Consumer address:", consumerAddress.String()) - fmt.Println("Consumer request command:") - requestCommand := fmt.Sprintf( - "go run . consumer-request-randomness -consumer-address %s -sub-id %s", - consumerAddress.Hex(), subID) - fmt.Println(requestCommand) - fmt.Println() - - fmt.Println("Consumer callback request command:") - callbackCommand := fmt.Sprintf( - "go run . consumer-request-callback -consumer-address %s -sub-id %s", - consumerAddress.Hex(), subID) - fmt.Println(callbackCommand) - fmt.Println() - - fmt.Println("Consumer callback batch request command:") - callbackCommand = fmt.Sprintf( - "go run . consumer-request-callback-batch -consumer-address %s -sub-id %s -batch-size ", - loadTestConsumerAddress.Hex(), subID) - fmt.Println(callbackCommand) - fmt.Println() - - fmt.Println("Consumer redeem randomness command:") - redeemCommand := fmt.Sprintf( - "go run . consumer-redeem-randomness -consumer-address %s -sub-id %s -request-id ", - consumerAddress.Hex(), subID) - fmt.Println(redeemCommand) - fmt.Println() -} - -func SetupNode( - e helpers.Environment, - flagSet *flag.FlagSet, - nodeIdx int, - databasePrefix, - databaseSuffixes string, - useForwarder bool, - resetDB bool, - wsUrl string, - httpUrl string, -) *cmd.SetupOCR2VRFNodePayload { - configureEnvironmentVariables((useForwarder) && (nodeIdx > 0), e.ChainID, wsUrl, httpUrl, nodeIdx, databasePrefix, databaseSuffixes) - - client := newSetupClient() - app := cmd.NewApp(client) - ctx := cli.NewContext(app, flagSet, nil) - - defer func() { - err := app.After(ctx) - helpers.PanicErr(err) - }() - - err := app.Before(ctx) - helpers.PanicErr(err) - - if resetDB { - resetDatabase(client, ctx) - } - - return setupOCR2VRFNodeFromClient(client, ctx, e) -} diff --git a/core/scripts/ocr2vrf/util.go b/core/scripts/ocr2vrf/util.go deleted file mode 100644 index d19e7289ab4..00000000000 --- a/core/scripts/ocr2vrf/util.go +++ /dev/null @@ -1,619 +0,0 @@ -package main - -import ( - "context" - "crypto/ed25519" - "encoding/hex" - "fmt" - "math/big" - "os" - "strconv" - "strings" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - gethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/urfave/cli" - "go.dedis.ch/kyber/v3" - "go.dedis.ch/kyber/v3/group/edwards25519" - "go.dedis.ch/kyber/v3/pairing" - - "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" - "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - - "github.com/smartcontractkit/chainlink-vrf/altbn_128" - "github.com/smartcontractkit/chainlink-vrf/dkg" - "github.com/smartcontractkit/chainlink-vrf/ocr2vrf" - ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" - - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" - "github.com/smartcontractkit/chainlink/v2/core/cmd" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/authorized_forwarder" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" - dkgContract "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/dkg" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/load_test_beacon_consumer" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon_consumer" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_coordinator" - - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" -) - -var ( - suite pairing.Suite = &altbn_128.PairingSuite{} - g1 = suite.G1() - g2 = suite.G2() - tomlConfigTemplate = ` - [P2P.V2] - ListenAddresses = ["127.0.0.1:8000"] - - [Feature] - LogPoller = true - - [OCR2] - Enabled = true - - [[EVM]] - FinalityDepth = 10 - ChainID = '%d' - - [EVM.Transactions] - ForwardersEnabled = %t - - [EVM.HeadTracker] - HistoryDepth = 1 - - [[EVM.Nodes]] - Name = "chain1" - HTTPURL = "%s" - WSURL = "%s" - ` -) - -func deployDKG(e helpers.Environment) common.Address { - _, tx, _, err := dkgContract.DeployDKG(e.Owner, e.Ec) - helpers.PanicErr(err) - return helpers.ConfirmContractDeployed(context.Background(), e.Ec, tx, e.ChainID) -} - -func deployVRFCoordinator(e helpers.Environment, beaconPeriodBlocks *big.Int, linkAddress, linkEthFeed string) (common.Address, *vrf_coordinator.VRFCoordinator) { - _, tx, coordinator, err := vrf_coordinator.DeployVRFCoordinator( - e.Owner, - e.Ec, - beaconPeriodBlocks, - common.HexToAddress(linkAddress), - ) - helpers.PanicErr(err) - return helpers.ConfirmContractDeployed(context.Background(), e.Ec, tx, e.ChainID), coordinator -} - -func configureVRFCoordinator(e helpers.Environment, coordinator *vrf_coordinator.VRFCoordinator, maxCbGasLimit, maxCbArgsLen uint32) *gethtypes.Receipt { - tx, err := coordinator.SetCallbackConfig(e.Owner, vrf_coordinator.VRFCoordinatorCallbackConfig{ - MaxCallbackGasLimit: maxCbGasLimit, - MaxCallbackArgumentsLength: maxCbArgsLen, - }) - helpers.PanicErr(err) - return helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID, "vrf coordinator setConfig") -} - -func deployAuthorizedForwarder(e helpers.Environment, link common.Address, owner common.Address) common.Address { - _, tx, _, err := authorized_forwarder.DeployAuthorizedForwarder(e.Owner, e.Ec, link, owner, common.Address{}, []byte{}) - helpers.PanicErr(err) - return helpers.ConfirmContractDeployed(context.Background(), e.Ec, tx, e.ChainID) -} - -func setAuthorizedSenders(e helpers.Environment, forwarder common.Address, senders []common.Address) { - f, err := authorized_forwarder.NewAuthorizedForwarder(forwarder, e.Ec) - helpers.PanicErr(err) - tx, err := f.SetAuthorizedSenders(e.Owner, senders) - helpers.PanicErr(err) - helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID) -} - -func deployVRFBeacon(e helpers.Environment, coordinatorAddress, linkAddress, dkgAddress, keyID string) common.Address { - keyIDBytes := decodeHexTo32ByteArray(keyID) - _, tx, _, err := vrf_beacon.DeployVRFBeacon(e.Owner, e.Ec, common.HexToAddress(linkAddress), common.HexToAddress(coordinatorAddress), common.HexToAddress(dkgAddress), keyIDBytes) - helpers.PanicErr(err) - return helpers.ConfirmContractDeployed(context.Background(), e.Ec, tx, e.ChainID) -} - -func deployVRFBeaconCoordinatorConsumer(e helpers.Environment, coordinatorAddress string, shouldFail bool, beaconPeriodBlocks *big.Int) common.Address { - _, tx, _, err := vrf_beacon_consumer.DeployBeaconVRFConsumer(e.Owner, e.Ec, common.HexToAddress(coordinatorAddress), shouldFail, beaconPeriodBlocks) - helpers.PanicErr(err) - return helpers.ConfirmContractDeployed(context.Background(), e.Ec, tx, e.ChainID) -} - -func deployLoadTestVRFBeaconCoordinatorConsumer(e helpers.Environment, coordinatorAddress string, shouldFail bool, beaconPeriodBlocks *big.Int) common.Address { - _, tx, _, err := load_test_beacon_consumer.DeployLoadTestBeaconVRFConsumer(e.Owner, e.Ec, common.HexToAddress(coordinatorAddress), shouldFail, beaconPeriodBlocks) - helpers.PanicErr(err) - return helpers.ConfirmContractDeployed(context.Background(), e.Ec, tx, e.ChainID) -} - -func addClientToDKG(e helpers.Environment, dkgAddress string, keyID string, clientAddress string) { - keyIDBytes := decodeHexTo32ByteArray(keyID) - - dkg, err := dkgContract.NewDKG(common.HexToAddress(dkgAddress), e.Ec) - helpers.PanicErr(err) - - tx, err := dkg.AddClient(e.Owner, keyIDBytes, common.HexToAddress(clientAddress)) - helpers.PanicErr(err) - helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID) -} - -func removeClientFromDKG(e helpers.Environment, dkgAddress string, keyID string, clientAddress string) { - keyIDBytes := decodeHexTo32ByteArray(keyID) - - dkg, err := dkgContract.NewDKG(common.HexToAddress(dkgAddress), e.Ec) - helpers.PanicErr(err) - - tx, err := dkg.RemoveClient(e.Owner, keyIDBytes, common.HexToAddress(clientAddress)) - helpers.PanicErr(err) - helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID) -} - -func setDKGConfig(e helpers.Environment, dkgAddress string, c dkgSetConfigArgs) { - oracleIdentities := toOraclesIdentityList( - helpers.ParseAddressSlice(c.onchainPubKeys), - strings.Split(c.offchainPubKeys, ","), - strings.Split(c.configPubKeys, ","), - strings.Split(c.peerIDs, ","), - strings.Split(c.transmitters, ",")) - - ed25519Suite := edwards25519.NewBlakeSHA256Ed25519() - var signingKeys []kyber.Point - for _, signingKey := range strings.Split(c.dkgSigningPubKeys, ",") { - signingKeyBytes, err := hex.DecodeString(signingKey) - helpers.PanicErr(err) - signingKeyPoint := ed25519Suite.Point() - helpers.PanicErr(signingKeyPoint.UnmarshalBinary(signingKeyBytes)) - signingKeys = append(signingKeys, signingKeyPoint) - } - - altbn128Suite := &altbn_128.PairingSuite{} - var encryptionKeys []kyber.Point - for _, encryptionKey := range strings.Split(c.dkgEncryptionPubKeys, ",") { - encryptionKeyBytes, err := hex.DecodeString(encryptionKey) - helpers.PanicErr(err) - encryptionKeyPoint := altbn128Suite.G1().Point() - helpers.PanicErr(encryptionKeyPoint.UnmarshalBinary(encryptionKeyBytes)) - encryptionKeys = append(encryptionKeys, encryptionKeyPoint) - } - - keyIDBytes := decodeHexTo32ByteArray(c.keyID) - - offchainConfig, err := dkg.OffchainConfig(encryptionKeys, signingKeys, &altbn_128.G1{}, &ocr2vrftypes.PairingTranslation{ - Suite: &altbn_128.PairingSuite{}, - }) - helpers.PanicErr(err) - onchainConfig, err := dkg.OnchainConfig(dkg.KeyID(keyIDBytes)) - helpers.PanicErr(err) - - fmt.Println("dkg offchain config:", hex.EncodeToString(offchainConfig)) - fmt.Println("dkg onchain config:", hex.EncodeToString(onchainConfig)) - - _, _, f, onchainConfig, offchainConfigVersion, offchainConfig, err := confighelper.ContractSetConfigArgsForTests( - c.deltaProgress, - c.deltaResend, - c.deltaRound, - c.deltaGrace, - c.deltaStage, - c.maxRounds, - helpers.ParseIntSlice(c.schedule), - oracleIdentities, - offchainConfig, - c.maxDurationQuery, - c.maxDurationObservation, - c.maxDurationReport, - c.maxDurationAccept, - c.maxDurationTransmit, - int(c.f), - onchainConfig) - - helpers.PanicErr(err) - - dkg := newDKG(common.HexToAddress(dkgAddress), e.Ec) - - tx, err := dkg.SetConfig(e.Owner, helpers.ParseAddressSlice(c.onchainPubKeys), helpers.ParseAddressSlice(c.transmitters), f, onchainConfig, offchainConfigVersion, offchainConfig) - helpers.PanicErr(err) - helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID) -} - -func (c *vrfBeaconSetConfigArgs) setVRFBeaconConfig(e helpers.Environment, vrfBeaconAddr string) { - oracleIdentities := toOraclesIdentityList( - helpers.ParseAddressSlice(c.onchainPubKeys), - strings.Split(c.offchainPubKeys, ","), - strings.Split(c.configPubKeys, ","), - strings.Split(c.peerIDs, ","), - strings.Split(c.transmitters, ",")) - - confDelays := make(map[uint32]struct{}) - for _, c := range strings.Split(c.confDelays, ",") { - confDelay, err := strconv.ParseUint(c, 0, 32) - helpers.PanicErr(err) - confDelays[uint32(confDelay)] = struct{}{} - } - - onchainConfig := ocr2vrf.OnchainConfig(confDelays) - - _, _, f, onchainConfig, offchainConfigVersion, offchainConfig, err := confighelper.ContractSetConfigArgsForTests( - c.deltaProgress, - c.deltaResend, - c.deltaRound, - c.deltaGrace, - c.deltaStage, - c.maxRounds, - helpers.ParseIntSlice(c.schedule), - oracleIdentities, - ocr2vrf.OffchainConfig(&c.coordinatorConfig), // off-chain config - c.maxDurationQuery, - c.maxDurationObservation, - c.maxDurationReport, - c.maxDurationAccept, - c.maxDurationTransmit, - int(c.f), - onchainConfig) - - helpers.PanicErr(err) - - beacon := newVRFBeacon(common.HexToAddress(vrfBeaconAddr), e.Ec) - - tx, err := beacon.SetConfig(e.Owner, helpers.ParseAddressSlice(c.onchainPubKeys), helpers.ParseAddressSlice(c.transmitters), f, onchainConfig, offchainConfigVersion, offchainConfig) - helpers.PanicErr(err) - helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID) -} - -func setProducer(e helpers.Environment, vrfCoordinatorAddr, vrfBeaconAddr string) { - coordinator := newVRFCoordinator(common.HexToAddress(vrfCoordinatorAddr), e.Ec) - - tx, err := coordinator.SetProducer(e.Owner, common.HexToAddress(vrfBeaconAddr)) - helpers.PanicErr(err) - helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID) -} - -func createSubscription(e helpers.Environment, vrfCoordinatorAddr string) { - coordinator := newVRFCoordinator(common.HexToAddress(vrfCoordinatorAddr), e.Ec) - - tx, err := coordinator.CreateSubscription(e.Owner) - helpers.PanicErr(err) - helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID) -} - -func getSubscription(e helpers.Environment, vrfCoordinatorAddr string, subId *big.Int) vrf_coordinator.GetSubscription { - coordinator := newVRFCoordinator(common.HexToAddress(vrfCoordinatorAddr), e.Ec) - - sub, err := coordinator.GetSubscription(nil, subId) - helpers.PanicErr(err) - return sub -} - -// returns subscription ID that belongs to the given owner. Returns result found first -func findSubscriptionID(e helpers.Environment, vrfCoordinatorAddr string) *big.Int { - // Use most recent 500 blocks as search window. - head, err := e.Ec.BlockNumber(context.Background()) - helpers.PanicErr(err) - fopts := &bind.FilterOpts{ - Start: head - 500, - } - - coordinator := newVRFCoordinator(common.HexToAddress(vrfCoordinatorAddr), e.Ec) - subscriptionIterator, err := coordinator.FilterSubscriptionCreated(fopts, nil, []common.Address{e.Owner.From}) - helpers.PanicErr(err) - - if !subscriptionIterator.Next() { - helpers.PanicErr(fmt.Errorf("expected at leats 1 subID for the given owner %s", e.Owner.From.Hex())) - } - return subscriptionIterator.Event.SubId -} - -func addConsumer(e helpers.Environment, vrfCoordinatorAddr, consumerAddr string, subId *big.Int) { - coordinator := newVRFCoordinator(common.HexToAddress(vrfCoordinatorAddr), e.Ec) - - tx, err := coordinator.AddConsumer(e.Owner, subId, common.HexToAddress(consumerAddr)) - helpers.PanicErr(err) - helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID) -} - -func setPayees(e helpers.Environment, vrfBeaconAddr string, transmitters, payees []common.Address) { - beacon := newVRFBeacon(common.HexToAddress(vrfBeaconAddr), e.Ec) - - tx, err := beacon.SetPayees(e.Owner, transmitters, payees) - helpers.PanicErr(err) - helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID) -} - -func eoaFundSubscription(e helpers.Environment, coordinatorAddress, linkAddress string, amount, subID *big.Int) { - linkToken, err := link_token_interface.NewLinkToken(common.HexToAddress(linkAddress), e.Ec) - helpers.PanicErr(err) - bal, err := linkToken.BalanceOf(nil, e.Owner.From) - helpers.PanicErr(err) - fmt.Println("Initial account balance:", bal, e.Owner.From.String(), "Funding amount:", amount.String()) - b, err := utils.ABIEncode(`[{"type":"uint256"}]`, subID) - helpers.PanicErr(err) - tx, err := linkToken.TransferAndCall(e.Owner, common.HexToAddress(coordinatorAddress), amount, b) - helpers.PanicErr(err) - helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID, fmt.Sprintf("sub ID: %d", subID)) -} - -func toOraclesIdentityList(onchainPubKeys []common.Address, offchainPubKeys, configPubKeys, peerIDs, transmitters []string) []confighelper.OracleIdentityExtra { - offchainPubKeysBytes := []types.OffchainPublicKey{} - for _, pkHex := range offchainPubKeys { - pkBytes, err := hex.DecodeString(pkHex) - helpers.PanicErr(err) - pkBytesFixed := [ed25519.PublicKeySize]byte{} - n := copy(pkBytesFixed[:], pkBytes) - if n != ed25519.PublicKeySize { - panic("wrong num elements copied") - } - - offchainPubKeysBytes = append(offchainPubKeysBytes, types.OffchainPublicKey(pkBytesFixed)) - } - - configPubKeysBytes := []types.ConfigEncryptionPublicKey{} - for _, pkHex := range configPubKeys { - pkBytes, err := hex.DecodeString(pkHex) - helpers.PanicErr(err) - - pkBytesFixed := [ed25519.PublicKeySize]byte{} - n := copy(pkBytesFixed[:], pkBytes) - if n != ed25519.PublicKeySize { - panic("wrong num elements copied") - } - - configPubKeysBytes = append(configPubKeysBytes, types.ConfigEncryptionPublicKey(pkBytesFixed)) - } - - o := []confighelper.OracleIdentityExtra{} - for index := range configPubKeys { - o = append(o, confighelper.OracleIdentityExtra{ - OracleIdentity: confighelper.OracleIdentity{ - OnchainPublicKey: onchainPubKeys[index][:], - OffchainPublicKey: offchainPubKeysBytes[index], - PeerID: peerIDs[index], - TransmitAccount: types.Account(transmitters[index]), - }, - ConfigEncryptionPublicKey: configPubKeysBytes[index], - }) - } - return o -} - -func requestRandomness(e helpers.Environment, coordinatorAddress string, numWords uint16, subID, confDelay *big.Int) { - coordinator := newVRFCoordinator(common.HexToAddress(coordinatorAddress), e.Ec) - - tx, err := coordinator.RequestRandomness(e.Owner, confDelay, numWords, confDelay, nil) - helpers.PanicErr(err) - helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID) -} - -func redeemRandomness(e helpers.Environment, coordinatorAddress string, requestID, subID *big.Int) { - coordinator := newVRFCoordinator(common.HexToAddress(coordinatorAddress), e.Ec) - - tx, err := coordinator.RedeemRandomness(e.Owner, subID, requestID, nil) - helpers.PanicErr(err) - helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID) -} - -func requestRandomnessFromConsumer(e helpers.Environment, consumerAddress string, numWords uint16, subID, confDelay *big.Int) *big.Int { - consumer := newVRFBeaconCoordinatorConsumer(common.HexToAddress(consumerAddress), e.Ec) - - tx, err := consumer.TestRequestRandomness(e.Owner, numWords, subID, confDelay) - helpers.PanicErr(err) - receipt := helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID) - - periodBlocks, err := consumer.IBeaconPeriodBlocks(nil) - helpers.PanicErr(err) - - blockNumber := receipt.BlockNumber - periodOffset := new(big.Int).Mod(blockNumber, periodBlocks) - nextBeaconOutputHeight := new(big.Int).Sub(new(big.Int).Add(blockNumber, periodBlocks), periodOffset) - - fmt.Println("nextBeaconOutputHeight: ", nextBeaconOutputHeight) - - requestID, err := consumer.SRequestsIDs(nil, nextBeaconOutputHeight, confDelay) - helpers.PanicErr(err) - fmt.Println("requestID: ", requestID) - - return requestID -} - -func readRandomness( - e helpers.Environment, - consumerAddress string, - requestID *big.Int, - numWords int) { - consumer := newVRFBeaconCoordinatorConsumer(common.HexToAddress(consumerAddress), e.Ec) - for i := 0; i < numWords; i++ { - r, err := consumer.SReceivedRandomnessByRequestID(nil, requestID, big.NewInt(int64(i))) - helpers.PanicErr(err) - fmt.Println("random word", i, ":", r.String()) - } -} - -func requestRandomnessCallback( - e helpers.Environment, - consumerAddress string, - numWords uint16, - subID, confDelay *big.Int, - callbackGasLimit uint32, - args []byte, -) (requestID *big.Int) { - consumer := newVRFBeaconCoordinatorConsumer(common.HexToAddress(consumerAddress), e.Ec) - - tx, err := consumer.TestRequestRandomnessFulfillment(e.Owner, subID, numWords, confDelay, callbackGasLimit, args) - helpers.PanicErr(err) - receipt := helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID, "TestRequestRandomnessFulfillment") - - periodBlocks, err := consumer.IBeaconPeriodBlocks(nil) - helpers.PanicErr(err) - - blockNumber := receipt.BlockNumber - periodOffset := new(big.Int).Mod(blockNumber, periodBlocks) - nextBeaconOutputHeight := new(big.Int).Sub(new(big.Int).Add(blockNumber, periodBlocks), periodOffset) - - fmt.Println("nextBeaconOutputHeight: ", nextBeaconOutputHeight) - - requestID, err = consumer.SRequestsIDs(nil, nextBeaconOutputHeight, confDelay) - helpers.PanicErr(err) - fmt.Println("requestID: ", requestID) - - return requestID -} - -func redeemRandomnessFromConsumer(e helpers.Environment, consumerAddress string, subID, requestID *big.Int, numWords int64) { - consumer := newVRFBeaconCoordinatorConsumer(common.HexToAddress(consumerAddress), e.Ec) - - tx, err := consumer.TestRedeemRandomness(e.Owner, subID, requestID) - helpers.PanicErr(err) - helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID) - - printRandomnessFromConsumer(consumer, requestID, numWords) -} - -func printRandomnessFromConsumer(consumer *vrf_beacon_consumer.BeaconVRFConsumer, requestID *big.Int, numWords int64) { - for i := int64(0); i < numWords; i++ { - randomness, err := consumer.SReceivedRandomnessByRequestID(nil, requestID, big.NewInt(0)) - helpers.PanicErr(err) - fmt.Println("random words index", i, ":", randomness.String()) - } -} - -func newVRFCoordinator(addr common.Address, client *ethclient.Client) *vrf_coordinator.VRFCoordinator { - coordinator, err := vrf_coordinator.NewVRFCoordinator(addr, client) - helpers.PanicErr(err) - return coordinator -} - -func newDKG(addr common.Address, client *ethclient.Client) *dkgContract.DKG { - dkg, err := dkgContract.NewDKG(addr, client) - helpers.PanicErr(err) - return dkg -} - -func newVRFBeaconCoordinatorConsumer(addr common.Address, client *ethclient.Client) *vrf_beacon_consumer.BeaconVRFConsumer { - consumer, err := vrf_beacon_consumer.NewBeaconVRFConsumer(addr, client) - helpers.PanicErr(err) - return consumer -} - -func newLoadTestVRFBeaconCoordinatorConsumer(addr common.Address, client *ethclient.Client) *load_test_beacon_consumer.LoadTestBeaconVRFConsumer { - consumer, err := load_test_beacon_consumer.NewLoadTestBeaconVRFConsumer(addr, client) - helpers.PanicErr(err) - return consumer -} - -func newVRFBeacon(addr common.Address, client *ethclient.Client) *vrf_beacon.VRFBeacon { - beacon, err := vrf_beacon.NewVRFBeacon(addr, client) - helpers.PanicErr(err) - return beacon -} - -func decodeHexTo32ByteArray(val string) (byteArray [32]byte) { - decoded, err := hex.DecodeString(val) - helpers.PanicErr(err) - if len(decoded) != 32 { - panic(fmt.Sprintf("expected value to be 32 bytes but received %d bytes", len(decoded))) - } - copy(byteArray[:], decoded) - return -} - -func setupOCR2VRFNodeFromClient(client *cmd.Shell, context *cli.Context, e helpers.Environment) *cmd.SetupOCR2VRFNodePayload { - payload, err := client.ConfigureOCR2VRFNode(context, e.Owner, e.Ec) - helpers.PanicErr(err) - - return payload -} - -func configureEnvironmentVariables(useForwarder bool, chainID int64, wsUrl string, ethURL string, index int, databasePrefix string, databaseSuffixes string) { - // Set permitted envars for v2. - helpers.PanicErr(os.Setenv("CL_DATABASE_URL", fmt.Sprintf("%s-%d?%s", databasePrefix, index, databaseSuffixes))) - helpers.PanicErr(os.Setenv("CL_CONFIG", fmt.Sprintf(tomlConfigTemplate, chainID, useForwarder, ethURL, wsUrl))) - - // Unset prohibited envars for v2. - helpers.PanicErr(os.Unsetenv("ETH_URL")) - helpers.PanicErr(os.Unsetenv("ETH_HTTP_URL")) - helpers.PanicErr(os.Unsetenv("ETH_CHAIN_ID")) -} - -func resetDatabase(client *cmd.Shell, context *cli.Context) { - helpers.PanicErr(client.ResetDatabase(context)) -} - -func newSetupClient() *cmd.Shell { - prompter := cmd.NewTerminalPrompter() - return &cmd.Shell{ - Renderer: cmd.RendererTable{Writer: os.Stdout}, - AppFactory: cmd.ChainlinkAppFactory{}, - KeyStoreAuthenticator: cmd.TerminalKeyStoreAuthenticator{Prompter: prompter}, - FallbackAPIInitializer: cmd.NewPromptingAPIInitializer(prompter), - Runner: cmd.ChainlinkRunner{}, - PromptingSessionRequestBuilder: cmd.NewPromptingSessionRequestBuilder(prompter), - ChangePasswordPrompter: cmd.NewChangePasswordPrompter(), - PasswordPrompter: cmd.NewPasswordPrompter(), - } -} - -func requestRandomnessCallbackBatch( - e helpers.Environment, - consumerAddress string, - numWords uint16, - subID, confDelay *big.Int, - callbackGasLimit uint32, - args []byte, - batchSize *big.Int, -) (requestID *big.Int) { - consumer := newLoadTestVRFBeaconCoordinatorConsumer(common.HexToAddress(consumerAddress), e.Ec) - - tx, err := consumer.TestRequestRandomnessFulfillmentBatch(e.Owner, subID, numWords, confDelay, callbackGasLimit, args, batchSize) - helpers.PanicErr(err) - receipt := helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID, "TestRequestRandomnessFulfillment") - - periodBlocks, err := consumer.IBeaconPeriodBlocks(nil) - helpers.PanicErr(err) - - blockNumber := receipt.BlockNumber - periodOffset := new(big.Int).Mod(blockNumber, periodBlocks) - nextBeaconOutputHeight := new(big.Int).Sub(new(big.Int).Add(blockNumber, periodBlocks), periodOffset) - - fmt.Println("nextBeaconOutputHeight: ", nextBeaconOutputHeight) - - requestID, err = consumer.SRequestsIDs(nil, nextBeaconOutputHeight, confDelay) - helpers.PanicErr(err) - fmt.Println("requestID: ", requestID) - - return requestID -} - -func printLoadtestResults(e helpers.Environment, consumerAddress string) { - consumer := newLoadTestVRFBeaconCoordinatorConsumer(common.HexToAddress(consumerAddress), e.Ec) - - totalRequests, err := consumer.STotalRequests(nil) - helpers.PanicErr(err) - - totalFulfilled, err := consumer.STotalFulfilled(nil) - helpers.PanicErr(err) - - avgBlocksInMil, err := consumer.SAverageFulfillmentInMillions(nil) - helpers.PanicErr(err) - - slowestBlocks, err := consumer.SSlowestFulfillment(nil) - helpers.PanicErr(err) - - fastestBlock, err := consumer.SFastestFulfillment(nil) - helpers.PanicErr(err) - - slowestRequest, err := consumer.SSlowestRequestID(nil) - helpers.PanicErr(err) - - pendingRequests, err := consumer.PendingRequests(nil) - helpers.PanicErr(err) - - fmt.Println("Total Requests: ", totalRequests.Uint64()) - fmt.Println("Total Fulfilled: ", totalFulfilled.Uint64()) - fmt.Println("Average Fulfillment Delay in Blocks: ", float64(avgBlocksInMil.Uint64())/1000000) - fmt.Println("Slowest Fulfillment Delay in Blocks: ", slowestBlocks.Uint64()) - fmt.Println("Slowest Request ID: ", slowestRequest.Uint64()) - fmt.Println("Fastest Fulfillment Delay in Blocks: ", fastestBlock.Uint64()) - fmt.Println("Pending Requests: ", pendingRequests) -} diff --git a/core/scripts/ocr2vrf/verify.go b/core/scripts/ocr2vrf/verify.go deleted file mode 100644 index 7d7fb94496a..00000000000 --- a/core/scripts/ocr2vrf/verify.go +++ /dev/null @@ -1,181 +0,0 @@ -package main - -import ( - "context" - "fmt" - "math/big" - - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/vm" - bn256 "github.com/ethereum/go-ethereum/crypto/bn256/google" - "go.dedis.ch/kyber/v3" - "go.dedis.ch/kyber/v3/group/mod" - "go.dedis.ch/kyber/v3/pairing" - - "github.com/smartcontractkit/chainlink-vrf/altbn_128" - ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" - - helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - dkgContract "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/dkg" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_coordinator" -) - -func getDKGLatestConfigDetails(e helpers.Environment, dkgAddress string) dkgContract.LatestConfigDetails { - dkg := newDKG(common.HexToAddress(dkgAddress), e.Ec) - dkgConfig, err := dkg.LatestConfigDetails(nil) - helpers.PanicErr(err) - - return dkgConfig -} - -func getVRFLatestConfigDetails(e helpers.Environment, beaconAddress string) vrf_beacon.LatestConfigDetails { - beacon := newVRFBeacon(common.HexToAddress(beaconAddress), e.Ec) - beaconConfig, err := beacon.LatestConfigDetails(nil) - helpers.PanicErr(err) - - return beaconConfig -} - -func getDKGKeyData(e helpers.Environment, dkgAddress string, keyID, configDigest [32]byte) dkgContract.KeyDataStructKeyData { - dkg := newDKG(common.HexToAddress(dkgAddress), e.Ec) - keyData, err := dkg.GetKey(nil, keyID, configDigest) - helpers.PanicErr(err) - - return keyData -} - -func getKeyID(e helpers.Environment, beaconAddress string) [32]byte { - beacon := newVRFBeacon(common.HexToAddress(beaconAddress), e.Ec) - keyID, err := beacon.SKeyID(nil) - helpers.PanicErr(err) - return keyID -} - -func getPublicKey(e helpers.Environment, dkgAddress string, keyID, configDigest [32]byte) kyber.Point { - keyData := getDKGKeyData(e, dkgAddress, keyID, configDigest) - kg := &altbn_128.G2{} - pk := kg.Point() - err := pk.UnmarshalBinary(keyData.PublicKey) - helpers.PanicErr(err) - return pk -} - -func getHashToCurveMessage(e helpers.Environment, height uint64, confDelay uint32, vrfConfigDigest [32]byte, pk kyber.Point) *altbn_128.HashProof { - blockNumber := big.NewInt(0).SetUint64(height) - block, err := e.Ec.BlockByNumber(context.Background(), blockNumber) - helpers.PanicErr(err) - b := ocr2vrftypes.Block{ - Height: height, - ConfirmationDelay: confDelay, - Hash: block.Hash(), - } - h := b.VRFHash(vrfConfigDigest, pk) - return altbn_128.NewHashProof(h) -} - -func getVRFSignature(e helpers.Environment, coordinatorAddress string, height, confDelay, searchWindow uint64) (proofG1X, proofG1Y *big.Int) { - // get transmission logs from requested block to requested block + search window blocks - // TODO: index transmission logs by height and confirmation delay to - // make the FilterQuery call more efficient - query := ethereum.FilterQuery{ - FromBlock: big.NewInt(0).SetUint64(height), - ToBlock: big.NewInt(0).SetUint64(height + searchWindow), - Addresses: []common.Address{ - common.HexToAddress(coordinatorAddress), - }, - Topics: [][]common.Hash{ - { - vrf_coordinator.VRFCoordinatorOutputsServed{}.Topic(), - }, - }, - } - logs, err := e.Ec.FilterLogs(context.Background(), query) - helpers.PanicErr(err) - - coordinator := newVRFCoordinator(common.HexToAddress(coordinatorAddress), e.Ec) - for _, log := range logs { - t, err := coordinator.ParseOutputsServed(log) - helpers.PanicErr(err) - for _, o := range t.OutputsServed { - if o.ConfirmationDelay.Uint64() == confDelay && o.Height == height { - proofG1X = o.ProofG1X - proofG1Y = o.ProofG1Y - } - } - } - return -} - -func verifyBeaconRandomness(e helpers.Environment, dkgAddress, beaconAddress string, coordinatorAddress string, height, confDelay, searchWindow uint64) bool { - dkgConfig := getDKGLatestConfigDetails(e, dkgAddress) - vrfConfig := getVRFLatestConfigDetails(e, beaconAddress) - keyID := getKeyID(e, beaconAddress) - pk := getPublicKey(e, dkgAddress, keyID, dkgConfig.ConfigDigest) - h := getHashToCurveMessage(e, height, uint32(confDelay), vrfConfig.ConfigDigest, pk) - hpoint := h.HashPoint - negHpoint := g1.Point() - negHpoint.Neg(hpoint) - g2Base := g2.Point().Base() - - // get BLS signature for the given height and confirmation delay - proofG1X, proofG1Y := getVRFSignature(e, coordinatorAddress, height, confDelay, searchWindow) - if proofG1X.Cmp(big.NewInt(0)) == 0 || proofG1Y.Cmp(big.NewInt(0)) == 0 { - panic("signature not found") - } - g1Proof, err := altbn_128.CoordinatesToG1(mod.NewInt(proofG1X, bn256.P), mod.NewInt(proofG1Y, bn256.P)) - helpers.PanicErr(err) - - // Perform verification of BLS signature is done using pairing function - isValid := validateSignature(suite, hpoint, pk, g1Proof) - fmt.Println("Verification Result: ", isValid) - - // Perform the same verification as above using precompiled contract 0x8 - // This should always result in same result as validateSignature() - // signature is valid iff contract0x8(-b_x, -b_y, pk_x, pk_y, p_x, p_y, g2_x, g2_y) == 1 - input := make([]byte, 384) - hb := altbn_128.LongMarshal(negHpoint) - if len(hb) != 64 { - panic("wrong length of hpoint") - } - copy(input[:64], hb[:]) - - pkb, err := pk.MarshalBinary() - helpers.PanicErr(err) - if len(pkb) != 128 { - panic("wrong length of public key") - } - copy(input[64:192], pkb) - - if len(proofG1X.Bytes()) != 32 { - panic("wrong length of VRF signature x-coordinator") - } - if len(proofG1Y.Bytes()) != 32 { - panic("wrong length of VRF signature y-coordinator") - } - copy(input[192:224], proofG1X.Bytes()) - copy(input[224:256], proofG1Y.Bytes()) - - g2b, err := g2Base.MarshalBinary() - helpers.PanicErr(err) - if len(g2b) != 128 { - panic("wrong length of altbn_128 base points") - } - copy(input[256:384], g2b) - - contract := vm.PrecompiledContractsByzantium[common.HexToAddress("0x8")] - res, err := contract.Run(input) - helpers.PanicErr(err) - isValidPrecompiledContract := big.NewInt(0).SetBytes(res).Uint64() == 1 - fmt.Println("Verification Result Using Precompiled Contract 0x8: ", isValidPrecompiledContract) - - if isValid && isValidPrecompiledContract { - return true - } - return false -} - -func validateSignature(p pairing.Suite, msg, publicKey, signature kyber.Point) bool { - return p.Pair(msg, publicKey).Equal(p.Pair(signature, p.G2().Point().Base())) -} diff --git a/core/services/chainlink/application.go b/core/services/chainlink/application.go index 7a928c46b85..9a2d08d000c 100644 --- a/core/services/chainlink/application.go +++ b/core/services/chainlink/application.go @@ -500,8 +500,6 @@ func NewApplication(opts ApplicationOpts) (Application, error) { globalLogger, ocr2DelegateConfig, keyStore.OCR2(), - keyStore.DKGSign(), - keyStore.DKGEncrypt(), keyStore.Eth(), opts.RelayerChainInteroperators, mailMon, diff --git a/core/services/job/models.go b/core/services/job/models.go index a8c12cbece9..a21a43d12dc 100644 --- a/core/services/job/models.go +++ b/core/services/job/models.go @@ -352,7 +352,7 @@ type ocr2Config interface { SimulateTransactions() bool } -var ForwardersSupportedPlugins = []types.OCR2PluginType{types.Median, types.DKG, types.OCR2VRF, types.OCR2Keeper, types.Functions} +var ForwardersSupportedPlugins = []types.OCR2PluginType{types.Median, types.OCR2Keeper, types.Functions} // OCR2OracleSpec defines the job spec for OCR2 jobs. // Relay config is chain specific config for a relay (chain adapter). diff --git a/core/services/job/spawner_test.go b/core/services/job/spawner_test.go index 4abb81eda3a..86f0324e6a0 100644 --- a/core/services/job/spawner_test.go +++ b/core/services/job/spawner_test.go @@ -20,6 +20,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/utils/mailbox/mailboxtest" "github.com/smartcontractkit/chainlink/v2/core/capabilities" + "github.com/smartcontractkit/chainlink/v2/plugins" "github.com/smartcontractkit/chainlink/v2/core/bridges" mocklp "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks" @@ -38,7 +39,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" evmrelayer "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" - "github.com/smartcontractkit/chainlink/v2/plugins" ) type delegate struct { @@ -316,7 +316,7 @@ func TestSpawner_CreateJobDeleteJob(t *testing.T) { ocr2DelegateConfig := ocr2.NewDelegateConfig(config.OCR2(), config.Mercury(), config.Threshold(), config.Insecure(), config.JobPipeline(), processConfig) d := ocr2.NewDelegate(nil, orm, nil, nil, nil, nil, nil, monitoringEndpoint, legacyChains, lggr, ocr2DelegateConfig, - keyStore.OCR2(), keyStore.DKGSign(), keyStore.DKGEncrypt(), ethKeyStore, testRelayGetter, mailMon, capabilities.NewRegistry(lggr)) + keyStore.OCR2(), ethKeyStore, testRelayGetter, mailMon, capabilities.NewRegistry(lggr)) delegateOCR2 := &delegate{jobOCR2Keeper.Type, []job.ServiceCtx{}, 0, nil, d} spawner := job.NewSpawner(orm, config.Database(), noopChecker{}, map[job.Type]job.Delegate{ diff --git a/core/services/keystore/dkgencrypt.go b/core/services/keystore/dkgencrypt.go deleted file mode 100644 index 15d0ae8b24d..00000000000 --- a/core/services/keystore/dkgencrypt.go +++ /dev/null @@ -1,164 +0,0 @@ -package keystore - -import ( - "context" - "fmt" - - "github.com/pkg/errors" - - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgencryptkey" -) - -//go:generate mockery --quiet --name DKGEncrypt --output mocks/ --case=underscore - -// DKGEncrypt provides encryption keys for the DKG. -type DKGEncrypt interface { - Get(id string) (dkgencryptkey.Key, error) - GetAll() ([]dkgencryptkey.Key, error) - Create(ctx context.Context) (dkgencryptkey.Key, error) - Add(ctx context.Context, key dkgencryptkey.Key) error - Delete(ctx context.Context, id string) (dkgencryptkey.Key, error) - Import(ctx context.Context, keyJSON []byte, password string) (dkgencryptkey.Key, error) - Export(id string, password string) ([]byte, error) - EnsureKey(ctx context.Context) error -} - -type dkgEncrypt struct { - *keyManager -} - -func newDKGEncryptKeyStore(km *keyManager) *dkgEncrypt { - return &dkgEncrypt{ - keyManager: km, - } -} - -var _ DKGEncrypt = &dkgEncrypt{} - -// Add implements DKGEncrypt -func (d *dkgEncrypt) Add(ctx context.Context, key dkgencryptkey.Key) error { - d.lock.Lock() - defer d.lock.Unlock() - if d.isLocked() { - return ErrLocked - } - return d.safeAddKey(ctx, key) -} - -// Create implements DKGEncrypt -func (d *dkgEncrypt) Create(ctx context.Context) (dkgencryptkey.Key, error) { - d.lock.Lock() - defer d.lock.Unlock() - if d.isLocked() { - return dkgencryptkey.Key{}, ErrLocked - } - key, err := dkgencryptkey.New() - if err != nil { - return dkgencryptkey.Key{}, errors.Wrap(err, "dkgencryptkey.New()") - } - return key, d.safeAddKey(ctx, key) -} - -// Delete implements DKGEncrypt -func (d *dkgEncrypt) Delete(ctx context.Context, id string) (dkgencryptkey.Key, error) { - d.lock.Lock() - defer d.lock.Unlock() - if d.isLocked() { - return dkgencryptkey.Key{}, ErrLocked - } - key, err := d.getByID(id) - if err != nil { - return dkgencryptkey.Key{}, err - } - - err = d.safeRemoveKey(ctx, key) - return key, errors.Wrap(err, "safe remove key") -} - -// EnsureKey implements DKGEncrypt -func (d *dkgEncrypt) EnsureKey(ctx context.Context) error { - d.lock.Lock() - defer d.lock.Unlock() - if d.isLocked() { - return ErrLocked - } - if len(d.keyRing.DKGEncrypt) > 0 { - return nil - } - - key, err := dkgencryptkey.New() - if err != nil { - return errors.Wrap(err, "dkgencryptkey. New()") - } - - d.logger.Infof("Created DKGEncrypt key with ID %s", key.ID()) - - return d.safeAddKey(ctx, key) -} - -// Export implements DKGEncrypt -func (d *dkgEncrypt) Export(id string, password string) ([]byte, error) { - d.lock.RLock() - defer d.lock.RUnlock() - if d.isLocked() { - return nil, ErrLocked - } - key, err := d.getByID(id) - if err != nil { - return nil, err - } - return key.ToEncryptedJSON(password, d.scryptParams) -} - -// Get implements DKGEncrypt -func (d *dkgEncrypt) Get(id string) (keys dkgencryptkey.Key, err error) { - d.lock.RLock() - defer d.lock.RUnlock() - if d.isLocked() { - return dkgencryptkey.Key{}, ErrLocked - } - return d.getByID(id) -} - -// GetAll implements DKGEncrypt -func (d *dkgEncrypt) GetAll() (keys []dkgencryptkey.Key, err error) { - d.lock.RLock() - defer d.lock.RUnlock() - if d.isLocked() { - return nil, ErrLocked - } - for _, key := range d.keyRing.DKGEncrypt { - keys = append(keys, key) - } - return keys, nil -} - -// Import implements DKGEncrypt -func (d *dkgEncrypt) Import(ctx context.Context, keyJSON []byte, password string) (dkgencryptkey.Key, error) { - d.lock.Lock() - defer d.lock.Unlock() - if d.isLocked() { - return dkgencryptkey.Key{}, ErrLocked - } - key, err := dkgencryptkey.FromEncryptedJSON(keyJSON, password) - if err != nil { - return dkgencryptkey.Key{}, errors.Wrap(err, "from encrypted json") - } - _, err = d.getByID(key.ID()) - if err == nil { - return dkgencryptkey.Key{}, fmt.Errorf("key with ID %s already exists", key.ID()) - } - return key, d.keyManager.safeAddKey(ctx, key) -} - -// caller must hold lock -func (d *dkgEncrypt) getByID(id string) (dkgencryptkey.Key, error) { - key, found := d.keyRing.DKGEncrypt[id] - if !found { - return dkgencryptkey.Key{}, KeyNotFoundError{ - ID: id, - KeyType: "DKGEncrypt", - } - } - return key, nil -} diff --git a/core/services/keystore/dkgencrypt_test.go b/core/services/keystore/dkgencrypt_test.go deleted file mode 100644 index 4856473a0df..00000000000 --- a/core/services/keystore/dkgencrypt_test.go +++ /dev/null @@ -1,130 +0,0 @@ -package keystore_test - -import ( - "context" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgencryptkey" -) - -func Test_DKGEncryptKeyStore_E2E(t *testing.T) { - db := pgtest.NewSqlxDB(t) - keyStore := keystore.ExposedNewMaster(t, db) - require.NoError(t, keyStore.Unlock(testutils.Context(t), cltest.Password)) - ks := keyStore.DKGEncrypt() - - assert.NotNil(t, ks) - - reset := func() { - ctx := context.Background() // Executed on cleanup - _, err := db.Exec("DELETE FROM encrypted_key_rings") - require.NoError(t, err) - keyStore.ResetXXXTestOnly() - require.NoError(t, keyStore.Unlock(ctx, cltest.Password)) - } - - t.Run("initializes with an empty state", func(t *testing.T) { - defer reset() - keys, err := ks.GetAll() - require.NoError(t, err) - require.Equal(t, 0, len(keys)) - }) - - t.Run("errors when getting non-existent ID", func(t *testing.T) { - defer reset() - _, err := ks.Get("non-existent-id") - require.Error(t, err) - }) - - t.Run("creates a key", func(t *testing.T) { - defer reset() - ctx := testutils.Context(t) - key, err := ks.Create(ctx) - require.NoError(t, err) - retrievedKey, err := ks.Get(key.ID()) - require.NoError(t, err) - require.Equal(t, key, retrievedKey) - }) - - t.Run("imports and exports a key", func(t *testing.T) { - defer reset() - ctx := testutils.Context(t) - key, err := ks.Create(ctx) - require.NoError(t, err) - exportJSON, err := ks.Export(key.ID(), cltest.Password) - require.NoError(t, err) - _, err = ks.Delete(ctx, key.ID()) - require.NoError(t, err) - _, err = ks.Get(key.ID()) - require.Error(t, err) - importedKey, err := ks.Import(ctx, exportJSON, cltest.Password) - require.NoError(t, err) - require.Equal(t, key.ID(), importedKey.ID()) - retrievedKey, err := ks.Get(key.ID()) - require.NoError(t, err) - require.Equal(t, importedKey, retrievedKey) - }) - - t.Run("adds an externally created key / deletes a key", func(t *testing.T) { - defer reset() - ctx := testutils.Context(t) - newKey, err := dkgencryptkey.New() - require.NoError(t, err) - err = ks.Add(ctx, newKey) - require.NoError(t, err) - keys, err := ks.GetAll() - require.NoError(t, err) - require.Equal(t, 1, len(keys)) - _, err = ks.Delete(ctx, newKey.ID()) - require.NoError(t, err) - keys, err = ks.GetAll() - require.NoError(t, err) - require.Equal(t, 0, len(keys)) - _, err = ks.Get(newKey.ID()) - require.Error(t, err) - }) - - t.Run("adds an externally created key/ensures it already exists", func(t *testing.T) { - defer reset() - ctx := testutils.Context(t) - - newKey, err := dkgencryptkey.New() - assert.NoError(t, err) - err = ks.Add(ctx, newKey) - assert.NoError(t, err) - - err = keyStore.DKGEncrypt().EnsureKey(ctx) - assert.NoError(t, err) - keys, err2 := ks.GetAll() - assert.NoError(t, err2) - - require.Equal(t, 1, len(keys)) - require.Equal(t, newKey.ID(), keys[0].ID()) - require.Equal(t, newKey.PublicKey, keys[0].PublicKey) - }) - - t.Run("auto creates a key if it doesn't exists when trying to ensure it already exists", func(t *testing.T) { - defer reset() - ctx := testutils.Context(t) - - keys, err := ks.GetAll() - assert.NoError(t, err) - assert.Equal(t, 0, len(keys)) - - err = keyStore.DKGEncrypt().EnsureKey(ctx) - assert.NoError(t, err) - - keys, err = ks.GetAll() - assert.NoError(t, err) - - require.NoError(t, err) - require.Equal(t, 1, len(keys)) - }) -} diff --git a/core/services/keystore/dkgsign.go b/core/services/keystore/dkgsign.go deleted file mode 100644 index 385323fc0fa..00000000000 --- a/core/services/keystore/dkgsign.go +++ /dev/null @@ -1,164 +0,0 @@ -package keystore - -import ( - "context" - "fmt" - - "github.com/pkg/errors" - - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgsignkey" -) - -//go:generate mockery --quiet --name DKGSign --output mocks/ --case=underscore - -// DKGSign provides signing keys for the DKG. -type DKGSign interface { - Get(id string) (dkgsignkey.Key, error) - GetAll() ([]dkgsignkey.Key, error) - Create(ctx context.Context) (dkgsignkey.Key, error) - Add(ctx context.Context, key dkgsignkey.Key) error - Delete(ctx context.Context, id string) (dkgsignkey.Key, error) - Import(ctx context.Context, keyJSON []byte, password string) (dkgsignkey.Key, error) - Export(id string, password string) ([]byte, error) - EnsureKey(ctx context.Context) error -} - -type dkgSign struct { - *keyManager -} - -func newDKGSignKeyStore(km *keyManager) *dkgSign { - return &dkgSign{ - keyManager: km, - } -} - -var _ DKGSign = &dkgSign{} - -// Add implements DKGSign -func (d *dkgSign) Add(ctx context.Context, key dkgsignkey.Key) error { - d.lock.Lock() - defer d.lock.Unlock() - if d.isLocked() { - return ErrLocked - } - return d.safeAddKey(ctx, key) -} - -// Create implements DKGSign -func (d *dkgSign) Create(ctx context.Context) (dkgsignkey.Key, error) { - d.lock.Lock() - defer d.lock.Unlock() - if d.isLocked() { - return dkgsignkey.Key{}, ErrLocked - } - key, err := dkgsignkey.New() - if err != nil { - return dkgsignkey.Key{}, errors.Wrap(err, "dkgsignkey New()") - } - return key, d.safeAddKey(ctx, key) -} - -// Delete implements DKGSign -func (d *dkgSign) Delete(ctx context.Context, id string) (dkgsignkey.Key, error) { - d.lock.Lock() - defer d.lock.Unlock() - if d.isLocked() { - return dkgsignkey.Key{}, ErrLocked - } - key, err := d.getByID(id) - if err != nil { - return dkgsignkey.Key{}, err - } - - err = d.safeRemoveKey(ctx, key) - return key, errors.Wrap(err, "safe remove key") -} - -// EnsureKey implements DKGSign -func (d *dkgSign) EnsureKey(ctx context.Context) error { - d.lock.Lock() - defer d.lock.Unlock() - if d.isLocked() { - return ErrLocked - } - if len(d.keyRing.DKGSign) > 0 { - return nil - } - - key, err := dkgsignkey.New() - if err != nil { - return errors.Wrap(err, "dkgsignkey New()") - } - - d.logger.Infof("Created DKGSign key with ID %s", key.ID()) - - return d.safeAddKey(ctx, key) -} - -// Export implements DKGSign -func (d *dkgSign) Export(id string, password string) ([]byte, error) { - d.lock.RLock() - defer d.lock.RUnlock() - if d.isLocked() { - return nil, ErrLocked - } - key, err := d.getByID(id) - if err != nil { - return nil, err - } - return key.ToEncryptedJSON(password, d.scryptParams) -} - -// Get implements DKGSign -func (d *dkgSign) Get(id string) (keys dkgsignkey.Key, err error) { - d.lock.RLock() - defer d.lock.RUnlock() - if d.isLocked() { - return dkgsignkey.Key{}, ErrLocked - } - return d.getByID(id) -} - -// GetAll implements DKGSign -func (d *dkgSign) GetAll() (keys []dkgsignkey.Key, err error) { - d.lock.RLock() - defer d.lock.RUnlock() - if d.isLocked() { - return nil, ErrLocked - } - for _, key := range d.keyRing.DKGSign { - keys = append(keys, key) - } - return keys, nil -} - -// Import implements DKGSign -func (d *dkgSign) Import(ctx context.Context, keyJSON []byte, password string) (dkgsignkey.Key, error) { - d.lock.Lock() - defer d.lock.Unlock() - if d.isLocked() { - return dkgsignkey.Key{}, ErrLocked - } - key, err := dkgsignkey.FromEncryptedJSON(keyJSON, password) - if err != nil { - return dkgsignkey.Key{}, errors.Wrap(err, "from encrypted json") - } - _, err = d.getByID(key.ID()) - if err == nil { - return dkgsignkey.Key{}, fmt.Errorf("key with ID %s already exists", key.ID()) - } - return key, d.keyManager.safeAddKey(ctx, key) -} - -// caller must hold lock -func (d *dkgSign) getByID(id string) (dkgsignkey.Key, error) { - key, found := d.keyRing.DKGSign[id] - if !found { - return dkgsignkey.Key{}, KeyNotFoundError{ - ID: id, - KeyType: "DKGSign", - } - } - return key, nil -} diff --git a/core/services/keystore/dkgsign_test.go b/core/services/keystore/dkgsign_test.go deleted file mode 100644 index 8aa8cb1ad74..00000000000 --- a/core/services/keystore/dkgsign_test.go +++ /dev/null @@ -1,129 +0,0 @@ -package keystore_test - -import ( - "context" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgsignkey" -) - -func Test_DKGSignKeyStore_E2E(t *testing.T) { - db := pgtest.NewSqlxDB(t) - keyStore := keystore.ExposedNewMaster(t, db) - require.NoError(t, keyStore.Unlock(testutils.Context(t), cltest.Password)) - ks := keyStore.DKGSign() - - assert.NotNil(t, ks) - - reset := func() { - ctx := context.Background() // Executed on cleanup - _, err := db.Exec("DELETE FROM encrypted_key_rings") - require.NoError(t, err) - keyStore.ResetXXXTestOnly() - require.NoError(t, keyStore.Unlock(ctx, cltest.Password)) - } - - t.Run("initializes with an empty state", func(t *testing.T) { - defer reset() - keys, err := ks.GetAll() - require.NoError(t, err) - require.Equal(t, 0, len(keys)) - }) - - t.Run("errors when getting non-existent ID", func(t *testing.T) { - defer reset() - _, err := ks.Get("non-existent-id") - require.Error(t, err) - }) - - t.Run("creates a key", func(t *testing.T) { - defer reset() - ctx := testutils.Context(t) - key, err := ks.Create(ctx) - require.NoError(t, err) - retrievedKey, err := ks.Get(key.ID()) - require.NoError(t, err) - require.Equal(t, key, retrievedKey) - }) - - t.Run("imports and exports a key", func(t *testing.T) { - defer reset() - ctx := testutils.Context(t) - key, err := ks.Create(ctx) - require.NoError(t, err) - exportJSON, err := ks.Export(key.ID(), cltest.Password) - require.NoError(t, err) - _, err = ks.Delete(ctx, key.ID()) - require.NoError(t, err) - _, err = ks.Get(key.ID()) - require.Error(t, err) - importedKey, err := ks.Import(ctx, exportJSON, cltest.Password) - require.NoError(t, err) - require.Equal(t, key.ID(), importedKey.ID()) - retrievedKey, err := ks.Get(key.ID()) - require.NoError(t, err) - require.Equal(t, importedKey, retrievedKey) - }) - - t.Run("adds an externally created key / deletes a key", func(t *testing.T) { - defer reset() - ctx := testutils.Context(t) - newKey, err := dkgsignkey.New() - require.NoError(t, err) - err = ks.Add(ctx, newKey) - require.NoError(t, err) - keys, err := ks.GetAll() - require.NoError(t, err) - require.Equal(t, 1, len(keys)) - _, err = ks.Delete(ctx, newKey.ID()) - require.NoError(t, err) - keys, err = ks.GetAll() - require.NoError(t, err) - require.Equal(t, 0, len(keys)) - _, err = ks.Get(newKey.ID()) - require.Error(t, err) - }) - - t.Run("adds an externally created key/ensures it already exists", func(t *testing.T) { - defer reset() - ctx := testutils.Context(t) - newKey, err := dkgsignkey.New() - assert.NoError(t, err) - err = ks.Add(ctx, newKey) - assert.NoError(t, err) - - err = keyStore.DKGSign().EnsureKey(ctx) - assert.NoError(t, err) - keys, err2 := ks.GetAll() - assert.NoError(t, err2) - - require.Equal(t, 1, len(keys)) - require.Equal(t, newKey.ID(), keys[0].ID()) - require.Equal(t, newKey.PublicKey, keys[0].PublicKey) - }) - - t.Run("auto creates a key if it doesn't exists when trying to ensure it already exists", func(t *testing.T) { - defer reset() - ctx := testutils.Context(t) - - keys, err := ks.GetAll() - assert.NoError(t, err) - assert.Equal(t, 0, len(keys)) - - err = keyStore.DKGSign().EnsureKey(ctx) - assert.NoError(t, err) - - keys, err = ks.GetAll() - assert.NoError(t, err) - - require.NoError(t, err) - require.Equal(t, 1, len(keys)) - }) -} diff --git a/core/services/keystore/keys/dkgencryptkey/export.go b/core/services/keystore/keys/dkgencryptkey/export.go deleted file mode 100644 index 3bccf1a07ba..00000000000 --- a/core/services/keystore/keys/dkgencryptkey/export.go +++ /dev/null @@ -1,44 +0,0 @@ -package dkgencryptkey - -import ( - "github.com/ethereum/go-ethereum/accounts/keystore" - - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys" - "github.com/smartcontractkit/chainlink/v2/core/utils" -) - -const keyTypeIdentifier = "DKGEncrypt" - -// FromEncryptedJSON returns a dkgencryptkey.KeyV2 from encrypted data in go-ethereum keystore format. -func FromEncryptedJSON(keyJSON []byte, password string) (Key, error) { - return keys.FromEncryptedJSON( - keyTypeIdentifier, - keyJSON, - password, - adulteratedPassword, - func(_ keys.EncryptedKeyExport, rawPrivKey []byte) (Key, error) { - return Raw(rawPrivKey).Key(), nil - }) -} - -// ToEncryptedJSON exports this key into a JSON object following the format of EncryptedDKGEncryptKeyExport -func (k Key) ToEncryptedJSON(password string, scryptParams utils.ScryptParams) (export []byte, err error) { - return keys.ToEncryptedJSON( - keyTypeIdentifier, - k.Raw(), - k, - password, - scryptParams, - adulteratedPassword, - func(id string, key Key, cryptoJSON keystore.CryptoJSON) keys.EncryptedKeyExport { - return keys.EncryptedKeyExport{ - KeyType: id, - PublicKey: key.PublicKeyString(), - Crypto: cryptoJSON, - } - }) -} - -func adulteratedPassword(password string) string { - return "dkgencryptkey" + password -} diff --git a/core/services/keystore/keys/dkgencryptkey/export_test.go b/core/services/keystore/keys/dkgencryptkey/export_test.go deleted file mode 100644 index 952c786d8ab..00000000000 --- a/core/services/keystore/keys/dkgencryptkey/export_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package dkgencryptkey - -import ( - "testing" - - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys" -) - -func TestDKGEncryptKeys_ExportImport(t *testing.T) { - keys.RunKeyExportImportTestcase(t, createKey, decryptKey) -} - -func createKey() (keys.KeyType, error) { - return New() -} - -func decryptKey(keyJSON []byte, password string) (keys.KeyType, error) { - return FromEncryptedJSON(keyJSON, password) -} diff --git a/core/services/keystore/keys/dkgencryptkey/key.go b/core/services/keystore/keys/dkgencryptkey/key.go deleted file mode 100644 index e94f2a6bdf4..00000000000 --- a/core/services/keystore/keys/dkgencryptkey/key.go +++ /dev/null @@ -1,116 +0,0 @@ -package dkgencryptkey - -import ( - "encoding/hex" - "fmt" - "math/big" - - "github.com/pkg/errors" - "go.dedis.ch/kyber/v3" - "go.dedis.ch/kyber/v3/pairing" - - "github.com/smartcontractkit/chainlink-vrf/altbn_128" -) - -var suite pairing.Suite = &altbn_128.PairingSuite{} -var g1 = suite.G1() - -type Raw []byte - -func (r Raw) Key() Key { - scalar := g1.Scalar() - err := scalar.UnmarshalBinary(r) - if err != nil { - panic(err) // should never happen6 - } - key, err := keyFromScalar(scalar) - if err != nil { - panic(err) // should never happen - } - return key -} - -func (r Raw) String() string { - return "" -} - -func (r Raw) GoString() string { - return r.String() -} - -type Key struct { - privateKey kyber.Scalar - publicKeyBytes []byte - PublicKey kyber.Point -} - -// New returns a new dkgencryptkey key -func New() (Key, error) { - return keyFromScalar(g1.Scalar().Pick(suite.RandomStream())) -} - -// MustNewXXXTestingOnly creates a new DKGEncrypt key from the given secret key. -// NOTE: for testing only. -func MustNewXXXTestingOnly(sk *big.Int) Key { - key, err := keyFromScalar(g1.Scalar().SetInt64(sk.Int64())) - if err != nil { - panic(err) - } - return key -} - -var _ fmt.GoStringer = &Key{} - -// GoString implements fmt.GoStringer -func (k Key) GoString() string { - return k.String() -} - -// String returns the string representation of this key -func (k Key) String() string { - return fmt.Sprintf("DKGEncryptKey{PrivateKey: , PublicKey: %s", k.PublicKeyString()) -} - -// ID returns the ID of this key -func (k Key) ID() string { - return k.PublicKeyString() -} - -// PublicKeyString returns the hex representation of this key's public key -func (k Key) PublicKeyString() string { - return hex.EncodeToString(k.publicKeyBytes) -} - -// Raw returns the key raw data -func (k Key) Raw() Raw { - raw, err := k.privateKey.MarshalBinary() - if err != nil { - panic(err) // should never happen - } - return Raw(raw) -} - -// KyberScalar returns the private key as a kyber.Scalar object -func (k Key) KyberScalar() kyber.Scalar { - return g1.Scalar().Set(k.privateKey) -} - -// KyberPoint returns the public key as a kyber.Point object -func (k Key) KyberPoint() kyber.Point { - return g1.Point().Base().Mul(k.privateKey, nil) -} - -// keyFromScalar creates a new dkgencryptkey key from the given scalar. -// the given scalar must be a scalar of the g1 group in the altbn_128 pairing. -func keyFromScalar(k kyber.Scalar) (Key, error) { - publicKey := g1.Point().Base().Mul(k, nil) - publicKeyBytes, err := publicKey.MarshalBinary() - if err != nil { - return Key{}, errors.Wrap(err, "kyber point MarshalBinary") - } - return Key{ - privateKey: k, - PublicKey: publicKey, - publicKeyBytes: publicKeyBytes, - }, nil -} diff --git a/core/services/keystore/keys/dkgencryptkey/key_test.go b/core/services/keystore/keys/dkgencryptkey/key_test.go deleted file mode 100644 index 3bf12772a46..00000000000 --- a/core/services/keystore/keys/dkgencryptkey/key_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package dkgencryptkey - -import ( - "math/big" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/smartcontractkit/chainlink/v2/core/utils" -) - -func TestNew(t *testing.T) { - key, err := New() - assert.NoError(t, err) - assert.NotNil(t, key.privateKey) - assert.NotNil(t, key.PublicKey) - assert.NotNil(t, key.publicKeyBytes) -} - -func TestStringers(t *testing.T) { - key := MustNewXXXTestingOnly(big.NewInt(1337)) - assert.Equal(t, "26578c46722826d18dc5f5a954c65c5c78e0d215a465356502ff8f002aff36ef", key.PublicKeyString()) - assert.Equal(t, - "DKGEncryptKey{PrivateKey: , PublicKey: 26578c46722826d18dc5f5a954c65c5c78e0d215a465356502ff8f002aff36ef", - key.String()) - assert.Equal(t, - "DKGEncryptKey{PrivateKey: , PublicKey: 26578c46722826d18dc5f5a954c65c5c78e0d215a465356502ff8f002aff36ef", - key.GoString()) - assert.Equal(t, - "26578c46722826d18dc5f5a954c65c5c78e0d215a465356502ff8f002aff36ef", - key.ID()) -} - -func TestRaw(t *testing.T) { - key := MustNewXXXTestingOnly(big.NewInt(1337)) - rawFromKey := key.Raw() - scalar := g1.Scalar().SetBytes(rawFromKey) - assert.True(t, scalar.Equal(key.privateKey)) - - keyFromRaw := rawFromKey.Key() - assert.True(t, keyFromRaw.privateKey.Equal(key.privateKey)) - - assert.Equal(t, "", rawFromKey.GoString()) - assert.Equal(t, "", rawFromKey.String()) -} - -func TestExportImport(t *testing.T) { - password := "helloworld" - key := MustNewXXXTestingOnly(big.NewInt(1337)) - encryptedJSON, err := key.ToEncryptedJSON(password, utils.DefaultScryptParams) - assert.NoError(t, err) - - decryptedKey, err := FromEncryptedJSON(encryptedJSON, password) - assert.NoError(t, err) - assert.True(t, decryptedKey.privateKey.Equal(key.privateKey)) - assert.True(t, decryptedKey.PublicKey.Equal(key.PublicKey)) - assert.ElementsMatch(t, decryptedKey.publicKeyBytes, key.publicKeyBytes) -} diff --git a/core/services/keystore/keys/dkgsignkey/export.go b/core/services/keystore/keys/dkgsignkey/export.go deleted file mode 100644 index 3c421760d63..00000000000 --- a/core/services/keystore/keys/dkgsignkey/export.go +++ /dev/null @@ -1,46 +0,0 @@ -package dkgsignkey - -import ( - "github.com/ethereum/go-ethereum/accounts/keystore" - - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys" - "github.com/smartcontractkit/chainlink/v2/core/utils" -) - -const keyTypeIdentifier = "DKGSign" - -// FromEncryptedJSON returns a dkgsignkey.Key from encrypted data in go-ethereum keystore format. -func FromEncryptedJSON(keyJSON []byte, password string) (Key, error) { - return keys.FromEncryptedJSON( - keyTypeIdentifier, - keyJSON, - password, - adulteratedPassword, - func(_ keys.EncryptedKeyExport, rawPrivKey []byte) (Key, error) { - return Raw(rawPrivKey).Key(), nil - }, - ) -} - -// ToEncryptedJSON exports this key into a JSON object following the format of EncryptedDKGSignKeyExport -func (key Key) ToEncryptedJSON(password string, scryptParams utils.ScryptParams) (export []byte, err error) { - return keys.ToEncryptedJSON( - keyTypeIdentifier, - key.Raw(), - key, - password, - scryptParams, - adulteratedPassword, - func(id string, key Key, cryptoJSON keystore.CryptoJSON) keys.EncryptedKeyExport { - return keys.EncryptedKeyExport{ - KeyType: id, - PublicKey: key.PublicKeyString(), - Crypto: cryptoJSON, - } - }, - ) -} - -func adulteratedPassword(password string) string { - return "dkgsignkey" + password -} diff --git a/core/services/keystore/keys/dkgsignkey/export_test.go b/core/services/keystore/keys/dkgsignkey/export_test.go deleted file mode 100644 index 90d8f66ab38..00000000000 --- a/core/services/keystore/keys/dkgsignkey/export_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package dkgsignkey - -import ( - "testing" - - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys" -) - -func TestDKGSignKeys_ExportImport(t *testing.T) { - keys.RunKeyExportImportTestcase(t, createKey, decryptKey) -} - -func createKey() (keys.KeyType, error) { - return New() -} - -func decryptKey(keyJSON []byte, password string) (keys.KeyType, error) { - return FromEncryptedJSON(keyJSON, password) -} diff --git a/core/services/keystore/keys/dkgsignkey/key.go b/core/services/keystore/keys/dkgsignkey/key.go deleted file mode 100644 index 6ab18810689..00000000000 --- a/core/services/keystore/keys/dkgsignkey/key.go +++ /dev/null @@ -1,92 +0,0 @@ -package dkgsignkey - -import ( - "encoding/hex" - "fmt" - "math/big" - - "go.dedis.ch/kyber/v3" - "go.dedis.ch/kyber/v3/group/edwards25519" -) - -var suite = edwards25519.NewBlakeSHA256Ed25519() - -// Raw represents a raw dkgsign secret key in little-endian byte order. -type Raw []byte - -// Key returns a Key object from this raw data. -func (r Raw) Key() Key { - privKey := suite.Scalar().SetBytes(r) - key, err := keyFromScalar(privKey) - if err != nil { - panic(err) // should never happen - } - return key -} - -func (r Raw) String() string { - return "" -} - -func (r Raw) GoString() string { - return r.String() -} - -// Key is DKG signing key that conforms to the keystore.Key interface -type Key struct { - privateKey kyber.Scalar - publicKeyBytes []byte - PublicKey kyber.Point -} - -// New creates a new DKGSign key -func New() (Key, error) { - privateKey := suite.Scalar().Pick(suite.RandomStream()) - return keyFromScalar(privateKey) -} - -// MustNewXXXTestingOnly creates a new DKGSign key from the given secret key. -// NOTE: for testing only. -func MustNewXXXTestingOnly(sk *big.Int) Key { - key, err := keyFromScalar(scalarFromBig(sk)) - if err != nil { - panic(err) - } - return key -} - -var _ fmt.GoStringer = &Key{} - -// GoString implements fmt.GoStringer -func (k Key) GoString() string { - return k.String() -} - -// String returns the string representation of this key -func (k Key) String() string { - return fmt.Sprintf("DKGSignKey{PrivateKey: , PublicKey: %s", k.PublicKey) -} - -// ID returns the ID of this key -func (k Key) ID() string { - return k.PublicKeyString() -} - -// PublicKeyString returns the hex representation of this key's public key -func (k Key) PublicKeyString() string { - return hex.EncodeToString(k.publicKeyBytes) -} - -// Raw returns the key raw data -func (k Key) Raw() Raw { - raw, err := k.privateKey.MarshalBinary() - if err != nil { - panic(err) // should never happen - } - return Raw(raw) -} - -// KyberScalar returns the private key as a kyber.Scalar object -func (k Key) KyberScalar() kyber.Scalar { - return suite.Scalar().Set(k.privateKey) -} diff --git a/core/services/keystore/keys/dkgsignkey/key_test.go b/core/services/keystore/keys/dkgsignkey/key_test.go deleted file mode 100644 index 736aca34f64..00000000000 --- a/core/services/keystore/keys/dkgsignkey/key_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package dkgsignkey - -import ( - "math/big" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/smartcontractkit/chainlink/v2/core/utils" -) - -func TestNew(t *testing.T) { - key, err := New() - assert.NoError(t, err) - assert.NotNil(t, key.privateKey) - assert.NotNil(t, key.PublicKey) - assert.NotNil(t, key.publicKeyBytes) -} - -func TestStringers(t *testing.T) { - key := MustNewXXXTestingOnly(big.NewInt(1337)) - assert.Equal(t, "becd7a86af89b2f3ffd11fabe897de820b74cd2956c6e047a14e35d090ade17d", key.PublicKeyString()) - assert.Equal(t, - "DKGSignKey{PrivateKey: , PublicKey: becd7a86af89b2f3ffd11fabe897de820b74cd2956c6e047a14e35d090ade17d", - key.String()) - assert.Equal(t, - "DKGSignKey{PrivateKey: , PublicKey: becd7a86af89b2f3ffd11fabe897de820b74cd2956c6e047a14e35d090ade17d", - key.GoString()) - assert.Equal(t, - "becd7a86af89b2f3ffd11fabe897de820b74cd2956c6e047a14e35d090ade17d", - key.ID()) -} - -func TestRaw(t *testing.T) { - key := MustNewXXXTestingOnly(big.NewInt(1337)) - rawFromKey := key.Raw() - scalar := suite.Scalar().SetBytes(rawFromKey) - assert.True(t, scalar.Equal(key.privateKey)) - - keyFromRaw := rawFromKey.Key() - assert.True(t, keyFromRaw.privateKey.Equal(key.privateKey)) - - assert.Equal(t, "", rawFromKey.GoString()) - assert.Equal(t, "", rawFromKey.String()) -} - -func TestExportImport(t *testing.T) { - password := "helloworld" - key := MustNewXXXTestingOnly(big.NewInt(1337)) - encryptedJSON, err := key.ToEncryptedJSON(password, utils.DefaultScryptParams) - assert.NoError(t, err) - - decryptedKey, err := FromEncryptedJSON(encryptedJSON, password) - assert.NoError(t, err) - assert.True(t, decryptedKey.privateKey.Equal(key.privateKey)) - assert.True(t, decryptedKey.PublicKey.Equal(key.PublicKey)) - assert.ElementsMatch(t, decryptedKey.publicKeyBytes, key.publicKeyBytes) -} diff --git a/core/services/keystore/keys/dkgsignkey/utils.go b/core/services/keystore/keys/dkgsignkey/utils.go deleted file mode 100644 index 8b4add1ed1e..00000000000 --- a/core/services/keystore/keys/dkgsignkey/utils.go +++ /dev/null @@ -1,39 +0,0 @@ -package dkgsignkey - -import ( - "math/big" - - "github.com/pkg/errors" - "go.dedis.ch/kyber/v3" -) - -// scalarFromBig creates a kyber.Scalar belonging to the edwards25519 -// kyber suite from a big integer. This is useful for testing. -func scalarFromBig(i *big.Int) kyber.Scalar { - scalar := suite.Scalar() - // big.Int.Bytes() returns a byte slice in big-endian order, - // need to reverse the slice before we SetBytes since - // SetBytes interprets it in little-endian order. - b := i.Bytes() - reverseSliceInPlace(b) - return scalar.SetBytes(b) -} - -func keyFromScalar(k kyber.Scalar) (Key, error) { - publicKey := suite.Point().Base().Mul(k, nil) - publicKeyBytes, err := publicKey.MarshalBinary() - if err != nil { - return Key{}, errors.Wrap(err, "kyber point MarshalBinary") - } - return Key{ - privateKey: k, - PublicKey: publicKey, - publicKeyBytes: publicKeyBytes, - }, nil -} - -func reverseSliceInPlace[T any](elems []T) { - for i := 0; i < len(elems)/2; i++ { - elems[i], elems[len(elems)-i-1] = elems[len(elems)-i-1], elems[i] - } -} diff --git a/core/services/keystore/keystoretest.go b/core/services/keystore/keystoretest.go index 990f06c91ab..e179b51bb54 100644 --- a/core/services/keystore/keystoretest.go +++ b/core/services/keystore/keystoretest.go @@ -75,7 +75,5 @@ func NewInMemory(ds sqlutil.DataSource, scryptParams utils.ScryptParams, lggr lo starknet: newStarkNetKeyStore(km), aptos: newAptosKeyStore(km), vrf: newVRFKeyStore(km), - dkgSign: newDKGSignKeyStore(km), - dkgEncrypt: newDKGEncryptKeyStore(km), } } diff --git a/core/services/keystore/master.go b/core/services/keystore/master.go index da42f5368ca..4076fee6a2a 100644 --- a/core/services/keystore/master.go +++ b/core/services/keystore/master.go @@ -14,8 +14,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/aptoskey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/cosmoskey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/csakey" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgencryptkey" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgsignkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocrkey" @@ -40,8 +38,6 @@ type DefaultEVMChainIDFunc func() (defaultEVMChainID *big.Int, err error) type Master interface { CSA() CSA - DKGSign() DKGSign - DKGEncrypt() DKGEncrypt Eth() Eth OCR() OCR OCR2() OCR2 @@ -57,18 +53,16 @@ type Master interface { type master struct { *keyManager - cosmos *cosmos - csa *csa - eth *eth - ocr *ocr - ocr2 ocr2 - p2p *p2p - solana *solana - starknet *starknet - aptos *aptos - vrf *vrf - dkgSign *dkgSign - dkgEncrypt *dkgEncrypt + cosmos *cosmos + csa *csa + eth *eth + ocr *ocr + ocr2 ocr2 + p2p *p2p + solana *solana + starknet *starknet + aptos *aptos + vrf *vrf } func New(ds sqlutil.DataSource, scryptParams utils.ScryptParams, lggr logger.Logger) Master { @@ -97,19 +91,9 @@ func newMaster(ds sqlutil.DataSource, scryptParams utils.ScryptParams, lggr logg starknet: newStarkNetKeyStore(km), aptos: newAptosKeyStore(km), vrf: newVRFKeyStore(km), - dkgSign: newDKGSignKeyStore(km), - dkgEncrypt: newDKGEncryptKeyStore(km), } } -func (ks *master) DKGEncrypt() DKGEncrypt { - return ks.dkgEncrypt -} - -func (ks master) DKGSign() DKGSign { - return ks.dkgSign -} - func (ks master) CSA() CSA { return ks.csa } @@ -285,10 +269,6 @@ func GetFieldNameForKey(unknownKey Key) (string, error) { return "Aptos", nil case vrfkey.KeyV2: return "VRF", nil - case dkgsignkey.Key: - return "DKGSign", nil - case dkgencryptkey.Key: - return "DKGEncrypt", nil } return "", fmt.Errorf("unknown key type: %T", unknownKey) } diff --git a/core/services/keystore/mocks/dkg_encrypt.go b/core/services/keystore/mocks/dkg_encrypt.go deleted file mode 100644 index 1a3fddf5771..00000000000 --- a/core/services/keystore/mocks/dkg_encrypt.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - context "context" - - dkgencryptkey "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgencryptkey" - - mock "github.com/stretchr/testify/mock" -) - -// DKGEncrypt is an autogenerated mock type for the DKGEncrypt type -type DKGEncrypt struct { - mock.Mock -} - -// Add provides a mock function with given fields: ctx, key -func (_m *DKGEncrypt) Add(ctx context.Context, key dkgencryptkey.Key) error { - ret := _m.Called(ctx, key) - - if len(ret) == 0 { - panic("no return value specified for Add") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, dkgencryptkey.Key) error); ok { - r0 = rf(ctx, key) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Create provides a mock function with given fields: ctx -func (_m *DKGEncrypt) Create(ctx context.Context) (dkgencryptkey.Key, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for Create") - } - - var r0 dkgencryptkey.Key - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (dkgencryptkey.Key, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) dkgencryptkey.Key); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(dkgencryptkey.Key) - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Delete provides a mock function with given fields: ctx, id -func (_m *DKGEncrypt) Delete(ctx context.Context, id string) (dkgencryptkey.Key, error) { - ret := _m.Called(ctx, id) - - if len(ret) == 0 { - panic("no return value specified for Delete") - } - - var r0 dkgencryptkey.Key - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (dkgencryptkey.Key, error)); ok { - return rf(ctx, id) - } - if rf, ok := ret.Get(0).(func(context.Context, string) dkgencryptkey.Key); ok { - r0 = rf(ctx, id) - } else { - r0 = ret.Get(0).(dkgencryptkey.Key) - } - - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, id) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// EnsureKey provides a mock function with given fields: ctx -func (_m *DKGEncrypt) EnsureKey(ctx context.Context) error { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for EnsureKey") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context) error); ok { - r0 = rf(ctx) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Export provides a mock function with given fields: id, password -func (_m *DKGEncrypt) Export(id string, password string) ([]byte, error) { - ret := _m.Called(id, password) - - if len(ret) == 0 { - panic("no return value specified for Export") - } - - var r0 []byte - var r1 error - if rf, ok := ret.Get(0).(func(string, string) ([]byte, error)); ok { - return rf(id, password) - } - if rf, ok := ret.Get(0).(func(string, string) []byte); ok { - r0 = rf(id, password) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]byte) - } - } - - if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(id, password) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Get provides a mock function with given fields: id -func (_m *DKGEncrypt) Get(id string) (dkgencryptkey.Key, error) { - ret := _m.Called(id) - - if len(ret) == 0 { - panic("no return value specified for Get") - } - - var r0 dkgencryptkey.Key - var r1 error - if rf, ok := ret.Get(0).(func(string) (dkgencryptkey.Key, error)); ok { - return rf(id) - } - if rf, ok := ret.Get(0).(func(string) dkgencryptkey.Key); ok { - r0 = rf(id) - } else { - r0 = ret.Get(0).(dkgencryptkey.Key) - } - - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(id) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetAll provides a mock function with given fields: -func (_m *DKGEncrypt) GetAll() ([]dkgencryptkey.Key, error) { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for GetAll") - } - - var r0 []dkgencryptkey.Key - var r1 error - if rf, ok := ret.Get(0).(func() ([]dkgencryptkey.Key, error)); ok { - return rf() - } - if rf, ok := ret.Get(0).(func() []dkgencryptkey.Key); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]dkgencryptkey.Key) - } - } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Import provides a mock function with given fields: ctx, keyJSON, password -func (_m *DKGEncrypt) Import(ctx context.Context, keyJSON []byte, password string) (dkgencryptkey.Key, error) { - ret := _m.Called(ctx, keyJSON, password) - - if len(ret) == 0 { - panic("no return value specified for Import") - } - - var r0 dkgencryptkey.Key - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, []byte, string) (dkgencryptkey.Key, error)); ok { - return rf(ctx, keyJSON, password) - } - if rf, ok := ret.Get(0).(func(context.Context, []byte, string) dkgencryptkey.Key); ok { - r0 = rf(ctx, keyJSON, password) - } else { - r0 = ret.Get(0).(dkgencryptkey.Key) - } - - if rf, ok := ret.Get(1).(func(context.Context, []byte, string) error); ok { - r1 = rf(ctx, keyJSON, password) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewDKGEncrypt creates a new instance of DKGEncrypt. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewDKGEncrypt(t interface { - mock.TestingT - Cleanup(func()) -}) *DKGEncrypt { - mock := &DKGEncrypt{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/core/services/keystore/mocks/dkg_sign.go b/core/services/keystore/mocks/dkg_sign.go deleted file mode 100644 index 01e69f8f3fb..00000000000 --- a/core/services/keystore/mocks/dkg_sign.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - context "context" - - dkgsignkey "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgsignkey" - - mock "github.com/stretchr/testify/mock" -) - -// DKGSign is an autogenerated mock type for the DKGSign type -type DKGSign struct { - mock.Mock -} - -// Add provides a mock function with given fields: ctx, key -func (_m *DKGSign) Add(ctx context.Context, key dkgsignkey.Key) error { - ret := _m.Called(ctx, key) - - if len(ret) == 0 { - panic("no return value specified for Add") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, dkgsignkey.Key) error); ok { - r0 = rf(ctx, key) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Create provides a mock function with given fields: ctx -func (_m *DKGSign) Create(ctx context.Context) (dkgsignkey.Key, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for Create") - } - - var r0 dkgsignkey.Key - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (dkgsignkey.Key, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) dkgsignkey.Key); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(dkgsignkey.Key) - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Delete provides a mock function with given fields: ctx, id -func (_m *DKGSign) Delete(ctx context.Context, id string) (dkgsignkey.Key, error) { - ret := _m.Called(ctx, id) - - if len(ret) == 0 { - panic("no return value specified for Delete") - } - - var r0 dkgsignkey.Key - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (dkgsignkey.Key, error)); ok { - return rf(ctx, id) - } - if rf, ok := ret.Get(0).(func(context.Context, string) dkgsignkey.Key); ok { - r0 = rf(ctx, id) - } else { - r0 = ret.Get(0).(dkgsignkey.Key) - } - - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, id) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// EnsureKey provides a mock function with given fields: ctx -func (_m *DKGSign) EnsureKey(ctx context.Context) error { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for EnsureKey") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context) error); ok { - r0 = rf(ctx) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Export provides a mock function with given fields: id, password -func (_m *DKGSign) Export(id string, password string) ([]byte, error) { - ret := _m.Called(id, password) - - if len(ret) == 0 { - panic("no return value specified for Export") - } - - var r0 []byte - var r1 error - if rf, ok := ret.Get(0).(func(string, string) ([]byte, error)); ok { - return rf(id, password) - } - if rf, ok := ret.Get(0).(func(string, string) []byte); ok { - r0 = rf(id, password) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]byte) - } - } - - if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(id, password) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Get provides a mock function with given fields: id -func (_m *DKGSign) Get(id string) (dkgsignkey.Key, error) { - ret := _m.Called(id) - - if len(ret) == 0 { - panic("no return value specified for Get") - } - - var r0 dkgsignkey.Key - var r1 error - if rf, ok := ret.Get(0).(func(string) (dkgsignkey.Key, error)); ok { - return rf(id) - } - if rf, ok := ret.Get(0).(func(string) dkgsignkey.Key); ok { - r0 = rf(id) - } else { - r0 = ret.Get(0).(dkgsignkey.Key) - } - - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(id) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetAll provides a mock function with given fields: -func (_m *DKGSign) GetAll() ([]dkgsignkey.Key, error) { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for GetAll") - } - - var r0 []dkgsignkey.Key - var r1 error - if rf, ok := ret.Get(0).(func() ([]dkgsignkey.Key, error)); ok { - return rf() - } - if rf, ok := ret.Get(0).(func() []dkgsignkey.Key); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]dkgsignkey.Key) - } - } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Import provides a mock function with given fields: ctx, keyJSON, password -func (_m *DKGSign) Import(ctx context.Context, keyJSON []byte, password string) (dkgsignkey.Key, error) { - ret := _m.Called(ctx, keyJSON, password) - - if len(ret) == 0 { - panic("no return value specified for Import") - } - - var r0 dkgsignkey.Key - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, []byte, string) (dkgsignkey.Key, error)); ok { - return rf(ctx, keyJSON, password) - } - if rf, ok := ret.Get(0).(func(context.Context, []byte, string) dkgsignkey.Key); ok { - r0 = rf(ctx, keyJSON, password) - } else { - r0 = ret.Get(0).(dkgsignkey.Key) - } - - if rf, ok := ret.Get(1).(func(context.Context, []byte, string) error); ok { - r1 = rf(ctx, keyJSON, password) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewDKGSign creates a new instance of DKGSign. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewDKGSign(t interface { - mock.TestingT - Cleanup(func()) -}) *DKGSign { - mock := &DKGSign{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/core/services/keystore/mocks/master.go b/core/services/keystore/mocks/master.go index 0e706141704..d6c089f2a8a 100644 --- a/core/services/keystore/mocks/master.go +++ b/core/services/keystore/mocks/master.go @@ -74,46 +74,6 @@ func (_m *Master) Cosmos() keystore.Cosmos { return r0 } -// DKGEncrypt provides a mock function with given fields: -func (_m *Master) DKGEncrypt() keystore.DKGEncrypt { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for DKGEncrypt") - } - - var r0 keystore.DKGEncrypt - if rf, ok := ret.Get(0).(func() keystore.DKGEncrypt); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(keystore.DKGEncrypt) - } - } - - return r0 -} - -// DKGSign provides a mock function with given fields: -func (_m *Master) DKGSign() keystore.DKGSign { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for DKGSign") - } - - var r0 keystore.DKGSign - if rf, ok := ret.Get(0).(func() keystore.DKGSign); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(keystore.DKGSign) - } - } - - return r0 -} - // Eth provides a mock function with given fields: func (_m *Master) Eth() keystore.Eth { ret := _m.Called() diff --git a/core/services/keystore/models.go b/core/services/keystore/models.go index 3c4efdf2695..d5eec6802b9 100644 --- a/core/services/keystore/models.go +++ b/core/services/keystore/models.go @@ -14,8 +14,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/aptoskey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/cosmoskey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/csakey" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgencryptkey" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgsignkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocrkey" @@ -160,25 +158,21 @@ type keyRing struct { StarkNet map[string]starkkey.Key Aptos map[string]aptoskey.Key VRF map[string]vrfkey.KeyV2 - DKGSign map[string]dkgsignkey.Key - DKGEncrypt map[string]dkgencryptkey.Key LegacyKeys LegacyKeyStorage } func newKeyRing() *keyRing { return &keyRing{ - CSA: make(map[string]csakey.KeyV2), - Eth: make(map[string]ethkey.KeyV2), - OCR: make(map[string]ocrkey.KeyV2), - OCR2: make(map[string]ocr2key.KeyBundle), - P2P: make(map[string]p2pkey.KeyV2), - Cosmos: make(map[string]cosmoskey.Key), - Solana: make(map[string]solkey.Key), - StarkNet: make(map[string]starkkey.Key), - Aptos: make(map[string]aptoskey.Key), - VRF: make(map[string]vrfkey.KeyV2), - DKGSign: make(map[string]dkgsignkey.Key), - DKGEncrypt: make(map[string]dkgencryptkey.Key), + CSA: make(map[string]csakey.KeyV2), + Eth: make(map[string]ethkey.KeyV2), + OCR: make(map[string]ocrkey.KeyV2), + OCR2: make(map[string]ocr2key.KeyBundle), + P2P: make(map[string]p2pkey.KeyV2), + Cosmos: make(map[string]cosmoskey.Key), + Solana: make(map[string]solkey.Key), + StarkNet: make(map[string]starkkey.Key), + Aptos: make(map[string]aptoskey.Key), + VRF: make(map[string]vrfkey.KeyV2), } } @@ -242,12 +236,6 @@ func (kr *keyRing) raw() (rawKeys rawKeyRing) { for _, vrfKey := range kr.VRF { rawKeys.VRF = append(rawKeys.VRF, vrfKey.Raw()) } - for _, dkgSignKey := range kr.DKGSign { - rawKeys.DKGSign = append(rawKeys.DKGSign, dkgSignKey.Raw()) - } - for _, dkgEncryptKey := range kr.DKGEncrypt { - rawKeys.DKGEncrypt = append(rawKeys.DKGEncrypt, dkgEncryptKey.Raw()) - } return rawKeys } @@ -293,14 +281,6 @@ func (kr *keyRing) logPubKeys(lggr logger.Logger) { for _, VRFKey := range kr.VRF { vrfIDs = append(vrfIDs, VRFKey.ID()) } - var dkgSignIDs []string - for _, dkgSignKey := range kr.DKGSign { - dkgSignIDs = append(dkgSignIDs, dkgSignKey.ID()) - } - var dkgEncryptIDs []string - for _, dkgEncryptKey := range kr.DKGEncrypt { - dkgEncryptIDs = append(dkgEncryptIDs, dkgEncryptKey.ID()) - } if len(csaIDs) > 0 { lggr.Infow(fmt.Sprintf("Unlocked %d CSA keys", len(csaIDs)), "keys", csaIDs) } @@ -331,12 +311,6 @@ func (kr *keyRing) logPubKeys(lggr logger.Logger) { if len(vrfIDs) > 0 { lggr.Infow(fmt.Sprintf("Unlocked %d VRF keys", len(vrfIDs)), "keys", vrfIDs) } - if len(dkgSignIDs) > 0 { - lggr.Infow(fmt.Sprintf("Unlocked %d DKGSign keys", len(dkgSignIDs)), "keys", dkgSignIDs) - } - if len(dkgEncryptIDs) > 0 { - lggr.Infow(fmt.Sprintf("Unlocked %d DKGEncrypt keys", len(dkgEncryptIDs)), "keys", dkgEncryptIDs) - } if len(kr.LegacyKeys.legacyRawKeys) > 0 { lggr.Infow(fmt.Sprintf("%d keys stored in legacy system", kr.LegacyKeys.legacyRawKeys.len())) } @@ -356,8 +330,6 @@ type rawKeyRing struct { StarkNet []starkkey.Raw Aptos []aptoskey.Raw VRF []vrfkey.Raw - DKGSign []dkgsignkey.Raw - DKGEncrypt []dkgencryptkey.Raw LegacyKeys LegacyKeyStorage `json:"-"` } @@ -404,14 +376,6 @@ func (rawKeys rawKeyRing) keys() (*keyRing, error) { vrfKey := rawVRFKey.Key() keyRing.VRF[vrfKey.ID()] = vrfKey } - for _, rawDKGSignKey := range rawKeys.DKGSign { - dkgSignKey := rawDKGSignKey.Key() - keyRing.DKGSign[dkgSignKey.ID()] = dkgSignKey - } - for _, rawDKGEncryptKey := range rawKeys.DKGEncrypt { - dkgEncryptKey := rawDKGEncryptKey.Key() - keyRing.DKGEncrypt[dkgEncryptKey.ID()] = dkgEncryptKey - } keyRing.LegacyKeys = rawKeys.LegacyKeys return keyRing, nil diff --git a/core/services/keystore/models_test.go b/core/services/keystore/models_test.go index 25331a3b218..8f7881809ea 100644 --- a/core/services/keystore/models_test.go +++ b/core/services/keystore/models_test.go @@ -11,8 +11,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/cosmoskey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/csakey" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgencryptkey" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgsignkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocrkey" @@ -42,19 +40,15 @@ func TestKeyRing_Encrypt_Decrypt(t *testing.T) { sol1, sol2 := solkey.MustNewInsecure(rand.Reader), solkey.MustNewInsecure(rand.Reader) vrf1, vrf2 := vrfkey.MustNewV2XXXTestingOnly(big.NewInt(1)), vrfkey.MustNewV2XXXTestingOnly(big.NewInt(2)) tk1, tk2 := cosmoskey.MustNewInsecure(rand.Reader), cosmoskey.MustNewInsecure(rand.Reader) - dkgsign1, dkgsign2 := dkgsignkey.MustNewXXXTestingOnly(big.NewInt(1)), dkgsignkey.MustNewXXXTestingOnly(big.NewInt(2)) - dkgencrypt1, dkgencrypt2 := dkgencryptkey.MustNewXXXTestingOnly(big.NewInt(1)), dkgencryptkey.MustNewXXXTestingOnly(big.NewInt(2)) originalKeyRingRaw := rawKeyRing{ - CSA: []csakey.Raw{csa1.Raw(), csa2.Raw()}, - Eth: []ethkey.Raw{eth1.Raw(), eth2.Raw()}, - OCR: []ocrkey.Raw{ocr[0].Raw(), ocr[1].Raw()}, - OCR2: ocr2_raw, - P2P: []p2pkey.Raw{p2p1.Raw(), p2p2.Raw()}, - Solana: []solkey.Raw{sol1.Raw(), sol2.Raw()}, - VRF: []vrfkey.Raw{vrf1.Raw(), vrf2.Raw()}, - Cosmos: []cosmoskey.Raw{tk1.Raw(), tk2.Raw()}, - DKGSign: []dkgsignkey.Raw{dkgsign1.Raw(), dkgsign2.Raw()}, - DKGEncrypt: []dkgencryptkey.Raw{dkgencrypt1.Raw(), dkgencrypt2.Raw()}, + CSA: []csakey.Raw{csa1.Raw(), csa2.Raw()}, + Eth: []ethkey.Raw{eth1.Raw(), eth2.Raw()}, + OCR: []ocrkey.Raw{ocr[0].Raw(), ocr[1].Raw()}, + OCR2: ocr2_raw, + P2P: []p2pkey.Raw{p2p1.Raw(), p2p2.Raw()}, + Solana: []solkey.Raw{sol1.Raw(), sol2.Raw()}, + VRF: []vrfkey.Raw{vrf1.Raw(), vrf2.Raw()}, + Cosmos: []cosmoskey.Raw{tk1.Raw(), tk2.Raw()}, } originalKeyRing, kerr := originalKeyRingRaw.keys() require.NoError(t, kerr) @@ -109,14 +103,6 @@ func TestKeyRing_Encrypt_Decrypt(t *testing.T) { require.Equal(t, 2, len(decryptedKeyRing.VRF)) require.Equal(t, originalKeyRing.VRF[vrf1.ID()].PublicKey, decryptedKeyRing.VRF[vrf1.ID()].PublicKey) require.Equal(t, originalKeyRing.VRF[vrf2.ID()].PublicKey, decryptedKeyRing.VRF[vrf2.ID()].PublicKey) - // compare dkgsign keys - require.Equal(t, 2, len(decryptedKeyRing.DKGSign)) - require.Equal(t, originalKeyRing.DKGSign[dkgsign1.ID()].PublicKey, decryptedKeyRing.DKGSign[dkgsign1.ID()].PublicKey) - require.Equal(t, originalKeyRing.DKGSign[dkgsign2.ID()].PublicKey, decryptedKeyRing.DKGSign[dkgsign2.ID()].PublicKey) - // compare dkgencrypt keys - require.Equal(t, 2, len(decryptedKeyRing.DKGEncrypt)) - require.Equal(t, originalKeyRing.DKGEncrypt[dkgencrypt1.ID()].PublicKey, decryptedKeyRing.DKGEncrypt[dkgencrypt1.ID()].PublicKey) - require.Equal(t, originalKeyRing.DKGEncrypt[dkgencrypt2.ID()].PublicKey, decryptedKeyRing.DKGEncrypt[dkgencrypt2.ID()].PublicKey) }) t.Run("test legacy system", func(t *testing.T) { diff --git a/core/services/ocr2/delegate.go b/core/services/ocr2/delegate.go index 875ee0f69ed..9066afd740b 100644 --- a/core/services/ocr2/delegate.go +++ b/core/services/ocr2/delegate.go @@ -36,10 +36,6 @@ import ( llotypes "github.com/smartcontractkit/chainlink-common/pkg/types/llo" "github.com/smartcontractkit/chainlink-common/pkg/utils/mailbox" - "github.com/smartcontractkit/chainlink-vrf/altbn_128" - dkgpkg "github.com/smartcontractkit/chainlink-vrf/dkg" - "github.com/smartcontractkit/chainlink-vrf/ocr2vrf" - "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" coreconfig "github.com/smartcontractkit/chainlink/v2/core/config" @@ -50,8 +46,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" "github.com/smartcontractkit/chainlink/v2/core/services/llo" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/dkg" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/dkg/persistence" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/functions" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/generic" lloconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/llo/config" @@ -61,12 +55,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/autotelemetry21" ocr2keeper21core "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/core" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider" - ocr2vrfconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2vrf/config" - ocr2coordinator "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2vrf/coordinator" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2vrf/juelsfeecoin" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2vrf/reportserializer" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/promwrapper" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/validate" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" @@ -121,8 +109,6 @@ type Delegate struct { cfg DelegateConfig lggr logger.Logger ks keystore.OCR2 - dkgSignKs keystore.DKGSign - dkgEncryptKs keystore.DKGEncrypt ethKs keystore.Eth RelayGetter isNewlyCreatedJob bool // Set to true if this is a new job freshly added, false if job was present already on node boot. @@ -231,8 +217,6 @@ func NewDelegate( lggr logger.Logger, cfg DelegateConfig, ks keystore.OCR2, - dkgSignKs keystore.DKGSign, - dkgEncryptKs keystore.DKGEncrypt, ethKs keystore.Eth, relayers RelayGetter, mailMon *mailbox.Monitor, @@ -251,8 +235,6 @@ func NewDelegate( cfg: cfg, lggr: lggr.Named("OCR2"), ks: ks, - dkgSignKs: dkgSignKs, - dkgEncryptKs: dkgEncryptKs, ethKs: ethKs, RelayGetter: relayers, isNewlyCreatedJob: false, @@ -310,11 +292,6 @@ func (d *Delegate) cleanupEVM(ctx context.Context, jb job.Job, relayID types.Rel var filters []string switch spec.PluginType { - case types.OCR2VRF: - filters, err = ocr2coordinator.FilterNamesFromSpec(spec) - if err != nil { - d.lggr.Errorw("failed to derive ocr2vrf filter names from spec", "err", err, "spec", spec) - } case types.OCR2Keeper: // Not worth the effort to validate and parse the job spec config to figure out whether this is v2.0 or v2.1, // simpler and faster to just Unregister them both @@ -453,12 +430,6 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, jb job.Job) ([]job.Servi case types.Median: return d.newServicesMedian(ctx, lggr, jb, bootstrapPeers, kb, kvStore, ocrDB, lc) - case types.DKG: - return d.newServicesDKG(lggr, jb, bootstrapPeers, kb, ocrDB, lc) - - case types.OCR2VRF: - return d.newServicesOCR2VRF(ctx, lggr, jb, bootstrapPeers, kb, ocrDB, lc) - case types.OCR2Keeper: return d.newServicesOCR2Keepers(ctx, lggr, jb, bootstrapPeers, kb, ocrDB, lc) @@ -494,8 +465,8 @@ func GetEVMEffectiveTransmitterID(ctx context.Context, jb *job.Job, chain legacy if err != nil { return "", err } - if len(sendingKeys) > 1 && spec.PluginType != types.OCR2VRF { - return "", errors.New("only ocr2 vrf should have more than 1 sending key") + if len(sendingKeys) > 1 { + return "", errors.New("no plugin should have more than 1 sending key") } spec.TransmitterID = null.StringFrom(sendingKeys[0]) } @@ -1062,245 +1033,6 @@ func (d *Delegate) newServicesMedian( return medianServices, err2 } -func (d *Delegate) newServicesDKG( - lggr logger.SugaredLogger, - jb job.Job, - bootstrapPeers []commontypes.BootstrapperLocator, - kb ocr2key.KeyBundle, - ocrDB *db, - lc ocrtypes.LocalConfig, -) ([]job.ServiceCtx, error) { - spec := jb.OCR2OracleSpec - rid, err := spec.RelayID() - if err != nil { - return nil, ErrJobSpecNoRelayer{Err: err, PluginName: "DKG"} - } - if rid.Network != relay.NetworkEVM { - return nil, fmt.Errorf("DKG services: expected EVM relayer got %q", rid.Network) - } - - chain, err2 := d.legacyChains.Get(rid.ChainID) - if err2 != nil { - return nil, fmt.Errorf("DKG services: failed to get chain %s: %w", rid.ChainID, err2) - } - ocr2vrfRelayer := evmrelay.NewOCR2VRFRelayer(chain, lggr.Named("OCR2VRFRelayer"), d.ethKs) - dkgProvider, err2 := ocr2vrfRelayer.NewDKGProvider( - types.RelayArgs{ - ExternalJobID: jb.ExternalJobID, - JobID: jb.ID, - ContractID: spec.ContractID, - New: d.isNewlyCreatedJob, - RelayConfig: spec.RelayConfig.Bytes(), - }, types.PluginArgs{ - TransmitterID: spec.TransmitterID.String, - PluginConfig: spec.PluginConfig.Bytes(), - }) - if err2 != nil { - return nil, err2 - } - ocrLogger := ocrcommon.NewOCRWrapper(lggr, d.cfg.OCR2().TraceLogging(), func(ctx context.Context, msg string) { - lggr.ErrorIf(d.jobORM.RecordError(ctx, jb.ID, msg), "unable to record error") - }) - noopMonitoringEndpoint := telemetry.NoopAgent{} - oracleArgsNoPlugin := libocr2.OCR2OracleArgs{ - BinaryNetworkEndpointFactory: d.peerWrapper.Peer2, - V2Bootstrappers: bootstrapPeers, - ContractTransmitter: dkgProvider.ContractTransmitter(), - ContractConfigTracker: dkgProvider.ContractConfigTracker(), - Database: ocrDB, - LocalConfig: lc, - Logger: ocrLogger, - // Telemetry ingress for DKG is currently not supported so a noop monitoring endpoint is being used - MonitoringEndpoint: &noopMonitoringEndpoint, - OffchainConfigDigester: dkgProvider.OffchainConfigDigester(), - OffchainKeyring: kb, - OnchainKeyring: kb, - MetricsRegisterer: prometheus.WrapRegistererWith(map[string]string{"job_name": jb.Name.ValueOrZero()}, prometheus.DefaultRegisterer), - } - services, err := dkg.NewDKGServices(jb, dkgProvider, lggr, ocrLogger, d.dkgSignKs, d.dkgEncryptKs, chain.Client(), oracleArgsNoPlugin, d.ds, chain.ID(), spec.Relay) - if err != nil { - return nil, err - } - services = append(services, ocrLogger) - return services, nil -} - -func (d *Delegate) newServicesOCR2VRF( - ctx context.Context, - lggr logger.SugaredLogger, - jb job.Job, - bootstrapPeers []commontypes.BootstrapperLocator, - kb ocr2key.KeyBundle, - ocrDB *db, - lc ocrtypes.LocalConfig, -) ([]job.ServiceCtx, error) { - spec := jb.OCR2OracleSpec - - rid, err := spec.RelayID() - if err != nil { - return nil, ErrJobSpecNoRelayer{Err: err, PluginName: "VRF"} - } - if rid.Network != relay.NetworkEVM { - return nil, fmt.Errorf("VRF services: expected EVM relayer got %q", rid.Network) - } - chain, err2 := d.legacyChains.Get(rid.ChainID) - if err2 != nil { - return nil, fmt.Errorf("VRF services: failed to get chain (%s): %w", rid.ChainID, err2) - } - if jb.ForwardingAllowed != chain.Config().EVM().Transactions().ForwardersEnabled() { - return nil, errors.New("transaction forwarding settings must be consistent for ocr2vrf") - } - - var cfg ocr2vrfconfig.PluginConfig - err2 = json.Unmarshal(spec.PluginConfig.Bytes(), &cfg) - if err2 != nil { - return nil, errors.Wrap(err2, "unmarshal ocr2vrf plugin config") - } - - err2 = ocr2vrfconfig.ValidatePluginConfig(cfg, d.dkgSignKs, d.dkgEncryptKs) - if err2 != nil { - return nil, errors.Wrap(err2, "validate ocr2vrf plugin config") - } - - ocr2vrfRelayer := evmrelay.NewOCR2VRFRelayer(chain, lggr.Named("OCR2VRFRelayer"), d.ethKs) - transmitterID := spec.TransmitterID.String - - vrfProvider, err2 := ocr2vrfRelayer.NewOCR2VRFProvider( - types.RelayArgs{ - ExternalJobID: jb.ExternalJobID, - JobID: jb.ID, - ContractID: spec.ContractID, - New: d.isNewlyCreatedJob, - RelayConfig: spec.RelayConfig.Bytes(), - }, types.PluginArgs{ - TransmitterID: transmitterID, - PluginConfig: spec.PluginConfig.Bytes(), - }) - if err2 != nil { - return nil, errors.Wrap(err2, "new vrf provider") - } - - dkgProvider, err2 := ocr2vrfRelayer.NewDKGProvider( - types.RelayArgs{ - ExternalJobID: jb.ExternalJobID, - JobID: jb.ID, - ContractID: cfg.DKGContractAddress, - RelayConfig: spec.RelayConfig.Bytes(), - }, types.PluginArgs{ - TransmitterID: transmitterID, - PluginConfig: spec.PluginConfig.Bytes(), - }) - if err2 != nil { - return nil, errors.Wrap(err2, "new dkg provider") - } - - dkgContract, err2 := dkg.NewOnchainDKGClient(cfg.DKGContractAddress, chain.Client()) - if err2 != nil { - return nil, errors.Wrap(err2, "new onchain dkg client") - } - - timeout := 5 * time.Second - interval := 60 * time.Second - juelsLogger := lggr.Named("JuelsFeeCoin").With("contract", cfg.LinkEthFeedAddress, "timeout", timeout, "interval", interval) - juelsPerFeeCoin, err2 := juelsfeecoin.NewLinkEthPriceProvider( - common.HexToAddress(cfg.LinkEthFeedAddress), chain.Client(), timeout, interval, juelsLogger) - if err2 != nil { - return nil, errors.Wrap(err2, "new link eth price provider") - } - - reasonableGasPrice := reasonablegasprice.NewReasonableGasPriceProvider( - chain.GasEstimator(), - timeout, - chain.Config().EVM().GasEstimator().PriceMax(), - chain.Config().EVM().GasEstimator().EIP1559DynamicFees(), - ) - - encryptionSecretKey, err2 := d.dkgEncryptKs.Get(cfg.DKGEncryptionPublicKey) - if err2 != nil { - return nil, errors.Wrap(err2, "get DKG encryption key") - } - signingSecretKey, err2 := d.dkgSignKs.Get(cfg.DKGSigningPublicKey) - if err2 != nil { - return nil, errors.Wrap(err2, "get DKG signing key") - } - keyID, err2 := dkg.DecodeKeyID(cfg.DKGKeyID) - if err2 != nil { - return nil, errors.Wrap(err2, "decode DKG key ID") - } - - coordinator, err2 := ocr2coordinator.New( - ctx, - lggr.Named("OCR2VRFCoordinator"), - common.HexToAddress(spec.ContractID), - common.HexToAddress(cfg.VRFCoordinatorAddress), - common.HexToAddress(cfg.DKGContractAddress), - chain.Client(), - chain.LogPoller(), - chain.Config().EVM().FinalityDepth(), - ) - if err2 != nil { - return nil, errors.Wrap(err2, "create ocr2vrf coordinator") - } - l := lggr.Named("OCR2VRF").With( - "jobName", jb.Name.ValueOrZero(), - "jobID", jb.ID, - ) - vrfLogger := ocrcommon.NewOCRWrapper(l.With("vrfContractID", spec.ContractID), d.cfg.OCR2().TraceLogging(), func(ctx context.Context, msg string) { - lggr.ErrorIf(d.jobORM.RecordError(ctx, jb.ID, msg), "unable to record error") - }) - dkgLogger := ocrcommon.NewOCRWrapper(l.With("dkgContractID", cfg.DKGContractAddress), d.cfg.OCR2().TraceLogging(), func(ctx context.Context, msg string) { - lggr.ErrorIf(d.jobORM.RecordError(ctx, jb.ID, msg), "unable to record error") - }) - dkgReportingPluginFactoryDecorator := func(wrapped ocrtypes.ReportingPluginFactory) ocrtypes.ReportingPluginFactory { - return promwrapper.NewPromFactory(wrapped, "DKG", string(relay.NetworkEVM), chain.ID()) - } - vrfReportingPluginFactoryDecorator := func(wrapped ocrtypes.ReportingPluginFactory) ocrtypes.ReportingPluginFactory { - return promwrapper.NewPromFactory(wrapped, "OCR2VRF", string(relay.NetworkEVM), chain.ID()) - } - noopMonitoringEndpoint := telemetry.NoopAgent{} - oracles, err2 := ocr2vrf.NewOCR2VRF(ocr2vrf.DKGVRFArgs{ - VRFLogger: vrfLogger, - DKGLogger: dkgLogger, - BinaryNetworkEndpointFactory: d.peerWrapper.Peer2, - V2Bootstrappers: bootstrapPeers, - OffchainKeyring: kb, - OnchainKeyring: kb, - VRFOffchainConfigDigester: vrfProvider.OffchainConfigDigester(), - VRFContractConfigTracker: vrfProvider.ContractConfigTracker(), - VRFContractTransmitter: vrfProvider.ContractTransmitter(), - VRFDatabase: ocrDB, - VRFLocalConfig: lc, - VRFMonitoringEndpoint: d.monitoringEndpointGen.GenMonitoringEndpoint(rid.Network, rid.ChainID, spec.ContractID, synchronization.OCR2VRF), - DKGContractConfigTracker: dkgProvider.ContractConfigTracker(), - DKGOffchainConfigDigester: dkgProvider.OffchainConfigDigester(), - DKGContract: dkgpkg.NewOnchainContract(dkgContract, &altbn_128.G2{}), - DKGContractTransmitter: dkgProvider.ContractTransmitter(), - DKGDatabase: ocrDB, - DKGLocalConfig: lc, - // Telemetry ingress for DKG is currently not supported so a noop monitoring endpoint is being used - DKGMonitoringEndpoint: &noopMonitoringEndpoint, - Serializer: reportserializer.NewReportSerializer(&altbn_128.G1{}), - JuelsPerFeeCoin: juelsPerFeeCoin, - ReasonableGasPrice: reasonableGasPrice, - Coordinator: coordinator, - Esk: encryptionSecretKey.KyberScalar(), - Ssk: signingSecretKey.KyberScalar(), - KeyID: keyID, - DKGReportingPluginFactoryDecorator: dkgReportingPluginFactoryDecorator, - VRFReportingPluginFactoryDecorator: vrfReportingPluginFactoryDecorator, - DKGSharePersistence: persistence.NewShareDB(d.ds, lggr.Named("DKGShareDB"), chain.ID(), spec.Relay), - }) - if err2 != nil { - return nil, errors.Wrap(err2, "new ocr2vrf") - } - - // NOTE: we return from here with the services because the OCR2VRF oracles are defined - // and exported from the ocr2vrf library. It takes care of running the DKG and OCR2VRF - // oracles under the hood together. - oracleCtx := job.NewServiceAdapter(oracles) - return []job.ServiceCtx{vrfProvider, dkgProvider, oracleCtx}, nil -} - func (d *Delegate) newServicesOCR2Keepers( ctx context.Context, lggr logger.SugaredLogger, diff --git a/core/services/ocr2/delegate_test.go b/core/services/ocr2/delegate_test.go index 1e4be66c7d1..9015928ade1 100644 --- a/core/services/ocr2/delegate_test.go +++ b/core/services/ocr2/delegate_test.go @@ -99,12 +99,6 @@ func TestGetEVMEffectiveTransmitterID(t *testing.T) { sendingKeys: []any{"0x7e57000000000000000000000000000000000001", "0x7e57000000000000000000000000000000000002", "0x7e57000000000000000000000000000000000003"}, expectedError: true, }, - { - name: "when transmitterID is not defined and plugin is ocr2vrf, it should allow>1 sendingKeys and set transmitterID to the first one", - pluginType: types.OCR2VRF, - sendingKeys: []any{"0x7e57000000000000000000000000000000000000", "0x7e57000000000000000000000000000000000001", "0x7e57000000000000000000000000000000000002"}, - expectedTransmitterID: "0x7e57000000000000000000000000000000000000", - }, { name: "when transmitterID is not defined, it should set transmitterID to first sendingKey", sendingKeys: []any{"0x7e57000000000000000000000000000000000004"}, @@ -117,23 +111,6 @@ func TestGetEVMEffectiveTransmitterID(t *testing.T) { getForwarderForEOAArg: common.HexToAddress("0x7e57000000000000000000000000000000000001"), expectedTransmitterID: "0x7e58000000000000000000000000000000000000", }, - { - name: "when forwarders are enabled and when transmitterID is not defined, it should use first sendingKey to retrieve forwarder address", - pluginType: types.OCR2VRF, - forwardingEnabled: true, - sendingKeys: []any{"0x7e57000000000000000000000000000000000001", "0x7e57000000000000000000000000000000000002"}, - getForwarderForEOAArg: common.HexToAddress("0x7e57000000000000000000000000000000000001"), - expectedTransmitterID: "0x7e58000000000000000000000000000000000000", - }, - { - name: "when forwarders are enabled but forwarder address fails to be retrieved and when transmitterID is not defined, it should default to using first sendingKey", - pluginType: types.OCR2VRF, - forwardingEnabled: true, - sendingKeys: []any{"0x7e57000000000000000000000000000000000001", "0x7e57000000000000000000000000000000000002"}, - getForwarderForEOAArg: common.HexToAddress("0x7e57000000000000000000000000000000000001"), - getForwarderForEOAErr: true, - expectedTransmitterID: "0x7e57000000000000000000000000000000000001", - }, { name: "when forwarders are enabled but forwarder address fails to be retrieved and when transmitterID is defined, it should default to using spec transmitterID", forwardingEnabled: true, diff --git a/core/services/ocr2/plugins/dkg/config/config.go b/core/services/ocr2/plugins/dkg/config/config.go deleted file mode 100644 index b848b9b3e2e..00000000000 --- a/core/services/ocr2/plugins/dkg/config/config.go +++ /dev/null @@ -1,28 +0,0 @@ -package config - -import ( - "github.com/pkg/errors" - - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" -) - -// PluginConfig contains custom arguments for the DKG plugin. -type PluginConfig struct { - EncryptionPublicKey string `json:"encryptionPublicKey"` - SigningPublicKey string `json:"signingPublicKey"` - KeyID string `json:"keyID"` -} - -// ValidatePluginConfig validates that the given DKG plugin configuration is correct. -func ValidatePluginConfig(config PluginConfig, dkgSignKs keystore.DKGSign, dkgEncryptKs keystore.DKGEncrypt) error { - _, err := dkgEncryptKs.Get(config.EncryptionPublicKey) - if err != nil { - return errors.Wrapf(err, "DKG encryption key: %s not found in key store", config.EncryptionPublicKey) - } - _, err = dkgSignKs.Get(config.SigningPublicKey) - if err != nil { - return errors.Wrapf(err, "DKG sign key: %s not found in key store", config.SigningPublicKey) - } - - return nil -} diff --git a/core/services/ocr2/plugins/dkg/config/config_test.go b/core/services/ocr2/plugins/dkg/config/config_test.go deleted file mode 100644 index f8cc1265ee1..00000000000 --- a/core/services/ocr2/plugins/dkg/config/config_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package config_test - -import ( - "encoding/hex" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/dkg/config" -) - -func TestValidatePluginConfig(t *testing.T) { - t.Parallel() - ctx := testutils.Context(t) - - db := pgtest.NewSqlxDB(t) - kst := cltest.NewKeyStore(t, db) - - dkgEncryptKey, err := kst.DKGEncrypt().Create(ctx) - require.NoError(t, err) - dkgSignKey, err := kst.DKGSign().Create(ctx) - require.NoError(t, err) - - encryptKeyBytes, err := dkgEncryptKey.PublicKey.MarshalBinary() - require.NoError(t, err) - encryptKey := hex.EncodeToString(encryptKeyBytes) - - signKeyBytes, err := dkgSignKey.PublicKey.MarshalBinary() - require.NoError(t, err) - signKey := hex.EncodeToString(signKeyBytes) - - pluginConfig := config.PluginConfig{ - EncryptionPublicKey: encryptKey, - SigningPublicKey: signKey, - } - t.Run("no error when keys are found", func(t *testing.T) { - err = config.ValidatePluginConfig(pluginConfig, kst.DKGSign(), kst.DKGEncrypt()) - require.NoError(t, err) - }) - - t.Run("error when encryption key not found", func(t *testing.T) { - pluginConfig = config.PluginConfig{ - EncryptionPublicKey: "wrongKey", - SigningPublicKey: signKey, - } - err = config.ValidatePluginConfig(pluginConfig, kst.DKGSign(), kst.DKGEncrypt()) - require.Error(t, err) - require.Contains(t, err.Error(), "DKG encryption key: wrongKey not found in key store") - }) - - t.Run("error when sign key not found", func(t *testing.T) { - pluginConfig = config.PluginConfig{ - EncryptionPublicKey: encryptKey, - SigningPublicKey: "wrongKey", - } - - err = config.ValidatePluginConfig(pluginConfig, kst.DKGSign(), kst.DKGEncrypt()) - require.Error(t, err) - require.Contains(t, err.Error(), "DKG sign key: wrongKey not found in key store") - }) -} diff --git a/core/services/ocr2/plugins/dkg/key_consumer.go b/core/services/ocr2/plugins/dkg/key_consumer.go deleted file mode 100644 index 23ca7e795bf..00000000000 --- a/core/services/ocr2/plugins/dkg/key_consumer.go +++ /dev/null @@ -1,24 +0,0 @@ -package dkg - -import ( - "encoding/hex" - "fmt" - - "github.com/smartcontractkit/chainlink-vrf/dkg" -) - -type dummyKeyConsumer struct{} - -func (d dummyKeyConsumer) KeyInvalidated(keyID dkg.KeyID) { - fmt.Println("KEY INVALIDATED:", hex.EncodeToString(keyID[:])) -} - -func (d dummyKeyConsumer) NewKey(keyID dkg.KeyID, data *dkg.KeyData) { - fmt.Println("NEW KEY FOR KEY ID:", hex.EncodeToString(keyID[:]), "KEY:", data) -} - -var _ dkg.KeyConsumer = dummyKeyConsumer{} - -func newDummyKeyConsumer() dummyKeyConsumer { - return dummyKeyConsumer{} -} diff --git a/core/services/ocr2/plugins/dkg/onchain_contract.go b/core/services/ocr2/plugins/dkg/onchain_contract.go deleted file mode 100644 index c6ea84de235..00000000000 --- a/core/services/ocr2/plugins/dkg/onchain_contract.go +++ /dev/null @@ -1,90 +0,0 @@ -package dkg - -import ( - "context" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/pkg/errors" - "go.dedis.ch/kyber/v3/sign/anon" - - "github.com/smartcontractkit/chainlink-vrf/dkg" - dkgwrapper "github.com/smartcontractkit/chainlink-vrf/gethwrappers/dkg" - ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" - - evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" -) - -type onchainContract struct { - wrapper *dkgwrapper.DKG - dkgAddress common.Address -} - -var _ dkg.DKG = &onchainContract{} - -func NewOnchainDKGClient(dkgAddress string, ethClient evmclient.Client) (dkg.DKG, error) { - dkgAddr := common.HexToAddress(dkgAddress) - wrapper, err := dkgwrapper.NewDKG(dkgAddr, ethClient) - if err != nil { - return nil, errors.Wrap(err, "new dkg wrapper") - } - return &onchainContract{ - wrapper: wrapper, - dkgAddress: dkgAddr, - }, nil -} - -func (o *onchainContract) GetKey( - ctx context.Context, - keyID dkg.KeyID, - configDigest [32]byte, -) (dkg.OnchainKeyData, error) { - keyData, err := o.wrapper.GetKey(&bind.CallOpts{ - Context: ctx, - }, keyID, configDigest) - if err != nil { - return dkg.OnchainKeyData{}, errors.Wrap(err, "wrapper GetKey") - } - return dkg.OnchainKeyData{ - PublicKey: keyData.PublicKey, - Hashes: keyData.Hashes, - }, nil -} - -func (o *onchainContract) Address() common.Address { - return o.dkgAddress -} - -func (o *onchainContract) CurrentCommittee(ctx context.Context) (ocr2vrftypes.OCRCommittee, error) { - // NOTE: this is only ever used in tests in the ocr2vrf repo. - // Since this isn't really used for production DKG running, - // there's no point in implementing it. - panic("unimplemented") -} - -func (o *onchainContract) InitiateDKG( - ctx context.Context, - committee ocr2vrftypes.OCRCommittee, - f ocr2vrftypes.PlayerIdxInt, - keyID dkg.KeyID, - epks dkg.EncryptionPublicKeys, - spks dkg.SigningPublicKeys, - encGroup anon.Suite, - translator ocr2vrftypes.PubKeyTranslation, -) error { - // NOTE: this is only ever used in tests, the idea here is to call setConfig - // on the DKG contract to get the OCR process going. Since this isn't really - // used for production DKG running, there's no point in implementing it. - panic("unimplemented") -} - -func (o *onchainContract) AddClient( - ctx context.Context, - keyID [32]byte, - clientAddress common.Address, -) error { - // NOTE: this is only ever used in tests in the ocr2vrf repo. - // Since this isn't really used for production DKG running, - // there's no point in implementing it. - panic("unimplemented") -} diff --git a/core/services/ocr2/plugins/dkg/persistence/db.go b/core/services/ocr2/plugins/dkg/persistence/db.go deleted file mode 100644 index 07dad494ed7..00000000000 --- a/core/services/ocr2/plugins/dkg/persistence/db.go +++ /dev/null @@ -1,224 +0,0 @@ -package persistence - -import ( - "bytes" - "context" - "database/sql" - "fmt" - "math/big" - "time" - - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/jmoiron/sqlx" - "github.com/pkg/errors" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" - - ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - - "github.com/smartcontractkit/chainlink-common/pkg/sqlutil" - ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" - "github.com/smartcontractkit/chainlink-vrf/types/hash" - - "github.com/smartcontractkit/chainlink/v2/core/logger" -) - -var ( - _ ocr2vrftypes.DKGSharePersistence = &shareDB{} - zeroHash hash.Hash - buckets = []float64{ - float64(100 * time.Millisecond), - float64(200 * time.Millisecond), - float64(500 * time.Millisecond), - float64(1 * time.Second), - float64(2 * time.Second), - float64(5 * time.Second), - float64(10 * time.Second), - float64(30 * time.Second), - } - labels = []string{ - "chainType", "chainID", - } - promWriteShareRecords = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "write_share_records_time", - Help: "The duration of the DKG WriteShareRecords call", - Buckets: buckets, - }, labels) - promReadShareRecords = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "read_share_records_time", - Help: "The duration of the DKG ReadShareRecords call.", - Buckets: buckets, - }, labels) -) - -type shareDB struct { - ds sqlutil.DataSource - lggr logger.Logger - chainID *big.Int - chainType string -} - -// NewShareDB creates a new DKG share database. -func NewShareDB(ds sqlutil.DataSource, lggr logger.Logger, chainID *big.Int, chainType string) ocr2vrftypes.DKGSharePersistence { - return &shareDB{ - ds: ds, - lggr: lggr, - chainID: chainID, - chainType: chainType, - } -} - -// WriteShareRecords writes the provided (already encrypted) -// share records to the Chainlink database. -func (s *shareDB) WriteShareRecords( - ctx context.Context, - cfgDgst ocrtypes.ConfigDigest, - keyID [32]byte, - shareRecords []ocr2vrftypes.PersistentShareSetRecord, -) error { - lggr := s.lggr.With( - "configDigest", hexutil.Encode(cfgDgst[:]), - "keyID", hexutil.Encode(keyID[:])) - - start := time.Now() - defer func() { - duration := time.Since(start) - promWriteShareRecords.WithLabelValues(s.chainType, s.chainID.String()).Observe(float64(duration)) - // lggr.Debugw("Inserted DKG shares into DB", "duration", duration) // see ocr2vrf code for logs - }() - - var named []dkgShare - for _, record := range shareRecords { - if bytes.Equal(record.Hash[:], zeroHash[:]) { - // see ocr2vrf for logging - // lggr.Warnw("skipping record with zero hash", - // "player", record.Dealer.String(), - // "hash", hexutil.Encode(record.Hash[:]), - // ) - continue - } - - // XXX: this might be expensive, but is a good sanity check. - localHash := hash.GetHash(record.MarshaledShareRecord) - if !bytes.Equal(record.Hash[:], localHash[:]) { - return fmt.Errorf("local hash doesn't match given hash in record, expected: %x, got: %x", - localHash[:], record.Hash[:]) - } - - var h hash.Hash - if copied := copy(h[:], record.Hash[:]); copied != 32 { - return fmt.Errorf("wrong number of bytes copied in hash (dealer:%s) %x: %d", - record.Dealer.String(), record.Hash[:], copied) - } - - named = append(named, dkgShare{ - ConfigDigest: cfgDgst[:], - KeyID: keyID[:], - Dealer: record.Dealer.Marshal(), - MarshaledShareRecord: record.MarshaledShareRecord, - /* TODO/WTF: can't do "record.Hash[:]": this leads to store the last record's hash for all the records! */ - RecordHash: h[:], - }) - } - - if len(named) == 0 { - lggr.Infow("No valid share records to insert") - return nil - } - - // see ocr2vrf for logging - // lggr.Infow("Inserting DKG shares into DB", - // "shareHashes", shareHashes(shareRecords), - // "numRecords", len(shareRecords), - // "numNamed", len(named)) - - // Always upsert because we want the number of rows in the table to match - // the number of members of the committee. - _, err := s.ds.NamedExecContext(ctx, ` -INSERT INTO dkg_shares (config_digest, key_id, dealer, marshaled_share_record, record_hash) -VALUES (:config_digest, :key_id, :dealer, :marshaled_share_record, :record_hash) -ON CONFLICT ON CONSTRAINT dkg_shares_pkey -DO UPDATE SET marshaled_share_record = EXCLUDED.marshaled_share_record, record_hash = EXCLUDED.record_hash -`, named[:]) - return err -} - -// ReadShareRecords retrieves any share records in the database that correspond -// to the provided config digest and DKG key ID. -func (s *shareDB) ReadShareRecords( - cfgDgst ocrtypes.ConfigDigest, - keyID [32]byte, -) ( - retrievedShares []ocr2vrftypes.PersistentShareSetRecord, - err error, -) { - ctx := context.Background() //TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 - lggr := s.lggr.With( - "configDigest", hexutil.Encode(cfgDgst[:]), - "keyID", hexutil.Encode(keyID[:])) - - start := time.Now() - defer func() { - duration := time.Since(start) - promReadShareRecords.WithLabelValues(s.chainType, s.chainID.String()).Observe(float64(duration)) - lggr.Debugw("Finished reading DKG shares from DB", "duration", duration) - }() - - a := map[string]any{ - "config_digest": cfgDgst[:], - "key_id": keyID[:], - } - query, args, err := sqlx.Named( - ` -SELECT * -FROM dkg_shares -WHERE config_digest = :config_digest - AND key_id = :key_id -`, a) - if err != nil { - return nil, errors.Wrap(err, "sqlx Named") - } - query = s.ds.Rebind(query) - var dkgShares []dkgShare - err = s.ds.SelectContext(ctx, &dkgShares, query, args...) - if errors.Is(err, sql.ErrNoRows) { - return nil, nil - } - if err != nil { - return nil, err - } - - for _, share := range dkgShares { - playerIdx, _, err := ocr2vrftypes.UnmarshalPlayerIdx(share.Dealer) - if err != nil { - return nil, errors.Wrapf(err, "unmarshalling %x", share.Dealer) - } - var h hash.Hash - if copied := copy(h[:], share.RecordHash); copied != 32 { - return nil, fmt.Errorf("wrong number of bytes copied in hash %x: %d", share.RecordHash, copied) - } - - // NOTE: no integrity check on share.MarshaledShareRecord - // because caller will do it anyways, so it'd be wasteful. - retrievedShares = append(retrievedShares, ocr2vrftypes.PersistentShareSetRecord{ - Dealer: *playerIdx, - MarshaledShareRecord: share.MarshaledShareRecord, - Hash: h, - }) - } - - lggr.Debugw("Read DKG shares from DB", - "shareRecords", shareHashes(retrievedShares), - "numRecords", len(dkgShares), - ) - - return retrievedShares, nil -} - -func shareHashes(shareRecords []ocr2vrftypes.PersistentShareSetRecord) []string { - r := make([]string, len(shareRecords)) - for i, record := range shareRecords { - r[i] = hexutil.Encode(record.Hash[:]) - } - return r -} diff --git a/core/services/ocr2/plugins/dkg/persistence/db_test.go b/core/services/ocr2/plugins/dkg/persistence/db_test.go deleted file mode 100644 index 06f1bf3583f..00000000000 --- a/core/services/ocr2/plugins/dkg/persistence/db_test.go +++ /dev/null @@ -1,183 +0,0 @@ -package persistence - -import ( - "fmt" - "math/big" - "testing" - - "github.com/ethereum/go-ethereum/crypto" - "github.com/jmoiron/sqlx" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" - "github.com/smartcontractkit/chainlink-vrf/types/hash" - - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest" - "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/relay" -) - -func setup(t testing.TB) (ocr2vrftypes.DKGSharePersistence, *sqlx.DB) { - db := pgtest.NewSqlxDB(t) - lggr := logger.TestLogger(t) - return NewShareDB(db, lggr, big.NewInt(1337), relay.NetworkEVM), db -} - -func TestShareDB_WriteShareRecords(t *testing.T) { - configDigest := testutils.Random32Byte() - keyID := testutils.Random32Byte() - - t.Run("valid input", func(tt *testing.T) { - shareDB, db := setup(tt) - var expectedRecords []ocr2vrftypes.PersistentShareSetRecord - - // Starting from 1 because player indexes must not be 0 - for i := 1; i < 4; i++ { - b := ocr2vrftypes.RawMarshalPlayerIdxInt(ocr2vrftypes.PlayerIdxInt(i)) - playerIdx, _, err := ocr2vrftypes.UnmarshalPlayerIdx(b) - require.NoError(t, err) - shareRecord := crypto.Keccak256Hash([]byte(fmt.Sprintf("%d", i))) - shareRecordHash := hash.GetHash(shareRecord[:]) - var h hash.Hash - copy(h[:], shareRecordHash[:]) - rec := ocr2vrftypes.PersistentShareSetRecord{ - Dealer: *playerIdx, - MarshaledShareRecord: shareRecord[:], - Hash: h, - } - expectedRecords = append(expectedRecords, rec) - } - - err := shareDB.WriteShareRecords(testutils.Context(t), configDigest, keyID, expectedRecords) - require.NoError(tt, err) - - rows, err := db.Query(`SELECT COUNT(*) AS count FROM dkg_shares`) - require.NoError(tt, err) - t.Cleanup(func() { assert.NoError(t, rows.Close()) }) - - var count int - for rows.Next() { - require.NoError(tt, rows.Scan(&count)) - } - require.NoError(tt, rows.Err()) - - require.Equal(tt, 3, count) - }) - - t.Run("bad input, zero hash", func(tt *testing.T) { - shareDB, db := setup(tt) - b := ocr2vrftypes.RawMarshalPlayerIdxInt(ocr2vrftypes.PlayerIdxInt(1)) - dealer, _, err := ocr2vrftypes.UnmarshalPlayerIdx(b) - require.NoError(tt, err) - records := []ocr2vrftypes.PersistentShareSetRecord{ - { - Dealer: *dealer, - MarshaledShareRecord: []byte{1}, - Hash: hash.Hash{}, // There's a problem here - }, - } - - // no error, but there will be no rows inserted in the db - err = shareDB.WriteShareRecords(testutils.Context(t), configDigest, keyID, records) - require.NoError(tt, err) - - rows, err := db.Query(`SELECT COUNT(*) AS count FROM dkg_shares`) - require.NoError(tt, err) - t.Cleanup(func() { assert.NoError(t, rows.Close()) }) - - var count int - for rows.Next() { - require.NoError(tt, rows.Scan(&count)) - } - require.NoError(tt, rows.Err()) - - require.Equal(tt, 0, count) - }) - - t.Run("bad input, nonmatching hash", func(tt *testing.T) { - shareDB, db := setup(tt) - var records []ocr2vrftypes.PersistentShareSetRecord - - // Starting from 1 because player indexes must not be 0 - for i := 1; i < 4; i++ { - b := ocr2vrftypes.RawMarshalPlayerIdxInt(ocr2vrftypes.PlayerIdxInt(i)) - playerIdx, _, err := ocr2vrftypes.UnmarshalPlayerIdx(b) - require.NoError(t, err) - shareRecord := crypto.Keccak256Hash([]byte(fmt.Sprintf("%d", i))) - // Expected hash is SHA256, not Keccak256. - shareRecordHash := crypto.Keccak256Hash(shareRecord[:]) - var h hash.Hash - copy(h[:], shareRecordHash[:]) - rec := ocr2vrftypes.PersistentShareSetRecord{ - Dealer: *playerIdx, - MarshaledShareRecord: shareRecord[:], - Hash: h, - } - records = append(records, rec) - } - - err := shareDB.WriteShareRecords(testutils.Context(t), configDigest, keyID, records) - require.Error(tt, err) - - // no rows should have been inserted - rows, err := db.Query(`SELECT COUNT(*) AS count FROM dkg_shares`) - require.NoError(tt, err) - t.Cleanup(func() { assert.NoError(t, rows.Close()) }) - - var count int - for rows.Next() { - require.NoError(tt, rows.Scan(&count)) - } - require.NoError(tt, rows.Err()) - - require.Equal(tt, 0, count) - }) -} - -func TestShareDBE2E(t *testing.T) { - shareDB, _ := setup(t) - - // create some fake data to insert and retrieve - configDigest := testutils.Random32Byte() - keyID := testutils.Random32Byte() - var expectedRecords []ocr2vrftypes.PersistentShareSetRecord - expectedRecordsMap := make(map[ocr2vrftypes.PlayerIdx]ocr2vrftypes.PersistentShareSetRecord) - - // Starting from 1 because player indexes must not be 0 - for i := 1; i < 4; i++ { - b := ocr2vrftypes.RawMarshalPlayerIdxInt(ocr2vrftypes.PlayerIdxInt(i)) - playerIdx, _, err := ocr2vrftypes.UnmarshalPlayerIdx(b) - require.NoError(t, err) - shareRecord := crypto.Keccak256Hash([]byte(fmt.Sprintf("%d", i))) - shareRecordHash := hash.GetHash(shareRecord[:]) - var h hash.Hash - copy(h[:], shareRecordHash[:]) - rec := ocr2vrftypes.PersistentShareSetRecord{ - Dealer: *playerIdx, - MarshaledShareRecord: shareRecord[:], - Hash: h, - } - expectedRecords = append(expectedRecords, rec) - expectedRecordsMap[*playerIdx] = rec - } - - err := shareDB.WriteShareRecords(testutils.Context(t), configDigest, keyID, expectedRecords) - require.NoError(t, err) - - actualRecords, err := shareDB.ReadShareRecords(configDigest, keyID) - require.NoError(t, err) - - assert.Equal(t, len(expectedRecords), len(actualRecords)) - numAssertions := 0 - for _, actualRecord := range actualRecords { - expectedRecord, ok := expectedRecordsMap[actualRecord.Dealer] - require.True(t, ok) - require.Equal(t, expectedRecord.MarshaledShareRecord, actualRecord.MarshaledShareRecord) - require.Equal(t, expectedRecord.Hash[:], actualRecord.Hash[:]) - numAssertions++ - } - - require.Equal(t, len(expectedRecords), numAssertions) -} diff --git a/core/services/ocr2/plugins/dkg/persistence/models.go b/core/services/ocr2/plugins/dkg/persistence/models.go deleted file mode 100644 index 02c63393a3b..00000000000 --- a/core/services/ocr2/plugins/dkg/persistence/models.go +++ /dev/null @@ -1,9 +0,0 @@ -package persistence - -type dkgShare struct { - ConfigDigest []byte `db:"config_digest"` - KeyID []byte `db:"key_id"` - Dealer []byte `db:"dealer"` - MarshaledShareRecord []byte `db:"marshaled_share_record"` - RecordHash []byte `db:"record_hash"` -} diff --git a/core/services/ocr2/plugins/dkg/plugin.go b/core/services/ocr2/plugins/dkg/plugin.go deleted file mode 100644 index 0364c5d9ab0..00000000000 --- a/core/services/ocr2/plugins/dkg/plugin.go +++ /dev/null @@ -1,96 +0,0 @@ -package dkg - -import ( - "encoding/hex" - "encoding/json" - "fmt" - "math/big" - - "github.com/pkg/errors" - - "github.com/smartcontractkit/libocr/commontypes" - libocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus" - - "github.com/smartcontractkit/chainlink-common/pkg/sqlutil" - "github.com/smartcontractkit/chainlink-vrf/altbn_128" - "github.com/smartcontractkit/chainlink-vrf/dkg" - - evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" - "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/dkg/config" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/dkg/persistence" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" -) - -func NewDKGServices( - jb job.Job, - ocr2Provider evmrelay.DKGProvider, - lggr logger.Logger, - ocrLogger commontypes.Logger, - dkgSignKs keystore.DKGSign, - dkgEncryptKs keystore.DKGEncrypt, - ethClient evmclient.Client, - oracleArgsNoPlugin libocr2.OCR2OracleArgs, - ds sqlutil.DataSource, - chainID *big.Int, - network string, -) ([]job.ServiceCtx, error) { - var pluginConfig config.PluginConfig - err := json.Unmarshal(jb.OCR2OracleSpec.PluginConfig.Bytes(), &pluginConfig) - if err != nil { - return nil, errors.Wrap(err, "json unmarshal plugin config") - } - err = config.ValidatePluginConfig(pluginConfig, dkgSignKs, dkgEncryptKs) - if err != nil { - return nil, errors.Wrap(err, "validate plugin config") - } - signKey, err := dkgSignKs.Get(pluginConfig.SigningPublicKey) - if err != nil { - return nil, errors.Wrap(err, "get dkgsign key") - } - encryptKey, err := dkgEncryptKs.Get(pluginConfig.EncryptionPublicKey) - if err != nil { - return nil, errors.Wrap(err, "get dkgencrypt key") - } - onchainDKGClient, err := NewOnchainDKGClient( - jb.OCR2OracleSpec.ContractID, - ethClient) - if err != nil { - return nil, errors.Wrap(err, "new onchain dkg client") - } - onchainContract := dkg.NewOnchainContract(onchainDKGClient, &altbn_128.G2{}) - keyConsumer := newDummyKeyConsumer() - keyID, err := DecodeKeyID(pluginConfig.KeyID) - if err != nil { - return nil, errors.Wrap(err, "decode key ID") - } - shareDB := persistence.NewShareDB(ds, lggr.Named("DKGShareDB"), chainID, network) - oracleArgsNoPlugin.ReportingPluginFactory = dkg.NewReportingPluginFactory( - encryptKey.KyberScalar(), - signKey.KyberScalar(), - keyID, - onchainContract, - ocrLogger, - keyConsumer, - shareDB, - ) - oracle, err := libocr2.NewOracle(oracleArgsNoPlugin) - if err != nil { - return nil, errors.Wrap(err, "error calling NewOracle") - } - return []job.ServiceCtx{ocr2Provider, job.NewServiceAdapter(oracle)}, nil -} - -func DecodeKeyID(val string) (byteArray [32]byte, err error) { - decoded, err := hex.DecodeString(val) - if err != nil { - return [32]byte{}, errors.Wrap(err, "hex decode string") - } - if len(decoded) != 32 { - return [32]byte{}, fmt.Errorf("expected value to be 32 bytes but received %d bytes", len(decoded)) - } - copy(byteArray[:], decoded) - return -} diff --git a/core/services/ocr2/plugins/ocr2vrf/config/config.go b/core/services/ocr2/plugins/ocr2vrf/config/config.go deleted file mode 100644 index 9df02c23344..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/config/config.go +++ /dev/null @@ -1,57 +0,0 @@ -package config - -import ( - "github.com/pkg/errors" - - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - dkgconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/dkg/config" -) - -// PluginConfig contains custom arguments for the OCR2VRF plugin. -// -// The OCR2VRF plugin runs a DKG under the hood, so it will need both -// DKG and OCR2VRF configuration fields. -// -// The DKG contract address is provided in the plugin configuration, -// however the OCR2VRF contract address is provided in the OCR2 job spec -// under the 'contractID' key. -type PluginConfig struct { - // DKG configuration fields. - DKGEncryptionPublicKey string `json:"dkgEncryptionPublicKey"` - DKGSigningPublicKey string `json:"dkgSigningPublicKey"` - DKGKeyID string `json:"dkgKeyID"` - DKGContractAddress string `json:"dkgContractAddress"` - - // VRF configuration fields - VRFCoordinatorAddress string `json:"vrfCoordinatorAddress"` - LinkEthFeedAddress string `json:"linkEthFeedAddress"` -} - -// ValidatePluginConfig validates that the given OCR2VRF plugin configuration is correct. -func ValidatePluginConfig(config PluginConfig, dkgSignKs keystore.DKGSign, dkgEncryptKs keystore.DKGEncrypt) error { - err := dkgconfig.ValidatePluginConfig(dkgconfig.PluginConfig{ - EncryptionPublicKey: config.DKGEncryptionPublicKey, - SigningPublicKey: config.DKGSigningPublicKey, - KeyID: config.DKGKeyID, - }, dkgSignKs, dkgEncryptKs) - if err != nil { - return err - } - - // NOTE: a better validation would be to call a method on the on-chain contract pointed to by this - // address. - if config.DKGContractAddress == "" { - return errors.New("dkgContractAddress field must be provided") - } - - if config.VRFCoordinatorAddress == "" { - return errors.New("vrfCoordinatorAddress field must be provided") - } - - // NOTE: similar to the above. - if config.LinkEthFeedAddress == "" { - return errors.New("linkEthFieldAddress field must be provided") - } - - return nil -} diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator.go deleted file mode 100644 index f77b99b3568..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator.go +++ /dev/null @@ -1,1156 +0,0 @@ -package coordinator - -import ( - "bytes" - "context" - "encoding/binary" - "encoding/json" - "fmt" - "math/big" - "sort" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/pkg/errors" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" - "golang.org/x/exp/maps" - "google.golang.org/protobuf/proto" - - "github.com/smartcontractkit/libocr/commontypes" - ocr2Types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - - "github.com/smartcontractkit/chainlink-common/pkg/utils/mathutil" - - "github.com/smartcontractkit/chainlink-vrf/dkg" - ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" - - evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" - evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - dkg_wrapper "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/dkg" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_coordinator" - vrf_wrapper "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_coordinator" - "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/job" - ocr2vrfconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2vrf/config" -) - -var _ ocr2vrftypes.CoordinatorInterface = &coordinator{} - -var ( - dkgABI = evmtypes.MustGetABI(dkg_wrapper.DKGMetaData.ABI) - vrfBeaconABI = evmtypes.MustGetABI(vrf_beacon.VRFBeaconMetaData.ABI) - vrfCoordinatorABI = evmtypes.MustGetABI(vrf_coordinator.VRFCoordinatorMetaData.ABI) - counterBuckets = []float64{ - 0, - 1, - 2, - 4, - 8, - 16, - 32, - 64, - 128, - 256, - 512, - 1024, - 2048, - } - timingBuckets = []float64{ - float64(1 * time.Millisecond), - float64(5 * time.Millisecond), - float64(10 * time.Millisecond), - float64(50 * time.Millisecond), - float64(100 * time.Millisecond), - float64(500 * time.Millisecond), - float64(time.Second), - float64(5 * time.Second), - float64(10 * time.Second), - float64(30 * time.Second), - } - promLabels = []string{"evmChainID", "oracleID", "configDigest"} - promBlocksToReport = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "ocr2vrf_coordinator_blocks_to_report", - Help: "Number of unfulfilled and in-flight blocks that fit in current report in reportBlocks", - Buckets: counterBuckets, - }, promLabels) - promCallbacksToReport = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "ocr2vrf_coordinator_callbacks_to_report", - Help: "Number of unfulfilled and in-flight callbacks fit in current report in reportBlocks", - Buckets: counterBuckets, - }, promLabels) - promBlocksInReport = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "ocr2vrf_coordinator_blocks_in_report", - Help: "Number of blocks found in reportWillBeTransmitted", - Buckets: counterBuckets, - }, promLabels) - promCallbacksInReport = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "ocr2vrf_coordinator_callbacks_in_report", - Help: "Number of callbacks found in reportWillBeTransmitted", - Buckets: counterBuckets, - }, promLabels) - promMethodDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "ocr2vrf_coordinator_method_time", - Help: "The amount of time elapsed for given method call", - Buckets: timingBuckets, - }, append(promLabels, "methodName")) -) - -const ( - // VRF-only events. - randomnessRequestedEvent string = "RandomnessRequested" - randomnessFulfillmentRequestedEvent string = "RandomnessFulfillmentRequested" - randomWordsFulfilledEvent string = "RandomWordsFulfilled" - newTransmissionEvent string = "NewTransmission" - outputsServedEvent string = "OutputsServed" - - // Both VRF and DKG contracts emit this, it's an OCR event. - configSetEvent = "ConfigSet" -) - -// block is used to key into a set that tracks beacon blocks. -type block struct { - blockNumber uint64 - confDelay uint32 -} - -type blockInReport struct { - block - recentBlockHeight uint64 - recentBlockHash common.Hash -} - -type callback struct { - blockNumber uint64 - requestID *big.Int -} - -type callbackInReport struct { - callback - recentBlockHeight uint64 - recentBlockHash common.Hash -} - -type coordinator struct { - lggr logger.Logger - - lp logpoller.LogPoller - topics - finalityDepth uint32 - - onchainRouter VRFBeaconCoordinator - coordinatorAddress common.Address - beaconAddress common.Address - - // We need to keep track of DKG ConfigSet events as well. - dkgAddress common.Address - - evmClient evmclient.Client - - // set of blocks that have been scheduled for transmission. - toBeTransmittedBlocks *ocrCache[blockInReport] - // set of request id's that have been scheduled for transmission. - toBeTransmittedCallbacks *ocrCache[callbackInReport] - blockhashLookback uint64 - coordinatorConfig *ocr2vrftypes.CoordinatorConfig - configDigest ocr2Types.ConfigDigest - oracleID commontypes.OracleID -} - -// New creates a new CoordinatorInterface implementor. -func New( - ctx context.Context, - lggr logger.Logger, - beaconAddress common.Address, - coordinatorAddress common.Address, - dkgAddress common.Address, - client evmclient.Client, - logPoller logpoller.LogPoller, - finalityDepth uint32, -) (ocr2vrftypes.CoordinatorInterface, error) { - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, client) - if err != nil { - return nil, errors.Wrap(err, "onchain router creation") - } - - t := newTopics() - - // Add log filters for the log poller so that it can poll and find the logs that - // we need. - err = logPoller.RegisterFilter(ctx, logpoller.Filter{ - Name: filterName(beaconAddress, coordinatorAddress, dkgAddress), - EventSigs: []common.Hash{ - t.randomnessRequestedTopic, - t.randomnessFulfillmentRequestedTopic, - t.randomWordsFulfilledTopic, - t.configSetTopic, - t.outputsServedTopic, - t.newTransmissionTopic}, Addresses: []common.Address{beaconAddress, coordinatorAddress, dkgAddress}}) - if err != nil { - return nil, err - } - - cacheEvictionWindowSeconds := int64(60) - cacheEvictionWindow := time.Duration(cacheEvictionWindowSeconds * int64(time.Second)) - lookbackBlocks := uint64(1_000) - - return &coordinator{ - onchainRouter: onchainRouter, - coordinatorAddress: coordinatorAddress, - beaconAddress: beaconAddress, - dkgAddress: dkgAddress, - lp: logPoller, - topics: t, - finalityDepth: finalityDepth, - evmClient: client, - lggr: lggr.Named("OCR2VRFCoordinator"), - toBeTransmittedBlocks: NewBlockCache[blockInReport](cacheEvictionWindow), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](cacheEvictionWindow), - blockhashLookback: mathutil.Min(256, lookbackBlocks), - // defaults - coordinatorConfig: &ocr2vrftypes.CoordinatorConfig{ - CacheEvictionWindowSeconds: cacheEvictionWindowSeconds, - BatchGasLimit: 5_000_000, - CoordinatorOverhead: 50_000, - BlockGasOverhead: 50_000, - CallbackOverhead: 50_000, - LookbackBlocks: lookbackBlocks, - }, - }, nil -} - -func (c *coordinator) CurrentChainHeight(ctx context.Context) (uint64, error) { - head, err := c.lp.LatestBlock(ctx) - if err != nil { - return 0, err - } - return uint64(head.BlockNumber), nil -} - -// ReportIsOnchain returns true iff a report for the given OCR epoch/round is -// present onchain. -func (c *coordinator) ReportIsOnchain( - ctx context.Context, - epoch uint32, - round uint8, - configDigest [32]byte, -) (presentOnchain bool, err error) { - now := time.Now().UTC() - defer c.logAndEmitFunctionDuration("ReportIsOnchain", now) - - // Check if a NewTransmission event was emitted on-chain with the - // provided epoch and round. - - epochAndRound := toEpochAndRoundUint40(epoch, round) - - // this is technically NOT a hash in the regular meaning, - // however it has the same size as a common.Hash. We need - // to left-pad by bytes because it has to be 256 (or 32 bytes) - // long in order to use as a topic filter. - enrTopic := common.BytesToHash(common.LeftPadBytes(epochAndRound.Bytes(), 32)) - - c.lggr.Info(fmt.Sprintf("epoch and round: %s %s", epochAndRound.String(), enrTopic.String())) - logs, err := c.lp.IndexedLogs( - ctx, - c.topics.newTransmissionTopic, - c.beaconAddress, - 2, - []common.Hash{ - enrTopic, - }, - 1) - if err != nil { - return false, errors.Wrap(err, "log poller IndexedLogs") - } - - // Filter for valid logs that match the current config digest. - var logsWithCorrectConfigDigest []logpoller.Log - for i := 0; i < len(logs); i++ { - rawLog := toGethLog(logs[i]) - unpacked, err := c.onchainRouter.ParseLog(rawLog) - if err != nil { - c.lggr.Warnw("Incorrect log found in NewTransmissions", "log", logs[i], "err", err) - continue - } - nt, ok := unpacked.(*vrf_beacon.VRFBeaconNewTransmission) - if !ok { - c.lggr.Warnw("Type error for log in NewTransmissisons", "log", logs[i], "err", err) - continue - } - if nt.ConfigDigest == configDigest { - logsWithCorrectConfigDigest = append(logsWithCorrectConfigDigest, logs[i]) - } - } - - c.lggr.Info(fmt.Sprintf("NewTransmission logs: %+v", logsWithCorrectConfigDigest)) - - return len(logsWithCorrectConfigDigest) >= 1, nil -} - -// ReportBlocks returns the heights and hashes of the blocks which require VRF -// proofs in the current report, and the callback requests which should be -// served as part of processing that report. Everything returned by this -// should concern blocks older than the corresponding confirmationDelay. -// Blocks and callbacks it has returned previously may be returned again, as -// long as retransmissionDelay blocks have passed since they were last -// returned. The callbacks returned do not have to correspond to the blocks. -// -// The implementor is responsible for only returning well-funded callback -// requests, and blocks for which clients have actually requested random output -// -// This can be implemented on ethereum using the RandomnessRequested and -// RandomnessFulfillmentRequested events, to identify which blocks and -// callbacks need to be served, along with the NewTransmission and -// RandomWordsFulfilled events, to identify which have already been served. -func (c *coordinator) ReportBlocks( - ctx context.Context, - slotInterval uint16, // TODO: unused for now - confirmationDelays map[uint32]struct{}, - retransmissionDelay time.Duration, // TODO: unused for now - maxBlocks, // TODO: unused for now - maxCallbacks int, // TODO: unused for now -) ( - blocks []ocr2vrftypes.Block, - callbacks []ocr2vrftypes.AbstractCostedCallbackRequest, - recentBlockHashesStartHeight uint64, - recentBlockHashes []common.Hash, - err error, -) { - now := time.Now().UTC() - defer c.logAndEmitFunctionDuration("ReportBlocks", now) - - // Instantiate the gas used by this batch. - currentBatchGasLimit := c.coordinatorConfig.CoordinatorOverhead - - // TODO: use head broadcaster instead? - currentHeight, err := c.CurrentChainHeight(ctx) - if err != nil { - err = errors.Wrap(err, "header by number") - return - } - - // Evict expired items from the cache. - c.toBeTransmittedBlocks.EvictExpiredItems(now) - c.toBeTransmittedCallbacks.EvictExpiredItems(now) - - c.lggr.Infow("current chain height", "currentHeight", currentHeight) - - logs, err := c.lp.LogsWithSigs( - ctx, - int64(currentHeight-c.coordinatorConfig.LookbackBlocks), - int64(currentHeight), - []common.Hash{ - c.randomnessRequestedTopic, - c.randomnessFulfillmentRequestedTopic, - c.randomWordsFulfilledTopic, - c.outputsServedTopic, - }, - c.coordinatorAddress) - if err != nil { - err = errors.Wrapf(err, "logs with topics. address: %s", c.coordinatorAddress) - return - } - - c.lggr.Tracew("logsWithSigs", "logs", logs) - - randomnessRequestedLogs, - randomnessFulfillmentRequestedLogs, - randomWordsFulfilledLogs, - outputsServedLogs, - err := c.unmarshalLogs(logs) - if err != nil { - err = errors.Wrap(err, "unmarshal logs") - return - } - - c.lggr.Tracew( - "finished unmarshalLogs", - "RandomnessRequested", randomnessRequestedLogs, - "RandomnessFulfillmentRequested", randomnessFulfillmentRequestedLogs, - "RandomWordsFulfilled", randomWordsFulfilledLogs, - "OutputsServed", outputsServedLogs, - ) - - // Get start height for recent blockhashes. - recentBlockHashesStartHeight = uint64(0) - if currentHeight >= c.blockhashLookback { - recentBlockHashesStartHeight = currentHeight - c.blockhashLookback + 1 - } - - // Get blockhashes that pertain to requested blocks. - blockhashesMapping, err := c.getBlockhashesMappingFromRequests( - ctx, - randomnessRequestedLogs, - randomnessFulfillmentRequestedLogs, - currentHeight, - recentBlockHashesStartHeight, - ) - if err != nil { - err = errors.Wrap(err, "get blockhashes in ReportBlocks") - return - } - - // TODO BELOW: Write tests for the new blockhash retrieval. - // Obtain recent blockhashes, ordered by ascending block height. - for i := recentBlockHashesStartHeight; i <= currentHeight; i++ { - recentBlockHashes = append(recentBlockHashes, blockhashesMapping[i]) - } - - blocksRequested := make(map[block]struct{}) - redeemRandomnessBlocksRequested := make(map[block]struct{}) - unfulfilled, err := c.filterEligibleRandomnessRequests(randomnessRequestedLogs, confirmationDelays, currentHeight, blockhashesMapping) - if err != nil { - err = errors.Wrap(err, "filter requests in ReportBlocks") - return - } - for _, uf := range unfulfilled { - blocksRequested[uf] = struct{}{} - redeemRandomnessBlocksRequested[uf] = struct{}{} - } - - c.lggr.Tracew("filtered eligible randomness requests", "blocks", unfulfilled) - - callbacksRequested, unfulfilled, err := c.filterEligibleCallbacks(randomnessFulfillmentRequestedLogs, confirmationDelays, currentHeight, blockhashesMapping) - if err != nil { - err = errors.Wrap(err, "filter callbacks in ReportBlocks") - return - } - for _, uf := range unfulfilled { - blocksRequested[uf] = struct{}{} - } - - c.lggr.Tracew("filtered eligible callbacks and blocks", "callbacks", callbacksRequested, "blocks", maps.Keys(blocksRequested)) - - // Remove blocks that have already received responses so that we don't - // respond to them again. - fulfilledBlocks := c.getFulfilledBlocks(outputsServedLogs) - for _, f := range fulfilledBlocks { - delete(blocksRequested, f) - delete(redeemRandomnessBlocksRequested, f) - } - - c.lggr.Tracew("got fulfilled blocks", "fulfilled", fulfilledBlocks) - - // Fill blocks slice with valid requested blocks. - blocks = []ocr2vrftypes.Block{} - for block := range blocksRequested { - if c.coordinatorConfig.BatchGasLimit-currentBatchGasLimit < c.coordinatorConfig.BlockGasOverhead { - break - } - _, redeemRandomnessRequested := redeemRandomnessBlocksRequested[block] - blocks = append(blocks, ocr2vrftypes.Block{ - Hash: blockhashesMapping[block.blockNumber], - Height: block.blockNumber, - ConfirmationDelay: block.confDelay, - ShouldStore: redeemRandomnessRequested, - }) - currentBatchGasLimit += c.coordinatorConfig.BlockGasOverhead - } - - c.lggr.Tracew("got elligible blocks", "blocks", blocks) - - // Find unfulfilled callback requests by filtering out already fulfilled callbacks. - fulfilledRequestIDs := c.getFulfilledRequestIDs(randomWordsFulfilledLogs) - callbacks = c.filterUnfulfilledCallbacks(callbacksRequested, fulfilledRequestIDs, confirmationDelays, currentHeight, currentBatchGasLimit) - c.emitReportBlocksMetrics(len(blocks), len(callbacks)) - - // Pull request IDs from elligible callbacks for logging. There should only be - // at most 100-200 elligible callbacks in a report. - var reqIDs []*big.Int - for _, c := range callbacks { - reqIDs = append(reqIDs, c.RequestID) - } - c.lggr.Debugw("reporting blocks and callbacks", "blocks", blocks, "callbacks", reqIDs) - c.lggr.Tracew("alreday fulfilled blocks and callbacks", "blocks", fulfilledBlocks, "callbacks", maps.Keys(fulfilledRequestIDs)) - - return -} - -// getBlockhashesMappingFromRequests returns the blockhashes for enqueued request blocks. -func (c *coordinator) getBlockhashesMappingFromRequests( - ctx context.Context, - randomnessRequestedLogs []*vrf_wrapper.VRFCoordinatorRandomnessRequested, - randomnessFulfillmentRequestedLogs []*vrf_wrapper.VRFCoordinatorRandomnessFulfillmentRequested, - currentHeight uint64, - recentBlockHashesStartHeight uint64, -) (blockhashesMapping map[uint64]common.Hash, err error) { - // Get all request + callback requests into a mapping. - rawBlocksRequested := make(map[uint64]struct{}) - for _, l := range randomnessRequestedLogs { - if isBlockEligible(l.NextBeaconOutputHeight, l.ConfDelay, currentHeight) { - rawBlocksRequested[l.NextBeaconOutputHeight] = struct{}{} - - // Also get the blockhash for the most recent cached report on this block, - // if one exists. - cacheKey := getBlockCacheKey(l.NextBeaconOutputHeight, l.ConfDelay.Uint64()) - t := c.toBeTransmittedBlocks.GetItem(cacheKey) - if t != nil { - rawBlocksRequested[t.recentBlockHeight] = struct{}{} - } - } - } - for _, l := range randomnessFulfillmentRequestedLogs { - if isBlockEligible(l.NextBeaconOutputHeight, l.ConfDelay, currentHeight) { - rawBlocksRequested[l.NextBeaconOutputHeight] = struct{}{} - - // Also get the blockhash for the most recent cached report on this callback, - // if one exists. - cacheKey := getCallbackCacheKey(l.RequestID) - t := c.toBeTransmittedCallbacks.GetItem(cacheKey) - if t != nil { - rawBlocksRequested[t.recentBlockHeight] = struct{}{} - } - } - } - - // Fill a unique list of request blocks. - requestedBlockNumbers := []uint64{} - for k := range rawBlocksRequested { - requestedBlockNumbers = append(requestedBlockNumbers, k) - } - - // Get a mapping of block numbers to block hashes. - blockhashesMapping, err = c.getBlockhashesMapping(ctx, append(requestedBlockNumbers, currentHeight, recentBlockHashesStartHeight)) - if err != nil { - err = errors.Wrap(err, "get blockhashes for ReportBlocks") - } - return -} - -func (c *coordinator) getFulfilledBlocks(outputsServedLogs []*vrf_coordinator.VRFCoordinatorOutputsServed) (fulfilled []block) { - for _, r := range outputsServedLogs { - for _, o := range r.OutputsServed { - fulfilled = append(fulfilled, block{ - blockNumber: o.Height, - confDelay: uint32(o.ConfirmationDelay.Uint64()), - }) - } - } - return -} - -// getBlockhashesMapping returns the blockhashes corresponding to a slice of block numbers. -func (c *coordinator) getBlockhashesMapping( - ctx context.Context, - blockNumbers []uint64, -) (blockhashesMapping map[uint64]common.Hash, err error) { - // GetBlocks doesn't necessarily need a sorted blockNumbers array, - // but sorting it is helpful for testing. - sort.Slice(blockNumbers, func(a, b int) bool { - return blockNumbers[a] < blockNumbers[b] - }) - - heads, err := c.lp.GetBlocksRange(ctx, blockNumbers) - if err != nil { - return nil, errors.Wrap(err, "logpoller.GetBlocks") - } - - blockhashesMapping = make(map[uint64]common.Hash) - for _, head := range heads { - blockhashesMapping[uint64(head.BlockNumber)] = head.BlockHash - } - - // Ensure that every requested block received a blockhash. - for _, b := range blockNumbers { - if _, ok := blockhashesMapping[b]; !ok { - err = fmt.Errorf("could not find all heads in db: want %d got %d", len(blockNumbers), len(heads)) - return - } - } - return -} - -// getFulfilledRequestIDs returns the request IDs referenced by the given RandomWordsFulfilled logs slice. -func (c *coordinator) getFulfilledRequestIDs(randomWordsFulfilledLogs []*vrf_wrapper.VRFCoordinatorRandomWordsFulfilled) map[uint64]struct{} { - fulfilledRequestIDs := make(map[uint64]struct{}) - for _, r := range randomWordsFulfilledLogs { - for _, requestID := range r.RequestIDs { - fulfilledRequestIDs[requestID.Uint64()] = struct{}{} - } - } - return fulfilledRequestIDs -} - -// filterUnfulfilledCallbacks returns unfulfilled callback requests given the -// callback request logs and the already fulfilled callback request IDs. -func (c *coordinator) filterUnfulfilledCallbacks( - callbacksRequested []*vrf_wrapper.VRFCoordinatorRandomnessFulfillmentRequested, - fulfilledRequestIDs map[uint64]struct{}, - confirmationDelays map[uint32]struct{}, - currentHeight uint64, - currentBatchGasLimit int64, -) (callbacks []ocr2vrftypes.AbstractCostedCallbackRequest) { - /** - * Callback batch ordering: - * - Callbacks are first ordered by beacon output + confirmation delay (ascending), in other words - * the fulfillments at the oldest block are first in line. - * - Within the same block, fulfillments are ordered by gasAllowance (ascending), i.e the callbacks with - * the lowest gasAllowance are first in line. - * - This ordering ensures that the oldest callbacks can be picked up first, and that as many callbacks as - * possible can be fit into a batch. - * - * Example: - * Unsorted: (outputHeight: 1, gasAllowance: 200k), (outputHeight: 3, gasAllowance: 100k), (outputHeight: 1, gasAllowance: 100k) - * Sorted: (outputHeight: 1, gasAllowance: 100k), (outputHeight: 1, gasAllowance: 200k), (outputHeight: 3, gasAllowance: 100k) - * - */ - sort.Slice(callbacksRequested, func(a, b int) bool { - aHeight := callbacksRequested[a].NextBeaconOutputHeight + callbacksRequested[a].ConfDelay.Uint64() - bHeight := callbacksRequested[b].NextBeaconOutputHeight + callbacksRequested[b].ConfDelay.Uint64() - if aHeight == bHeight { - return callbacksRequested[a].GasAllowance < callbacksRequested[b].GasAllowance - } - return aHeight < bHeight - }) - - for _, r := range callbacksRequested { - // Check if there is room left in the batch. If there is no room left, the coordinator - // will keep iterating, until it either finds a callback in a subsequent output height that - // can fit into the current batch or reaches the end of the sorted callbacks slice. - if c.coordinatorConfig.BatchGasLimit-currentBatchGasLimit < (int64(r.GasAllowance) + c.coordinatorConfig.CallbackOverhead) { - continue - } - - requestID := r.RequestID - if _, ok := fulfilledRequestIDs[requestID.Uint64()]; !ok { - // The on-chain machinery will revert requests that specify an unsupported - // confirmation delay, so this is more of a sanity check than anything else. - if _, ok := confirmationDelays[uint32(r.ConfDelay.Uint64())]; !ok { - // if we can't find the conf delay in the map then just ignore this request - c.lggr.Errorw("ignoring bad request, unsupported conf delay", - "confDelay", r.ConfDelay.String(), - "supportedConfDelays", confirmationDelays) - continue - } - - // NOTE: we already check if the callback has been fulfilled in filterEligibleCallbacks, - // so we don't need to do that again here. - if isBlockEligible(r.NextBeaconOutputHeight, r.ConfDelay, currentHeight) { - callbacks = append(callbacks, ocr2vrftypes.AbstractCostedCallbackRequest{ - BeaconHeight: r.NextBeaconOutputHeight, - ConfirmationDelay: uint32(r.ConfDelay.Uint64()), - SubscriptionID: r.SubID, - Price: big.NewInt(0), // TODO: no price tracking - RequestID: requestID, - NumWords: r.NumWords, - Requester: r.Requester, - Arguments: r.Arguments, - GasAllowance: big.NewInt(int64(r.GasAllowance)), - GasPrice: r.GasPrice, - WeiPerUnitLink: r.WeiPerUnitLink, - }) - currentBatchGasLimit += int64(r.GasAllowance) - c.lggr.Debugw("Request is unfulfilled", "requestID", requestID) - } - } - } - return callbacks -} - -// filterEligibleCallbacks extracts valid callback requests from the given logs, -// based on their readiness to be fulfilled. It also returns any unfulfilled blocks -// associated with those callbacks. -func (c *coordinator) filterEligibleCallbacks( - randomnessFulfillmentRequestedLogs []*vrf_wrapper.VRFCoordinatorRandomnessFulfillmentRequested, - confirmationDelays map[uint32]struct{}, - currentHeight uint64, - blockhashesMapping map[uint64]common.Hash, -) (callbacks []*vrf_wrapper.VRFCoordinatorRandomnessFulfillmentRequested, unfulfilled []block, err error) { - for _, r := range randomnessFulfillmentRequestedLogs { - // The on-chain machinery will revert requests that specify an unsupported - // confirmation delay, so this is more of a sanity check than anything else. - if _, ok := confirmationDelays[uint32(r.ConfDelay.Uint64())]; !ok { - // if we can't find the conf delay in the map then just ignore this request - c.lggr.Errorw("ignoring bad request, unsupported conf delay", - "confDelay", r.ConfDelay.String(), - "supportedConfDelays", confirmationDelays) - continue - } - - // Check that the callback is elligible. - if isBlockEligible(r.NextBeaconOutputHeight, r.ConfDelay, currentHeight) { - cacheKey := getCallbackCacheKey(r.RequestID) - t := c.toBeTransmittedCallbacks.GetItem(cacheKey) - // If the callback is found in the cache and the recentBlockHash from the report containing the callback - // is correct, then the callback is in-flight and should not be included in the current observation. If that - // report gets re-orged, then the recentBlockHash of the report will become invalid, in which case - // the cached callback is ignored, and the callback is added to the current observation. - inflightTransmission := (t != nil) && (t.recentBlockHash == blockhashesMapping[t.recentBlockHeight]) - if inflightTransmission { - c.lggr.Debugw("Request is in-flight", "requestID", r.RequestID) - continue - } - - callbacks = append(callbacks, r) - - // We could have a callback request that was made in a different block than what we - // have possibly already received from regular requests. - unfulfilled = append(unfulfilled, block{ - blockNumber: r.NextBeaconOutputHeight, - confDelay: uint32(r.ConfDelay.Uint64()), - }) - c.lggr.Debugw("Request is eligible", "requestID", r.RequestID) - } - } - return -} - -// filterEligibleRandomnessRequests extracts valid randomness requests from the given logs, -// based on their readiness to be fulfilled. -func (c *coordinator) filterEligibleRandomnessRequests( - randomnessRequestedLogs []*vrf_wrapper.VRFCoordinatorRandomnessRequested, - confirmationDelays map[uint32]struct{}, - currentHeight uint64, - blockhashesMapping map[uint64]common.Hash, -) (unfulfilled []block, err error) { - for _, r := range randomnessRequestedLogs { - // The on-chain machinery will revert requests that specify an unsupported - // confirmation delay, so this is more of a sanity check than anything else. - if _, ok := confirmationDelays[uint32(r.ConfDelay.Uint64())]; !ok { - // if we can't find the conf delay in the map then just ignore this request - c.lggr.Errorw("ignoring bad request, unsupported conf delay", - "confDelay", r.ConfDelay.String(), - "supportedConfDelays", confirmationDelays) - continue - } - - // Check that the block is elligible. - if isBlockEligible(r.NextBeaconOutputHeight, r.ConfDelay, currentHeight) { - cacheKey := getBlockCacheKey(r.NextBeaconOutputHeight, r.ConfDelay.Uint64()) - t := c.toBeTransmittedBlocks.GetItem(cacheKey) - // If the block is found in the cache and the recentBlockHash from the report containing the block - // is correct, then the block is in-flight and should not be included in the current observation. If that - // report gets re-orged, then the recentBlockHash of the report will become invalid, in which case - // the cached block is ignored and the block is added to the current observation. - validTransmission := (t != nil) && (t.recentBlockHash == blockhashesMapping[t.recentBlockHeight]) - if validTransmission { - c.lggr.Debugw("Block is in-flight", "blockNumber", r.NextBeaconOutputHeight, "confDelay", r.ConfDelay) - continue - } - - unfulfilled = append(unfulfilled, block{ - blockNumber: r.NextBeaconOutputHeight, - confDelay: uint32(r.ConfDelay.Uint64()), - }) - c.lggr.Debugw("Block is eligible", "blockNumber", r.NextBeaconOutputHeight, "confDelay", r.ConfDelay) - } - } - return -} - -func (c *coordinator) unmarshalLogs( - logs []logpoller.Log, -) ( - randomnessRequestedLogs []*vrf_wrapper.VRFCoordinatorRandomnessRequested, - randomnessFulfillmentRequestedLogs []*vrf_wrapper.VRFCoordinatorRandomnessFulfillmentRequested, - randomWordsFulfilledLogs []*vrf_wrapper.VRFCoordinatorRandomWordsFulfilled, - outputsServedLogs []*vrf_wrapper.VRFCoordinatorOutputsServed, - err error, -) { - for _, lg := range logs { - rawLog := toGethLog(lg) - switch lg.EventSig { - case c.randomnessRequestedTopic: - unpacked, err2 := c.onchainRouter.ParseLog(rawLog) - if err2 != nil { - // should never happen - err = errors.Wrap(err2, "unmarshal RandomnessRequested log") - return - } - rr, ok := unpacked.(*vrf_wrapper.VRFCoordinatorRandomnessRequested) - if !ok { - // should never happen - err = errors.New("cast to *VRFCoordinatorRandomnessRequested") - return - } - randomnessRequestedLogs = append(randomnessRequestedLogs, rr) - case c.randomnessFulfillmentRequestedTopic: - unpacked, err2 := c.onchainRouter.ParseLog(rawLog) - if err2 != nil { - // should never happen - err = errors.Wrap(err2, "unmarshal RandomnessFulfillmentRequested log") - return - } - rfr, ok := unpacked.(*vrf_wrapper.VRFCoordinatorRandomnessFulfillmentRequested) - if !ok { - // should never happen - err = errors.New("cast to *VRFCoordinatorRandomnessFulfillmentRequested") - return - } - randomnessFulfillmentRequestedLogs = append(randomnessFulfillmentRequestedLogs, rfr) - case c.randomWordsFulfilledTopic: - unpacked, err2 := c.onchainRouter.ParseLog(rawLog) - if err2 != nil { - // should never happen - err = errors.Wrap(err2, "unmarshal RandomWordsFulfilled log") - return - } - rwf, ok := unpacked.(*vrf_wrapper.VRFCoordinatorRandomWordsFulfilled) - if !ok { - // should never happen - err = errors.New("cast to *VRFCoordinatorRandomWordsFulfilled") - return - } - randomWordsFulfilledLogs = append(randomWordsFulfilledLogs, rwf) - case c.outputsServedTopic: - unpacked, err2 := c.onchainRouter.ParseLog(rawLog) - if err2 != nil { - // should never happen - err = errors.Wrap(err2, "unmarshal OutputsServed log") - return - } - nt, ok := unpacked.(*vrf_coordinator.VRFCoordinatorOutputsServed) - if !ok { - // should never happen - err = errors.New("cast to *vrf_coordinator.VRFCoordinatorOutputsServed") - } - outputsServedLogs = append(outputsServedLogs, nt) - default: - c.lggr.Error(fmt.Sprintf("Unexpected event sig: %s", lg.EventSig)) - c.lggr.Error(fmt.Sprintf("expected one of: %s (RandomnessRequested) %s (RandomnessFulfillmentRequested) %s (RandomWordsFulfilled) %s (OutputsServed), got %s", - hexutil.Encode(c.randomnessRequestedTopic[:]), - hexutil.Encode(c.randomnessFulfillmentRequestedTopic[:]), - hexutil.Encode(c.randomWordsFulfilledTopic[:]), - hexutil.Encode(c.outputsServedTopic[:]), - lg.EventSig)) - } - } - return -} - -// ReportWillBeTransmitted registers to the CoordinatorInterface that the -// local node has accepted the AbstractReport for transmission, so that its -// blocks and callbacks can be tracked for possible later retransmission -func (c *coordinator) ReportWillBeTransmitted(ctx context.Context, report ocr2vrftypes.AbstractReport) error { - now := time.Now().UTC() - defer c.logAndEmitFunctionDuration("ReportWillBeTransmitted", now) - - // Evict expired items from the cache. - c.toBeTransmittedBlocks.EvictExpiredItems(now) - c.toBeTransmittedCallbacks.EvictExpiredItems(now) - - // Check for a re-org, and return an error if one is present. - blockhashesMapping, err := c.getBlockhashesMapping(ctx, []uint64{report.RecentBlockHeight}) - if err != nil { - return errors.Wrap(err, "getting blockhash mapping in ReportWillBeTransmitted") - } - if blockhashesMapping[report.RecentBlockHeight] != report.RecentBlockHash { - return errors.Errorf("blockhash of report does not match most recent blockhash in ReportWillBeTransmitted") - } - - blocksRequested := []blockInReport{} - callbacksRequested := []callbackInReport{} - - // Get all requested blocks and callbacks. - for _, output := range report.Outputs { - // If the VRF proof size is 0, the block is not included in this output. We still - // check for callbacks in the ouptut. - if len(output.VRFProof) > 0 { - bR := blockInReport{ - block: block{ - blockNumber: output.BlockHeight, - confDelay: output.ConfirmationDelay, - }, - recentBlockHeight: report.RecentBlockHeight, - recentBlockHash: report.RecentBlockHash, - } - // Store block in blocksRequested.br - blocksRequested = append(blocksRequested, bR) - } - - // Iterate through callbacks for output. - for _, cb := range output.Callbacks { - cbR := callbackInReport{ - callback: callback{ - blockNumber: cb.BeaconHeight, - requestID: cb.RequestID, - }, - recentBlockHeight: report.RecentBlockHeight, - recentBlockHash: report.RecentBlockHash, - } - - // Add callback to callbacksRequested. - callbacksRequested = append(callbacksRequested, cbR) - } - } - - // Apply blockhashes to blocks and mark them as transmitted. - for _, b := range blocksRequested { - cacheKey := getBlockCacheKey(b.blockNumber, uint64(b.confDelay)) - c.toBeTransmittedBlocks.CacheItem(b, cacheKey, now) - c.lggr.Debugw("Block is being transmitted", "blockNumber", b.blockNumber, "confDelay", b.confDelay) - } - - // Add the corresponding blockhashes to callbacks and mark them as transmitted. - for _, cb := range callbacksRequested { - cacheKey := getCallbackCacheKey(cb.requestID) - c.toBeTransmittedCallbacks.CacheItem(cb, cacheKey, now) - c.lggr.Debugw("Request is being transmitted", "requestID", cb.requestID) - } - - c.emitReportWillBeTransmittedMetrics(len(blocksRequested), len(callbacksRequested)) - - return nil -} - -// DKGVRFCommittees returns the addresses of the signers and transmitters -// for the DKG and VRF OCR committees. On ethereum, these can be retrieved -// from the most recent ConfigSet events for each contract. -func (c *coordinator) DKGVRFCommittees(ctx context.Context) (dkgCommittee, vrfCommittee ocr2vrftypes.OCRCommittee, err error) { - startTime := time.Now().UTC() - defer c.logAndEmitFunctionDuration("DKGVRFCommittees", startTime) - - latestVRF, err := c.lp.LatestLogByEventSigWithConfs( - ctx, - c.configSetTopic, - c.beaconAddress, - evmtypes.Confirmations(c.finalityDepth), - ) - if err != nil { - err = errors.Wrap(err, "latest vrf ConfigSet by sig with confs") - return - } - - latestDKG, err := c.lp.LatestLogByEventSigWithConfs( - ctx, - c.configSetTopic, - c.dkgAddress, - evmtypes.Confirmations(c.finalityDepth), - ) - if err != nil { - err = errors.Wrap(err, "latest dkg ConfigSet by sig with confs") - return - } - - var vrfConfigSetLog vrf_beacon.VRFBeaconConfigSet - err = vrfBeaconABI.UnpackIntoInterface(&vrfConfigSetLog, configSetEvent, latestVRF.Data) - if err != nil { - err = errors.Wrap(err, "unpack vrf ConfigSet into interface") - return - } - - var dkgConfigSetLog dkg_wrapper.DKGConfigSet - err = dkgABI.UnpackIntoInterface(&dkgConfigSetLog, configSetEvent, latestDKG.Data) - if err != nil { - err = errors.Wrap(err, "unpack dkg ConfigSet into interface") - return - } - - // len(signers) == len(transmitters), this is guaranteed by libocr. - for i := range vrfConfigSetLog.Signers { - vrfCommittee.Signers = append(vrfCommittee.Signers, vrfConfigSetLog.Signers[i]) - vrfCommittee.Transmitters = append(vrfCommittee.Transmitters, vrfConfigSetLog.Transmitters[i]) - } - - for i := range dkgConfigSetLog.Signers { - dkgCommittee.Signers = append(dkgCommittee.Signers, dkgConfigSetLog.Signers[i]) - dkgCommittee.Transmitters = append(dkgCommittee.Transmitters, dkgConfigSetLog.Transmitters[i]) - } - - return -} - -// ProvingKeyHash returns the VRF current proving block, in view of the local -// node. On ethereum this can be retrieved from the VRF contract's attribute -// s_provingKeyHash -func (c *coordinator) ProvingKeyHash(ctx context.Context) (common.Hash, error) { - h, err := c.onchainRouter.SProvingKeyHash(&bind.CallOpts{ - Context: ctx, - }) - if err != nil { - return [32]byte{}, errors.Wrap(err, "get proving block hash") - } - - return h, nil -} - -// BeaconPeriod returns the period used in the coordinator's contract -func (c *coordinator) BeaconPeriod(ctx context.Context) (uint16, error) { - beaconPeriodBlocks, err := c.onchainRouter.IBeaconPeriodBlocks(&bind.CallOpts{ - Context: ctx, - }) - if err != nil { - return 0, errors.Wrap(err, "get beacon period blocks") - } - - return uint16(beaconPeriodBlocks.Int64()), nil -} - -// ConfirmationDelays returns the list of confirmation delays defined in the coordinator's contract -func (c *coordinator) ConfirmationDelays(ctx context.Context) ([]uint32, error) { - confDelays, err := c.onchainRouter.GetConfirmationDelays(&bind.CallOpts{ - Context: ctx, - }) - if err != nil { - return nil, errors.Wrap(err, "could not get confirmation delays") - } - var result []uint32 - for _, c := range confDelays { - result = append(result, uint32(c.Uint64())) - } - return result, nil -} - -// KeyID returns the key ID from coordinator's contract -func (c *coordinator) KeyID(ctx context.Context) (dkg.KeyID, error) { - keyID, err := c.onchainRouter.SKeyID(&bind.CallOpts{Context: ctx}) - if err != nil { - return dkg.KeyID{}, errors.Wrap(err, "could not get key ID") - } - return keyID, nil -} - -// isBlockEligible returns true if and only if the nextBeaconOutputHeight plus -// the confDelay is less than the current blockchain height, meaning that the beacon -// output height has enough confirmations. -// -// NextBeaconOutputHeight is always greater than the request block, therefore -// a number of confirmations on the beacon block is always enough confirmations -// for the request block. -func isBlockEligible(nextBeaconOutputHeight uint64, confDelay *big.Int, currentHeight uint64) bool { - cond := confDelay.Uint64() < currentHeight // Edge case: for simulated chains with low block numbers - cond = cond && (nextBeaconOutputHeight+confDelay.Uint64()) < currentHeight - return cond -} - -// toEpochAndRoundUint40 returns a single unsigned 40 bit big.Int object -// that has the epoch in the first 32 bytes and the round in the last 8 bytes, -// in a big-endian fashion. -func toEpochAndRoundUint40(epoch uint32, round uint8) *big.Int { - return big.NewInt((int64(epoch) << 8) + int64(round)) -} - -func toGethLog(lg logpoller.Log) types.Log { - var topics []common.Hash - for _, b := range lg.Topics { - topics = append(topics, common.BytesToHash(b)) - } - return types.Log{ - Data: lg.Data, - Address: lg.Address, - BlockHash: lg.BlockHash, - BlockNumber: uint64(lg.BlockNumber), - Topics: topics, - TxHash: lg.TxHash, - Index: uint(lg.LogIndex), - } -} - -// getBlockCacheKey returns a cache key for a requested block -// The blockhash of the block does not need to be included in the key. Instead, -// the block cached at a given key contains a blockhash that is checked for validity -// against the log poller's current state. -func getBlockCacheKey(blockNumber uint64, confDelay uint64) common.Hash { - var blockNumberBytes [8]byte - var confDelayBytes [8]byte - - binary.BigEndian.PutUint64(blockNumberBytes[:], blockNumber) - binary.BigEndian.PutUint64(confDelayBytes[:], confDelay) - - return common.BytesToHash(bytes.Join([][]byte{blockNumberBytes[:], confDelayBytes[:]}, nil)) -} - -// getBlockCacheKey returns a cache key for a requested callback -// The blockhash of the callback does not need to be included in the key. Instead, -// the callback cached at a given key contains a blockhash that is checked for validity -// against the log poller's current state. -func getCallbackCacheKey(requestID *big.Int) common.Hash { - return common.BigToHash(requestID) -} - -// logAndEmitFunctionDuration logs the time in milliseconds and emits metrics in nanosecond for function duration -func (c *coordinator) logAndEmitFunctionDuration(funcName string, startTime time.Time) { - elapsed := time.Now().UTC().Sub(startTime) - c.lggr.Debugf("%s took %d milliseconds to complete", funcName, elapsed.Milliseconds()) - promMethodDuration.WithLabelValues( - append(c.labelValues(), funcName)..., - ).Observe(float64(elapsed.Nanoseconds())) -} - -func (c *coordinator) UpdateConfiguration( - b []byte, - configDigest ocr2Types.ConfigDigest, - oracleID commontypes.OracleID, -) error { - // Update config digest & oracle ID for epoch. - c.configDigest = configDigest - c.oracleID = oracleID - - // Unmarshal off-chain config. - err := proto.Unmarshal(b, c.coordinatorConfig) - if err != nil { - return errors.Wrap(err, "error setting offchain config on coordinator") - } - - // Update local caches with new eviction window. - cacheEvictionWindowSeconds := c.coordinatorConfig.CacheEvictionWindowSeconds - cacheEvictionWindow := time.Duration(cacheEvictionWindowSeconds * int64(time.Second)) - c.toBeTransmittedBlocks.SetEvictonWindow(cacheEvictionWindow) - c.toBeTransmittedCallbacks.SetEvictonWindow(cacheEvictionWindow) - - c.blockhashLookback = mathutil.Min(256, c.coordinatorConfig.LookbackBlocks) - c.lggr.Infow("set offchain config", - offchainConfigFields(c.coordinatorConfig)..., - ) - - return nil -} - -func offchainConfigFields(coordinatorConfig *ocr2vrftypes.CoordinatorConfig) []any { - return []any{ - "cacheEvictionWindowSeconds", coordinatorConfig.CacheEvictionWindowSeconds, - "batchGasLimit", coordinatorConfig.BatchGasLimit, - "coordinatorOverhead", coordinatorConfig.CoordinatorOverhead, - "lookbackBlocks", coordinatorConfig.LookbackBlocks, - "blockGasOverhead", coordinatorConfig.BlockGasOverhead, - "callbackOverhead", coordinatorConfig.CallbackOverhead, - } -} - -func (c *coordinator) labelValues() []string { - chainId := c.evmClient.ConfiguredChainID() - return []string{chainId.String(), fmt.Sprintf("%d", c.oracleID), common.Bytes2Hex(c.configDigest[:])} -} - -func (c *coordinator) emitReportBlocksMetrics( - numBlocks int, - numCallbacks int) { - promBlocksToReport.WithLabelValues(c.labelValues()...).Observe(float64(numBlocks)) - promCallbacksToReport.WithLabelValues(c.labelValues()...).Observe(float64(numCallbacks)) -} - -func (c *coordinator) emitReportWillBeTransmittedMetrics( - numBlocks int, - numCallbacks int) { - promBlocksInReport.WithLabelValues(c.labelValues()...).Observe(float64(numBlocks)) - promCallbacksInReport.WithLabelValues(c.labelValues()...).Observe(float64(numCallbacks)) -} - -func filterName(beaconAddress, coordinatorAddress, dkgAddress common.Address) string { - return logpoller.FilterName("VRF Coordinator", beaconAddress, coordinatorAddress, dkgAddress) -} - -func FilterNamesFromSpec(spec *job.OCR2OracleSpec) (names []string, err error) { - var cfg ocr2vrfconfig.PluginConfig - var beaconAddress, coordinatorAddress, dkgAddress evmtypes.EIP55Address - - if err = json.Unmarshal(spec.PluginConfig.Bytes(), &cfg); err != nil { - err = errors.Wrap(err, "failed to unmarshal ocr2vrf plugin config") - return nil, err - } - - if beaconAddress, err = evmtypes.NewEIP55Address(spec.ContractID); err == nil { - if coordinatorAddress, err = evmtypes.NewEIP55Address(cfg.VRFCoordinatorAddress); err == nil { - if dkgAddress, err = evmtypes.NewEIP55Address(cfg.DKGContractAddress); err == nil { - return []string{filterName(beaconAddress.Address(), coordinatorAddress.Address(), dkgAddress.Address())}, nil - } - } - } - - return nil, err -} diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go deleted file mode 100644 index d0f89ae4ca9..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go +++ /dev/null @@ -1,1787 +0,0 @@ -package coordinator - -import ( - "bytes" - "crypto/rand" - "fmt" - "math/big" - "sort" - "testing" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - gethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/pkg/errors" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/libocr/commontypes" - ocr2Types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - - "github.com/smartcontractkit/chainlink-vrf/dkg" - "github.com/smartcontractkit/chainlink-vrf/ocr2vrf" - ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" - evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - - "github.com/smartcontractkit/chainlink-common/pkg/types" - "github.com/smartcontractkit/chainlink-common/pkg/utils/mathutil" - - evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" - lp_mocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks" - dkg_wrapper "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/dkg" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_coordinator" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" - "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2vrf/coordinator/mocks" -) - -func TestCoordinator_BeaconPeriod(t *testing.T) { - t.Parallel() - - t.Run("valid output", func(t *testing.T) { - onchainRouter := mocks.NewVRFBeaconCoordinator(t) - onchainRouter. - On("IBeaconPeriodBlocks", mock.Anything). - Return(big.NewInt(10), nil) - c := &coordinator{ - onchainRouter: onchainRouter, - } - period, err := c.BeaconPeriod(testutils.Context(t)) - assert.NoError(t, err) - assert.Equal(t, uint16(10), period) - }) - - t.Run("invalid output", func(t *testing.T) { - onchainRouter := mocks.NewVRFBeaconCoordinator(t) - onchainRouter. - On("IBeaconPeriodBlocks", mock.Anything). - Return(nil, errors.New("rpc error")) - c := &coordinator{ - onchainRouter: onchainRouter, - } - _, err := c.BeaconPeriod(testutils.Context(t)) - assert.Error(t, err) - }) -} - -func TestCoordinator_DKGVRFCommittees(t *testing.T) { - t.Parallel() - evmClient := evmclimocks.NewClient(t) - evmClient.On("ConfiguredChainID").Return(big.NewInt(1)) - - t.Run("happy path", func(t *testing.T) { - // In this test the DKG and VRF committees have the same signers and - // transmitters. This may (?) be different in practice. - - lp := lp_mocks.NewLogPoller(t) - tp := newTopics() - - coordinatorAddress := newAddress(t) - beaconAddress := newAddress(t) - dkgAddress := newAddress(t) - lp.On("LatestLogByEventSigWithConfs", mock.Anything, tp.configSetTopic, beaconAddress, evmtypes.Confirmations(10)). - Return(&logpoller.Log{ - Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000a6fca200010576e704b4a519484d6239ef17f1f5b4a82e330b0daf827ed4dc2789971b0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000a8cbea12a06869d3ec432ab9682dab6c761d591000000000000000000000000f4f9db7bb1d16b7cdfb18ec68994c26964f5985300000000000000000000000022fb3f90c539457f00d8484438869135e604a65500000000000000000000000033cbcedccb11c9773ad78e214ba342e979255ab30000000000000000000000006ffaa96256fbc1012325cca88c79f725c33eed80000000000000000000000000000000000000000000000000000000000000000500000000000000000000000074103cf8b436465870b26aa9fa2f62ad62b22e3500000000000000000000000038a6cb196f805cc3041f6645a5a6cec27b64430d00000000000000000000000047d7095cfebf8285bdaa421bc8268d0db87d933c000000000000000000000000a8842be973800ff61d80d2d53fa62c3a685380eb0000000000000000000000003750e31321aee8c024751877070e8d5f704ce98700000000000000000000000000000000000000000000000000000000000000206f3b82406688b8ddb944c6f2e6d808f014c8fa8d568d639c25019568c715fbf000000000000000000000000000000000000000000000000000000000000004220880d88ee16f1080c8afa0251880c8afa025208090dfc04a288090dfc04a30033a05010101010142206c5ca6f74b532222ac927dd3de235d46a943e372c0563393a33b01dcfd3f371c4220855114d25c2ef5e85fffe4f20a365672d8f2dba3b2ec82333f494168a2039c0442200266e835634db00977cbc1caa4db10e1676c1a4c0fcbc6ba7f09300f0d1831824220980cd91f7a73f20f4b0d51d00cd4e00373dc2beafbb299ca3c609757ab98c8304220eb6d36e2af8922085ff510bbe1eb8932a0e3295ca9f047fef25d90e69c52948f4a34313244334b6f6f574463364b7232644542684b59326b336e685057694676544565325331703978544532544b74344d7572716f684a34313244334b6f6f574b436e4367724b637743324a3577576a626e355435335068646b6b6f57454e534a39546537544b7836366f4a4a34313244334b6f6f575239616f675948786b357a38636b624c4c56346e426f7a777a747871664a7050586671336d4a7232796452474a34313244334b6f6f5744695444635565675637776b313133473366476a69616259756f54436f3157726f6f53656741343263556f544a34313244334b6f6f574e64687072586b5472665370354d5071736270467a70364167394a53787358694341434442676454424c656652820300050e416c74424e2d3132382047e282810e86e8cf899ae9a1b43e023bbe8825b103659bb8d6d4e54f6a3cfae7b106069c216a812d7616e47f0bd38fa4863f48fbcda6a38af4c58d2233dfa7cf79620947042d09f923e0a2f7a2270391e8b058d8bdb8f79fe082b7b627f025651c7290382fdff97c3181d15d162c146ce87ff752499d2acc2b26011439a12e29571a6f1e1defb1751c3be4258c493984fd9f0f6b4a26c539870b5f15bfed3d8ffac92499eb62dbd2beb7c1524275a8019022f6ce6a7e86c9e65e3099452a2b96fc2432b127a112970e1adf615f823b2b2180754c2f0ee01f1b389e56df55ca09702cd0401b66ff71779d2dd67222503a85ab921b28c329cc1832800b192d0b0247c0776e1b9653dc00df48daa6364287c84c0382f5165e7269fef06d10bc67c1bba252305d1af0dc7bb0fe92558eb4c5f38c23163dee1cfb34a72020669dbdfe337c16f3307472616e736c61746f722066726f6d20416c74424e2d3132382047e2828120746f20416c74424e2d3132382047e282825880ade2046080c8afa0256880c8afa0257080ade204788094ebdc0382019e010a205034214e0bd4373f38e162cf9fc9133e2f3b71441faa4c3d1ac01c1877f1cd2712200e03e975b996f911abba2b79d2596c2150bc94510963c40a1137a03df6edacdb1a107dee1cdb894163813bb3da604c9c133c1a10bb33302eeafbd55d352e35dcc5d2b3311a10d2c658b6b93d74a02d467849b6fe75251a10fea5308cc1fea69e7246eafe7ca8a3a51a1048efe1ad873b6f025ac0243bdef715f8000000000000000000000000000000000000000000000000000000000000"), - }, nil) - lp.On("LatestLogByEventSigWithConfs", mock.Anything, tp.configSetTopic, dkgAddress, evmtypes.Confirmations(10)). - Return(&logpoller.Log{ - Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000a6fca200010576e704b4a519484d6239ef17f1f5b4a82e330b0daf827ed4dc2789971b0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000a8cbea12a06869d3ec432ab9682dab6c761d591000000000000000000000000f4f9db7bb1d16b7cdfb18ec68994c26964f5985300000000000000000000000022fb3f90c539457f00d8484438869135e604a65500000000000000000000000033cbcedccb11c9773ad78e214ba342e979255ab30000000000000000000000006ffaa96256fbc1012325cca88c79f725c33eed80000000000000000000000000000000000000000000000000000000000000000500000000000000000000000074103cf8b436465870b26aa9fa2f62ad62b22e3500000000000000000000000038a6cb196f805cc3041f6645a5a6cec27b64430d00000000000000000000000047d7095cfebf8285bdaa421bc8268d0db87d933c000000000000000000000000a8842be973800ff61d80d2d53fa62c3a685380eb0000000000000000000000003750e31321aee8c024751877070e8d5f704ce98700000000000000000000000000000000000000000000000000000000000000206f3b82406688b8ddb944c6f2e6d808f014c8fa8d568d639c25019568c715fbf000000000000000000000000000000000000000000000000000000000000004220880d88ee16f1080c8afa0251880c8afa025208090dfc04a288090dfc04a30033a05010101010142206c5ca6f74b532222ac927dd3de235d46a943e372c0563393a33b01dcfd3f371c4220855114d25c2ef5e85fffe4f20a365672d8f2dba3b2ec82333f494168a2039c0442200266e835634db00977cbc1caa4db10e1676c1a4c0fcbc6ba7f09300f0d1831824220980cd91f7a73f20f4b0d51d00cd4e00373dc2beafbb299ca3c609757ab98c8304220eb6d36e2af8922085ff510bbe1eb8932a0e3295ca9f047fef25d90e69c52948f4a34313244334b6f6f574463364b7232644542684b59326b336e685057694676544565325331703978544532544b74344d7572716f684a34313244334b6f6f574b436e4367724b637743324a3577576a626e355435335068646b6b6f57454e534a39546537544b7836366f4a4a34313244334b6f6f575239616f675948786b357a38636b624c4c56346e426f7a777a747871664a7050586671336d4a7232796452474a34313244334b6f6f5744695444635565675637776b313133473366476a69616259756f54436f3157726f6f53656741343263556f544a34313244334b6f6f574e64687072586b5472665370354d5071736270467a70364167394a53787358694341434442676454424c656652820300050e416c74424e2d3132382047e282810e86e8cf899ae9a1b43e023bbe8825b103659bb8d6d4e54f6a3cfae7b106069c216a812d7616e47f0bd38fa4863f48fbcda6a38af4c58d2233dfa7cf79620947042d09f923e0a2f7a2270391e8b058d8bdb8f79fe082b7b627f025651c7290382fdff97c3181d15d162c146ce87ff752499d2acc2b26011439a12e29571a6f1e1defb1751c3be4258c493984fd9f0f6b4a26c539870b5f15bfed3d8ffac92499eb62dbd2beb7c1524275a8019022f6ce6a7e86c9e65e3099452a2b96fc2432b127a112970e1adf615f823b2b2180754c2f0ee01f1b389e56df55ca09702cd0401b66ff71779d2dd67222503a85ab921b28c329cc1832800b192d0b0247c0776e1b9653dc00df48daa6364287c84c0382f5165e7269fef06d10bc67c1bba252305d1af0dc7bb0fe92558eb4c5f38c23163dee1cfb34a72020669dbdfe337c16f3307472616e736c61746f722066726f6d20416c74424e2d3132382047e2828120746f20416c74424e2d3132382047e282825880ade2046080c8afa0256880c8afa0257080ade204788094ebdc0382019e010a205034214e0bd4373f38e162cf9fc9133e2f3b71441faa4c3d1ac01c1877f1cd2712200e03e975b996f911abba2b79d2596c2150bc94510963c40a1137a03df6edacdb1a107dee1cdb894163813bb3da604c9c133c1a10bb33302eeafbd55d352e35dcc5d2b3311a10d2c658b6b93d74a02d467849b6fe75251a10fea5308cc1fea69e7246eafe7ca8a3a51a1048efe1ad873b6f025ac0243bdef715f8000000000000000000000000000000000000000000000000000000000000"), - }, nil) - - expectedDKGVRF := ocr2vrftypes.OCRCommittee{ - Signers: []common.Address{ - common.HexToAddress("0x0A8cbEA12a06869d3EC432aB9682DAb6C761D591"), - common.HexToAddress("0xF4f9db7BB1d16b7CDfb18Ec68994c26964F59853"), - common.HexToAddress("0x22fB3F90C539457f00d8484438869135E604a655"), - common.HexToAddress("0x33CbCedccb11c9773AD78e214Ba342E979255ab3"), - common.HexToAddress("0x6ffaA96256fbC1012325cca88C79F725c33eED80"), - }, - Transmitters: []common.Address{ - common.HexToAddress("0x74103Cf8b436465870b26aa9Fa2F62AD62b22E35"), - common.HexToAddress("0x38A6Cb196f805cC3041F6645a5A6CEC27B64430D"), - common.HexToAddress("0x47d7095CFEBF8285BdAa421Bc8268D0DB87D933C"), - common.HexToAddress("0xa8842BE973800fF61D80d2d53fa62C3a685380eB"), - common.HexToAddress("0x3750e31321aEE8c024751877070E8d5F704cE987"), - }, - } - - c := &coordinator{ - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - dkgAddress: dkgAddress, - finalityDepth: 10, - evmClient: evmClient, - } - actualDKG, actualVRF, err := c.DKGVRFCommittees(testutils.Context(t)) - assert.NoError(t, err) - assert.ElementsMatch(t, expectedDKGVRF.Signers, actualDKG.Signers) - assert.ElementsMatch(t, expectedDKGVRF.Transmitters, actualDKG.Transmitters) - assert.ElementsMatch(t, expectedDKGVRF.Signers, actualVRF.Signers) - assert.ElementsMatch(t, expectedDKGVRF.Transmitters, actualVRF.Transmitters) - }) - - t.Run("vrf log poll fails", func(t *testing.T) { - lp := lp_mocks.NewLogPoller(t) - tp := newTopics() - - beaconAddress := newAddress(t) - lp.On("LatestLogByEventSigWithConfs", mock.Anything, tp.configSetTopic, beaconAddress, evmtypes.Confirmations(10)). - Return(nil, errors.New("rpc error")) - - c := &coordinator{ - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - beaconAddress: beaconAddress, - finalityDepth: 10, - evmClient: evmClient, - } - - _, _, err := c.DKGVRFCommittees(testutils.Context(t)) - assert.Error(t, err) - }) - - t.Run("dkg log poll fails", func(t *testing.T) { - lp := lp_mocks.NewLogPoller(t) - tp := newTopics() - beaconAddress := newAddress(t) - coordinatorAddress := newAddress(t) - dkgAddress := newAddress(t) - lp.On("LatestLogByEventSigWithConfs", mock.Anything, tp.configSetTopic, beaconAddress, evmtypes.Confirmations(10)). - Return(&logpoller.Log{ - Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000a6fca200010576e704b4a519484d6239ef17f1f5b4a82e330b0daf827ed4dc2789971b0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000a8cbea12a06869d3ec432ab9682dab6c761d591000000000000000000000000f4f9db7bb1d16b7cdfb18ec68994c26964f5985300000000000000000000000022fb3f90c539457f00d8484438869135e604a65500000000000000000000000033cbcedccb11c9773ad78e214ba342e979255ab30000000000000000000000006ffaa96256fbc1012325cca88c79f725c33eed80000000000000000000000000000000000000000000000000000000000000000500000000000000000000000074103cf8b436465870b26aa9fa2f62ad62b22e3500000000000000000000000038a6cb196f805cc3041f6645a5a6cec27b64430d00000000000000000000000047d7095cfebf8285bdaa421bc8268d0db87d933c000000000000000000000000a8842be973800ff61d80d2d53fa62c3a685380eb0000000000000000000000003750e31321aee8c024751877070e8d5f704ce98700000000000000000000000000000000000000000000000000000000000000206f3b82406688b8ddb944c6f2e6d808f014c8fa8d568d639c25019568c715fbf000000000000000000000000000000000000000000000000000000000000004220880d88ee16f1080c8afa0251880c8afa025208090dfc04a288090dfc04a30033a05010101010142206c5ca6f74b532222ac927dd3de235d46a943e372c0563393a33b01dcfd3f371c4220855114d25c2ef5e85fffe4f20a365672d8f2dba3b2ec82333f494168a2039c0442200266e835634db00977cbc1caa4db10e1676c1a4c0fcbc6ba7f09300f0d1831824220980cd91f7a73f20f4b0d51d00cd4e00373dc2beafbb299ca3c609757ab98c8304220eb6d36e2af8922085ff510bbe1eb8932a0e3295ca9f047fef25d90e69c52948f4a34313244334b6f6f574463364b7232644542684b59326b336e685057694676544565325331703978544532544b74344d7572716f684a34313244334b6f6f574b436e4367724b637743324a3577576a626e355435335068646b6b6f57454e534a39546537544b7836366f4a4a34313244334b6f6f575239616f675948786b357a38636b624c4c56346e426f7a777a747871664a7050586671336d4a7232796452474a34313244334b6f6f5744695444635565675637776b313133473366476a69616259756f54436f3157726f6f53656741343263556f544a34313244334b6f6f574e64687072586b5472665370354d5071736270467a70364167394a53787358694341434442676454424c656652820300050e416c74424e2d3132382047e282810e86e8cf899ae9a1b43e023bbe8825b103659bb8d6d4e54f6a3cfae7b106069c216a812d7616e47f0bd38fa4863f48fbcda6a38af4c58d2233dfa7cf79620947042d09f923e0a2f7a2270391e8b058d8bdb8f79fe082b7b627f025651c7290382fdff97c3181d15d162c146ce87ff752499d2acc2b26011439a12e29571a6f1e1defb1751c3be4258c493984fd9f0f6b4a26c539870b5f15bfed3d8ffac92499eb62dbd2beb7c1524275a8019022f6ce6a7e86c9e65e3099452a2b96fc2432b127a112970e1adf615f823b2b2180754c2f0ee01f1b389e56df55ca09702cd0401b66ff71779d2dd67222503a85ab921b28c329cc1832800b192d0b0247c0776e1b9653dc00df48daa6364287c84c0382f5165e7269fef06d10bc67c1bba252305d1af0dc7bb0fe92558eb4c5f38c23163dee1cfb34a72020669dbdfe337c16f3307472616e736c61746f722066726f6d20416c74424e2d3132382047e2828120746f20416c74424e2d3132382047e282825880ade2046080c8afa0256880c8afa0257080ade204788094ebdc0382019e010a205034214e0bd4373f38e162cf9fc9133e2f3b71441faa4c3d1ac01c1877f1cd2712200e03e975b996f911abba2b79d2596c2150bc94510963c40a1137a03df6edacdb1a107dee1cdb894163813bb3da604c9c133c1a10bb33302eeafbd55d352e35dcc5d2b3311a10d2c658b6b93d74a02d467849b6fe75251a10fea5308cc1fea69e7246eafe7ca8a3a51a1048efe1ad873b6f025ac0243bdef715f8000000000000000000000000000000000000000000000000000000000000"), - }, nil) - lp.On("LatestLogByEventSigWithConfs", mock.Anything, tp.configSetTopic, dkgAddress, evmtypes.Confirmations(10)). - Return(nil, errors.New("rpc error")) - - c := &coordinator{ - lp: lp, - topics: tp, - lggr: logger.TestLogger(t), - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - dkgAddress: dkgAddress, - finalityDepth: 10, - evmClient: evmClient, - } - _, _, err := c.DKGVRFCommittees(testutils.Context(t)) - assert.Error(t, err) - }) -} - -func TestCoordinator_ProvingKeyHash(t *testing.T) { - t.Parallel() - - t.Run("valid output", func(t *testing.T) { - h := crypto.Keccak256Hash([]byte("hello world")) - var expected [32]byte - copy(expected[:], h.Bytes()) - onchainRouter := mocks.NewVRFBeaconCoordinator(t) - onchainRouter. - On("SProvingKeyHash", mock.Anything). - Return(expected, nil) - c := &coordinator{ - onchainRouter: onchainRouter, - } - provingKeyHash, err := c.ProvingKeyHash(testutils.Context(t)) - assert.NoError(t, err) - assert.ElementsMatch(t, expected[:], provingKeyHash[:]) - }) - - t.Run("invalid output", func(t *testing.T) { - onchainRouter := mocks.NewVRFBeaconCoordinator(t) - onchainRouter. - On("SProvingKeyHash", mock.Anything). - Return([32]byte{}, errors.New("rpc error")) - c := &coordinator{ - onchainRouter: onchainRouter, - } - _, err := c.ProvingKeyHash(testutils.Context(t)) - assert.Error(t, err) - }) -} - -func TestCoordinator_ReportBlocks(t *testing.T) { - lggr := logger.TestLogger(t) - proofG1X := big.NewInt(1) - proofG1Y := big.NewInt(2) - evmClient := evmclimocks.NewClient(t) - evmClient.On("ConfiguredChainID").Return(big.NewInt(1)) - t.Run("happy path, beacon requests", func(t *testing.T) { - beaconAddress := newAddress(t) - coordinatorAddress := newAddress(t) - - latestHeadNumber := uint64(200) - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - require.NoError(t, err) - - tp := newTopics() - - lookbackBlocks := uint64(5) - lp := getLogPoller(t, []uint64{195}, latestHeadNumber, true, true, lookbackBlocks) - lp.On( - "LogsWithSigs", - mock.Anything, - int64(latestHeadNumber-lookbackBlocks), - int64(latestHeadNumber), - []common.Hash{ - tp.randomnessRequestedTopic, - tp.randomnessFulfillmentRequestedTopic, - tp.randomWordsFulfilledTopic, - tp.outputsServedTopic, - }, - coordinatorAddress, - ).Return([]logpoller.Log{ - newRandomnessRequestedLog(t, 3, 195, 191, 0, coordinatorAddress), - newRandomnessRequestedLog(t, 3, 195, 192, 1, coordinatorAddress), - newRandomnessRequestedLog(t, 3, 195, 193, 2, coordinatorAddress), - }, nil).Once() - - c := &coordinator{ - onchainRouter: onchainRouter, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - evmClient: evmClient, - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - blockhashLookback: lookbackBlocks, - } - - blocks, callbacks, recentHeightStart, recentBlocks, err := c.ReportBlocks( - testutils.Context(t), - 0, // slotInterval: unused - map[uint32]struct{}{3: {}}, - time.Duration(0), - 100, // maxBlocks: unused - 100, // maxCallbacks: unused - ) - assert.NoError(t, err) - assert.Len(t, blocks, 1) - assert.Len(t, callbacks, 0) - assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) - assert.Len(t, recentBlocks, int(lookbackBlocks)) - }) - - t.Run("happy path, callback requests", func(t *testing.T) { - beaconAddress := newAddress(t) - coordinatorAddress := newAddress(t) - - latestHeadNumber := uint64(200) - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - require.NoError(t, err) - - tp := newTopics() - - lookbackBlocks := uint64(5) - lp := getLogPoller(t, []uint64{195}, latestHeadNumber, true, true, lookbackBlocks) - lp.On( - "LogsWithSigs", - mock.Anything, - int64(latestHeadNumber-lookbackBlocks), - int64(latestHeadNumber), - []common.Hash{ - tp.randomnessRequestedTopic, - tp.randomnessFulfillmentRequestedTopic, - tp.randomWordsFulfilledTopic, - tp.outputsServedTopic, - }, - coordinatorAddress, - ).Return([]logpoller.Log{ - newRandomnessFulfillmentRequestedLog(t, 3, 195, 191, 1, 1000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 192, 2, 1000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 193, 3, 1000, coordinatorAddress), - }, nil).Once() - - c := &coordinator{ - onchainRouter: onchainRouter, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - evmClient: evmClient, - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - blockhashLookback: lookbackBlocks, - } - - blocks, callbacks, recentHeightStart, recentBlocks, err := c.ReportBlocks( - testutils.Context(t), - 0, // slotInterval: unused - map[uint32]struct{}{3: {}}, - time.Duration(0), - 100, // maxBlocks: unused - 100, // maxCallbacks: unused - ) - assert.NoError(t, err) - assert.Len(t, blocks, 1) - for _, b := range blocks { - assert.False(t, b.ShouldStore) - } - assert.Len(t, callbacks, 3) - assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) - assert.Len(t, recentBlocks, int(lookbackBlocks)) - }) - - t.Run("happy path, beacon requests, beacon fulfillments", func(t *testing.T) { - beaconAddress := newAddress(t) - coordinatorAddress := newAddress(t) - - latestHeadNumber := uint64(200) - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - require.NoError(t, err) - - tp := newTopics() - - lookbackBlocks := uint64(5) - lp := getLogPoller(t, []uint64{195}, latestHeadNumber, true, true, lookbackBlocks) - lp.On( - "LogsWithSigs", - mock.Anything, - int64(latestHeadNumber-lookbackBlocks), - int64(latestHeadNumber), - []common.Hash{ - tp.randomnessRequestedTopic, - tp.randomnessFulfillmentRequestedTopic, - tp.randomWordsFulfilledTopic, - tp.outputsServedTopic, - }, - coordinatorAddress, - ).Return([]logpoller.Log{ - newRandomnessRequestedLog(t, 3, 195, 191, 0, coordinatorAddress), - newRandomnessRequestedLog(t, 3, 195, 192, 1, coordinatorAddress), - newRandomnessRequestedLog(t, 3, 195, 193, 2, coordinatorAddress), - newOutputsServedLog(t, []vrf_coordinator.VRFBeaconTypesOutputServed{ - { - Height: 195, - ConfirmationDelay: big.NewInt(3), - ProofG1X: proofG1X, - ProofG1Y: proofG1Y, - }, - }, coordinatorAddress), - }, nil).Once() - - c := &coordinator{ - onchainRouter: onchainRouter, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - evmClient: evmClient, - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - blockhashLookback: lookbackBlocks, - } - - blocks, callbacks, recentHeightStart, recentBlocks, err := c.ReportBlocks( - testutils.Context(t), - 0, // slotInterval: unused - map[uint32]struct{}{3: {}}, - time.Duration(0), - 100, // maxBlocks: unused - 100, // maxCallbacks: unused - ) - assert.NoError(t, err) - assert.Len(t, blocks, 0) - assert.Len(t, callbacks, 0) - assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) - assert.Len(t, recentBlocks, int(lookbackBlocks)) - }) - - t.Run("happy path, callback requests, callback fulfillments", func(t *testing.T) { - beaconAddress := newAddress(t) - coordinatorAddress := newAddress(t) - - latestHeadNumber := uint64(200) - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - require.NoError(t, err) - - tp := newTopics() - - lookbackBlocks := uint64(5) - lp := getLogPoller(t, []uint64{195}, latestHeadNumber, true, true, lookbackBlocks) - // Both RandomWordsFulfilled and NewTransmission events are emitted - // when a VRF fulfillment happens on chain. - lp.On( - "LogsWithSigs", - mock.Anything, - int64(latestHeadNumber-lookbackBlocks), - int64(latestHeadNumber), - []common.Hash{ - tp.randomnessRequestedTopic, - tp.randomnessFulfillmentRequestedTopic, - tp.randomWordsFulfilledTopic, - tp.outputsServedTopic, - }, - coordinatorAddress, - ).Return([]logpoller.Log{ - newRandomnessFulfillmentRequestedLog(t, 3, 195, 191, 1, 1000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 192, 2, 1000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 193, 3, 1000, coordinatorAddress), - // Regardless of success or failure, if the fulfillment has been tried once do not report again. - newRandomWordsFulfilledLog(t, []*big.Int{big.NewInt(1), big.NewInt(2), big.NewInt(3)}, []byte{1, 0, 0}, coordinatorAddress), - newOutputsServedLog(t, []vrf_coordinator.VRFBeaconTypesOutputServed{ - { - Height: 195, - ConfirmationDelay: big.NewInt(3), - ProofG1X: proofG1X, - ProofG1Y: proofG1Y, - }, - }, coordinatorAddress), - }, nil).Once() - - c := &coordinator{ - onchainRouter: onchainRouter, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - evmClient: evmClient, - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - blockhashLookback: lookbackBlocks, - } - - blocks, callbacks, recentHeightStart, recentBlocks, err := c.ReportBlocks( - testutils.Context(t), - 0, // slotInterval: unused - map[uint32]struct{}{3: {}}, - time.Duration(0), - 100, // maxBlocks: unused - 100, // maxCallbacks: unused - ) - assert.NoError(t, err) - assert.Len(t, blocks, 0) - assert.Len(t, callbacks, 0) - assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) - assert.Len(t, recentBlocks, int(lookbackBlocks)) - }) - - t.Run("happy path, only beacon fulfillment", func(t *testing.T) { - beaconAddress := newAddress(t) - coordinatorAddress := newAddress(t) - - latestHeadNumber := uint64(200) - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - require.NoError(t, err) - - tp := newTopics() - - lookbackBlocks := uint64(5) - lp := getLogPoller(t, []uint64{}, latestHeadNumber, true, true, lookbackBlocks) - lp.On( - "LogsWithSigs", - mock.Anything, - int64(latestHeadNumber-lookbackBlocks), - int64(latestHeadNumber), - []common.Hash{ - tp.randomnessRequestedTopic, - tp.randomnessFulfillmentRequestedTopic, - tp.randomWordsFulfilledTopic, - tp.outputsServedTopic, - }, - coordinatorAddress, - ).Return([]logpoller.Log{newOutputsServedLog(t, []vrf_coordinator.VRFBeaconTypesOutputServed{ - { - Height: 195, - ConfirmationDelay: big.NewInt(3), - ProofG1X: proofG1X, - ProofG1Y: proofG1Y, - }, - }, coordinatorAddress)}, nil).Once() - - c := &coordinator{ - onchainRouter: onchainRouter, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - evmClient: evmClient, - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - blockhashLookback: lookbackBlocks, - } - - blocks, callbacks, recentHeightStart, recentBlocks, err := c.ReportBlocks( - testutils.Context(t), - 0, // slotInterval: unused - map[uint32]struct{}{3: {}}, - time.Duration(0), - 100, // maxBlocks: unused - 100, // maxCallbacks: unused - ) - assert.NoError(t, err) - assert.Len(t, blocks, 0) - assert.Len(t, callbacks, 0) - assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) - assert.Len(t, recentBlocks, int(lookbackBlocks)) - }) - - t.Run("happy path, callback requests & callback fulfillments in-flight", func(t *testing.T) { - beaconAddress := newAddress(t) - coordinatorAddress := newAddress(t) - - latestHeadNumber := uint64(200) - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - require.NoError(t, err) - - tp := newTopics() - - lookbackBlocks := uint64(5) - // Do not include latestHeadNumber in "GetBlocksRange" call for initial "ReportWillBeTransmitted." - // Do not include recent blockhashes in range either. - lp := getLogPoller(t, []uint64{195}, latestHeadNumber, false, false /* includeLatestHeadInRange */, 0) - - c := &coordinator{ - onchainRouter: onchainRouter, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - evmClient: evmClient, - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - blockhashLookback: lookbackBlocks, - } - - report := ocr2vrftypes.AbstractReport{ - RecentBlockHeight: 195, - RecentBlockHash: common.HexToHash("0x001"), - Outputs: []ocr2vrftypes.AbstractVRFOutput{ - { - BlockHeight: 195, - ConfirmationDelay: 195, - Callbacks: []ocr2vrftypes.AbstractCostedCallbackRequest{ - { - RequestID: big.NewInt(1), - BeaconHeight: 195, - }, - { - RequestID: big.NewInt(2), - BeaconHeight: 195, - }, - { - RequestID: big.NewInt(3), - BeaconHeight: 195, - }, - }, - }, - }, - } - - err = c.ReportWillBeTransmitted(testutils.Context(t), report) - require.NoError(t, err) - - // Include latestHeadNumber in "GetBlocksRange" call for "ReportBlocks" call. - // Include recent blockhashes in range. - lp = getLogPoller(t, []uint64{195}, latestHeadNumber, true, true /* includeLatestHeadInRange */, lookbackBlocks) - c.lp = lp - lp.On( - "LogsWithSigs", - mock.Anything, - int64(latestHeadNumber-lookbackBlocks), - int64(latestHeadNumber), - []common.Hash{ - tp.randomnessRequestedTopic, - tp.randomnessFulfillmentRequestedTopic, - tp.randomWordsFulfilledTopic, - tp.outputsServedTopic, - }, - coordinatorAddress, - ).Return([]logpoller.Log{ - newRandomnessFulfillmentRequestedLog(t, 3, 195, 191, 1, 1000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 192, 2, 1000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 193, 3, 1000, coordinatorAddress), - newOutputsServedLog(t, []vrf_coordinator.VRFBeaconTypesOutputServed{ - { - Height: 195, - ConfirmationDelay: big.NewInt(3), - ProofG1X: proofG1X, - ProofG1Y: proofG1Y, - }, - }, coordinatorAddress), - }, nil).Once() - - blocks, callbacks, recentHeightStart, recentBlocks, err := c.ReportBlocks( - testutils.Context(t), - 0, // slotInterval: unused - map[uint32]struct{}{3: {}}, - time.Duration(0), - 100, // maxBlocks: unused - 100, // maxCallbacks: unused - ) - assert.NoError(t, err) - assert.Len(t, blocks, 0) - assert.Len(t, callbacks, 0) - assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) - assert.Len(t, recentBlocks, int(lookbackBlocks)) - }) - - t.Run("happy path, blocks requested hits batch gas limit", func(t *testing.T) { - coordinatorAddress := newAddress(t) - beaconAddress := newAddress(t) - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - require.NoError(t, err) - - latestHeadNumber := uint64(400) - lookbackBlocks := uint64(400) - blockhashLookback := uint64(256) - - tp := newTopics() - - logs := []logpoller.Log{} - requestedBlocks := []uint64{} - - // Populate 200 request blocks. - for i := 0; i < 400; i += 2 { - logs = append(logs, newRandomnessRequestedLog(t, 1, uint64(i), 0, int64(i), coordinatorAddress)) - requestedBlocks = append(requestedBlocks, uint64(i)) - } - lp := getLogPoller(t, requestedBlocks, latestHeadNumber, true, true, blockhashLookback) - lp.On( - "LogsWithSigs", - mock.Anything, - int64(latestHeadNumber-lookbackBlocks), - int64(latestHeadNumber), - []common.Hash{ - tp.randomnessRequestedTopic, - tp.randomnessFulfillmentRequestedTopic, - tp.randomWordsFulfilledTopic, - tp.outputsServedTopic, - }, - coordinatorAddress, - ).Return(logs, nil) - - c := &coordinator{ - onchainRouter: onchainRouter, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - evmClient: evmClient, - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - blockhashLookback: blockhashLookback, - } - - blocks, callbacks, recentHeightStart, recentBlocks, err := c.ReportBlocks( - testutils.Context(t), - 0, // slotInterval: unused - map[uint32]struct{}{1: {}}, - time.Duration(0), - 100, // maxBlocks: unused - 100, // maxCallbacks: unused - ) - - // Coordinator should allow 99 blocks, i.e 100 blocks - 1 block's worth of gas - // for the coordinator overhead. - assert.NoError(t, err) - assert.Len(t, blocks, 99) - for _, b := range blocks { - assert.True(t, b.ShouldStore) - } - assert.Len(t, callbacks, 0) - assert.Equal(t, latestHeadNumber-blockhashLookback+1, recentHeightStart) - assert.Len(t, recentBlocks, int(blockhashLookback)) - }) - - t.Run("happy path, last callback hits batch gas limit", func(t *testing.T) { - coordinatorAddress := newAddress(t) - beaconAddress := newAddress(t) - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - require.NoError(t, err) - - latestHeadNumber := uint64(200) - lookbackBlocks := uint64(5) - - tp := newTopics() - - requestedBlocks := []uint64{195} - lp := getLogPoller(t, requestedBlocks, latestHeadNumber, true, true, lookbackBlocks) - lp.On( - "LogsWithSigs", - mock.Anything, - int64(latestHeadNumber-lookbackBlocks), - int64(latestHeadNumber), - []common.Hash{ - tp.randomnessRequestedTopic, - tp.randomnessFulfillmentRequestedTopic, - tp.randomWordsFulfilledTopic, - tp.outputsServedTopic, - }, - coordinatorAddress, - ).Return([]logpoller.Log{ - newRandomnessRequestedLog(t, 3, 195, 191, 0, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 191, 1, 2_000_000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 192, 2, 2_900_000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 193, 3, 1, coordinatorAddress), - }, nil) - - c := &coordinator{ - onchainRouter: onchainRouter, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - evmClient: evmClient, - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - blockhashLookback: lookbackBlocks, - } - - blocks, callbacks, recentHeightStart, recentBlocks, err := c.ReportBlocks( - testutils.Context(t), - 0, // slotInterval: unused - map[uint32]struct{}{3: {}}, - time.Duration(0), - 100, // maxBlocks: unused - 100, // maxCallbacks: unused - ) - - // Should allow the first two callbacks, which add up to 4_950_000 + 50_000 (1 block) = 5_000_000, - // then reject the last callback for being out of gas. - assert.NoError(t, err) - assert.Len(t, blocks, 1) - for _, b := range blocks { - assert.True(t, b.ShouldStore) - } - assert.Len(t, callbacks, 2) - assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) - assert.Len(t, recentBlocks, int(lookbackBlocks)) - }) - - t.Run("happy path, sandwiched callbacks hit batch gas limit", func(t *testing.T) { - coordinatorAddress := newAddress(t) - beaconAddress := newAddress(t) - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - require.NoError(t, err) - - latestHeadNumber := uint64(200) - lookbackBlocks := uint64(5) - - tp := newTopics() - - requestedBlocks := []uint64{195} - lp := getLogPoller(t, requestedBlocks, latestHeadNumber, true, true, lookbackBlocks) - lp.On( - "LogsWithSigs", - mock.Anything, - int64(latestHeadNumber-lookbackBlocks), - int64(latestHeadNumber), - []common.Hash{ - tp.randomnessRequestedTopic, - tp.randomnessFulfillmentRequestedTopic, - tp.randomWordsFulfilledTopic, - tp.outputsServedTopic, - }, - coordinatorAddress, - ).Return([]logpoller.Log{ - newRandomnessRequestedLog(t, 3, 195, 191, 0, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 191, 1, 10_000_000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 192, 2, 1000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 193, 3, 10_000_000, coordinatorAddress), - }, nil) - - c := &coordinator{ - onchainRouter: onchainRouter, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - evmClient: evmClient, - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - blockhashLookback: lookbackBlocks, - } - - blocks, callbacks, recentHeightStart, recentBlocks, err := c.ReportBlocks( - testutils.Context(t), - 0, // slotInterval: unused - map[uint32]struct{}{3: {}}, - time.Duration(0), - 100, // maxBlocks: unused - 100, // maxCallbacks: unused - ) - - // Should allow the middle callback, with an acceptable gas allowance, to be processed. - assert.NoError(t, err) - assert.Len(t, blocks, 1) - assert.Len(t, callbacks, 1) - assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) - assert.Len(t, recentBlocks, int(lookbackBlocks)) - }) - - t.Run("happy path, sandwiched callbacks with valid callback in next block hit batch gas limit", func(t *testing.T) { - coordinatorAddress := newAddress(t) - beaconAddress := newAddress(t) - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - require.NoError(t, err) - - latestHeadNumber := uint64(200) - lookbackBlocks := uint64(5) - - tp := newTopics() - - requestedBlocks := []uint64{195, 196} - lp := getLogPoller(t, requestedBlocks, latestHeadNumber, true, true, lookbackBlocks) - lp.On( - "LogsWithSigs", - mock.Anything, - int64(latestHeadNumber-lookbackBlocks), - int64(latestHeadNumber), - []common.Hash{ - tp.randomnessRequestedTopic, - tp.randomnessFulfillmentRequestedTopic, - tp.randomWordsFulfilledTopic, - tp.outputsServedTopic, - }, - coordinatorAddress, - ).Return([]logpoller.Log{ - newRandomnessRequestedLog(t, 3, 195, 191, 0, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 191, 1, 10_000_000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 192, 2, 1000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 193, 3, 10_000_000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 196, 194, 4, 1000, coordinatorAddress), - }, nil) - - c := &coordinator{ - onchainRouter: onchainRouter, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - evmClient: evmClient, - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - blockhashLookback: lookbackBlocks, - } - - blocks, callbacks, recentHeightStart, recentBlocks, err := c.ReportBlocks( - testutils.Context(t), - 0, // slotInterval: unused - map[uint32]struct{}{3: {}}, - time.Duration(0), - 100, // maxBlocks: unused - 100, // maxCallbacks: unused - ) - - // Should allow the middle callback, with an acceptable gas allowance, to be processed, - // then move to the next block and find a suitable callback. Also adds the block 196 for - // that callback. - assert.NoError(t, err) - assert.Len(t, blocks, 2) - assert.Len(t, callbacks, 2) - assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) - assert.Len(t, recentBlocks, int(lookbackBlocks)) - }) - - t.Run("correct blockhashes are retrieved with the maximum lookback", func(t *testing.T) { - coordinatorAddress := newAddress(t) - beaconAddress := newAddress(t) - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - require.NoError(t, err) - - latestHeadNumber := uint64(1000) - lookbackBlocks := uint64(256) - - tp := newTopics() - - requestedBlocks := []uint64{} - lp := getLogPoller(t, requestedBlocks, latestHeadNumber, true, true, lookbackBlocks) - lp.On( - "LogsWithSigs", - mock.Anything, - int64(latestHeadNumber-lookbackBlocks), - int64(latestHeadNumber), - []common.Hash{ - tp.randomnessRequestedTopic, - tp.randomnessFulfillmentRequestedTopic, - tp.randomWordsFulfilledTopic, - tp.outputsServedTopic, - }, - coordinatorAddress, - ).Return([]logpoller.Log{}, nil) - - c := &coordinator{ - onchainRouter: onchainRouter, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - evmClient: evmClient, - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - blockhashLookback: lookbackBlocks, - } - - _, _, recentHeightStart, recentBlocks, err := c.ReportBlocks( - testutils.Context(t), - 0, // slotInterval: unused - map[uint32]struct{}{3: {}}, - time.Duration(0), - 100, // maxBlocks: unused - 100, // maxCallbacks: unused - ) - - assert.NoError(t, err) - assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) - assert.Equal(t, common.HexToHash(fmt.Sprintf("0x00%d", 1)), recentBlocks[0]) - assert.Equal(t, common.HexToHash(fmt.Sprintf("0x00%d", lookbackBlocks)), recentBlocks[len(recentBlocks)-1]) - assert.Len(t, recentBlocks, int(lookbackBlocks)) - }) - - t.Run("correct blockhashes are retrieved with a capped lookback (close to genesis block)", func(t *testing.T) { - coordinatorAddress := newAddress(t) - beaconAddress := newAddress(t) - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - require.NoError(t, err) - - latestHeadNumber := uint64(100) - lookbackBlocks := uint64(100) - - tp := newTopics() - - requestedBlocks := []uint64{} - lp := getLogPoller(t, requestedBlocks, latestHeadNumber, true, true, lookbackBlocks) - lp.On( - "LogsWithSigs", - mock.Anything, - int64(latestHeadNumber-lookbackBlocks), - int64(latestHeadNumber), - []common.Hash{ - tp.randomnessRequestedTopic, - tp.randomnessFulfillmentRequestedTopic, - tp.randomWordsFulfilledTopic, - tp.outputsServedTopic, - }, - coordinatorAddress, - ).Return([]logpoller.Log{}, nil) - - c := &coordinator{ - onchainRouter: onchainRouter, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - evmClient: evmClient, - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - blockhashLookback: lookbackBlocks, - } - - _, _, recentHeightStart, recentBlocks, err := c.ReportBlocks( - testutils.Context(t), - 0, // slotInterval: unused - map[uint32]struct{}{3: {}}, - time.Duration(0), - 100, // maxBlocks: unused - 100, // maxCallbacks: unused - ) - - assert.NoError(t, err) - assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) - assert.Equal(t, common.HexToHash(fmt.Sprintf("0x00%d", 1)), recentBlocks[0]) - assert.Equal(t, common.HexToHash(fmt.Sprintf("0x00%d", lookbackBlocks)), recentBlocks[len(recentBlocks)-1]) - assert.Len(t, recentBlocks, int(lookbackBlocks)) - }) - - t.Run("logpoller GetBlocks returns error", func(tt *testing.T) { - coordinatorAddress := newAddress(t) - beaconAddress := newAddress(t) - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - require.NoError(t, err) - - latestHeadNumber := uint64(200) - lookbackBlocks := uint64(5) - - tp := newTopics() - - requestedBlocks := []uint64{195, 196} - lp := lp_mocks.NewLogPoller(t) - lp.On("LatestBlock", mock.Anything). - Return(logpoller.LogPollerBlock{BlockNumber: int64(latestHeadNumber)}, nil) - - lp.On("GetBlocksRange", mock.Anything, append(requestedBlocks, latestHeadNumber-lookbackBlocks+1, latestHeadNumber)). - Return(nil, errors.New("GetBlocks error")) - lp.On( - "LogsWithSigs", - mock.Anything, - int64(latestHeadNumber-lookbackBlocks), - int64(latestHeadNumber), - []common.Hash{ - tp.randomnessRequestedTopic, - tp.randomnessFulfillmentRequestedTopic, - tp.randomWordsFulfilledTopic, - tp.outputsServedTopic, - }, - coordinatorAddress, - ).Return([]logpoller.Log{ - newRandomnessRequestedLog(t, 3, 195, 191, 0, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 191, 1, 10_000_000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 192, 2, 1000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 195, 193, 3, 10_000_000, coordinatorAddress), - newRandomnessFulfillmentRequestedLog(t, 3, 196, 194, 4, 1000, coordinatorAddress), - }, nil) - - c := &coordinator{ - onchainRouter: onchainRouter, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - lp: lp, - lggr: logger.TestLogger(t), - topics: tp, - evmClient: evmClient, - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - blockhashLookback: lookbackBlocks, - } - - blocks, callbacks, _, _, err := c.ReportBlocks( - testutils.Context(t), - 0, // slotInterval: unused - map[uint32]struct{}{3: {}}, - time.Duration(0), - 100, // maxBlocks: unused - 100, // maxCallbacks: unused - ) - - assert.Error(tt, err) - assert.EqualError(tt, errors.Cause(err), "GetBlocks error") - assert.Nil(tt, blocks) - assert.Nil(tt, callbacks) - }) -} - -func TestCoordinator_ReportWillBeTransmitted(t *testing.T) { - evmClient := evmclimocks.NewClient(t) - evmClient.On("ConfiguredChainID").Return(big.NewInt(1)) - t.Run("happy path", func(t *testing.T) { - lookbackBlocks := uint64(0) - lp := getLogPoller(t, []uint64{199}, 200, false, false, 0) - c := &coordinator{ - lp: lp, - lggr: logger.TestLogger(t), - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - evmClient: evmClient, - } - assert.NoError(t, c.ReportWillBeTransmitted(testutils.Context(t), ocr2vrftypes.AbstractReport{ - RecentBlockHeight: 199, - RecentBlockHash: common.HexToHash("0x001"), - })) - }) - - t.Run("re-org", func(t *testing.T) { - lookbackBlocks := uint64(0) - lp := getLogPoller(t, []uint64{199}, 200, false, false, 0) - c := &coordinator{ - lp: lp, - lggr: logger.TestLogger(t), - toBeTransmittedBlocks: NewBlockCache[blockInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - toBeTransmittedCallbacks: NewBlockCache[callbackInReport](time.Duration(int64(lookbackBlocks) * int64(time.Second))), - coordinatorConfig: newCoordinatorConfig(lookbackBlocks), - evmClient: evmClient, - } - assert.Error(t, c.ReportWillBeTransmitted(testutils.Context(t), ocr2vrftypes.AbstractReport{ - RecentBlockHeight: 199, - RecentBlockHash: common.HexToHash("0x009"), - })) - }) -} - -func TestCoordinator_MarshalUnmarshal(t *testing.T) { - t.Parallel() - proofG1X := big.NewInt(1) - proofG1Y := big.NewInt(2) - lggr := logger.TestLogger(t) - evmClient := evmclimocks.NewClient(t) - - coordinatorAddress := newAddress(t) - beaconAddress := newAddress(t) - vrfBeaconCoordinator, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - require.NoError(t, err) - - lg := newRandomnessRequestedLog(t, 3, 1500, 1450, 1, coordinatorAddress) - rrIface, err := vrfBeaconCoordinator.ParseLog(toGethLog(lg)) - require.NoError(t, err) - rr, ok := rrIface.(*vrf_coordinator.VRFCoordinatorRandomnessRequested) - require.True(t, ok) - assert.Equal(t, uint64(1500), rr.NextBeaconOutputHeight) - assert.Equal(t, int64(3), rr.ConfDelay.Int64()) - - lg = newRandomnessFulfillmentRequestedLog(t, 3, 1500, 1450, 1, 1000, coordinatorAddress) - rfrIface, err := vrfBeaconCoordinator.ParseLog(toGethLog(lg)) - require.NoError(t, err) - rfr, ok := rfrIface.(*vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequested) - require.True(t, ok) - assert.Equal(t, uint64(1500), rfr.NextBeaconOutputHeight) - assert.Equal(t, int64(3), rfr.ConfDelay.Int64()) - assert.Equal(t, int64(1), rfr.RequestID.Int64()) - - configDigest := common.BigToHash(big.NewInt(10)) - lg = newNewTransmissionLog(t, beaconAddress, configDigest) - ntIface, err := vrfBeaconCoordinator.ParseLog(toGethLog(lg)) - require.NoError(t, err) - nt, ok := ntIface.(*vrf_beacon.VRFBeaconNewTransmission) - require.True(t, ok) - assert.True(t, bytes.Equal(nt.ConfigDigest[:], configDigest[:])) - assert.Equal(t, 0, nt.JuelsPerFeeCoin.Cmp(big.NewInt(1_000))) - assert.Equal(t, 0, nt.EpochAndRound.Cmp(big.NewInt(1))) - - lg = newRandomWordsFulfilledLog(t, []*big.Int{big.NewInt(1), big.NewInt(2), big.NewInt(3)}, []byte{1, 1, 1}, coordinatorAddress) - rwfIface, err := vrfBeaconCoordinator.ParseLog(toGethLog(lg)) - require.NoError(t, err) - rwf, ok := rwfIface.(*vrf_coordinator.VRFCoordinatorRandomWordsFulfilled) - require.True(t, ok) - assert.Equal(t, []int64{1, 2, 3}, []int64{rwf.RequestIDs[0].Int64(), rwf.RequestIDs[1].Int64(), rwf.RequestIDs[2].Int64()}) - assert.Equal(t, []byte{1, 1, 1}, rwf.SuccessfulFulfillment) - - lg = newOutputsServedLog(t, []vrf_coordinator.VRFBeaconTypesOutputServed{ - { - Height: 1500, - ConfirmationDelay: big.NewInt(3), - ProofG1X: proofG1X, - ProofG1Y: proofG1Y, - }, - { - Height: 1505, - ConfirmationDelay: big.NewInt(4), - ProofG1X: proofG1X, - ProofG1Y: proofG1Y, - }, - }, coordinatorAddress) - - osIface, err := vrfBeaconCoordinator.ParseLog(toGethLog(lg)) - require.NoError(t, err) - os, ok := osIface.(*vrf_coordinator.VRFCoordinatorOutputsServed) - require.True(t, ok) - assert.Equal(t, uint64(1500), os.OutputsServed[0].Height) - assert.Equal(t, uint64(1505), os.OutputsServed[1].Height) - assert.Equal(t, int64(3), os.OutputsServed[0].ConfirmationDelay.Int64()) - assert.Equal(t, int64(4), os.OutputsServed[1].ConfirmationDelay.Int64()) -} - -func TestCoordinator_ReportIsOnchain(t *testing.T) { - evmClient := evmclimocks.NewClient(t) - evmClient.On("ConfiguredChainID").Return(big.NewInt(1)) - - t.Run("report is on-chain", func(t *testing.T) { - tp := newTopics() - beaconAddress := newAddress(t) - coordinatorAddress := newAddress(t) - lggr := logger.TestLogger(t) - - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - assert.NoError(t, err) - - epoch := uint32(20) - round := uint8(3) - epochAndRound := toEpochAndRoundUint40(epoch, round) - enrTopic := common.BytesToHash(common.LeftPadBytes(epochAndRound.Bytes(), 32)) - lp := lp_mocks.NewLogPoller(t) - configDigest := common.BigToHash(big.NewInt(1337)) - log := newNewTransmissionLog(t, beaconAddress, configDigest) - log.BlockNumber = 195 - lp.On("IndexedLogs", mock.Anything, tp.newTransmissionTopic, beaconAddress, 2, []common.Hash{ - enrTopic, - }, evmtypes.Confirmations(1)).Return([]logpoller.Log{log}, nil) - - c := &coordinator{ - lp: lp, - onchainRouter: onchainRouter, - lggr: logger.TestLogger(t), - beaconAddress: beaconAddress, - topics: tp, - evmClient: evmClient, - } - - present, err := c.ReportIsOnchain(testutils.Context(t), epoch, round, configDigest) - assert.NoError(t, err) - assert.True(t, present) - }) - - t.Run("report is on-chain for old config digest", func(t *testing.T) { - tp := newTopics() - beaconAddress := newAddress(t) - coordinatorAddress := newAddress(t) - lggr := logger.TestLogger(t) - - onchainRouter, err := newRouter(lggr, beaconAddress, coordinatorAddress, evmClient) - assert.NoError(t, err) - - epoch := uint32(20) - round := uint8(3) - epochAndRound := toEpochAndRoundUint40(epoch, round) - enrTopic := common.BytesToHash(common.LeftPadBytes(epochAndRound.Bytes(), 32)) - lp := lp_mocks.NewLogPoller(t) - oldConfigDigest := common.BigToHash(big.NewInt(1337)) - newConfigDigest := common.BigToHash(big.NewInt(8888)) - log := newNewTransmissionLog(t, beaconAddress, oldConfigDigest) - log.BlockNumber = 195 - lp.On("IndexedLogs", mock.Anything, tp.newTransmissionTopic, beaconAddress, 2, []common.Hash{ - enrTopic, - }, evmtypes.Confirmations(1)).Return([]logpoller.Log{log}, nil) - - c := &coordinator{ - lp: lp, - onchainRouter: onchainRouter, - lggr: logger.TestLogger(t), - beaconAddress: beaconAddress, - topics: tp, - evmClient: evmClient, - } - - present, err := c.ReportIsOnchain(testutils.Context(t), epoch, round, newConfigDigest) - assert.NoError(t, err) - assert.False(t, present) - }) - - t.Run("report is not on-chain", func(t *testing.T) { - tp := newTopics() - beaconAddress := newAddress(t) - - epoch := uint32(20) - round := uint8(3) - epochAndRound := toEpochAndRoundUint40(epoch, round) - enrTopic := common.BytesToHash(common.LeftPadBytes(epochAndRound.Bytes(), 32)) - lp := lp_mocks.NewLogPoller(t) - lp.On("IndexedLogs", mock.Anything, tp.newTransmissionTopic, beaconAddress, 2, []common.Hash{ - enrTopic, - }, evmtypes.Confirmations(1)).Return([]logpoller.Log{}, nil) - - c := &coordinator{ - lp: lp, - lggr: logger.TestLogger(t), - beaconAddress: beaconAddress, - topics: tp, - evmClient: evmClient, - } - - configDigest := common.BigToHash(big.NewInt(0)) - present, err := c.ReportIsOnchain(testutils.Context(t), epoch, round, configDigest) - assert.NoError(t, err) - assert.False(t, present) - }) -} - -func TestCoordinator_ConfirmationDelays(t *testing.T) { - t.Parallel() - - t.Run("valid output", func(t *testing.T) { - expected := [8]uint32{1, 2, 3, 4, 5, 6, 7, 8} - ret := [8]*big.Int{} - for i, delay := range expected { - ret[i] = big.NewInt(int64(delay)) - } - onchainRouter := mocks.NewVRFBeaconCoordinator(t) - onchainRouter. - On("GetConfirmationDelays", mock.Anything). - Return(ret, nil) - c := &coordinator{ - onchainRouter: onchainRouter, - } - confDelays, err := c.ConfirmationDelays(testutils.Context(t)) - assert.NoError(t, err) - assert.Equal(t, expected[:], confDelays[:]) - }) - - t.Run("invalid output", func(t *testing.T) { - onchainRouter := mocks.NewVRFBeaconCoordinator(t) - onchainRouter. - On("GetConfirmationDelays", mock.Anything). - Return([8]*big.Int{}, errors.New("rpc error")) - c := &coordinator{ - onchainRouter: onchainRouter, - } - _, err := c.ConfirmationDelays(testutils.Context(t)) - assert.Error(t, err) - }) -} - -func TestCoordinator_getBlockCacheKey(t *testing.T) { - t.Parallel() - - t.Run("calculates key correctly", func(t *testing.T) { - hash := getBlockCacheKey(1, 11) - assert.Equal( - t, - common.HexToHash("0x000000000000000000000000000000000000000000000001000000000000000b"), - hash, - ) - }) -} - -func TestCoordinator_KeyID(t *testing.T) { - t.Parallel() - - t.Run("valid output", func(t *testing.T) { - var keyIDBytes [32]byte - keyIDBytes[0] = 1 - expected := dkg.KeyID(keyIDBytes) - onchainRouter := mocks.NewVRFBeaconCoordinator(t) - onchainRouter. - On("SKeyID", mock.Anything). - Return(keyIDBytes, nil) - c := &coordinator{ - onchainRouter: onchainRouter, - } - keyID, err := c.KeyID(testutils.Context(t)) - assert.NoError(t, err) - assert.Equal(t, expected[:], keyID[:]) - }) - - t.Run("invalid output", func(t *testing.T) { - var emptyBytes [32]byte - onchainRouter := mocks.NewVRFBeaconCoordinator(t) - onchainRouter. - On("SKeyID", mock.Anything). - Return(emptyBytes, errors.New("rpc error")) - c := &coordinator{ - onchainRouter: onchainRouter, - } - _, err := c.KeyID(testutils.Context(t)) - assert.Error(t, err) - }) -} - -func TestTopics_DKGConfigSet_VRFConfigSet(t *testing.T) { - dkgConfigSetTopic := dkg_wrapper.DKGConfigSet{}.Topic() - vrfConfigSetTopic := vrf_beacon.VRFBeaconConfigSet{}.Topic() - assert.Equal(t, dkgConfigSetTopic, vrfConfigSetTopic, "config set topics of vrf and dkg must be equal") -} - -func Test_UpdateConfiguration(t *testing.T) { - t.Parallel() - - t.Run("valid binary", func(t *testing.T) { - c := &coordinator{coordinatorConfig: newCoordinatorConfig(10), lggr: logger.TestLogger(t)} - cacheEvictionWindowSeconds := int64(60) - cacheEvictionWindow := time.Duration(cacheEvictionWindowSeconds * int64(time.Second)) - c.toBeTransmittedBlocks = NewBlockCache[blockInReport](cacheEvictionWindow) - c.toBeTransmittedCallbacks = NewBlockCache[callbackInReport](cacheEvictionWindow) - - newCoordinatorConfig := &ocr2vrftypes.CoordinatorConfig{ - CacheEvictionWindowSeconds: 30, - BatchGasLimit: 1_000_000, - CoordinatorOverhead: 10_000, - CallbackOverhead: 10_000, - BlockGasOverhead: 10_000, - LookbackBlocks: 1_000, - } - - require.Equal(t, cacheEvictionWindow, c.toBeTransmittedBlocks.evictionWindow) - require.Equal(t, cacheEvictionWindow, c.toBeTransmittedCallbacks.evictionWindow) - - expectedConfigDigest := ocr2Types.ConfigDigest(common.HexToHash("asd")) - expectedOracleID := commontypes.OracleID(3) - err := c.UpdateConfiguration(ocr2vrf.OffchainConfig(newCoordinatorConfig), expectedConfigDigest, expectedOracleID) - newCacheEvictionWindow := time.Duration(newCoordinatorConfig.CacheEvictionWindowSeconds * int64(time.Second)) - require.NoError(t, err) - require.Equal(t, newCoordinatorConfig.CacheEvictionWindowSeconds, c.coordinatorConfig.CacheEvictionWindowSeconds) - require.Equal(t, newCoordinatorConfig.BatchGasLimit, c.coordinatorConfig.BatchGasLimit) - require.Equal(t, newCoordinatorConfig.CoordinatorOverhead, c.coordinatorConfig.CoordinatorOverhead) - require.Equal(t, newCoordinatorConfig.CallbackOverhead, c.coordinatorConfig.CallbackOverhead) - require.Equal(t, newCoordinatorConfig.BlockGasOverhead, c.coordinatorConfig.BlockGasOverhead) - require.Equal(t, newCoordinatorConfig.LookbackBlocks, c.coordinatorConfig.LookbackBlocks) - require.Equal(t, newCacheEvictionWindow, c.toBeTransmittedBlocks.evictionWindow) - require.Equal(t, newCacheEvictionWindow, c.toBeTransmittedCallbacks.evictionWindow) - require.Equal(t, expectedConfigDigest, c.configDigest) - require.Equal(t, expectedOracleID, c.oracleID) - }) - - t.Run("invalid binary", func(t *testing.T) { - c := &coordinator{coordinatorConfig: newCoordinatorConfig(10), lggr: logger.TestLogger(t)} - - err := c.UpdateConfiguration([]byte{123}, ocr2Types.ConfigDigest{}, commontypes.OracleID(0)) - require.Error(t, err) - }) -} - -func newCoordinatorConfig(lookbackBlocks uint64) *ocr2vrftypes.CoordinatorConfig { - return &ocr2vrftypes.CoordinatorConfig{ - CacheEvictionWindowSeconds: 60, - BatchGasLimit: 5_000_000, - CoordinatorOverhead: 50_000, - CallbackOverhead: 50_000, - BlockGasOverhead: 50_000, - LookbackBlocks: lookbackBlocks, - } -} - -func newRandomnessRequestedLog( - t *testing.T, - confDelay int64, - nextBeaconOutputHeight uint64, - requestBlock uint64, - requestID int64, - coordinatorAddress common.Address, -) logpoller.Log { - //event RandomnessRequested( - // RequestID indexed requestID, - // address indexed requester, - // uint64 nextBeaconOutputHeight, - // ConfirmationDelay confDelay, - // uint64 subID, - // uint16 numWords - //); - e := vrf_coordinator.VRFCoordinatorRandomnessRequested{ - RequestID: big.NewInt(requestID), - Requester: common.HexToAddress("0x1234567890"), - ConfDelay: big.NewInt(confDelay), - NextBeaconOutputHeight: nextBeaconOutputHeight, - NumWords: 1, - SubID: big.NewInt(1), - CostJuels: big.NewInt(50_000), - NewSubBalance: big.NewInt(100_000), - Raw: gethtypes.Log{ - BlockNumber: requestBlock, - }, - } - var unindexed abi.Arguments - for _, a := range vrfCoordinatorABI.Events[randomnessRequestedEvent].Inputs { - if !a.Indexed { - unindexed = append(unindexed, a) - } - } - nonIndexedData, err := unindexed.Pack(e.Requester, e.NextBeaconOutputHeight, e.ConfDelay, e.SubID, e.NumWords, e.CostJuels, e.NewSubBalance) - require.NoError(t, err) - - requestIDType, err := abi.NewType("uint64", "", nil) - require.NoError(t, err) - - requestIDArg := abi.Arguments{abi.Argument{ - Name: "requestID", - Type: requestIDType, - Indexed: true, - }} - - topic1, err := requestIDArg.Pack(e.RequestID.Uint64()) - require.NoError(t, err) - - topic0 := vrfCoordinatorABI.Events[randomnessRequestedEvent].ID - lg := logpoller.Log{ - Address: coordinatorAddress, - Data: nonIndexedData, - Topics: [][]byte{ - // first topic is the event signature - topic0.Bytes(), - // second topic is requestID since it's indexed - topic1, - }, - BlockNumber: int64(requestBlock), - EventSig: topic0, - } - return lg -} - -func newRandomnessFulfillmentRequestedLog( - t *testing.T, - confDelay int64, - nextBeaconOutputHeight uint64, - requestBlock uint64, - requestID int64, - gasAllowance uint32, - coordinatorAddress common.Address, -) logpoller.Log { - //event RandomnessFulfillmentRequested( - // RequestID indexed requestID, - // address indexed requester, - // uint64 nextBeaconOutputHeight, - // ConfirmationDelay confDelay, - // uint256 subID, - // uint16 numWords, - // uint32 gasAllowance, - // uint256 gasPrice, - // uint256 weiPerUnitLink, - // bytes arguments, - // uint256 costJuels - //); - e := vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequested{ - ConfDelay: big.NewInt(confDelay), - NextBeaconOutputHeight: nextBeaconOutputHeight, - RequestID: big.NewInt(1), - NumWords: 1, - GasAllowance: gasAllowance, - GasPrice: big.NewInt(0), - WeiPerUnitLink: big.NewInt(0), - SubID: big.NewInt(1), - Requester: common.HexToAddress("0x1234567890"), - CostJuels: big.NewInt(50_000), - NewSubBalance: big.NewInt(100_000), - Raw: gethtypes.Log{ - BlockNumber: requestBlock, - }, - } - var unindexed abi.Arguments - for _, a := range vrfCoordinatorABI.Events[randomnessFulfillmentRequestedEvent].Inputs { - if !a.Indexed { - unindexed = append(unindexed, a) - } - } - nonIndexedData, err := unindexed.Pack(e.Requester, e.NextBeaconOutputHeight, e.ConfDelay, e.SubID, e.NumWords, - e.GasAllowance, e.GasPrice, e.WeiPerUnitLink, e.Arguments, e.CostJuels, e.NewSubBalance) - require.NoError(t, err) - - requestIDType, err := abi.NewType("uint64", "", nil) - require.NoError(t, err) - - requestIDArg := abi.Arguments{abi.Argument{ - Name: "requestID", - Type: requestIDType, - Indexed: true, - }} - - topic0 := vrfCoordinatorABI.Events[randomnessFulfillmentRequestedEvent].ID - topic1, err := requestIDArg.Pack(e.RequestID.Uint64()) - require.NoError(t, err) - return logpoller.Log{ - Address: coordinatorAddress, - Data: nonIndexedData, - EventSig: topic0, - Topics: [][]byte{ - topic0.Bytes(), - topic1, - }, - BlockNumber: int64(requestBlock), - } -} - -func newRandomWordsFulfilledLog( - t *testing.T, - requestIDs []*big.Int, - successfulFulfillment []byte, - coordinatorAddress common.Address, -) logpoller.Log { - //event RandomWordsFulfilled( - // RequestID[] requestIDs, - // bytes successfulFulfillment, - // bytes[] truncatedErrorData - //); - e := vrf_coordinator.VRFCoordinatorRandomWordsFulfilled{ - RequestIDs: requestIDs, - SuccessfulFulfillment: successfulFulfillment, - } - packed, err := vrfCoordinatorABI.Events[randomWordsFulfilledEvent].Inputs.Pack( - e.RequestIDs, e.SuccessfulFulfillment, e.TruncatedErrorData, e.SubBalances, e.SubIDs) - require.NoError(t, err) - topic0 := vrfCoordinatorABI.Events[randomWordsFulfilledEvent].ID - return logpoller.Log{ - Address: coordinatorAddress, - Data: packed, - EventSig: topic0, - Topics: [][]byte{topic0.Bytes()}, - } -} - -func newOutputsServedLog( - t *testing.T, - outputsServed []vrf_coordinator.VRFBeaconTypesOutputServed, - beaconAddress common.Address, -) logpoller.Log { - // event OutputsServed( - // uint64 recentBlockHeight, - // address transmitter, - // uint192 juelsPerFeeCoin, - // OutputServed[] outputsServed - // ); - e := vrf_coordinator.VRFCoordinatorOutputsServed{ - RecentBlockHeight: 0, - // AggregatorRoundId: 1, - OutputsServed: outputsServed, - JuelsPerFeeCoin: big.NewInt(0), - ReasonableGasPrice: 0, - // EpochAndRound: big.NewInt(1), - // ConfigDigest: crypto.Keccak256Hash([]byte("hello world")), - } - var unindexed abi.Arguments - for _, a := range vrfCoordinatorABI.Events[outputsServedEvent].Inputs { - if !a.Indexed { - unindexed = append(unindexed, a) - } - } - nonIndexedData, err := unindexed.Pack(e.RecentBlockHeight, e.JuelsPerFeeCoin, e.ReasonableGasPrice, e.OutputsServed) - require.NoError(t, err) - - topic0 := vrfCoordinatorABI.Events[outputsServedEvent].ID - return logpoller.Log{ - Address: beaconAddress, - Data: nonIndexedData, - Topics: [][]byte{ - topic0.Bytes(), - }, - EventSig: topic0, - } -} - -func newNewTransmissionLog( - t *testing.T, - beaconAddress common.Address, - configDigest [32]byte, -) logpoller.Log { - // event NewTransmission( - // uint32 indexed aggregatorRoundId, - // uint40 indexed epochAndRound, - // address transmitter, - // uint192 juelsPerFeeCoin, - // bytes32 configDigest - // ); - e := vrf_beacon.VRFBeaconNewTransmission{ - JuelsPerFeeCoin: big.NewInt(1_000), - ReasonableGasPrice: 1_000, - EpochAndRound: big.NewInt(1), - ConfigDigest: configDigest, - Transmitter: newAddress(t), - } - var unindexed abi.Arguments - for _, a := range vrfBeaconABI.Events[newTransmissionEvent].Inputs { - if !a.Indexed { - unindexed = append(unindexed, a) - } - } - nonIndexedData, err := unindexed.Pack( - e.Transmitter, e.JuelsPerFeeCoin, e.ReasonableGasPrice, e.ConfigDigest) - require.NoError(t, err) - - // epochAndRound is indexed - epochAndRoundType, err := abi.NewType("uint40", "", nil) - require.NoError(t, err) - indexedArgs := abi.Arguments{ - { - Name: "epochAndRound", - Type: epochAndRoundType, - }, - } - epochAndRoundPacked, err := indexedArgs.Pack(e.EpochAndRound) - require.NoError(t, err) - - topic0 := vrfBeaconABI.Events[newTransmissionEvent].ID - return logpoller.Log{ - Address: beaconAddress, - Data: nonIndexedData, - Topics: [][]byte{ - topic0.Bytes(), - epochAndRoundPacked, - }, - EventSig: topic0, - } -} - -func newAddress(t *testing.T) common.Address { - b := make([]byte, 20) - _, err := rand.Read(b) - require.NoError(t, err) - return common.HexToAddress(hexutil.Encode(b)) -} - -func getLogPoller( - t *testing.T, - requestedBlocks []uint64, - latestHeadNumber uint64, - needsLatestBlock bool, - includeLatestHeadInRange bool, - blockhashLookback uint64, -) *lp_mocks.LogPoller { - lp := lp_mocks.NewLogPoller(t) - if needsLatestBlock { - lp.On("LatestBlock", mock.Anything). - Return(logpoller.LogPollerBlock{BlockNumber: int64(latestHeadNumber)}, nil) - } - var logPollerBlocks []logpoller.LogPollerBlock - - // If provided, ajust the blockhash range such that it starts at the most recent head. - if includeLatestHeadInRange { - requestedBlocks = append(requestedBlocks, latestHeadNumber) - } - - // If provided, adjust the blockhash range such that it includes all recent available blockhashes. - if blockhashLookback != 0 { - requestedBlocks = append(requestedBlocks, latestHeadNumber-blockhashLookback+1) - } - - // Sort the blocks to match the coordinator's calls. - sort.Slice(requestedBlocks, func(a, b int) bool { - return requestedBlocks[a] < requestedBlocks[b] - }) - - // Fill range of blocks based on requestedBlocks - // example: requestedBlocks [195, 197] -> [{BlockNumber: 195, BlockHash: 0x001}, {BlockNumber: 196, BlockHash: 0x002}, {BlockNumber: 197, BlockHash: 0x003}] - minRequestedBlock := mathutil.Min(requestedBlocks[0], requestedBlocks[1:]...) - maxRequestedBlock := mathutil.Max(requestedBlocks[0], requestedBlocks[1:]...) - for i := minRequestedBlock; i <= maxRequestedBlock; i++ { - logPollerBlocks = append(logPollerBlocks, logpoller.LogPollerBlock{ - BlockNumber: int64(i), - BlockHash: common.HexToHash(fmt.Sprintf("0x00%d", i-minRequestedBlock+1)), - }) - } - - lp.On("GetBlocksRange", mock.Anything, requestedBlocks). - Return(logPollerBlocks, nil) - - return lp -} - -func TestFilterNamesFromSpec(t *testing.T) { - beaconAddress := newAddress(t) - coordinatorAddress := newAddress(t) - dkgAddress := newAddress(t) - - spec := &job.OCR2OracleSpec{ - ContractID: beaconAddress.String(), - PluginType: types.OCR2VRF, - PluginConfig: job.JSONConfig{ - "VRFCoordinatorAddress": coordinatorAddress.String(), - "DKGContractAddress": dkgAddress.String(), - }, - } - - names, err := FilterNamesFromSpec(spec) - require.NoError(t, err) - - assert.Len(t, names, 1) - assert.Equal(t, logpoller.FilterName("VRF Coordinator", beaconAddress, coordinatorAddress, dkgAddress), names[0]) - - spec = &job.OCR2OracleSpec{ - PluginType: types.OCR2VRF, - ContractID: beaconAddress.String(), - PluginConfig: nil, // missing coordinator & dkg addresses - } - _, err = FilterNamesFromSpec(spec) - require.ErrorContains(t, err, "is not a valid EIP55 formatted address") -} diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/interfaces.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/interfaces.go deleted file mode 100644 index 67dd567b68d..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/interfaces.go +++ /dev/null @@ -1,31 +0,0 @@ -package coordinator - -import ( - "math/big" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/core/types" - - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" -) - -//go:generate mockery --quiet --name VRFBeaconCoordinator --output ./mocks/ --case=underscore - -// VRFBeaconCoordinator is an interface that defines methods needed by the off-chain coordinator -type VRFBeaconCoordinator interface { - // SProvingKeyHash retrieves the proving key hash from the on-chain contract. - SProvingKeyHash(opts *bind.CallOpts) ([32]byte, error) - - // SKeyID retrieves the keyID from the on-chain contract. - SKeyID(opts *bind.CallOpts) ([32]byte, error) - - // IBeaconPeriodBlocks retrieves the beacon period in blocks from the on-chain contract. - IBeaconPeriodBlocks(opts *bind.CallOpts) (*big.Int, error) - - // ParseLog parses the raw log data and topics into a go object. - // The returned object must be casted to the expected type. - ParseLog(log types.Log) (generated.AbigenLog, error) - - // GetConfirmationDelays retrieves confirmation delays from the on-chain contract. - GetConfirmationDelays(opts *bind.CallOpts) ([8]*big.Int, error) -} diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/mocks/vrf_beacon.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/mocks/vrf_beacon.go deleted file mode 100644 index 79d1033377f..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/mocks/vrf_beacon.go +++ /dev/null @@ -1,2179 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - big "math/big" - - bind "github.com/ethereum/go-ethereum/accounts/abi/bind" - common "github.com/ethereum/go-ethereum/common" - - event "github.com/ethereum/go-ethereum/event" - - generated "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" - - mock "github.com/stretchr/testify/mock" - - types "github.com/ethereum/go-ethereum/core/types" - - vrf_beacon "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon" -) - -// VRFBeaconInterface is an autogenerated mock type for the VRFBeaconInterface type -type VRFBeaconInterface struct { - mock.Mock -} - -// AcceptOwnership provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for AcceptOwnership") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts) (*types.Transaction, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts) *types.Transaction); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// AcceptPayeeship provides a mock function with given fields: opts, transmitter -func (_m *VRFBeaconInterface) AcceptPayeeship(opts *bind.TransactOpts, transmitter common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, transmitter) - - if len(ret) == 0 { - panic("no return value specified for AcceptPayeeship") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { - return rf(opts, transmitter) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { - r0 = rf(opts, transmitter) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { - r1 = rf(opts, transmitter) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Address provides a mock function with given fields: -func (_m *VRFBeaconInterface) Address() common.Address { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Address") - } - - var r0 common.Address - if rf, ok := ret.Get(0).(func() common.Address); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - return r0 -} - -// ExposeType provides a mock function with given fields: opts, arg0 -func (_m *VRFBeaconInterface) ExposeType(opts *bind.TransactOpts, arg0 vrf_beacon.VRFBeaconReportReport) (*types.Transaction, error) { - ret := _m.Called(opts, arg0) - - if len(ret) == 0 { - panic("no return value specified for ExposeType") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, vrf_beacon.VRFBeaconReportReport) (*types.Transaction, error)); ok { - return rf(opts, arg0) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, vrf_beacon.VRFBeaconReportReport) *types.Transaction); ok { - r0 = rf(opts, arg0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, vrf_beacon.VRFBeaconReportReport) error); ok { - r1 = rf(opts, arg0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterBillingAccessControllerSet provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) FilterBillingAccessControllerSet(opts *bind.FilterOpts) (*vrf_beacon.VRFBeaconBillingAccessControllerSetIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterBillingAccessControllerSet") - } - - var r0 *vrf_beacon.VRFBeaconBillingAccessControllerSetIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*vrf_beacon.VRFBeaconBillingAccessControllerSetIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *vrf_beacon.VRFBeaconBillingAccessControllerSetIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconBillingAccessControllerSetIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterBillingSet provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) FilterBillingSet(opts *bind.FilterOpts) (*vrf_beacon.VRFBeaconBillingSetIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterBillingSet") - } - - var r0 *vrf_beacon.VRFBeaconBillingSetIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*vrf_beacon.VRFBeaconBillingSetIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *vrf_beacon.VRFBeaconBillingSetIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconBillingSetIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterConfigSet provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) FilterConfigSet(opts *bind.FilterOpts) (*vrf_beacon.VRFBeaconConfigSetIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterConfigSet") - } - - var r0 *vrf_beacon.VRFBeaconConfigSetIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*vrf_beacon.VRFBeaconConfigSetIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *vrf_beacon.VRFBeaconConfigSetIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconConfigSetIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterNewTransmission provides a mock function with given fields: opts, epochAndRound -func (_m *VRFBeaconInterface) FilterNewTransmission(opts *bind.FilterOpts, epochAndRound []*big.Int) (*vrf_beacon.VRFBeaconNewTransmissionIterator, error) { - ret := _m.Called(opts, epochAndRound) - - if len(ret) == 0 { - panic("no return value specified for FilterNewTransmission") - } - - var r0 *vrf_beacon.VRFBeaconNewTransmissionIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) (*vrf_beacon.VRFBeaconNewTransmissionIterator, error)); ok { - return rf(opts, epochAndRound) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) *vrf_beacon.VRFBeaconNewTransmissionIterator); ok { - r0 = rf(opts, epochAndRound) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconNewTransmissionIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []*big.Int) error); ok { - r1 = rf(opts, epochAndRound) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterOraclePaid provides a mock function with given fields: opts, transmitter, payee, linkToken -func (_m *VRFBeaconInterface) FilterOraclePaid(opts *bind.FilterOpts, transmitter []common.Address, payee []common.Address, linkToken []common.Address) (*vrf_beacon.VRFBeaconOraclePaidIterator, error) { - ret := _m.Called(opts, transmitter, payee, linkToken) - - if len(ret) == 0 { - panic("no return value specified for FilterOraclePaid") - } - - var r0 *vrf_beacon.VRFBeaconOraclePaidIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address, []common.Address) (*vrf_beacon.VRFBeaconOraclePaidIterator, error)); ok { - return rf(opts, transmitter, payee, linkToken) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address, []common.Address) *vrf_beacon.VRFBeaconOraclePaidIterator); ok { - r0 = rf(opts, transmitter, payee, linkToken) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconOraclePaidIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address, []common.Address) error); ok { - r1 = rf(opts, transmitter, payee, linkToken) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterOutputsServed provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) FilterOutputsServed(opts *bind.FilterOpts) (*vrf_beacon.VRFBeaconOutputsServedIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterOutputsServed") - } - - var r0 *vrf_beacon.VRFBeaconOutputsServedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*vrf_beacon.VRFBeaconOutputsServedIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *vrf_beacon.VRFBeaconOutputsServedIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconOutputsServedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterOwnershipTransferRequested provides a mock function with given fields: opts, from, to -func (_m *VRFBeaconInterface) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*vrf_beacon.VRFBeaconOwnershipTransferRequestedIterator, error) { - ret := _m.Called(opts, from, to) - - if len(ret) == 0 { - panic("no return value specified for FilterOwnershipTransferRequested") - } - - var r0 *vrf_beacon.VRFBeaconOwnershipTransferRequestedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*vrf_beacon.VRFBeaconOwnershipTransferRequestedIterator, error)); ok { - return rf(opts, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *vrf_beacon.VRFBeaconOwnershipTransferRequestedIterator); ok { - r0 = rf(opts, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconOwnershipTransferRequestedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { - r1 = rf(opts, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterOwnershipTransferred provides a mock function with given fields: opts, from, to -func (_m *VRFBeaconInterface) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*vrf_beacon.VRFBeaconOwnershipTransferredIterator, error) { - ret := _m.Called(opts, from, to) - - if len(ret) == 0 { - panic("no return value specified for FilterOwnershipTransferred") - } - - var r0 *vrf_beacon.VRFBeaconOwnershipTransferredIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*vrf_beacon.VRFBeaconOwnershipTransferredIterator, error)); ok { - return rf(opts, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *vrf_beacon.VRFBeaconOwnershipTransferredIterator); ok { - r0 = rf(opts, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconOwnershipTransferredIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { - r1 = rf(opts, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterPayeeshipTransferRequested provides a mock function with given fields: opts, transmitter, current, proposed -func (_m *VRFBeaconInterface) FilterPayeeshipTransferRequested(opts *bind.FilterOpts, transmitter []common.Address, current []common.Address, proposed []common.Address) (*vrf_beacon.VRFBeaconPayeeshipTransferRequestedIterator, error) { - ret := _m.Called(opts, transmitter, current, proposed) - - if len(ret) == 0 { - panic("no return value specified for FilterPayeeshipTransferRequested") - } - - var r0 *vrf_beacon.VRFBeaconPayeeshipTransferRequestedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address, []common.Address) (*vrf_beacon.VRFBeaconPayeeshipTransferRequestedIterator, error)); ok { - return rf(opts, transmitter, current, proposed) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address, []common.Address) *vrf_beacon.VRFBeaconPayeeshipTransferRequestedIterator); ok { - r0 = rf(opts, transmitter, current, proposed) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconPayeeshipTransferRequestedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address, []common.Address) error); ok { - r1 = rf(opts, transmitter, current, proposed) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterPayeeshipTransferred provides a mock function with given fields: opts, transmitter, previous, current -func (_m *VRFBeaconInterface) FilterPayeeshipTransferred(opts *bind.FilterOpts, transmitter []common.Address, previous []common.Address, current []common.Address) (*vrf_beacon.VRFBeaconPayeeshipTransferredIterator, error) { - ret := _m.Called(opts, transmitter, previous, current) - - if len(ret) == 0 { - panic("no return value specified for FilterPayeeshipTransferred") - } - - var r0 *vrf_beacon.VRFBeaconPayeeshipTransferredIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address, []common.Address) (*vrf_beacon.VRFBeaconPayeeshipTransferredIterator, error)); ok { - return rf(opts, transmitter, previous, current) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address, []common.Address) *vrf_beacon.VRFBeaconPayeeshipTransferredIterator); ok { - r0 = rf(opts, transmitter, previous, current) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconPayeeshipTransferredIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address, []common.Address) error); ok { - r1 = rf(opts, transmitter, previous, current) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterRandomWordsFulfilled provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) FilterRandomWordsFulfilled(opts *bind.FilterOpts) (*vrf_beacon.VRFBeaconRandomWordsFulfilledIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterRandomWordsFulfilled") - } - - var r0 *vrf_beacon.VRFBeaconRandomWordsFulfilledIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*vrf_beacon.VRFBeaconRandomWordsFulfilledIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *vrf_beacon.VRFBeaconRandomWordsFulfilledIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconRandomWordsFulfilledIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterRandomnessFulfillmentRequested provides a mock function with given fields: opts, requestID -func (_m *VRFBeaconInterface) FilterRandomnessFulfillmentRequested(opts *bind.FilterOpts, requestID []*big.Int) (*vrf_beacon.VRFBeaconRandomnessFulfillmentRequestedIterator, error) { - ret := _m.Called(opts, requestID) - - if len(ret) == 0 { - panic("no return value specified for FilterRandomnessFulfillmentRequested") - } - - var r0 *vrf_beacon.VRFBeaconRandomnessFulfillmentRequestedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) (*vrf_beacon.VRFBeaconRandomnessFulfillmentRequestedIterator, error)); ok { - return rf(opts, requestID) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) *vrf_beacon.VRFBeaconRandomnessFulfillmentRequestedIterator); ok { - r0 = rf(opts, requestID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconRandomnessFulfillmentRequestedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []*big.Int) error); ok { - r1 = rf(opts, requestID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterRandomnessRedeemed provides a mock function with given fields: opts, requestID, requester -func (_m *VRFBeaconInterface) FilterRandomnessRedeemed(opts *bind.FilterOpts, requestID []*big.Int, requester []common.Address) (*vrf_beacon.VRFBeaconRandomnessRedeemedIterator, error) { - ret := _m.Called(opts, requestID, requester) - - if len(ret) == 0 { - panic("no return value specified for FilterRandomnessRedeemed") - } - - var r0 *vrf_beacon.VRFBeaconRandomnessRedeemedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int, []common.Address) (*vrf_beacon.VRFBeaconRandomnessRedeemedIterator, error)); ok { - return rf(opts, requestID, requester) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int, []common.Address) *vrf_beacon.VRFBeaconRandomnessRedeemedIterator); ok { - r0 = rf(opts, requestID, requester) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconRandomnessRedeemedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []*big.Int, []common.Address) error); ok { - r1 = rf(opts, requestID, requester) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterRandomnessRequested provides a mock function with given fields: opts, requestID -func (_m *VRFBeaconInterface) FilterRandomnessRequested(opts *bind.FilterOpts, requestID []*big.Int) (*vrf_beacon.VRFBeaconRandomnessRequestedIterator, error) { - ret := _m.Called(opts, requestID) - - if len(ret) == 0 { - panic("no return value specified for FilterRandomnessRequested") - } - - var r0 *vrf_beacon.VRFBeaconRandomnessRequestedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) (*vrf_beacon.VRFBeaconRandomnessRequestedIterator, error)); ok { - return rf(opts, requestID) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) *vrf_beacon.VRFBeaconRandomnessRequestedIterator); ok { - r0 = rf(opts, requestID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconRandomnessRequestedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []*big.Int) error); ok { - r1 = rf(opts, requestID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetBilling provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) GetBilling(opts *bind.CallOpts) (vrf_beacon.GetBilling, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for GetBilling") - } - - var r0 vrf_beacon.GetBilling - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (vrf_beacon.GetBilling, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) vrf_beacon.GetBilling); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(vrf_beacon.GetBilling) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetBillingAccessController provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) GetBillingAccessController(opts *bind.CallOpts) (common.Address, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for GetBillingAccessController") - } - - var r0 common.Address - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (common.Address, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) common.Address); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ICoordinator provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) ICoordinator(opts *bind.CallOpts) (common.Address, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for ICoordinator") - } - - var r0 common.Address - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (common.Address, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) common.Address); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ILink provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) ILink(opts *bind.CallOpts) (common.Address, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for ILink") - } - - var r0 common.Address - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (common.Address, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) common.Address); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// KeyGenerated provides a mock function with given fields: opts, kd -func (_m *VRFBeaconInterface) KeyGenerated(opts *bind.TransactOpts, kd vrf_beacon.KeyDataStructKeyData) (*types.Transaction, error) { - ret := _m.Called(opts, kd) - - if len(ret) == 0 { - panic("no return value specified for KeyGenerated") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, vrf_beacon.KeyDataStructKeyData) (*types.Transaction, error)); ok { - return rf(opts, kd) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, vrf_beacon.KeyDataStructKeyData) *types.Transaction); ok { - r0 = rf(opts, kd) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, vrf_beacon.KeyDataStructKeyData) error); ok { - r1 = rf(opts, kd) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// LatestConfigDetails provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) LatestConfigDetails(opts *bind.CallOpts) (vrf_beacon.LatestConfigDetails, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for LatestConfigDetails") - } - - var r0 vrf_beacon.LatestConfigDetails - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (vrf_beacon.LatestConfigDetails, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) vrf_beacon.LatestConfigDetails); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(vrf_beacon.LatestConfigDetails) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// LatestConfigDigestAndEpoch provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) LatestConfigDigestAndEpoch(opts *bind.CallOpts) (vrf_beacon.LatestConfigDigestAndEpoch, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for LatestConfigDigestAndEpoch") - } - - var r0 vrf_beacon.LatestConfigDigestAndEpoch - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (vrf_beacon.LatestConfigDigestAndEpoch, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) vrf_beacon.LatestConfigDigestAndEpoch); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(vrf_beacon.LatestConfigDigestAndEpoch) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// LinkAvailableForPayment provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) LinkAvailableForPayment(opts *bind.CallOpts) (*big.Int, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for LinkAvailableForPayment") - } - - var r0 *big.Int - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (*big.Int, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) *big.Int); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*big.Int) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NUMCONFDELAYS provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) NUMCONFDELAYS(opts *bind.CallOpts) (uint8, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for NUMCONFDELAYS") - } - - var r0 uint8 - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (uint8, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) uint8); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(uint8) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewKeyRequested provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) NewKeyRequested(opts *bind.TransactOpts) (*types.Transaction, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for NewKeyRequested") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts) (*types.Transaction, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts) *types.Transaction); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OwedPayment provides a mock function with given fields: opts, transmitterAddress -func (_m *VRFBeaconInterface) OwedPayment(opts *bind.CallOpts, transmitterAddress common.Address) (*big.Int, error) { - ret := _m.Called(opts, transmitterAddress) - - if len(ret) == 0 { - panic("no return value specified for OwedPayment") - } - - var r0 *big.Int - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address) (*big.Int, error)); ok { - return rf(opts, transmitterAddress) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, common.Address) *big.Int); ok { - r0 = rf(opts, transmitterAddress) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*big.Int) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, common.Address) error); ok { - r1 = rf(opts, transmitterAddress) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Owner provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) Owner(opts *bind.CallOpts) (common.Address, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for Owner") - } - - var r0 common.Address - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (common.Address, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) common.Address); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseBillingAccessControllerSet provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParseBillingAccessControllerSet(log types.Log) (*vrf_beacon.VRFBeaconBillingAccessControllerSet, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseBillingAccessControllerSet") - } - - var r0 *vrf_beacon.VRFBeaconBillingAccessControllerSet - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_beacon.VRFBeaconBillingAccessControllerSet, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_beacon.VRFBeaconBillingAccessControllerSet); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconBillingAccessControllerSet) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseBillingSet provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParseBillingSet(log types.Log) (*vrf_beacon.VRFBeaconBillingSet, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseBillingSet") - } - - var r0 *vrf_beacon.VRFBeaconBillingSet - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_beacon.VRFBeaconBillingSet, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_beacon.VRFBeaconBillingSet); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconBillingSet) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseConfigSet provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParseConfigSet(log types.Log) (*vrf_beacon.VRFBeaconConfigSet, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseConfigSet") - } - - var r0 *vrf_beacon.VRFBeaconConfigSet - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_beacon.VRFBeaconConfigSet, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_beacon.VRFBeaconConfigSet); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconConfigSet) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseLog provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParseLog(log types.Log) (generated.AbigenLog, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseLog") - } - - var r0 generated.AbigenLog - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (generated.AbigenLog, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) generated.AbigenLog); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(generated.AbigenLog) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseNewTransmission provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParseNewTransmission(log types.Log) (*vrf_beacon.VRFBeaconNewTransmission, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseNewTransmission") - } - - var r0 *vrf_beacon.VRFBeaconNewTransmission - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_beacon.VRFBeaconNewTransmission, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_beacon.VRFBeaconNewTransmission); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconNewTransmission) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseOraclePaid provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParseOraclePaid(log types.Log) (*vrf_beacon.VRFBeaconOraclePaid, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseOraclePaid") - } - - var r0 *vrf_beacon.VRFBeaconOraclePaid - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_beacon.VRFBeaconOraclePaid, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_beacon.VRFBeaconOraclePaid); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconOraclePaid) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseOutputsServed provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParseOutputsServed(log types.Log) (*vrf_beacon.VRFBeaconOutputsServed, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseOutputsServed") - } - - var r0 *vrf_beacon.VRFBeaconOutputsServed - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_beacon.VRFBeaconOutputsServed, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_beacon.VRFBeaconOutputsServed); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconOutputsServed) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseOwnershipTransferRequested provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParseOwnershipTransferRequested(log types.Log) (*vrf_beacon.VRFBeaconOwnershipTransferRequested, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseOwnershipTransferRequested") - } - - var r0 *vrf_beacon.VRFBeaconOwnershipTransferRequested - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_beacon.VRFBeaconOwnershipTransferRequested, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_beacon.VRFBeaconOwnershipTransferRequested); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconOwnershipTransferRequested) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseOwnershipTransferred provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParseOwnershipTransferred(log types.Log) (*vrf_beacon.VRFBeaconOwnershipTransferred, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseOwnershipTransferred") - } - - var r0 *vrf_beacon.VRFBeaconOwnershipTransferred - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_beacon.VRFBeaconOwnershipTransferred, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_beacon.VRFBeaconOwnershipTransferred); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconOwnershipTransferred) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParsePayeeshipTransferRequested provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParsePayeeshipTransferRequested(log types.Log) (*vrf_beacon.VRFBeaconPayeeshipTransferRequested, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParsePayeeshipTransferRequested") - } - - var r0 *vrf_beacon.VRFBeaconPayeeshipTransferRequested - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_beacon.VRFBeaconPayeeshipTransferRequested, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_beacon.VRFBeaconPayeeshipTransferRequested); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconPayeeshipTransferRequested) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParsePayeeshipTransferred provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParsePayeeshipTransferred(log types.Log) (*vrf_beacon.VRFBeaconPayeeshipTransferred, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParsePayeeshipTransferred") - } - - var r0 *vrf_beacon.VRFBeaconPayeeshipTransferred - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_beacon.VRFBeaconPayeeshipTransferred, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_beacon.VRFBeaconPayeeshipTransferred); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconPayeeshipTransferred) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseRandomWordsFulfilled provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParseRandomWordsFulfilled(log types.Log) (*vrf_beacon.VRFBeaconRandomWordsFulfilled, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseRandomWordsFulfilled") - } - - var r0 *vrf_beacon.VRFBeaconRandomWordsFulfilled - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_beacon.VRFBeaconRandomWordsFulfilled, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_beacon.VRFBeaconRandomWordsFulfilled); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconRandomWordsFulfilled) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseRandomnessFulfillmentRequested provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParseRandomnessFulfillmentRequested(log types.Log) (*vrf_beacon.VRFBeaconRandomnessFulfillmentRequested, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseRandomnessFulfillmentRequested") - } - - var r0 *vrf_beacon.VRFBeaconRandomnessFulfillmentRequested - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_beacon.VRFBeaconRandomnessFulfillmentRequested, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_beacon.VRFBeaconRandomnessFulfillmentRequested); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconRandomnessFulfillmentRequested) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseRandomnessRedeemed provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParseRandomnessRedeemed(log types.Log) (*vrf_beacon.VRFBeaconRandomnessRedeemed, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseRandomnessRedeemed") - } - - var r0 *vrf_beacon.VRFBeaconRandomnessRedeemed - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_beacon.VRFBeaconRandomnessRedeemed, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_beacon.VRFBeaconRandomnessRedeemed); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconRandomnessRedeemed) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseRandomnessRequested provides a mock function with given fields: log -func (_m *VRFBeaconInterface) ParseRandomnessRequested(log types.Log) (*vrf_beacon.VRFBeaconRandomnessRequested, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseRandomnessRequested") - } - - var r0 *vrf_beacon.VRFBeaconRandomnessRequested - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_beacon.VRFBeaconRandomnessRequested, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_beacon.VRFBeaconRandomnessRequested); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_beacon.VRFBeaconRandomnessRequested) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SKeyID provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) SKeyID(opts *bind.CallOpts) ([32]byte, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for SKeyID") - } - - var r0 [32]byte - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) ([32]byte, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) [32]byte); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([32]byte) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SKeyProvider provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) SKeyProvider(opts *bind.CallOpts) (common.Address, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for SKeyProvider") - } - - var r0 common.Address - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (common.Address, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) common.Address); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SProvingKeyHash provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) SProvingKeyHash(opts *bind.CallOpts) ([32]byte, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for SProvingKeyHash") - } - - var r0 [32]byte - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) ([32]byte, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) [32]byte); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([32]byte) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SetBilling provides a mock function with given fields: opts, maximumGasPrice, reasonableGasPrice, observationPayment, transmissionPayment, accountingGas -func (_m *VRFBeaconInterface) SetBilling(opts *bind.TransactOpts, maximumGasPrice uint64, reasonableGasPrice uint64, observationPayment uint64, transmissionPayment uint64, accountingGas *big.Int) (*types.Transaction, error) { - ret := _m.Called(opts, maximumGasPrice, reasonableGasPrice, observationPayment, transmissionPayment, accountingGas) - - if len(ret) == 0 { - panic("no return value specified for SetBilling") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, uint64, uint64, uint64, uint64, *big.Int) (*types.Transaction, error)); ok { - return rf(opts, maximumGasPrice, reasonableGasPrice, observationPayment, transmissionPayment, accountingGas) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, uint64, uint64, uint64, uint64, *big.Int) *types.Transaction); ok { - r0 = rf(opts, maximumGasPrice, reasonableGasPrice, observationPayment, transmissionPayment, accountingGas) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, uint64, uint64, uint64, uint64, *big.Int) error); ok { - r1 = rf(opts, maximumGasPrice, reasonableGasPrice, observationPayment, transmissionPayment, accountingGas) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SetBillingAccessController provides a mock function with given fields: opts, _billingAccessController -func (_m *VRFBeaconInterface) SetBillingAccessController(opts *bind.TransactOpts, _billingAccessController common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, _billingAccessController) - - if len(ret) == 0 { - panic("no return value specified for SetBillingAccessController") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { - return rf(opts, _billingAccessController) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { - r0 = rf(opts, _billingAccessController) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { - r1 = rf(opts, _billingAccessController) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SetConfig provides a mock function with given fields: opts, signers, transmitters, f, onchainConfig, offchainConfigVersion, offchainConfig -func (_m *VRFBeaconInterface) SetConfig(opts *bind.TransactOpts, signers []common.Address, transmitters []common.Address, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte) (*types.Transaction, error) { - ret := _m.Called(opts, signers, transmitters, f, onchainConfig, offchainConfigVersion, offchainConfig) - - if len(ret) == 0 { - panic("no return value specified for SetConfig") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []common.Address, []common.Address, uint8, []byte, uint64, []byte) (*types.Transaction, error)); ok { - return rf(opts, signers, transmitters, f, onchainConfig, offchainConfigVersion, offchainConfig) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []common.Address, []common.Address, uint8, []byte, uint64, []byte) *types.Transaction); ok { - r0 = rf(opts, signers, transmitters, f, onchainConfig, offchainConfigVersion, offchainConfig) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []common.Address, []common.Address, uint8, []byte, uint64, []byte) error); ok { - r1 = rf(opts, signers, transmitters, f, onchainConfig, offchainConfigVersion, offchainConfig) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SetPayees provides a mock function with given fields: opts, transmitters, payees -func (_m *VRFBeaconInterface) SetPayees(opts *bind.TransactOpts, transmitters []common.Address, payees []common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, transmitters, payees) - - if len(ret) == 0 { - panic("no return value specified for SetPayees") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []common.Address, []common.Address) (*types.Transaction, error)); ok { - return rf(opts, transmitters, payees) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []common.Address, []common.Address) *types.Transaction); ok { - r0 = rf(opts, transmitters, payees) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []common.Address, []common.Address) error); ok { - r1 = rf(opts, transmitters, payees) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// TransferOwnership provides a mock function with given fields: opts, to -func (_m *VRFBeaconInterface) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, to) - - if len(ret) == 0 { - panic("no return value specified for TransferOwnership") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { - return rf(opts, to) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { - r0 = rf(opts, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { - r1 = rf(opts, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// TransferPayeeship provides a mock function with given fields: opts, transmitter, proposed -func (_m *VRFBeaconInterface) TransferPayeeship(opts *bind.TransactOpts, transmitter common.Address, proposed common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, transmitter, proposed) - - if len(ret) == 0 { - panic("no return value specified for TransferPayeeship") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address, common.Address) (*types.Transaction, error)); ok { - return rf(opts, transmitter, proposed) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address, common.Address) *types.Transaction); ok { - r0 = rf(opts, transmitter, proposed) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address, common.Address) error); ok { - r1 = rf(opts, transmitter, proposed) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Transmit provides a mock function with given fields: opts, reportContext, report, rs, ss, rawVs -func (_m *VRFBeaconInterface) Transmit(opts *bind.TransactOpts, reportContext [3][32]byte, report []byte, rs [][32]byte, ss [][32]byte, rawVs [32]byte) (*types.Transaction, error) { - ret := _m.Called(opts, reportContext, report, rs, ss, rawVs) - - if len(ret) == 0 { - panic("no return value specified for Transmit") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [3][32]byte, []byte, [][32]byte, [][32]byte, [32]byte) (*types.Transaction, error)); ok { - return rf(opts, reportContext, report, rs, ss, rawVs) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [3][32]byte, []byte, [][32]byte, [][32]byte, [32]byte) *types.Transaction); ok { - r0 = rf(opts, reportContext, report, rs, ss, rawVs) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, [3][32]byte, []byte, [][32]byte, [][32]byte, [32]byte) error); ok { - r1 = rf(opts, reportContext, report, rs, ss, rawVs) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// TypeAndVersion provides a mock function with given fields: opts -func (_m *VRFBeaconInterface) TypeAndVersion(opts *bind.CallOpts) (string, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for TypeAndVersion") - } - - var r0 string - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (string, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) string); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(string) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchBillingAccessControllerSet provides a mock function with given fields: opts, sink -func (_m *VRFBeaconInterface) WatchBillingAccessControllerSet(opts *bind.WatchOpts, sink chan<- *vrf_beacon.VRFBeaconBillingAccessControllerSet) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchBillingAccessControllerSet") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconBillingAccessControllerSet) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconBillingAccessControllerSet) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconBillingAccessControllerSet) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchBillingSet provides a mock function with given fields: opts, sink -func (_m *VRFBeaconInterface) WatchBillingSet(opts *bind.WatchOpts, sink chan<- *vrf_beacon.VRFBeaconBillingSet) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchBillingSet") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconBillingSet) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconBillingSet) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconBillingSet) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchConfigSet provides a mock function with given fields: opts, sink -func (_m *VRFBeaconInterface) WatchConfigSet(opts *bind.WatchOpts, sink chan<- *vrf_beacon.VRFBeaconConfigSet) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchConfigSet") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconConfigSet) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconConfigSet) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconConfigSet) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchNewTransmission provides a mock function with given fields: opts, sink, epochAndRound -func (_m *VRFBeaconInterface) WatchNewTransmission(opts *bind.WatchOpts, sink chan<- *vrf_beacon.VRFBeaconNewTransmission, epochAndRound []*big.Int) (event.Subscription, error) { - ret := _m.Called(opts, sink, epochAndRound) - - if len(ret) == 0 { - panic("no return value specified for WatchNewTransmission") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconNewTransmission, []*big.Int) (event.Subscription, error)); ok { - return rf(opts, sink, epochAndRound) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconNewTransmission, []*big.Int) event.Subscription); ok { - r0 = rf(opts, sink, epochAndRound) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconNewTransmission, []*big.Int) error); ok { - r1 = rf(opts, sink, epochAndRound) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchOraclePaid provides a mock function with given fields: opts, sink, transmitter, payee, linkToken -func (_m *VRFBeaconInterface) WatchOraclePaid(opts *bind.WatchOpts, sink chan<- *vrf_beacon.VRFBeaconOraclePaid, transmitter []common.Address, payee []common.Address, linkToken []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, transmitter, payee, linkToken) - - if len(ret) == 0 { - panic("no return value specified for WatchOraclePaid") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconOraclePaid, []common.Address, []common.Address, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, transmitter, payee, linkToken) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconOraclePaid, []common.Address, []common.Address, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, transmitter, payee, linkToken) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconOraclePaid, []common.Address, []common.Address, []common.Address) error); ok { - r1 = rf(opts, sink, transmitter, payee, linkToken) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchOutputsServed provides a mock function with given fields: opts, sink -func (_m *VRFBeaconInterface) WatchOutputsServed(opts *bind.WatchOpts, sink chan<- *vrf_beacon.VRFBeaconOutputsServed) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchOutputsServed") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconOutputsServed) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconOutputsServed) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconOutputsServed) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchOwnershipTransferRequested provides a mock function with given fields: opts, sink, from, to -func (_m *VRFBeaconInterface) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *vrf_beacon.VRFBeaconOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, from, to) - - if len(ret) == 0 { - panic("no return value specified for WatchOwnershipTransferRequested") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconOwnershipTransferRequested, []common.Address, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconOwnershipTransferRequested, []common.Address, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconOwnershipTransferRequested, []common.Address, []common.Address) error); ok { - r1 = rf(opts, sink, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchOwnershipTransferred provides a mock function with given fields: opts, sink, from, to -func (_m *VRFBeaconInterface) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *vrf_beacon.VRFBeaconOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, from, to) - - if len(ret) == 0 { - panic("no return value specified for WatchOwnershipTransferred") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconOwnershipTransferred, []common.Address, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconOwnershipTransferred, []common.Address, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconOwnershipTransferred, []common.Address, []common.Address) error); ok { - r1 = rf(opts, sink, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchPayeeshipTransferRequested provides a mock function with given fields: opts, sink, transmitter, current, proposed -func (_m *VRFBeaconInterface) WatchPayeeshipTransferRequested(opts *bind.WatchOpts, sink chan<- *vrf_beacon.VRFBeaconPayeeshipTransferRequested, transmitter []common.Address, current []common.Address, proposed []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, transmitter, current, proposed) - - if len(ret) == 0 { - panic("no return value specified for WatchPayeeshipTransferRequested") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconPayeeshipTransferRequested, []common.Address, []common.Address, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, transmitter, current, proposed) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconPayeeshipTransferRequested, []common.Address, []common.Address, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, transmitter, current, proposed) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconPayeeshipTransferRequested, []common.Address, []common.Address, []common.Address) error); ok { - r1 = rf(opts, sink, transmitter, current, proposed) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchPayeeshipTransferred provides a mock function with given fields: opts, sink, transmitter, previous, current -func (_m *VRFBeaconInterface) WatchPayeeshipTransferred(opts *bind.WatchOpts, sink chan<- *vrf_beacon.VRFBeaconPayeeshipTransferred, transmitter []common.Address, previous []common.Address, current []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, transmitter, previous, current) - - if len(ret) == 0 { - panic("no return value specified for WatchPayeeshipTransferred") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconPayeeshipTransferred, []common.Address, []common.Address, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, transmitter, previous, current) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconPayeeshipTransferred, []common.Address, []common.Address, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, transmitter, previous, current) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconPayeeshipTransferred, []common.Address, []common.Address, []common.Address) error); ok { - r1 = rf(opts, sink, transmitter, previous, current) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchRandomWordsFulfilled provides a mock function with given fields: opts, sink -func (_m *VRFBeaconInterface) WatchRandomWordsFulfilled(opts *bind.WatchOpts, sink chan<- *vrf_beacon.VRFBeaconRandomWordsFulfilled) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchRandomWordsFulfilled") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconRandomWordsFulfilled) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconRandomWordsFulfilled) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconRandomWordsFulfilled) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchRandomnessFulfillmentRequested provides a mock function with given fields: opts, sink, requestID -func (_m *VRFBeaconInterface) WatchRandomnessFulfillmentRequested(opts *bind.WatchOpts, sink chan<- *vrf_beacon.VRFBeaconRandomnessFulfillmentRequested, requestID []*big.Int) (event.Subscription, error) { - ret := _m.Called(opts, sink, requestID) - - if len(ret) == 0 { - panic("no return value specified for WatchRandomnessFulfillmentRequested") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconRandomnessFulfillmentRequested, []*big.Int) (event.Subscription, error)); ok { - return rf(opts, sink, requestID) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconRandomnessFulfillmentRequested, []*big.Int) event.Subscription); ok { - r0 = rf(opts, sink, requestID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconRandomnessFulfillmentRequested, []*big.Int) error); ok { - r1 = rf(opts, sink, requestID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchRandomnessRedeemed provides a mock function with given fields: opts, sink, requestID, requester -func (_m *VRFBeaconInterface) WatchRandomnessRedeemed(opts *bind.WatchOpts, sink chan<- *vrf_beacon.VRFBeaconRandomnessRedeemed, requestID []*big.Int, requester []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, requestID, requester) - - if len(ret) == 0 { - panic("no return value specified for WatchRandomnessRedeemed") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconRandomnessRedeemed, []*big.Int, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, requestID, requester) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconRandomnessRedeemed, []*big.Int, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, requestID, requester) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconRandomnessRedeemed, []*big.Int, []common.Address) error); ok { - r1 = rf(opts, sink, requestID, requester) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchRandomnessRequested provides a mock function with given fields: opts, sink, requestID -func (_m *VRFBeaconInterface) WatchRandomnessRequested(opts *bind.WatchOpts, sink chan<- *vrf_beacon.VRFBeaconRandomnessRequested, requestID []*big.Int) (event.Subscription, error) { - ret := _m.Called(opts, sink, requestID) - - if len(ret) == 0 { - panic("no return value specified for WatchRandomnessRequested") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconRandomnessRequested, []*big.Int) (event.Subscription, error)); ok { - return rf(opts, sink, requestID) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconRandomnessRequested, []*big.Int) event.Subscription); ok { - r0 = rf(opts, sink, requestID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_beacon.VRFBeaconRandomnessRequested, []*big.Int) error); ok { - r1 = rf(opts, sink, requestID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WithdrawFunds provides a mock function with given fields: opts, recipient, amount -func (_m *VRFBeaconInterface) WithdrawFunds(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) { - ret := _m.Called(opts, recipient, amount) - - if len(ret) == 0 { - panic("no return value specified for WithdrawFunds") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address, *big.Int) (*types.Transaction, error)); ok { - return rf(opts, recipient, amount) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address, *big.Int) *types.Transaction); ok { - r0 = rf(opts, recipient, amount) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address, *big.Int) error); ok { - r1 = rf(opts, recipient, amount) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WithdrawPayment provides a mock function with given fields: opts, transmitter -func (_m *VRFBeaconInterface) WithdrawPayment(opts *bind.TransactOpts, transmitter common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, transmitter) - - if len(ret) == 0 { - panic("no return value specified for WithdrawPayment") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { - return rf(opts, transmitter) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { - r0 = rf(opts, transmitter) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { - r1 = rf(opts, transmitter) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewVRFBeaconInterface creates a new instance of VRFBeaconInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewVRFBeaconInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *VRFBeaconInterface { - mock := &VRFBeaconInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/mocks/vrf_beacon_coordinator.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/mocks/vrf_beacon_coordinator.go deleted file mode 100644 index d12f69fde49..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/mocks/vrf_beacon_coordinator.go +++ /dev/null @@ -1,184 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - big "math/big" - - bind "github.com/ethereum/go-ethereum/accounts/abi/bind" - - generated "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" - - mock "github.com/stretchr/testify/mock" - - types "github.com/ethereum/go-ethereum/core/types" -) - -// VRFBeaconCoordinator is an autogenerated mock type for the VRFBeaconCoordinator type -type VRFBeaconCoordinator struct { - mock.Mock -} - -// GetConfirmationDelays provides a mock function with given fields: opts -func (_m *VRFBeaconCoordinator) GetConfirmationDelays(opts *bind.CallOpts) ([8]*big.Int, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for GetConfirmationDelays") - } - - var r0 [8]*big.Int - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) ([8]*big.Int, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) [8]*big.Int); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([8]*big.Int) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// IBeaconPeriodBlocks provides a mock function with given fields: opts -func (_m *VRFBeaconCoordinator) IBeaconPeriodBlocks(opts *bind.CallOpts) (*big.Int, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for IBeaconPeriodBlocks") - } - - var r0 *big.Int - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (*big.Int, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) *big.Int); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*big.Int) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseLog provides a mock function with given fields: log -func (_m *VRFBeaconCoordinator) ParseLog(log types.Log) (generated.AbigenLog, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseLog") - } - - var r0 generated.AbigenLog - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (generated.AbigenLog, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) generated.AbigenLog); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(generated.AbigenLog) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SKeyID provides a mock function with given fields: opts -func (_m *VRFBeaconCoordinator) SKeyID(opts *bind.CallOpts) ([32]byte, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for SKeyID") - } - - var r0 [32]byte - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) ([32]byte, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) [32]byte); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([32]byte) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SProvingKeyHash provides a mock function with given fields: opts -func (_m *VRFBeaconCoordinator) SProvingKeyHash(opts *bind.CallOpts) ([32]byte, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for SProvingKeyHash") - } - - var r0 [32]byte - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) ([32]byte, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) [32]byte); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([32]byte) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewVRFBeaconCoordinator creates a new instance of VRFBeaconCoordinator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewVRFBeaconCoordinator(t interface { - mock.TestingT - Cleanup(func()) -}) *VRFBeaconCoordinator { - mock := &VRFBeaconCoordinator{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/mocks/vrf_coordinator.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/mocks/vrf_coordinator.go deleted file mode 100644 index 205427f1a77..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/mocks/vrf_coordinator.go +++ /dev/null @@ -1,3093 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - big "math/big" - - bind "github.com/ethereum/go-ethereum/accounts/abi/bind" - common "github.com/ethereum/go-ethereum/common" - - event "github.com/ethereum/go-ethereum/event" - - generated "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" - - mock "github.com/stretchr/testify/mock" - - types "github.com/ethereum/go-ethereum/core/types" - - vrf_coordinator "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_coordinator" -) - -// VRFCoordinatorInterface is an autogenerated mock type for the VRFCoordinatorInterface type -type VRFCoordinatorInterface struct { - mock.Mock -} - -// AcceptOwnership provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for AcceptOwnership") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts) (*types.Transaction, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts) *types.Transaction); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// AcceptSubscriptionOwnerTransfer provides a mock function with given fields: opts, subId -func (_m *VRFCoordinatorInterface) AcceptSubscriptionOwnerTransfer(opts *bind.TransactOpts, subId *big.Int) (*types.Transaction, error) { - ret := _m.Called(opts, subId) - - if len(ret) == 0 { - panic("no return value specified for AcceptSubscriptionOwnerTransfer") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int) (*types.Transaction, error)); ok { - return rf(opts, subId) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int) *types.Transaction); ok { - r0 = rf(opts, subId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, *big.Int) error); ok { - r1 = rf(opts, subId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// AddConsumer provides a mock function with given fields: opts, subId, consumer -func (_m *VRFCoordinatorInterface) AddConsumer(opts *bind.TransactOpts, subId *big.Int, consumer common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, subId, consumer) - - if len(ret) == 0 { - panic("no return value specified for AddConsumer") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int, common.Address) (*types.Transaction, error)); ok { - return rf(opts, subId, consumer) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int, common.Address) *types.Transaction); ok { - r0 = rf(opts, subId, consumer) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, *big.Int, common.Address) error); ok { - r1 = rf(opts, subId, consumer) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Address provides a mock function with given fields: -func (_m *VRFCoordinatorInterface) Address() common.Address { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Address") - } - - var r0 common.Address - if rf, ok := ret.Get(0).(func() common.Address); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - return r0 -} - -// BatchTransferLink provides a mock function with given fields: opts, recipients, paymentsInJuels -func (_m *VRFCoordinatorInterface) BatchTransferLink(opts *bind.TransactOpts, recipients []common.Address, paymentsInJuels []*big.Int) (*types.Transaction, error) { - ret := _m.Called(opts, recipients, paymentsInJuels) - - if len(ret) == 0 { - panic("no return value specified for BatchTransferLink") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []common.Address, []*big.Int) (*types.Transaction, error)); ok { - return rf(opts, recipients, paymentsInJuels) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []common.Address, []*big.Int) *types.Transaction); ok { - r0 = rf(opts, recipients, paymentsInJuels) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []common.Address, []*big.Int) error); ok { - r1 = rf(opts, recipients, paymentsInJuels) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CancelSubscription provides a mock function with given fields: opts, subId, to -func (_m *VRFCoordinatorInterface) CancelSubscription(opts *bind.TransactOpts, subId *big.Int, to common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, subId, to) - - if len(ret) == 0 { - panic("no return value specified for CancelSubscription") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int, common.Address) (*types.Transaction, error)); ok { - return rf(opts, subId, to) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int, common.Address) *types.Transaction); ok { - r0 = rf(opts, subId, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, *big.Int, common.Address) error); ok { - r1 = rf(opts, subId, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateSubscription provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) CreateSubscription(opts *bind.TransactOpts) (*types.Transaction, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for CreateSubscription") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts) (*types.Transaction, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts) *types.Transaction); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeregisterMigratableCoordinator provides a mock function with given fields: opts, target -func (_m *VRFCoordinatorInterface) DeregisterMigratableCoordinator(opts *bind.TransactOpts, target common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, target) - - if len(ret) == 0 { - panic("no return value specified for DeregisterMigratableCoordinator") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { - return rf(opts, target) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { - r0 = rf(opts, target) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { - r1 = rf(opts, target) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterCallbackConfigSet provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) FilterCallbackConfigSet(opts *bind.FilterOpts) (*vrf_coordinator.VRFCoordinatorCallbackConfigSetIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterCallbackConfigSet") - } - - var r0 *vrf_coordinator.VRFCoordinatorCallbackConfigSetIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*vrf_coordinator.VRFCoordinatorCallbackConfigSetIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *vrf_coordinator.VRFCoordinatorCallbackConfigSetIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorCallbackConfigSetIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterCoordinatorConfigSet provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) FilterCoordinatorConfigSet(opts *bind.FilterOpts) (*vrf_coordinator.VRFCoordinatorCoordinatorConfigSetIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterCoordinatorConfigSet") - } - - var r0 *vrf_coordinator.VRFCoordinatorCoordinatorConfigSetIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*vrf_coordinator.VRFCoordinatorCoordinatorConfigSetIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *vrf_coordinator.VRFCoordinatorCoordinatorConfigSetIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorCoordinatorConfigSetIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterCoordinatorDeregistered provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) FilterCoordinatorDeregistered(opts *bind.FilterOpts) (*vrf_coordinator.VRFCoordinatorCoordinatorDeregisteredIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterCoordinatorDeregistered") - } - - var r0 *vrf_coordinator.VRFCoordinatorCoordinatorDeregisteredIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*vrf_coordinator.VRFCoordinatorCoordinatorDeregisteredIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *vrf_coordinator.VRFCoordinatorCoordinatorDeregisteredIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorCoordinatorDeregisteredIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterCoordinatorRegistered provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) FilterCoordinatorRegistered(opts *bind.FilterOpts) (*vrf_coordinator.VRFCoordinatorCoordinatorRegisteredIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterCoordinatorRegistered") - } - - var r0 *vrf_coordinator.VRFCoordinatorCoordinatorRegisteredIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*vrf_coordinator.VRFCoordinatorCoordinatorRegisteredIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *vrf_coordinator.VRFCoordinatorCoordinatorRegisteredIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorCoordinatorRegisteredIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterMigrationCompleted provides a mock function with given fields: opts, newVersion, subID -func (_m *VRFCoordinatorInterface) FilterMigrationCompleted(opts *bind.FilterOpts, newVersion []uint8, subID []*big.Int) (*vrf_coordinator.VRFCoordinatorMigrationCompletedIterator, error) { - ret := _m.Called(opts, newVersion, subID) - - if len(ret) == 0 { - panic("no return value specified for FilterMigrationCompleted") - } - - var r0 *vrf_coordinator.VRFCoordinatorMigrationCompletedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint8, []*big.Int) (*vrf_coordinator.VRFCoordinatorMigrationCompletedIterator, error)); ok { - return rf(opts, newVersion, subID) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []uint8, []*big.Int) *vrf_coordinator.VRFCoordinatorMigrationCompletedIterator); ok { - r0 = rf(opts, newVersion, subID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorMigrationCompletedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []uint8, []*big.Int) error); ok { - r1 = rf(opts, newVersion, subID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterOutputsServed provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) FilterOutputsServed(opts *bind.FilterOpts) (*vrf_coordinator.VRFCoordinatorOutputsServedIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterOutputsServed") - } - - var r0 *vrf_coordinator.VRFCoordinatorOutputsServedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*vrf_coordinator.VRFCoordinatorOutputsServedIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *vrf_coordinator.VRFCoordinatorOutputsServedIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorOutputsServedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterOwnershipTransferRequested provides a mock function with given fields: opts, from, to -func (_m *VRFCoordinatorInterface) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*vrf_coordinator.VRFCoordinatorOwnershipTransferRequestedIterator, error) { - ret := _m.Called(opts, from, to) - - if len(ret) == 0 { - panic("no return value specified for FilterOwnershipTransferRequested") - } - - var r0 *vrf_coordinator.VRFCoordinatorOwnershipTransferRequestedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*vrf_coordinator.VRFCoordinatorOwnershipTransferRequestedIterator, error)); ok { - return rf(opts, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *vrf_coordinator.VRFCoordinatorOwnershipTransferRequestedIterator); ok { - r0 = rf(opts, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorOwnershipTransferRequestedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { - r1 = rf(opts, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterOwnershipTransferred provides a mock function with given fields: opts, from, to -func (_m *VRFCoordinatorInterface) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*vrf_coordinator.VRFCoordinatorOwnershipTransferredIterator, error) { - ret := _m.Called(opts, from, to) - - if len(ret) == 0 { - panic("no return value specified for FilterOwnershipTransferred") - } - - var r0 *vrf_coordinator.VRFCoordinatorOwnershipTransferredIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) (*vrf_coordinator.VRFCoordinatorOwnershipTransferredIterator, error)); ok { - return rf(opts, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []common.Address, []common.Address) *vrf_coordinator.VRFCoordinatorOwnershipTransferredIterator); ok { - r0 = rf(opts, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorOwnershipTransferredIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []common.Address, []common.Address) error); ok { - r1 = rf(opts, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterPauseFlagChanged provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) FilterPauseFlagChanged(opts *bind.FilterOpts) (*vrf_coordinator.VRFCoordinatorPauseFlagChangedIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterPauseFlagChanged") - } - - var r0 *vrf_coordinator.VRFCoordinatorPauseFlagChangedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*vrf_coordinator.VRFCoordinatorPauseFlagChangedIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *vrf_coordinator.VRFCoordinatorPauseFlagChangedIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorPauseFlagChangedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterRandomWordsFulfilled provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) FilterRandomWordsFulfilled(opts *bind.FilterOpts) (*vrf_coordinator.VRFCoordinatorRandomWordsFulfilledIterator, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for FilterRandomWordsFulfilled") - } - - var r0 *vrf_coordinator.VRFCoordinatorRandomWordsFulfilledIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) (*vrf_coordinator.VRFCoordinatorRandomWordsFulfilledIterator, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts) *vrf_coordinator.VRFCoordinatorRandomWordsFulfilledIterator); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorRandomWordsFulfilledIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterRandomnessFulfillmentRequested provides a mock function with given fields: opts, requestID -func (_m *VRFCoordinatorInterface) FilterRandomnessFulfillmentRequested(opts *bind.FilterOpts, requestID []*big.Int) (*vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequestedIterator, error) { - ret := _m.Called(opts, requestID) - - if len(ret) == 0 { - panic("no return value specified for FilterRandomnessFulfillmentRequested") - } - - var r0 *vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequestedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) (*vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequestedIterator, error)); ok { - return rf(opts, requestID) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) *vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequestedIterator); ok { - r0 = rf(opts, requestID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequestedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []*big.Int) error); ok { - r1 = rf(opts, requestID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterRandomnessRedeemed provides a mock function with given fields: opts, requestID, requester -func (_m *VRFCoordinatorInterface) FilterRandomnessRedeemed(opts *bind.FilterOpts, requestID []*big.Int, requester []common.Address) (*vrf_coordinator.VRFCoordinatorRandomnessRedeemedIterator, error) { - ret := _m.Called(opts, requestID, requester) - - if len(ret) == 0 { - panic("no return value specified for FilterRandomnessRedeemed") - } - - var r0 *vrf_coordinator.VRFCoordinatorRandomnessRedeemedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int, []common.Address) (*vrf_coordinator.VRFCoordinatorRandomnessRedeemedIterator, error)); ok { - return rf(opts, requestID, requester) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int, []common.Address) *vrf_coordinator.VRFCoordinatorRandomnessRedeemedIterator); ok { - r0 = rf(opts, requestID, requester) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorRandomnessRedeemedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []*big.Int, []common.Address) error); ok { - r1 = rf(opts, requestID, requester) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterRandomnessRequested provides a mock function with given fields: opts, requestID -func (_m *VRFCoordinatorInterface) FilterRandomnessRequested(opts *bind.FilterOpts, requestID []*big.Int) (*vrf_coordinator.VRFCoordinatorRandomnessRequestedIterator, error) { - ret := _m.Called(opts, requestID) - - if len(ret) == 0 { - panic("no return value specified for FilterRandomnessRequested") - } - - var r0 *vrf_coordinator.VRFCoordinatorRandomnessRequestedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) (*vrf_coordinator.VRFCoordinatorRandomnessRequestedIterator, error)); ok { - return rf(opts, requestID) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) *vrf_coordinator.VRFCoordinatorRandomnessRequestedIterator); ok { - r0 = rf(opts, requestID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorRandomnessRequestedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []*big.Int) error); ok { - r1 = rf(opts, requestID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterSubscriptionCanceled provides a mock function with given fields: opts, subId -func (_m *VRFCoordinatorInterface) FilterSubscriptionCanceled(opts *bind.FilterOpts, subId []*big.Int) (*vrf_coordinator.VRFCoordinatorSubscriptionCanceledIterator, error) { - ret := _m.Called(opts, subId) - - if len(ret) == 0 { - panic("no return value specified for FilterSubscriptionCanceled") - } - - var r0 *vrf_coordinator.VRFCoordinatorSubscriptionCanceledIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) (*vrf_coordinator.VRFCoordinatorSubscriptionCanceledIterator, error)); ok { - return rf(opts, subId) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) *vrf_coordinator.VRFCoordinatorSubscriptionCanceledIterator); ok { - r0 = rf(opts, subId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorSubscriptionCanceledIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []*big.Int) error); ok { - r1 = rf(opts, subId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterSubscriptionConsumerAdded provides a mock function with given fields: opts, subId -func (_m *VRFCoordinatorInterface) FilterSubscriptionConsumerAdded(opts *bind.FilterOpts, subId []*big.Int) (*vrf_coordinator.VRFCoordinatorSubscriptionConsumerAddedIterator, error) { - ret := _m.Called(opts, subId) - - if len(ret) == 0 { - panic("no return value specified for FilterSubscriptionConsumerAdded") - } - - var r0 *vrf_coordinator.VRFCoordinatorSubscriptionConsumerAddedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) (*vrf_coordinator.VRFCoordinatorSubscriptionConsumerAddedIterator, error)); ok { - return rf(opts, subId) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) *vrf_coordinator.VRFCoordinatorSubscriptionConsumerAddedIterator); ok { - r0 = rf(opts, subId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorSubscriptionConsumerAddedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []*big.Int) error); ok { - r1 = rf(opts, subId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterSubscriptionConsumerRemoved provides a mock function with given fields: opts, subId -func (_m *VRFCoordinatorInterface) FilterSubscriptionConsumerRemoved(opts *bind.FilterOpts, subId []*big.Int) (*vrf_coordinator.VRFCoordinatorSubscriptionConsumerRemovedIterator, error) { - ret := _m.Called(opts, subId) - - if len(ret) == 0 { - panic("no return value specified for FilterSubscriptionConsumerRemoved") - } - - var r0 *vrf_coordinator.VRFCoordinatorSubscriptionConsumerRemovedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) (*vrf_coordinator.VRFCoordinatorSubscriptionConsumerRemovedIterator, error)); ok { - return rf(opts, subId) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) *vrf_coordinator.VRFCoordinatorSubscriptionConsumerRemovedIterator); ok { - r0 = rf(opts, subId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorSubscriptionConsumerRemovedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []*big.Int) error); ok { - r1 = rf(opts, subId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterSubscriptionCreated provides a mock function with given fields: opts, subId, owner -func (_m *VRFCoordinatorInterface) FilterSubscriptionCreated(opts *bind.FilterOpts, subId []*big.Int, owner []common.Address) (*vrf_coordinator.VRFCoordinatorSubscriptionCreatedIterator, error) { - ret := _m.Called(opts, subId, owner) - - if len(ret) == 0 { - panic("no return value specified for FilterSubscriptionCreated") - } - - var r0 *vrf_coordinator.VRFCoordinatorSubscriptionCreatedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int, []common.Address) (*vrf_coordinator.VRFCoordinatorSubscriptionCreatedIterator, error)); ok { - return rf(opts, subId, owner) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int, []common.Address) *vrf_coordinator.VRFCoordinatorSubscriptionCreatedIterator); ok { - r0 = rf(opts, subId, owner) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorSubscriptionCreatedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []*big.Int, []common.Address) error); ok { - r1 = rf(opts, subId, owner) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterSubscriptionFunded provides a mock function with given fields: opts, subId -func (_m *VRFCoordinatorInterface) FilterSubscriptionFunded(opts *bind.FilterOpts, subId []*big.Int) (*vrf_coordinator.VRFCoordinatorSubscriptionFundedIterator, error) { - ret := _m.Called(opts, subId) - - if len(ret) == 0 { - panic("no return value specified for FilterSubscriptionFunded") - } - - var r0 *vrf_coordinator.VRFCoordinatorSubscriptionFundedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) (*vrf_coordinator.VRFCoordinatorSubscriptionFundedIterator, error)); ok { - return rf(opts, subId) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) *vrf_coordinator.VRFCoordinatorSubscriptionFundedIterator); ok { - r0 = rf(opts, subId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorSubscriptionFundedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []*big.Int) error); ok { - r1 = rf(opts, subId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterSubscriptionOwnerTransferRequested provides a mock function with given fields: opts, subId -func (_m *VRFCoordinatorInterface) FilterSubscriptionOwnerTransferRequested(opts *bind.FilterOpts, subId []*big.Int) (*vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferRequestedIterator, error) { - ret := _m.Called(opts, subId) - - if len(ret) == 0 { - panic("no return value specified for FilterSubscriptionOwnerTransferRequested") - } - - var r0 *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferRequestedIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) (*vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferRequestedIterator, error)); ok { - return rf(opts, subId) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferRequestedIterator); ok { - r0 = rf(opts, subId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferRequestedIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []*big.Int) error); ok { - r1 = rf(opts, subId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// FilterSubscriptionOwnerTransferred provides a mock function with given fields: opts, subId -func (_m *VRFCoordinatorInterface) FilterSubscriptionOwnerTransferred(opts *bind.FilterOpts, subId []*big.Int) (*vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferredIterator, error) { - ret := _m.Called(opts, subId) - - if len(ret) == 0 { - panic("no return value specified for FilterSubscriptionOwnerTransferred") - } - - var r0 *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferredIterator - var r1 error - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) (*vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferredIterator, error)); ok { - return rf(opts, subId) - } - if rf, ok := ret.Get(0).(func(*bind.FilterOpts, []*big.Int) *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferredIterator); ok { - r0 = rf(opts, subId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferredIterator) - } - } - - if rf, ok := ret.Get(1).(func(*bind.FilterOpts, []*big.Int) error); ok { - r1 = rf(opts, subId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetCallbackMemo provides a mock function with given fields: opts, requestId -func (_m *VRFCoordinatorInterface) GetCallbackMemo(opts *bind.CallOpts, requestId *big.Int) ([32]byte, error) { - ret := _m.Called(opts, requestId) - - if len(ret) == 0 { - panic("no return value specified for GetCallbackMemo") - } - - var r0 [32]byte - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, *big.Int) ([32]byte, error)); ok { - return rf(opts, requestId) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, *big.Int) [32]byte); ok { - r0 = rf(opts, requestId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([32]byte) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, *big.Int) error); ok { - r1 = rf(opts, requestId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetConfirmationDelays provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) GetConfirmationDelays(opts *bind.CallOpts) ([8]*big.Int, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for GetConfirmationDelays") - } - - var r0 [8]*big.Int - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) ([8]*big.Int, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) [8]*big.Int); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([8]*big.Int) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetFee provides a mock function with given fields: opts, arg0, arg1 -func (_m *VRFCoordinatorInterface) GetFee(opts *bind.CallOpts, arg0 *big.Int, arg1 []byte) (*big.Int, error) { - ret := _m.Called(opts, arg0, arg1) - - if len(ret) == 0 { - panic("no return value specified for GetFee") - } - - var r0 *big.Int - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, *big.Int, []byte) (*big.Int, error)); ok { - return rf(opts, arg0, arg1) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, *big.Int, []byte) *big.Int); ok { - r0 = rf(opts, arg0, arg1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*big.Int) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, *big.Int, []byte) error); ok { - r1 = rf(opts, arg0, arg1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetFulfillmentFee provides a mock function with given fields: opts, arg0, callbackGasLimit, arguments, arg3 -func (_m *VRFCoordinatorInterface) GetFulfillmentFee(opts *bind.CallOpts, arg0 *big.Int, callbackGasLimit uint32, arguments []byte, arg3 []byte) (*big.Int, error) { - ret := _m.Called(opts, arg0, callbackGasLimit, arguments, arg3) - - if len(ret) == 0 { - panic("no return value specified for GetFulfillmentFee") - } - - var r0 *big.Int - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, *big.Int, uint32, []byte, []byte) (*big.Int, error)); ok { - return rf(opts, arg0, callbackGasLimit, arguments, arg3) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, *big.Int, uint32, []byte, []byte) *big.Int); ok { - r0 = rf(opts, arg0, callbackGasLimit, arguments, arg3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*big.Int) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, *big.Int, uint32, []byte, []byte) error); ok { - r1 = rf(opts, arg0, callbackGasLimit, arguments, arg3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetSubscription provides a mock function with given fields: opts, subId -func (_m *VRFCoordinatorInterface) GetSubscription(opts *bind.CallOpts, subId *big.Int) (vrf_coordinator.GetSubscription, error) { - ret := _m.Called(opts, subId) - - if len(ret) == 0 { - panic("no return value specified for GetSubscription") - } - - var r0 vrf_coordinator.GetSubscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, *big.Int) (vrf_coordinator.GetSubscription, error)); ok { - return rf(opts, subId) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, *big.Int) vrf_coordinator.GetSubscription); ok { - r0 = rf(opts, subId) - } else { - r0 = ret.Get(0).(vrf_coordinator.GetSubscription) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, *big.Int) error); ok { - r1 = rf(opts, subId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetSubscriptionLinkBalance provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) GetSubscriptionLinkBalance(opts *bind.CallOpts) (*big.Int, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for GetSubscriptionLinkBalance") - } - - var r0 *big.Int - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (*big.Int, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) *big.Int); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*big.Int) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// IBeaconPeriodBlocks provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) IBeaconPeriodBlocks(opts *bind.CallOpts) (*big.Int, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for IBeaconPeriodBlocks") - } - - var r0 *big.Int - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (*big.Int, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) *big.Int); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*big.Int) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ILink provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) ILink(opts *bind.CallOpts) (common.Address, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for ILink") - } - - var r0 common.Address - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (common.Address, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) common.Address); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MAXCONSUMERS provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) MAXCONSUMERS(opts *bind.CallOpts) (uint16, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for MAXCONSUMERS") - } - - var r0 uint16 - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (uint16, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) uint16); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(uint16) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MAXNUMWORDS provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) MAXNUMWORDS(opts *bind.CallOpts) (*big.Int, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for MAXNUMWORDS") - } - - var r0 *big.Int - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (*big.Int, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) *big.Int); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*big.Int) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Migrate provides a mock function with given fields: opts, newCoordinator, encodedRequest -func (_m *VRFCoordinatorInterface) Migrate(opts *bind.TransactOpts, newCoordinator common.Address, encodedRequest []byte) (*types.Transaction, error) { - ret := _m.Called(opts, newCoordinator, encodedRequest) - - if len(ret) == 0 { - panic("no return value specified for Migrate") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address, []byte) (*types.Transaction, error)); ok { - return rf(opts, newCoordinator, encodedRequest) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address, []byte) *types.Transaction); ok { - r0 = rf(opts, newCoordinator, encodedRequest) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address, []byte) error); ok { - r1 = rf(opts, newCoordinator, encodedRequest) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MigrationVersion provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) MigrationVersion(opts *bind.CallOpts) (uint8, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for MigrationVersion") - } - - var r0 uint8 - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (uint8, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) uint8); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(uint8) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NUMCONFDELAYS provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) NUMCONFDELAYS(opts *bind.CallOpts) (uint8, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for NUMCONFDELAYS") - } - - var r0 uint8 - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (uint8, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) uint8); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(uint8) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// OnMigration provides a mock function with given fields: opts, arg0 -func (_m *VRFCoordinatorInterface) OnMigration(opts *bind.CallOpts, arg0 []byte) error { - ret := _m.Called(opts, arg0) - - if len(ret) == 0 { - panic("no return value specified for OnMigration") - } - - var r0 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, []byte) error); ok { - r0 = rf(opts, arg0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// OnTokenTransfer provides a mock function with given fields: opts, arg0, amount, data -func (_m *VRFCoordinatorInterface) OnTokenTransfer(opts *bind.TransactOpts, arg0 common.Address, amount *big.Int, data []byte) (*types.Transaction, error) { - ret := _m.Called(opts, arg0, amount, data) - - if len(ret) == 0 { - panic("no return value specified for OnTokenTransfer") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address, *big.Int, []byte) (*types.Transaction, error)); ok { - return rf(opts, arg0, amount, data) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address, *big.Int, []byte) *types.Transaction); ok { - r0 = rf(opts, arg0, amount, data) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address, *big.Int, []byte) error); ok { - r1 = rf(opts, arg0, amount, data) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Owner provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) Owner(opts *bind.CallOpts) (common.Address, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for Owner") - } - - var r0 common.Address - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (common.Address, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) common.Address); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseCallbackConfigSet provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseCallbackConfigSet(log types.Log) (*vrf_coordinator.VRFCoordinatorCallbackConfigSet, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseCallbackConfigSet") - } - - var r0 *vrf_coordinator.VRFCoordinatorCallbackConfigSet - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorCallbackConfigSet, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorCallbackConfigSet); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorCallbackConfigSet) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseCoordinatorConfigSet provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseCoordinatorConfigSet(log types.Log) (*vrf_coordinator.VRFCoordinatorCoordinatorConfigSet, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseCoordinatorConfigSet") - } - - var r0 *vrf_coordinator.VRFCoordinatorCoordinatorConfigSet - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorCoordinatorConfigSet, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorCoordinatorConfigSet); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorCoordinatorConfigSet) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseCoordinatorDeregistered provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseCoordinatorDeregistered(log types.Log) (*vrf_coordinator.VRFCoordinatorCoordinatorDeregistered, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseCoordinatorDeregistered") - } - - var r0 *vrf_coordinator.VRFCoordinatorCoordinatorDeregistered - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorCoordinatorDeregistered, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorCoordinatorDeregistered); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorCoordinatorDeregistered) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseCoordinatorRegistered provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseCoordinatorRegistered(log types.Log) (*vrf_coordinator.VRFCoordinatorCoordinatorRegistered, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseCoordinatorRegistered") - } - - var r0 *vrf_coordinator.VRFCoordinatorCoordinatorRegistered - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorCoordinatorRegistered, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorCoordinatorRegistered); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorCoordinatorRegistered) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseLog provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseLog(log types.Log) (generated.AbigenLog, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseLog") - } - - var r0 generated.AbigenLog - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (generated.AbigenLog, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) generated.AbigenLog); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(generated.AbigenLog) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseMigrationCompleted provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseMigrationCompleted(log types.Log) (*vrf_coordinator.VRFCoordinatorMigrationCompleted, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseMigrationCompleted") - } - - var r0 *vrf_coordinator.VRFCoordinatorMigrationCompleted - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorMigrationCompleted, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorMigrationCompleted); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorMigrationCompleted) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseOutputsServed provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseOutputsServed(log types.Log) (*vrf_coordinator.VRFCoordinatorOutputsServed, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseOutputsServed") - } - - var r0 *vrf_coordinator.VRFCoordinatorOutputsServed - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorOutputsServed, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorOutputsServed); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorOutputsServed) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseOwnershipTransferRequested provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseOwnershipTransferRequested(log types.Log) (*vrf_coordinator.VRFCoordinatorOwnershipTransferRequested, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseOwnershipTransferRequested") - } - - var r0 *vrf_coordinator.VRFCoordinatorOwnershipTransferRequested - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorOwnershipTransferRequested, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorOwnershipTransferRequested); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorOwnershipTransferRequested) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseOwnershipTransferred provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseOwnershipTransferred(log types.Log) (*vrf_coordinator.VRFCoordinatorOwnershipTransferred, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseOwnershipTransferred") - } - - var r0 *vrf_coordinator.VRFCoordinatorOwnershipTransferred - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorOwnershipTransferred, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorOwnershipTransferred); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorOwnershipTransferred) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParsePauseFlagChanged provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParsePauseFlagChanged(log types.Log) (*vrf_coordinator.VRFCoordinatorPauseFlagChanged, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParsePauseFlagChanged") - } - - var r0 *vrf_coordinator.VRFCoordinatorPauseFlagChanged - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorPauseFlagChanged, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorPauseFlagChanged); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorPauseFlagChanged) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseRandomWordsFulfilled provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseRandomWordsFulfilled(log types.Log) (*vrf_coordinator.VRFCoordinatorRandomWordsFulfilled, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseRandomWordsFulfilled") - } - - var r0 *vrf_coordinator.VRFCoordinatorRandomWordsFulfilled - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorRandomWordsFulfilled, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorRandomWordsFulfilled); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorRandomWordsFulfilled) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseRandomnessFulfillmentRequested provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseRandomnessFulfillmentRequested(log types.Log) (*vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequested, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseRandomnessFulfillmentRequested") - } - - var r0 *vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequested - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequested, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequested); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequested) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseRandomnessRedeemed provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseRandomnessRedeemed(log types.Log) (*vrf_coordinator.VRFCoordinatorRandomnessRedeemed, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseRandomnessRedeemed") - } - - var r0 *vrf_coordinator.VRFCoordinatorRandomnessRedeemed - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorRandomnessRedeemed, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorRandomnessRedeemed); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorRandomnessRedeemed) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseRandomnessRequested provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseRandomnessRequested(log types.Log) (*vrf_coordinator.VRFCoordinatorRandomnessRequested, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseRandomnessRequested") - } - - var r0 *vrf_coordinator.VRFCoordinatorRandomnessRequested - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorRandomnessRequested, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorRandomnessRequested); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorRandomnessRequested) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseSubscriptionCanceled provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseSubscriptionCanceled(log types.Log) (*vrf_coordinator.VRFCoordinatorSubscriptionCanceled, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseSubscriptionCanceled") - } - - var r0 *vrf_coordinator.VRFCoordinatorSubscriptionCanceled - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorSubscriptionCanceled, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorSubscriptionCanceled); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorSubscriptionCanceled) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseSubscriptionConsumerAdded provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseSubscriptionConsumerAdded(log types.Log) (*vrf_coordinator.VRFCoordinatorSubscriptionConsumerAdded, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseSubscriptionConsumerAdded") - } - - var r0 *vrf_coordinator.VRFCoordinatorSubscriptionConsumerAdded - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorSubscriptionConsumerAdded, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorSubscriptionConsumerAdded); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorSubscriptionConsumerAdded) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseSubscriptionConsumerRemoved provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseSubscriptionConsumerRemoved(log types.Log) (*vrf_coordinator.VRFCoordinatorSubscriptionConsumerRemoved, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseSubscriptionConsumerRemoved") - } - - var r0 *vrf_coordinator.VRFCoordinatorSubscriptionConsumerRemoved - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorSubscriptionConsumerRemoved, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorSubscriptionConsumerRemoved); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorSubscriptionConsumerRemoved) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseSubscriptionCreated provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseSubscriptionCreated(log types.Log) (*vrf_coordinator.VRFCoordinatorSubscriptionCreated, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseSubscriptionCreated") - } - - var r0 *vrf_coordinator.VRFCoordinatorSubscriptionCreated - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorSubscriptionCreated, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorSubscriptionCreated); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorSubscriptionCreated) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseSubscriptionFunded provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseSubscriptionFunded(log types.Log) (*vrf_coordinator.VRFCoordinatorSubscriptionFunded, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseSubscriptionFunded") - } - - var r0 *vrf_coordinator.VRFCoordinatorSubscriptionFunded - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorSubscriptionFunded, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorSubscriptionFunded); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorSubscriptionFunded) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseSubscriptionOwnerTransferRequested provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseSubscriptionOwnerTransferRequested(log types.Log) (*vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferRequested, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseSubscriptionOwnerTransferRequested") - } - - var r0 *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferRequested - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferRequested, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferRequested); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferRequested) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ParseSubscriptionOwnerTransferred provides a mock function with given fields: log -func (_m *VRFCoordinatorInterface) ParseSubscriptionOwnerTransferred(log types.Log) (*vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferred, error) { - ret := _m.Called(log) - - if len(ret) == 0 { - panic("no return value specified for ParseSubscriptionOwnerTransferred") - } - - var r0 *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferred - var r1 error - if rf, ok := ret.Get(0).(func(types.Log) (*vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferred, error)); ok { - return rf(log) - } - if rf, ok := ret.Get(0).(func(types.Log) *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferred); ok { - r0 = rf(log) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferred) - } - } - - if rf, ok := ret.Get(1).(func(types.Log) error); ok { - r1 = rf(log) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ProcessVRFOutputs provides a mock function with given fields: opts, vrfOutputs, juelsPerFeeCoin, reasonableGasPrice, blockHeight -func (_m *VRFCoordinatorInterface) ProcessVRFOutputs(opts *bind.TransactOpts, vrfOutputs []vrf_coordinator.VRFBeaconTypesVRFOutput, juelsPerFeeCoin *big.Int, reasonableGasPrice uint64, blockHeight uint64) (*types.Transaction, error) { - ret := _m.Called(opts, vrfOutputs, juelsPerFeeCoin, reasonableGasPrice, blockHeight) - - if len(ret) == 0 { - panic("no return value specified for ProcessVRFOutputs") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []vrf_coordinator.VRFBeaconTypesVRFOutput, *big.Int, uint64, uint64) (*types.Transaction, error)); ok { - return rf(opts, vrfOutputs, juelsPerFeeCoin, reasonableGasPrice, blockHeight) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, []vrf_coordinator.VRFBeaconTypesVRFOutput, *big.Int, uint64, uint64) *types.Transaction); ok { - r0 = rf(opts, vrfOutputs, juelsPerFeeCoin, reasonableGasPrice, blockHeight) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, []vrf_coordinator.VRFBeaconTypesVRFOutput, *big.Int, uint64, uint64) error); ok { - r1 = rf(opts, vrfOutputs, juelsPerFeeCoin, reasonableGasPrice, blockHeight) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RedeemRandomness provides a mock function with given fields: opts, subID, requestID, arg2 -func (_m *VRFCoordinatorInterface) RedeemRandomness(opts *bind.TransactOpts, subID *big.Int, requestID *big.Int, arg2 []byte) (*types.Transaction, error) { - ret := _m.Called(opts, subID, requestID, arg2) - - if len(ret) == 0 { - panic("no return value specified for RedeemRandomness") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int, *big.Int, []byte) (*types.Transaction, error)); ok { - return rf(opts, subID, requestID, arg2) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int, *big.Int, []byte) *types.Transaction); ok { - r0 = rf(opts, subID, requestID, arg2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, *big.Int, *big.Int, []byte) error); ok { - r1 = rf(opts, subID, requestID, arg2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RegisterMigratableCoordinator provides a mock function with given fields: opts, target -func (_m *VRFCoordinatorInterface) RegisterMigratableCoordinator(opts *bind.TransactOpts, target common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, target) - - if len(ret) == 0 { - panic("no return value specified for RegisterMigratableCoordinator") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { - return rf(opts, target) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { - r0 = rf(opts, target) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { - r1 = rf(opts, target) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RemoveConsumer provides a mock function with given fields: opts, subId, consumer -func (_m *VRFCoordinatorInterface) RemoveConsumer(opts *bind.TransactOpts, subId *big.Int, consumer common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, subId, consumer) - - if len(ret) == 0 { - panic("no return value specified for RemoveConsumer") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int, common.Address) (*types.Transaction, error)); ok { - return rf(opts, subId, consumer) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int, common.Address) *types.Transaction); ok { - r0 = rf(opts, subId, consumer) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, *big.Int, common.Address) error); ok { - r1 = rf(opts, subId, consumer) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RequestRandomness provides a mock function with given fields: opts, subID, numWords, confDelay, arg3 -func (_m *VRFCoordinatorInterface) RequestRandomness(opts *bind.TransactOpts, subID *big.Int, numWords uint16, confDelay *big.Int, arg3 []byte) (*types.Transaction, error) { - ret := _m.Called(opts, subID, numWords, confDelay, arg3) - - if len(ret) == 0 { - panic("no return value specified for RequestRandomness") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int, uint16, *big.Int, []byte) (*types.Transaction, error)); ok { - return rf(opts, subID, numWords, confDelay, arg3) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int, uint16, *big.Int, []byte) *types.Transaction); ok { - r0 = rf(opts, subID, numWords, confDelay, arg3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, *big.Int, uint16, *big.Int, []byte) error); ok { - r1 = rf(opts, subID, numWords, confDelay, arg3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RequestRandomnessFulfillment provides a mock function with given fields: opts, subID, numWords, confDelay, callbackGasLimit, arguments, arg5 -func (_m *VRFCoordinatorInterface) RequestRandomnessFulfillment(opts *bind.TransactOpts, subID *big.Int, numWords uint16, confDelay *big.Int, callbackGasLimit uint32, arguments []byte, arg5 []byte) (*types.Transaction, error) { - ret := _m.Called(opts, subID, numWords, confDelay, callbackGasLimit, arguments, arg5) - - if len(ret) == 0 { - panic("no return value specified for RequestRandomnessFulfillment") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int, uint16, *big.Int, uint32, []byte, []byte) (*types.Transaction, error)); ok { - return rf(opts, subID, numWords, confDelay, callbackGasLimit, arguments, arg5) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int, uint16, *big.Int, uint32, []byte, []byte) *types.Transaction); ok { - r0 = rf(opts, subID, numWords, confDelay, callbackGasLimit, arguments, arg5) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, *big.Int, uint16, *big.Int, uint32, []byte, []byte) error); ok { - r1 = rf(opts, subID, numWords, confDelay, callbackGasLimit, arguments, arg5) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RequestSubscriptionOwnerTransfer provides a mock function with given fields: opts, subId, newOwner -func (_m *VRFCoordinatorInterface) RequestSubscriptionOwnerTransfer(opts *bind.TransactOpts, subId *big.Int, newOwner common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, subId, newOwner) - - if len(ret) == 0 { - panic("no return value specified for RequestSubscriptionOwnerTransfer") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int, common.Address) (*types.Transaction, error)); ok { - return rf(opts, subId, newOwner) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, *big.Int, common.Address) *types.Transaction); ok { - r0 = rf(opts, subId, newOwner) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, *big.Int, common.Address) error); ok { - r1 = rf(opts, subId, newOwner) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SCallbackConfig provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) SCallbackConfig(opts *bind.CallOpts) (vrf_coordinator.SCallbackConfig, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for SCallbackConfig") - } - - var r0 vrf_coordinator.SCallbackConfig - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (vrf_coordinator.SCallbackConfig, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) vrf_coordinator.SCallbackConfig); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(vrf_coordinator.SCallbackConfig) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SCoordinatorConfig provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) SCoordinatorConfig(opts *bind.CallOpts) (vrf_coordinator.SCoordinatorConfig, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for SCoordinatorConfig") - } - - var r0 vrf_coordinator.SCoordinatorConfig - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (vrf_coordinator.SCoordinatorConfig, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) vrf_coordinator.SCoordinatorConfig); ok { - r0 = rf(opts) - } else { - r0 = ret.Get(0).(vrf_coordinator.SCoordinatorConfig) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SPendingRequests provides a mock function with given fields: opts, arg0 -func (_m *VRFCoordinatorInterface) SPendingRequests(opts *bind.CallOpts, arg0 *big.Int) (vrf_coordinator.SPendingRequests, error) { - ret := _m.Called(opts, arg0) - - if len(ret) == 0 { - panic("no return value specified for SPendingRequests") - } - - var r0 vrf_coordinator.SPendingRequests - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts, *big.Int) (vrf_coordinator.SPendingRequests, error)); ok { - return rf(opts, arg0) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts, *big.Int) vrf_coordinator.SPendingRequests); ok { - r0 = rf(opts, arg0) - } else { - r0 = ret.Get(0).(vrf_coordinator.SPendingRequests) - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts, *big.Int) error); ok { - r1 = rf(opts, arg0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SProducer provides a mock function with given fields: opts -func (_m *VRFCoordinatorInterface) SProducer(opts *bind.CallOpts) (common.Address, error) { - ret := _m.Called(opts) - - if len(ret) == 0 { - panic("no return value specified for SProducer") - } - - var r0 common.Address - var r1 error - if rf, ok := ret.Get(0).(func(*bind.CallOpts) (common.Address, error)); ok { - return rf(opts) - } - if rf, ok := ret.Get(0).(func(*bind.CallOpts) common.Address); ok { - r0 = rf(opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(common.Address) - } - } - - if rf, ok := ret.Get(1).(func(*bind.CallOpts) error); ok { - r1 = rf(opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SetCallbackConfig provides a mock function with given fields: opts, config -func (_m *VRFCoordinatorInterface) SetCallbackConfig(opts *bind.TransactOpts, config vrf_coordinator.VRFCoordinatorCallbackConfig) (*types.Transaction, error) { - ret := _m.Called(opts, config) - - if len(ret) == 0 { - panic("no return value specified for SetCallbackConfig") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, vrf_coordinator.VRFCoordinatorCallbackConfig) (*types.Transaction, error)); ok { - return rf(opts, config) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, vrf_coordinator.VRFCoordinatorCallbackConfig) *types.Transaction); ok { - r0 = rf(opts, config) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, vrf_coordinator.VRFCoordinatorCallbackConfig) error); ok { - r1 = rf(opts, config) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SetConfirmationDelays provides a mock function with given fields: opts, confDelays -func (_m *VRFCoordinatorInterface) SetConfirmationDelays(opts *bind.TransactOpts, confDelays [8]*big.Int) (*types.Transaction, error) { - ret := _m.Called(opts, confDelays) - - if len(ret) == 0 { - panic("no return value specified for SetConfirmationDelays") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [8]*big.Int) (*types.Transaction, error)); ok { - return rf(opts, confDelays) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, [8]*big.Int) *types.Transaction); ok { - r0 = rf(opts, confDelays) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, [8]*big.Int) error); ok { - r1 = rf(opts, confDelays) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SetCoordinatorConfig provides a mock function with given fields: opts, coordinatorConfig -func (_m *VRFCoordinatorInterface) SetCoordinatorConfig(opts *bind.TransactOpts, coordinatorConfig vrf_coordinator.VRFBeaconTypesCoordinatorConfig) (*types.Transaction, error) { - ret := _m.Called(opts, coordinatorConfig) - - if len(ret) == 0 { - panic("no return value specified for SetCoordinatorConfig") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, vrf_coordinator.VRFBeaconTypesCoordinatorConfig) (*types.Transaction, error)); ok { - return rf(opts, coordinatorConfig) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, vrf_coordinator.VRFBeaconTypesCoordinatorConfig) *types.Transaction); ok { - r0 = rf(opts, coordinatorConfig) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, vrf_coordinator.VRFBeaconTypesCoordinatorConfig) error); ok { - r1 = rf(opts, coordinatorConfig) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SetPauseFlag provides a mock function with given fields: opts, pause -func (_m *VRFCoordinatorInterface) SetPauseFlag(opts *bind.TransactOpts, pause bool) (*types.Transaction, error) { - ret := _m.Called(opts, pause) - - if len(ret) == 0 { - panic("no return value specified for SetPauseFlag") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, bool) (*types.Transaction, error)); ok { - return rf(opts, pause) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, bool) *types.Transaction); ok { - r0 = rf(opts, pause) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, bool) error); ok { - r1 = rf(opts, pause) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SetProducer provides a mock function with given fields: opts, producer -func (_m *VRFCoordinatorInterface) SetProducer(opts *bind.TransactOpts, producer common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, producer) - - if len(ret) == 0 { - panic("no return value specified for SetProducer") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { - return rf(opts, producer) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { - r0 = rf(opts, producer) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { - r1 = rf(opts, producer) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// TransferLink provides a mock function with given fields: opts, recipient, juelsAmount -func (_m *VRFCoordinatorInterface) TransferLink(opts *bind.TransactOpts, recipient common.Address, juelsAmount *big.Int) (*types.Transaction, error) { - ret := _m.Called(opts, recipient, juelsAmount) - - if len(ret) == 0 { - panic("no return value specified for TransferLink") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address, *big.Int) (*types.Transaction, error)); ok { - return rf(opts, recipient, juelsAmount) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address, *big.Int) *types.Transaction); ok { - r0 = rf(opts, recipient, juelsAmount) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address, *big.Int) error); ok { - r1 = rf(opts, recipient, juelsAmount) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// TransferOwnership provides a mock function with given fields: opts, to -func (_m *VRFCoordinatorInterface) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - ret := _m.Called(opts, to) - - if len(ret) == 0 { - panic("no return value specified for TransferOwnership") - } - - var r0 *types.Transaction - var r1 error - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) (*types.Transaction, error)); ok { - return rf(opts, to) - } - if rf, ok := ret.Get(0).(func(*bind.TransactOpts, common.Address) *types.Transaction); ok { - r0 = rf(opts, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.Transaction) - } - } - - if rf, ok := ret.Get(1).(func(*bind.TransactOpts, common.Address) error); ok { - r1 = rf(opts, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchCallbackConfigSet provides a mock function with given fields: opts, sink -func (_m *VRFCoordinatorInterface) WatchCallbackConfigSet(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorCallbackConfigSet) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchCallbackConfigSet") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorCallbackConfigSet) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorCallbackConfigSet) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorCallbackConfigSet) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchCoordinatorConfigSet provides a mock function with given fields: opts, sink -func (_m *VRFCoordinatorInterface) WatchCoordinatorConfigSet(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorCoordinatorConfigSet) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchCoordinatorConfigSet") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorCoordinatorConfigSet) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorCoordinatorConfigSet) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorCoordinatorConfigSet) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchCoordinatorDeregistered provides a mock function with given fields: opts, sink -func (_m *VRFCoordinatorInterface) WatchCoordinatorDeregistered(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorCoordinatorDeregistered) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchCoordinatorDeregistered") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorCoordinatorDeregistered) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorCoordinatorDeregistered) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorCoordinatorDeregistered) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchCoordinatorRegistered provides a mock function with given fields: opts, sink -func (_m *VRFCoordinatorInterface) WatchCoordinatorRegistered(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorCoordinatorRegistered) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchCoordinatorRegistered") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorCoordinatorRegistered) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorCoordinatorRegistered) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorCoordinatorRegistered) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchMigrationCompleted provides a mock function with given fields: opts, sink, newVersion, subID -func (_m *VRFCoordinatorInterface) WatchMigrationCompleted(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorMigrationCompleted, newVersion []uint8, subID []*big.Int) (event.Subscription, error) { - ret := _m.Called(opts, sink, newVersion, subID) - - if len(ret) == 0 { - panic("no return value specified for WatchMigrationCompleted") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorMigrationCompleted, []uint8, []*big.Int) (event.Subscription, error)); ok { - return rf(opts, sink, newVersion, subID) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorMigrationCompleted, []uint8, []*big.Int) event.Subscription); ok { - r0 = rf(opts, sink, newVersion, subID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorMigrationCompleted, []uint8, []*big.Int) error); ok { - r1 = rf(opts, sink, newVersion, subID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchOutputsServed provides a mock function with given fields: opts, sink -func (_m *VRFCoordinatorInterface) WatchOutputsServed(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorOutputsServed) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchOutputsServed") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorOutputsServed) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorOutputsServed) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorOutputsServed) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchOwnershipTransferRequested provides a mock function with given fields: opts, sink, from, to -func (_m *VRFCoordinatorInterface) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, from, to) - - if len(ret) == 0 { - panic("no return value specified for WatchOwnershipTransferRequested") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorOwnershipTransferRequested, []common.Address, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorOwnershipTransferRequested, []common.Address, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorOwnershipTransferRequested, []common.Address, []common.Address) error); ok { - r1 = rf(opts, sink, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchOwnershipTransferred provides a mock function with given fields: opts, sink, from, to -func (_m *VRFCoordinatorInterface) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, from, to) - - if len(ret) == 0 { - panic("no return value specified for WatchOwnershipTransferred") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorOwnershipTransferred, []common.Address, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, from, to) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorOwnershipTransferred, []common.Address, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, from, to) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorOwnershipTransferred, []common.Address, []common.Address) error); ok { - r1 = rf(opts, sink, from, to) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchPauseFlagChanged provides a mock function with given fields: opts, sink -func (_m *VRFCoordinatorInterface) WatchPauseFlagChanged(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorPauseFlagChanged) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchPauseFlagChanged") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorPauseFlagChanged) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorPauseFlagChanged) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorPauseFlagChanged) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchRandomWordsFulfilled provides a mock function with given fields: opts, sink -func (_m *VRFCoordinatorInterface) WatchRandomWordsFulfilled(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorRandomWordsFulfilled) (event.Subscription, error) { - ret := _m.Called(opts, sink) - - if len(ret) == 0 { - panic("no return value specified for WatchRandomWordsFulfilled") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorRandomWordsFulfilled) (event.Subscription, error)); ok { - return rf(opts, sink) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorRandomWordsFulfilled) event.Subscription); ok { - r0 = rf(opts, sink) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorRandomWordsFulfilled) error); ok { - r1 = rf(opts, sink) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchRandomnessFulfillmentRequested provides a mock function with given fields: opts, sink, requestID -func (_m *VRFCoordinatorInterface) WatchRandomnessFulfillmentRequested(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequested, requestID []*big.Int) (event.Subscription, error) { - ret := _m.Called(opts, sink, requestID) - - if len(ret) == 0 { - panic("no return value specified for WatchRandomnessFulfillmentRequested") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequested, []*big.Int) (event.Subscription, error)); ok { - return rf(opts, sink, requestID) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequested, []*big.Int) event.Subscription); ok { - r0 = rf(opts, sink, requestID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequested, []*big.Int) error); ok { - r1 = rf(opts, sink, requestID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchRandomnessRedeemed provides a mock function with given fields: opts, sink, requestID, requester -func (_m *VRFCoordinatorInterface) WatchRandomnessRedeemed(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorRandomnessRedeemed, requestID []*big.Int, requester []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, requestID, requester) - - if len(ret) == 0 { - panic("no return value specified for WatchRandomnessRedeemed") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorRandomnessRedeemed, []*big.Int, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, requestID, requester) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorRandomnessRedeemed, []*big.Int, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, requestID, requester) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorRandomnessRedeemed, []*big.Int, []common.Address) error); ok { - r1 = rf(opts, sink, requestID, requester) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchRandomnessRequested provides a mock function with given fields: opts, sink, requestID -func (_m *VRFCoordinatorInterface) WatchRandomnessRequested(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorRandomnessRequested, requestID []*big.Int) (event.Subscription, error) { - ret := _m.Called(opts, sink, requestID) - - if len(ret) == 0 { - panic("no return value specified for WatchRandomnessRequested") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorRandomnessRequested, []*big.Int) (event.Subscription, error)); ok { - return rf(opts, sink, requestID) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorRandomnessRequested, []*big.Int) event.Subscription); ok { - r0 = rf(opts, sink, requestID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorRandomnessRequested, []*big.Int) error); ok { - r1 = rf(opts, sink, requestID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchSubscriptionCanceled provides a mock function with given fields: opts, sink, subId -func (_m *VRFCoordinatorInterface) WatchSubscriptionCanceled(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorSubscriptionCanceled, subId []*big.Int) (event.Subscription, error) { - ret := _m.Called(opts, sink, subId) - - if len(ret) == 0 { - panic("no return value specified for WatchSubscriptionCanceled") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionCanceled, []*big.Int) (event.Subscription, error)); ok { - return rf(opts, sink, subId) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionCanceled, []*big.Int) event.Subscription); ok { - r0 = rf(opts, sink, subId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionCanceled, []*big.Int) error); ok { - r1 = rf(opts, sink, subId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchSubscriptionConsumerAdded provides a mock function with given fields: opts, sink, subId -func (_m *VRFCoordinatorInterface) WatchSubscriptionConsumerAdded(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorSubscriptionConsumerAdded, subId []*big.Int) (event.Subscription, error) { - ret := _m.Called(opts, sink, subId) - - if len(ret) == 0 { - panic("no return value specified for WatchSubscriptionConsumerAdded") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionConsumerAdded, []*big.Int) (event.Subscription, error)); ok { - return rf(opts, sink, subId) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionConsumerAdded, []*big.Int) event.Subscription); ok { - r0 = rf(opts, sink, subId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionConsumerAdded, []*big.Int) error); ok { - r1 = rf(opts, sink, subId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchSubscriptionConsumerRemoved provides a mock function with given fields: opts, sink, subId -func (_m *VRFCoordinatorInterface) WatchSubscriptionConsumerRemoved(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorSubscriptionConsumerRemoved, subId []*big.Int) (event.Subscription, error) { - ret := _m.Called(opts, sink, subId) - - if len(ret) == 0 { - panic("no return value specified for WatchSubscriptionConsumerRemoved") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionConsumerRemoved, []*big.Int) (event.Subscription, error)); ok { - return rf(opts, sink, subId) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionConsumerRemoved, []*big.Int) event.Subscription); ok { - r0 = rf(opts, sink, subId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionConsumerRemoved, []*big.Int) error); ok { - r1 = rf(opts, sink, subId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchSubscriptionCreated provides a mock function with given fields: opts, sink, subId, owner -func (_m *VRFCoordinatorInterface) WatchSubscriptionCreated(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorSubscriptionCreated, subId []*big.Int, owner []common.Address) (event.Subscription, error) { - ret := _m.Called(opts, sink, subId, owner) - - if len(ret) == 0 { - panic("no return value specified for WatchSubscriptionCreated") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionCreated, []*big.Int, []common.Address) (event.Subscription, error)); ok { - return rf(opts, sink, subId, owner) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionCreated, []*big.Int, []common.Address) event.Subscription); ok { - r0 = rf(opts, sink, subId, owner) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionCreated, []*big.Int, []common.Address) error); ok { - r1 = rf(opts, sink, subId, owner) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchSubscriptionFunded provides a mock function with given fields: opts, sink, subId -func (_m *VRFCoordinatorInterface) WatchSubscriptionFunded(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorSubscriptionFunded, subId []*big.Int) (event.Subscription, error) { - ret := _m.Called(opts, sink, subId) - - if len(ret) == 0 { - panic("no return value specified for WatchSubscriptionFunded") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionFunded, []*big.Int) (event.Subscription, error)); ok { - return rf(opts, sink, subId) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionFunded, []*big.Int) event.Subscription); ok { - r0 = rf(opts, sink, subId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionFunded, []*big.Int) error); ok { - r1 = rf(opts, sink, subId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchSubscriptionOwnerTransferRequested provides a mock function with given fields: opts, sink, subId -func (_m *VRFCoordinatorInterface) WatchSubscriptionOwnerTransferRequested(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferRequested, subId []*big.Int) (event.Subscription, error) { - ret := _m.Called(opts, sink, subId) - - if len(ret) == 0 { - panic("no return value specified for WatchSubscriptionOwnerTransferRequested") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferRequested, []*big.Int) (event.Subscription, error)); ok { - return rf(opts, sink, subId) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferRequested, []*big.Int) event.Subscription); ok { - r0 = rf(opts, sink, subId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferRequested, []*big.Int) error); ok { - r1 = rf(opts, sink, subId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WatchSubscriptionOwnerTransferred provides a mock function with given fields: opts, sink, subId -func (_m *VRFCoordinatorInterface) WatchSubscriptionOwnerTransferred(opts *bind.WatchOpts, sink chan<- *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferred, subId []*big.Int) (event.Subscription, error) { - ret := _m.Called(opts, sink, subId) - - if len(ret) == 0 { - panic("no return value specified for WatchSubscriptionOwnerTransferred") - } - - var r0 event.Subscription - var r1 error - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferred, []*big.Int) (event.Subscription, error)); ok { - return rf(opts, sink, subId) - } - if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferred, []*big.Int) event.Subscription); ok { - r0 = rf(opts, sink, subId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(event.Subscription) - } - } - - if rf, ok := ret.Get(1).(func(*bind.WatchOpts, chan<- *vrf_coordinator.VRFCoordinatorSubscriptionOwnerTransferred, []*big.Int) error); ok { - r1 = rf(opts, sink, subId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewVRFCoordinatorInterface creates a new instance of VRFCoordinatorInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewVRFCoordinatorInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *VRFCoordinatorInterface { - mock := &VRFCoordinatorInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/ocr_cache.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/ocr_cache.go deleted file mode 100644 index 0dab659258e..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/ocr_cache.go +++ /dev/null @@ -1,121 +0,0 @@ -package coordinator - -import ( - "runtime" - "sync" - "time" - - "github.com/ethereum/go-ethereum/common" -) - -// ocrCache is a caching strucuture that allows items to be stored and then evicted -// based on an eviction window. In this package, it is being used to track in-flight -// items the coordinator includes in OCR reports, such that the items can be checked against -// the cache to avoid double-transmissions. -type ocrCache[T any] struct { - evictionWindow time.Duration - cacheMu sync.Mutex - cache map[common.Hash]*cacheItem[T] - cleaner *intervalCacheCleaner[T] -} - -type cacheItem[T any] struct { - item T - itemKey common.Hash - timeStored time.Time -} - -// NewBlockCache constructs a new cache. -func NewBlockCache[T any](evictionWindow time.Duration) *ocrCache[T] { - // Construct cache cleaner to evict old items. - cleaner := &intervalCacheCleaner[T]{ - interval: evictionWindow, - stop: make(chan struct{}, 1), - } - - // Instantiate the cache for type T. - cache := &ocrCache[T]{ - cacheMu: sync.Mutex{}, - cache: make(map[common.Hash]*cacheItem[T]), - evictionWindow: evictionWindow, - cleaner: cleaner, - } - - // Stop the cleaner upon garbage collection of the cache. - runtime.SetFinalizer(cache, func(b *ocrCache[T]) { b.cleaner.stop <- struct{}{} }) - - return cache -} - -// AddItem adds an item to the cache. -func (l *ocrCache[T]) CacheItem(item T, itemKey common.Hash, timeStored time.Time) { - // Construct new item to be stored. - newItem := &cacheItem[T]{ - item: item, - itemKey: itemKey, - timeStored: timeStored, - } - - // Lock, and defer unlock. - l.cacheMu.Lock() - defer l.cacheMu.Unlock() - - // Assign item to key. - l.cache[itemKey] = newItem -} - -func (l *ocrCache[T]) SetEvictonWindow(newWindow time.Duration) { - l.evictionWindow = newWindow -} - -// AddItem adds an item to the cache. -func (l *ocrCache[T]) GetItem(itemKey common.Hash) (item *T) { - // Lock, and defer unlock. - l.cacheMu.Lock() - defer l.cacheMu.Unlock() - - // Construct new item to be stored. - cacheItem := l.cache[itemKey] - - // Return nil if the item is not found, otherwise return item. - if cacheItem == nil { - return - } - - return &cacheItem.item -} - -// EvictExpiredItems removes all expired items stored in the cache. -func (l *ocrCache[T]) EvictExpiredItems(currentTime time.Time) { - // Lock, and defer unlock. - l.cacheMu.Lock() - defer l.cacheMu.Unlock() - - // Iteratively check all item ages, and delete an item if it is expired. - for key, item := range l.cache { - diff := currentTime.Sub(item.timeStored) - if diff > l.evictionWindow { - delete(l.cache, key) - } - } -} - -// A cache cleaner that evicts items on a regular interval. -type intervalCacheCleaner[T any] struct { - interval time.Duration - stop chan struct{} -} - -// Run evicts expired items every n seconds, until the "stop" channel is triggered. -func (ic *intervalCacheCleaner[T]) Run(c *ocrCache[T]) { - ticker := time.NewTicker(ic.interval) - for { - select { - case <-ticker.C: - c.EvictExpiredItems(time.Now().UTC()) - case <-ic.stop: - ticker.Stop() - return - } - } -} diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/ocr_cache_test.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/ocr_cache_test.go deleted file mode 100644 index b4be43420b4..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/ocr_cache_test.go +++ /dev/null @@ -1,163 +0,0 @@ -package coordinator - -import ( - "testing" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/stretchr/testify/assert" -) - -func TestNewCache(t *testing.T) { - b := NewBlockCache[int](time.Second) - - assert.Equal(t, time.Second, b.evictionWindow, "must set correct blockEvictionWindow") -} - -func TestCache(t *testing.T) { - t.Run("Happy path, no overwrites.", func(t *testing.T) { - now := time.Now().UTC() - - tests := []struct { - Key common.Hash - Value int - }{ - {Key: common.HexToHash("0x0"), Value: 1}, - {Key: common.HexToHash("0x1"), Value: 2}, - {Key: common.HexToHash("0x2"), Value: 3}, - {Key: common.HexToHash("0x3"), Value: 4}, - {Key: common.HexToHash("0x4"), Value: 5}, - } - - c := NewBlockCache[int](100 * time.Second) - - // Populate cache with ordered items. - for i, test := range tests { - c.CacheItem(test.Value, test.Key, getSecondsAfterNow(now, i)) - item := c.GetItem(test.Key) - assert.Equal(t, test.Value, *item) - } - - // Ensure cache has 5 items, with the newest and oldest pointers correct. - assert.Equal(t, 5, len(c.cache), "cache should contain 5 keys") - - // Evict all items. - evictionTime := getSecondsAfterNow(now, 105) - c.EvictExpiredItems(evictionTime) - assert.Equal(t, 0, len(c.cache), "cache should contain 0 keys") - - // Cache a new item. - c.CacheItem(tests[0].Value, tests[0].Key, getSecondsAfterNow(now, 10)) - item := c.GetItem(tests[0].Key) - assert.Equal(t, tests[0].Value, *item) - - // Attempting a new eviction should have no effect. - c.EvictExpiredItems(evictionTime) - assert.Equal(t, 1, len(c.cache), "cache should contain 1 key") - - // Reduce eviction window. - c.SetEvictonWindow(time.Second * 50) - - // Attempting a new eviction will remove the added item. - c.EvictExpiredItems(evictionTime) - assert.Equal(t, 0, len(c.cache), "cache should contain 0 keys") - }) - - t.Run("Happy path, override middle item.", func(t *testing.T) { - now := time.Now().UTC() - - tests := []struct { - Key common.Hash - Value int - }{ - {Key: common.HexToHash("0x0"), Value: 1}, - {Key: common.HexToHash("0x1"), Value: 2}, - {Key: common.HexToHash("0x2"), Value: 3}, - {Key: common.HexToHash("0x3"), Value: 4}, - {Key: common.HexToHash("0x1"), Value: 5}, - } - - c := NewBlockCache[int](100 * time.Second) - - // Populate cache with items. - for i, test := range tests { - c.CacheItem(test.Value, test.Key, getSecondsAfterNow(now, i)) - item := c.GetItem(test.Key) - assert.Equal(t, test.Value, *item) - } - - // Ensure cache has 4 items, with the newest and oldest pointers correct. - assert.Equal(t, 4, len(c.cache), "cache should contain 4 keys") - - // Evict all but two items. - c.EvictExpiredItems(getSecondsAfterNow(now, 103)) - assert.Equal(t, 2, len(c.cache), "cache should contain 2 keys") - - // Evict all but one items. - c.EvictExpiredItems(getSecondsAfterNow(now, 104)) - assert.Equal(t, 1, len(c.cache), "cache should contain 1 keys") - - // Evict remaining item. - c.EvictExpiredItems(getSecondsAfterNow(now, 105)) - assert.Equal(t, 0, len(c.cache), "cache should contain 0 keys") - }) - - t.Run("Happy path, override last item.", func(t *testing.T) { - now := time.Now().UTC() - - tests := []struct { - Key common.Hash - Value int - }{ - {Key: common.HexToHash("0x0"), Value: 1}, - {Key: common.HexToHash("0x1"), Value: 2}, - {Key: common.HexToHash("0x2"), Value: 3}, - {Key: common.HexToHash("0x3"), Value: 4}, - {Key: common.HexToHash("0x0"), Value: 5}, - } - - c := NewBlockCache[int](100 * time.Second) - - // Populate cache with items. - for i, test := range tests { - c.CacheItem(test.Value, test.Key, getSecondsAfterNow(now, i)) - item := c.GetItem(test.Key) - assert.Equal(t, test.Value, *item) - } - - // Ensure cache has 4 items, with the newest and oldest pointers correct. - assert.Equal(t, 4, len(c.cache), "cache should contain 4 keys") - - // Evict all but one item. - c.EvictExpiredItems(getSecondsAfterNow(now, 104)) - assert.Equal(t, 1, len(c.cache), "cache should contain 1 keys") - - // Cache a new item. - c.CacheItem(tests[1].Value, tests[1].Key, getSecondsAfterNow(now, 110)) - item := c.GetItem(tests[1].Key) - assert.Equal(t, tests[1].Value, *item) - - // Assert correct length. - assert.Equal(t, 2, len(c.cache), "cache should contain 2 keys") - - // Replace the oldest item. - c.CacheItem(tests[0].Value, tests[0].Key, getSecondsAfterNow(now, 111)) - item = c.GetItem(tests[0].Key) - assert.Equal(t, tests[0].Value, *item) - - // Assert correct length. - assert.Equal(t, 2, len(c.cache), "cache should contain 2 keys") - - // Replace the newest item. - c.CacheItem(tests[0].Value, tests[0].Key, getSecondsAfterNow(now, 112)) - item = c.GetItem(tests[0].Key) - assert.Equal(t, tests[0].Value, *item) - - // Assert correct length. - assert.Equal(t, 2, len(c.cache), "cache should contain 2 keys") - }) -} - -func getSecondsAfterNow(now time.Time, i int) time.Time { - return now.Add(time.Duration(i) * time.Second) -} diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/router.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/router.go deleted file mode 100644 index 77384a085ab..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/router.go +++ /dev/null @@ -1,82 +0,0 @@ -package coordinator - -import ( - "math/big" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/pkg/errors" - - evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_coordinator" - "github.com/smartcontractkit/chainlink/v2/core/logger" -) - -var _ VRFBeaconCoordinator = &vrfRouter{} - -// VRFProxy routes requests to VRFBeacon and VRFCoordinator go wrappers and implements VRFBeaconCoordinator interface -type vrfRouter struct { - lggr logger.Logger - beacon vrf_beacon.VRFBeaconInterface - coordinator vrf_coordinator.VRFCoordinatorInterface -} - -func newRouter( - lggr logger.Logger, - beaconAddress common.Address, - coordinatorAddress common.Address, - client evmclient.Client, -) (VRFBeaconCoordinator, error) { - beacon, err := vrf_beacon.NewVRFBeacon(beaconAddress, client) - if err != nil { - return nil, errors.Wrap(err, "beacon wrapper creation") - } - coordinator, err := vrf_coordinator.NewVRFCoordinator(coordinatorAddress, client) - if err != nil { - return nil, errors.Wrap(err, "coordinator wrapper creation") - } - return &vrfRouter{ - lggr: lggr, - beacon: beacon, - coordinator: coordinator, - }, nil -} - -// SProvingKeyHash retrieves the proving key hash from the on-chain contract. -// Calls VRF beacon wrapper to retrieve proving key hash -func (v *vrfRouter) SProvingKeyHash(opts *bind.CallOpts) ([32]byte, error) { - return v.beacon.SProvingKeyHash(opts) -} - -// SKeyID retrieves the keyID from the on-chain contract. -// Calls VRF beacon wrapper to retrieve key ID -func (v *vrfRouter) SKeyID(opts *bind.CallOpts) ([32]byte, error) { - return v.beacon.SKeyID(opts) -} - -// IBeaconPeriodBlocks retrieves the beacon period in blocks from the on-chain contract. -// Calls VRF coordinator wrapper to beacon period blocks -func (v *vrfRouter) IBeaconPeriodBlocks(opts *bind.CallOpts) (*big.Int, error) { - return v.coordinator.IBeaconPeriodBlocks(opts) -} - -// ParseLog parses the raw log data and topics into a go object. -// The returned object must be casted to the expected type. -// Calls either VRF beacon wrapper or VRF coordinator wrapper depending on the addresses of the log -func (v *vrfRouter) ParseLog(log types.Log) (generated.AbigenLog, error) { - if log.Address == v.beacon.Address() { - return v.beacon.ParseLog(log) - } else if log.Address == v.coordinator.Address() { - return v.coordinator.ParseLog(log) - } - return nil, errors.Errorf("failed to parse log. contractAddress: %x logs: %x", log.Address, log.Topics) -} - -// GetConfirmationDelays retrieves confirmation delays from the on-chain contract. -// Calls VRF coordinator to retrieve confirmation delays -func (v *vrfRouter) GetConfirmationDelays(opts *bind.CallOpts) ([8]*big.Int, error) { - return v.coordinator.GetConfirmationDelays(opts) -} diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/router_test.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/router_test.go deleted file mode 100644 index 7135fa862e3..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/router_test.go +++ /dev/null @@ -1,130 +0,0 @@ -package coordinator - -import ( - "math/big" - "testing" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/core/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_coordinator" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2vrf/coordinator/mocks" -) - -var nilOpts *bind.CallOpts - -func TestRouter_SProvingKeyHash(t *testing.T) { - beacon := mocks.NewVRFBeaconInterface(t) - keyHash := [32]byte{1} - router := vrfRouter{ - beacon: beacon, - } - beacon.On("SProvingKeyHash", mock.Anything).Return(keyHash, nil).Once() - - result, err := router.SProvingKeyHash(nilOpts) - assert.NoError(t, err) - assert.Equal(t, keyHash, result) -} - -func TestRouter_SKeyID(t *testing.T) { - beacon := mocks.NewVRFBeaconInterface(t) - keyID := [32]byte{2} - router := vrfRouter{ - beacon: beacon, - } - beacon.On("SKeyID", mock.Anything).Return(keyID, nil).Once() - - result, err := router.SKeyID(nilOpts) - assert.NoError(t, err) - assert.Equal(t, keyID, result) -} - -func TestRouter_IBeaconPeriodBlocks(t *testing.T) { - coordinator := mocks.NewVRFCoordinatorInterface(t) - periodBlocks := big.NewInt(3) - router := vrfRouter{ - coordinator: coordinator, - } - coordinator.On("IBeaconPeriodBlocks", mock.Anything).Return(periodBlocks, nil).Once() - - result, err := router.IBeaconPeriodBlocks(nilOpts) - assert.NoError(t, err) - assert.Equal(t, periodBlocks, result) -} - -func TestRouter_GetConfirmationDelays(t *testing.T) { - coordinator := mocks.NewVRFCoordinatorInterface(t) - confDelays := [8]*big.Int{big.NewInt(4)} - router := vrfRouter{ - coordinator: coordinator, - } - coordinator.On("GetConfirmationDelays", mock.Anything).Return(confDelays, nil).Once() - - result, err := router.GetConfirmationDelays(nilOpts) - assert.NoError(t, err) - assert.Equal(t, confDelays, result) -} - -func TestRouter_ParseLog(t *testing.T) { - t.Parallel() - - t.Run("parse beacon log", func(t *testing.T) { - addr := newAddress(t) - log := types.Log{ - Address: addr, - } - parsedLog := vrf_beacon.VRFBeaconNewTransmission{} - beacon := mocks.NewVRFBeaconInterface(t) - router := vrfRouter{ - beacon: beacon, - } - beacon.On("Address").Return(addr).Once() - beacon.On("ParseLog", log).Return(parsedLog, nil).Once() - - result, err := router.ParseLog(log) - assert.NoError(t, err) - assert.Equal(t, result, parsedLog) - }) - - t.Run("parse coordinator log", func(t *testing.T) { - addr := newAddress(t) - log := types.Log{ - Address: addr, - } - parsedLog := vrf_coordinator.VRFCoordinatorRandomnessRequested{} - beacon := mocks.NewVRFBeaconInterface(t) - coordinator := mocks.NewVRFCoordinatorInterface(t) - router := vrfRouter{ - beacon: beacon, - coordinator: coordinator, - } - beacon.On("Address").Return(newAddress(t)).Once() - coordinator.On("Address").Return(addr).Once() - coordinator.On("ParseLog", log).Return(parsedLog, nil).Once() - - result, err := router.ParseLog(log) - assert.NoError(t, err) - assert.Equal(t, result, parsedLog) - }) - - t.Run("parse log unexpected log", func(t *testing.T) { - log := types.Log{ - Address: newAddress(t), - } - beacon := mocks.NewVRFBeaconInterface(t) - coordinator := mocks.NewVRFCoordinatorInterface(t) - router := vrfRouter{ - beacon: beacon, - coordinator: coordinator, - } - beacon.On("Address").Return(newAddress(t)).Once() - coordinator.On("Address").Return(newAddress(t)).Once() - - result, err := router.ParseLog(log) - assert.Nil(t, result) - assert.Contains(t, err.Error(), "failed to parse log") - }) -} diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/topics.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/topics.go deleted file mode 100644 index 370f0c5fd00..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/topics.go +++ /dev/null @@ -1,28 +0,0 @@ -package coordinator - -import ( - "github.com/ethereum/go-ethereum/common" - - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_coordinator" -) - -type topics struct { - randomnessRequestedTopic common.Hash - randomnessFulfillmentRequestedTopic common.Hash - randomWordsFulfilledTopic common.Hash - configSetTopic common.Hash - newTransmissionTopic common.Hash - outputsServedTopic common.Hash -} - -func newTopics() topics { - return topics{ - randomnessRequestedTopic: vrf_coordinator.VRFCoordinatorRandomnessRequested{}.Topic(), - randomnessFulfillmentRequestedTopic: vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequested{}.Topic(), - randomWordsFulfilledTopic: vrf_coordinator.VRFCoordinatorRandomWordsFulfilled{}.Topic(), - configSetTopic: vrf_beacon.VRFBeaconConfigSet{}.Topic(), - newTransmissionTopic: vrf_beacon.VRFBeaconNewTransmission{}.Topic(), - outputsServedTopic: vrf_coordinator.VRFCoordinatorOutputsServed{}.Topic(), - } -} diff --git a/core/services/ocr2/plugins/ocr2vrf/internal/ocr2vrf_integration_test.go b/core/services/ocr2/plugins/ocr2vrf/internal/ocr2vrf_integration_test.go deleted file mode 100644 index 8087591a123..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/internal/ocr2vrf_integration_test.go +++ /dev/null @@ -1,883 +0,0 @@ -package internal_test - -import ( - "crypto/rand" - "encoding/hex" - "errors" - "fmt" - "math/big" - "testing" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/hashicorp/consul/sdk/freeport" - "github.com/onsi/gomega" - "github.com/stretchr/testify/require" - "go.dedis.ch/kyber/v3" - - "github.com/smartcontractkit/libocr/commontypes" - confighelper2 "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" - ocrtypes2 "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - - "github.com/smartcontractkit/chainlink-vrf/altbn_128" - ocr2dkg "github.com/smartcontractkit/chainlink-vrf/dkg" - "github.com/smartcontractkit/chainlink-vrf/ocr2vrf" - ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" - - commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" - commonutils "github.com/smartcontractkit/chainlink-common/pkg/utils" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" - ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/authorized_forwarder" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/mock_v3_aggregator_contract" - dkg_wrapper "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/dkg" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/load_test_beacon_consumer" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon_consumer" - vrf_wrapper "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_coordinator" - "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" - "github.com/smartcontractkit/chainlink/v2/core/internal/cltest/heavyweight" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" - "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgencryptkey" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgsignkey" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/keystest" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/validate" - "github.com/smartcontractkit/chainlink/v2/core/services/ocrbootstrap" -) - -type ocr2vrfUniverse struct { - owner *bind.TransactOpts - backend *backends.SimulatedBackend - - dkgAddress common.Address - dkg *dkg_wrapper.DKG - - beaconAddress common.Address - coordinatorAddress common.Address - beacon *vrf_beacon.VRFBeacon - coordinator *vrf_wrapper.VRFCoordinator - - linkAddress common.Address - link *link_token_interface.LinkToken - - consumerAddress common.Address - consumer *vrf_beacon_consumer.BeaconVRFConsumer - - loadTestConsumerAddress common.Address - loadTestConsumer *load_test_beacon_consumer.LoadTestBeaconVRFConsumer - - feedAddress common.Address - feed *mock_v3_aggregator_contract.MockV3AggregatorContract - - subID *big.Int -} - -const ( - fundingAmount int64 = 5e18 -) - -type ocr2Node struct { - app *cltest.TestApplication - peerID string - transmitter common.Address - effectiveTransmitter common.Address - keybundle ocr2key.KeyBundle - sendingKeys []string -} - -func setupOCR2VRFContracts( - t *testing.T, beaconPeriod int64, keyID [32]byte, consumerShouldFail bool) ocr2vrfUniverse { - owner := testutils.MustNewSimTransactor(t) - owner.GasPrice = assets.GWei(1).ToInt() - genesisData := core.GenesisAlloc{ - owner.From: { - Balance: assets.Ether(100).ToInt(), - }, - } - b := backends.NewSimulatedBackend(genesisData, ethconfig.Defaults.Miner.GasCeil*2) - - // deploy OCR2VRF contracts, which have the following deploy order: - // * link token - // * link/eth feed - // * DKG - // * VRF (coordinator, and beacon) - // * VRF consumer - linkAddress, _, link, err := link_token_interface.DeployLinkToken( - owner, b) - require.NoError(t, err) - b.Commit() - - feedAddress, _, feed, err := mock_v3_aggregator_contract.DeployMockV3AggregatorContract( - owner, b, 18, assets.GWei(int(1e7)).ToInt()) // 0.01 eth per link - require.NoError(t, err) - b.Commit() - - dkgAddress, _, dkg, err := dkg_wrapper.DeployDKG(owner, b) - require.NoError(t, err) - b.Commit() - - coordinatorAddress, _, coordinator, err := vrf_wrapper.DeployVRFCoordinator( - owner, b, big.NewInt(beaconPeriod), linkAddress) - require.NoError(t, err) - b.Commit() - - require.NoError(t, commonutils.JustError(coordinator.SetCallbackConfig(owner, vrf_wrapper.VRFCoordinatorCallbackConfig{ - MaxCallbackGasLimit: 2.5e6, - MaxCallbackArgumentsLength: 160, // 5 EVM words - }))) - b.Commit() - - require.NoError(t, commonutils.JustError(coordinator.SetCoordinatorConfig(owner, vrf_wrapper.VRFBeaconTypesCoordinatorConfig{ - RedeemableRequestGasOverhead: 50_000, - CallbackRequestGasOverhead: 50_000, - StalenessSeconds: 60, - FallbackWeiPerUnitLink: assets.GWei(int(1e7)).ToInt(), - }))) - b.Commit() - - beaconAddress, _, beacon, err := vrf_beacon.DeployVRFBeacon( - owner, b, linkAddress, coordinatorAddress, dkgAddress, keyID) - require.NoError(t, err) - b.Commit() - - consumerAddress, _, consumer, err := vrf_beacon_consumer.DeployBeaconVRFConsumer( - owner, b, coordinatorAddress, consumerShouldFail, big.NewInt(beaconPeriod)) - require.NoError(t, err) - b.Commit() - - loadTestConsumerAddress, _, loadTestConsumer, err := load_test_beacon_consumer.DeployLoadTestBeaconVRFConsumer( - owner, b, coordinatorAddress, consumerShouldFail, big.NewInt(beaconPeriod)) - require.NoError(t, err) - b.Commit() - - // Set up coordinator subscription for billing. - require.NoError(t, commonutils.JustError(coordinator.CreateSubscription(owner))) - b.Commit() - - fopts := &bind.FilterOpts{} - - subscriptionIterator, err := coordinator.FilterSubscriptionCreated(fopts, nil, []common.Address{owner.From}) - require.NoError(t, err) - - require.True(t, subscriptionIterator.Next()) - subID := subscriptionIterator.Event.SubId - - require.NoError(t, commonutils.JustError(coordinator.AddConsumer(owner, subID, consumerAddress))) - b.Commit() - require.NoError(t, commonutils.JustError(coordinator.AddConsumer(owner, subID, loadTestConsumerAddress))) - b.Commit() - data, err := utils.ABIEncode(`[{"type":"uint256"}]`, subID) - require.NoError(t, err) - require.NoError(t, commonutils.JustError(link.TransferAndCall(owner, coordinatorAddress, big.NewInt(5e18), data))) - b.Commit() - - _, err = dkg.AddClient(owner, keyID, beaconAddress) - require.NoError(t, err) - b.Commit() - - _, err = coordinator.SetProducer(owner, beaconAddress) - require.NoError(t, err) - - // Achieve finality depth so the CL node can work properly. - for i := 0; i < 20; i++ { - b.Commit() - } - - return ocr2vrfUniverse{ - owner: owner, - backend: b, - dkgAddress: dkgAddress, - dkg: dkg, - beaconAddress: beaconAddress, - coordinatorAddress: coordinatorAddress, - beacon: beacon, - coordinator: coordinator, - linkAddress: linkAddress, - link: link, - consumerAddress: consumerAddress, - consumer: consumer, - loadTestConsumerAddress: loadTestConsumerAddress, - loadTestConsumer: loadTestConsumer, - feedAddress: feedAddress, - feed: feed, - subID: subID, - } -} - -func setupNodeOCR2( - t *testing.T, - owner *bind.TransactOpts, - port int, - dbName string, - b *backends.SimulatedBackend, - useForwarders bool, - p2pV2Bootstrappers []commontypes.BootstrapperLocator, -) *ocr2Node { - ctx := testutils.Context(t) - p2pKey := keystest.NewP2PKeyV2(t) - config, _ := heavyweight.FullTestDBV2(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.Insecure.OCRDevelopmentMode = ptr(true) // Disables ocr spec validation so we can have fast polling for the test. - - c.Feature.LogPoller = ptr(true) - - c.P2P.PeerID = ptr(p2pKey.PeerID()) - c.P2P.V2.Enabled = ptr(true) - c.P2P.V2.DeltaDial = commonconfig.MustNewDuration(500 * time.Millisecond) - c.P2P.V2.DeltaReconcile = commonconfig.MustNewDuration(5 * time.Second) - c.P2P.V2.ListenAddresses = &[]string{fmt.Sprintf("127.0.0.1:%d", port)} - if len(p2pV2Bootstrappers) > 0 { - c.P2P.V2.DefaultBootstrappers = &p2pV2Bootstrappers - } - - c.OCR.Enabled = ptr(false) - c.OCR2.Enabled = ptr(true) - - c.EVM[0].LogPollInterval = commonconfig.MustNewDuration(500 * time.Millisecond) - c.EVM[0].GasEstimator.LimitDefault = ptr[uint64](3_500_000) - c.EVM[0].Transactions.ForwardersEnabled = &useForwarders - c.OCR2.ContractPollInterval = commonconfig.MustNewDuration(10 * time.Second) - }) - - app := cltest.NewApplicationWithConfigV2AndKeyOnSimulatedBlockchain(t, config, b, p2pKey) - - var sendingKeys []ethkey.KeyV2 - { - var err error - sendingKeys, err = app.KeyStore.Eth().EnabledKeysForChain(ctx, testutils.SimulatedChainID) - require.NoError(t, err) - require.Len(t, sendingKeys, 1) - } - transmitter := sendingKeys[0].Address - effectiveTransmitter := sendingKeys[0].Address - - if useForwarders { - sendingKeysAddresses := []common.Address{sendingKeys[0].Address} - - // Add new sending key. - k, err := app.KeyStore.Eth().Create(ctx) - require.NoError(t, err) - require.NoError(t, app.KeyStore.Eth().Add(ctx, k.Address, testutils.SimulatedChainID)) - require.NoError(t, app.KeyStore.Eth().Enable(ctx, k.Address, testutils.SimulatedChainID)) - sendingKeys = append(sendingKeys, k) - sendingKeysAddresses = append(sendingKeysAddresses, k.Address) - - require.Len(t, sendingKeys, 2) - - // Deploy a forwarder. - faddr, _, authorizedForwarder, err := authorized_forwarder.DeployAuthorizedForwarder(owner, b, common.HexToAddress("0x326C977E6efc84E512bB9C30f76E30c160eD06FB"), owner.From, common.Address{}, []byte{}) - require.NoError(t, err) - - // Set the node's sending keys as authorized senders. - _, err = authorizedForwarder.SetAuthorizedSenders(owner, sendingKeysAddresses) - require.NoError(t, err) - b.Commit() - - // Add the forwarder to the node's forwarder manager. - forwarderORM := forwarders.NewORM(app.GetDB()) - chainID := ubig.Big(*b.Blockchain().Config().ChainID) - _, err = forwarderORM.CreateForwarder(testutils.Context(t), faddr, chainID) - require.NoError(t, err) - effectiveTransmitter = faddr - } - - // Fund the sending keys with some ETH. - var sendingKeyStrings []string - for _, k := range sendingKeys { - sendingKeyStrings = append(sendingKeyStrings, k.Address.String()) - n, err := b.NonceAt(ctx, owner.From, nil) - require.NoError(t, err) - - tx := cltest.NewLegacyTransaction( - n, k.Address, - assets.Ether(1).ToInt(), - 21000, - assets.GWei(1).ToInt(), - nil) - signedTx, err := owner.Signer(owner.From, tx) - require.NoError(t, err) - err = b.SendTransaction(ctx, signedTx) - require.NoError(t, err) - b.Commit() - } - - kb, err := app.GetKeyStore().OCR2().Create(ctx, "evm") - require.NoError(t, err) - - return &ocr2Node{ - app: app, - peerID: p2pKey.PeerID().Raw(), - transmitter: transmitter, - effectiveTransmitter: effectiveTransmitter, - keybundle: kb, - sendingKeys: sendingKeyStrings, - } -} - -func TestIntegration_OCR2VRF_ForwarderFlow(t *testing.T) { - testutils.SkipFlakey(t, "https://smartcontract-it.atlassian.net/browse/VRF-688") - runOCR2VRFTest(t, true) -} - -func TestIntegration_OCR2VRF(t *testing.T) { - testutils.SkipFlakey(t, "https://smartcontract-it.atlassian.net/browse/VRF-688") - runOCR2VRFTest(t, false) -} - -func runOCR2VRFTest(t *testing.T, useForwarders bool) { - ctx := testutils.Context(t) - keyID := randomKeyID(t) - uni := setupOCR2VRFContracts(t, 5, keyID, false) - - t.Log("Creating bootstrap node") - - bootstrapNodePort := freeport.GetOne(t) - bootstrapNode := setupNodeOCR2(t, uni.owner, bootstrapNodePort, "bootstrap", uni.backend, false, nil) - numNodes := 5 - - t.Log("Creating OCR2 nodes") - var ( - oracles []confighelper2.OracleIdentityExtra - transmitters []common.Address - payees []common.Address - payeeTransactors []*bind.TransactOpts - effectiveTransmitters []common.Address - onchainPubKeys []common.Address - kbs []ocr2key.KeyBundle - apps []*cltest.TestApplication - dkgEncrypters []dkgencryptkey.Key - dkgSigners []dkgsignkey.Key - sendingKeys [][]string - ) - ports := freeport.GetN(t, numNodes) - for i := 0; i < numNodes; i++ { - // Supply the bootstrap IP and port as a V2 peer address - bootstrappers := []commontypes.BootstrapperLocator{ - {PeerID: bootstrapNode.peerID, Addrs: []string{ - fmt.Sprintf("127.0.0.1:%d", bootstrapNodePort), - }}, - } - node := setupNodeOCR2(t, uni.owner, ports[i], fmt.Sprintf("ocr2vrforacle%d", i), uni.backend, useForwarders, bootstrappers) - sendingKeys = append(sendingKeys, node.sendingKeys) - - dkgSignKey, err := node.app.GetKeyStore().DKGSign().Create(ctx) - require.NoError(t, err) - - dkgEncryptKey, err := node.app.GetKeyStore().DKGEncrypt().Create(ctx) - require.NoError(t, err) - - kbs = append(kbs, node.keybundle) - apps = append(apps, node.app) - transmitters = append(transmitters, node.transmitter) - payeeTransactor := testutils.MustNewSimTransactor(t) - payeeTransactors = append(payeeTransactors, payeeTransactor) - payees = append(payees, payeeTransactor.From) - effectiveTransmitters = append(effectiveTransmitters, node.effectiveTransmitter) - dkgEncrypters = append(dkgEncrypters, dkgEncryptKey) - dkgSigners = append(dkgSigners, dkgSignKey) - onchainPubKeys = append(onchainPubKeys, common.BytesToAddress(node.keybundle.PublicKey())) - oracles = append(oracles, confighelper2.OracleIdentityExtra{ - OracleIdentity: confighelper2.OracleIdentity{ - OnchainPublicKey: node.keybundle.PublicKey(), - TransmitAccount: ocrtypes2.Account(node.transmitter.String()), - OffchainPublicKey: node.keybundle.OffchainPublicKey(), - PeerID: node.peerID, - }, - ConfigEncryptionPublicKey: node.keybundle.ConfigEncryptionPublicKey(), - }) - } - - _, err := uni.beacon.SetPayees(uni.owner, transmitters, payees) - require.NoError(t, err) - - t.Log("starting ticker to commit blocks") - tick := time.NewTicker(1 * time.Second) - defer tick.Stop() - go func() { - for range tick.C { - uni.backend.Commit() - } - }() - - blockBeforeConfig, err := uni.backend.BlockByNumber(ctx, nil) - require.NoError(t, err) - - t.Log("Setting DKG config before block:", blockBeforeConfig.Number().String()) - - // set config for dkg - setDKGConfig( - t, - uni, - onchainPubKeys, - effectiveTransmitters, - 1, - oracles, - dkgSigners, - dkgEncrypters, - keyID, - ) - - t.Log("Adding bootstrap node job") - err = bootstrapNode.app.Start(ctx) - require.NoError(t, err) - - evmChains := bootstrapNode.app.GetRelayers().LegacyEVMChains() - require.NotNil(t, evmChains) - bootstrapJobSpec := fmt.Sprintf(` -type = "bootstrap" -name = "bootstrap" -contractConfigTrackerPollInterval = "15s" -relay = "evm" -schemaVersion = 1 -contractID = "%s" -[relayConfig] -chainID = 1337 -fromBlock = %d -`, uni.dkgAddress.Hex(), blockBeforeConfig.Number().Int64()) - t.Log("Creating bootstrap job:", bootstrapJobSpec) - ocrJob, err := ocrbootstrap.ValidatedBootstrapSpecToml(bootstrapJobSpec) - require.NoError(t, err) - err = bootstrapNode.app.AddJobV2(ctx, &ocrJob) - require.NoError(t, err) - - t.Log("Creating OCR2VRF jobs") - for i := 0; i < numNodes; i++ { - var sendingKeysString = fmt.Sprintf(`"%s"`, sendingKeys[i][0]) - for x := 1; x < len(sendingKeys[i]); x++ { - sendingKeysString = fmt.Sprintf(`%s,"%s"`, sendingKeysString, sendingKeys[i][x]) - } - err = apps[i].Start(ctx) - require.NoError(t, err) - - jobSpec := fmt.Sprintf(` -type = "offchainreporting2" -schemaVersion = 1 -name = "ocr2 vrf integration test" -maxTaskDuration = "30s" -contractID = "%s" -ocrKeyBundleID = "%s" -relay = "evm" -pluginType = "ocr2vrf" -transmitterID = "%s" -forwardingAllowed = %t -contractConfigTrackerPollInterval = "15s" - -[relayConfig] -chainID = 1337 -fromBlock = %d - -[pluginConfig] -dkgEncryptionPublicKey = "%s" -dkgSigningPublicKey = "%s" -dkgKeyID = "%s" -dkgContractAddress = "%s" - -vrfCoordinatorAddress = "%s" -linkEthFeedAddress = "%s" -`, uni.beaconAddress.String(), - kbs[i].ID(), - transmitters[i], - useForwarders, - blockBeforeConfig.Number().Int64(), - dkgEncrypters[i].PublicKeyString(), - dkgSigners[i].PublicKeyString(), - hex.EncodeToString(keyID[:]), - uni.dkgAddress.String(), - uni.coordinatorAddress.String(), - uni.feedAddress.String(), - ) - t.Log("Creating OCR2VRF job with spec:", jobSpec) - ocrJob2, err2 := validate.ValidatedOracleSpecToml(testutils.Context(t), apps[i].Config.OCR2(), apps[i].Config.Insecure(), jobSpec, nil) - require.NoError(t, err2) - err2 = apps[i].AddJobV2(ctx, &ocrJob2) - require.NoError(t, err2) - } - - t.Log("Waiting for DKG key to get written") - // poll until a DKG key is written to the contract - // at that point we can start sending VRF requests - var emptyKH [32]byte - emptyHash := crypto.Keccak256Hash(emptyKH[:]) - gomega.NewWithT(t).Eventually(func() bool { - kh, err2 := uni.beacon.SProvingKeyHash(&bind.CallOpts{ - Context: ctx, - }) - require.NoError(t, err2) - t.Log("proving keyhash:", hexutil.Encode(kh[:])) - return crypto.Keccak256Hash(kh[:]) != emptyHash - }, testutils.WaitTimeout(t), 5*time.Second).Should(gomega.BeTrue()) - - t.Log("DKG key written, setting VRF config") - - // set config for vrf now that dkg is ready - setVRFConfig( - t, - uni, - onchainPubKeys, - effectiveTransmitters, - 1, - oracles, - []int{1, 2, 3, 4, 5, 6, 7, 8}, - keyID) - - t.Log("Sending VRF request") - - initialSub, err := uni.coordinator.GetSubscription(nil, uni.subID) - require.NoError(t, err) - require.Equal(t, assets.Ether(5).ToInt(), initialSub.Balance) - - // Send a beacon VRF request and mine it - _, err = uni.consumer.TestRequestRandomness(uni.owner, 2, uni.subID, big.NewInt(1)) - require.NoError(t, err) - uni.backend.Commit() - - redemptionRequestID, err := uni.consumer.SMostRecentRequestID(nil) - require.NoError(t, err) - - // There is no premium on this request, so the cost of the request should have been: - // = (request overhead) * (gas price) / (LINK/ETH ratio) - // = (50_000 * 1 Gwei) / .01 - // = 5_000_000 GJuels - subAfterBeaconRequest, err := uni.coordinator.GetSubscription(nil, uni.subID) - require.NoError(t, err) - require.Equal(t, big.NewInt(initialSub.Balance.Int64()-assets.GWei(5_000_000).Int64()), subAfterBeaconRequest.Balance) - - // Send a fulfillment VRF request and mine it - _, err = uni.consumer.TestRequestRandomnessFulfillment(uni.owner, uni.subID, 1, big.NewInt(2), 100_000, []byte{}) - require.NoError(t, err) - uni.backend.Commit() - - fulfillmentRequestID, err := uni.consumer.SMostRecentRequestID(nil) - require.NoError(t, err) - - // There is no premium on this request, so the cost of the request should have been: - // = (request overhead + callback gas allowance) * (gas price) / (LINK/ETH ratio) - // = ((50_000 + 100_000) * 1 Gwei) / .01 - // = 15_000_000 GJuels - subAfterFulfillmentRequest, err := uni.coordinator.GetSubscription(nil, uni.subID) - require.NoError(t, err) - require.Equal(t, big.NewInt(subAfterBeaconRequest.Balance.Int64()-assets.GWei(15_000_000).Int64()), subAfterFulfillmentRequest.Balance) - - // Send two batched fulfillment VRF requests and mine them - _, err = uni.loadTestConsumer.TestRequestRandomnessFulfillmentBatch(uni.owner, uni.subID, 1, big.NewInt(2), 200_000, []byte{}, big.NewInt(2)) - require.NoError(t, err) - uni.backend.Commit() - - batchFulfillmentRequestID1, err := uni.loadTestConsumer.SRequestIDs(nil, big.NewInt(0), big.NewInt(0)) - require.NoError(t, err) - - batchFulfillmentRequestID2, err := uni.loadTestConsumer.SRequestIDs(nil, big.NewInt(0), big.NewInt(1)) - require.NoError(t, err) - - // There is no premium on these requests, so the cost of the requests should have been: - // = ((request overhead + callback gas allowance) * (gas price) / (LINK/ETH ratio)) * batch size - // = (((50_000 + 200_000) * 1 Gwei) / .01) * 2 - // = 50_000_000 GJuels - subAfterBatchFulfillmentRequest, err := uni.coordinator.GetSubscription(nil, uni.subID) - require.NoError(t, err) - require.Equal(t, big.NewInt(subAfterFulfillmentRequest.Balance.Int64()-assets.GWei(50_000_000).Int64()), subAfterBatchFulfillmentRequest.Balance) - - t.Logf("sub balance after batch fulfillment request: %d", subAfterBatchFulfillmentRequest.Balance) - - t.Log("waiting for fulfillment") - - var balanceAfterRefund *big.Int - // poll until we're able to redeem the randomness without reverting - // at that point, it's been fulfilled - gomega.NewWithT(t).Eventually(func() bool { - _, err2 := uni.consumer.TestRedeemRandomness(uni.owner, uni.subID, redemptionRequestID) - t.Logf("TestRedeemRandomness err: %+v", err2) - return err2 == nil - }, testutils.WaitTimeout(t), 5*time.Second).Should(gomega.BeTrue()) - - gomega.NewWithT(t).Eventually(func() bool { - // Ensure a refund is provided. Refund amount comes out to ~15_700_000 GJuels. - // We use an upper and lower bound such that this part of the test is not excessively brittle to upstream tweaks. - refundUpperBound := big.NewInt(0).Add(assets.GWei(17_000_000).ToInt(), subAfterBatchFulfillmentRequest.Balance) - refundLowerBound := big.NewInt(0).Add(assets.GWei(15_000_000).ToInt(), subAfterBatchFulfillmentRequest.Balance) - subAfterRefund, err2 := uni.coordinator.GetSubscription(nil, uni.subID) - require.NoError(t, err2) - balanceAfterRefund = subAfterRefund.Balance - if ok := ((balanceAfterRefund.Cmp(refundUpperBound) == -1) && (balanceAfterRefund.Cmp(refundLowerBound) == 1)); !ok { - t.Logf("unexpected sub balance after refund: %d", balanceAfterRefund) - return false - } - return true - }, testutils.WaitTimeout(t), 5*time.Second).Should(gomega.BeTrue()) - - // Mine block after redeeming randomness - uni.backend.Commit() - - // ensure that total sub balance is updated correctly - totalSubBalance, err := uni.coordinator.GetSubscriptionLinkBalance(nil) - require.NoError(t, err) - require.True(t, totalSubBalance.Cmp(balanceAfterRefund) == 0) - // ensure total link balance is correct before any payout - totalLinkBalance, err := uni.link.BalanceOf(nil, uni.coordinatorAddress) - require.NoError(t, err) - require.True(t, totalLinkBalance.Cmp(big.NewInt(fundingAmount)) == 0) - - // get total owed amount to NOPs and ensure linkAvailableForPayment (CLL profit) calculation is correct - nopOwedAmount := new(big.Int) - for _, transmitter := range transmitters { - owedAmount, err2 := uni.beacon.OwedPayment(nil, transmitter) - require.NoError(t, err2) - nopOwedAmount = new(big.Int).Add(nopOwedAmount, owedAmount) - } - linkAvailable, err := uni.beacon.LinkAvailableForPayment(nil) - require.NoError(t, err) - debt := new(big.Int).Add(totalSubBalance, nopOwedAmount) - profit := new(big.Int).Sub(totalLinkBalance, debt) - require.True(t, linkAvailable.Cmp(profit) == 0) - - // test cancel subscription - linkBalanceBeforeCancel, err := uni.link.BalanceOf(nil, uni.owner.From) - require.NoError(t, err) - _, err = uni.coordinator.CancelSubscription(uni.owner, uni.subID, uni.owner.From) - require.NoError(t, err) - uni.backend.Commit() - linkBalanceAfterCancel, err := uni.link.BalanceOf(nil, uni.owner.From) - require.NoError(t, err) - require.True(t, new(big.Int).Add(linkBalanceBeforeCancel, totalSubBalance).Cmp(linkBalanceAfterCancel) == 0) - totalSubBalance, err = uni.coordinator.GetSubscriptionLinkBalance(nil) - require.NoError(t, err) - require.True(t, totalSubBalance.Cmp(big.NewInt(0)) == 0) - totalLinkBalance, err = uni.link.BalanceOf(nil, uni.coordinatorAddress) - require.NoError(t, err) - require.True(t, totalLinkBalance.Cmp(new(big.Int).Sub(big.NewInt(fundingAmount), balanceAfterRefund)) == 0) - - // payout node operators - totalNopPayout := new(big.Int) - for idx, payeeTransactor := range payeeTransactors { - // Fund the payee with some ETH. - n, err2 := uni.backend.NonceAt(ctx, uni.owner.From, nil) - require.NoError(t, err2) - tx := cltest.NewLegacyTransaction( - n, payeeTransactor.From, - assets.Ether(1).ToInt(), - 21000, - assets.GWei(1).ToInt(), - nil) - signedTx, err2 := uni.owner.Signer(uni.owner.From, tx) - require.NoError(t, err2) - err2 = uni.backend.SendTransaction(ctx, signedTx) - require.NoError(t, err2) - - _, err2 = uni.beacon.WithdrawPayment(payeeTransactor, transmitters[idx]) - require.NoError(t, err2) - uni.backend.Commit() - payoutAmount, err2 := uni.link.BalanceOf(nil, payeeTransactor.From) - require.NoError(t, err2) - totalNopPayout = new(big.Int).Add(totalNopPayout, payoutAmount) - owedAmountAfter, err2 := uni.beacon.OwedPayment(nil, transmitters[idx]) - require.NoError(t, err2) - require.True(t, owedAmountAfter.Cmp(big.NewInt(0)) == 0) - } - require.True(t, nopOwedAmount.Cmp(totalNopPayout) == 0) - - // check total link balance after NOP payout - totalLinkBalanceAfterNopPayout, err := uni.link.BalanceOf(nil, uni.coordinatorAddress) - require.NoError(t, err) - require.True(t, totalLinkBalanceAfterNopPayout.Cmp(new(big.Int).Sub(totalLinkBalance, totalNopPayout)) == 0) - totalSubBalance, err = uni.coordinator.GetSubscriptionLinkBalance(nil) - require.NoError(t, err) - require.True(t, totalSubBalance.Cmp(big.NewInt(0)) == 0) - - // withdraw remaining profits after NOP payout - linkAvailable, err = uni.beacon.LinkAvailableForPayment(nil) - require.NoError(t, err) - linkBalanceBeforeWithdraw, err := uni.link.BalanceOf(nil, uni.owner.From) - require.NoError(t, err) - _, err = uni.beacon.WithdrawFunds(uni.owner, uni.owner.From, linkAvailable) - require.NoError(t, err) - uni.backend.Commit() - linkBalanceAfterWithdraw, err := uni.link.BalanceOf(nil, uni.owner.From) - require.NoError(t, err) - require.True(t, linkBalanceAfterWithdraw.Cmp(new(big.Int).Add(linkBalanceBeforeWithdraw, linkAvailable)) == 0) - linkAvailable, err = uni.beacon.LinkAvailableForPayment(nil) - require.NoError(t, err) - require.True(t, linkAvailable.Cmp(big.NewInt(0)) == 0) - - // poll until we're able to verify that consumer contract has stored randomness as expected - // First arg is the request ID, which starts at zero, second is the index into - // the random words. - gomega.NewWithT(t).Eventually(func() bool { - var errs []error - rw1, err2 := uni.consumer.SReceivedRandomnessByRequestID(nil, redemptionRequestID, big.NewInt(0)) - t.Logf("TestRedeemRandomness 1st word err: %+v", err2) - errs = append(errs, err2) - rw2, err2 := uni.consumer.SReceivedRandomnessByRequestID(nil, redemptionRequestID, big.NewInt(1)) - t.Logf("TestRedeemRandomness 2nd word err: %+v", err2) - errs = append(errs, err2) - rw3, err2 := uni.consumer.SReceivedRandomnessByRequestID(nil, fulfillmentRequestID, big.NewInt(0)) - t.Logf("FulfillRandomness 1st word err: %+v", err2) - errs = append(errs, err2) - rw4, err2 := uni.loadTestConsumer.SReceivedRandomnessByRequestID(nil, batchFulfillmentRequestID1, big.NewInt(0)) - t.Logf("Batch FulfillRandomness 1st word err: %+v", err2) - errs = append(errs, err2) - rw5, err2 := uni.loadTestConsumer.SReceivedRandomnessByRequestID(nil, batchFulfillmentRequestID2, big.NewInt(0)) - t.Logf("Batch FulfillRandomness 2nd word err: %+v", err2) - errs = append(errs, err2) - batchTotalRequests, err2 := uni.loadTestConsumer.STotalRequests(nil) - t.Logf("Batch FulfillRandomness total requests err: %+v", err2) - errs = append(errs, err2) - batchTotalFulfillments, err2 := uni.loadTestConsumer.STotalFulfilled(nil) - t.Logf("Batch FulfillRandomness total fulfillments err: %+v", err2) - errs = append(errs, err2) - err2 = nil - if batchTotalRequests.Int64() != batchTotalFulfillments.Int64() { - err2 = errors.New("batchTotalRequests is not equal to batchTotalFulfillments") - errs = append(errs, err2) - } - t.Logf("Batch FulfillRandomness total requests/fulfillments equal err: %+v", err2) - - t.Logf("randomness from redeemRandomness: %s %s", rw1.String(), rw2.String()) - t.Logf("randomness from fulfillRandomness: %s", rw3.String()) - t.Logf("randomness from batch fulfillRandomness: %s %s", rw4.String(), rw5.String()) - t.Logf("total batch requested and fulfilled: %d %d", batchTotalRequests, batchTotalFulfillments) - - for _, err := range errs { - if err != nil { - return false - } - } - return true - }, testutils.WaitTimeout(t), 5*time.Second).Should(gomega.BeTrue()) -} - -func setDKGConfig( - t *testing.T, - uni ocr2vrfUniverse, - onchainPubKeys []common.Address, - transmitters []common.Address, - f uint8, - oracleIdentities []confighelper2.OracleIdentityExtra, - signKeys []dkgsignkey.Key, - encryptKeys []dkgencryptkey.Key, - keyID [32]byte, -) { - var ( - signingPubKeys []kyber.Point - encryptPubKeys []kyber.Point - ) - for i := range signKeys { - signingPubKeys = append(signingPubKeys, signKeys[i].PublicKey) - encryptPubKeys = append(encryptPubKeys, encryptKeys[i].PublicKey) - } - - offchainConfig, err := ocr2dkg.OffchainConfig( - encryptPubKeys, - signingPubKeys, - &altbn_128.G1{}, - &ocr2vrftypes.PairingTranslation{ - Suite: &altbn_128.PairingSuite{}, - }) - require.NoError(t, err) - onchainConfig, err := ocr2dkg.OnchainConfig(keyID) - require.NoError(t, err) - - var schedule []int - for range oracleIdentities { - schedule = append(schedule, 1) - } - - _, _, f, onchainConfig, offchainConfigVersion, offchainConfig, err := confighelper2.ContractSetConfigArgsForTests( - 30*time.Second, - 10*time.Second, - 20*time.Second, - 2*time.Second, - 20*time.Second, - 3, - schedule, - oracleIdentities, - offchainConfig, - 50*time.Millisecond, - 10*time.Second, - 10*time.Second, - 100*time.Millisecond, - 1*time.Second, - int(f), - onchainConfig) - require.NoError(t, err) - - _, err = uni.dkg.SetConfig(uni.owner, onchainPubKeys, transmitters, f, onchainConfig, offchainConfigVersion, offchainConfig) - require.NoError(t, err) - - uni.backend.Commit() -} - -func setVRFConfig( - t *testing.T, - uni ocr2vrfUniverse, - onchainPubKeys []common.Address, - transmitters []common.Address, - f uint8, - oracleIdentities []confighelper2.OracleIdentityExtra, - confDelaysSl []int, - keyID [32]byte, -) { - offchainConfig := ocr2vrf.OffchainConfig(&ocr2vrftypes.CoordinatorConfig{ - CacheEvictionWindowSeconds: 1, - BatchGasLimit: 5_000_000, - CoordinatorOverhead: 50_000, - CallbackOverhead: 50_000, - BlockGasOverhead: 50_000, - LookbackBlocks: 1_000, - }) - - confDelays := make(map[uint32]struct{}) - for _, c := range confDelaysSl { - confDelays[uint32(c)] = struct{}{} - } - - onchainConfig := ocr2vrf.OnchainConfig(confDelays) - - var schedule []int - for range oracleIdentities { - schedule = append(schedule, 1) - } - - _, _, f, onchainConfig, offchainConfigVersion, offchainConfig, err := confighelper2.ContractSetConfigArgsForTests( - 30*time.Second, - 10*time.Second, - 20*time.Second, - 2*time.Second, - 20*time.Second, - 3, - schedule, - oracleIdentities, - offchainConfig, - 50*time.Millisecond, - 10*time.Second, - 10*time.Second, - 100*time.Millisecond, - 1*time.Second, - int(f), - onchainConfig) - require.NoError(t, err) - - _, err = uni.beacon.SetConfig( - uni.owner, onchainPubKeys, transmitters, f, onchainConfig, offchainConfigVersion, offchainConfig) - require.NoError(t, err) - - uni.backend.Commit() -} - -func randomKeyID(t *testing.T) (r [32]byte) { - _, err := rand.Read(r[:]) - require.NoError(t, err) - return -} - -func ptr[T any](v T) *T { return &v } diff --git a/core/services/ocr2/plugins/ocr2vrf/juelsfeecoin/link_eth_price_provider.go b/core/services/ocr2/plugins/ocr2vrf/juelsfeecoin/link_eth_price_provider.go deleted file mode 100644 index 2601ae14668..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/juelsfeecoin/link_eth_price_provider.go +++ /dev/null @@ -1,109 +0,0 @@ -package juelsfeecoin - -import ( - "context" - "math/big" - "runtime" - "sync" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/pkg/errors" - - "github.com/smartcontractkit/chainlink-vrf/types" - - evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/aggregator_v3_interface" - "github.com/smartcontractkit/chainlink/v2/core/logger" -) - -// linkEthPriceProvider provides conversation rate between Link and native token using price feeds -type linkEthPriceProvider struct { - aggregator aggregator_v3_interface.AggregatorV3InterfaceInterface - timeout time.Duration - interval time.Duration - lock sync.RWMutex - stop chan struct{} - currentJuelsPerFeeCoin *big.Int - lggr logger.Logger -} - -var _ types.JuelsPerFeeCoin = (*linkEthPriceProvider)(nil) - -func NewLinkEthPriceProvider( - linkEthFeedAddress common.Address, - client evmclient.Client, - timeout time.Duration, - interval time.Duration, - logger logger.Logger, -) (types.JuelsPerFeeCoin, error) { - aggregator, err := aggregator_v3_interface.NewAggregatorV3Interface(linkEthFeedAddress, client) - if err != nil { - return nil, errors.Wrap(err, "new aggregator v3 interface") - } - - if timeout >= interval { - return nil, errors.New("timeout must be less than interval") - } - - p := &linkEthPriceProvider{ - aggregator: aggregator, - timeout: timeout, - interval: interval, - currentJuelsPerFeeCoin: big.NewInt(0), - stop: make(chan struct{}), - lggr: logger, - } - - // Begin updating JuelsPerFeeCoin. - // Stop fetching price updates on garbage collection, as to avoid a leaked goroutine. - go p.run() - runtime.SetFinalizer(p, func(p *linkEthPriceProvider) { p.stop <- struct{}{} }) - - return p, nil -} - -// Run updates the JuelsPerFeeCoin value at a regular interval, until stopped. -// Do not block the main thread, such that updates are always timely. -func (p *linkEthPriceProvider) run() { - ticker := time.NewTicker(p.interval) - for { - select { - case <-ticker.C: - go p.updateJuelsPerFeeCoin() - case <-p.stop: - ticker.Stop() - return - } - } -} - -// JuelsPerFeeCoin returns the current JuelsPerFeeCoin value, threadsafe. -func (p *linkEthPriceProvider) JuelsPerFeeCoin() (*big.Int, error) { - p.lock.RLock() - defer p.lock.RUnlock() - return p.currentJuelsPerFeeCoin, nil -} - -// Get current JuelsPerFeeCoin value from aggregator contract. -// If the RPC call fails, log the error and return. -func (p *linkEthPriceProvider) updateJuelsPerFeeCoin() { - // Ensure writes to currentJuelsPerFeeCoin are threadsafe. - p.lock.Lock() - defer p.lock.Unlock() - - ctx, cancel := context.WithTimeout(context.Background(), p.timeout) - defer cancel() - roundData, err := p.aggregator.LatestRoundData(&bind.CallOpts{Context: ctx}) - - // For RPC issues, set the most recent price to 0. This way, stale prices will not be transmitted, - // and zero-observations can be ignored in OCR and on-chain. - if err != nil { - p.currentJuelsPerFeeCoin = big.NewInt(0) - return - } - - // Update JuelsPerFeeCoin to the obtained value. - p.currentJuelsPerFeeCoin = roundData.Answer -} diff --git a/core/services/ocr2/plugins/ocr2vrf/juelsfeecoin/link_eth_price_provider_test.go b/core/services/ocr2/plugins/ocr2vrf/juelsfeecoin/link_eth_price_provider_test.go deleted file mode 100644 index 73a66d17ead..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/juelsfeecoin/link_eth_price_provider_test.go +++ /dev/null @@ -1,91 +0,0 @@ -package juelsfeecoin - -import ( - "errors" - "math/big" - "testing" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - - evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/aggregator_v3_interface" - "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/vrf/mocks" -) - -func Test_JuelsPerFeeCoin(t *testing.T) { - t.Parallel() - - t.Run("returns juels per fee coin", func(t *testing.T) { - mockAggregator := mocks.NewAggregatorV3Interface(t) - latestRoundData := aggregator_v3_interface.LatestRoundData{Answer: big.NewInt(10000)} - mockAggregator.On("LatestRoundData", mock.Anything).Return(latestRoundData, nil) - - // Start linkEthPriceProvider. - provider := &linkEthPriceProvider{ - aggregator: mockAggregator, - timeout: time.Second / 2, - interval: time.Second, - stop: make(chan struct{}), - currentJuelsPerFeeCoin: big.NewInt(0), - lggr: logger.TestLogger(t), - } - go provider.run() - t.Cleanup(func() { close(provider.stop) }) - - // Assert correct initial price. - price, err := provider.JuelsPerFeeCoin() - require.NoError(t, err) - assert.Equal(t, int64(0), price.Int64()) - - // Wait until the price is updated. - time.Sleep(2 * time.Second) - - // Ensure the correct price is returned. - price, err = provider.JuelsPerFeeCoin() - require.NoError(t, err) - assert.Equal(t, int64(10000), price.Int64()) - }) - - t.Run("returns juels per fee coin (error updating)", func(t *testing.T) { - mockAggregator := mocks.NewAggregatorV3Interface(t) - mockAggregator.On("LatestRoundData", mock.Anything).Return(aggregator_v3_interface.LatestRoundData{}, - errors.New("could not fetch")) - - // Start linkEthPriceProvider. - provider := &linkEthPriceProvider{ - aggregator: mockAggregator, - timeout: time.Second / 2, - interval: time.Second, - stop: make(chan struct{}), - currentJuelsPerFeeCoin: big.NewInt(0), - lggr: logger.TestLogger(t), - } - go provider.run() - t.Cleanup(func() { close(provider.stop) }) - - // Assert correct initial price. - price, err := provider.JuelsPerFeeCoin() - require.NoError(t, err) - assert.Equal(t, int64(0), price.Int64()) - - // Wait until the price is updated. - time.Sleep(2 * time.Second) - - // Ensure the correct price is returned. - price, err = provider.JuelsPerFeeCoin() - require.NoError(t, err) - assert.Equal(t, int64(0), price.Int64()) - }) - - t.Run("errors out for timeout >= interval", func(t *testing.T) { - evmClient := evmclimocks.NewClient(t) - _, err := NewLinkEthPriceProvider(common.Address{}, evmClient, time.Second, time.Second, logger.TestLogger(t)) - require.Error(t, err) - require.Equal(t, "timeout must be less than interval", err.Error()) - }) -} diff --git a/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_provider.go b/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_provider.go deleted file mode 100644 index 880b8084338..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_provider.go +++ /dev/null @@ -1,42 +0,0 @@ -package reasonablegasprice - -import ( - "math/big" - "time" - - "github.com/smartcontractkit/chainlink-vrf/types" - - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" -) - -// reasonableGasPriceProvider provides an estimate for the average gas price -type reasonableGasPriceProvider struct { - estimator gas.EvmFeeEstimator - timeout time.Duration - maxGasPrice *assets.Wei - supportsDynamicFee bool -} - -var _ types.ReasonableGasPrice = (*reasonableGasPriceProvider)(nil) - -func NewReasonableGasPriceProvider( - estimator gas.EvmFeeEstimator, - timeout time.Duration, - maxGasPrice *assets.Wei, - supportsDynamicFee bool, -) types.ReasonableGasPrice { - return &reasonableGasPriceProvider{ - estimator: estimator, - timeout: timeout, - maxGasPrice: maxGasPrice, - supportsDynamicFee: supportsDynamicFee, - } -} - -// TODO: implement this function to use a gas estimator. This change can be rolled out -// to all nodes while the on-chain `useReasonableGasPrice` flag is disabled. Once reasonable -// gas prices reported by nodes become 'reasonable' the flag can be enabled. -func (r *reasonableGasPriceProvider) ReasonableGasPrice() (*big.Int, error) { - return big.NewInt(0), nil -} diff --git a/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_test.go b/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_test.go deleted file mode 100644 index ec8b085dea8..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package reasonablegasprice - -import ( - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" -) - -func Test_ReasonableGasPrice(t *testing.T) { - t.Parallel() - - t.Run("returns reasonable gas price", func(t *testing.T) { - r := NewReasonableGasPriceProvider(nil, 1*time.Second, assets.GWei(100), true) - g, err := r.ReasonableGasPrice() - require.NoError(t, err) - - require.Equal(t, int64(0), g.Int64()) - }) -} diff --git a/core/services/ocr2/plugins/ocr2vrf/reportserializer/report_serializer.go b/core/services/ocr2/plugins/ocr2vrf/reportserializer/report_serializer.go deleted file mode 100644 index b33c749589f..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/reportserializer/report_serializer.go +++ /dev/null @@ -1,61 +0,0 @@ -package reportserializer - -import ( - "github.com/pkg/errors" - "go.dedis.ch/kyber/v3" - - "github.com/smartcontractkit/chainlink-vrf/ocr2vrf" - "github.com/smartcontractkit/chainlink-vrf/types" -) - -type reportSerializer struct { - e ocr2vrf.EthereumReportSerializer -} - -var _ types.ReportSerializer = (*reportSerializer)(nil) - -// NewReportSerializer provides a serialization component for sending byte-encoded reports on-chain. -func NewReportSerializer(encryptionGroup kyber.Group) types.ReportSerializer { - return &reportSerializer{ - e: ocr2vrf.EthereumReportSerializer{ - G: encryptionGroup, - }, - } -} - -// SerializeReport serializes an abstract report into abi-encoded bytes. -func (serializer *reportSerializer) SerializeReport(r types.AbstractReport) ([]byte, error) { - packed, err := serializer.e.SerializeReport(r) - - if err != nil { - return nil, errors.Wrap(err, "serialize report") - } - - return packed, nil -} - -// DeserializeReport deserializes a serialized byte array into a report. -func (serializer *reportSerializer) DeserializeReport(reportBytes []byte) (types.AbstractReport, error) { - // Leaving unimplemented, as serialization here is not two-way. The object that is abi-encoded on-chain is a BeaconReport, not an AbstractReport. - // So, the AbstractReport is first converted to a BeaconReport before the encoding. Converting an AbstractReport to a BeaconReport requires - // the removal of some fields, so when it is converted back to a BeaconReport and then deserialized, those fields are missing. - // Consequently, either the returned object from this function will be an abstract report - // that has had some fields removed/zeroed, or the return type will be changed to a BeaconReport, which cannot be re-serialized. - // - // Also, the need for off-chain deserialization is not currently clear. - panic("implement me") -} - -// MaxReportLength gives the max length of a report to be transmitted on-chain. -func (serializer *reportSerializer) MaxReportLength() uint { - return 150_000 // TODO: change this. -} - -// ReportLength provides the expected report length of a report. -func (serializer *reportSerializer) ReportLength(a types.AbstractReport) uint { - s, err := serializer.SerializeReport(a) - if err != nil { - return 0 - } - return uint(len(s)) -} diff --git a/core/services/ocr2/plugins/ocr2vrf/reportserializer/report_serializer_test.go b/core/services/ocr2/plugins/ocr2vrf/reportserializer/report_serializer_test.go deleted file mode 100644 index 32704a55b0f..00000000000 --- a/core/services/ocr2/plugins/ocr2vrf/reportserializer/report_serializer_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package reportserializer_test - -import ( - "math/big" - "testing" - - "github.com/ethereum/go-ethereum/common" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink-vrf/altbn_128" - "github.com/smartcontractkit/chainlink-vrf/types" - - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2vrf/reportserializer" -) - -func Test_Serialize_Deserialize(t *testing.T) { - altbn128Suite := &altbn_128.PairingSuite{} - reportSerializer := reportserializer.NewReportSerializer(altbn128Suite.G1()) - - unserializedReport := types.AbstractReport{ - JuelsPerFeeCoin: big.NewInt(10), - RecentBlockHeight: 100, - RecentBlockHash: common.HexToHash("0x002"), - Outputs: []types.AbstractVRFOutput{{ - BlockHeight: 10, - ConfirmationDelay: 20, - Callbacks: []types.AbstractCostedCallbackRequest{{ - RequestID: big.NewInt(1), - NumWords: 2, - Requester: common.HexToAddress("0x03"), - Arguments: []byte{4}, - SubscriptionID: big.NewInt(5), - GasAllowance: big.NewInt(6), - Price: big.NewInt(7), - GasPrice: big.NewInt(0), - WeiPerUnitLink: big.NewInt(0), - }}, - }}, - } - r, err := reportSerializer.SerializeReport(unserializedReport) - require.NoError(t, err) - require.Equal(t, uint(len(r)), reportSerializer.ReportLength(unserializedReport)) - // TODO: Add deserialization after this point to verify. -} diff --git a/core/services/ocr2/validate/validate.go b/core/services/ocr2/validate/validate.go index e39bb6d1c63..2993a67114e 100644 --- a/core/services/ocr2/validate/validate.go +++ b/core/services/ocr2/validate/validate.go @@ -2,7 +2,6 @@ package validate import ( "context" - "encoding/hex" "encoding/json" "errors" "fmt" @@ -20,10 +19,8 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/config/env" "github.com/smartcontractkit/chainlink/v2/core/services/job" - dkgconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/dkg/config" lloconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/llo/config" mercuryconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/mercury/config" - ocr2vrfconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2vrf/config" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/smartcontractkit/chainlink/v2/plugins" @@ -111,10 +108,6 @@ func validateSpec(ctx context.Context, tree *toml.Tree, spec job.Job, rc plugins if spec.Pipeline.Source == "" { return errors.New("no pipeline specified") } - case types.DKG: - return validateDKGSpec(spec.OCR2OracleSpec.PluginConfig) - case types.OCR2VRF: - return validateOCR2VRFSpec(spec.OCR2OracleSpec.PluginConfig) case types.OCR2Keeper: return validateOCR2KeeperSpec(spec.OCR2OracleSpec.PluginConfig) case types.Functions: @@ -312,68 +305,6 @@ func validateGenericPluginSpec(ctx context.Context, spec *job.OCR2OracleSpec, rc return plugin.ValidateConfig(ctx, spec.PluginConfig) } -func validateDKGSpec(jsonConfig job.JSONConfig) error { - if jsonConfig == nil { - return errors.New("pluginConfig is empty") - } - var pluginConfig dkgconfig.PluginConfig - err := json.Unmarshal(jsonConfig.Bytes(), &pluginConfig) - if err != nil { - return pkgerrors.Wrap(err, "error while unmarshaling plugin config") - } - err = validateHexString(pluginConfig.EncryptionPublicKey, 32) - if err != nil { - return pkgerrors.Wrap(err, "validation error for encryptedPublicKey") - } - err = validateHexString(pluginConfig.SigningPublicKey, 32) - if err != nil { - return pkgerrors.Wrap(err, "validation error for signingPublicKey") - } - err = validateHexString(pluginConfig.KeyID, 32) - if err != nil { - return pkgerrors.Wrap(err, "validation error for keyID") - } - - return nil -} - -func validateHexString(val string, expectedLengthInBytes uint) error { - decoded, err := hex.DecodeString(val) - if err != nil { - return pkgerrors.Wrapf(err, "expected hex string but received %s", val) - } - if len(decoded) != int(expectedLengthInBytes) { - return fmt.Errorf("value: %s has unexpected length. Expected %d bytes", val, expectedLengthInBytes) - } - return nil -} - -func validateOCR2VRFSpec(jsonConfig job.JSONConfig) error { - if jsonConfig == nil { - return errors.New("pluginConfig is empty") - } - var cfg ocr2vrfconfig.PluginConfig - err := json.Unmarshal(jsonConfig.Bytes(), &cfg) - if err != nil { - return pkgerrors.Wrap(err, "json unmarshal plugin config") - } - err = validateDKGSpec(job.JSONConfig{ - "encryptionPublicKey": cfg.DKGEncryptionPublicKey, - "signingPublicKey": cfg.DKGSigningPublicKey, - "keyID": cfg.DKGKeyID, - }) - if err != nil { - return err - } - if cfg.LinkEthFeedAddress == "" { - return errors.New("linkEthFeedAddress must be provided") - } - if cfg.DKGContractAddress == "" { - return errors.New("dkgContractAddress must be provided") - } - return nil -} - func validateOCR2KeeperSpec(jsonConfig job.JSONConfig) error { return nil } diff --git a/core/services/ocr2/validate/validate_test.go b/core/services/ocr2/validate/validate_test.go index 05a10caeaf5..b92752c647d 100644 --- a/core/services/ocr2/validate/validate_test.go +++ b/core/services/ocr2/validate/validate_test.go @@ -429,263 +429,6 @@ chainID = 1337 require.Contains(t, err.Error(), "no such relay blerg supported") }, }, - { - name: "valid DKG pluginConfig", - toml: ` -type = "offchainreporting2" -schemaVersion = 1 -name = "dkg" -externalJobID = "6d46d85f-d38c-4f4a-9f00-ac29a25b6330" -maxTaskDuration = "1s" -contractID = "0x3e54dCc49F16411A3aaa4cDbC41A25bCa9763Cee" -ocrKeyBundleID = "08d14c6eed757414d72055d28de6caf06535806c6a14e450f3a2f1c854420e17" -p2pv2Bootstrappers = [ - "12D3KooWSbPRwXY4gxFRJT7LWCnjgGbR4S839nfCRCDgQUiNenxa@127.0.0.1:8000" -] -relay = "evm" -pluginType = "dkg" -transmitterID = "0x74103Cf8b436465870b26aa9Fa2F62AD62b22E35" - -[relayConfig] -chainID = 4 - -[onchainSigningStrategy] -strategyName = "single-chain" -[onchainSigningStrategy.config] -evm = "" -publicKey = "0x1234567890123456789012345678901234567890" - -[pluginConfig] -EncryptionPublicKey = "0e86e8cf899ae9a1b43e023bbe8825b103659bb8d6d4e54f6a3cfae7b106069c" -SigningPublicKey = "eb62dbd2beb7c1524275a8019022f6ce6a7e86c9e65e3099452a2b96fc2432b1" -KeyID = "6f3b82406688b8ddb944c6f2e6d808f014c8fa8d568d639c25019568c715fbf0" -`, - assertion: func(t *testing.T, os job.Job, err error) { - require.NoError(t, err) - }, - }, - { - name: "DKG encryption key is not hex", - toml: ` -type = "offchainreporting2" -schemaVersion = 1 -name = "dkg" -externalJobID = "6d46d85f-d38c-4f4a-9f00-ac29a25b6330" -maxTaskDuration = "1s" -contractID = "0x3e54dCc49F16411A3aaa4cDbC41A25bCa9763Cee" -ocrKeyBundleID = "08d14c6eed757414d72055d28de6caf06535806c6a14e450f3a2f1c854420e17" -p2pv2Bootstrappers = [ - "12D3KooWSbPRwXY4gxFRJT7LWCnjgGbR4S839nfCRCDgQUiNenxa@127.0.0.1:8000" -] -relay = "evm" -pluginType = "dkg" -transmitterID = "0x74103Cf8b436465870b26aa9Fa2F62AD62b22E35" - -[relayConfig] -chainID = 4 - -[onchainSigningStrategy] -strategyName = "single-chain" -[onchainSigningStrategy.config] -evm = "" -publicKey = "0x1234567890123456789012345678901234567890" - -[pluginConfig] -EncryptionPublicKey = "frog" -SigningPublicKey = "eb62dbd2beb7c1524275a8019022f6ce6a7e86c9e65e3099452a2b96fc2432b1" -KeyID = "6f3b82406688b8ddb944c6f2e6d808f014c8fa8d568d639c25019568c715fbf0" -`, - assertion: func(t *testing.T, os job.Job, err error) { - require.Error(t, err) - require.Contains(t, err.Error(), "expected hex string but received frog") - require.Contains(t, err.Error(), "validation error for encryptedPublicKey") - }, - }, - { - name: "DKG encryption key is too short", - toml: ` -type = "offchainreporting2" -schemaVersion = 1 -name = "dkg" -externalJobID = "6d46d85f-d38c-4f4a-9f00-ac29a25b6330" -maxTaskDuration = "1s" -contractID = "0x3e54dCc49F16411A3aaa4cDbC41A25bCa9763Cee" -ocrKeyBundleID = "08d14c6eed757414d72055d28de6caf06535806c6a14e450f3a2f1c854420e17" -p2pv2Bootstrappers = [ - "12D3KooWSbPRwXY4gxFRJT7LWCnjgGbR4S839nfCRCDgQUiNenxa@127.0.0.1:8000" -] -relay = "evm" -pluginType = "dkg" -transmitterID = "0x74103Cf8b436465870b26aa9Fa2F62AD62b22E35" - -[relayConfig] -chainID = 4 - -[onchainSigningStrategy] -strategyName = "single-chain" -[onchainSigningStrategy.config] -evm = "" -publicKey = "0x1234567890123456789012345678901234567890" - -[pluginConfig] -EncryptionPublicKey = "0e86e8cf899ae9a1b43e023bbe8825b103659bb8d6d4e54f6a3cfae7b10606" -SigningPublicKey = "eb62dbd2beb7c1524275a8019022f6ce6a7e86c9e65e3099452a2b96fc2432b1" -KeyID = "6f3b82406688b8ddb944c6f2e6d808f014c8fa8d568d639c25019568c715fbf0" -`, - assertion: func(t *testing.T, os job.Job, err error) { - require.Error(t, err) - require.Contains(t, err.Error(), "value: 0e86e8cf899ae9a1b43e023bbe8825b103659bb8d6d4e54f6a3cfae7b10606 has unexpected length. Expected 32 bytes") - require.Contains(t, err.Error(), "validation error for encryptedPublicKey") - }, - }, - { - name: "DKG signing key is not hex", - toml: ` -type = "offchainreporting2" -schemaVersion = 1 -name = "dkg" -externalJobID = "6d46d85f-d38c-4f4a-9f00-ac29a25b6330" -maxTaskDuration = "1s" -contractID = "0x3e54dCc49F16411A3aaa4cDbC41A25bCa9763Cee" -ocrKeyBundleID = "08d14c6eed757414d72055d28de6caf06535806c6a14e450f3a2f1c854420e17" -p2pv2Bootstrappers = [ - "12D3KooWSbPRwXY4gxFRJT7LWCnjgGbR4S839nfCRCDgQUiNenxa@127.0.0.1:8000" -] -relay = "evm" -pluginType = "dkg" -transmitterID = "0x74103Cf8b436465870b26aa9Fa2F62AD62b22E35" - -[relayConfig] -chainID = 4 - -[onchainSigningStrategy] -strategyName = "single-chain" -[onchainSigningStrategy.config] -evm = "" -publicKey = "0x1234567890123456789012345678901234567890" - -[pluginConfig] -EncryptionPublicKey = "0e86e8cf899ae9a1b43e023bbe8825b103659bb8d6d4e54f6a3cfae7b106069c" -SigningPublicKey = "frog" -KeyID = "6f3b82406688b8ddb944c6f2e6d808f014c8fa8d568d639c25019568c715fbf0" -`, - assertion: func(t *testing.T, os job.Job, err error) { - require.Error(t, err) - require.Contains(t, err.Error(), "expected hex string but received frog") - require.Contains(t, err.Error(), "validation error for signingPublicKey") - }, - }, - { - name: "DKG signing key is too short", - toml: ` -type = "offchainreporting2" -schemaVersion = 1 -name = "dkg" -externalJobID = "6d46d85f-d38c-4f4a-9f00-ac29a25b6330" -maxTaskDuration = "1s" -contractID = "0x3e54dCc49F16411A3aaa4cDbC41A25bCa9763Cee" -ocrKeyBundleID = "08d14c6eed757414d72055d28de6caf06535806c6a14e450f3a2f1c854420e17" -p2pv2Bootstrappers = [ - "12D3KooWSbPRwXY4gxFRJT7LWCnjgGbR4S839nfCRCDgQUiNenxa@127.0.0.1:8000" -] -relay = "evm" -pluginType = "dkg" -transmitterID = "0x74103Cf8b436465870b26aa9Fa2F62AD62b22E35" - -[relayConfig] -chainID = 4 - -[onchainSigningStrategy] -strategyName = "single-chain" -[onchainSigningStrategy.config] -evm = "" -publicKey = "0x1234567890123456789012345678901234567890" - -[pluginConfig] -EncryptionPublicKey = "0e86e8cf899ae9a1b43e023bbe8825b103659bb8d6d4e54f6a3cfae7b106069c" -SigningPublicKey = "eb62dbd2beb7c1524275a8019022f6ce6a7e86c9e65e3099452a2b96fc24" -KeyID = "6f3b82406688b8ddb944c6f2e6d808f014c8fa8d568d639c25019568c715fbf0" -`, - assertion: func(t *testing.T, os job.Job, err error) { - require.Error(t, err) - require.Contains(t, err.Error(), "value: eb62dbd2beb7c1524275a8019022f6ce6a7e86c9e65e3099452a2b96fc24 has unexpected length. Expected 32 bytes") - require.Contains(t, err.Error(), "validation error for signingPublicKey") - }, - }, - { - name: "DKG keyID is not hex", - toml: ` -type = "offchainreporting2" -schemaVersion = 1 -name = "dkg" -externalJobID = "6d46d85f-d38c-4f4a-9f00-ac29a25b6330" -maxTaskDuration = "1s" -contractID = "0x3e54dCc49F16411A3aaa4cDbC41A25bCa9763Cee" -ocrKeyBundleID = "08d14c6eed757414d72055d28de6caf06535806c6a14e450f3a2f1c854420e17" -p2pv2Bootstrappers = [ - "12D3KooWSbPRwXY4gxFRJT7LWCnjgGbR4S839nfCRCDgQUiNenxa@127.0.0.1:8000" -] -relay = "evm" -pluginType = "dkg" -transmitterID = "0x74103Cf8b436465870b26aa9Fa2F62AD62b22E35" - -[relayConfig] -chainID = 4 - -[onchainSigningStrategy] -strategyName = "single-chain" -[onchainSigningStrategy.config] -evm = "" -publicKey = "0x1234567890123456789012345678901234567890" - -[pluginConfig] -EncryptionPublicKey = "0e86e8cf899ae9a1b43e023bbe8825b103659bb8d6d4e54f6a3cfae7b106069c" -SigningPublicKey = "eb62dbd2beb7c1524275a8019022f6ce6a7e86c9e65e3099452a2b96fc2432b1" -KeyID = "frog" -`, - assertion: func(t *testing.T, os job.Job, err error) { - require.Error(t, err) - require.Contains(t, err.Error(), "expected hex string but received frog") - require.Contains(t, err.Error(), "validation error for keyID") - }, - }, - { - name: "DKG keyID is too long", - toml: ` -type = "offchainreporting2" -schemaVersion = 1 -name = "dkg" -externalJobID = "6d46d85f-d38c-4f4a-9f00-ac29a25b6330" -maxTaskDuration = "1s" -contractID = "0x3e54dCc49F16411A3aaa4cDbC41A25bCa9763Cee" -ocrKeyBundleID = "08d14c6eed757414d72055d28de6caf06535806c6a14e450f3a2f1c854420e17" -p2pv2Bootstrappers = [ - "12D3KooWSbPRwXY4gxFRJT7LWCnjgGbR4S839nfCRCDgQUiNenxa@127.0.0.1:8000" -] -relay = "evm" -pluginType = "dkg" -transmitterID = "0x74103Cf8b436465870b26aa9Fa2F62AD62b22E35" - -[relayConfig] -chainID = 4 - -[onchainSigningStrategy] -strategyName = "single-chain" -[onchainSigningStrategy.config] -evm = "" -publicKey = "0x1234567890123456789012345678901234567890" - -[pluginConfig] -EncryptionPublicKey = "0e86e8cf899ae9a1b43e023bbe8825b103659bb8d6d4e54f6a3cfae7b106069c" -SigningPublicKey = "eb62dbd2beb7c1524275a8019022f6ce6a7e86c9e65e3099452a2b96fc2432b1" -KeyID = "6f3b82406688b8ddb944c6f2e6d808f014c8fa8d568d639c25019568c715fbaaaabc" -`, - assertion: func(t *testing.T, os job.Job, err error) { - require.Error(t, err) - require.Contains(t, err.Error(), "value: 6f3b82406688b8ddb944c6f2e6d808f014c8fa8d568d639c25019568c715fbaaaabc has unexpected length. Expected 32 bytes") - require.Contains(t, err.Error(), "validation error for keyID") - }, - }, { name: "Generic public onchain signing strategy with no public key", toml: ` diff --git a/core/services/relay/evm/ocr2vrf.go b/core/services/relay/evm/ocr2vrf.go deleted file mode 100644 index f8cf7527f2c..00000000000 --- a/core/services/relay/evm/ocr2vrf.go +++ /dev/null @@ -1,178 +0,0 @@ -package evm - -import ( - "context" - "encoding/json" - "fmt" - - "github.com/ethereum/go-ethereum/common" - "github.com/smartcontractkit/libocr/offchainreporting2plus/chains/evmutil" - ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - - commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" - - "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" - "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/dkg/config" - "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" -) - -// DKGProvider provides all components needed for a DKG plugin. -type DKGProvider interface { - commontypes.Plugin -} - -// OCR2VRFProvider provides all components needed for a OCR2VRF plugin. -type OCR2VRFProvider interface { - commontypes.Plugin -} - -// OCR2VRFRelayer contains the relayer and instantiating functions for OCR2VRF providers. -type OCR2VRFRelayer interface { - NewDKGProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (DKGProvider, error) - NewOCR2VRFProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (OCR2VRFProvider, error) -} - -var ( - _ OCR2VRFRelayer = (*ocr2vrfRelayer)(nil) - _ DKGProvider = (*dkgProvider)(nil) - _ OCR2VRFProvider = (*ocr2vrfProvider)(nil) -) - -// Relayer with added DKG and OCR2VRF provider functions. -type ocr2vrfRelayer struct { - chain legacyevm.Chain - lggr logger.Logger - ethKeystore keystore.Eth -} - -func NewOCR2VRFRelayer(chain legacyevm.Chain, lggr logger.Logger, ethKeystore keystore.Eth) OCR2VRFRelayer { - return &ocr2vrfRelayer{ - chain: chain, - lggr: lggr, - ethKeystore: ethKeystore, - } -} - -func (r *ocr2vrfRelayer) NewDKGProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (DKGProvider, error) { - // TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 - ctx := context.Background() - - configWatcher, err := newOCR2VRFConfigProvider(ctx, r.lggr, r.chain, rargs) - if err != nil { - return nil, err - } - contractTransmitter, err := newOnChainContractTransmitter(ctx, r.lggr, rargs, pargs.TransmitterID, r.ethKeystore, configWatcher, configTransmitterOpts{}, OCR2AggregatorTransmissionContractABI, 0) - if err != nil { - return nil, err - } - - var pluginConfig config.PluginConfig - err = json.Unmarshal(pargs.PluginConfig, &pluginConfig) - if err != nil { - return nil, err - } - - return &dkgProvider{ - configWatcher: configWatcher, - contractTransmitter: contractTransmitter, - pluginConfig: pluginConfig, - }, nil -} - -func (r *ocr2vrfRelayer) NewOCR2VRFProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (OCR2VRFProvider, error) { - // TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 - ctx := context.Background() - - configWatcher, err := newOCR2VRFConfigProvider(ctx, r.lggr, r.chain, rargs) - if err != nil { - return nil, err - } - contractTransmitter, err := newOnChainContractTransmitter(ctx, r.lggr, rargs, pargs.TransmitterID, r.ethKeystore, configWatcher, configTransmitterOpts{}, OCR2AggregatorTransmissionContractABI, 0) - if err != nil { - return nil, err - } - return &ocr2vrfProvider{ - configWatcher: configWatcher, - contractTransmitter: contractTransmitter, - }, nil -} - -type dkgProvider struct { - *configWatcher - contractTransmitter ContractTransmitter - pluginConfig config.PluginConfig -} - -func (c *dkgProvider) ContractTransmitter() ocrtypes.ContractTransmitter { - return c.contractTransmitter -} - -func (c *dkgProvider) ChainReader() commontypes.ContractReader { - return nil -} - -func (c *dkgProvider) Codec() commontypes.Codec { - return nil -} - -type ocr2vrfProvider struct { - *configWatcher - contractTransmitter ContractTransmitter -} - -func (c *ocr2vrfProvider) ContractTransmitter() ocrtypes.ContractTransmitter { - return c.contractTransmitter -} - -func (c *ocr2vrfProvider) ChainReader() commontypes.ContractReader { - return nil -} - -func (c *ocr2vrfProvider) Codec() commontypes.Codec { - return nil -} - -func newOCR2VRFConfigProvider(ctx context.Context, lggr logger.Logger, chain legacyevm.Chain, rargs commontypes.RelayArgs) (*configWatcher, error) { - var relayConfig types.RelayConfig - err := json.Unmarshal(rargs.RelayConfig, &relayConfig) - if err != nil { - return nil, err - } - if !common.IsHexAddress(rargs.ContractID) { - return nil, fmt.Errorf("invalid contract address '%s'", rargs.ContractID) - } - - contractAddress := common.HexToAddress(rargs.ContractID) - configPoller, err := NewConfigPoller( - ctx, - lggr.With("contractID", rargs.ContractID), - CPConfig{ - chain.Client(), - chain.LogPoller(), - contractAddress, - // TODO: Does ocr2vrf need to support config contract? DF-19182 - nil, - OCR2AggregatorLogDecoder, - }, - ) - if err != nil { - return nil, err - } - - offchainConfigDigester := evmutil.EVMOffchainConfigDigester{ - ChainID: chain.Config().EVM().ChainID().Uint64(), - ContractAddress: contractAddress, - } - - return newConfigWatcher( - lggr, - contractAddress, - offchainConfigDigester, - configPoller, - chain, - relayConfig.FromBlock, - rargs.New, - ), nil -} diff --git a/core/services/synchronization/common.go b/core/services/synchronization/common.go index 584f5b24380..1278875e331 100644 --- a/core/services/synchronization/common.go +++ b/core/services/synchronization/common.go @@ -20,7 +20,6 @@ const ( OCR2S4 TelemetryType = "ocr2-s4" OCR2Median TelemetryType = "ocr2-median" OCR3Mercury TelemetryType = "ocr3-mercury" - OCR2VRF TelemetryType = "ocr2-vrf" AutomationCustom TelemetryType = "automation-custom" OCR3Automation TelemetryType = "ocr3-automation" ) diff --git a/core/services/synchronization/telemetry_ingress_batch_client_test.go b/core/services/synchronization/telemetry_ingress_batch_client_test.go index c4f6417131d..964fc9b25b2 100644 --- a/core/services/synchronization/telemetry_ingress_batch_client_test.go +++ b/core/services/synchronization/telemetry_ingress_batch_client_test.go @@ -45,11 +45,6 @@ func TestTelemetryIngressBatchClient_HappyPath(t *testing.T) { ContractID: "0x1", TelemType: synchronization.OCR, } - telemPayload2 := synchronization.TelemPayload{ - Telemetry: []byte("Mock telem 2"), - ContractID: "0x2", - TelemType: synchronization.OCR2VRF, - } telemPayload3 := synchronization.TelemPayload{ Telemetry: []byte("Mock telem 3"), ContractID: "0x3", @@ -58,7 +53,6 @@ func TestTelemetryIngressBatchClient_HappyPath(t *testing.T) { // Assert telemetry payloads for each contract are correctly sent to wsrpc var contractCounter1 atomic.Uint32 - var contractCounter2 atomic.Uint32 var contractCounter3 atomic.Uint32 telemClient.On("TelemBatch", mock.Anything, mock.Anything).Return(nil, nil).Run(func(args mock.Arguments) { telemBatchReq := args.Get(1).(*telemPb.TelemBatchRequest) @@ -70,13 +64,6 @@ func TestTelemetryIngressBatchClient_HappyPath(t *testing.T) { assert.Equal(t, synchronization.OCR, telemPayload1.TelemType) } } - if telemBatchReq.ContractId == "0x2" { - for _, telem := range telemBatchReq.Telemetry { - contractCounter2.Add(1) - assert.Equal(t, telemPayload2.Telemetry, telem) - assert.Equal(t, synchronization.OCR2VRF, telemPayload2.TelemType) - } - } if telemBatchReq.ContractId == "0x3" { for _, telem := range telemBatchReq.Telemetry { contractCounter3.Add(1) @@ -89,15 +76,13 @@ func TestTelemetryIngressBatchClient_HappyPath(t *testing.T) { // Send telemetry testCtx := testutils.Context(t) telemIngressClient.Send(testCtx, telemPayload1.Telemetry, telemPayload1.ContractID, telemPayload1.TelemType) - telemIngressClient.Send(testCtx, telemPayload2.Telemetry, telemPayload2.ContractID, telemPayload2.TelemType) telemIngressClient.Send(testCtx, telemPayload3.Telemetry, telemPayload3.ContractID, telemPayload3.TelemType) time.Sleep(sendInterval * 2) telemIngressClient.Send(testCtx, telemPayload1.Telemetry, telemPayload1.ContractID, telemPayload1.TelemType) telemIngressClient.Send(testCtx, telemPayload1.Telemetry, telemPayload1.ContractID, telemPayload1.TelemType) - telemIngressClient.Send(testCtx, telemPayload2.Telemetry, telemPayload2.ContractID, telemPayload2.TelemType) // Wait for the telemetry to be handled g.Eventually(func() []uint32 { - return []uint32{contractCounter1.Load(), contractCounter2.Load(), contractCounter3.Load()} - }).Should(gomega.Equal([]uint32{3, 2, 1})) + return []uint32{contractCounter1.Load(), contractCounter3.Load()} + }).Should(gomega.Equal([]uint32{3, 1})) } diff --git a/core/web/auth/auth_test.go b/core/web/auth/auth_test.go index 632527ac762..25479409545 100644 --- a/core/web/auth/auth_test.go +++ b/core/web/auth/auth_test.go @@ -276,27 +276,22 @@ var routesRolesMap = [...]routeRules{ {"GET", "/v2/keys/cosmos", true, true, true}, {"GET", "/v2/keys/starknet", true, true, true}, {"GET", "/v2/keys/aptos", true, true, true}, - {"GET", "/v2/keys/dkgsign", true, true, true}, {"POST", "/v2/keys/solana", false, false, true}, {"POST", "/v2/keys/cosmos", false, false, true}, {"POST", "/v2/keys/starknet", false, false, true}, {"POST", "/v2/keys/aptos", false, false, true}, - {"POST", "/v2/keys/dkgsign", false, false, true}, {"DELETE", "/v2/keys/solana/MOCK", false, false, false}, {"DELETE", "/v2/keys/cosmos/MOCK", false, false, false}, {"DELETE", "/v2/keys/starknet/MOCK", false, false, false}, {"DELETE", "/v2/keys/aptos/MOCK", false, false, false}, - {"DELETE", "/v2/keys/dkgsign/MOCK", false, false, false}, {"POST", "/v2/keys/solana/import", false, false, false}, {"POST", "/v2/keys/cosmos/import", false, false, false}, {"POST", "/v2/keys/starknet/import", false, false, false}, {"POST", "/v2/keys/aptos/import", false, false, false}, - {"POST", "/v2/keys/dkgsign/import", false, false, false}, {"POST", "/v2/keys/solana/export/MOCK", false, false, false}, {"POST", "/v2/keys/cosmos/export/MOCK", false, false, false}, {"POST", "/v2/keys/starknet/export/MOCK", false, false, false}, {"POST", "/v2/keys/aptos/export/MOCK", false, false, false}, - {"POST", "/v2/keys/dkgsign/export/MOCK", false, false, false}, {"GET", "/v2/keys/vrf", true, true, true}, {"POST", "/v2/keys/vrf", false, false, true}, {"DELETE", "/v2/keys/vrf/MOCK", false, false, false}, diff --git a/core/web/dkgencrypt_keys_controller.go b/core/web/dkgencrypt_keys_controller.go deleted file mode 100644 index 5bd6fe2f347..00000000000 --- a/core/web/dkgencrypt_keys_controller.go +++ /dev/null @@ -1,17 +0,0 @@ -package web - -import ( - "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgencryptkey" - "github.com/smartcontractkit/chainlink/v2/core/web/presenters" -) - -func NewDKGEncryptKeysController(app chainlink.Application) KeysController { - return NewKeysController[dkgencryptkey.Key, presenters.DKGEncryptKeyResource]( - app.GetKeyStore().DKGEncrypt(), - app.GetLogger(), - app.GetAuditLogger(), - "dkgencryptKey", - presenters.NewDKGEncryptKeyResource, - presenters.NewDKGEncryptKeyResources) -} diff --git a/core/web/dkgencrypt_keys_controller_test.go b/core/web/dkgencrypt_keys_controller_test.go deleted file mode 100644 index 0f4344fdc23..00000000000 --- a/core/web/dkgencrypt_keys_controller_test.go +++ /dev/null @@ -1,109 +0,0 @@ -package web_test - -import ( - "fmt" - "net/http" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink-common/pkg/utils" - "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/web" - "github.com/smartcontractkit/chainlink/v2/core/web/presenters" -) - -func TestDKGEncryptKeysController_Index_HappyPath(t *testing.T) { - t.Parallel() - - client, keyStore := setupDKGEncryptKeysControllerTests(t) - keys, _ := keyStore.DKGEncrypt().GetAll() - - response, cleanup := client.Get("/v2/keys/dkgencrypt") - t.Cleanup(cleanup) - cltest.AssertServerResponse(t, response, http.StatusOK) - - resources := []presenters.DKGEncryptKeyResource{} - err := web.ParseJSONAPIResponse(cltest.ParseResponseBody(t, response), &resources) - assert.NoError(t, err) - - assert.Len(t, resources, len(keys)) - - assert.Equal(t, keys[0].ID(), resources[0].ID) - assert.Equal(t, keys[0].PublicKeyString(), resources[0].PublicKey) -} - -func TestDKGEncryptKeysController_Create_HappyPath(t *testing.T) { - t.Parallel() - - client, keyStore := setupDKGEncryptKeysControllerTests(t) - - response, cleanup := client.Post("/v2/keys/dkgencrypt", nil) - t.Cleanup(cleanup) - cltest.AssertServerResponse(t, response, http.StatusOK) - - keys, _ := keyStore.DKGEncrypt().GetAll() - assert.Len(t, keys, 2) - - resource := presenters.DKGEncryptKeyResource{} - err := web.ParseJSONAPIResponse(cltest.ParseResponseBody(t, response), &resource) - assert.NoError(t, err) - - // the order in which keys are returned by GetAll is non-deterministic - // due to map iteration non-determinism. - found := false - for _, key := range keys { - if key.ID() == resource.ID { - assert.Equal(t, key.PublicKeyString(), resource.PublicKey) - found = true - } - } - assert.True(t, found) - - _, err = keyStore.DKGEncrypt().Get(resource.ID) - assert.NoError(t, err) -} - -func TestDKGEncryptKeysController_Delete_NonExistentDKGEncryptKeyID(t *testing.T) { - t.Parallel() - - client, _ := setupDKGEncryptKeysControllerTests(t) - - response, cleanup := client.Delete("/v2/keys/dkgencrypt/" + "nonexistentKey") - t.Cleanup(cleanup) - assert.Equal(t, http.StatusNotFound, response.StatusCode) -} - -func TestDKGEncryptKeysController_Delete_HappyPath(t *testing.T) { - t.Parallel() - - client, keyStore := setupDKGEncryptKeysControllerTests(t) - - keys, _ := keyStore.DKGEncrypt().GetAll() - initialLength := len(keys) - - response, cleanup := client.Delete(fmt.Sprintf("/v2/keys/dkgencrypt/%s", keys[0].ID())) - t.Cleanup(cleanup) - cltest.AssertServerResponse(t, response, http.StatusOK) - assert.Error(t, utils.JustError(keyStore.DKGEncrypt().Get(keys[0].ID()))) - - afterKeys, err := keyStore.DKGEncrypt().GetAll() - assert.NoError(t, err) - assert.Equal(t, initialLength-1, len(afterKeys)) -} - -func setupDKGEncryptKeysControllerTests(t *testing.T) (cltest.HTTPClientCleaner, keystore.Master) { - t.Helper() - - app := cltest.NewApplication(t) - ctx := testutils.Context(t) - require.NoError(t, app.Start(ctx)) - require.NoError(t, app.KeyStore.DKGEncrypt().Add(ctx, cltest.DefaultDKGEncryptKey)) - - client := app.NewHTTPClient(nil) - - return client, app.GetKeyStore() -} diff --git a/core/web/dkgsign_keys_controller.go b/core/web/dkgsign_keys_controller.go deleted file mode 100644 index 39cebb03030..00000000000 --- a/core/web/dkgsign_keys_controller.go +++ /dev/null @@ -1,17 +0,0 @@ -package web - -import ( - "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgsignkey" - "github.com/smartcontractkit/chainlink/v2/core/web/presenters" -) - -func NewDKGSignKeysController(app chainlink.Application) KeysController { - return NewKeysController[dkgsignkey.Key, presenters.DKGSignKeyResource]( - app.GetKeyStore().DKGSign(), - app.GetLogger(), - app.GetAuditLogger(), - "dkgsignKey", - presenters.NewDKGSignKeyResource, - presenters.NewDKGSignKeyResources) -} diff --git a/core/web/dkgsign_keys_controller_test.go b/core/web/dkgsign_keys_controller_test.go deleted file mode 100644 index 01b8489c0b8..00000000000 --- a/core/web/dkgsign_keys_controller_test.go +++ /dev/null @@ -1,109 +0,0 @@ -package web_test - -import ( - "fmt" - "net/http" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink-common/pkg/utils" - "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/web" - "github.com/smartcontractkit/chainlink/v2/core/web/presenters" -) - -func TestDKGSignKeysController_Index_HappyPath(t *testing.T) { - t.Parallel() - - client, keyStore := setupDKGSignKeysControllerTests(t) - keys, _ := keyStore.DKGSign().GetAll() - - response, cleanup := client.Get("/v2/keys/dkgsign") - t.Cleanup(cleanup) - cltest.AssertServerResponse(t, response, http.StatusOK) - - resources := []presenters.DKGSignKeyResource{} - err := web.ParseJSONAPIResponse(cltest.ParseResponseBody(t, response), &resources) - assert.NoError(t, err) - - assert.Len(t, resources, len(keys)) - - assert.Equal(t, keys[0].ID(), resources[0].ID) - assert.Equal(t, keys[0].PublicKeyString(), resources[0].PublicKey) -} - -func TestDKGSignKeysController_Create_HappyPath(t *testing.T) { - t.Parallel() - - client, keyStore := setupDKGSignKeysControllerTests(t) - - response, cleanup := client.Post("/v2/keys/dkgsign", nil) - t.Cleanup(cleanup) - cltest.AssertServerResponse(t, response, http.StatusOK) - - keys, _ := keyStore.DKGSign().GetAll() - assert.Len(t, keys, 2) - - resource := presenters.DKGSignKeyResource{} - err := web.ParseJSONAPIResponse(cltest.ParseResponseBody(t, response), &resource) - assert.NoError(t, err) - - // the order in which keys are returned by GetAll is non-deterministic - // due to map iteration non-determinism. - found := false - for _, key := range keys { - if key.ID() == resource.ID { - assert.Equal(t, key.PublicKeyString(), resource.PublicKey) - found = true - } - } - assert.True(t, found) - - _, err = keyStore.DKGSign().Get(resource.ID) - assert.NoError(t, err) -} - -func TestDKGSignKeysController_Delete_NonExistentDKGSignKeyID(t *testing.T) { - t.Parallel() - - client, _ := setupDKGSignKeysControllerTests(t) - - response, cleanup := client.Delete("/v2/keys/dkgsign/" + "nonexistentKey") - t.Cleanup(cleanup) - assert.Equal(t, http.StatusNotFound, response.StatusCode) -} - -func TestDKGSignKeysController_Delete_HappyPath(t *testing.T) { - t.Parallel() - - client, keyStore := setupDKGSignKeysControllerTests(t) - - keys, _ := keyStore.DKGSign().GetAll() - initialLength := len(keys) - - response, cleanup := client.Delete(fmt.Sprintf("/v2/keys/dkgsign/%s", keys[0].ID())) - t.Cleanup(cleanup) - cltest.AssertServerResponse(t, response, http.StatusOK) - assert.Error(t, utils.JustError(keyStore.DKGSign().Get(keys[0].ID()))) - - afterKeys, err := keyStore.DKGSign().GetAll() - assert.NoError(t, err) - assert.Equal(t, initialLength-1, len(afterKeys)) -} - -func setupDKGSignKeysControllerTests(t *testing.T) (cltest.HTTPClientCleaner, keystore.Master) { - t.Helper() - - app := cltest.NewApplication(t) - ctx := testutils.Context(t) - require.NoError(t, app.Start(ctx)) - require.NoError(t, app.KeyStore.DKGSign().Add(ctx, cltest.DefaultDKGSignKey)) - - client := app.NewHTTPClient(nil) - - return client, app.GetKeyStore() -} diff --git a/core/web/presenters/dkgencrypt_key.go b/core/web/presenters/dkgencrypt_key.go deleted file mode 100644 index ae715b79048..00000000000 --- a/core/web/presenters/dkgencrypt_key.go +++ /dev/null @@ -1,38 +0,0 @@ -package presenters - -import ( - "github.com/manyminds/api2go/jsonapi" - - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgencryptkey" -) - -// DKGEncryptKeyResource is just that. -type DKGEncryptKeyResource struct { - JAID - PublicKey string `json:"publicKey"` -} - -var _ jsonapi.EntityNamer = DKGEncryptKeyResource{} - -// GetName implements jsonapi.EntityNamer -func (DKGEncryptKeyResource) GetName() string { - return "encryptedDKGEncryptKeys" -} - -// NewDKGEncryptKeyResource creates a new DKGEncryptKeyResource from the given DKG sign key. -func NewDKGEncryptKeyResource(key dkgencryptkey.Key) *DKGEncryptKeyResource { - return &DKGEncryptKeyResource{ - JAID: JAID{ - ID: key.ID(), - }, - PublicKey: key.PublicKeyString(), - } -} - -// NewDKGEncryptKeyResources creates many DKGEncryptKeyResource objects from the given DKG sign keys. -func NewDKGEncryptKeyResources(keys []dkgencryptkey.Key) (resources []DKGEncryptKeyResource) { - for _, key := range keys { - resources = append(resources, *NewDKGEncryptKeyResource(key)) - } - return -} diff --git a/core/web/presenters/dkgsign_key.go b/core/web/presenters/dkgsign_key.go deleted file mode 100644 index e6aa95ff314..00000000000 --- a/core/web/presenters/dkgsign_key.go +++ /dev/null @@ -1,38 +0,0 @@ -package presenters - -import ( - "github.com/manyminds/api2go/jsonapi" - - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/dkgsignkey" -) - -// DKGSignKeyResource is just that. -type DKGSignKeyResource struct { - JAID - PublicKey string `json:"publicKey"` -} - -var _ jsonapi.EntityNamer = DKGSignKeyResource{} - -// GetName implements jsonapi.EntityNamer -func (DKGSignKeyResource) GetName() string { - return "encryptedDKGSignKeys" -} - -// NewDKGSignKeyResource creates a new DKGSignKeyResource from the given DKG sign key. -func NewDKGSignKeyResource(key dkgsignkey.Key) *DKGSignKeyResource { - return &DKGSignKeyResource{ - JAID: JAID{ - ID: key.ID(), - }, - PublicKey: key.PublicKeyString(), - } -} - -// NewDKGSignKeyResources creates many DKGSignKeyResource objects from the given DKG sign keys. -func NewDKGSignKeyResources(keys []dkgsignkey.Key) (resources []DKGSignKeyResource) { - for _, key := range keys { - resources = append(resources, *NewDKGSignKeyResource(key)) - } - return -} diff --git a/core/web/router.go b/core/web/router.go index a220df220c7..6e96b47981b 100644 --- a/core/web/router.go +++ b/core/web/router.go @@ -351,8 +351,6 @@ func v2Routes(app chainlink.Application, r *gin.RouterGroup) { {"cosmos", NewCosmosKeysController(app)}, {"starknet", NewStarkNetKeysController(app)}, {"aptos", NewAptosKeysController(app)}, - {"dkgsign", NewDKGSignKeysController(app)}, - {"dkgencrypt", NewDKGEncryptKeysController(app)}, } { authv2.GET("/keys/"+keys.path, keys.kc.Index) authv2.POST("/keys/"+keys.path, auth.RequiresEditRole(keys.kc.Create)) diff --git a/go.md b/go.md index dda7192c1a1..4ef6c4da9e4 100644 --- a/go.md +++ b/go.md @@ -40,8 +40,6 @@ flowchart LR click chainlink-solana href "https://github.com/smartcontractkit/chainlink-solana" chainlink/v2 --> chainlink-starknet/relayer click chainlink-starknet/relayer href "https://github.com/smartcontractkit/chainlink-starknet" - chainlink/v2 --> chainlink-vrf - click chainlink-vrf href "https://github.com/smartcontractkit/chainlink-vrf" chainlink/v2 --> libocr click libocr href "https://github.com/smartcontractkit/libocr" chainlink/v2 --> tdh2/go/ocr2/decryptionplugin @@ -64,7 +62,6 @@ flowchart LR chainlink-solana --> libocr chainlink-starknet/relayer --> chainlink-common chainlink-starknet/relayer --> libocr - chainlink-vrf --> libocr tdh2/go/ocr2/decryptionplugin --> libocr tdh2/go/ocr2/decryptionplugin --> tdh2/go/tdh2 ``` diff --git a/go.mod b/go.mod index 6389e5364fe..f8a317f4e4e 100644 --- a/go.mod +++ b/go.mod @@ -78,7 +78,6 @@ require ( github.com/smartcontractkit/chainlink-feeds v0.0.0-20240522213638-159fb2d99917 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240703132526-6362ffb96401 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240625074951-06ab5e670dba - github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20240702141926-063ceef8c42e github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 @@ -283,7 +282,6 @@ require ( github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/sethvargo/go-retry v0.2.4 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect - github.com/sirupsen/logrus v1.9.3 // indirect github.com/spf13/afero v1.9.5 // indirect github.com/spf13/cobra v1.8.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect diff --git a/go.sum b/go.sum index 9e896ab6f2e..db1e1fc2259 100644 --- a/go.sum +++ b/go.sum @@ -1182,8 +1182,6 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240703132526-6362ffb9640 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240703132526-6362ffb96401/go.mod h1:NbXXQaNFskVMYRut0MvBlcHu/vDgipGMwYjamvjVB9Y= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240625074951-06ab5e670dba h1:YNSlhK5mobyAaw02LPGgIEuS3lXyCTXcc6oaV2L6uUI= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240625074951-06ab5e670dba/go.mod h1:UVFRacRkP7O7TQAzFmR52v5mUlxf+G1ovMlCQAB/cHU= -github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= -github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868/go.mod h1:Kn1Hape05UzFZ7bOUnm3GVsHzP0TNrVmpfXYNHdqGGs= github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16 h1:TFe+FvzxClblt6qRfqEhUfa4kFQx5UobuoFGO2W4mMo= github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= @@ -1666,7 +1664,6 @@ golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go deleted file mode 100644 index 58e394cb797..00000000000 --- a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go +++ /dev/null @@ -1,338 +0,0 @@ -package ocr2vrf_actions - -import ( - "crypto/ed25519" - "encoding/hex" - "errors" - "fmt" - "strconv" - "testing" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/lib/pq" - "github.com/stretchr/testify/require" - "go.dedis.ch/kyber/v3" - "go.dedis.ch/kyber/v3/group/edwards25519" - "gopkg.in/guregu/null.v4" - - "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" - "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - - "github.com/smartcontractkit/chainlink-vrf/altbn_128" - "github.com/smartcontractkit/chainlink-vrf/dkg" - "github.com/smartcontractkit/chainlink-vrf/ocr2vrf" - ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" - - "github.com/smartcontractkit/chainlink-testing-framework/logging" - "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" - - "github.com/smartcontractkit/chainlink/integration-tests/client" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" -) - -// CreateOCR2VRFJobs bootstraps the first node and to the other nodes sends ocr jobs -func CreateOCR2VRFJobs( - t *testing.T, - bootstrapNode *client.ChainlinkK8sClient, - nonBootstrapNodes []*client.ChainlinkK8sClient, - OCR2VRFPluginConfig *OCR2VRFPluginConfig, - chainID int64, - keyIndex int, -) { - l := logging.GetTestLogger(t) - p2pV2Bootstrapper := createBootstrapJob(t, bootstrapNode, OCR2VRFPluginConfig.DKGConfig.DKGContractAddress, chainID) - - createNonBootstrapJobs(t, nonBootstrapNodes, OCR2VRFPluginConfig, chainID, keyIndex, p2pV2Bootstrapper) - l.Info().Msg("Done creating OCR automation jobs") -} - -func createNonBootstrapJobs( - t *testing.T, - nonBootstrapNodes []*client.ChainlinkK8sClient, - OCR2VRFPluginConfig *OCR2VRFPluginConfig, - chainID int64, - keyIndex int, - P2Pv2Bootstrapper string, -) { - for index, nonBootstrapNode := range nonBootstrapNodes { - nodeTransmitterAddress, err := nonBootstrapNode.EthAddresses() - require.NoError(t, err, "Shouldn't fail getting primary ETH address from OCR node %d", index) - nodeOCRKeys, err := nonBootstrapNode.MustReadOCR2Keys() - require.NoError(t, err, "Shouldn't fail getting OCR keys from OCR node %d", index) - var nodeOCRKeyId []string - for _, key := range nodeOCRKeys.Data { - if key.Attributes.ChainType == string(chaintype.EVM) { - nodeOCRKeyId = append(nodeOCRKeyId, key.ID) - break - } - } - - OCR2VRFJobSpec := client.OCR2TaskJobSpec{ - Name: "ocr2", - JobType: "offchainreporting2", - OCR2OracleSpec: job.OCR2OracleSpec{ - PluginType: "ocr2vrf", - Relay: "evm", - RelayConfig: map[string]interface{}{ - "chainID": int(chainID), - }, - ContractID: OCR2VRFPluginConfig.VRFBeaconConfig.VRFBeaconAddress, - OCRKeyBundleID: null.StringFrom(nodeOCRKeyId[keyIndex]), - TransmitterID: null.StringFrom(nodeTransmitterAddress[keyIndex]), - P2PV2Bootstrappers: pq.StringArray{P2Pv2Bootstrapper}, - PluginConfig: map[string]interface{}{ - "dkgEncryptionPublicKey": fmt.Sprintf("\"%s\"", OCR2VRFPluginConfig.DKGConfig.DKGKeyConfigs[index].DKGEncryptionPublicKey), - "dkgSigningPublicKey": fmt.Sprintf("\"%s\"", OCR2VRFPluginConfig.DKGConfig.DKGKeyConfigs[index].DKGSigningPublicKey), - "dkgKeyID": fmt.Sprintf("\"%s\"", OCR2VRFPluginConfig.DKGConfig.DKGKeyID), - "dkgContractAddress": fmt.Sprintf("\"%s\"", OCR2VRFPluginConfig.DKGConfig.DKGContractAddress), - "vrfCoordinatorAddress": fmt.Sprintf("\"%s\"", OCR2VRFPluginConfig.VRFCoordinatorAddress), - "linkEthFeedAddress": fmt.Sprintf("\"%s\"", OCR2VRFPluginConfig.LinkEthFeedAddress), - }, - }, - } - _, err = nonBootstrapNode.MustCreateJob(&OCR2VRFJobSpec) - require.NoError(t, err, "Shouldn't fail creating OCR Task job on OCR node %d", index) - } -} - -func createBootstrapJob(t *testing.T, bootstrapNode *client.ChainlinkK8sClient, dkgAddress string, chainID int64) string { - bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() - require.NoError(t, err, "Shouldn't fail reading P2P keys from bootstrap node") - bootstrapP2PId := bootstrapP2PIds.Data[0].Attributes.PeerID - - bootstrapSpec := &client.OCR2TaskJobSpec{ - Name: "ocr2 bootstrap node", - JobType: "bootstrap", - OCR2OracleSpec: job.OCR2OracleSpec{ - ContractID: dkgAddress, - Relay: "evm", - RelayConfig: map[string]interface{}{ - "chainID": int(chainID), - }, - }, - } - _, err = bootstrapNode.MustCreateJob(bootstrapSpec) - require.NoError(t, err, "Shouldn't fail creating bootstrap job on bootstrap node") - return fmt.Sprintf("%s@%s:%d", bootstrapP2PId, bootstrapNode.InternalIP(), 6690) -} - -func BuildOCR2DKGConfigVars( - t *testing.T, - ocr2VRFPluginConfig *OCR2VRFPluginConfig, -) contracts.OCRv2Config { - l := logging.GetTestLogger(t) - var onchainPublicKeys []common.Address - for _, onchainPublicKey := range ocr2VRFPluginConfig.OCR2Config.OnchainPublicKeys { - onchainPublicKeys = append(onchainPublicKeys, common.HexToAddress(onchainPublicKey)) - } - - var transmitters []common.Address - for _, transmitterAddress := range ocr2VRFPluginConfig.OCR2Config.TransmitterAddresses { - transmitters = append(transmitters, common.HexToAddress(transmitterAddress)) - } - oracleIdentities, err := toOraclesIdentityList( - onchainPublicKeys, - ocr2VRFPluginConfig.OCR2Config.OffchainPublicKeys, - ocr2VRFPluginConfig.OCR2Config.ConfigPublicKeys, - ocr2VRFPluginConfig.OCR2Config.PeerIds, - ocr2VRFPluginConfig.OCR2Config.TransmitterAddresses, - ) - require.NoError(t, err) - - ed25519Suite := edwards25519.NewBlakeSHA256Ed25519() - var signingKeys []kyber.Point - for _, dkgKey := range ocr2VRFPluginConfig.DKGConfig.DKGKeyConfigs { - signingKeyBytes, err := hex.DecodeString(dkgKey.DKGSigningPublicKey) - require.NoError(t, err) - signingKeyPoint := ed25519Suite.Point() - err = signingKeyPoint.UnmarshalBinary(signingKeyBytes) - require.NoError(t, err) - signingKeys = append(signingKeys, signingKeyPoint) - } - - altbn128Suite := &altbn_128.PairingSuite{} - var encryptionKeys []kyber.Point - for _, dkgKey := range ocr2VRFPluginConfig.DKGConfig.DKGKeyConfigs { - encryptionKeyBytes, err := hex.DecodeString(dkgKey.DKGEncryptionPublicKey) - require.NoError(t, err) - encryptionKeyPoint := altbn128Suite.G1().Point() - err = encryptionKeyPoint.UnmarshalBinary(encryptionKeyBytes) - require.NoError(t, err) - encryptionKeys = append(encryptionKeys, encryptionKeyPoint) - } - - keyIDBytes, err := DecodeHexTo32ByteArray(ocr2VRFPluginConfig.DKGConfig.DKGKeyID) - require.NoError(t, err, "Shouldn't fail decoding DKG key ID") - - offchainConfig, err := dkg.OffchainConfig(encryptionKeys, signingKeys, &altbn_128.G1{}, &ocr2vrftypes.PairingTranslation{ - Suite: &altbn_128.PairingSuite{}, - }) - require.NoError(t, err) - onchainConfig, err := dkg.OnchainConfig(dkg.KeyID(keyIDBytes)) - require.NoError(t, err) - - _, _, f, onchainConfig, offchainConfigVersion, offchainConfig, err := - confighelper.ContractSetConfigArgsForTests( - 30*time.Second, // deltaProgress time.Duration, - 10*time.Second, // deltaResend time.Duration, - 10*time.Millisecond, // deltaRound time.Duration, - 20*time.Millisecond, // deltaGrace time.Duration, - 20*time.Millisecond, // deltaStage time.Duration, - 3, // rMax uint8, - ocr2VRFPluginConfig.OCR2Config.Schedule, // s []int, - oracleIdentities, // oracles []OracleIdentityExtra, - offchainConfig, - 10*time.Millisecond, // maxDurationQuery time.Duration, - 10*time.Second, // maxDurationObservation time.Duration, - 10*time.Second, // maxDurationReport time.Duration, - 10*time.Millisecond, // maxDurationShouldAcceptFinalizedReport time.Duration, - 1*time.Second, // maxDurationShouldTransmitAcceptedReport time.Duration, - 1, // f int, - onchainConfig, // onchainConfig []byte, - ) - require.NoError(t, err, "Shouldn't fail building OCR config") - - l.Info().Msg("Done building DKG OCR config") - return contracts.OCRv2Config{ - Signers: onchainPublicKeys, - Transmitters: transmitters, - F: f, - OnchainConfig: onchainConfig, - OffchainConfigVersion: offchainConfigVersion, - OffchainConfig: offchainConfig, - } -} - -func toOraclesIdentityList( - onchainPubKeys []common.Address, - offchainPubKeys, - configPubKeys, - peerIDs, - transmitters []string, -) ([]confighelper.OracleIdentityExtra, error) { - offchainPubKeysBytes := []types.OffchainPublicKey{} - for _, pkHex := range offchainPubKeys { - pkBytes, err := hex.DecodeString(pkHex) - if err != nil { - return nil, err - } - pkBytesFixed := [ed25519.PublicKeySize]byte{} - n := copy(pkBytesFixed[:], pkBytes) - if n != ed25519.PublicKeySize { - return nil, errors.New("wrong num elements copied") - } - - offchainPubKeysBytes = append(offchainPubKeysBytes, types.OffchainPublicKey(pkBytesFixed)) - } - - configPubKeysBytes := []types.ConfigEncryptionPublicKey{} - for _, pkHex := range configPubKeys { - pkBytes, err := hex.DecodeString(pkHex) - if err != nil { - return nil, err - } - pkBytesFixed := [ed25519.PublicKeySize]byte{} - n := copy(pkBytesFixed[:], pkBytes) - if n != ed25519.PublicKeySize { - return nil, errors.New("wrong num elements copied") - } - - configPubKeysBytes = append(configPubKeysBytes, types.ConfigEncryptionPublicKey(pkBytesFixed)) - } - - o := []confighelper.OracleIdentityExtra{} - for index := range configPubKeys { - o = append(o, confighelper.OracleIdentityExtra{ - OracleIdentity: confighelper.OracleIdentity{ - OnchainPublicKey: onchainPubKeys[index][:], - OffchainPublicKey: offchainPubKeysBytes[index], - PeerID: peerIDs[index], - TransmitAccount: types.Account(transmitters[index]), - }, - ConfigEncryptionPublicKey: configPubKeysBytes[index], - }) - } - return o, nil -} - -func DecodeHexTo32ByteArray(val string) ([32]byte, error) { - var byteArray [32]byte - decoded, err := hex.DecodeString(val) - if err != nil { - return [32]byte{}, err - } - if len(decoded) != 32 { - return [32]byte{}, fmt.Errorf("expected value to be 32 bytes but received %d bytes", len(decoded)) - } - copy(byteArray[:], decoded) - return byteArray, err -} - -func BuildOCR2VRFConfigVars( - t *testing.T, - ocr2VRFPluginConfig *OCR2VRFPluginConfig, -) contracts.OCRv2Config { - l := logging.GetTestLogger(t) - var onchainPublicKeys []common.Address - for _, onchainPublicKey := range ocr2VRFPluginConfig.OCR2Config.OnchainPublicKeys { - onchainPublicKeys = append(onchainPublicKeys, common.HexToAddress(onchainPublicKey)) - } - - var transmitters []common.Address - for _, transmitterAddress := range ocr2VRFPluginConfig.OCR2Config.TransmitterAddresses { - transmitters = append(transmitters, common.HexToAddress(transmitterAddress)) - } - - oracleIdentities, err := toOraclesIdentityList( - onchainPublicKeys, - ocr2VRFPluginConfig.OCR2Config.OffchainPublicKeys, - ocr2VRFPluginConfig.OCR2Config.ConfigPublicKeys, - ocr2VRFPluginConfig.OCR2Config.PeerIds, - ocr2VRFPluginConfig.OCR2Config.TransmitterAddresses, - ) - require.NoError(t, err) - - confDelays := make(map[uint32]struct{}) - - for _, c := range ocr2VRFPluginConfig.VRFBeaconConfig.ConfDelays { - confDelay, err := strconv.ParseUint(c, 0, 32) - require.NoError(t, err) - confDelays[uint32(confDelay)] = struct{}{} - } - - onchainConfig := ocr2vrf.OnchainConfig(confDelays) - - _, _, f, onchainConfig, offchainConfigVersion, offchainConfig, err := - confighelper.ContractSetConfigArgsForTests( - 30*time.Second, // deltaProgress time.Duration, - 10*time.Second, // deltaResend time.Duration, - 10*time.Second, // deltaRound time.Duration, - 20*time.Second, // deltaGrace time.Duration, - 20*time.Second, // deltaStage time.Duration, - 3, // rMax uint8, - ocr2VRFPluginConfig.OCR2Config.Schedule, // s []int, - oracleIdentities, // oracles []OracleIdentityExtra, - ocr2vrf.OffchainConfig(ocr2VRFPluginConfig.VRFBeaconConfig.CoordinatorConfig), - 10*time.Millisecond, // maxDurationQuery time.Duration, - 10*time.Second, // maxDurationObservation time.Duration, - 10*time.Second, // maxDurationReport time.Duration, - 5*time.Second, // maxDurationShouldAcceptFinalizedReport time.Duration, - 1*time.Second, // maxDurationShouldTransmitAcceptedReport time.Duration, - 1, // f int, - onchainConfig, // onchainConfig []byte, - ) - require.NoError(t, err) - - l.Info().Msg("Done building VRF OCR config") - return contracts.OCRv2Config{ - Signers: onchainPublicKeys, - Transmitters: transmitters, - F: f, - OnchainConfig: onchainConfig, - OffchainConfigVersion: offchainConfigVersion, - OffchainConfig: offchainConfig, - } - -} diff --git a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_constants/ocr2vrf_constants.go b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_constants/ocr2vrf_constants.go deleted file mode 100644 index 7f17be3fd84..00000000000 --- a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_constants/ocr2vrf_constants.go +++ /dev/null @@ -1,31 +0,0 @@ -package ocr2vrf_constants - -import ( - "math/big" - "time" - - ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" -) - -var ( - LinkEthFeedResponse = big.NewInt(1e18) - LinkFundingAmount = big.NewInt(100) - BeaconPeriodBlocksCount = big.NewInt(3) - EthFundingAmount = big.NewFloat(1) - NumberOfRandomWordsToRequest = uint16(2) - ConfirmationDelay = big.NewInt(1) - RandomnessFulfilmentTransmissionEventTimeout = time.Minute * 6 - RandomnessRedeemTransmissionEventTimeout = time.Minute * 5 - //keyId can be any random value - KeyID = "aee00d81f822f882b6fe28489822f59ebb21ea95c0ae21d9f67c0239461148fc" - - CoordinatorConfig = &ocr2vrftypes.CoordinatorConfig{ - CacheEvictionWindowSeconds: 60, - BatchGasLimit: 5_000_000, - CoordinatorOverhead: 50_000, - CallbackOverhead: 50_000, - BlockGasOverhead: 50_000, - LookbackBlocks: 1_000, - } - VRFBeaconAllowedConfirmationDelays = []string{"1", "2", "3", "4", "5", "6", "7", "8"} -) diff --git a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_models.go b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_models.go deleted file mode 100644 index 08580203380..00000000000 --- a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_models.go +++ /dev/null @@ -1,37 +0,0 @@ -package ocr2vrf_actions - -import ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" - -type DKGKeyConfig struct { - DKGEncryptionPublicKey string - DKGSigningPublicKey string -} - -type DKGConfig struct { - DKGKeyConfigs []DKGKeyConfig - DKGKeyID string - DKGContractAddress string -} - -type VRFBeaconConfig struct { - VRFBeaconAddress string - ConfDelays []string - CoordinatorConfig *ocr2vrftypes.CoordinatorConfig -} - -type OCR2Config struct { - OnchainPublicKeys []string - OffchainPublicKeys []string - PeerIds []string - ConfigPublicKeys []string - TransmitterAddresses []string - Schedule []int -} - -type OCR2VRFPluginConfig struct { - OCR2Config OCR2Config - DKGConfig DKGConfig - VRFBeaconConfig VRFBeaconConfig - VRFCoordinatorAddress string - LinkEthFeedAddress string -} diff --git a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go deleted file mode 100644 index cda6fa72ca2..00000000000 --- a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go +++ /dev/null @@ -1,363 +0,0 @@ -package ocr2vrf_actions - -import ( - "math/big" - "strings" - "testing" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/seth" - - ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" - - "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/logging" - "github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext" - - "github.com/smartcontractkit/chainlink/integration-tests/actions" - chainlinkutils "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" - - "github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions/ocr2vrf_constants" - "github.com/smartcontractkit/chainlink/integration-tests/client" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" -) - -func SetAndWaitForVRFBeaconProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, vrfBeacon contracts.VRFBeacon) { - l := logging.GetTestLogger(t) - ocr2VrfConfig := BuildOCR2VRFConfigVars(t, ocr2VRFPluginConfig) - l.Debug().Interface("OCR2 VRF Config", ocr2VrfConfig).Msg("OCR2 VRF Config prepared") - - err := vrfBeacon.SetConfig( - ocr2VrfConfig.Signers, - ocr2VrfConfig.Transmitters, - ocr2VrfConfig.F, - ocr2VrfConfig.OnchainConfig, - ocr2VrfConfig.OffchainConfigVersion, - ocr2VrfConfig.OffchainConfig, - ) - require.NoError(t, err, "Error setting OCR config for VRFBeacon contract") - - vrfConfigSetEvent, err := vrfBeacon.WaitForConfigSetEvent(time.Minute) - require.NoError(t, err, "Error waiting for ConfigSet Event for VRFBeacon contract") - l.Info().Interface("Event", vrfConfigSetEvent).Msg("OCR2 VRF Config was set") -} - -func SetAndWaitForDKGProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, dkg contracts.DKG) { - l := logging.GetTestLogger(t) - ocr2DkgConfig := BuildOCR2DKGConfigVars(t, ocr2VRFPluginConfig) - - // set config for DKG OCR - l.Debug().Interface("OCR2 DKG Config", ocr2DkgConfig).Msg("OCR2 DKG Config prepared") - err := dkg.SetConfig( - ocr2DkgConfig.Signers, - ocr2DkgConfig.Transmitters, - ocr2DkgConfig.F, - ocr2DkgConfig.OnchainConfig, - ocr2DkgConfig.OffchainConfigVersion, - ocr2DkgConfig.OffchainConfig, - ) - require.NoError(t, err, "Error setting OCR config for DKG contract") - - // wait for the event ConfigSet from DKG contract - dkgConfigSetEvent, err := dkg.WaitForConfigSetEvent(time.Minute) - require.NoError(t, err, "Error waiting for ConfigSet Event for DKG contract") - l.Info().Interface("Event", dkgConfigSetEvent).Msg("OCR2 DKG Config Set") - // wait for the event Transmitted from DKG contract, meaning that OCR committee has sent out the Public key and Shares - dkgSharesTransmittedEvent, err := dkg.WaitForTransmittedEvent(time.Minute * 5) - require.NoError(t, err) - l.Info().Interface("Event", dkgSharesTransmittedEvent).Msg("DKG Shares were generated and transmitted by OCR Committee") -} - -func SetAndGetOCR2VRFPluginConfig( - t *testing.T, - nonBootstrapNodes []*client.ChainlinkK8sClient, - dkg contracts.DKG, - vrfBeacon contracts.VRFBeacon, - coordinator contracts.VRFCoordinatorV3, - mockETHLinkFeed contracts.MockETHLINKFeed, - keyID string, - vrfBeaconAllowedConfirmationDelays []string, - coordinatorConfig *ocr2vrftypes.CoordinatorConfig, -) *OCR2VRFPluginConfig { - var ( - dkgKeyConfigs []DKGKeyConfig - transmitters []string - ocrConfigPubKeys []string - peerIDs []string - ocrOnchainPubKeys []string - ocrOffchainPubKeys []string - schedule []int - ) - - for _, node := range nonBootstrapNodes { - dkgSignKey, err := node.MustCreateDkgSignKey() - require.NoError(t, err, "Error creating DKG Sign Keys") - - dkgEncryptKey, err := node.MustCreateDkgEncryptKey() - require.NoError(t, err, "Error creating DKG Encrypt Keys") - - ethKeys, err := node.MustReadETHKeys() - require.NoError(t, err) - for _, key := range ethKeys.Data { - transmitters = append(transmitters, key.Attributes.Address) - } - - p2pKeys, err := node.MustReadP2PKeys() - require.NoError(t, err, "Shouldn't fail reading P2P keys from node") - - peerId := p2pKeys.Data[0].Attributes.PeerID - peerIDs = append(peerIDs, peerId) - - ocr2Keys, err := node.MustReadOCR2Keys() - require.NoError(t, err, "Shouldn't fail reading OCR2 keys from node") - var ocr2Config client.OCR2KeyAttributes - for _, key := range ocr2Keys.Data { - if key.Attributes.ChainType == string(chaintype.EVM) { - ocr2Config = key.Attributes - break - } - } - - offchainPubKey := strings.TrimPrefix(ocr2Config.OffChainPublicKey, "ocr2off_evm_") - ocrOffchainPubKeys = append(ocrOffchainPubKeys, offchainPubKey) - - configPubKey := strings.TrimPrefix(ocr2Config.ConfigPublicKey, "ocr2cfg_evm_") - ocrConfigPubKeys = append(ocrConfigPubKeys, configPubKey) - - onchainPubKey := strings.TrimPrefix(ocr2Config.OnChainPublicKey, "ocr2on_evm_") - ocrOnchainPubKeys = append(ocrOnchainPubKeys, onchainPubKey) - - schedule = append(schedule, 1) - - dkgKeyConfigs = append(dkgKeyConfigs, DKGKeyConfig{ - DKGEncryptionPublicKey: dkgEncryptKey.Data.Attributes.PublicKey, - DKGSigningPublicKey: dkgSignKey.Data.Attributes.PublicKey, - }) - } - - ocr2VRFPluginConfig := &OCR2VRFPluginConfig{ - OCR2Config: OCR2Config{ - OnchainPublicKeys: ocrOnchainPubKeys, - OffchainPublicKeys: ocrOffchainPubKeys, - ConfigPublicKeys: ocrConfigPubKeys, - PeerIds: peerIDs, - TransmitterAddresses: transmitters, - Schedule: schedule, - }, - - DKGConfig: DKGConfig{ - DKGKeyConfigs: dkgKeyConfigs, - DKGKeyID: keyID, - DKGContractAddress: dkg.Address(), - }, - VRFBeaconConfig: VRFBeaconConfig{ - VRFBeaconAddress: vrfBeacon.Address(), - ConfDelays: vrfBeaconAllowedConfirmationDelays, - CoordinatorConfig: coordinatorConfig, - }, - VRFCoordinatorAddress: coordinator.Address(), - LinkEthFeedAddress: mockETHLinkFeed.Address(), - } - return ocr2VRFPluginConfig -} - -func FundVRFCoordinatorV3Subscription(t *testing.T, linkToken contracts.LinkToken, coordinator contracts.VRFCoordinatorV3, subscriptionID, linkFundingAmount *big.Int) { - encodedSubId, err := chainlinkutils.ABIEncode(`[{"type":"uint256"}]`, subscriptionID) - require.NoError(t, err, "Error Abi encoding subscriptionID") - _, err = linkToken.TransferAndCall(coordinator.Address(), big.NewInt(0).Mul(linkFundingAmount, big.NewInt(1e18)), encodedSubId) - require.NoError(t, err, "Error sending Link token") -} - -func DeployOCR2VRFContracts(t *testing.T, chainClient *seth.Client, linkToken contracts.LinkToken, beaconPeriodBlocksCount *big.Int, keyID string) (contracts.DKG, contracts.VRFCoordinatorV3, contracts.VRFBeacon, contracts.VRFBeaconConsumer) { - dkg, err := contracts.DeployDKG(chainClient) - require.NoError(t, err, "Error deploying DKG Contract") - - coordinator, err := contracts.DeployOCR2VRFCoordinator(chainClient, beaconPeriodBlocksCount, linkToken.Address()) - require.NoError(t, err, "Error deploying OCR2VRFCoordinator Contract") - - vrfBeacon, err := contracts.DeployVRFBeacon(chainClient, coordinator.Address(), linkToken.Address(), dkg.Address(), keyID) - require.NoError(t, err, "Error deploying VRFBeacon Contract") - - consumer, err := contracts.DeployVRFBeaconConsumer(chainClient, coordinator.Address(), beaconPeriodBlocksCount) - require.NoError(t, err, "Error deploying VRFBeaconConsumer Contract") - - return dkg, coordinator, vrfBeacon, consumer -} - -func RequestAndRedeemRandomness( - t *testing.T, - consumer contracts.VRFBeaconConsumer, - vrfBeacon contracts.VRFBeacon, - numberOfRandomWordsToRequest uint16, - subscriptionID, - confirmationDelay *big.Int, - randomnessTransmissionEventTimeout time.Duration, -) *big.Int { - l := logging.GetTestLogger(t) - receipt, err := consumer.RequestRandomness( - numberOfRandomWordsToRequest, - subscriptionID, - confirmationDelay, - ) - require.NoError(t, err, "Error requesting randomness from Consumer Contract") - l.Info().Interface("TX Hash", receipt.TxHash).Msg("Randomness requested from Consumer contract") - - requestID := getRequestId(t, consumer, receipt, confirmationDelay) - - newTransmissionEvent, err := vrfBeacon.WaitForNewTransmissionEvent(randomnessTransmissionEventTimeout) - require.NoError(t, err, "Error waiting for NewTransmission event from VRF Beacon Contract") - l.Info().Interface("NewTransmission event", newTransmissionEvent).Msg("Randomness transmitted by DON") - - err = consumer.RedeemRandomness(subscriptionID, requestID) - require.NoError(t, err, "Error redeeming randomness from Consumer Contract") - - return requestID -} - -func RequestRandomnessFulfillmentAndWaitForFulfilment( - t *testing.T, - consumer contracts.VRFBeaconConsumer, - vrfBeacon contracts.VRFBeacon, - numberOfRandomWordsToRequest uint16, - subscriptionID *big.Int, - confirmationDelay *big.Int, - randomnessTransmissionEventTimeout time.Duration, -) *big.Int { - l := logging.GetTestLogger(t) - receipt, err := consumer.RequestRandomnessFulfillment( - numberOfRandomWordsToRequest, - subscriptionID, - confirmationDelay, - 200_000, - 100_000, - nil, - ) - require.NoError(t, err, "Error requesting Randomness Fulfillment") - l.Info().Interface("TX Hash", receipt.TxHash).Msg("Randomness Fulfillment requested from Consumer contract") - - requestID := getRequestId(t, consumer, receipt, confirmationDelay) - - newTransmissionEvent, err := vrfBeacon.WaitForNewTransmissionEvent(randomnessTransmissionEventTimeout) - require.NoError(t, err, "Error waiting for NewTransmission event from VRF Beacon Contract") - l.Info().Interface("NewTransmission event", newTransmissionEvent).Msg("Randomness Fulfillment transmitted by DON") - - return requestID -} - -func getRequestId(t *testing.T, consumer contracts.VRFBeaconConsumer, receipt *types.Receipt, confirmationDelay *big.Int) *big.Int { - periodBlocks, err := consumer.IBeaconPeriodBlocks(testcontext.Get(t)) - require.NoError(t, err, "Error getting Beacon Period block count") - - blockNumber := receipt.BlockNumber - periodOffset := new(big.Int).Mod(blockNumber, periodBlocks) - nextBeaconOutputHeight := new(big.Int).Sub(new(big.Int).Add(blockNumber, periodBlocks), periodOffset) - - requestID, err := consumer.GetRequestIdsBy(testcontext.Get(t), nextBeaconOutputHeight, confirmationDelay) - require.NoError(t, err, "Error getting requestID from consumer contract") - - return requestID -} - -func SetupOCR2VRFUniverse( - t *testing.T, - linkToken contracts.LinkToken, - mockETHLinkFeed contracts.MockETHLINKFeed, - chainClient *seth.Client, - nodeAddresses []common.Address, - chainlinkNodes []*client.ChainlinkK8sClient, - testNetwork blockchain.EVMNetwork, -) (contracts.DKG, contracts.VRFCoordinatorV3, contracts.VRFBeacon, contracts.VRFBeaconConsumer, *big.Int) { - l := logging.GetTestLogger(t) - - // Deploy DKG contract - // Deploy VRFCoordinator(beaconPeriodBlocks, linkAddress, linkEthfeedAddress) - // Deploy VRFBeacon - // Deploy Consumer Contract - dkgContract, coordinatorContract, vrfBeaconContract, consumerContract := DeployOCR2VRFContracts( - t, - chainClient, - linkToken, - ocr2vrf_constants.BeaconPeriodBlocksCount, - ocr2vrf_constants.KeyID, - ) - - // Add VRFBeacon as DKG client - err := dkgContract.AddClient(ocr2vrf_constants.KeyID, vrfBeaconContract.Address()) - require.NoError(t, err, "Error adding client to DKG Contract") - // Adding VRFBeacon as producer in VRFCoordinator - err = coordinatorContract.SetProducer(vrfBeaconContract.Address()) - require.NoError(t, err, "Error setting Producer for VRFCoordinator contract") - err = coordinatorContract.SetConfig(2.5e6, 160 /* 5 EVM words */) - require.NoError(t, err, "Error setting config for VRFCoordinator contract") - - // Subscription: - //1. Create Subscription - err = coordinatorContract.CreateSubscription() - require.NoError(t, err, "Error creating subscription in VRFCoordinator contract") - subID, err := coordinatorContract.FindSubscriptionID() - require.NoError(t, err) - - //2. Add Consumer to subscription - err = coordinatorContract.AddConsumer(subID, consumerContract.Address()) - require.NoError(t, err, "Error adding a consumer to a subscription in VRFCoordinator contract") - - //3. fund subscription with LINK token - FundVRFCoordinatorV3Subscription( - t, - linkToken, - coordinatorContract, - subID, - ocr2vrf_constants.LinkFundingAmount, - ) - - // set Payees for VRFBeacon ((address which gets the reward) for each transmitter) - nonBootstrapNodeAddresses := nodeAddresses[1:] - err = vrfBeaconContract.SetPayees(nonBootstrapNodeAddresses, nonBootstrapNodeAddresses) - require.NoError(t, err, "Error setting Payees in VRFBeacon Contract") - - // fund OCR Nodes (so that they can transmit) - nodes := contracts.ChainlinkK8sClientToChainlinkNodeWithKeysAndAddress(chainlinkNodes) - err = actions.FundChainlinkNodesFromRootAddress(l, chainClient, nodes, ocr2vrf_constants.EthFundingAmount) - require.NoError(t, err, "Error funding Nodes") - - bootstrapNode := chainlinkNodes[0] - nonBootstrapNodes := chainlinkNodes[1:] - - // Create DKG Sign and Encrypt keys for each non-bootstrap node - // set Job specs for each node - ocr2VRFPluginConfig := SetAndGetOCR2VRFPluginConfig( - t, - nonBootstrapNodes, - dkgContract, - vrfBeaconContract, - coordinatorContract, - mockETHLinkFeed, - ocr2vrf_constants.KeyID, - ocr2vrf_constants.VRFBeaconAllowedConfirmationDelays, - ocr2vrf_constants.CoordinatorConfig, - ) - // Create Jobs for Bootstrap and non-boostrap nodes - CreateOCR2VRFJobs( - t, - bootstrapNode, - nonBootstrapNodes, - ocr2VRFPluginConfig, - testNetwork.ChainID, - 0, - ) - - // set config for DKG OCR, - // wait for the event ConfigSet from DKG contract - // wait for the event Transmitted from DKG contract, meaning that OCR committee has sent out the Public key and Shares - SetAndWaitForDKGProcessToFinish(t, ocr2VRFPluginConfig, dkgContract) - - // set config for VRFBeacon OCR, - // wait for the event ConfigSet from VRFBeacon contract - SetAndWaitForVRFBeaconProcessToFinish(t, ocr2VRFPluginConfig, vrfBeaconContract) - return dkgContract, coordinatorContract, vrfBeaconContract, consumerContract, subID -} diff --git a/integration-tests/chaos/ocr2vrf_chaos_test.go b/integration-tests/chaos/ocr2vrf_chaos_test.go deleted file mode 100644 index 2d1bb5b10e0..00000000000 --- a/integration-tests/chaos/ocr2vrf_chaos_test.go +++ /dev/null @@ -1,230 +0,0 @@ -package chaos - -import ( - "fmt" - "math/big" - "strings" - "testing" - "time" - - "github.com/stretchr/testify/require" - "go.uber.org/zap/zapcore" - - ctf_config "github.com/smartcontractkit/chainlink-testing-framework/config" - "github.com/smartcontractkit/chainlink-testing-framework/k8s/chaos" - "github.com/smartcontractkit/chainlink-testing-framework/k8s/environment" - "github.com/smartcontractkit/chainlink-testing-framework/k8s/pkg/helm/chainlink" - "github.com/smartcontractkit/chainlink-testing-framework/k8s/pkg/helm/ethereum" - "github.com/smartcontractkit/chainlink-testing-framework/logging" - "github.com/smartcontractkit/chainlink-testing-framework/networks" - "github.com/smartcontractkit/chainlink-testing-framework/utils/ptr" - seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth" - "github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - - "github.com/smartcontractkit/chainlink/integration-tests/actions" - "github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions" - "github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions/ocr2vrf_constants" - "github.com/smartcontractkit/chainlink/integration-tests/client" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" -) - -func TestOCR2VRFChaos(t *testing.T) { - t.Parallel() - l := logging.GetTestLogger(t) - testConfig, err := tc.GetConfig([]string{"Chaos"}, tc.OCR2VRF) - if err != nil { - t.Fatal(err) - } - - loadedNetwork := networks.MustGetSelectedNetworkConfig(testConfig.Network)[0] - - tomlConfig, err := actions.BuildTOMLNodeConfigForK8s(&testConfig, loadedNetwork) - require.NoError(t, err, "Error building TOML config") - - defaultOCR2VRFSettings := map[string]interface{}{ - "replicas": 6, - "toml": tomlConfig, - } - - defaultOCR2VRFEthereumSettings := ðereum.Props{ - NetworkName: loadedNetwork.Name, - Simulated: loadedNetwork.Simulated, - WsURLs: loadedNetwork.URLs, - } - - var overrideFn = func(_ interface{}, target interface{}) { - ctf_config.MustConfigOverrideChainlinkVersion(testConfig.GetChainlinkImageConfig(), target) - ctf_config.MightConfigOverridePyroscopeKey(testConfig.GetPyroscopeConfig(), target) - } - - chainlinkCfg := chainlink.NewWithOverride(0, defaultOCR2VRFSettings, testConfig.ChainlinkImage, overrideFn) - - testCases := map[string]struct { - networkChart environment.ConnectedChart - clChart environment.ConnectedChart - chaosFunc chaos.ManifestFunc - chaosProps *chaos.Props - }{ - // network-* and pods-* are split intentionally into 2 parallel groups - // we can't use chaos.NewNetworkPartition and chaos.NewFailPods in parallel - // because of jsii runtime bug, see Makefile - - // PodChaosFailMinorityNodes Test description: - //1. DKG and VRF beacon processes are set and VRF request gets fulfilled - //2. Apply chaos experiment - take down 2 nodes out of 5 non-bootstrap - //3. Bring back all nodes to normal - //4. verify VRF request gets fulfilled - PodChaosFailMinorityNodes: { - ethereum.New(defaultOCR2VRFEthereumSettings), - chainlinkCfg, - chaos.NewFailPods, - &chaos.Props{ - LabelsSelector: &map[string]*string{ChaosGroupMinority: ptr.Ptr("1")}, - DurationStr: "1m", - }, - }, - //todo - currently failing, need to investigate deeper - //PodChaosFailMajorityNodes: { - // ethereum.New(defaultOCR2VRFEthereumSettings), - // chainlinkCfg, - // chaos.NewFailPods, - // &chaos.Props{ - // LabelsSelector: &map[string]*string{ChaosGroupMajority: ptr.Ptr("1")}, - // DurationStr: "1m", - // }, - //}, - //todo - do we need these chaos tests? - //PodChaosFailMajorityDB: { - // ethereum.New(defaultOCR2VRFEthereumSettings), - // chainlinkCfg, - // chaos.NewFailPods, - // &chaos.Props{ - // LabelsSelector: &map[string]*string{ChaosGroupMajority: ptr.Ptr("1")}, - // DurationStr: "1m", - // ContainerNames: &[]*string{ptr.Ptr("chainlink-db")}, - // }, - //}, - //NetworkChaosFailMajorityNetwork: { - // ethereum.New(defaultOCR2VRFEthereumSettings), - // chainlinkCfg, - // chaos.NewNetworkPartition, - // &chaos.Props{ - // FromLabels: &map[string]*string{ChaosGroupMajority: ptr.Ptr("1")}, - // ToLabels: &map[string]*string{ChaosGroupMinority: ptr.Ptr("1")}, - // DurationStr: "1m", - // }, - //}, - //NetworkChaosFailBlockchainNode: { - // ethereum.New(defaultOCR2VRFEthereumSettings), - // chainlinkCfg, - // chaos.NewNetworkPartition, - // &chaos.Props{ - // FromLabels: &map[string]*string{"app": ptr.Ptr("geth")}, - // ToLabels: &map[string]*string{ChaosGroupMajority: ptr.Ptr("1")}, - // DurationStr: "1m", - // }, - //}, - } - - for testCaseName, tc := range testCases { - testCase := tc - t.Run(fmt.Sprintf("OCR2VRF_%s", testCaseName), func(t *testing.T) { - t.Parallel() - testNetwork := networks.MustGetSelectedNetworkConfig(testConfig.Network)[0] // Need a new copy of the network for each test - testEnvironment := environment. - New(&environment.Config{ - NamespacePrefix: fmt.Sprintf( - "chaos-ocr2vrf-%s", strings.ReplaceAll(strings.ToLower(testNetwork.Name), " ", "-"), - ), - Test: t, - }). - AddHelm(testCase.networkChart). - AddHelm(testCase.clChart) - err := testEnvironment.Run() - require.NoError(t, err, "Error running test environment") - if testEnvironment.WillUseRemoteRunner() { - return - } - - err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=node-", 1, 2, ChaosGroupMinority) - require.NoError(t, err) - err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=node-", 3, 5, ChaosGroupMajority) - require.NoError(t, err) - - testNetwork = seth_utils.MustReplaceSimulatedNetworkUrlWithK8(l, testNetwork, *testEnvironment) - chainClient, err := seth_utils.GetChainClientWithConfigFunction(testConfig, testNetwork, seth_utils.OneEphemeralKeysLiveTestnetCheckFn) - require.NoError(t, err, "Error creating seth client") - - chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) - require.NoError(t, err, "Error connecting to Chainlink nodes") - nodeAddresses, err := actions.ChainlinkNodeAddresses(chainlinkNodes) - require.NoError(t, err, "Retrieving on-chain wallet addresses for chainlink nodes shouldn't fail") - - t.Cleanup(func() { - err := actions.TeardownSuite(t, chainClient, testEnvironment, chainlinkNodes, nil, zapcore.PanicLevel, &testConfig) - require.NoError(t, err, "Error tearing down environment") - }) - - linkToken, err := contracts.DeployLinkTokenContract(l, chainClient) - require.NoError(t, err, "Error deploying LINK token") - - mockETHLinkFeed, err := contracts.DeployMockETHLINKFeed(chainClient, ocr2vrf_constants.LinkEthFeedResponse) - require.NoError(t, err, "Error deploying Mock ETH/LINK Feed") - - _, _, vrfBeaconContract, consumerContract, subID := ocr2vrf_actions.SetupOCR2VRFUniverse( - t, - linkToken, - mockETHLinkFeed, - chainClient, - nodeAddresses, - chainlinkNodes, - testNetwork, - ) - - //Request and Redeem Randomness to verify that process works fine - requestID := ocr2vrf_actions.RequestAndRedeemRandomness( - t, - consumerContract, - vrfBeaconContract, - ocr2vrf_constants.NumberOfRandomWordsToRequest, - subID, - ocr2vrf_constants.ConfirmationDelay, - ocr2vrf_constants.RandomnessRedeemTransmissionEventTimeout, - ) - - for i := uint16(0); i < ocr2vrf_constants.NumberOfRandomWordsToRequest; i++ { - randomness, err := consumerContract.GetRandomnessByRequestId(testcontext.Get(t), requestID, big.NewInt(int64(i))) - require.NoError(t, err) - l.Info().Interface("Random Number", randomness).Interface("Randomness Number Index", i).Msg("Randomness retrieved from Consumer contract") - require.NotEqual(t, 0, randomness.Uint64(), "Randomness retrieved from Consumer contract give an answer other than 0") - } - - id, err := testEnvironment.Chaos.Run(testCase.chaosFunc(testEnvironment.Cfg.Namespace, testCase.chaosProps)) - require.NoError(t, err, "Error running Chaos Experiment") - l.Info().Msg("Chaos Applied") - - err = testEnvironment.Chaos.WaitForAllRecovered(id, time.Minute) - require.NoError(t, err, "Error waiting for Chaos Experiment to end") - l.Info().Msg("Chaos Recovered") - - //Request and Redeem Randomness again to see that after Chaos Experiment whole process is still working - requestID = ocr2vrf_actions.RequestAndRedeemRandomness( - t, - consumerContract, - vrfBeaconContract, - ocr2vrf_constants.NumberOfRandomWordsToRequest, - subID, - ocr2vrf_constants.ConfirmationDelay, - ocr2vrf_constants.RandomnessRedeemTransmissionEventTimeout, - ) - - for i := uint16(0); i < ocr2vrf_constants.NumberOfRandomWordsToRequest; i++ { - randomness, err := consumerContract.GetRandomnessByRequestId(testcontext.Get(t), requestID, big.NewInt(int64(i))) - require.NoError(t, err, "Error getting Randomness result from Consumer Contract") - l.Info().Interface("Random Number", randomness).Interface("Randomness Number Index", i).Msg("Randomness retrieved from Consumer contract") - require.NotEqual(t, 0, randomness.Uint64(), "Randomness retrieved from Consumer contract give an answer other than 0") - } - }) - } -} diff --git a/integration-tests/client/chainlink.go b/integration-tests/client/chainlink.go index bf4dbd9df13..08a47101dc1 100644 --- a/integration-tests/client/chainlink.go +++ b/integration-tests/client/chainlink.go @@ -843,62 +843,6 @@ func (c *ChainlinkClient) ImportVRFKey(vrfExportKey *VRFExportKey) (*VRFKey, *ht return vrfKey, resp.RawResponse, err } -// MustCreateDkgSignKey creates a DKG Sign key on the Chainlink node -// and returns error if the request is unsuccessful -func (c *ChainlinkClient) MustCreateDkgSignKey() (*DKGSignKey, error) { - dkgSignKey := &DKGSignKey{} - c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating DKG Sign Key") - resp, err := c.APIClient.R(). - SetResult(dkgSignKey). - Post("/v2/keys/dkgsign") - if err == nil { - err = VerifyStatusCode(resp.StatusCode(), http.StatusOK) - } - return dkgSignKey, err -} - -// MustCreateDkgEncryptKey creates a DKG Encrypt key on the Chainlink node -// and returns error if the request is unsuccessful -func (c *ChainlinkClient) MustCreateDkgEncryptKey() (*DKGEncryptKey, error) { - dkgEncryptKey := &DKGEncryptKey{} - c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating DKG Encrypt Key") - resp, err := c.APIClient.R(). - SetResult(dkgEncryptKey). - Post("/v2/keys/dkgencrypt") - if err == nil { - err = VerifyStatusCode(resp.StatusCode(), http.StatusOK) - } - return dkgEncryptKey, err -} - -// MustReadDKGSignKeys reads all DKG Sign Keys from the Chainlink node returns err if response not 200 -func (c *ChainlinkClient) MustReadDKGSignKeys() (*DKGSignKeys, error) { - dkgSignKeys := &DKGSignKeys{} - c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading DKG Sign Keys") - resp, err := c.APIClient.R(). - SetResult(dkgSignKeys). - Get("/v2/keys/dkgsign") - if err != nil { - return nil, err - } - err = VerifyStatusCode(resp.StatusCode(), http.StatusOK) - return dkgSignKeys, err -} - -// MustReadDKGEncryptKeys reads all DKG Encrypt Keys from the Chainlink node returns err if response not 200 -func (c *ChainlinkClient) MustReadDKGEncryptKeys() (*DKGEncryptKeys, error) { - dkgEncryptKeys := &DKGEncryptKeys{} - c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading DKG Encrypt Keys") - resp, err := c.APIClient.R(). - SetResult(dkgEncryptKeys). - Get("/v2/keys/dkgencrypt") - if err != nil { - return nil, err - } - err = VerifyStatusCode(resp.StatusCode(), http.StatusOK) - return dkgEncryptKeys, err -} - // CreateCSAKey creates a CSA key on the Chainlink node, only 1 CSA key per noe func (c *ChainlinkClient) CreateCSAKey() (*CSAKey, *http.Response, error) { csaKey := &CSAKey{} diff --git a/integration-tests/client/chainlink_models.go b/integration-tests/client/chainlink_models.go index 586fd67f0e2..a0435d53368 100644 --- a/integration-tests/client/chainlink_models.go +++ b/integration-tests/client/chainlink_models.go @@ -214,50 +214,6 @@ type VRFKeys struct { Data []VRFKey `json:"data"` } -// DKGSignKeyAttributes is the model that represents the created DKG Sign key attributes when read -type DKGSignKeyAttributes struct { - PublicKey string `json:"publicKey"` -} - -// DKGSignKeyData is the model that represents the created DKG Sign key's data when read -type DKGSignKeyData struct { - Type string `json:"type"` - ID string `json:"id"` - Attributes DKGSignKeyAttributes `json:"attributes"` -} - -// DKGSignKey is the model that represents the created DKG Sign key when read -type DKGSignKey struct { - Data DKGSignKeyData `json:"data"` -} - -// DKGSignKeys is the model that represents the created DKGSignData key when read -type DKGSignKeys struct { - Data []DKGSignKey `json:"data"` -} - -// DKGEncryptKeyAttributes is the model that represents the created DKG Encrypt key attributes when read -type DKGEncryptKeyAttributes struct { - PublicKey string `json:"publicKey"` -} - -// DKGEncryptKeyData is the model that represents the created DKG Encrypt key's data when read -type DKGEncryptKeyData struct { - Type string `json:"type"` - ID string `json:"id"` - Attributes DKGEncryptKeyAttributes `json:"attributes"` -} - -// DKGEncryptKey is the model that represents the created DKG Encrypt key when read -type DKGEncryptKey struct { - Data DKGEncryptKeyData `json:"data"` -} - -// DKGEncryptKeys is the model that represents the created DKGEncryptKeys key when read -type DKGEncryptKeys struct { - Data []DKGEncryptKey `json:"data"` -} - // OCRKeys is the model that represents the created OCR keys when read type OCRKeys struct { Data []OCRKeyData `json:"data"` diff --git a/integration-tests/contracts/contract_vrf_models.go b/integration-tests/contracts/contract_vrf_models.go index c30eadd3d3d..45825a18ff3 100644 --- a/integration-tests/contracts/contract_vrf_models.go +++ b/integration-tests/contracts/contract_vrf_models.go @@ -21,8 +21,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_v2plus_upgraded_version" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrfv2_wrapper_load_test_consumer" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrfv2plus_wrapper_load_test_consumer" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/dkg" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon" ) type VRF interface { @@ -322,47 +320,6 @@ type VRFv2PlusWrapperLoadTestConsumer interface { GetLoadTestMetrics(ctx context.Context) (*VRFLoadTestMetrics, error) } -type DKG interface { - Address() string - AddClient(keyID string, clientAddress string) error - SetConfig( - signerAddresses []common.Address, - transmitterAddresses []common.Address, - f uint8, - onchainConfig []byte, - offchainConfigVersion uint64, - offchainConfig []byte, - ) error - WaitForConfigSetEvent(timeout time.Duration) (*dkg.DKGConfigSet, error) - WaitForTransmittedEvent(timeout time.Duration) (*dkg.DKGTransmitted, error) -} - -type VRFCoordinatorV3 interface { - Address() string - SetProducer(producerAddress string) error - CreateSubscription() error - FindSubscriptionID() (*big.Int, error) - AddConsumer(subId *big.Int, consumerAddress string) error - SetConfig(maxCallbackGasLimit, maxCallbackArgumentsLength uint32) error -} - -type VRFBeacon interface { - Address() string - SetPayees(transmitterAddresses []common.Address, payeesAddresses []common.Address) error - SetConfig( - signerAddresses []common.Address, - transmitterAddresses []common.Address, - f uint8, - onchainConfig []byte, - offchainConfigVersion uint64, - offchainConfig []byte, - ) error - WaitForConfigSetEvent(timeout time.Duration) (*vrf_beacon.VRFBeaconConfigSet, error) - WaitForNewTransmissionEvent(timeout time.Duration) (*vrf_beacon.VRFBeaconNewTransmission, error) - LatestConfigDigestAndEpoch(ctx context.Context) (vrf_beacon.LatestConfigDigestAndEpoch, - error) -} - type VRFBeaconConsumer interface { Address() string RequestRandomness( diff --git a/integration-tests/contracts/ethereum_ocr2vrf_contracts.go b/integration-tests/contracts/ethereum_ocr2vrf_contracts.go deleted file mode 100644 index 4ef0740fdbc..00000000000 --- a/integration-tests/contracts/ethereum_ocr2vrf_contracts.go +++ /dev/null @@ -1,523 +0,0 @@ -package contracts - -import ( - "context" - "encoding/hex" - "fmt" - "math/big" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/rs/zerolog/log" - - "github.com/smartcontractkit/seth" - - "github.com/smartcontractkit/chainlink/integration-tests/wrappers" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_blockhash_store" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/dkg" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon_consumer" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_coordinator" -) - -// EthereumDKG represents DKG contract -type EthereumDKG struct { - address common.Address - client *seth.Client - dkg *dkg.DKG -} - -// EthereumVRFCoordinatorV3 represents VRFCoordinatorV3 contract -type EthereumVRFCoordinatorV3 struct { - address common.Address - client *seth.Client - vrfCoordinatorV3 *vrf_coordinator.VRFCoordinator -} - -// EthereumVRFBeacon represents VRFBeacon contract -type EthereumVRFBeacon struct { - address common.Address - client *seth.Client - vrfBeacon *vrf_beacon.VRFBeacon -} - -// EthereumVRFBeaconConsumer represents VRFBeaconConsumer contract -type EthereumVRFBeaconConsumer struct { - address common.Address - client *seth.Client - vrfBeaconConsumer *vrf_beacon_consumer.BeaconVRFConsumer -} - -// DeployDKG deploys DKG contract -func DeployDKG(seth *seth.Client) (DKG, error) { - abi, err := dkg.DKGMetaData.GetAbi() - if err != nil { - return &EthereumDKG{}, fmt.Errorf("failed to get DKG ABI: %w", err) - } - - data, err := seth.DeployContract( - seth.NewTXOpts(), - "DKG", - *abi, - common.FromHex(dkg.DKGMetaData.Bin)) - if err != nil { - return &EthereumDKG{}, fmt.Errorf("DKG instance deployment have failed: %w", err) - } - - contract, err := dkg.NewDKG(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumDKG{}, fmt.Errorf("failed to instantiate DKG instance: %w", err) - } - - return &EthereumDKG{ - client: seth, - dkg: contract, - address: data.Address, - }, err -} - -// DeployOCR2VRFCoordinator deploys CR2VRFCoordinator contract -func DeployOCR2VRFCoordinator(seth *seth.Client, beaconPeriodBlocksCount *big.Int, linkAddress string) (VRFCoordinatorV3, error) { - abi, err := vrf_coordinator.VRFCoordinatorMetaData.GetAbi() - if err != nil { - return &EthereumVRFCoordinatorV3{}, fmt.Errorf("failed to get VRFCoordinatorV3 ABI: %w", err) - } - - data, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFCoordinatorV3", - *abi, - common.FromHex(vrf_coordinator.VRFCoordinatorMetaData.Bin), - beaconPeriodBlocksCount, common.HexToAddress(linkAddress)) - if err != nil { - return &EthereumVRFCoordinatorV3{}, fmt.Errorf("VRFCoordinatorV3 instance deployment have failed: %w", err) - } - - contract, err := vrf_coordinator.NewVRFCoordinator(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFCoordinatorV3{}, fmt.Errorf("failed to instantiate VRFCoordinatorV3 instance: %w", err) - } - - return &EthereumVRFCoordinatorV3{ - client: seth, - vrfCoordinatorV3: contract, - address: data.Address, - }, err -} - -// DeployVRFBeacon deploys DeployVRFBeacon contract -func DeployVRFBeacon(seth *seth.Client, vrfCoordinatorAddress string, linkAddress string, dkgAddress string, keyId string) (VRFBeacon, error) { - abi, err := vrf_beacon.VRFBeaconMetaData.GetAbi() - if err != nil { - return &EthereumVRFBeacon{}, fmt.Errorf("failed to get VRFBeacon ABI: %w", err) - } - keyIDBytes, err := DecodeHexTo32ByteArray(keyId) - if err != nil { - return nil, err - } - data, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFBeacon", - *abi, - common.FromHex(vrf_beacon.VRFBeaconMetaData.Bin), - common.HexToAddress(linkAddress), common.HexToAddress(vrfCoordinatorAddress), common.HexToAddress(dkgAddress), keyIDBytes) - if err != nil { - return &EthereumVRFBeacon{}, fmt.Errorf("VRFBeacon instance deployment have failed: %w", err) - } - - contract, err := vrf_beacon.NewVRFBeacon(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFBeacon{}, fmt.Errorf("failed to instantiate VRFBeacon instance: %w", err) - } - - return &EthereumVRFBeacon{ - client: seth, - vrfBeacon: contract, - address: data.Address, - }, err -} - -// DeployBatchBlockhashStore deploys DeployBatchBlockhashStore contract -func DeployBatchBlockhashStore(seth *seth.Client, blockhashStoreAddr string) (BatchBlockhashStore, error) { - abi, err := batch_blockhash_store.BatchBlockhashStoreMetaData.GetAbi() - if err != nil { - return &EthereumBatchBlockhashStore{}, fmt.Errorf("failed to get BatchBlockhashStore ABI: %w", err) - } - data, err := seth.DeployContract( - seth.NewTXOpts(), - "BatchBlockhashStore", - *abi, - common.FromHex(batch_blockhash_store.BatchBlockhashStoreMetaData.Bin), - common.HexToAddress(blockhashStoreAddr)) - if err != nil { - return &EthereumBatchBlockhashStore{}, fmt.Errorf("BatchBlockhashStore instance deployment have failed: %w", err) - } - - contract, err := batch_blockhash_store.NewBatchBlockhashStore(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumBatchBlockhashStore{}, fmt.Errorf("failed to instantiate BatchBlockhashStore instance: %w", err) - } - - return &EthereumBatchBlockhashStore{ - client: seth, - batchBlockhashStore: contract, - address: data.Address, - }, err -} - -// todo - solve import cycle -func DecodeHexTo32ByteArray(val string) ([32]byte, error) { - var byteArray [32]byte - decoded, err := hex.DecodeString(val) - if err != nil { - return [32]byte{}, err - } - if len(decoded) != 32 { - return [32]byte{}, fmt.Errorf("expected value to be 32 bytes but received %d bytes", len(decoded)) - } - copy(byteArray[:], decoded) - return byteArray, err -} - -// DeployVRFBeaconConsumer deploys VRFv@ consumer contract -func DeployVRFBeaconConsumer(seth *seth.Client, vrfCoordinatorAddress string, beaconPeriodBlockCount *big.Int) (VRFBeaconConsumer, error) { - abi, err := vrf_beacon_consumer.BeaconVRFConsumerMetaData.GetAbi() - if err != nil { - return &EthereumVRFBeaconConsumer{}, fmt.Errorf("failed to get VRFBeaconConsumer ABI: %w", err) - } - data, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFBeaconConsumer", - *abi, - common.FromHex(vrf_beacon_consumer.BeaconVRFConsumerMetaData.Bin), - common.HexToAddress(vrfCoordinatorAddress), false, beaconPeriodBlockCount) - if err != nil { - return &EthereumVRFBeaconConsumer{}, fmt.Errorf("VRFBeaconConsumer instance deployment have failed: %w", err) - } - - contract, err := vrf_beacon_consumer.NewBeaconVRFConsumer(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFBeaconConsumer{}, fmt.Errorf("failed to instantiate VRFBeaconConsumer instance: %w", err) - } - - return &EthereumVRFBeaconConsumer{ - client: seth, - vrfBeaconConsumer: contract, - address: data.Address, - }, err -} - -func (dkgContract *EthereumDKG) Address() string { - return dkgContract.address.Hex() -} - -func (dkgContract *EthereumDKG) AddClient(keyID string, clientAddress string) error { - keyIDBytes, err := DecodeHexTo32ByteArray(keyID) - if err != nil { - return err - } - _, err = dkgContract.client.Decode(dkgContract.dkg.AddClient( - dkgContract.client.NewTXOpts(), - keyIDBytes, - common.HexToAddress(clientAddress), - )) - return err -} - -func (dkgContract *EthereumDKG) SetConfig( - signerAddresses []common.Address, - transmitterAddresses []common.Address, - f uint8, - onchainConfig []byte, - offchainConfigVersion uint64, - offchainConfig []byte, -) error { - _, err := dkgContract.client.Decode(dkgContract.dkg.SetConfig( - dkgContract.client.NewTXOpts(), - signerAddresses, - transmitterAddresses, - f, - onchainConfig, - offchainConfigVersion, - offchainConfig, - )) - return err -} - -func (dkgContract *EthereumDKG) WaitForTransmittedEvent(timeout time.Duration) (*dkg.DKGTransmitted, error) { - transmittedEventsChannel := make(chan *dkg.DKGTransmitted) - subscription, err := dkgContract.dkg.WatchTransmitted(nil, transmittedEventsChannel) - if err != nil { - return nil, err - } - defer subscription.Unsubscribe() - - for { - select { - case err = <-subscription.Err(): - return nil, err - case <-time.After(timeout): - return nil, fmt.Errorf("timeout waiting for DKGTransmitted event") - case transmittedEvent := <-transmittedEventsChannel: - return transmittedEvent, nil - } - } -} - -func (dkgContract *EthereumDKG) WaitForConfigSetEvent(timeout time.Duration) (*dkg.DKGConfigSet, error) { - configSetEventsChannel := make(chan *dkg.DKGConfigSet) - subscription, err := dkgContract.dkg.WatchConfigSet(nil, configSetEventsChannel) - if err != nil { - return nil, err - } - defer subscription.Unsubscribe() - - for { - select { - case err = <-subscription.Err(): - return nil, err - case <-time.After(timeout): - return nil, fmt.Errorf("timeout waiting for DKGConfigSet event") - case configSetEvent := <-configSetEventsChannel: - return configSetEvent, nil - } - } -} - -func (coordinator *EthereumVRFCoordinatorV3) Address() string { - return coordinator.address.Hex() -} - -func (coordinator *EthereumVRFCoordinatorV3) SetProducer(producerAddress string) error { - _, err := coordinator.client.Decode(coordinator.vrfCoordinatorV3.SetProducer( - coordinator.client.NewTXOpts(), - common.HexToAddress(producerAddress), - )) - return err -} - -func (coordinator *EthereumVRFCoordinatorV3) CreateSubscription() error { - _, err := coordinator.client.Decode(coordinator.vrfCoordinatorV3.CreateSubscription( - coordinator.client.NewTXOpts(), - )) - return err -} - -func (coordinator *EthereumVRFCoordinatorV3) FindSubscriptionID() (*big.Int, error) { - fopts := &bind.FilterOpts{} - owner := coordinator.client.MustGetRootKeyAddress() - - subscriptionIterator, err := coordinator.vrfCoordinatorV3.FilterSubscriptionCreated( - fopts, - nil, - []common.Address{owner}, - ) - if err != nil { - return nil, err - } - - if !subscriptionIterator.Next() { - return nil, fmt.Errorf("expected at least 1 subID for the given owner %s", owner) - } - - return subscriptionIterator.Event.SubId, nil -} - -func (coordinator *EthereumVRFCoordinatorV3) AddConsumer(subId *big.Int, consumerAddress string) error { - _, err := coordinator.client.Decode(coordinator.vrfCoordinatorV3.AddConsumer( - coordinator.client.NewTXOpts(), - subId, - common.HexToAddress(consumerAddress), - )) - return err -} - -func (coordinator *EthereumVRFCoordinatorV3) SetConfig(maxCallbackGasLimit uint32, maxCallbackArgumentsLength uint32) error { - _, err := coordinator.client.Decode(coordinator.vrfCoordinatorV3.SetCallbackConfig( - coordinator.client.NewTXOpts(), - vrf_coordinator.VRFCoordinatorCallbackConfig{ - MaxCallbackGasLimit: maxCallbackGasLimit, - MaxCallbackArgumentsLength: maxCallbackArgumentsLength, // 5 EVM words - }, - )) - return err -} - -func (beacon *EthereumVRFBeacon) Address() string { - return beacon.address.Hex() -} - -func (beacon *EthereumVRFBeacon) SetPayees(transmitterAddresses []common.Address, payeesAddresses []common.Address) error { - _, err := beacon.client.Decode(beacon.vrfBeacon.SetPayees( - beacon.client.NewTXOpts(), - transmitterAddresses, - payeesAddresses, - )) - return err -} - -func (beacon *EthereumVRFBeacon) SetConfig( - signerAddresses []common.Address, - transmitterAddresses []common.Address, - f uint8, - onchainConfig []byte, - offchainConfigVersion uint64, - offchainConfig []byte, -) error { - _, err := beacon.client.Decode(beacon.vrfBeacon.SetConfig( - beacon.client.NewTXOpts(), - signerAddresses, - transmitterAddresses, - f, - onchainConfig, - offchainConfigVersion, - offchainConfig, - )) - return err -} - -func (beacon *EthereumVRFBeacon) WaitForConfigSetEvent(timeout time.Duration) (*vrf_beacon.VRFBeaconConfigSet, error) { - configSetEventsChannel := make(chan *vrf_beacon.VRFBeaconConfigSet) - subscription, err := beacon.vrfBeacon.WatchConfigSet(nil, configSetEventsChannel) - if err != nil { - return nil, err - } - defer subscription.Unsubscribe() - - for { - select { - case err := <-subscription.Err(): - return nil, err - case <-time.After(timeout): - return nil, fmt.Errorf("timeout waiting for config set event") - case configSetEvent := <-configSetEventsChannel: - return configSetEvent, nil - } - } -} - -func (beacon *EthereumVRFBeacon) WaitForNewTransmissionEvent(timeout time.Duration) (*vrf_beacon.VRFBeaconNewTransmission, error) { - newTransmissionEventsChannel := make(chan *vrf_beacon.VRFBeaconNewTransmission) - subscription, err := beacon.vrfBeacon.WatchNewTransmission(nil, newTransmissionEventsChannel, nil) - if err != nil { - return nil, err - } - defer subscription.Unsubscribe() - - for { - select { - case err := <-subscription.Err(): - return nil, err - case <-time.After(timeout): - return nil, fmt.Errorf("timeout waiting for new transmission event") - case newTransmissionEvent := <-newTransmissionEventsChannel: - return newTransmissionEvent, nil - } - } -} - -func (beacon *EthereumVRFBeacon) LatestConfigDigestAndEpoch(ctx context.Context) (vrf_beacon.LatestConfigDigestAndEpoch, - error) { - opts := &bind.CallOpts{ - From: beacon.client.MustGetRootKeyAddress(), - Context: ctx, - } - return beacon.vrfBeacon.LatestConfigDigestAndEpoch(opts) -} - -func (consumer *EthereumVRFBeaconConsumer) Address() string { - return consumer.address.Hex() -} - -func (consumer *EthereumVRFBeaconConsumer) RequestRandomness( - numWords uint16, - subID, confirmationDelayArg *big.Int, -) (*types.Receipt, error) { - tx, err := consumer.client.Decode(consumer.vrfBeaconConsumer.TestRequestRandomness( - consumer.client.NewTXOpts(), - numWords, - subID, - confirmationDelayArg, - )) - if err != nil { - return nil, fmt.Errorf("TestRequestRandomness failed, err: %w", err) - } - log.Info().Interface("Sub ID", subID). - Interface("Number of Words", numWords). - Interface("Number of Confirmations", confirmationDelayArg). - Msg("RequestRandomness called") - return tx.Receipt, nil -} - -func (consumer *EthereumVRFBeaconConsumer) RedeemRandomness( - subID, requestID *big.Int, -) error { - _, err := consumer.client.Decode(consumer.vrfBeaconConsumer.TestRedeemRandomness( - consumer.client.NewTXOpts(), - subID, - requestID, - )) - if err != nil { - return err - } - log.Info().Interface("Sub ID", subID). - Interface("Request ID", requestID). - Msg("RedeemRandomness called") - return nil -} - -func (consumer *EthereumVRFBeaconConsumer) RequestRandomnessFulfillment( - numWords uint16, - subID, confirmationDelayArg *big.Int, - requestGasLimit uint32, - callbackGasLimit uint32, - arguments []byte, -) (*types.Receipt, error) { - opts := consumer.client.NewTXOpts() - // overriding gas limit because gas estimated by TestRequestRandomnessFulfillment - // is incorrect - opts.GasLimit = uint64(requestGasLimit) - tx, err := consumer.client.Decode(consumer.vrfBeaconConsumer.TestRequestRandomnessFulfillment( - opts, - subID, - numWords, - confirmationDelayArg, - callbackGasLimit, - arguments, - )) - if err != nil { - return nil, fmt.Errorf("TestRequestRandomnessFulfillment failed, err: %w", err) - } - log.Info().Interface("Sub ID", subID). - Interface("Number of Words", numWords). - Interface("Number of Confirmations", confirmationDelayArg). - Interface("Callback Gas Limit", callbackGasLimit). - Msg("RequestRandomnessFulfillment called") - return tx.Receipt, nil -} - -func (consumer *EthereumVRFBeaconConsumer) IBeaconPeriodBlocks(ctx context.Context) (*big.Int, error) { - opts := &bind.CallOpts{ - From: consumer.client.MustGetRootKeyAddress(), - Context: ctx, - } - return consumer.vrfBeaconConsumer.IBeaconPeriodBlocks(opts) -} - -func (consumer *EthereumVRFBeaconConsumer) GetRequestIdsBy(ctx context.Context, nextBeaconOutputHeight *big.Int, confDelay *big.Int) (*big.Int, error) { - opts := &bind.CallOpts{ - From: consumer.client.MustGetRootKeyAddress(), - Context: ctx, - } - return consumer.vrfBeaconConsumer.SRequestsIDs(opts, nextBeaconOutputHeight, confDelay) -} - -func (consumer *EthereumVRFBeaconConsumer) GetRandomnessByRequestId(ctx context.Context, requestID *big.Int, numWordIndex *big.Int) (*big.Int, error) { - opts := &bind.CallOpts{ - From: consumer.client.MustGetRootKeyAddress(), - Context: ctx, - } - return consumer.vrfBeaconConsumer.SReceivedRandomnessByRequestID(opts, requestID, numWordIndex) -} diff --git a/integration-tests/contracts/ethereum_vrfv2plus_contracts.go b/integration-tests/contracts/ethereum_vrfv2plus_contracts.go index 9f6f6665d21..ea0ee18e937 100644 --- a/integration-tests/contracts/ethereum_vrfv2plus_contracts.go +++ b/integration-tests/contracts/ethereum_vrfv2plus_contracts.go @@ -14,6 +14,7 @@ import ( "github.com/smartcontractkit/seth" "github.com/smartcontractkit/chainlink/integration-tests/wrappers" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_blockhash_store" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_vrf_coordinator_v2plus" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_coordinator_v2_5" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_v2plus_load_test_with_metrics" @@ -729,6 +730,34 @@ func (v *EthereumVRFv2PlusLoadTestConsumer) GetLoadTestMetrics(ctx context.Conte }, nil } +// DeployBatchBlockhashStore deploys DeployBatchBlockhashStore contract +func DeployBatchBlockhashStore(seth *seth.Client, blockhashStoreAddr string) (BatchBlockhashStore, error) { + abi, err := batch_blockhash_store.BatchBlockhashStoreMetaData.GetAbi() + if err != nil { + return &EthereumBatchBlockhashStore{}, fmt.Errorf("failed to get BatchBlockhashStore ABI: %w", err) + } + data, err := seth.DeployContract( + seth.NewTXOpts(), + "BatchBlockhashStore", + *abi, + common.FromHex(batch_blockhash_store.BatchBlockhashStoreMetaData.Bin), + common.HexToAddress(blockhashStoreAddr)) + if err != nil { + return &EthereumBatchBlockhashStore{}, fmt.Errorf("BatchBlockhashStore instance deployment have failed: %w", err) + } + + contract, err := batch_blockhash_store.NewBatchBlockhashStore(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) + if err != nil { + return &EthereumBatchBlockhashStore{}, fmt.Errorf("failed to instantiate BatchBlockhashStore instance: %w", err) + } + + return &EthereumBatchBlockhashStore{ + client: seth, + batchBlockhashStore: contract, + address: data.Address, + }, err +} + func DeployVRFCoordinatorV2PlusUpgradedVersion(client *seth.Client, bhsAddr string) (VRFCoordinatorV2PlusUpgradedVersion, error) { abi, err := vrf_v2plus_upgraded_version.VRFCoordinatorV2PlusUpgradedVersionMetaData.GetAbi() if err != nil { diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 5c5429eecdc..78c5ec6f197 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -31,7 +31,6 @@ require ( github.com/smartcontractkit/chainlink-common v0.1.7-0.20240702120320-563bf07487fe github.com/smartcontractkit/chainlink-testing-framework v1.31.7 github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240405215812-5a72bc9af239 - github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/havoc/k8schaos v0.0.0-20240409145249-e78d20847e37 github.com/smartcontractkit/libocr v0.0.0-20240702141926-063ceef8c42e @@ -42,7 +41,6 @@ require ( github.com/test-go/testify v1.1.4 github.com/testcontainers/testcontainers-go v0.28.0 github.com/umbracle/ethgo v0.1.3 - go.dedis.ch/kyber/v3 v3.1.0 go.uber.org/zap v1.26.0 golang.org/x/sync v0.6.0 golang.org/x/text v0.14.0 @@ -423,6 +421,7 @@ require ( github.com/zondax/hid v0.9.1 // indirect github.com/zondax/ledger-go v0.14.1 // indirect go.dedis.ch/fixbuf v1.0.3 // indirect + go.dedis.ch/kyber/v3 v3.1.0 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.etcd.io/etcd/api/v3 v3.5.7 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index efae8357d5d..ebc2bda3af0 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1530,8 +1530,6 @@ github.com/smartcontractkit/chainlink-testing-framework v1.31.7 h1:Vy4ah8VAfj+Y7 github.com/smartcontractkit/chainlink-testing-framework v1.31.7/go.mod h1:E6uNEZhZZid9PHv6/Kq5Vn63GlO61ZcKB+/f0DKo3Q4= github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240405215812-5a72bc9af239 h1:Kk5OVlx/5g9q3Z3lhxytZS4/f8ds1MiNM8yaHgK3Oe8= github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240405215812-5a72bc9af239/go.mod h1:DC8sQMyTlI/44UCTL8QWFwb0bYNoXCfjwCv2hMivYZU= -github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= -github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868/go.mod h1:Kn1Hape05UzFZ7bOUnm3GVsHzP0TNrVmpfXYNHdqGGs= github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16 h1:TFe+FvzxClblt6qRfqEhUfa4kFQx5UobuoFGO2W4mMo= github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= @@ -1731,7 +1729,6 @@ go.dedis.ch/kyber/v3 v3.1.0 h1:ghu+kiRgM5JyD9TJ0hTIxTLQlJBR/ehjWvWwYW3XsC0= go.dedis.ch/kyber/v3 v3.1.0/go.mod h1:kXy7p3STAurkADD+/aZcsznZGKVHEqbtmdIzvPfrs1U= go.dedis.ch/protobuf v1.0.5/go.mod h1:eIV4wicvi6JK0q/QnfIEGeSFNG0ZeB24kzut5+HaRLo= go.dedis.ch/protobuf v1.0.7/go.mod h1:pv5ysfkDX/EawiPqcW3ikOxsL5t+BqnV6xHSmE79KI4= -go.dedis.ch/protobuf v1.0.11 h1:FTYVIEzY/bfl37lu3pR4lIj+F9Vp1jE8oh91VmxKgLo= go.dedis.ch/protobuf v1.0.11/go.mod h1:97QR256dnkimeNdfmURz0wAMNVbd1VmLXhG1CrTYrJ4= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 1a00c92156c..cd930e1c843 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -370,7 +370,6 @@ require ( github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240703132526-6362ffb96401 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240625074951-06ab5e670dba // indirect github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240405215812-5a72bc9af239 // indirect - github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.3 // indirect github.com/soheilhy/cmux v0.1.5 // indirect diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 6bdcdb28565..9e48327f421 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1520,8 +1520,6 @@ github.com/smartcontractkit/chainlink-testing-framework v1.31.7 h1:Vy4ah8VAfj+Y7 github.com/smartcontractkit/chainlink-testing-framework v1.31.7/go.mod h1:E6uNEZhZZid9PHv6/Kq5Vn63GlO61ZcKB+/f0DKo3Q4= github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240405215812-5a72bc9af239 h1:Kk5OVlx/5g9q3Z3lhxytZS4/f8ds1MiNM8yaHgK3Oe8= github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240405215812-5a72bc9af239/go.mod h1:DC8sQMyTlI/44UCTL8QWFwb0bYNoXCfjwCv2hMivYZU= -github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= -github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868/go.mod h1:Kn1Hape05UzFZ7bOUnm3GVsHzP0TNrVmpfXYNHdqGGs= github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16 h1:TFe+FvzxClblt6qRfqEhUfa4kFQx5UobuoFGO2W4mMo= github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= @@ -1719,7 +1717,6 @@ go.dedis.ch/kyber/v3 v3.1.0 h1:ghu+kiRgM5JyD9TJ0hTIxTLQlJBR/ehjWvWwYW3XsC0= go.dedis.ch/kyber/v3 v3.1.0/go.mod h1:kXy7p3STAurkADD+/aZcsznZGKVHEqbtmdIzvPfrs1U= go.dedis.ch/protobuf v1.0.5/go.mod h1:eIV4wicvi6JK0q/QnfIEGeSFNG0ZeB24kzut5+HaRLo= go.dedis.ch/protobuf v1.0.7/go.mod h1:pv5ysfkDX/EawiPqcW3ikOxsL5t+BqnV6xHSmE79KI4= -go.dedis.ch/protobuf v1.0.11 h1:FTYVIEzY/bfl37lu3pR4lIj+F9Vp1jE8oh91VmxKgLo= go.dedis.ch/protobuf v1.0.11/go.mod h1:97QR256dnkimeNdfmURz0wAMNVbd1VmLXhG1CrTYrJ4= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= diff --git a/integration-tests/smoke/ocr2vrf_test.go b/integration-tests/smoke/ocr2vrf_test.go deleted file mode 100644 index bf81e22b40e..00000000000 --- a/integration-tests/smoke/ocr2vrf_test.go +++ /dev/null @@ -1,195 +0,0 @@ -package smoke - -import ( - "fmt" - "math/big" - "strings" - "testing" - - "github.com/stretchr/testify/require" - "go.uber.org/zap/zapcore" - - "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - ctf_config "github.com/smartcontractkit/chainlink-testing-framework/config" - "github.com/smartcontractkit/chainlink-testing-framework/k8s/environment" - "github.com/smartcontractkit/chainlink-testing-framework/k8s/pkg/helm/chainlink" - eth "github.com/smartcontractkit/chainlink-testing-framework/k8s/pkg/helm/ethereum" - "github.com/smartcontractkit/chainlink-testing-framework/logging" - "github.com/smartcontractkit/chainlink-testing-framework/networks" - seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth" - "github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext" - - "github.com/smartcontractkit/chainlink/integration-tests/actions" - "github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions" - "github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions/ocr2vrf_constants" - "github.com/smartcontractkit/chainlink/integration-tests/client" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "github.com/smartcontractkit/chainlink/integration-tests/testconfig" -) - -var ocr2vrfSmokeConfig *testconfig.TestConfig - -func TestOCR2VRFRedeemModel(t *testing.T) { - t.Parallel() - // remember to add TOML testConfig for Chainlink node before trying to run this test in future - t.Skip("VRFv3 is on pause, skipping") - l := logging.GetTestLogger(t) - testConfig, err := testconfig.GetConfig([]string{"Smoke"}, testconfig.OCR2VRF) - require.NoError(t, err, "Error getting config") - - testEnvironment, testNetwork := setupOCR2VRFEnvironment(t) - if testEnvironment.WillUseRemoteRunner() { - return - } - - testNetwork = seth_utils.MustReplaceSimulatedNetworkUrlWithK8(l, testNetwork, *testEnvironment) - chainClient, err := seth_utils.GetChainClientWithConfigFunction(testConfig, testNetwork, seth_utils.OneEphemeralKeysLiveTestnetCheckFn) - require.NoError(t, err, "Error creating seth client") - - chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) - require.NoError(t, err, "Error connecting to Chainlink nodes") - nodeAddresses, err := actions.ChainlinkNodeAddresses(chainlinkNodes) - require.NoError(t, err, "Retreiving on-chain wallet addresses for chainlink nodes shouldn't fail") - - t.Cleanup(func() { - err := actions.TeardownSuite(t, chainClient, testEnvironment, chainlinkNodes, nil, zapcore.ErrorLevel, &testConfig) - require.NoError(t, err, "Error tearing down environment") - }) - - linkToken, err := contracts.DeployLinkTokenContract(l, chainClient) - require.NoError(t, err, "Error deploying LINK token") - - mockETHLinkFeed, err := contracts.DeployMockETHLINKFeed(chainClient, ocr2vrf_constants.LinkEthFeedResponse) - require.NoError(t, err, "Error deploying Mock ETH/LINK Feed") - - _, _, vrfBeaconContract, consumerContract, subID := ocr2vrf_actions.SetupOCR2VRFUniverse( - t, - linkToken, - mockETHLinkFeed, - chainClient, - nodeAddresses, - chainlinkNodes, - testNetwork, - ) - - //Request and Redeem Randomness - requestID := ocr2vrf_actions.RequestAndRedeemRandomness( - t, - consumerContract, - vrfBeaconContract, - ocr2vrf_constants.NumberOfRandomWordsToRequest, - subID, - ocr2vrf_constants.ConfirmationDelay, - ocr2vrf_constants.RandomnessRedeemTransmissionEventTimeout, - ) - - for i := uint16(0); i < ocr2vrf_constants.NumberOfRandomWordsToRequest; i++ { - randomness, err := consumerContract.GetRandomnessByRequestId(testcontext.Get(t), requestID, big.NewInt(int64(i))) - require.NoError(t, err) - l.Info().Interface("Random Number", randomness).Interface("Randomness Number Index", i).Msg("Randomness retrieved from Consumer contract") - require.NotEqual(t, 0, randomness.Uint64(), "Randomness retrieved from Consumer contract give an answer other than 0") - } -} - -func TestOCR2VRFFulfillmentModel(t *testing.T) { - t.Parallel() - t.Skip("VRFv3 is on pause, skipping") - l := logging.GetTestLogger(t) - testConfig, err := testconfig.GetConfig([]string{"Smoke"}, testconfig.OCR2VRF) - require.NoError(t, err, "Error getting config") - - testEnvironment, testNetwork := setupOCR2VRFEnvironment(t) - if testEnvironment.WillUseRemoteRunner() { - return - } - - testNetwork = seth_utils.MustReplaceSimulatedNetworkUrlWithK8(l, testNetwork, *testEnvironment) - chainClient, err := seth_utils.GetChainClientWithConfigFunction(testConfig, testNetwork, seth_utils.OneEphemeralKeysLiveTestnetCheckFn) - require.NoError(t, err, "Error creating seth client") - - chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) - require.NoError(t, err, "Error connecting to Chainlink nodes") - nodeAddresses, err := actions.ChainlinkNodeAddresses(chainlinkNodes) - require.NoError(t, err, "Retreiving on-chain wallet addresses for chainlink nodes shouldn't fail") - - t.Cleanup(func() { - err := actions.TeardownSuite(t, chainClient, testEnvironment, chainlinkNodes, nil, zapcore.ErrorLevel, &testConfig) - require.NoError(t, err, "Error tearing down environment") - }) - - linkToken, err := contracts.DeployLinkTokenContract(l, chainClient) - require.NoError(t, err, "Error deploying LINK token") - - mockETHLinkFeed, err := contracts.DeployMockETHLINKFeed(chainClient, ocr2vrf_constants.LinkEthFeedResponse) - require.NoError(t, err, "Error deploying Mock ETH/LINK Feed") - - _, _, vrfBeaconContract, consumerContract, subID := ocr2vrf_actions.SetupOCR2VRFUniverse( - t, - linkToken, - mockETHLinkFeed, - chainClient, - nodeAddresses, - chainlinkNodes, - testNetwork, - ) - - requestID := ocr2vrf_actions.RequestRandomnessFulfillmentAndWaitForFulfilment( - t, - consumerContract, - vrfBeaconContract, - ocr2vrf_constants.NumberOfRandomWordsToRequest, - subID, - ocr2vrf_constants.ConfirmationDelay, - ocr2vrf_constants.RandomnessFulfilmentTransmissionEventTimeout, - ) - - for i := uint16(0); i < ocr2vrf_constants.NumberOfRandomWordsToRequest; i++ { - randomness, err := consumerContract.GetRandomnessByRequestId(testcontext.Get(t), requestID, big.NewInt(int64(i))) - require.NoError(t, err, "Error getting Randomness result from Consumer Contract") - l.Info().Interface("Random Number", randomness).Interface("Randomness Number Index", i).Msg("Randomness Fulfillment retrieved from Consumer contract") - require.NotEqual(t, 0, randomness.Uint64(), "Randomness Fulfillment retrieved from Consumer contract give an answer other than 0") - } -} - -func setupOCR2VRFEnvironment(t *testing.T) (testEnvironment *environment.Environment, testNetwork blockchain.EVMNetwork) { - if ocr2vrfSmokeConfig == nil { - c, err := testconfig.GetConfig([]string{"Smoke"}, testconfig.OCR2VRF) - require.NoError(t, err, "Error getting config") - ocr2vrfSmokeConfig = &c - } - - testNetwork = networks.MustGetSelectedNetworkConfig(ocr2vrfSmokeConfig.Network)[0] - evmConfig := eth.New(nil) - if !testNetwork.Simulated { - evmConfig = eth.New(ð.Props{ - NetworkName: testNetwork.Name, - Simulated: testNetwork.Simulated, - WsURLs: testNetwork.URLs, - }) - } - - var overrideFn = func(_ interface{}, target interface{}) { - ctf_config.MustConfigOverrideChainlinkVersion(ocr2vrfSmokeConfig.GetChainlinkImageConfig(), target) - ctf_config.MightConfigOverridePyroscopeKey(ocr2vrfSmokeConfig.GetPyroscopeConfig(), target) - } - - tomlConfig, err := actions.BuildTOMLNodeConfigForK8s(ocr2vrfSmokeConfig, testNetwork) - require.NoError(t, err, "Error building TOML config") - - cd := chainlink.NewWithOverride(0, map[string]interface{}{ - "replicas": 6, - "toml": tomlConfig, - }, ocr2vrfSmokeConfig.ChainlinkImage, overrideFn) - - testEnvironment = environment.New(&environment.Config{ - NamespacePrefix: fmt.Sprintf("smoke-ocr2vrf-%s", strings.ReplaceAll(strings.ToLower(testNetwork.Name), " ", "-")), - Test: t, - }). - AddHelm(evmConfig). - AddHelm(cd) - err = testEnvironment.Run() - - require.NoError(t, err, "Error running test environment") - - return testEnvironment, testNetwork -} diff --git a/integration-tests/testconfig/configs_embed.go b/integration-tests/testconfig/configs_embed.go index 0dbd2b29e66..31303357a43 100644 --- a/integration-tests/testconfig/configs_embed.go +++ b/integration-tests/testconfig/configs_embed.go @@ -17,7 +17,6 @@ import "embed" //go:embed ocr2/ocr2.toml //go:embed vrf/vrf.toml //go:embed vrfv2/vrfv2.toml -//go:embed ocr2vrf/ocr2vrf.toml //go:embed vrfv2plus/vrfv2plus.toml var embeddedConfigsFs embed.FS diff --git a/integration-tests/testconfig/ocr2vrf/example.toml b/integration-tests/testconfig/ocr2vrf/example.toml deleted file mode 100644 index 6e7138aeda3..00000000000 --- a/integration-tests/testconfig/ocr2vrf/example.toml +++ /dev/null @@ -1,167 +0,0 @@ -# Example of full config with all fields -# General part -[ChainlinkImage] -image="public.ecr.aws/chainlink/chainlink" -version="2.7.0" - -[Logging] -# if set to true will save logs even if test did not fail -test_log_collect=false - -[Logging.LogStream] -# supported targets: file, loki, in-memory. if empty no logs will be persistet -log_targets=["file"] -# context timeout for starting log producer and also time-frame for requesting logs -log_producer_timeout="10s" -# number of retries before log producer gives up and stops listening to logs -log_producer_retry_limit=10 - -[Logging.Loki] -tenant_id="tenant_id" -# full URL of Loki ingest endpoint -endpoint="https://loki.url/api/v3/push" -# currently only needed when using public instance -basic_auth_secret="loki-basic-auth" -# only needed for cloud grafana -bearer_token_secret="bearer_token" - -# LogStream will try to shorten Grafana URLs by default (if all 3 variables are set) -[Logging.Grafana] -# grafana url (trailing "/" will be stripped) -base_url="http://grafana.url" -# url of your grafana dashboard (prefix and suffix "/" are stirpped), example: /d/ad61652-2712-1722/my-dashboard -dashboard_url="/d/your-dashboard" -bearer_token_secret="my-awesome-token" - -# if you want to use polygon_mumbial -[Network] -selected_networks=["polygon_mumbai"] - -[Network.RpcHttpUrls] -polygon_mumbai = ["https://my-rpc-endpoint.io"] - -[Network.RpcWsUrls] -polygon_mumbai = ["https://my-rpc-endpoint.io"] - -[Network.WalletKeys] -polygon_mumbai = ["change-me-to-your-PK"] - -[PrivateEthereumNetwork] -# pos or pow -consensus_type="pos" -# only prysm supported currently -consensus_layer="prysm" -# geth, besu, nethermind or erigon -execution_layer="geth" -# if true after env started it will wait for at least 1 epoch to be finalised before continuing -wait_for_finalization=false - -[PrivateEthereumNetwork.EthereumChainConfig] -# duration of single slot, lower => faster block production, must be >= 4 -seconds_per_slot=12 -# numer of slots in epoch, lower => faster epoch finalisation, must be >= 4 -slots_per_epoch=6 -# extra genesis gelay, no need to modify, but it should be after all validators/beacon chain starts -genesis_delay=15 -# number of validators in the network -validator_count=8 -chain_id=1337 -# list of addresses to be prefunded in genesis -addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] - -[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] -# hardforks to be applied (fork_name = epoch) -Deneb=500 - -# Chainlink node TOML config -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR2] -Enabled = true - -[P2P] -[P2P.V2] -ListenAddresses = ['0.0.0.0:6690'] -""" - -# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml -CommonChainConfigTOML = """ -AutoCreateKey = true -FinalityDepth = 1 -MinContractPayment = 0 - -[GasEstimator] -PriceMax = '200 gwei' -LimitDefault = 6000000 -FeeCapDefault = '200 gwei' -""" - -# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key -[NodeConfig.ChainConfigTOMLByChainID] -# applicable for arbitrum-goerli chain -421613 = """ -[GasEstimator] -PriceMax = '400 gwei' -LimitDefault = 100000000 -FeeCapDefault = '200 gwei' -BumpThreshold = 60 -BumpPercent = 20 -BumpMin = '100 gwei' -""" - -# load test specific configuration -[Load.OCR] -[Load.OCR.Common] -eth_funds = 3 - -[Load.OCR.Load] -test_duration = "3m" -rate_limit_unit_duration = "1m" -rate = 3 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# soak test specific configuration -[Soak.Common] -chainlink_node_funding = 100 - -[Soak.OCR] -[Soak.OCR.Common] -test_duration="15m" - -[Soak.OCR.Soak] -ocr_version="1" -number_of_contracts=2 -time_between_rounds="1m" \ No newline at end of file diff --git a/integration-tests/testconfig/ocr2vrf/ocr2vrf.toml b/integration-tests/testconfig/ocr2vrf/ocr2vrf.toml deleted file mode 100644 index 884a51736da..00000000000 --- a/integration-tests/testconfig/ocr2vrf/ocr2vrf.toml +++ /dev/null @@ -1,93 +0,0 @@ -# product defaults -[Common] -chainlink_node_funding = 0.5 - -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR2] -Enabled = true - -[P2P] -[P2P.V2] -ListenAddresses = ['0.0.0.0:6690'] -""" - -CommonChainConfigTOML = """ -FinalityDepth = 5 - -[GasEstimator] -LimitDefault = 3_500_000 -PriceMax = 100000000000 -FeeCapDefault = 100000000000 -""" - -# load test specific configuration -[Load.OCR] -[Load.OCR.Common] -eth_funds = 3 - -[Load.OCR.Load] -test_duration = "3m" -rate_limit_unit_duration = "1m" -rate = 3 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# volume test specific configuration -[Volume.OCR] -[Volume.OCR.Common] -eth_funds = 3 - -[Volume.OCR.Volume] -test_duration = "3m" -rate_limit_unit_duration = "1m" -vu_requests_per_unit = 10 -rate = 1 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# soak test specific configuration -[Soak.Common] -chainlink_node_funding = 100 - -[Soak.OCR] -[Soak.OCR.Common] -test_duration="15m" - -[Soak.OCR.Soak] -ocr_version="2" -number_of_contracts=2 -time_between_rounds="1m" diff --git a/integration-tests/testconfig/testconfig.go b/integration-tests/testconfig/testconfig.go index 95cb368a2a4..8f06433fb07 100644 --- a/integration-tests/testconfig/testconfig.go +++ b/integration-tests/testconfig/testconfig.go @@ -79,7 +79,6 @@ type TestConfig struct { LogPoller *lp_config.Config `toml:"LogPoller"` OCR *ocr_config.Config `toml:"OCR"` OCR2 *ocr_config.Config `toml:"OCR2"` - OCR2VRF *ocr_config.Config `toml:"OCRR2VRF"` VRF *vrf_config.Config `toml:"VRF"` VRFv2 *vrfv2_config.Config `toml:"VRFv2"` VRFv2Plus *vrfv2plus_config.Config `toml:"VRFv2Plus"` @@ -209,11 +208,7 @@ func (c TestConfig) GetActiveOCRConfig() *ocr_config.Config { return c.OCR } - if c.OCR2 != nil { - return c.OCR2 - } - - return c.OCR2VRF + return c.OCR2 } func (c *TestConfig) AsBase64() (string, error) { @@ -251,7 +246,6 @@ const ( Node Product = "node" OCR Product = "ocr" OCR2 Product = "ocr2" - OCR2VRF Product = "ocr2vrf" RunLog Product = "runlog" VRF Product = "vrf" VRFv2 Product = "vrfv2" @@ -559,12 +553,6 @@ func (c *TestConfig) Validate() error { } } - if c.OCR2VRF != nil { - if err := c.OCR2VRF.Validate(); err != nil { - return errors.Wrapf(err, "OCR2VRF config validation failed") - } - } - if c.VRF != nil { if err := c.VRF.Validate(); err != nil { return errors.Wrapf(err, "VRF config validation failed") diff --git a/testdata/scripts/help-all/help-all.txtar b/testdata/scripts/help-all/help-all.txtar index 93b24580e36..372b149bd19 100644 --- a/testdata/scripts/help-all/help-all.txtar +++ b/testdata/scripts/help-all/help-all.txtar @@ -72,18 +72,6 @@ keys csa create # Create a CSA key, encrypted with password from the password fi keys csa export # Exports an existing CSA key by its ID. keys csa import # Imports a CSA key from a JSON file. keys csa list # List available CSA keys -keys dkgencrypt # Remote commands for administering the node's DKGEncrypt keys -keys dkgencrypt create # Create a DKGEncrypt key -keys dkgencrypt delete # Delete DKGEncrypt key if present -keys dkgencrypt export # Export DKGEncrypt key to keyfile -keys dkgencrypt import # Import DKGEncrypt key from keyfile -keys dkgencrypt list # List the DKGEncrypt keys -keys dkgsign # Remote commands for administering the node's DKGSign keys -keys dkgsign create # Create a DKGSign key -keys dkgsign delete # Delete DKGSign key if present -keys dkgsign export # Export DKGSign key to keyfile -keys dkgsign import # Import DKGSign key from keyfile -keys dkgsign list # List the DKGSign keys keys eth # Remote commands for administering the node's Ethereum keys keys eth chain # Update an EVM key for the given chain keys eth create # Create a key in the node's keystore alongside the existing key; to create an original key, just run the node diff --git a/testdata/scripts/keys/dkgencrypt/help.txtar b/testdata/scripts/keys/dkgencrypt/help.txtar deleted file mode 100644 index 98a791eccf0..00000000000 --- a/testdata/scripts/keys/dkgencrypt/help.txtar +++ /dev/null @@ -1,20 +0,0 @@ -exec chainlink keys dkgencrypt --help -cmp stdout out.txt - --- out.txt -- -NAME: - chainlink keys dkgencrypt - Remote commands for administering the node's DKGEncrypt keys - -USAGE: - chainlink keys dkgencrypt command [command options] [arguments...] - -COMMANDS: - create Create a DKGEncrypt key - import Import DKGEncrypt key from keyfile - export Export DKGEncrypt key to keyfile - delete Delete DKGEncrypt key if present - list List the DKGEncrypt keys - -OPTIONS: - --help, -h show help - diff --git a/testdata/scripts/keys/dkgsign/help.txtar b/testdata/scripts/keys/dkgsign/help.txtar deleted file mode 100644 index 7c3e2258423..00000000000 --- a/testdata/scripts/keys/dkgsign/help.txtar +++ /dev/null @@ -1,20 +0,0 @@ -exec chainlink keys dkgsign --help -cmp stdout out.txt - --- out.txt -- -NAME: - chainlink keys dkgsign - Remote commands for administering the node's DKGSign keys - -USAGE: - chainlink keys dkgsign command [command options] [arguments...] - -COMMANDS: - create Create a DKGSign key - import Import DKGSign key from keyfile - export Export DKGSign key to keyfile - delete Delete DKGSign key if present - list List the DKGSign keys - -OPTIONS: - --help, -h show help - diff --git a/testdata/scripts/keys/help.txtar b/testdata/scripts/keys/help.txtar index 5c144017c66..83253d6906d 100644 --- a/testdata/scripts/keys/help.txtar +++ b/testdata/scripts/keys/help.txtar @@ -9,18 +9,16 @@ USAGE: chainlink keys command [command options] [arguments...] COMMANDS: - eth Remote commands for administering the node's Ethereum keys - p2p Remote commands for administering the node's p2p keys - csa Remote commands for administering the node's CSA keys - ocr Remote commands for administering the node's legacy off chain reporting keys - ocr2 Remote commands for administering the node's off chain reporting keys - cosmos Remote commands for administering the node's Cosmos keys - solana Remote commands for administering the node's Solana keys - starknet Remote commands for administering the node's StarkNet keys - aptos Remote commands for administering the node's Aptos keys - dkgsign Remote commands for administering the node's DKGSign keys - dkgencrypt Remote commands for administering the node's DKGEncrypt keys - vrf Remote commands for administering the node's vrf keys + eth Remote commands for administering the node's Ethereum keys + p2p Remote commands for administering the node's p2p keys + csa Remote commands for administering the node's CSA keys + ocr Remote commands for administering the node's legacy off chain reporting keys + ocr2 Remote commands for administering the node's off chain reporting keys + cosmos Remote commands for administering the node's Cosmos keys + solana Remote commands for administering the node's Solana keys + starknet Remote commands for administering the node's StarkNet keys + aptos Remote commands for administering the node's Aptos keys + vrf Remote commands for administering the node's vrf keys OPTIONS: --help, -h show help