From deddf175bdbddc305cd9ef2af9d5664652358d9a Mon Sep 17 00:00:00 2001 From: Domino Valdano <2644901+reductionista@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:37:44 -0800 Subject: [PATCH 001/112] Implement skeleton interfaces, structs, & methods for ChainReader EVM POC - Read ChainReader config in from RelayConfig - Add some initialization and validation relay skeletons - Use medianProviderWrapper instead of passing medianContract separately This avoids us having to modify the signature of NewMedianFactory, which would require further modifications to all non-evm repos and chainlink-relay - Add chain_reader_test.go with some basic relay tests Co-authored-by: Jordan Krage - Add chain reader config validation - Add chain reader config validation tests - Add config for chain reader median contract to cr validation testcases - Add unimplemented Encode(), Decode(), GetMaxEncodingSize(), GetMaxDecodingSize() - Add ChainReader() method to mock provider for plugin test - Rename relaymercury.ChainReader to MercuryChainReader, resolve name collisions - Add tests for errors during ChainReader construction - Propagate InvalidConfig & any other errors back to client We should ignore Unsupported until node ops have been given ample time to migrate to the new job spec (including a section for ChainReader config) so that we can remove the old product-specific MedianContract component from MedianProvider. All other errors we can immediately start passing back to the client, letting the core node decide how to handle them (eg. displaying an "invalid job spec" message to the UI if the RelayConfig was invalid or the ContractID missing) --- .github/workflows/integration-tests.yml | 2 +- core/scripts/go.mod | 11 +- core/scripts/go.sum | 21 +- core/services/chainlink/relayer_factory.go | 3 +- core/services/functions/listener.go | 1 + .../services/ocr2/plugins/functions/plugin.go | 1 + core/services/ocr2/plugins/median/plugin.go | 1 + core/services/ocr2/plugins/median/services.go | 72 ++++ core/services/ocr2/plugins/mercury/plugin.go | 2 +- .../plugins/ocr2keeper/integration_21_test.go | 1 - core/services/ocr2/plugins/ocr2keeper/util.go | 1 - .../ocr2vrf/coordinator/coordinator_test.go | 8 +- core/services/relay/evm/chain_reader.go | 202 ++++++++++ core/services/relay/evm/chain_reader_test.go | 344 ++++++++++++++++++ core/services/relay/evm/config_poller.go | 1 + core/services/relay/evm/evm.go | 31 +- core/services/relay/evm/functions.go | 5 + .../relay/evm/functions/logpoller_wrapper.go | 1 + .../evm/functions/offchain_config_digester.go | 8 +- .../relay/evm/mercury/v1/data_source.go | 4 +- .../relay/evm/mercury/v1/data_source_test.go | 19 +- core/services/relay/evm/mercury_provider.go | 38 +- core/services/relay/evm/ocr2keeper.go | 4 + core/services/relay/evm/ocr2vrf.go | 8 + core/services/relay/evm/types/types.go | 35 +- core/services/relay/relay_test.go | 3 +- go.mod | 16 +- go.sum | 21 +- integration-tests/go.mod | 11 +- integration-tests/go.sum | 21 +- plugins/medianpoc/plugin_test.go | 8 +- 31 files changed, 807 insertions(+), 97 deletions(-) create mode 100644 core/services/relay/evm/chain_reader.go create mode 100644 core/services/relay/evm/chain_reader_test.go diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 9550be83ced..f7f7c7a3abe 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -626,7 +626,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: repository: smartcontractkit/chainlink-solana - ref: develop + ref: BCF-2612-ChainReader fetch-depth: 0 path: solanapath - name: Get long sha diff --git a/core/scripts/go.mod b/core/scripts/go.mod index e9fa432d4cd..46eacbee5be 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -11,7 +11,7 @@ require ( github.com/docker/docker v24.0.6+incompatible github.com/docker/go-connections v0.4.0 github.com/ethereum/go-ethereum v1.12.0 - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.3.1 github.com/jmoiron/sqlx v1.3.5 github.com/joho/godotenv v1.4.0 @@ -121,6 +121,7 @@ require ( github.com/gin-contrib/sse v0.1.0 // indirect github.com/gin-gonic/gin v1.9.1 // indirect github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect + github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-ldap/ldap/v3 v3.4.5 // indirect @@ -303,10 +304,10 @@ require ( github.com/shirou/gopsutil/v3 v3.23.9 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231121180428-d7f28e91ccc3 // indirect - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231117191236-12eab01a4542 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231117191230-aa6640f2edd1 // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231117204155-b253a2f56664 // indirect + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 3d9962474b9..230d62a4d14 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -437,6 +437,8 @@ github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3Bop github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0 h1:ymLjT4f35nQbASLnvxEde4XOBL+Sn7rFuV+FOJqkljg= +github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0/go.mod h1:6daplAwHHGbUGib4990V3Il26O0OC4aRyvewaaAihaA= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= @@ -565,8 +567,9 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= @@ -1464,14 +1467,14 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231121180428-d7f28e91ccc3 h1:cyA1aW1PYrOLZAMaSmuH7U99QBTfrF59s+6uDxQgOr0= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231121180428-d7f28e91ccc3/go.mod h1:Hrru9i7n+WEYyW2aIt3/YGPhxLX+HEGWnhk3yVXeDF8= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231117191236-12eab01a4542 h1:oewYJtdRkJKUHCNDCj5C2LQe6Oq6qy975g931nfG0cc= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231117191236-12eab01a4542/go.mod h1:EpvRoycRD+kniYlz+pCpRT5e+fmPm0mSD/vmND+0oMg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231117191230-aa6640f2edd1 h1:D7yb4kgNGVAiD5lFYqm/LW8d5jU66TXyYvSskDiW9yg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231117191230-aa6640f2edd1/go.mod h1:UfW7/PZKon+iDEHtrHOfvMnS5GfYOW/SdMZ6P97rPEk= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231117204155-b253a2f56664 h1:yxaHuDTtj2xxtsR8b+LJw8xDvyr6v/F6GP3InsP4wPI= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231117204155-b253a2f56664/go.mod h1:3Fa+HQTZ3R3fPC0hUqugvoo+NEeo8Y4J2WOnQfi7O34= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 h1:QLhOOIeFldRBc+ESAVZfEPrIpfeiduwnmHlvDt1iFmM= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af h1:lwrfntkyF0onNy2QVdphvtutQsqj5E5izh63t7XZbFc= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af/go.mod h1:jOBq6ZSI0bkVS721oiAZ2t3IzOszk2B81PfWAeNeL40= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= 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-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= diff --git a/core/services/chainlink/relayer_factory.go b/core/services/chainlink/relayer_factory.go index 6376839c700..65d3ced3adb 100644 --- a/core/services/chainlink/relayer_factory.go +++ b/core/services/chainlink/relayer_factory.go @@ -5,9 +5,8 @@ import ( "errors" "fmt" - "github.com/pelletier/go-toml/v2" - "github.com/jmoiron/sqlx" + "github.com/pelletier/go-toml/v2" "github.com/smartcontractkit/chainlink-common/pkg/loop" "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos" diff --git a/core/services/functions/listener.go b/core/services/functions/listener.go index 3a308431807..c14961fb806 100644 --- a/core/services/functions/listener.go +++ b/core/services/functions/listener.go @@ -16,6 +16,7 @@ import ( "github.com/smartcontractkit/libocr/commontypes" "github.com/smartcontractkit/chainlink-common/pkg/services" + "github.com/smartcontractkit/chainlink/v2/core/cbor" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/logger" diff --git a/core/services/ocr2/plugins/functions/plugin.go b/core/services/ocr2/plugins/functions/plugin.go index 475cf0a2af7..6d61cb26639 100644 --- a/core/services/ocr2/plugins/functions/plugin.go +++ b/core/services/ocr2/plugins/functions/plugin.go @@ -14,6 +14,7 @@ import ( libocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus" "github.com/smartcontractkit/chainlink-common/pkg/assets" + "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" "github.com/smartcontractkit/chainlink/v2/core/logger" diff --git a/core/services/ocr2/plugins/median/plugin.go b/core/services/ocr2/plugins/median/plugin.go index 11197f09175..cad2099832d 100644 --- a/core/services/ocr2/plugins/median/plugin.go +++ b/core/services/ocr2/plugins/median/plugin.go @@ -25,6 +25,7 @@ func (p *Plugin) NewMedianFactory(ctx context.Context, provider types.MedianProv var ctxVals loop.ContextValues ctxVals.SetValues(ctx) lggr := logger.With(p.Logger, ctxVals.Args()...) + factory := median.NumericalMedianFactory{ ContractTransmitter: provider.MedianContract(), DataSource: dataSource, diff --git a/core/services/ocr2/plugins/median/services.go b/core/services/ocr2/plugins/median/services.go index 9d65921ef2b..04a9d0f8535 100644 --- a/core/services/ocr2/plugins/median/services.go +++ b/core/services/ocr2/plugins/median/services.go @@ -5,9 +5,13 @@ import ( "encoding/json" "errors" "fmt" + "math/big" "time" + "github.com/ethereum/go-ethereum/common" + "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" libocr "github.com/smartcontractkit/libocr/offchainreporting2plus" + ocr2types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-common/pkg/loop" "github.com/smartcontractkit/chainlink-common/pkg/types" @@ -44,6 +48,21 @@ func (m *medianConfig) JobPipelineMaxSuccessfulRuns() uint64 { return m.jobPipelineMaxSuccessfulRuns } +// This wrapper avoids the need to modify the signature of NewMedianFactory in all of the non-evm +// relay repos as well as its primary definition in chainlink-common. Once ChainReader is implemented +// and working on all 4 blockchain families, we can remove the original MedianContract() method from +// MedianProvider and pass medianContract as a separate param to NewMedianFactory +type medianProviderWrapper struct { + types.MedianProvider + contract median.MedianContract +} + +// Override relay's implementation of MedianContract with product plugin's implementation of +// MedianContract, making use of product-agnostic ChainReader to read the contract instead of relay MedianContract +func (m medianProviderWrapper) MedianContract() median.MedianContract { + return m.contract +} + func NewMedianServices(ctx context.Context, jb job.Job, isNewlyCreatedJob bool, @@ -111,6 +130,13 @@ func NewMedianServices(ctx context.Context, CreatedAt: time.Now(), }, lggr) + if medianProvider.ChainReader() != nil { + medianProvider = medianProviderWrapper{ + medianProvider, // attach newer MedianContract which uses ChainReader + newMedianContract(provider.ChainReader(), common.HexToAddress(spec.ContractID)), + } + } + if cmdName := env.MedianPluginCmd.Get(); cmdName != "" { // use unique logger names so we can use it to register a loop @@ -152,3 +178,49 @@ func NewMedianServices(ctx context.Context, } return } + +type medianContract struct { + chainReader types.ChainReader + contract types.BoundContract +} + +type latestTransmissionDetailsResponse struct { + configDigest ocr2types.ConfigDigest + epoch uint32 + round uint8 + latestAnswer *big.Int + latestTimestamp time.Time +} + +type latestRoundRequested struct { + configDigest ocr2types.ConfigDigest + epoch uint32 + round uint8 +} + +func (m *medianContract) LatestTransmissionDetails(ctx context.Context) (configDigest ocr2types.ConfigDigest, epoch uint32, round uint8, latestAnswer *big.Int, latestTimestamp time.Time, err error) { + var resp latestTransmissionDetailsResponse + + err = m.chainReader.GetLatestValue(ctx, m.contract, "LatestTransmissionDetails", nil, &resp) + if err != nil { + return + } + + return resp.configDigest, resp.epoch, resp.round, resp.latestAnswer, resp.latestTimestamp, err +} + +func (m *medianContract) LatestRoundRequested(ctx context.Context, lookback time.Duration) (configDigest ocr2types.ConfigDigest, epoch uint32, round uint8, err error) { + var resp latestRoundRequested + + err = m.chainReader.GetLatestValue(ctx, m.contract, "LatestRoundReported", map[string]string{}, &resp) + if err != nil { + return + } + + return resp.configDigest, resp.epoch, resp.round, err +} + +func newMedianContract(chainReader types.ChainReader, address common.Address) *medianContract { + contract := types.BoundContract{Address: address.String(), Name: "median", Pending: true} + return &medianContract{chainReader, contract} +} diff --git a/core/services/ocr2/plugins/mercury/plugin.go b/core/services/ocr2/plugins/mercury/plugin.go index bd68ccd8b72..c6c58f3e0a7 100644 --- a/core/services/ocr2/plugins/mercury/plugin.go +++ b/core/services/ocr2/plugins/mercury/plugin.go @@ -65,7 +65,7 @@ func NewServices( lggr, runResults, chEnhancedTelem, - ocr2Provider.ChainReader(), + ocr2Provider.MercuryChainReader(), ocr2Provider.MercuryServerFetcher(), pluginConfig.InitialBlockNumber.Ptr(), feedID, diff --git a/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go b/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go index 01418b9f761..e1605ee498a 100644 --- a/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go +++ b/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go @@ -32,7 +32,6 @@ import ( ocrTypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-automation/pkg/v3/config" - "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" diff --git a/core/services/ocr2/plugins/ocr2keeper/util.go b/core/services/ocr2/plugins/ocr2keeper/util.go index 2c477e7a6a1..f58c86591a9 100644 --- a/core/services/ocr2/plugins/ocr2keeper/util.go +++ b/core/services/ocr2/plugins/ocr2keeper/util.go @@ -12,7 +12,6 @@ import ( ocr2keepers20polling "github.com/smartcontractkit/chainlink-automation/pkg/v2/observer/polling" ocr2keepers20runner "github.com/smartcontractkit/chainlink-automation/pkg/v2/runner" ocr2keepers21 "github.com/smartcontractkit/chainlink-automation/pkg/v3/types" - "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go index 418e4356c68..ca46d70d3fb 100644 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go +++ b/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go @@ -19,14 +19,12 @@ import ( "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-common/pkg/types" "github.com/smartcontractkit/chainlink-vrf/dkg" "github.com/smartcontractkit/chainlink-vrf/ocr2vrf" ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" - - "github.com/smartcontractkit/chainlink-common/pkg/types" + "github.com/smartcontractkit/libocr/commontypes" + ocr2Types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go new file mode 100644 index 00000000000..e8f31a371b2 --- /dev/null +++ b/core/services/relay/evm/chain_reader.go @@ -0,0 +1,202 @@ +package evm + +import ( + "context" + "errors" + "fmt" + "strings" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" + "github.com/smartcontractkit/chainlink/v2/core/logger" + "github.com/smartcontractkit/chainlink/v2/core/services" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" +) + +type ChainReaderService interface { + services.ServiceCtx + commontypes.ChainReader +} + +type chainReader struct { + lggr logger.Logger + contractID common.Address + lp logpoller.LogPoller +} + +// NewChainReaderService constructor for ChainReader +func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, ropts *types.RelayOpts) (*chainReader, error) { + relayConfig, err := ropts.RelayConfig() + if err != nil { + return nil, fmt.Errorf("failed parsing RelayConfig: %w", err) + } + + if !common.IsHexAddress(ropts.ContractID) { + return nil, fmt.Errorf("%w: invalid contractID, expected hex address", commontypes.ErrInvalidConfig) + } + contractID := common.HexToAddress(ropts.ContractID) + + if relayConfig.ChainReader == nil { + return nil, fmt.Errorf("%w: ChainReader missing from RelayConfig", errors.ErrUnsupported) + } + + if err = validateChainReaderConfig(*relayConfig.ChainReader); err != nil { + return nil, err + } + + return &chainReader{lggr.Named("ChainReader"), contractID, lp}, nil +} + +func (cr *chainReader) Name() string { return cr.lggr.Name() } + +func (cr *chainReader) initialize() error { + // Initialize chain reader, start cache polling loop, etc. + return nil +} + +func (cr *chainReader) Start(ctx context.Context) error { + if err := cr.initialize(); err != nil { + return fmt.Errorf("Failed to initialize ChainReader: %w", err) + } + return nil +} + +func (cr *chainReader) Close() error { return nil } + +func (cr *chainReader) Ready() error { return nil } + +func (cr *chainReader) HealthReport() map[string]error { + return map[string]error{cr.Name(): nil} +} + +func (cr *chainReader) GetLatestValue(ctx context.Context, bc commontypes.BoundContract, method string, params any, returnVal any) error { + return fmt.Errorf("Unimplemented method GetLatestValue called %w", errors.ErrUnsupported) +} + +func (cr *chainReader) Encode(ctx context.Context, item any, itemType string) (ocrtypes.Report, error) { + return nil, fmt.Errorf("Unimplemented method Encode called %w", errors.ErrUnsupported) +} + +func (cr *chainReader) Decode(_ context.Context, raw []byte, into any, itemType string) error { + return fmt.Errorf("Unimplemented method Decode called %w", errors.ErrUnsupported) +} + +func (cr *chainReader) GetMaxEncodingSize(ctx context.Context, n int, itemType string) (int, error) { + return 0, fmt.Errorf("Unimplemented method GetMaxDecodingSize called %w", errors.ErrUnsupported) +} + +func (cr *chainReader) GetMaxDecodingSize(ctx context.Context, n int, itemType string) (int, error) { + return 0, fmt.Errorf("Unimplemented method GetMaxDecodingSize called %w", errors.ErrUnsupported) +} + +func validateChainReaderConfig(cfg types.ChainReaderConfig) error { + for contractName, chainContractReader := range cfg.ChainContractReaders { + abi, err := abi.JSON(strings.NewReader(chainContractReader.ContractABI)) + if err != nil { + return err + } + + for chainReadingDefinitionName, chainReaderDefinition := range chainContractReader.ChainReaderDefinitions { + switch chainReaderDefinition.ReadType { + case types.Method: + err = validateMethods(abi, chainReaderDefinition) + case types.Event: + err = validateEvents(abi, chainReaderDefinition) + default: + return fmt.Errorf("%w: invalid chain reader definition read type: %d", commontypes.ErrInvalidConfig, chainReaderDefinition.ReadType) + } + if err != nil { + return fmt.Errorf("%w: invalid chain reader config for contract: %q chain reading definition: %q, err: %w", commontypes.ErrInvalidConfig, contractName, chainReadingDefinitionName, err) + } + } + } + + return nil +} + +func validateEvents(contractABI abi.ABI, chainReaderDefinition types.ChainReaderDefinition) error { + event, methodExists := contractABI.Events[chainReaderDefinition.ChainSpecificName] + if !methodExists { + return fmt.Errorf("method: %s doesn't exist", chainReaderDefinition.ChainSpecificName) + } + + if !areChainReaderArgumentsValid(event.Inputs, chainReaderDefinition.ReturnValues) { + var abiEventInputsNames []string + for _, input := range event.Inputs { + abiEventInputsNames = append(abiEventInputsNames, input.Name) + } + return fmt.Errorf("return values: [%s] don't match abi event inputs: [%s]", strings.Join(chainReaderDefinition.ReturnValues, ","), strings.Join(abiEventInputsNames, ",")) + } + + var abiEventIndexedInputs []abi.Argument + for _, eventInput := range event.Inputs { + if eventInput.Indexed { + abiEventIndexedInputs = append(abiEventIndexedInputs, eventInput) + } + } + + var chainReaderEventParams []string + for chainReaderEventParam := range chainReaderDefinition.Params { + chainReaderEventParams = append(chainReaderEventParams, chainReaderEventParam) + } + + if !areChainReaderArgumentsValid(abiEventIndexedInputs, chainReaderEventParams) { + var abiEventIndexedInputsNames []string + for _, abiEventIndexedInput := range abiEventIndexedInputs { + abiEventIndexedInputsNames = append(abiEventIndexedInputsNames, abiEventIndexedInput.Name) + } + return fmt.Errorf("params: [%s] don't match abi event indexed inputs: [%s]", strings.Join(chainReaderEventParams, ","), strings.Join(abiEventIndexedInputsNames, ",")) + } + return nil +} + +func validateMethods(abi abi.ABI, chainReaderDefinition types.ChainReaderDefinition) error { + method, methodExists := abi.Methods[chainReaderDefinition.ChainSpecificName] + if !methodExists { + return fmt.Errorf("method: %q doesn't exist", chainReaderDefinition.ChainSpecificName) + } + + var methodNames []string + for methodName := range chainReaderDefinition.Params { + methodNames = append(methodNames, methodName) + } + + if !areChainReaderArgumentsValid(method.Inputs, methodNames) { + var abiMethodInputs []string + for _, input := range method.Inputs { + abiMethodInputs = append(abiMethodInputs, input.Name) + } + return fmt.Errorf("params: [%s] don't match abi method inputs: [%s]", strings.Join(methodNames, ","), strings.Join(abiMethodInputs, ",")) + } + + if !areChainReaderArgumentsValid(method.Outputs, chainReaderDefinition.ReturnValues) { + var abiMethodOutputs []string + for _, input := range method.Outputs { + abiMethodOutputs = append(abiMethodOutputs, input.Name) + } + return fmt.Errorf("return values: [%s] don't match abi method outputs: [%s]", strings.Join(chainReaderDefinition.ReturnValues, ","), strings.Join(abiMethodOutputs, ",")) + } + + return nil +} + +func areChainReaderArgumentsValid(contractArgs []abi.Argument, chainReaderArgs []string) bool { + for _, chArgName := range chainReaderArgs { + found := false + for _, contractArg := range contractArgs { + if chArgName == contractArg.Name { + found = true + break + } + } + if !found { + return false + } + } + return true +} diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go new file mode 100644 index 00000000000..a08da84643b --- /dev/null +++ b/core/services/relay/evm/chain_reader_test.go @@ -0,0 +1,344 @@ +package evm + +import ( + "encoding/json" + "errors" + "fmt" + "strings" + "testing" + + types2 "github.com/smartcontractkit/chainlink-common/pkg/types" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + mocklogpoller "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/mocks" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" + "github.com/smartcontractkit/chainlink/v2/core/logger" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" +) + +func TestNewChainReader(t *testing.T) { + lggr := logger.TestLogger(t) + lp := mocklogpoller.NewLogPoller(t) + chain := mocks.NewChain(t) + contractID := testutils.NewAddress() + contractABI := `[{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"result","type":"string"}],"stateMutability":"view","type":"function"}]` + + makeRelayConfig := func(abi string, retValues []string) types.ChainReaderConfig { + return types.ChainReaderConfig{ + ChainContractReaders: map[string]types.ChainContractReader{ + "MyContract": {abi, + map[string]types.ChainReaderDefinition{ + "MyGenericMethod": types.ChainReaderDefinition{ + "name", + map[string]any{}, + retValues, + false, + types.Method, + }, + }, + }, + }, + } + } + + chainReaderConfig := makeRelayConfig(contractABI, []string{"result"}) + relayConfig := types.RelayConfig{ChainReader: &chainReaderConfig} + r, err := json.Marshal(&relayConfig) + require.NoError(t, err) + rargs := types2.RelayArgs{ContractID: contractID.String(), RelayConfig: r} + ropts := types.NewRelayOpts(rargs) + require.NotNil(t, ropts) + + t.Run("happy path", func(t *testing.T) { + chain.On("LogPoller").Return(lp) + _, err2 := NewChainReaderService(lggr, chain.LogPoller(), ropts) + assert.NoError(t, err2) + }) + + t.Run("invalid contractID", func(t *testing.T) { + rargs := types2.RelayArgs{ContractID: "invalid hex string", RelayConfig: r} + ropts = types.NewRelayOpts(rargs) + require.NotNil(t, ropts) + _, err2 := NewChainReaderService(lggr, chain.LogPoller(), ropts) + assert.ErrorIs(t, err2, types2.ErrInvalidConfig) + assert.ErrorContains(t, err2, "invalid contractID") + }) + + t.Run("invalid config", func(t *testing.T) { + chainReaderConfig = makeRelayConfig(contractABI, []string{"result", "extraResult"}) // 2 results required but abi includes only one + invalidConfig := types.RelayConfig{ChainReader: &chainReaderConfig} + r2, err2 := json.Marshal(&invalidConfig) + require.NoError(t, err2) + rargs = types2.RelayArgs{ContractID: contractID.String(), RelayConfig: r2} + ropts = types.NewRelayOpts(rargs) + require.NotNil(t, ropts) + _, err2 = NewChainReaderService(lggr, chain.LogPoller(), ropts) + assert.ErrorIs(t, err2, types2.ErrInvalidConfig) + assert.ErrorContains(t, err2, "return values: [result,extraResult] don't match abi method outputs: [result]") + }) + + t.Run("ChainReader missing from RelayConfig", func(t *testing.T) { + preChainReaderConfig := types.RelayConfig{} + r2, err2 := json.Marshal(&preChainReaderConfig) + require.NoError(t, err2) + rargs = types2.RelayArgs{ContractID: contractID.String(), RelayConfig: r2} + ropts = types.NewRelayOpts(rargs) + require.NotNil(t, ropts) + _, err2 = NewChainReaderService(lggr, chain.LogPoller(), ropts) + assert.ErrorIs(t, err2, errors.ErrUnsupported) + assert.ErrorContains(t, err2, "ChainReader missing from RelayConfig") + }) +} + +func TestChainReaderStartClose(t *testing.T) { + lggr := logger.TestLogger(t) + lp := mocklogpoller.NewLogPoller(t) + chainReader := chainReader{ + lggr: lggr, + lp: lp, + } + err := chainReader.Start(testutils.Context(t)) + assert.NoError(t, err) + err = chainReader.Close() + assert.NoError(t, err) +} + +func TestValidateChainReaderConfig(t *testing.T) { + chainReaderConfigTemplate := `{ + "chainContractReaders": { + "testContract": { + "contractName": "testContract", + "contractABI": "[%s]", + "chainReaderDefinitions": { + %s + } + } + } + }` + + type testCase struct { + name string + abiInput string + chainReadingDefinitions string + } + + var testCases []testCase + testCases = append(testCases, testCase{ + name: "median abi", + abiInput: `{"inputs":[{"internalType":"uint32","name":"_maximumGasPrice","type":"uint32"},{"internalType":"uint32","name":"_reasonableGasPrice","type":"uint32"},{"internalType":"uint32","name":"_microLinkPerEth","type":"uint32"},{"internalType":"uint32","name":"_linkGweiPerObservation","type":"uint32"},{"internalType":"uint32","name":"_linkGweiPerTransmission","type":"uint32"},{"internalType":"address","name":"_link","type":"address"},{"internalType":"address","name":"_validator","type":"address"},{"internalType":"int192","name":"_minAnswer","type":"int192"},{"internalType":"int192","name":"_maxAnswer","type":"int192"},{"internalType":"contractAccessControllerInterface","name":"_billingAccessController","type":"address"},{"internalType":"contractAccessControllerInterface","name":"_requesterAccessController","type":"address"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"string","name":"_description","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"int256","name":"current","type":"int256"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"updatedAt","type":"uint256"}],"name":"AnswerUpdated","type":"event"},{"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":"uint32","name":"maximumGasPrice","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"reasonableGasPrice","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"microLinkPerEth","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"linkGweiPerObservation","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"linkGweiPerTransmission","type":"uint32"}],"name":"BillingSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"previousConfigBlockNumber","type":"uint32"},{"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":"threshold","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"encodedConfigVersion","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"encoded","type":"bytes"}],"name":"ConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":true,"internalType":"address","name":"startedBy","type":"address"},{"indexed":false,"internalType":"uint256","name":"startedAt","type":"uint256"}],"name":"NewRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"aggregatorRoundId","type":"uint32"},{"indexed":false,"internalType":"int192","name":"answer","type":"int192"},{"indexed":false,"internalType":"address","name":"transmitter","type":"address"},{"indexed":false,"internalType":"int192[]","name":"observations","type":"int192[]"},{"indexed":false,"internalType":"bytes","name":"observers","type":"bytes"},{"indexed":false,"internalType":"bytes32","name":"rawReportContext","type":"bytes32"}],"name":"NewTransmission","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"transmitter","type":"address"},{"indexed":false,"internalType":"address","name":"payee","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"OraclePaid","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":"contractAccessControllerInterface","name":"old","type":"address"},{"indexed":false,"internalType":"contractAccessControllerInterface","name":"current","type":"address"}],"name":"RequesterAccessControllerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"requester","type":"address"},{"indexed":false,"internalType":"bytes16","name":"configDigest","type":"bytes16"},{"indexed":false,"internalType":"uint32","name":"epoch","type":"uint32"},{"indexed":false,"internalType":"uint8","name":"round","type":"uint8"}],"name":"RoundRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previous","type":"address"},{"indexed":true,"internalType":"address","name":"current","type":"address"}],"name":"ValidatorUpdated","type":"event"},{"inputs":[],"name":"LINK","outputs":[{"internalType":"contractLinkTokenInterface","name":"","type":"address"}],"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":[],"name":"billingAccessController","outputs":[{"internalType":"contractAccessControllerInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundId","type":"uint256"}],"name":"getAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBilling","outputs":[{"internalType":"uint32","name":"maximumGasPrice","type":"uint32"},{"internalType":"uint32","name":"reasonableGasPrice","type":"uint32"},{"internalType":"uint32","name":"microLinkPerEth","type":"uint32"},{"internalType":"uint32","name":"linkGweiPerObservation","type":"uint32"},{"internalType":"uint32","name":"linkGweiPerTransmission","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"_roundId","type":"uint80"}],"name":"getRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundId","type":"uint256"}],"name":"getTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDetails","outputs":[{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"blockNumber","type":"uint32"},{"internalType":"bytes16","name":"configDigest","type":"bytes16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestTransmissionDetails","outputs":[{"internalType":"bytes16","name":"configDigest","type":"bytes16"},{"internalType":"uint32","name":"epoch","type":"uint32"},{"internalType":"uint8","name":"round","type":"uint8"},{"internalType":"int192","name":"latestAnswer","type":"int192"},{"internalType":"uint64","name":"latestTimestamp","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"linkAvailableForPayment","outputs":[{"internalType":"int256","name":"availableBalance","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxAnswer","outputs":[{"internalType":"int192","name":"","type":"int192"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minAnswer","outputs":[{"internalType":"int192","name":"","type":"int192"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_signerOrTransmitter","type":"address"}],"name":"oracleObservationCount","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_transmitter","type":"address"}],"name":"owedPayment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"addresspayable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"requestNewRound","outputs":[{"internalType":"uint80","name":"","type":"uint80"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requesterAccessController","outputs":[{"internalType":"contractAccessControllerInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_maximumGasPrice","type":"uint32"},{"internalType":"uint32","name":"_reasonableGasPrice","type":"uint32"},{"internalType":"uint32","name":"_microLinkPerEth","type":"uint32"},{"internalType":"uint32","name":"_linkGweiPerObservation","type":"uint32"},{"internalType":"uint32","name":"_linkGweiPerTransmission","type":"uint32"}],"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":"_threshold","type":"uint8"},{"internalType":"uint64","name":"_encodedConfigVersion","type":"uint64"},{"internalType":"bytes","name":"_encoded","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":"contractAccessControllerInterface","name":"_requesterAccessController","type":"address"}],"name":"setRequesterAccessController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newValidator","type":"address"}],"name":"setValidator","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":"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":"transmitters","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"validator","outputs":[{"internalType":"contractAggregatorValidatorInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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"}`, + chainReadingDefinitions: ` "latestTransmissionDetails":{ + "chainSpecificName": "latestTransmissionDetails", + "returnValues": [ + "configDigest", + "epoch", + "round", + "latestAnswer", + "latestTimestamp" + ], + "readType": 0 + }, + "latestRoundRequested":{ + "chainSpecificName": "RoundRequested", + "params": { + "requester": "" + }, + "returnValues": [ + "requester", + "configDigest", + "epoch", + "round" + ], + "readType": 1 + }`, + }) + testCases = append(testCases, + testCase{ + name: "eventWithNoIndexedTopics", + abiInput: `{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint112","name":"reserve0","type":"uint112"},{"indexed":false,"internalType":"uint112","name":"reserve1","type":"uint112"}],"name":"Sync","type":"event"}`, + chainReadingDefinitions: ` "Sync":{ + "chainSpecificName": "Sync", + "returnValues": [ + "reserve0", + "reserve1" + ], + "readType": 1 + }`, + }) + + testCases = append(testCases, + testCase{ + name: "eventWithMultipleIndexedTopics", + abiInput: `{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0Out","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1Out","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Swap","type":"event"}`, + chainReadingDefinitions: `"Swap":{ + "chainSpecificName": "Swap", + "params":{ + "sender": "0x0", + "to": "0x0" + }, + "returnValues": [ + "sender", + "amount0In", + "amount1In", + "amount0Out", + "amount1Out", + "to" + ], + "readType": 1 + }`, + }) + + testCases = append(testCases, + testCase{ + name: "functionWithOneParamAndMultipleResponses", + abiInput: `{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserAccountData","outputs":[{"internalType":"uint256","name":"totalLiquidityETH","type":"uint256"},{"internalType":"uint256","name":"totalCollateralETH","type":"uint256"},{"internalType":"uint256","name":"totalBorrowsETH","type":"uint256"},{"internalType":"uint256","name":"totalFeesETH","type":"uint256"},{"internalType":"uint256","name":"availableBorrowsETH","type":"uint256"},{"internalType":"uint256","name":"currentLiquidationThreshold","type":"uint256"},{"internalType":"uint256","name":"ltv","type":"uint256"},{"internalType":"uint256","name":"healthFactor","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}`, + chainReadingDefinitions: `"getUserAccountData":{ + "chainSpecificName": "getUserAccountData", + "params":{ + "_user": "0x0" + }, + "returnValues": [ + "totalLiquidityETH", + "totalCollateralETH", + "totalBorrowsETH", + "totalFeesETH", + "availableBorrowsETH", + "currentLiquidationThreshold", + "healthFactor" + ], + "readType": 0 + }`, + }) + + testCases = append(testCases, + testCase{ + name: "functionWithNoParamsAndOneResponseWithNoName", + abiInput: `{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}`, + chainReadingDefinitions: `"name":{ + "chainSpecificName": "name", + "returnValues": [ + "" + ], + "readType": 0 + }`, + }) + + testCases = append(testCases, + testCase{ + name: "functionWithMultipleParamsAndOneResult", + abiInput: `{"inputs":[{"internalType":"address","name":"_input","type":"address"},{"internalType":"address","name":"_output","type":"address"},{"internalType":"uint256","name":"_inputQuantity","type":"uint256"}],"name":"getSwapOutput","outputs":[{"internalType":"uint256","name":"swapOutput","type":"uint256"}],"stateMutability":"view","type":"function"}`, + chainReadingDefinitions: `"getSwapOutput":{ + "chainSpecificName": "getSwapOutput", + "params":{ + "_input":"0x0", + "_output":"0x0", + "_inputQuantity":"0x0" + }, + "returnValues": [ + "swapOutput" + ], + "readType": 0 + }`, + }) + + // TODO how to handle return values for tuples + /*testCases = append(testCases, + testCase{ + name: "functionWithOneParamAndMultipleTupleResponse", + struct BassetPersonal { + // Address of the bAsset + address addr; + // Address of the bAsset + address integrator; + // An ERC20 can charge transfer fee, for example USDT, DGX tokens. + bool hasTxFee; // takes a byte in storage + // Status of the bAsset + BassetStatus status; + } + + // Status of the Basset - has it broken its peg? + enum BassetStatus { + Default, + Normal, + BrokenBelowPeg, + BrokenAbovePeg, + Blacklisted, + Liquidating, + Liquidated, + Failed + } + + struct BassetData { + // 1 Basset * ratio / ratioScale == x Masset (relative value) + // If ratio == 10e8 then 1 bAsset = 10 mAssets + // A ratio is divised as 10^(18-tokenDecimals) * measurementMultiple(relative value of 1 base unit) + uint128 ratio; + // Amount of the Basset that is held in Collateral + uint128 vaultBalance; + } + abiInput: `{"inputs":[{"internalType":"address","name":"_bAsset","type":"address"}],"name":"getBasset","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"address","name":"integrator","type":"address"},{"internalType":"bool","name":"hasTxFee","type":"bool"},{"internalType":"enum BassetStatus","name":"status","type":"uint8"}],"internalType":"struct BassetPersonal","name":"personal","type":"tuple"},{"components":[{"internalType":"uint128","name":"ratio","type":"uint128"},{"internalType":"uint128","name":"vaultBalance","type":"uint128"}],"internalType":"struct BassetData","name":"vaultData","type":"tuple"}],"stateMutability":"view","type":"function"}`, + chainReadingDefinitions: `getBasset:{ + chainSpecificName: getBasset, + params:{ + _bAsset:"0x0", + }, + returnValues: [ + TODO, + ] + readType: 0, + }`, + }) + */ + + // TODO how to handle return values for tuples + /* + testCases = append(testCases, + testCase{ + name: "functionWithNoParamsAndTupleResponse", + struct FeederConfig { + uint256 supply; + uint256 a; + WeightLimits limits; + } + + struct WeightLimits { + uint128 min; + uint128 max; + } + abiInput: `{"inputs":[],"name":"getConfig","outputs":[{"components":[{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"uint256","name":"a","type":"uint256"},{"components":[{"internalType":"uint128","name":"min","type":"uint128"},{"internalType":"uint128","name":"max","type":"uint128"}],"internalType":"struct WeightLimits","name":"limits","type":"tuple"}],"internalType":"struct FeederConfig","name":"config","type":"tuple"}],"stateMutability":"view","type":"function"}`, + chainReadingDefinitions: `getConfig:{ + chainSpecificName: getConfig, + params:{}, + returnValues: [ + TODO, + ] + readType: 0, + }`, + })*/ + + var cfg types.ChainReaderConfig + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + abiString := strings.Replace(tc.abiInput, `"`, `\"`, -1) + formattedCfgJsonString := fmt.Sprintf(chainReaderConfigTemplate, abiString, tc.chainReadingDefinitions) + assert.NoError(t, json.Unmarshal([]byte(formattedCfgJsonString), &cfg)) + assert.NoError(t, validateChainReaderConfig(cfg)) + }) + } + + t.Run("large config with all test cases", func(t *testing.T) { + var largeABI string + var manyChainReadingDefinitions string + for _, tc := range testCases { + largeABI += tc.abiInput + "," + manyChainReadingDefinitions += tc.chainReadingDefinitions + "," + } + + largeABI = largeABI[:len(largeABI)-1] + manyChainReadingDefinitions = manyChainReadingDefinitions[:len(manyChainReadingDefinitions)-1] + formattedCfgJsonString := fmt.Sprintf(chainReaderConfigTemplate, strings.Replace(largeABI, `"`, `\"`, -1), manyChainReadingDefinitions) + assert.NoError(t, json.Unmarshal([]byte(formattedCfgJsonString), &cfg)) + assert.NoError(t, validateChainReaderConfig(cfg)) + }) +} diff --git a/core/services/relay/evm/config_poller.go b/core/services/relay/evm/config_poller.go index fe39ed0e343..dc75fe037fe 100644 --- a/core/services/relay/evm/config_poller.go +++ b/core/services/relay/evm/config_poller.go @@ -17,6 +17,7 @@ import ( ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-common/pkg/services" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" "github.com/smartcontractkit/chainlink/v2/core/logger" diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index e8267c9a842..990c75af21d 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -54,6 +54,7 @@ type Relayer struct { mercuryPool wsrpc.Pool eventBroadcaster pg.EventBroadcaster pgCfg pg.QConfig + chainReader commontypes.ChainReader } type CSAETHKeystore interface { @@ -189,8 +190,7 @@ func (r *Relayer) NewMercuryProvider(rargs commontypes.RelayArgs, pargs commonty } transmitter := mercury.NewTransmitter(lggr, cw.ContractConfigTracker(), client, privKey.PublicKey, rargs.JobID, *relayConfig.FeedID, r.db, r.pgCfg, transmitterCodec) - chainReader := NewChainReader(r.chain.HeadTracker()) - return NewMercuryProvider(cw, transmitter, reportCodecV1, reportCodecV2, reportCodecV3, chainReader, lggr), nil + return NewMercuryProvider(cw, r.chainReader, NewMercuryChainReader(r.chain.HeadTracker()), transmitter, reportCodecV1, reportCodecV2, reportCodecV3, lggr), nil } func (r *Relayer) NewFunctionsProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.FunctionsProvider, error) { @@ -518,12 +518,27 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp if err != nil { return nil, err } - return &medianProvider{ + + medianProvider := medianProvider{ configWatcher: configWatcher, reportCodec: reportCodec, contractTransmitter: contractTransmitter, medianContract: medianContract, - }, nil + } + + chainReader, err := NewChainReaderService(lggr, r.chain.LogPoller(), relayOpts) + if err != nil { + if errors.Is(err, errors.ErrUnsupported) { + // ignore for now, until we can remove old MedianContract code from MedianProvider + medianProvider.chainReader = nil + return &medianProvider, nil + } else { + return nil, err + } + } + medianProvider.chainReader = chainReader + + return &medianProvider, nil } var _ commontypes.MedianProvider = (*medianProvider)(nil) @@ -533,8 +548,8 @@ type medianProvider struct { contractTransmitter ContractTransmitter reportCodec median.ReportCodec medianContract *medianContract - - ms services.MultiStart + chainReader commontypes.ChainReader + ms services.MultiStart } func (p *medianProvider) Name() string { @@ -582,3 +597,7 @@ func (p *medianProvider) OffchainConfigDigester() ocrtypes.OffchainConfigDigeste func (p *medianProvider) ContractConfigTracker() ocrtypes.ContractConfigTracker { return p.configWatcher.ContractConfigTracker() } + +func (p *medianProvider) ChainReader() commontypes.ChainReader { + return p.chainReader +} diff --git a/core/services/relay/evm/functions.go b/core/services/relay/evm/functions.go index 88f9d22099e..7c39c08a0be 100644 --- a/core/services/relay/evm/functions.go +++ b/core/services/relay/evm/functions.go @@ -18,6 +18,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/services" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" txm "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" @@ -85,6 +86,10 @@ func (p *functionsProvider) Name() string { return p.configWatcher.Name() } +func (p *functionsProvider) ChainReader() commontypes.ChainReader { + return nil +} + func NewFunctionsProvider(chain evm.Chain, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs, lggr logger.Logger, ethKeystore keystore.Eth, pluginType functionsRelay.FunctionsPluginType) (evmRelayTypes.FunctionsProvider, error) { relayOpts := evmRelayTypes.NewRelayOpts(rargs) relayConfig, err := relayOpts.RelayConfig() diff --git a/core/services/relay/evm/functions/logpoller_wrapper.go b/core/services/relay/evm/functions/logpoller_wrapper.go index 95f45022ab3..e7f3a1a96af 100644 --- a/core/services/relay/evm/functions/logpoller_wrapper.go +++ b/core/services/relay/evm/functions/logpoller_wrapper.go @@ -11,6 +11,7 @@ import ( "github.com/pkg/errors" "github.com/smartcontractkit/chainlink-common/pkg/services" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/functions/generated/functions_coordinator" diff --git a/core/services/relay/evm/functions/offchain_config_digester.go b/core/services/relay/evm/functions/offchain_config_digester.go index b4467543d98..29547e794ce 100644 --- a/core/services/relay/evm/functions/offchain_config_digester.go +++ b/core/services/relay/evm/functions/offchain_config_digester.go @@ -10,13 +10,13 @@ import ( "github.com/smartcontractkit/libocr/offchainreporting2/chains/evmutil" "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - relaytypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" + evmRelayTypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) var ( - _ types.OffchainConfigDigester = &functionsOffchainConfigDigester{} - _ relaytypes.RouteUpdateSubscriber = &functionsOffchainConfigDigester{} - FunctionsDigestPrefix = types.ConfigDigestPrefixEVM + _ types.OffchainConfigDigester = &functionsOffchainConfigDigester{} + _ evmRelayTypes.RouteUpdateSubscriber = &functionsOffchainConfigDigester{} + FunctionsDigestPrefix = types.ConfigDigestPrefixEVM // In order to support multiple OCR plugins with a single jobspec & OCR2Base contract, each plugin must have a unique config digest. // This is accomplished by overriding the single config digest from the contract with a unique prefix for each plugin via this custom offchain digester & config poller. ThresholdDigestPrefix = types.ConfigDigestPrefix(7) diff --git a/core/services/relay/evm/mercury/v1/data_source.go b/core/services/relay/evm/mercury/v1/data_source.go index 79eb32af441..97d42709813 100644 --- a/core/services/relay/evm/mercury/v1/data_source.go +++ b/core/services/relay/evm/mercury/v1/data_source.go @@ -66,7 +66,7 @@ type datasource struct { mu sync.RWMutex chEnhancedTelem chan<- ocrcommon.EnhancedTelemetryMercuryData - chainReader relaymercury.ChainReader + mercuryChainReader relaymercury.ChainReader fetcher Fetcher initialBlockNumber *int64 @@ -294,7 +294,7 @@ func (ds *datasource) executeRun(ctx context.Context) (*pipeline.Run, pipeline.T } func (ds *datasource) setLatestBlocks(ctx context.Context, obs *relaymercuryv1.Observation) error { - latestBlocks, err := ds.chainReader.LatestHeads(ctx, nBlocksObservation) + latestBlocks, err := ds.mercuryChainReader.LatestHeads(ctx, nBlocksObservation) if err != nil { ds.lggr.Errorw("failed to read latest blocks", "error", err) return err diff --git a/core/services/relay/evm/mercury/v1/data_source_test.go b/core/services/relay/evm/mercury/v1/data_source_test.go index 6eb9f430c60..a5b8d2e7ffd 100644 --- a/core/services/relay/evm/mercury/v1/data_source_test.go +++ b/core/services/relay/evm/mercury/v1/data_source_test.go @@ -17,6 +17,7 @@ import ( relaymercury "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury" relaymercuryv1 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v1" + commonmocks "github.com/smartcontractkit/chainlink/v2/common/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" @@ -107,7 +108,7 @@ func TestMercury_Observe(t *testing.T) { ds.spec = spec h := commonmocks.NewHeadTracker[*evmtypes.Head, common.Hash](t) - ds.chainReader = evm.NewChainReader(h) + ds.mercuryChainReader = evm.NewMercuryChainReader(h) head := &evmtypes.Head{ Number: int64(rand.Int31()), @@ -199,7 +200,7 @@ func TestMercury_Observe(t *testing.T) { t.Run("if no current block available", func(t *testing.T) { h2 := commonmocks.NewHeadTracker[*evmtypes.Head, common.Hash](t) h2.On("LatestChain").Return((*evmtypes.Head)(nil)) - ds.chainReader = evm.NewChainReader(h2) + ds.mercuryChainReader = evm.NewMercuryChainReader(h2) obs, err := ds.Observe(ctx, repts, true) assert.NoError(t, err) @@ -210,7 +211,7 @@ func TestMercury_Observe(t *testing.T) { }) }) - ds.chainReader = evm.NewChainReader(h) + ds.mercuryChainReader = evm.NewMercuryChainReader(h) t.Run("when fetchMaxFinalizedBlockNum=false", func(t *testing.T) { t.Run("when run execution fails, returns error", func(t *testing.T) { @@ -318,7 +319,7 @@ func TestMercury_Observe(t *testing.T) { t.Run("when chain length is zero", func(t *testing.T) { ht2 := commonmocks.NewHeadTracker[*evmtypes.Head, common.Hash](t) ht2.On("LatestChain").Return((*evmtypes.Head)(nil)) - ds.chainReader = evm.NewChainReader(ht2) + ds.mercuryChainReader = evm.NewMercuryChainReader(ht2) obs, err := ds.Observe(ctx, repts, true) assert.NoError(t, err) @@ -343,7 +344,7 @@ func TestMercury_Observe(t *testing.T) { ht2 := commonmocks.NewHeadTracker[*evmtypes.Head, common.Hash](t) ht2.On("LatestChain").Return(h6) - ds.chainReader = evm.NewChainReader(ht2) + ds.mercuryChainReader = evm.NewMercuryChainReader(ht2) obs, err := ds.Observe(ctx, repts, true) assert.NoError(t, err) @@ -382,7 +383,7 @@ func TestMercury_Observe(t *testing.T) { ht2 := commonmocks.NewHeadTracker[*evmtypes.Head, common.Hash](t) ht2.On("LatestChain").Return(h6) - ds.chainReader = evm.NewChainReader(ht2) + ds.mercuryChainReader = evm.NewMercuryChainReader(ht2) obs, err := ds.Observe(ctx, repts, true) assert.NoError(t, err) @@ -399,7 +400,7 @@ func TestMercury_Observe(t *testing.T) { t.Run("when chain reader returns an error", func(t *testing.T) { - ds.chainReader = &mockChainReader{ + ds.mercuryChainReader = &mockChainReader{ err: io.EOF, obs: nil, } @@ -429,7 +430,7 @@ func TestMercury_SetLatestBlocks(t *testing.T) { t.Run("returns head from headtracker if present", func(t *testing.T) { headTracker := commonmocks.NewHeadTracker[*evmtypes.Head, common.Hash](t) headTracker.On("LatestChain").Return(&h, nil) - ds.chainReader = evm.NewChainReader(headTracker) + ds.mercuryChainReader = evm.NewMercuryChainReader(headTracker) obs := relaymercuryv1.Observation{} err := ds.setLatestBlocks(testutils.Context(t), &obs) @@ -448,7 +449,7 @@ func TestMercury_SetLatestBlocks(t *testing.T) { // This can happen in some cases e.g. RPC node is offline headTracker.On("LatestChain").Return((*evmtypes.Head)(nil)) - ds.chainReader = evm.NewChainReader(headTracker) + ds.mercuryChainReader = evm.NewMercuryChainReader(headTracker) obs := relaymercuryv1.Observation{} err := ds.setLatestBlocks(testutils.Context(t), &obs) diff --git a/core/services/relay/evm/mercury_provider.go b/core/services/relay/evm/mercury_provider.go index 90253808171..9e25597291f 100644 --- a/core/services/relay/evm/mercury_provider.go +++ b/core/services/relay/evm/mercury_provider.go @@ -12,6 +12,7 @@ import ( relaymercuryv3 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v3" "github.com/smartcontractkit/chainlink-common/pkg/services" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + httypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker/types" "github.com/smartcontractkit/chainlink/v2/core/logger" @@ -21,33 +22,36 @@ import ( var _ commontypes.MercuryProvider = (*mercuryProvider)(nil) type mercuryProvider struct { - configWatcher *configWatcher - transmitter mercury.Transmitter - reportCodecV1 relaymercuryv1.ReportCodec - reportCodecV2 relaymercuryv2.ReportCodec - reportCodecV3 relaymercuryv3.ReportCodec - chainReader relaymercury.ChainReader - logger logger.Logger + configWatcher *configWatcher + chainReader commontypes.ChainReader + mercuryChainReader relaymercury.ChainReader + transmitter mercury.Transmitter + reportCodecV1 relaymercuryv1.ReportCodec + reportCodecV2 relaymercuryv2.ReportCodec + reportCodecV3 relaymercuryv3.ReportCodec + logger logger.Logger ms services.MultiStart } func NewMercuryProvider( configWatcher *configWatcher, + chainReader commontypes.ChainReader, + mercuryChainReader relaymercury.ChainReader, transmitter mercury.Transmitter, reportCodecV1 relaymercuryv1.ReportCodec, reportCodecV2 relaymercuryv2.ReportCodec, reportCodecV3 relaymercuryv3.ReportCodec, - chainReader relaymercury.ChainReader, lggr logger.Logger, ) *mercuryProvider { return &mercuryProvider{ configWatcher, + chainReader, + mercuryChainReader, transmitter, reportCodecV1, reportCodecV2, reportCodecV3, - chainReader, lggr, services.MultiStart{}, } @@ -76,6 +80,10 @@ func (p *mercuryProvider) HealthReport() map[string]error { return report } +func (p *mercuryProvider) MercuryChainReader() relaymercury.ChainReader { + return p.mercuryChainReader +} + func (p *mercuryProvider) ContractConfigTracker() ocrtypes.ContractConfigTracker { return p.configWatcher.ContractConfigTracker() } @@ -108,23 +116,23 @@ func (p *mercuryProvider) MercuryServerFetcher() relaymercury.MercuryServerFetch return p.transmitter } -func (p *mercuryProvider) ChainReader() relaymercury.ChainReader { +func (p *mercuryProvider) ChainReader() commontypes.ChainReader { return p.chainReader } -var _ relaymercury.ChainReader = (*chainReader)(nil) +var _ relaymercury.ChainReader = (*mercuryChainReader)(nil) -type chainReader struct { +type mercuryChainReader struct { tracker httypes.HeadTracker } -func NewChainReader(h httypes.HeadTracker) relaymercury.ChainReader { - return &chainReader{ +func NewMercuryChainReader(h httypes.HeadTracker) relaymercury.ChainReader { + return &mercuryChainReader{ tracker: h, } } -func (r *chainReader) LatestHeads(ctx context.Context, k int) ([]relaymercury.Head, error) { +func (r *mercuryChainReader) LatestHeads(ctx context.Context, k int) ([]relaymercury.Head, error) { evmBlocks := r.tracker.LatestChain().AsSlice(k) if len(evmBlocks) == 0 { return nil, nil diff --git a/core/services/relay/evm/ocr2keeper.go b/core/services/relay/evm/ocr2keeper.go index 2b484edb798..9e056e8b983 100644 --- a/core/services/relay/evm/ocr2keeper.go +++ b/core/services/relay/evm/ocr2keeper.go @@ -130,6 +130,10 @@ func (c *ocr2keeperProvider) ContractTransmitter() ocrtypes.ContractTransmitter return c.contractTransmitter } +func (c *ocr2keeperProvider) ChainReader() commontypes.ChainReader { + return nil +} + func newOCR2KeeperConfigProvider(lggr logger.Logger, chain evm.Chain, rargs commontypes.RelayArgs) (*configWatcher, error) { var relayConfig types.RelayConfig err := json.Unmarshal(rargs.RelayConfig, &relayConfig) diff --git a/core/services/relay/evm/ocr2vrf.go b/core/services/relay/evm/ocr2vrf.go index 66ce42b7d8d..f4d695b4cd1 100644 --- a/core/services/relay/evm/ocr2vrf.go +++ b/core/services/relay/evm/ocr2vrf.go @@ -110,6 +110,10 @@ func (c *dkgProvider) ContractTransmitter() ocrtypes.ContractTransmitter { return c.contractTransmitter } +func (c *dkgProvider) ChainReader() commontypes.ChainReader { + return nil +} + type ocr2vrfProvider struct { *configWatcher contractTransmitter ContractTransmitter @@ -119,6 +123,10 @@ func (c *ocr2vrfProvider) ContractTransmitter() ocrtypes.ContractTransmitter { return c.contractTransmitter } +func (c *ocr2vrfProvider) ChainReader() commontypes.ChainReader { + return nil +} + func newOCR2VRFConfigProvider(lggr logger.Logger, chain evm.Chain, rargs commontypes.RelayArgs) (*configWatcher, error) { var relayConfig types.RelayConfig err := json.Unmarshal(rargs.RelayConfig, &relayConfig) diff --git a/core/services/relay/evm/types/types.go b/core/services/relay/evm/types/types.go index d2edef8b118..24afb65c55a 100644 --- a/core/services/relay/evm/types/types.go +++ b/core/services/relay/evm/types/types.go @@ -20,11 +20,38 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/utils" ) +type ChainReaderConfig struct { + // ChainContractReaders key is contract name + ChainContractReaders map[string]ChainContractReader `json:"chainContractReaders"` +} + +type ChainContractReader struct { + ContractABI string `json:"contractABI"` + // ChainReaderDefinitions key is chainAgnostic read name. + ChainReaderDefinitions map[string]ChainReaderDefinition `json:"chainReaderDefinitions"` +} + +type ChainReaderDefinition struct { + ChainSpecificName string `json:"chainSpecificName"` // chain specific contract method name or event type. + Params map[string]any `json:"params"` + ReturnValues []string `json:"returnValues"` + CacheEnabled bool `json:"cacheEnabled"` + ReadType ReadType `json:"readType"` +} + +type ReadType int64 + +const ( + Method ReadType = 0 + Event ReadType = 1 +) + type RelayConfig struct { - ChainID *utils.Big `json:"chainID"` - FromBlock uint64 `json:"fromBlock"` - EffectiveTransmitterID null.String `json:"effectiveTransmitterID"` - ConfigContractAddress *common.Address `json:"configContractAddress"` + ChainID *utils.Big `json:"chainID"` + FromBlock uint64 `json:"fromBlock"` + EffectiveTransmitterID null.String `json:"effectiveTransmitterID"` + ConfigContractAddress *common.Address `json:"configContractAddress"` + ChainReader *ChainReaderConfig `json:"chainReader"` // Contract-specific SendingKeys pq.StringArray `json:"sendingKeys"` diff --git a/core/services/relay/relay_test.go b/core/services/relay/relay_test.go index 18a7b1b44ea..e93740b2555 100644 --- a/core/services/relay/relay_test.go +++ b/core/services/relay/relay_test.go @@ -5,12 +5,13 @@ import ( "github.com/stretchr/testify/assert" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" + "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-common/pkg/loop" "github.com/smartcontractkit/chainlink-common/pkg/types" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" ) func TestIdentifier_UnmarshalString(t *testing.T) { diff --git a/go.mod b/go.mod index e6bb7347ffd..7f4b07da7e7 100644 --- a/go.mod +++ b/go.mod @@ -66,10 +66,10 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231121180428-d7f28e91ccc3 - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231117191236-12eab01a4542 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231117191230-aa6640f2edd1 - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231117204155-b253a2f56664 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20231107151413-13e0202ae8d7 github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 @@ -103,6 +103,11 @@ require ( gopkg.in/natefinch/lumberjack.v2 v2.0.0 ) +require ( + github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect + github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0 // indirect +) + require ( contrib.go.opencensus.io/exporter/stackdriver v0.13.5 // indirect cosmossdk.io/api v0.3.1 // indirect @@ -127,7 +132,6 @@ require ( github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/blendle/zapdriver v1.3.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect github.com/bytedance/sonic v1.9.1 // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect @@ -193,7 +197,7 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/btree v1.1.2 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/go-tpm v0.9.0 // indirect github.com/google/gofuzz v1.2.0 // indirect diff --git a/go.sum b/go.sum index 24d662390d0..2396d634b45 100644 --- a/go.sum +++ b/go.sum @@ -432,6 +432,8 @@ github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3Bop github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0 h1:ymLjT4f35nQbASLnvxEde4XOBL+Sn7rFuV+FOJqkljg= +github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0/go.mod h1:6daplAwHHGbUGib4990V3Il26O0OC4aRyvewaaAihaA= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= @@ -562,8 +564,9 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= @@ -1465,14 +1468,14 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231121180428-d7f28e91ccc3 h1:cyA1aW1PYrOLZAMaSmuH7U99QBTfrF59s+6uDxQgOr0= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231121180428-d7f28e91ccc3/go.mod h1:Hrru9i7n+WEYyW2aIt3/YGPhxLX+HEGWnhk3yVXeDF8= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231117191236-12eab01a4542 h1:oewYJtdRkJKUHCNDCj5C2LQe6Oq6qy975g931nfG0cc= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231117191236-12eab01a4542/go.mod h1:EpvRoycRD+kniYlz+pCpRT5e+fmPm0mSD/vmND+0oMg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231117191230-aa6640f2edd1 h1:D7yb4kgNGVAiD5lFYqm/LW8d5jU66TXyYvSskDiW9yg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231117191230-aa6640f2edd1/go.mod h1:UfW7/PZKon+iDEHtrHOfvMnS5GfYOW/SdMZ6P97rPEk= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231117204155-b253a2f56664 h1:yxaHuDTtj2xxtsR8b+LJw8xDvyr6v/F6GP3InsP4wPI= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231117204155-b253a2f56664/go.mod h1:3Fa+HQTZ3R3fPC0hUqugvoo+NEeo8Y4J2WOnQfi7O34= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 h1:QLhOOIeFldRBc+ESAVZfEPrIpfeiduwnmHlvDt1iFmM= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af h1:lwrfntkyF0onNy2QVdphvtutQsqj5E5izh63t7XZbFc= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af/go.mod h1:jOBq6ZSI0bkVS721oiAZ2t3IzOszk2B81PfWAeNeL40= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= 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-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 2338c0caa58..077de72631a 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -23,7 +23,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231121180428-d7f28e91ccc3 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 github.com/smartcontractkit/chainlink-testing-framework v1.19.5 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 @@ -156,6 +156,7 @@ require ( github.com/gin-gonic/gin v1.9.1 // indirect github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect github.com/go-errors/errors v1.4.2 // indirect + github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-ldap/ldap/v3 v3.4.5 // indirect @@ -191,7 +192,7 @@ require ( github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/btree v1.1.2 // indirect github.com/google/gnostic v0.6.9 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/go-tpm v0.9.0 // indirect github.com/google/gofuzz v1.2.0 // indirect @@ -389,9 +390,9 @@ require ( github.com/shopspring/decimal v1.3.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231117191236-12eab01a4542 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231117191230-aa6640f2edd1 // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231117204155-b253a2f56664 // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 21be8c1f480..bceebfa735c 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1047,6 +1047,8 @@ github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmn github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0 h1:ymLjT4f35nQbASLnvxEde4XOBL+Sn7rFuV+FOJqkljg= +github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0/go.mod h1:6daplAwHHGbUGib4990V3Il26O0OC4aRyvewaaAihaA= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= @@ -1266,8 +1268,9 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= @@ -2372,14 +2375,14 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231121180428-d7f28e91ccc3 h1:cyA1aW1PYrOLZAMaSmuH7U99QBTfrF59s+6uDxQgOr0= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231121180428-d7f28e91ccc3/go.mod h1:Hrru9i7n+WEYyW2aIt3/YGPhxLX+HEGWnhk3yVXeDF8= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231117191236-12eab01a4542 h1:oewYJtdRkJKUHCNDCj5C2LQe6Oq6qy975g931nfG0cc= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231117191236-12eab01a4542/go.mod h1:EpvRoycRD+kniYlz+pCpRT5e+fmPm0mSD/vmND+0oMg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231117191230-aa6640f2edd1 h1:D7yb4kgNGVAiD5lFYqm/LW8d5jU66TXyYvSskDiW9yg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231117191230-aa6640f2edd1/go.mod h1:UfW7/PZKon+iDEHtrHOfvMnS5GfYOW/SdMZ6P97rPEk= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231117204155-b253a2f56664 h1:yxaHuDTtj2xxtsR8b+LJw8xDvyr6v/F6GP3InsP4wPI= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231117204155-b253a2f56664/go.mod h1:3Fa+HQTZ3R3fPC0hUqugvoo+NEeo8Y4J2WOnQfi7O34= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 h1:QLhOOIeFldRBc+ESAVZfEPrIpfeiduwnmHlvDt1iFmM= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af h1:lwrfntkyF0onNy2QVdphvtutQsqj5E5izh63t7XZbFc= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af/go.mod h1:jOBq6ZSI0bkVS721oiAZ2t3IzOszk2B81PfWAeNeL40= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= github.com/smartcontractkit/chainlink-testing-framework v1.19.5 h1:Iq1L7wCA8IkBBtP3p6W2ttu8v9cJp95spusnozW1UrA= github.com/smartcontractkit/chainlink-testing-framework v1.19.5/go.mod h1:+FVgkz6phTc+piVT57AcQfr3I8xvZgZ1lOpRPOu/dLQ= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/plugins/medianpoc/plugin_test.go b/plugins/medianpoc/plugin_test.go index bc6af7ae5d3..089784ddbdb 100644 --- a/plugins/medianpoc/plugin_test.go +++ b/plugins/medianpoc/plugin_test.go @@ -9,10 +9,10 @@ import ( ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" - "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" + "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" + "github.com/smartcontractkit/chainlink/v2/core/logger" ) @@ -72,6 +72,10 @@ func (p provider) OnchainConfigCodec() median.OnchainConfigCodec { return mockOnchainConfigCodec{} } +func (p provider) ChainReader() types.ChainReader { + return nil +} + func TestNewPlugin(t *testing.T) { lggr := logger.TestLogger(t) p := NewPlugin(lggr) From 0217ec91ed0006b47eb07e68b4b30799a4606e3d Mon Sep 17 00:00:00 2001 From: ilija Date: Wed, 22 Nov 2023 14:22:44 +0100 Subject: [PATCH 002/112] Fix lint --- core/services/relay/evm/chain_reader_test.go | 25 ++++++++++---------- core/services/relay/evm/evm.go | 3 +-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index a08da84643b..4130c6446f7 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -28,14 +28,15 @@ func TestNewChainReader(t *testing.T) { makeRelayConfig := func(abi string, retValues []string) types.ChainReaderConfig { return types.ChainReaderConfig{ ChainContractReaders: map[string]types.ChainContractReader{ - "MyContract": {abi, - map[string]types.ChainReaderDefinition{ - "MyGenericMethod": types.ChainReaderDefinition{ - "name", - map[string]any{}, - retValues, - false, - types.Method, + "MyContract": { + ContractABI: abi, + ChainReaderDefinitions: map[string]types.ChainReaderDefinition{ + "MyGenericMethod": { + ChainSpecificName: "name", + Params: map[string]any{}, + ReturnValues: retValues, + CacheEnabled: false, + ReadType: types.Method, }, }, }, @@ -58,7 +59,7 @@ func TestNewChainReader(t *testing.T) { }) t.Run("invalid contractID", func(t *testing.T) { - rargs := types2.RelayArgs{ContractID: "invalid hex string", RelayConfig: r} + rargs = types2.RelayArgs{ContractID: "invalid hex string", RelayConfig: r} ropts = types.NewRelayOpts(rargs) require.NotNil(t, ropts) _, err2 := NewChainReaderService(lggr, chain.LogPoller(), ropts) @@ -95,13 +96,13 @@ func TestNewChainReader(t *testing.T) { func TestChainReaderStartClose(t *testing.T) { lggr := logger.TestLogger(t) lp := mocklogpoller.NewLogPoller(t) - chainReader := chainReader{ + cr := chainReader{ lggr: lggr, lp: lp, } - err := chainReader.Start(testutils.Context(t)) + err := cr.Start(testutils.Context(t)) assert.NoError(t, err) - err = chainReader.Close() + err = cr.Close() assert.NoError(t, err) } diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index 990c75af21d..42babba0338 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -532,9 +532,8 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp // ignore for now, until we can remove old MedianContract code from MedianProvider medianProvider.chainReader = nil return &medianProvider, nil - } else { - return nil, err } + return nil, err } medianProvider.chainReader = chainReader From 717079994f23cfcb8391279054cd887d7b1206d4 Mon Sep 17 00:00:00 2001 From: ilija Date: Wed, 22 Nov 2023 15:37:02 +0100 Subject: [PATCH 003/112] Fix go imports lint --- .../ocr2vrf/coordinator/coordinator_test.go | 5 ++- core/services/relay/evm/chain_reader_test.go | 43 ++++++++++--------- core/services/relay/relay_test.go | 4 +- plugins/medianpoc/plugin_test.go | 3 +- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go index ca46d70d3fb..43fdf8a78f4 100644 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go +++ b/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go @@ -19,12 +19,13 @@ import ( "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-common/pkg/types" "github.com/smartcontractkit/chainlink-vrf/dkg" "github.com/smartcontractkit/chainlink-vrf/ocr2vrf" ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types" - "github.com/smartcontractkit/libocr/commontypes" - ocr2Types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 4130c6446f7..92e6784465c 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -7,15 +7,16 @@ import ( "strings" "testing" - types2 "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + mocklogpoller "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/mocks" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) func TestNewChainReader(t *testing.T) { @@ -25,18 +26,18 @@ func TestNewChainReader(t *testing.T) { contractID := testutils.NewAddress() contractABI := `[{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"result","type":"string"}],"stateMutability":"view","type":"function"}]` - makeRelayConfig := func(abi string, retValues []string) types.ChainReaderConfig { - return types.ChainReaderConfig{ - ChainContractReaders: map[string]types.ChainContractReader{ + makeRelayConfig := func(abi string, retValues []string) evmtypes.ChainReaderConfig { + return evmtypes.ChainReaderConfig{ + ChainContractReaders: map[string]evmtypes.ChainContractReader{ "MyContract": { ContractABI: abi, - ChainReaderDefinitions: map[string]types.ChainReaderDefinition{ + ChainReaderDefinitions: map[string]evmtypes.ChainReaderDefinition{ "MyGenericMethod": { ChainSpecificName: "name", Params: map[string]any{}, ReturnValues: retValues, CacheEnabled: false, - ReadType: types.Method, + ReadType: evmtypes.Method, }, }, }, @@ -45,11 +46,11 @@ func TestNewChainReader(t *testing.T) { } chainReaderConfig := makeRelayConfig(contractABI, []string{"result"}) - relayConfig := types.RelayConfig{ChainReader: &chainReaderConfig} + relayConfig := evmtypes.RelayConfig{ChainReader: &chainReaderConfig} r, err := json.Marshal(&relayConfig) require.NoError(t, err) - rargs := types2.RelayArgs{ContractID: contractID.String(), RelayConfig: r} - ropts := types.NewRelayOpts(rargs) + rargs := commontypes.RelayArgs{ContractID: contractID.String(), RelayConfig: r} + ropts := evmtypes.NewRelayOpts(rargs) require.NotNil(t, ropts) t.Run("happy path", func(t *testing.T) { @@ -59,33 +60,33 @@ func TestNewChainReader(t *testing.T) { }) t.Run("invalid contractID", func(t *testing.T) { - rargs = types2.RelayArgs{ContractID: "invalid hex string", RelayConfig: r} - ropts = types.NewRelayOpts(rargs) + rargs = commontypes.RelayArgs{ContractID: "invalid hex string", RelayConfig: r} + ropts = evmtypes.NewRelayOpts(rargs) require.NotNil(t, ropts) _, err2 := NewChainReaderService(lggr, chain.LogPoller(), ropts) - assert.ErrorIs(t, err2, types2.ErrInvalidConfig) + assert.ErrorIs(t, err2, commontypes.ErrInvalidConfig) assert.ErrorContains(t, err2, "invalid contractID") }) t.Run("invalid config", func(t *testing.T) { chainReaderConfig = makeRelayConfig(contractABI, []string{"result", "extraResult"}) // 2 results required but abi includes only one - invalidConfig := types.RelayConfig{ChainReader: &chainReaderConfig} + invalidConfig := evmtypes.RelayConfig{ChainReader: &chainReaderConfig} r2, err2 := json.Marshal(&invalidConfig) require.NoError(t, err2) - rargs = types2.RelayArgs{ContractID: contractID.String(), RelayConfig: r2} - ropts = types.NewRelayOpts(rargs) + rargs = commontypes.RelayArgs{ContractID: contractID.String(), RelayConfig: r2} + ropts = evmtypes.NewRelayOpts(rargs) require.NotNil(t, ropts) _, err2 = NewChainReaderService(lggr, chain.LogPoller(), ropts) - assert.ErrorIs(t, err2, types2.ErrInvalidConfig) + assert.ErrorIs(t, err2, commontypes.ErrInvalidConfig) assert.ErrorContains(t, err2, "return values: [result,extraResult] don't match abi method outputs: [result]") }) t.Run("ChainReader missing from RelayConfig", func(t *testing.T) { - preChainReaderConfig := types.RelayConfig{} + preChainReaderConfig := evmtypes.RelayConfig{} r2, err2 := json.Marshal(&preChainReaderConfig) require.NoError(t, err2) - rargs = types2.RelayArgs{ContractID: contractID.String(), RelayConfig: r2} - ropts = types.NewRelayOpts(rargs) + rargs = commontypes.RelayArgs{ContractID: contractID.String(), RelayConfig: r2} + ropts = evmtypes.NewRelayOpts(rargs) require.NotNil(t, ropts) _, err2 = NewChainReaderService(lggr, chain.LogPoller(), ropts) assert.ErrorIs(t, err2, errors.ErrUnsupported) @@ -318,7 +319,7 @@ func TestValidateChainReaderConfig(t *testing.T) { }`, })*/ - var cfg types.ChainReaderConfig + var cfg evmtypes.ChainReaderConfig for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { abiString := strings.Replace(tc.abiInput, `"`, `\"`, -1) diff --git a/core/services/relay/relay_test.go b/core/services/relay/relay_test.go index e93740b2555..d23895699df 100644 --- a/core/services/relay/relay_test.go +++ b/core/services/relay/relay_test.go @@ -5,13 +5,13 @@ import ( "github.com/stretchr/testify/assert" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" - "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-common/pkg/loop" "github.com/smartcontractkit/chainlink-common/pkg/types" + + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" ) func TestIdentifier_UnmarshalString(t *testing.T) { diff --git a/plugins/medianpoc/plugin_test.go b/plugins/medianpoc/plugin_test.go index 089784ddbdb..4384e66d4b3 100644 --- a/plugins/medianpoc/plugin_test.go +++ b/plugins/medianpoc/plugin_test.go @@ -7,12 +7,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" - "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" - "github.com/smartcontractkit/chainlink/v2/core/logger" ) From 4b371c7fc029eae6d954291b2ff89c281729dae0 Mon Sep 17 00:00:00 2001 From: ilija42 <57732589+ilija42@users.noreply.github.com> Date: Wed, 22 Nov 2023 15:41:07 +0100 Subject: [PATCH 004/112] Fix go.mod require got split into two Co-authored-by: Jordan Krage --- go.mod | 3 --- 1 file changed, 3 deletions(-) diff --git a/go.mod b/go.mod index 7f4b07da7e7..060d85ba063 100644 --- a/go.mod +++ b/go.mod @@ -106,9 +106,6 @@ require ( require ( github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0 // indirect -) - -require ( contrib.go.opencensus.io/exporter/stackdriver v0.13.5 // indirect cosmossdk.io/api v0.3.1 // indirect cosmossdk.io/core v0.5.1 // indirect From 8782b450642f33386b186bea5318859f01e15ca8 Mon Sep 17 00:00:00 2001 From: ilija Date: Wed, 22 Nov 2023 15:59:49 +0100 Subject: [PATCH 005/112] Run make gomodtidy --- go.mod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 060d85ba063..80099549522 100644 --- a/go.mod +++ b/go.mod @@ -104,8 +104,6 @@ require ( ) require ( - github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect - github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0 // indirect contrib.go.opencensus.io/exporter/stackdriver v0.13.5 // indirect cosmossdk.io/api v0.3.1 // indirect cosmossdk.io/core v0.5.1 // indirect @@ -129,6 +127,7 @@ require ( github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/blendle/zapdriver v1.3.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect + github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect github.com/bytedance/sonic v1.9.1 // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect @@ -171,6 +170,7 @@ require ( github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect + github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-ldap/ldap/v3 v3.4.5 From 3ac341c3719d2d9f43859a7fdcb557278c119652 Mon Sep 17 00:00:00 2001 From: ilija Date: Wed, 22 Nov 2023 20:33:18 +0100 Subject: [PATCH 006/112] Add tickets to chainreader TODOs --- core/services/relay/evm/chain_reader.go | 1 + core/services/relay/evm/chain_reader_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index e8f31a371b2..fa8b930cb2c 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -49,6 +49,7 @@ func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, ropts *ty return nil, err } + // TODO BCF-2814 implement initialisation of chain reading definitions and pass them into chainReader return &chainReader{lggr.Named("ChainReader"), contractID, lp}, nil } diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 92e6784465c..fa94316c64e 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -244,7 +244,7 @@ func TestValidateChainReaderConfig(t *testing.T) { }`, }) - // TODO how to handle return values for tuples + // TODO BCF-2789 how to handle return values for tuples /*testCases = append(testCases, testCase{ name: "functionWithOneParamAndMultipleTupleResponse", From 879e2864017b367511bcf88cb0be8d5f3a792c58 Mon Sep 17 00:00:00 2001 From: Domino Valdano <2644901+reductionista@users.noreply.github.com> Date: Wed, 22 Nov 2023 14:19:27 -0800 Subject: [PATCH 007/112] Log when we're falling back to internal MedianContract We had this before, at some point it accidentally got dropped --- core/services/relay/evm/evm.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index 42babba0338..7914a59814f 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -530,6 +530,7 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp if err != nil { if errors.Is(err, errors.ErrUnsupported) { // ignore for now, until we can remove old MedianContract code from MedianProvider + lggr.Info("ChainReader missing from RelayConfig; falling back to internal MedianContract") medianProvider.chainReader = nil return &medianProvider, nil } From 109e0d90133aa4ab9556760b881493fd0240f8b5 Mon Sep 17 00:00:00 2001 From: Domino Valdano <2644901+reductionista@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:26:54 -0800 Subject: [PATCH 008/112] Pass contractID, relayConfig instead of relayOpts Also: move test for invalid contract ID to evm_test.go, & add mismatched ChainID test while we're here since it's pretty similar --- core/services/relay/evm/chain_reader.go | 14 ++--------- core/services/relay/evm/chain_reader_test.go | 25 +++----------------- core/services/relay/evm/evm.go | 6 ++++- 3 files changed, 10 insertions(+), 35 deletions(-) diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index fa8b930cb2c..fbb061dc4ee 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -30,22 +30,12 @@ type chainReader struct { } // NewChainReaderService constructor for ChainReader -func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, ropts *types.RelayOpts) (*chainReader, error) { - relayConfig, err := ropts.RelayConfig() - if err != nil { - return nil, fmt.Errorf("failed parsing RelayConfig: %w", err) - } - - if !common.IsHexAddress(ropts.ContractID) { - return nil, fmt.Errorf("%w: invalid contractID, expected hex address", commontypes.ErrInvalidConfig) - } - contractID := common.HexToAddress(ropts.ContractID) - +func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, contractID common.Address, relayConfig *types.RelayConfig) (*chainReader, error) { if relayConfig.ChainReader == nil { return nil, fmt.Errorf("%w: ChainReader missing from RelayConfig", errors.ErrUnsupported) } - if err = validateChainReaderConfig(*relayConfig.ChainReader); err != nil { + if err := validateChainReaderConfig(*relayConfig.ChainReader); err != nil { return nil, err } diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index fa94316c64e..4464cd6d09a 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -55,40 +55,21 @@ func TestNewChainReader(t *testing.T) { t.Run("happy path", func(t *testing.T) { chain.On("LogPoller").Return(lp) - _, err2 := NewChainReaderService(lggr, chain.LogPoller(), ropts) + _, err2 := NewChainReaderService(lggr, chain.LogPoller(), contractID, &relayConfig) assert.NoError(t, err2) }) - t.Run("invalid contractID", func(t *testing.T) { - rargs = commontypes.RelayArgs{ContractID: "invalid hex string", RelayConfig: r} - ropts = evmtypes.NewRelayOpts(rargs) - require.NotNil(t, ropts) - _, err2 := NewChainReaderService(lggr, chain.LogPoller(), ropts) - assert.ErrorIs(t, err2, commontypes.ErrInvalidConfig) - assert.ErrorContains(t, err2, "invalid contractID") - }) - t.Run("invalid config", func(t *testing.T) { chainReaderConfig = makeRelayConfig(contractABI, []string{"result", "extraResult"}) // 2 results required but abi includes only one invalidConfig := evmtypes.RelayConfig{ChainReader: &chainReaderConfig} - r2, err2 := json.Marshal(&invalidConfig) - require.NoError(t, err2) - rargs = commontypes.RelayArgs{ContractID: contractID.String(), RelayConfig: r2} - ropts = evmtypes.NewRelayOpts(rargs) - require.NotNil(t, ropts) - _, err2 = NewChainReaderService(lggr, chain.LogPoller(), ropts) + _, err2 := NewChainReaderService(lggr, chain.LogPoller(), contractID, &invalidConfig) assert.ErrorIs(t, err2, commontypes.ErrInvalidConfig) assert.ErrorContains(t, err2, "return values: [result,extraResult] don't match abi method outputs: [result]") }) t.Run("ChainReader missing from RelayConfig", func(t *testing.T) { preChainReaderConfig := evmtypes.RelayConfig{} - r2, err2 := json.Marshal(&preChainReaderConfig) - require.NoError(t, err2) - rargs = commontypes.RelayArgs{ContractID: contractID.String(), RelayConfig: r2} - ropts = evmtypes.NewRelayOpts(rargs) - require.NotNil(t, ropts) - _, err2 = NewChainReaderService(lggr, chain.LogPoller(), ropts) + _, err2 := NewChainReaderService(lggr, chain.LogPoller(), contractID, &preChainReaderConfig) assert.ErrorIs(t, err2, errors.ErrUnsupported) assert.ErrorContains(t, err2, "ChainReader missing from RelayConfig") }) diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index 7914a59814f..d96aec7ae6e 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -502,6 +502,10 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp if expectedChainID != r.chain.ID().String() { return nil, fmt.Errorf("internal error: chain id in spec does not match this relayer's chain: have %s expected %s", relayConfig.ChainID.String(), r.chain.ID().String()) } + if !common.IsHexAddress(relayOpts.ContractID) { + return nil, fmt.Errorf("invalid contractID %s, expected hex address", relayOpts.ContractID) + } + contractID := common.HexToAddress(relayOpts.ContractID) configWatcher, err := newConfigProvider(lggr, r.chain, relayOpts, r.eventBroadcaster) if err != nil { @@ -526,7 +530,7 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp medianContract: medianContract, } - chainReader, err := NewChainReaderService(lggr, r.chain.LogPoller(), relayOpts) + chainReader, err := NewChainReaderService(lggr, r.chain.LogPoller(), contractID, &relayConfig) if err != nil { if errors.Is(err, errors.ErrUnsupported) { // ignore for now, until we can remove old MedianContract code from MedianProvider From 106ba7f2d552296a75e2233a259d62d8a386f8da Mon Sep 17 00:00:00 2001 From: ilija42 <57732589+ilija42@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:10:01 +0100 Subject: [PATCH 009/112] Revert get solana sha workflow to ref develop Co-authored-by: Jordan Krage --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index f7f7c7a3abe..9550be83ced 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -626,7 +626,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: repository: smartcontractkit/chainlink-solana - ref: BCF-2612-ChainReader + ref: develop fetch-depth: 0 path: solanapath - name: Get long sha From 688e862778b7385fdb416163e22f09270215947f Mon Sep 17 00:00:00 2001 From: ilija Date: Thu, 23 Nov 2023 15:54:31 +0100 Subject: [PATCH 010/112] Update err handling for when chain reader config is missing --- core/services/relay/evm/chain_reader.go | 12 +++---- core/services/relay/evm/chain_reader_test.go | 35 +++++++------------- core/services/relay/evm/evm.go | 17 +++++----- 3 files changed, 26 insertions(+), 38 deletions(-) diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index fbb061dc4ee..2bc1aa5aeaa 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -30,12 +30,8 @@ type chainReader struct { } // NewChainReaderService constructor for ChainReader -func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, contractID common.Address, relayConfig *types.RelayConfig) (*chainReader, error) { - if relayConfig.ChainReader == nil { - return nil, fmt.Errorf("%w: ChainReader missing from RelayConfig", errors.ErrUnsupported) - } - - if err := validateChainReaderConfig(*relayConfig.ChainReader); err != nil { +func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, contractID common.Address, config types.ChainReaderConfig) (*chainReader, error) { + if err := validateChainReaderConfig(config); err != nil { return nil, err } @@ -86,6 +82,10 @@ func (cr *chainReader) GetMaxDecodingSize(ctx context.Context, n int, itemType s } func validateChainReaderConfig(cfg types.ChainReaderConfig) error { + if len(cfg.ChainContractReaders) == 0 { + return fmt.Errorf("chain reader config is empty") + } + for contractName, chainContractReader := range cfg.ChainContractReaders { abi, err := abi.JSON(strings.NewReader(chainContractReader.ContractABI)) if err != nil { diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 4464cd6d09a..b4d2b374ceb 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -2,13 +2,11 @@ package evm import ( "encoding/json" - "errors" "fmt" "strings" "testing" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" @@ -26,7 +24,7 @@ func TestNewChainReader(t *testing.T) { contractID := testutils.NewAddress() contractABI := `[{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"result","type":"string"}],"stateMutability":"view","type":"function"}]` - makeRelayConfig := func(abi string, retValues []string) evmtypes.ChainReaderConfig { + makeChainReaderConfig := func(abi string, retValues []string) evmtypes.ChainReaderConfig { return evmtypes.ChainReaderConfig{ ChainContractReaders: map[string]evmtypes.ChainContractReader{ "MyContract": { @@ -45,33 +43,24 @@ func TestNewChainReader(t *testing.T) { } } - chainReaderConfig := makeRelayConfig(contractABI, []string{"result"}) - relayConfig := evmtypes.RelayConfig{ChainReader: &chainReaderConfig} - r, err := json.Marshal(&relayConfig) - require.NoError(t, err) - rargs := commontypes.RelayArgs{ContractID: contractID.String(), RelayConfig: r} - ropts := evmtypes.NewRelayOpts(rargs) - require.NotNil(t, ropts) - t.Run("happy path", func(t *testing.T) { + chainReaderConfig := makeChainReaderConfig(contractABI, []string{"result"}) chain.On("LogPoller").Return(lp) - _, err2 := NewChainReaderService(lggr, chain.LogPoller(), contractID, &relayConfig) - assert.NoError(t, err2) + _, err := NewChainReaderService(lggr, chain.LogPoller(), contractID, chainReaderConfig) + assert.NoError(t, err) }) t.Run("invalid config", func(t *testing.T) { - chainReaderConfig = makeRelayConfig(contractABI, []string{"result", "extraResult"}) // 2 results required but abi includes only one - invalidConfig := evmtypes.RelayConfig{ChainReader: &chainReaderConfig} - _, err2 := NewChainReaderService(lggr, chain.LogPoller(), contractID, &invalidConfig) - assert.ErrorIs(t, err2, commontypes.ErrInvalidConfig) - assert.ErrorContains(t, err2, "return values: [result,extraResult] don't match abi method outputs: [result]") + invalidChainReaderConfig := makeChainReaderConfig(contractABI, []string{"result", "extraResult"}) // 2 results required but abi includes only one + _, err := NewChainReaderService(lggr, chain.LogPoller(), contractID, invalidChainReaderConfig) + assert.ErrorIs(t, err, commontypes.ErrInvalidConfig) + assert.ErrorContains(t, err, "return values: [result,extraResult] don't match abi method outputs: [result]") }) - t.Run("ChainReader missing from RelayConfig", func(t *testing.T) { - preChainReaderConfig := evmtypes.RelayConfig{} - _, err2 := NewChainReaderService(lggr, chain.LogPoller(), contractID, &preChainReaderConfig) - assert.ErrorIs(t, err2, errors.ErrUnsupported) - assert.ErrorContains(t, err2, "ChainReader missing from RelayConfig") + t.Run("ChainReader config is empty", func(t *testing.T) { + emptyChainReaderConfig := evmtypes.ChainReaderConfig{} + _, err := NewChainReaderService(lggr, chain.LogPoller(), contractID, emptyChainReaderConfig) + assert.EqualError(t, err, "chain reader config is empty") }) } diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index d96aec7ae6e..d57cc176642 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -530,17 +530,16 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp medianContract: medianContract, } - chainReader, err := NewChainReaderService(lggr, r.chain.LogPoller(), contractID, &relayConfig) - if err != nil { - if errors.Is(err, errors.ErrUnsupported) { - // ignore for now, until we can remove old MedianContract code from MedianProvider - lggr.Info("ChainReader missing from RelayConfig; falling back to internal MedianContract") - medianProvider.chainReader = nil - return &medianProvider, nil + // allow fallback until chain reader is default and median contract is removed, but still log just in case + var chainReaderService commontypes.ChainReader + if relayConfig.ChainReader != nil { + if chainReaderService, err = NewChainReaderService(lggr, r.chain.LogPoller(), contractID, *relayConfig.ChainReader); err != nil { + return nil, err } - return nil, err + } else { + lggr.Info("ChainReader missing from RelayConfig; falling back to internal MedianContract") } - medianProvider.chainReader = chainReader + medianProvider.chainReader = chainReaderService return &medianProvider, nil } From 80e27cacd6842476aa15c884398f7305b9a225f7 Mon Sep 17 00:00:00 2001 From: ilija Date: Thu, 23 Nov 2023 16:30:23 +0100 Subject: [PATCH 011/112] Update solana repo hash --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 80099549522..79a09df43ea 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123051431-7628438e5b18 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20231107151413-13e0202ae8d7 diff --git a/go.sum b/go.sum index 2396d634b45..853ed9da66d 100644 --- a/go.sum +++ b/go.sum @@ -1474,6 +1474,8 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f60 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af h1:lwrfntkyF0onNy2QVdphvtutQsqj5E5izh63t7XZbFc= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af/go.mod h1:jOBq6ZSI0bkVS721oiAZ2t3IzOszk2B81PfWAeNeL40= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123051431-7628438e5b18 h1:jEtpdWZj04EOBiMGWvFCpRDlBrvOIgA8aQ4uvateA6k= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123051431-7628438e5b18/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= From 36d465dbfd4d636e822e35820e820e5dc9bc254b Mon Sep 17 00:00:00 2001 From: ilija Date: Thu, 23 Nov 2023 18:05:04 +0100 Subject: [PATCH 012/112] Improve chain reader config validation tests --- core/services/relay/evm/chain_reader.go | 2 +- core/services/relay/evm/chain_reader_test.go | 207 +++++++++++++++---- go.mod | 2 +- go.sum | 2 + 4 files changed, 167 insertions(+), 46 deletions(-) diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index 2bc1aa5aeaa..3d8260c385b 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -113,7 +113,7 @@ func validateChainReaderConfig(cfg types.ChainReaderConfig) error { func validateEvents(contractABI abi.ABI, chainReaderDefinition types.ChainReaderDefinition) error { event, methodExists := contractABI.Events[chainReaderDefinition.ChainSpecificName] if !methodExists { - return fmt.Errorf("method: %s doesn't exist", chainReaderDefinition.ChainSpecificName) + return fmt.Errorf("event: %s doesn't exist", chainReaderDefinition.ChainSpecificName) } if !areChainReaderArgumentsValid(event.Inputs, chainReaderDefinition.ReturnValues) { diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index b4d2b374ceb..0c1910317e3 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -17,6 +17,48 @@ import ( evmtypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) +type chainReaderTestHelper struct { +} + +func (crTestHelper chainReaderTestHelper) makeChainReaderConfig(abi string, params map[string]any, retValues []string) evmtypes.ChainReaderConfig { + return evmtypes.ChainReaderConfig{ + ChainContractReaders: map[string]evmtypes.ChainContractReader{ + "MyContract": { + ContractABI: abi, + ChainReaderDefinitions: map[string]evmtypes.ChainReaderDefinition{ + "MyGenericMethod": { + ChainSpecificName: "name", + Params: params, + ReturnValues: retValues, + CacheEnabled: false, + ReadType: evmtypes.Method, + }, + }, + }, + }, + } +} + +func (crTestHelper chainReaderTestHelper) makeChainReaderConfigFromStrings(abi string, chainReadingDefinitions string) (evmtypes.ChainReaderConfig, error) { + chainReaderConfigTemplate := `{ + "chainContractReaders": { + "testContract": { + "contractName": "testContract", + "contractABI": "[%s]", + "chainReaderDefinitions": { + %s + } + } + } + }` + + abi = strings.Replace(abi, `"`, `\"`, -1) + formattedCfgJsonString := fmt.Sprintf(chainReaderConfigTemplate, abi, chainReadingDefinitions) + var chainReaderConfig evmtypes.ChainReaderConfig + err := json.Unmarshal([]byte(formattedCfgJsonString), &chainReaderConfig) + return chainReaderConfig, err +} + func TestNewChainReader(t *testing.T) { lggr := logger.TestLogger(t) lp := mocklogpoller.NewLogPoller(t) @@ -24,34 +66,15 @@ func TestNewChainReader(t *testing.T) { contractID := testutils.NewAddress() contractABI := `[{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"result","type":"string"}],"stateMutability":"view","type":"function"}]` - makeChainReaderConfig := func(abi string, retValues []string) evmtypes.ChainReaderConfig { - return evmtypes.ChainReaderConfig{ - ChainContractReaders: map[string]evmtypes.ChainContractReader{ - "MyContract": { - ContractABI: abi, - ChainReaderDefinitions: map[string]evmtypes.ChainReaderDefinition{ - "MyGenericMethod": { - ChainSpecificName: "name", - Params: map[string]any{}, - ReturnValues: retValues, - CacheEnabled: false, - ReadType: evmtypes.Method, - }, - }, - }, - }, - } - } - t.Run("happy path", func(t *testing.T) { - chainReaderConfig := makeChainReaderConfig(contractABI, []string{"result"}) + chainReaderConfig := chainReaderTestHelper{}.makeChainReaderConfig(contractABI, map[string]any{}, []string{"result"}) chain.On("LogPoller").Return(lp) _, err := NewChainReaderService(lggr, chain.LogPoller(), contractID, chainReaderConfig) assert.NoError(t, err) }) t.Run("invalid config", func(t *testing.T) { - invalidChainReaderConfig := makeChainReaderConfig(contractABI, []string{"result", "extraResult"}) // 2 results required but abi includes only one + invalidChainReaderConfig := chainReaderTestHelper{}.makeChainReaderConfig(contractABI, map[string]any{}, []string{"result", "extraResult"}) // 2 results required but abi includes only one _, err := NewChainReaderService(lggr, chain.LogPoller(), contractID, invalidChainReaderConfig) assert.ErrorIs(t, err, commontypes.ErrInvalidConfig) assert.ErrorContains(t, err, "return values: [result,extraResult] don't match abi method outputs: [result]") @@ -78,22 +101,11 @@ func TestChainReaderStartClose(t *testing.T) { } func TestValidateChainReaderConfig(t *testing.T) { - chainReaderConfigTemplate := `{ - "chainContractReaders": { - "testContract": { - "contractName": "testContract", - "contractABI": "[%s]", - "chainReaderDefinitions": { - %s - } - } - } - }` - type testCase struct { name string abiInput string chainReadingDefinitions string + expected error } var testCases []testCase @@ -163,7 +175,7 @@ func TestValidateChainReaderConfig(t *testing.T) { testCases = append(testCases, testCase{ - name: "functionWithOneParamAndMultipleResponses", + name: "methodWithOneParamAndMultipleResponses", abiInput: `{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserAccountData","outputs":[{"internalType":"uint256","name":"totalLiquidityETH","type":"uint256"},{"internalType":"uint256","name":"totalCollateralETH","type":"uint256"},{"internalType":"uint256","name":"totalBorrowsETH","type":"uint256"},{"internalType":"uint256","name":"totalFeesETH","type":"uint256"},{"internalType":"uint256","name":"availableBorrowsETH","type":"uint256"},{"internalType":"uint256","name":"currentLiquidationThreshold","type":"uint256"},{"internalType":"uint256","name":"ltv","type":"uint256"},{"internalType":"uint256","name":"healthFactor","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}`, chainReadingDefinitions: `"getUserAccountData":{ "chainSpecificName": "getUserAccountData", @@ -185,7 +197,7 @@ func TestValidateChainReaderConfig(t *testing.T) { testCases = append(testCases, testCase{ - name: "functionWithNoParamsAndOneResponseWithNoName", + name: "methodWithNoParamsAndOneResponseWithNoName", abiInput: `{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}`, chainReadingDefinitions: `"name":{ "chainSpecificName": "name", @@ -198,7 +210,7 @@ func TestValidateChainReaderConfig(t *testing.T) { testCases = append(testCases, testCase{ - name: "functionWithMultipleParamsAndOneResult", + name: "methodWithMultipleParamsAndOneResult", abiInput: `{"inputs":[{"internalType":"address","name":"_input","type":"address"},{"internalType":"address","name":"_output","type":"address"},{"internalType":"uint256","name":"_inputQuantity","type":"uint256"}],"name":"getSwapOutput","outputs":[{"internalType":"uint256","name":"swapOutput","type":"uint256"}],"stateMutability":"view","type":"function"}`, chainReadingDefinitions: `"getSwapOutput":{ "chainSpecificName": "getSwapOutput", @@ -217,7 +229,7 @@ func TestValidateChainReaderConfig(t *testing.T) { // TODO BCF-2789 how to handle return values for tuples /*testCases = append(testCases, testCase{ - name: "functionWithOneParamAndMultipleTupleResponse", + name: "methodWithOneParamAndMultipleTupleResponse", struct BassetPersonal { // Address of the bAsset address addr; @@ -267,7 +279,7 @@ func TestValidateChainReaderConfig(t *testing.T) { /* testCases = append(testCases, testCase{ - name: "functionWithNoParamsAndTupleResponse", + name: "methodWithNoParamsAndTupleResponse", struct FeederConfig { uint256 supply; uint256 a; @@ -289,12 +301,10 @@ func TestValidateChainReaderConfig(t *testing.T) { }`, })*/ - var cfg evmtypes.ChainReaderConfig for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - abiString := strings.Replace(tc.abiInput, `"`, `\"`, -1) - formattedCfgJsonString := fmt.Sprintf(chainReaderConfigTemplate, abiString, tc.chainReadingDefinitions) - assert.NoError(t, json.Unmarshal([]byte(formattedCfgJsonString), &cfg)) + cfg, err := chainReaderTestHelper{}.makeChainReaderConfigFromStrings(tc.abiInput, tc.chainReadingDefinitions) + assert.NoError(t, err) assert.NoError(t, validateChainReaderConfig(cfg)) }) } @@ -309,8 +319,117 @@ func TestValidateChainReaderConfig(t *testing.T) { largeABI = largeABI[:len(largeABI)-1] manyChainReadingDefinitions = manyChainReadingDefinitions[:len(manyChainReadingDefinitions)-1] - formattedCfgJsonString := fmt.Sprintf(chainReaderConfigTemplate, strings.Replace(largeABI, `"`, `\"`, -1), manyChainReadingDefinitions) - assert.NoError(t, json.Unmarshal([]byte(formattedCfgJsonString), &cfg)) + cfg, err := chainReaderTestHelper{}.makeChainReaderConfigFromStrings(largeABI, manyChainReadingDefinitions) + assert.NoError(t, err) assert.NoError(t, validateChainReaderConfig(cfg)) }) + + var badPathTestCases []testCase + mismatchedEventArgumentsTestABI := `{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"Swap","type":"event"}` + badPathTestCases = append(badPathTestCases, + testCase{ + name: "mismatched abi and event chain reading param values", + abiInput: mismatchedEventArgumentsTestABI, + chainReadingDefinitions: `"Swap":{ + "chainSpecificName": "Swap", + "params":{ + "malformedParam": "0x0" + }, + "returnValues": [ + "sender" + ], + "readType": 1 + }`, + expected: fmt.Errorf("invalid configuration: invalid chain reader config for contract: \"testContract\" chain reading definition: \"Swap\", err: params: [malformedParam] don't match abi event indexed inputs: [sender]"), + }) + + badPathTestCases = append(badPathTestCases, + testCase{ + name: "mismatched abi and event chain reading return values", + abiInput: mismatchedEventArgumentsTestABI, + chainReadingDefinitions: `"Swap":{ + "chainSpecificName": "Swap", + "params":{ + "sender": "0x0" + }, + "returnValues": [ + "malformedParam" + ], + "readType": 1 + }`, + expected: fmt.Errorf("invalid configuration: invalid chain reader config for contract: \"testContract\" chain reading definition: \"Swap\", err: return values: [malformedParam] don't match abi event inputs: [sender]"), + }) + + mismatchedFunctionArgumentsTestABI := `{"constant":true,"inputs":[{"internalType":"address","name":"from","type":"address"}],"name":"Swap","outputs":[{"internalType":"address","name":"to","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}` + badPathTestCases = append(badPathTestCases, + testCase{ + name: "mismatched abi and method chain reading param values", + abiInput: mismatchedFunctionArgumentsTestABI, + chainReadingDefinitions: `"Swap":{ + "chainSpecificName": "Swap", + "params":{ + "malformedParam": "0x0" + }, + "returnValues": [ + "to" + ], + "readType": 0 + }`, + expected: fmt.Errorf("invalid configuration: invalid chain reader config for contract: \"testContract\" chain reading definition: \"Swap\", err: params: [malformedParam] don't match abi method inputs: [from]"), + }, + ) + + badPathTestCases = append(badPathTestCases, + testCase{ + name: "mismatched abi and method chain reading return values", + abiInput: mismatchedFunctionArgumentsTestABI, + chainReadingDefinitions: `"Swap":{ + "chainSpecificName": "Swap", + "params":{ + "from": "0x0" + }, + "returnValues": [ + "malformedReturnValue" + ], + "readType": 0 + }`, + expected: fmt.Errorf("invalid configuration: invalid chain reader config for contract: \"testContract\" chain reading definition: \"Swap\", err: return values: [malformedReturnValue] don't match abi method outputs: [to]"), + }, + ) + + badPathTestCases = append(badPathTestCases, + testCase{ + name: "event doesn't exist", + abiInput: `{"constant":true,"inputs":[],"name":"someName","outputs":[],"payable":false,"stateMutability":"view","type":"function"}`, + chainReadingDefinitions: `"TestMethod":{ + "chainSpecificName": "Swap", + "readType": 1 + }`, + expected: fmt.Errorf("invalid configuration: invalid chain reader config for contract: \"testContract\" chain reading definition: \"TestMethod\", err: event: Swap doesn't exist"), + }, + ) + + badPathTestCases = append(badPathTestCases, + testCase{ + name: "method doesn't exist", + abiInput: `{"constant":true,"inputs":[],"name":"someName","outputs":[],"payable":false,"stateMutability":"view","type":"function"}`, + chainReadingDefinitions: `"TestMethod":{ + "chainSpecificName": "Swap", + "readType": 0 + }`, + expected: fmt.Errorf("invalid configuration: invalid chain reader config for contract: \"testContract\" chain reading definition: \"TestMethod\", err: method: \"Swap\" doesn't exist"), + }, + ) + + for _, tc := range badPathTestCases { + t.Run(tc.name, func(t *testing.T) { + cfg, err := chainReaderTestHelper{}.makeChainReaderConfigFromStrings(tc.abiInput, tc.chainReadingDefinitions) + assert.NoError(t, err) + if tc.expected == nil { + assert.NoError(t, validateChainReaderConfig(cfg)) + } else { + assert.EqualError(t, validateChainReaderConfig(cfg), tc.expected.Error()) + } + }) + } } diff --git a/go.mod b/go.mod index 79a09df43ea..a9ca874a193 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123051431-7628438e5b18 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20231107151413-13e0202ae8d7 diff --git a/go.sum b/go.sum index 853ed9da66d..4d958ffc298 100644 --- a/go.sum +++ b/go.sum @@ -1476,6 +1476,8 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0a github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af/go.mod h1:jOBq6ZSI0bkVS721oiAZ2t3IzOszk2B81PfWAeNeL40= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123051431-7628438e5b18 h1:jEtpdWZj04EOBiMGWvFCpRDlBrvOIgA8aQ4uvateA6k= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123051431-7628438e5b18/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8 h1:2OARlTQm7FohrLmwlhH3AeVKNQpVK4z9600n9JPSRME= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= From 833dbe758ed802c15fc2240f5d70d9e65fbd2b62 Mon Sep 17 00:00:00 2001 From: ilija Date: Thu, 23 Nov 2023 20:47:28 +0100 Subject: [PATCH 013/112] Run go mod tidy --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.sum | 4 ---- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 46eacbee5be..305e1815eb2 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -306,7 +306,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 230d62a4d14..8ee5ab87cc5 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1471,8 +1471,8 @@ github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af h1:lwrfntkyF0onNy2QVdphvtutQsqj5E5izh63t7XZbFc= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af/go.mod h1:jOBq6ZSI0bkVS721oiAZ2t3IzOszk2B81PfWAeNeL40= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8 h1:2OARlTQm7FohrLmwlhH3AeVKNQpVK4z9600n9JPSRME= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/go.sum b/go.sum index 4d958ffc298..c398bc3bd0b 100644 --- a/go.sum +++ b/go.sum @@ -1472,10 +1472,6 @@ github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af h1:lwrfntkyF0onNy2QVdphvtutQsqj5E5izh63t7XZbFc= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af/go.mod h1:jOBq6ZSI0bkVS721oiAZ2t3IzOszk2B81PfWAeNeL40= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123051431-7628438e5b18 h1:jEtpdWZj04EOBiMGWvFCpRDlBrvOIgA8aQ4uvateA6k= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123051431-7628438e5b18/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8 h1:2OARlTQm7FohrLmwlhH3AeVKNQpVK4z9600n9JPSRME= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 077de72631a..97e8a7c3e23 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -391,7 +391,7 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index bceebfa735c..421ebc0fa6c 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2379,8 +2379,8 @@ github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af h1:lwrfntkyF0onNy2QVdphvtutQsqj5E5izh63t7XZbFc= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231120073604-89592fceb0af/go.mod h1:jOBq6ZSI0bkVS721oiAZ2t3IzOszk2B81PfWAeNeL40= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8 h1:2OARlTQm7FohrLmwlhH3AeVKNQpVK4z9600n9JPSRME= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= github.com/smartcontractkit/chainlink-testing-framework v1.19.5 h1:Iq1L7wCA8IkBBtP3p6W2ttu8v9cJp95spusnozW1UrA= From 330696e688a1be321eaae3190c75ad818b59459c Mon Sep 17 00:00:00 2001 From: ilija Date: Thu, 23 Nov 2023 21:16:13 +0100 Subject: [PATCH 014/112] Update solana repo go mod reference and tidy --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 305e1815eb2..08404d545fa 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -306,7 +306,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 8ee5ab87cc5..effbdc09e71 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1471,8 +1471,8 @@ github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8 h1:2OARlTQm7FohrLmwlhH3AeVKNQpVK4z9600n9JPSRME= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed h1:8TJZ0TCsIrg+XQfR8wsgN1qy+KISdIjfQOxi6oCtO7o= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/go.mod b/go.mod index a9ca874a193..67a9a458611 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20231107151413-13e0202ae8d7 diff --git a/go.sum b/go.sum index c398bc3bd0b..cb4d9ae727b 100644 --- a/go.sum +++ b/go.sum @@ -1472,8 +1472,8 @@ github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8 h1:2OARlTQm7FohrLmwlhH3AeVKNQpVK4z9600n9JPSRME= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed h1:8TJZ0TCsIrg+XQfR8wsgN1qy+KISdIjfQOxi6oCtO7o= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 97e8a7c3e23..078f16921b9 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -391,7 +391,7 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 421ebc0fa6c..bed2e4b0a48 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2379,8 +2379,8 @@ github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8 h1:2OARlTQm7FohrLmwlhH3AeVKNQpVK4z9600n9JPSRME= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123152908-322b3326d2a8/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed h1:8TJZ0TCsIrg+XQfR8wsgN1qy+KISdIjfQOxi6oCtO7o= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= github.com/smartcontractkit/chainlink-testing-framework v1.19.5 h1:Iq1L7wCA8IkBBtP3p6W2ttu8v9cJp95spusnozW1UrA= From 0529d9c6eda64f49b54bea1a505a0ae9f2123e77 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Fri, 24 Nov 2023 14:33:51 +0100 Subject: [PATCH 015/112] fix logs dir for Solana tests --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 9550be83ced..7ec2d3e9fe3 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -848,7 +848,7 @@ jobs: test_command_to_run: export ENV_JOB_IMAGE=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-solana-tests:${{ needs.get_solana_sha.outputs.sha }} && make test_smoke cl_repo: ${{ env.CHAINLINK_IMAGE }} cl_image_tag: ${{ github.sha }}${{ matrix.image.tag-suffix }} - artifacts_location: /home/runner/work/chainlink-solana/chainlink-solana/integration-tests/logs + artifacts_location: /home/runner/work/chainlink/chainlink/integration-tests/logs publish_check_name: Solana Smoke Test Results go_mod_path: ./integration-tests/go.mod cache_key_id: core-solana-e2e-${{ env.MOD_CACHE_VERSION }} From 30f82734758d863fbdbc11f75932030ce3730307 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Fri, 24 Nov 2023 15:40:30 +0100 Subject: [PATCH 016/112] fix solana logs path once more --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 7ec2d3e9fe3..57aa132a4fb 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -848,7 +848,7 @@ jobs: test_command_to_run: export ENV_JOB_IMAGE=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-solana-tests:${{ needs.get_solana_sha.outputs.sha }} && make test_smoke cl_repo: ${{ env.CHAINLINK_IMAGE }} cl_image_tag: ${{ github.sha }}${{ matrix.image.tag-suffix }} - artifacts_location: /home/runner/work/chainlink/chainlink/integration-tests/logs + artifacts_location: /home/runner/work/chainlink/chainlink/logs publish_check_name: Solana Smoke Test Results go_mod_path: ./integration-tests/go.mod cache_key_id: core-solana-e2e-${{ env.MOD_CACHE_VERSION }} From fffe74e279ed939a9c64437f97694adb7091a7cf Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Fri, 24 Nov 2023 15:58:58 +0100 Subject: [PATCH 017/112] print absolue log folder location --- integration-tests/docker/test_env/test_env.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/integration-tests/docker/test_env/test_env.go b/integration-tests/docker/test_env/test_env.go index 6278ec13987..b3073965ccb 100644 --- a/integration-tests/docker/test_env/test_env.go +++ b/integration-tests/docker/test_env/test_env.go @@ -283,7 +283,12 @@ func (te *CLClusterTestEnv) collectTestLogs() error { return err } - te.l.Info().Str("Logs Location", folder).Msg("Wrote test logs") + absolutePath, err := filepath.Abs(folder) + if err != nil { + return err + } + + te.l.Info().Str("Logs Location", absolutePath).Msg("Wrote test logs") return nil } From b6a7f18bcf5ea4a50ee58b0c7e53de1d456ac24a Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Fri, 24 Nov 2023 16:18:10 +0100 Subject: [PATCH 018/112] get abs folder in a correct way --- integration-tests/docker/test_env/test_env.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/integration-tests/docker/test_env/test_env.go b/integration-tests/docker/test_env/test_env.go index b3073965ccb..1aa81e66267 100644 --- a/integration-tests/docker/test_env/test_env.go +++ b/integration-tests/docker/test_env/test_env.go @@ -283,12 +283,14 @@ func (te *CLClusterTestEnv) collectTestLogs() error { return err } - absolutePath, err := filepath.Abs(folder) + // Getting the absolute path + wd, err := os.Getwd() if err != nil { return err } + absolutePath := filepath.Join(wd, folder) - te.l.Info().Str("Logs Location", absolutePath).Msg("Wrote test logs") + te.l.Info().Str("Logs absolute Location", absolutePath).Msg("Wrote test logs") return nil } From de206db380b4271b61534051b979da2424306960 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Fri, 24 Nov 2023 16:44:21 +0100 Subject: [PATCH 019/112] do it some other way --- integration-tests/docker/test_env/test_env.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/integration-tests/docker/test_env/test_env.go b/integration-tests/docker/test_env/test_env.go index 1aa81e66267..8ac2b3d0dbb 100644 --- a/integration-tests/docker/test_env/test_env.go +++ b/integration-tests/docker/test_env/test_env.go @@ -204,6 +204,15 @@ func (te *CLClusterTestEnv) Cleanup() error { te.logWhetherAllContainersAreRunning() + // Getting the absolute path + wd, err := os.Getwd() + if err != nil { + return err + } + + wd = filepath.Join(wd, "logs") + te.l.Info().Str("Working dir", wd).Msg("Would write test logs here") + // TODO: This is an imperfect and temporary solution, see TT-590 for a more sustainable solution // Collect logs if the test fails, or if we just want them if te.t.Failed() || os.Getenv("TEST_LOG_COLLECT") == "true" { From 5e78c45795d812a176da7d9a9bc97574565f09ea Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Fri, 24 Nov 2023 16:57:44 +0100 Subject: [PATCH 020/112] update solana logs dir in github workflow --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 57aa132a4fb..3a5d5527a2a 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -848,7 +848,7 @@ jobs: test_command_to_run: export ENV_JOB_IMAGE=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-solana-tests:${{ needs.get_solana_sha.outputs.sha }} && make test_smoke cl_repo: ${{ env.CHAINLINK_IMAGE }} cl_image_tag: ${{ github.sha }}${{ matrix.image.tag-suffix }} - artifacts_location: /home/runner/work/chainlink/chainlink/logs + artifacts_location: /home/runner/work/chainlink/chainlink/integration-tests/smoke/logs publish_check_name: Solana Smoke Test Results go_mod_path: ./integration-tests/go.mod cache_key_id: core-solana-e2e-${{ env.MOD_CACHE_VERSION }} From 742ef7191180acffee98384b0faffd3c8c714f04 Mon Sep 17 00:00:00 2001 From: ilija Date: Fri, 24 Nov 2023 19:11:33 +0100 Subject: [PATCH 021/112] Add chain Reader enabled log to NewMedianServices --- core/services/ocr2/plugins/median/services.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/services/ocr2/plugins/median/services.go b/core/services/ocr2/plugins/median/services.go index 04a9d0f8535..82214934e22 100644 --- a/core/services/ocr2/plugins/median/services.go +++ b/core/services/ocr2/plugins/median/services.go @@ -131,6 +131,7 @@ func NewMedianServices(ctx context.Context, }, lggr) if medianProvider.ChainReader() != nil { + lggr.Info("Chain Reader enabled") medianProvider = medianProviderWrapper{ medianProvider, // attach newer MedianContract which uses ChainReader newMedianContract(provider.ChainReader(), common.HexToAddress(spec.ContractID)), From 61f5c9f3081954d70f39972147f348c2a2fd2ed6 Mon Sep 17 00:00:00 2001 From: ilija Date: Fri, 24 Nov 2023 19:20:23 +0100 Subject: [PATCH 022/112] Update chainlink-solana ref and tidy --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 08404d545fa..d509c9cefe5 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -306,7 +306,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index effbdc09e71..c17b8bd27cc 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1471,8 +1471,8 @@ github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed h1:8TJZ0TCsIrg+XQfR8wsgN1qy+KISdIjfQOxi6oCtO7o= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1 h1:bLr1EVx1pe9o70joA+eIzV143XuSwuWJfNuXhLxgW1c= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/go.mod b/go.mod index 67a9a458611..6199b6f51e7 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20231107151413-13e0202ae8d7 diff --git a/go.sum b/go.sum index cb4d9ae727b..8c08499b936 100644 --- a/go.sum +++ b/go.sum @@ -1472,8 +1472,8 @@ github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed h1:8TJZ0TCsIrg+XQfR8wsgN1qy+KISdIjfQOxi6oCtO7o= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1 h1:bLr1EVx1pe9o70joA+eIzV143XuSwuWJfNuXhLxgW1c= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 078f16921b9..07423f31690 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -391,7 +391,7 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index bed2e4b0a48..3448bc213c2 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2379,8 +2379,8 @@ github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed h1:8TJZ0TCsIrg+XQfR8wsgN1qy+KISdIjfQOxi6oCtO7o= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231123201501-a0dfbc59a9ed/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1 h1:bLr1EVx1pe9o70joA+eIzV143XuSwuWJfNuXhLxgW1c= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= github.com/smartcontractkit/chainlink-testing-framework v1.19.5 h1:Iq1L7wCA8IkBBtP3p6W2ttu8v9cJp95spusnozW1UrA= From 4e70656d7bba978b554961fb316544eb5983a891 Mon Sep 17 00:00:00 2001 From: ilija Date: Sun, 26 Nov 2023 12:44:01 +0100 Subject: [PATCH 023/112] Add logs and handle disabled chain reader when median loop is enabled --- core/services/ocr2/plugins/median/services.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/services/ocr2/plugins/median/services.go b/core/services/ocr2/plugins/median/services.go index 82214934e22..bb12846059d 100644 --- a/core/services/ocr2/plugins/median/services.go +++ b/core/services/ocr2/plugins/median/services.go @@ -130,19 +130,24 @@ func NewMedianServices(ctx context.Context, CreatedAt: time.Now(), }, lggr) - if medianProvider.ChainReader() != nil { + medianPluginCmd := env.MedianPluginCmd.Get() + medianLoopEnabled := medianPluginCmd != "" + + // TODO BCF-2821 handle this properly as this blocks Solana dev + if !medianLoopEnabled && medianProvider.ChainReader() != nil { lggr.Info("Chain Reader enabled") medianProvider = medianProviderWrapper{ medianProvider, // attach newer MedianContract which uses ChainReader newMedianContract(provider.ChainReader(), common.HexToAddress(spec.ContractID)), } + } else { + lggr.Info("Chain Reader disabled") } - if cmdName := env.MedianPluginCmd.Get(); cmdName != "" { - + if medianLoopEnabled { // use unique logger names so we can use it to register a loop medianLggr := lggr.Named("Median").Named(spec.ContractID).Named(spec.GetID()) - cmdFn, telem, err2 := cfg.RegisterLOOP(medianLggr.Name(), cmdName) + cmdFn, telem, err2 := cfg.RegisterLOOP(medianLggr.Name(), medianPluginCmd) if err2 != nil { err = fmt.Errorf("failed to register loop: %w", err2) abort() From 2597944aeac85e818d7fe5df85305edad493f8f9 Mon Sep 17 00:00:00 2001 From: ilija Date: Sun, 26 Nov 2023 12:54:23 +0100 Subject: [PATCH 024/112] Update go mod solana repo refs --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index d509c9cefe5..25c792d4e3d 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -306,7 +306,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index c17b8bd27cc..cf278800f6d 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1471,8 +1471,8 @@ github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1 h1:bLr1EVx1pe9o70joA+eIzV143XuSwuWJfNuXhLxgW1c= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90 h1:tcnV7rhW0wC/oukNE/wPRQzC1K86YERbVaWF5KYda7g= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/go.mod b/go.mod index 6199b6f51e7..c1f7d4aa28a 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20231107151413-13e0202ae8d7 diff --git a/go.sum b/go.sum index 8c08499b936..8e68b54f53e 100644 --- a/go.sum +++ b/go.sum @@ -1472,8 +1472,8 @@ github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1 h1:bLr1EVx1pe9o70joA+eIzV143XuSwuWJfNuXhLxgW1c= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90 h1:tcnV7rhW0wC/oukNE/wPRQzC1K86YERbVaWF5KYda7g= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 07423f31690..cbc09dea20c 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -391,7 +391,7 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 3448bc213c2..ee9667496fc 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2379,8 +2379,8 @@ github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1 h1:bLr1EVx1pe9o70joA+eIzV143XuSwuWJfNuXhLxgW1c= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231124181840-dbf514e39fb1/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90 h1:tcnV7rhW0wC/oukNE/wPRQzC1K86YERbVaWF5KYda7g= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= github.com/smartcontractkit/chainlink-testing-framework v1.19.5 h1:Iq1L7wCA8IkBBtP3p6W2ttu8v9cJp95spusnozW1UrA= From 1a739b66e63f2154555b811428ffa5438ba6ee0c Mon Sep 17 00:00:00 2001 From: ilija Date: Sun, 26 Nov 2023 14:01:37 +0100 Subject: [PATCH 025/112] Improve error messages in evm chain reader and add test cases --- core/services/relay/evm/chain_reader.go | 10 ++-- core/services/relay/evm/chain_reader_test.go | 62 ++++++++++++++------ 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index 3d8260c385b..075947cf7d8 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -32,7 +32,7 @@ type chainReader struct { // NewChainReaderService constructor for ChainReader func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, contractID common.Address, config types.ChainReaderConfig) (*chainReader, error) { if err := validateChainReaderConfig(config); err != nil { - return nil, err + return nil, fmt.Errorf("%w err: %w", commontypes.ErrInvalidConfig, err) } // TODO BCF-2814 implement initialisation of chain reading definitions and pass them into chainReader @@ -83,13 +83,13 @@ func (cr *chainReader) GetMaxDecodingSize(ctx context.Context, n int, itemType s func validateChainReaderConfig(cfg types.ChainReaderConfig) error { if len(cfg.ChainContractReaders) == 0 { - return fmt.Errorf("chain reader config is empty") + return fmt.Errorf("config is empty") } for contractName, chainContractReader := range cfg.ChainContractReaders { abi, err := abi.JSON(strings.NewReader(chainContractReader.ContractABI)) if err != nil { - return err + return fmt.Errorf("invalid abi: %w", err) } for chainReadingDefinitionName, chainReaderDefinition := range chainContractReader.ChainReaderDefinitions { @@ -99,10 +99,10 @@ func validateChainReaderConfig(cfg types.ChainReaderConfig) error { case types.Event: err = validateEvents(abi, chainReaderDefinition) default: - return fmt.Errorf("%w: invalid chain reader definition read type: %d", commontypes.ErrInvalidConfig, chainReaderDefinition.ReadType) + return fmt.Errorf("invalid chain reading definition read type: %d for contract: %q", chainReaderDefinition.ReadType, contractName) } if err != nil { - return fmt.Errorf("%w: invalid chain reader config for contract: %q chain reading definition: %q, err: %w", commontypes.ErrInvalidConfig, contractName, chainReadingDefinitionName, err) + return fmt.Errorf("invalid chain reading definition: %q for contract: %q, err: %w", chainReadingDefinitionName, contractName, err) } } } diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 0c1910317e3..b8dd53d6dfe 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -83,7 +83,8 @@ func TestNewChainReader(t *testing.T) { t.Run("ChainReader config is empty", func(t *testing.T) { emptyChainReaderConfig := evmtypes.ChainReaderConfig{} _, err := NewChainReaderService(lggr, chain.LogPoller(), contractID, emptyChainReaderConfig) - assert.EqualError(t, err, "chain reader config is empty") + assert.ErrorIs(t, err, commontypes.ErrInvalidConfig) + assert.ErrorContains(t, err, "config is empty") }) } @@ -100,12 +101,11 @@ func TestChainReaderStartClose(t *testing.T) { assert.NoError(t, err) } -func TestValidateChainReaderConfig(t *testing.T) { +func TestValidateChainReaderConfig_HappyPath(t *testing.T) { type testCase struct { name string abiInput string chainReadingDefinitions string - expected error } var testCases []testCase @@ -323,10 +323,19 @@ func TestValidateChainReaderConfig(t *testing.T) { assert.NoError(t, err) assert.NoError(t, validateChainReaderConfig(cfg)) }) +} + +func TestValidateChainReaderConfig_BadPath(t *testing.T) { + type testCase struct { + name string + abiInput string + chainReadingDefinitions string + expected error + } - var badPathTestCases []testCase + var testCases []testCase mismatchedEventArgumentsTestABI := `{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"Swap","type":"event"}` - badPathTestCases = append(badPathTestCases, + testCases = append(testCases, testCase{ name: "mismatched abi and event chain reading param values", abiInput: mismatchedEventArgumentsTestABI, @@ -340,10 +349,10 @@ func TestValidateChainReaderConfig(t *testing.T) { ], "readType": 1 }`, - expected: fmt.Errorf("invalid configuration: invalid chain reader config for contract: \"testContract\" chain reading definition: \"Swap\", err: params: [malformedParam] don't match abi event indexed inputs: [sender]"), + expected: fmt.Errorf("invalid chain reading definition: \"Swap\" for contract: \"testContract\", err: params: [malformedParam] don't match abi event indexed inputs: [sender]"), }) - badPathTestCases = append(badPathTestCases, + testCases = append(testCases, testCase{ name: "mismatched abi and event chain reading return values", abiInput: mismatchedEventArgumentsTestABI, @@ -357,11 +366,11 @@ func TestValidateChainReaderConfig(t *testing.T) { ], "readType": 1 }`, - expected: fmt.Errorf("invalid configuration: invalid chain reader config for contract: \"testContract\" chain reading definition: \"Swap\", err: return values: [malformedParam] don't match abi event inputs: [sender]"), + expected: fmt.Errorf("invalid chain reading definition: \"Swap\" for contract: \"testContract\", err: return values: [malformedParam] don't match abi event inputs: [sender]"), }) mismatchedFunctionArgumentsTestABI := `{"constant":true,"inputs":[{"internalType":"address","name":"from","type":"address"}],"name":"Swap","outputs":[{"internalType":"address","name":"to","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}` - badPathTestCases = append(badPathTestCases, + testCases = append(testCases, testCase{ name: "mismatched abi and method chain reading param values", abiInput: mismatchedFunctionArgumentsTestABI, @@ -375,11 +384,11 @@ func TestValidateChainReaderConfig(t *testing.T) { ], "readType": 0 }`, - expected: fmt.Errorf("invalid configuration: invalid chain reader config for contract: \"testContract\" chain reading definition: \"Swap\", err: params: [malformedParam] don't match abi method inputs: [from]"), + expected: fmt.Errorf("invalid chain reading definition: \"Swap\" for contract: \"testContract\", err: params: [malformedParam] don't match abi method inputs: [from]"), }, ) - badPathTestCases = append(badPathTestCases, + testCases = append(testCases, testCase{ name: "mismatched abi and method chain reading return values", abiInput: mismatchedFunctionArgumentsTestABI, @@ -393,11 +402,11 @@ func TestValidateChainReaderConfig(t *testing.T) { ], "readType": 0 }`, - expected: fmt.Errorf("invalid configuration: invalid chain reader config for contract: \"testContract\" chain reading definition: \"Swap\", err: return values: [malformedReturnValue] don't match abi method outputs: [to]"), + expected: fmt.Errorf("invalid chain reading definition: \"Swap\" for contract: \"testContract\", err: return values: [malformedReturnValue] don't match abi method outputs: [to]"), }, ) - badPathTestCases = append(badPathTestCases, + testCases = append(testCases, testCase{ name: "event doesn't exist", abiInput: `{"constant":true,"inputs":[],"name":"someName","outputs":[],"payable":false,"stateMutability":"view","type":"function"}`, @@ -405,11 +414,11 @@ func TestValidateChainReaderConfig(t *testing.T) { "chainSpecificName": "Swap", "readType": 1 }`, - expected: fmt.Errorf("invalid configuration: invalid chain reader config for contract: \"testContract\" chain reading definition: \"TestMethod\", err: event: Swap doesn't exist"), + expected: fmt.Errorf("invalid chain reading definition: \"TestMethod\" for contract: \"testContract\", err: event: Swap doesn't exist"), }, ) - badPathTestCases = append(badPathTestCases, + testCases = append(testCases, testCase{ name: "method doesn't exist", abiInput: `{"constant":true,"inputs":[],"name":"someName","outputs":[],"payable":false,"stateMutability":"view","type":"function"}`, @@ -417,18 +426,35 @@ func TestValidateChainReaderConfig(t *testing.T) { "chainSpecificName": "Swap", "readType": 0 }`, - expected: fmt.Errorf("invalid configuration: invalid chain reader config for contract: \"testContract\" chain reading definition: \"TestMethod\", err: method: \"Swap\" doesn't exist"), + expected: fmt.Errorf("invalid chain reading definition: \"TestMethod\" for contract: \"testContract\", err: method: \"Swap\" doesn't exist"), }, ) - for _, tc := range badPathTestCases { + testCases = append(testCases, testCase{ + name: "invalid abi", + abiInput: `broken abi`, + chainReadingDefinitions: `"TestMethod":{ + "chainSpecificName": "Swap", + "readType": 0 + }`, + expected: fmt.Errorf("invalid abi"), + }) + + testCases = append(testCases, testCase{ + name: "invalid read type", + abiInput: `{"constant":true,"inputs":[],"name":"someName","outputs":[],"payable":false,"stateMutability":"view","type":"function"}`, + chainReadingDefinitions: `"TestMethod":{"readType": 59}`, + expected: fmt.Errorf("invalid chain reading definition read type: 59"), + }) + + for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { cfg, err := chainReaderTestHelper{}.makeChainReaderConfigFromStrings(tc.abiInput, tc.chainReadingDefinitions) assert.NoError(t, err) if tc.expected == nil { assert.NoError(t, validateChainReaderConfig(cfg)) } else { - assert.EqualError(t, validateChainReaderConfig(cfg), tc.expected.Error()) + assert.ErrorContains(t, validateChainReaderConfig(cfg), tc.expected.Error()) } }) } From 23b5b41c8917eecd580f6c2010f8cdf998a30265 Mon Sep 17 00:00:00 2001 From: ilija42 <57732589+ilija42@users.noreply.github.com> Date: Mon, 27 Nov 2023 15:31:30 +0100 Subject: [PATCH 026/112] Update minor comment --- core/services/ocr2/plugins/median/services.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/services/ocr2/plugins/median/services.go b/core/services/ocr2/plugins/median/services.go index bb12846059d..10a2ad22a8a 100644 --- a/core/services/ocr2/plugins/median/services.go +++ b/core/services/ocr2/plugins/median/services.go @@ -133,7 +133,7 @@ func NewMedianServices(ctx context.Context, medianPluginCmd := env.MedianPluginCmd.Get() medianLoopEnabled := medianPluginCmd != "" - // TODO BCF-2821 handle this properly as this blocks Solana dev + // TODO BCF-2821 handle this properly as this blocks Solana chain reader dev if !medianLoopEnabled && medianProvider.ChainReader() != nil { lggr.Info("Chain Reader enabled") medianProvider = medianProviderWrapper{ From cc46b0a3155fc6ec0f791de19828f74770a26ed1 Mon Sep 17 00:00:00 2001 From: ilija Date: Mon, 27 Nov 2023 15:51:06 +0100 Subject: [PATCH 027/112] Run tidy --- integration-tests/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 0b94c6baee7..56f87166f8e 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -11,7 +11,7 @@ require ( github.com/cli/go-gh/v2 v2.0.0 github.com/ethereum/go-ethereum v1.12.0 github.com/go-resty/resty/v2 v2.7.0 - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.3.1 github.com/jmoiron/sqlx v1.3.5 github.com/kelseyhightower/envconfig v1.4.0 From d3153b1ee79773899a5a21118464ead7ec1bd2c3 Mon Sep 17 00:00:00 2001 From: ilija Date: Mon, 27 Nov 2023 16:13:18 +0100 Subject: [PATCH 028/112] Remove unneeded chain reader codec methods --- core/services/relay/evm/chain_reader.go | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index 075947cf7d8..723d1d7491e 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -8,7 +8,6 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" - ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" @@ -65,22 +64,6 @@ func (cr *chainReader) GetLatestValue(ctx context.Context, bc commontypes.BoundC return fmt.Errorf("Unimplemented method GetLatestValue called %w", errors.ErrUnsupported) } -func (cr *chainReader) Encode(ctx context.Context, item any, itemType string) (ocrtypes.Report, error) { - return nil, fmt.Errorf("Unimplemented method Encode called %w", errors.ErrUnsupported) -} - -func (cr *chainReader) Decode(_ context.Context, raw []byte, into any, itemType string) error { - return fmt.Errorf("Unimplemented method Decode called %w", errors.ErrUnsupported) -} - -func (cr *chainReader) GetMaxEncodingSize(ctx context.Context, n int, itemType string) (int, error) { - return 0, fmt.Errorf("Unimplemented method GetMaxDecodingSize called %w", errors.ErrUnsupported) -} - -func (cr *chainReader) GetMaxDecodingSize(ctx context.Context, n int, itemType string) (int, error) { - return 0, fmt.Errorf("Unimplemented method GetMaxDecodingSize called %w", errors.ErrUnsupported) -} - func validateChainReaderConfig(cfg types.ChainReaderConfig) error { if len(cfg.ChainContractReaders) == 0 { return fmt.Errorf("config is empty") From 372f0e3bb7e130ac6621736c18424bbd1682beae Mon Sep 17 00:00:00 2001 From: ilija Date: Mon, 27 Nov 2023 16:42:15 +0100 Subject: [PATCH 029/112] Remove chain reader return values as they are out of scope for this PR --- core/services/relay/evm/chain_reader.go | 21 +- core/services/relay/evm/chain_reader_test.go | 219 ++----------------- 2 files changed, 18 insertions(+), 222 deletions(-) diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index 723d1d7491e..ce93da70ec9 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -99,14 +99,6 @@ func validateEvents(contractABI abi.ABI, chainReaderDefinition types.ChainReader return fmt.Errorf("event: %s doesn't exist", chainReaderDefinition.ChainSpecificName) } - if !areChainReaderArgumentsValid(event.Inputs, chainReaderDefinition.ReturnValues) { - var abiEventInputsNames []string - for _, input := range event.Inputs { - abiEventInputsNames = append(abiEventInputsNames, input.Name) - } - return fmt.Errorf("return values: [%s] don't match abi event inputs: [%s]", strings.Join(chainReaderDefinition.ReturnValues, ","), strings.Join(abiEventInputsNames, ",")) - } - var abiEventIndexedInputs []abi.Argument for _, eventInput := range event.Inputs { if eventInput.Indexed { @@ -148,21 +140,13 @@ func validateMethods(abi abi.ABI, chainReaderDefinition types.ChainReaderDefinit return fmt.Errorf("params: [%s] don't match abi method inputs: [%s]", strings.Join(methodNames, ","), strings.Join(abiMethodInputs, ",")) } - if !areChainReaderArgumentsValid(method.Outputs, chainReaderDefinition.ReturnValues) { - var abiMethodOutputs []string - for _, input := range method.Outputs { - abiMethodOutputs = append(abiMethodOutputs, input.Name) - } - return fmt.Errorf("return values: [%s] don't match abi method outputs: [%s]", strings.Join(chainReaderDefinition.ReturnValues, ","), strings.Join(abiMethodOutputs, ",")) - } - return nil } func areChainReaderArgumentsValid(contractArgs []abi.Argument, chainReaderArgs []string) bool { - for _, chArgName := range chainReaderArgs { + for _, contractArg := range contractArgs { found := false - for _, contractArg := range contractArgs { + for _, chArgName := range chainReaderArgs { if chArgName == contractArg.Name { found = true break @@ -172,5 +156,6 @@ func areChainReaderArgumentsValid(contractArgs []abi.Argument, chainReaderArgs [ return false } } + return true } diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index b8dd53d6dfe..d2eb5d30cd7 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -20,7 +20,7 @@ import ( type chainReaderTestHelper struct { } -func (crTestHelper chainReaderTestHelper) makeChainReaderConfig(abi string, params map[string]any, retValues []string) evmtypes.ChainReaderConfig { +func (crTestHelper chainReaderTestHelper) makeChainReaderConfig(abi string, params map[string]any) evmtypes.ChainReaderConfig { return evmtypes.ChainReaderConfig{ ChainContractReaders: map[string]evmtypes.ChainContractReader{ "MyContract": { @@ -29,7 +29,6 @@ func (crTestHelper chainReaderTestHelper) makeChainReaderConfig(abi string, para "MyGenericMethod": { ChainSpecificName: "name", Params: params, - ReturnValues: retValues, CacheEnabled: false, ReadType: evmtypes.Method, }, @@ -64,20 +63,21 @@ func TestNewChainReader(t *testing.T) { lp := mocklogpoller.NewLogPoller(t) chain := mocks.NewChain(t) contractID := testutils.NewAddress() - contractABI := `[{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"result","type":"string"}],"stateMutability":"view","type":"function"}]` + contractABI := `[{"inputs":[{"internalType":"string","name":"param","type":"string"}],"name":"name","stateMutability":"view","type":"function"}]` t.Run("happy path", func(t *testing.T) { - chainReaderConfig := chainReaderTestHelper{}.makeChainReaderConfig(contractABI, map[string]any{}, []string{"result"}) + params := make(map[string]any) + params["param"] = "" + chainReaderConfig := chainReaderTestHelper{}.makeChainReaderConfig(contractABI, params) chain.On("LogPoller").Return(lp) _, err := NewChainReaderService(lggr, chain.LogPoller(), contractID, chainReaderConfig) assert.NoError(t, err) }) t.Run("invalid config", func(t *testing.T) { - invalidChainReaderConfig := chainReaderTestHelper{}.makeChainReaderConfig(contractABI, map[string]any{}, []string{"result", "extraResult"}) // 2 results required but abi includes only one + invalidChainReaderConfig := chainReaderTestHelper{}.makeChainReaderConfig(contractABI, map[string]any{}) // missing param _, err := NewChainReaderService(lggr, chain.LogPoller(), contractID, invalidChainReaderConfig) assert.ErrorIs(t, err, commontypes.ErrInvalidConfig) - assert.ErrorContains(t, err, "return values: [result,extraResult] don't match abi method outputs: [result]") }) t.Run("ChainReader config is empty", func(t *testing.T) { @@ -101,6 +101,7 @@ func TestChainReaderStartClose(t *testing.T) { assert.NoError(t, err) } +// TODO Chain Reading Definitions return values are WIP, waiting on codec work and BCF-2789 func TestValidateChainReaderConfig_HappyPath(t *testing.T) { type testCase struct { name string @@ -109,66 +110,16 @@ func TestValidateChainReaderConfig_HappyPath(t *testing.T) { } var testCases []testCase - testCases = append(testCases, testCase{ - name: "median abi", - abiInput: `{"inputs":[{"internalType":"uint32","name":"_maximumGasPrice","type":"uint32"},{"internalType":"uint32","name":"_reasonableGasPrice","type":"uint32"},{"internalType":"uint32","name":"_microLinkPerEth","type":"uint32"},{"internalType":"uint32","name":"_linkGweiPerObservation","type":"uint32"},{"internalType":"uint32","name":"_linkGweiPerTransmission","type":"uint32"},{"internalType":"address","name":"_link","type":"address"},{"internalType":"address","name":"_validator","type":"address"},{"internalType":"int192","name":"_minAnswer","type":"int192"},{"internalType":"int192","name":"_maxAnswer","type":"int192"},{"internalType":"contractAccessControllerInterface","name":"_billingAccessController","type":"address"},{"internalType":"contractAccessControllerInterface","name":"_requesterAccessController","type":"address"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"string","name":"_description","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"int256","name":"current","type":"int256"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"updatedAt","type":"uint256"}],"name":"AnswerUpdated","type":"event"},{"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":"uint32","name":"maximumGasPrice","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"reasonableGasPrice","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"microLinkPerEth","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"linkGweiPerObservation","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"linkGweiPerTransmission","type":"uint32"}],"name":"BillingSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"previousConfigBlockNumber","type":"uint32"},{"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":"threshold","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"encodedConfigVersion","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"encoded","type":"bytes"}],"name":"ConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":true,"internalType":"address","name":"startedBy","type":"address"},{"indexed":false,"internalType":"uint256","name":"startedAt","type":"uint256"}],"name":"NewRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"aggregatorRoundId","type":"uint32"},{"indexed":false,"internalType":"int192","name":"answer","type":"int192"},{"indexed":false,"internalType":"address","name":"transmitter","type":"address"},{"indexed":false,"internalType":"int192[]","name":"observations","type":"int192[]"},{"indexed":false,"internalType":"bytes","name":"observers","type":"bytes"},{"indexed":false,"internalType":"bytes32","name":"rawReportContext","type":"bytes32"}],"name":"NewTransmission","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"transmitter","type":"address"},{"indexed":false,"internalType":"address","name":"payee","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"OraclePaid","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":"contractAccessControllerInterface","name":"old","type":"address"},{"indexed":false,"internalType":"contractAccessControllerInterface","name":"current","type":"address"}],"name":"RequesterAccessControllerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"requester","type":"address"},{"indexed":false,"internalType":"bytes16","name":"configDigest","type":"bytes16"},{"indexed":false,"internalType":"uint32","name":"epoch","type":"uint32"},{"indexed":false,"internalType":"uint8","name":"round","type":"uint8"}],"name":"RoundRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previous","type":"address"},{"indexed":true,"internalType":"address","name":"current","type":"address"}],"name":"ValidatorUpdated","type":"event"},{"inputs":[],"name":"LINK","outputs":[{"internalType":"contractLinkTokenInterface","name":"","type":"address"}],"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":[],"name":"billingAccessController","outputs":[{"internalType":"contractAccessControllerInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundId","type":"uint256"}],"name":"getAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBilling","outputs":[{"internalType":"uint32","name":"maximumGasPrice","type":"uint32"},{"internalType":"uint32","name":"reasonableGasPrice","type":"uint32"},{"internalType":"uint32","name":"microLinkPerEth","type":"uint32"},{"internalType":"uint32","name":"linkGweiPerObservation","type":"uint32"},{"internalType":"uint32","name":"linkGweiPerTransmission","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"_roundId","type":"uint80"}],"name":"getRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundId","type":"uint256"}],"name":"getTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDetails","outputs":[{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"blockNumber","type":"uint32"},{"internalType":"bytes16","name":"configDigest","type":"bytes16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestTransmissionDetails","outputs":[{"internalType":"bytes16","name":"configDigest","type":"bytes16"},{"internalType":"uint32","name":"epoch","type":"uint32"},{"internalType":"uint8","name":"round","type":"uint8"},{"internalType":"int192","name":"latestAnswer","type":"int192"},{"internalType":"uint64","name":"latestTimestamp","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"linkAvailableForPayment","outputs":[{"internalType":"int256","name":"availableBalance","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxAnswer","outputs":[{"internalType":"int192","name":"","type":"int192"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minAnswer","outputs":[{"internalType":"int192","name":"","type":"int192"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_signerOrTransmitter","type":"address"}],"name":"oracleObservationCount","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_transmitter","type":"address"}],"name":"owedPayment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"addresspayable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"requestNewRound","outputs":[{"internalType":"uint80","name":"","type":"uint80"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requesterAccessController","outputs":[{"internalType":"contractAccessControllerInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_maximumGasPrice","type":"uint32"},{"internalType":"uint32","name":"_reasonableGasPrice","type":"uint32"},{"internalType":"uint32","name":"_microLinkPerEth","type":"uint32"},{"internalType":"uint32","name":"_linkGweiPerObservation","type":"uint32"},{"internalType":"uint32","name":"_linkGweiPerTransmission","type":"uint32"}],"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":"_threshold","type":"uint8"},{"internalType":"uint64","name":"_encodedConfigVersion","type":"uint64"},{"internalType":"bytes","name":"_encoded","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":"contractAccessControllerInterface","name":"_requesterAccessController","type":"address"}],"name":"setRequesterAccessController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newValidator","type":"address"}],"name":"setValidator","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":"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":"transmitters","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"validator","outputs":[{"internalType":"contractAggregatorValidatorInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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"}`, - chainReadingDefinitions: ` "latestTransmissionDetails":{ - "chainSpecificName": "latestTransmissionDetails", - "returnValues": [ - "configDigest", - "epoch", - "round", - "latestAnswer", - "latestTimestamp" - ], - "readType": 0 - }, - "latestRoundRequested":{ - "chainSpecificName": "RoundRequested", - "params": { - "requester": "" - }, - "returnValues": [ - "requester", - "configDigest", - "epoch", - "round" - ], - "readType": 1 - }`, - }) - testCases = append(testCases, - testCase{ - name: "eventWithNoIndexedTopics", - abiInput: `{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint112","name":"reserve0","type":"uint112"},{"indexed":false,"internalType":"uint112","name":"reserve1","type":"uint112"}],"name":"Sync","type":"event"}`, - chainReadingDefinitions: ` "Sync":{ - "chainSpecificName": "Sync", - "returnValues": [ - "reserve0", - "reserve1" - ], - "readType": 1 - }`, - }) - testCases = append(testCases, testCase{ name: "eventWithMultipleIndexedTopics", - abiInput: `{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0Out","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1Out","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Swap","type":"event"}`, + abiInput: `{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Swap","type":"event"}`, chainReadingDefinitions: `"Swap":{ "chainSpecificName": "Swap", "params":{ "sender": "0x0", "to": "0x0" }, - "returnValues": [ - "sender", - "amount0In", - "amount1In", - "amount0Out", - "amount1Out", - "to" - ], "readType": 1 }`, }) @@ -176,34 +127,12 @@ func TestValidateChainReaderConfig_HappyPath(t *testing.T) { testCases = append(testCases, testCase{ name: "methodWithOneParamAndMultipleResponses", - abiInput: `{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserAccountData","outputs":[{"internalType":"uint256","name":"totalLiquidityETH","type":"uint256"},{"internalType":"uint256","name":"totalCollateralETH","type":"uint256"},{"internalType":"uint256","name":"totalBorrowsETH","type":"uint256"},{"internalType":"uint256","name":"totalFeesETH","type":"uint256"},{"internalType":"uint256","name":"availableBorrowsETH","type":"uint256"},{"internalType":"uint256","name":"currentLiquidationThreshold","type":"uint256"},{"internalType":"uint256","name":"ltv","type":"uint256"},{"internalType":"uint256","name":"healthFactor","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}`, + abiInput: `{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserAccountData","payable":false,"stateMutability":"view","type":"function"}`, chainReadingDefinitions: `"getUserAccountData":{ "chainSpecificName": "getUserAccountData", "params":{ "_user": "0x0" }, - "returnValues": [ - "totalLiquidityETH", - "totalCollateralETH", - "totalBorrowsETH", - "totalFeesETH", - "availableBorrowsETH", - "currentLiquidationThreshold", - "healthFactor" - ], - "readType": 0 - }`, - }) - - testCases = append(testCases, - testCase{ - name: "methodWithNoParamsAndOneResponseWithNoName", - abiInput: `{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}`, - chainReadingDefinitions: `"name":{ - "chainSpecificName": "name", - "returnValues": [ - "" - ], "readType": 0 }`, }) @@ -211,7 +140,7 @@ func TestValidateChainReaderConfig_HappyPath(t *testing.T) { testCases = append(testCases, testCase{ name: "methodWithMultipleParamsAndOneResult", - abiInput: `{"inputs":[{"internalType":"address","name":"_input","type":"address"},{"internalType":"address","name":"_output","type":"address"},{"internalType":"uint256","name":"_inputQuantity","type":"uint256"}],"name":"getSwapOutput","outputs":[{"internalType":"uint256","name":"swapOutput","type":"uint256"}],"stateMutability":"view","type":"function"}`, + abiInput: `{"inputs":[{"internalType":"address","name":"_input","type":"address"},{"internalType":"address","name":"_output","type":"address"},{"internalType":"uint256","name":"_inputQuantity","type":"uint256"}],"name":"getSwapOutput","stateMutability":"view","type":"function"}`, chainReadingDefinitions: `"getSwapOutput":{ "chainSpecificName": "getSwapOutput", "params":{ @@ -219,88 +148,10 @@ func TestValidateChainReaderConfig_HappyPath(t *testing.T) { "_output":"0x0", "_inputQuantity":"0x0" }, - "returnValues": [ - "swapOutput" - ], "readType": 0 }`, }) - // TODO BCF-2789 how to handle return values for tuples - /*testCases = append(testCases, - testCase{ - name: "methodWithOneParamAndMultipleTupleResponse", - struct BassetPersonal { - // Address of the bAsset - address addr; - // Address of the bAsset - address integrator; - // An ERC20 can charge transfer fee, for example USDT, DGX tokens. - bool hasTxFee; // takes a byte in storage - // Status of the bAsset - BassetStatus status; - } - - // Status of the Basset - has it broken its peg? - enum BassetStatus { - Default, - Normal, - BrokenBelowPeg, - BrokenAbovePeg, - Blacklisted, - Liquidating, - Liquidated, - Failed - } - - struct BassetData { - // 1 Basset * ratio / ratioScale == x Masset (relative value) - // If ratio == 10e8 then 1 bAsset = 10 mAssets - // A ratio is divised as 10^(18-tokenDecimals) * measurementMultiple(relative value of 1 base unit) - uint128 ratio; - // Amount of the Basset that is held in Collateral - uint128 vaultBalance; - } - abiInput: `{"inputs":[{"internalType":"address","name":"_bAsset","type":"address"}],"name":"getBasset","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"address","name":"integrator","type":"address"},{"internalType":"bool","name":"hasTxFee","type":"bool"},{"internalType":"enum BassetStatus","name":"status","type":"uint8"}],"internalType":"struct BassetPersonal","name":"personal","type":"tuple"},{"components":[{"internalType":"uint128","name":"ratio","type":"uint128"},{"internalType":"uint128","name":"vaultBalance","type":"uint128"}],"internalType":"struct BassetData","name":"vaultData","type":"tuple"}],"stateMutability":"view","type":"function"}`, - chainReadingDefinitions: `getBasset:{ - chainSpecificName: getBasset, - params:{ - _bAsset:"0x0", - }, - returnValues: [ - TODO, - ] - readType: 0, - }`, - }) - */ - - // TODO how to handle return values for tuples - /* - testCases = append(testCases, - testCase{ - name: "methodWithNoParamsAndTupleResponse", - struct FeederConfig { - uint256 supply; - uint256 a; - WeightLimits limits; - } - - struct WeightLimits { - uint128 min; - uint128 max; - } - abiInput: `{"inputs":[],"name":"getConfig","outputs":[{"components":[{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"uint256","name":"a","type":"uint256"},{"components":[{"internalType":"uint128","name":"min","type":"uint128"},{"internalType":"uint128","name":"max","type":"uint128"}],"internalType":"struct WeightLimits","name":"limits","type":"tuple"}],"internalType":"struct FeederConfig","name":"config","type":"tuple"}],"stateMutability":"view","type":"function"}`, - chainReadingDefinitions: `getConfig:{ - chainSpecificName: getConfig, - params:{}, - returnValues: [ - TODO, - ] - readType: 0, - }`, - })*/ - for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { cfg, err := chainReaderTestHelper{}.makeChainReaderConfigFromStrings(tc.abiInput, tc.chainReadingDefinitions) @@ -325,6 +176,7 @@ func TestValidateChainReaderConfig_HappyPath(t *testing.T) { }) } +// TODO Chain Reading Definitions return values are WIP, waiting on codec work and BCF-2789 func TestValidateChainReaderConfig_BadPath(t *testing.T) { type testCase struct { name string @@ -344,32 +196,12 @@ func TestValidateChainReaderConfig_BadPath(t *testing.T) { "params":{ "malformedParam": "0x0" }, - "returnValues": [ - "sender" - ], "readType": 1 }`, expected: fmt.Errorf("invalid chain reading definition: \"Swap\" for contract: \"testContract\", err: params: [malformedParam] don't match abi event indexed inputs: [sender]"), }) - testCases = append(testCases, - testCase{ - name: "mismatched abi and event chain reading return values", - abiInput: mismatchedEventArgumentsTestABI, - chainReadingDefinitions: `"Swap":{ - "chainSpecificName": "Swap", - "params":{ - "sender": "0x0" - }, - "returnValues": [ - "malformedParam" - ], - "readType": 1 - }`, - expected: fmt.Errorf("invalid chain reading definition: \"Swap\" for contract: \"testContract\", err: return values: [malformedParam] don't match abi event inputs: [sender]"), - }) - - mismatchedFunctionArgumentsTestABI := `{"constant":true,"inputs":[{"internalType":"address","name":"from","type":"address"}],"name":"Swap","outputs":[{"internalType":"address","name":"to","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}` + mismatchedFunctionArgumentsTestABI := `{"constant":true,"inputs":[{"internalType":"address","name":"from","type":"address"}],"name":"Swap","payable":false,"stateMutability":"view","type":"function"}` testCases = append(testCases, testCase{ name: "mismatched abi and method chain reading param values", @@ -379,37 +211,16 @@ func TestValidateChainReaderConfig_BadPath(t *testing.T) { "params":{ "malformedParam": "0x0" }, - "returnValues": [ - "to" - ], "readType": 0 }`, expected: fmt.Errorf("invalid chain reading definition: \"Swap\" for contract: \"testContract\", err: params: [malformedParam] don't match abi method inputs: [from]"), }, ) - testCases = append(testCases, - testCase{ - name: "mismatched abi and method chain reading return values", - abiInput: mismatchedFunctionArgumentsTestABI, - chainReadingDefinitions: `"Swap":{ - "chainSpecificName": "Swap", - "params":{ - "from": "0x0" - }, - "returnValues": [ - "malformedReturnValue" - ], - "readType": 0 - }`, - expected: fmt.Errorf("invalid chain reading definition: \"Swap\" for contract: \"testContract\", err: return values: [malformedReturnValue] don't match abi method outputs: [to]"), - }, - ) - testCases = append(testCases, testCase{ name: "event doesn't exist", - abiInput: `{"constant":true,"inputs":[],"name":"someName","outputs":[],"payable":false,"stateMutability":"view","type":"function"}`, + abiInput: `{"constant":true,"inputs":[],"name":"someName","payable":false,"stateMutability":"view","type":"function"}`, chainReadingDefinitions: `"TestMethod":{ "chainSpecificName": "Swap", "readType": 1 @@ -421,7 +232,7 @@ func TestValidateChainReaderConfig_BadPath(t *testing.T) { testCases = append(testCases, testCase{ name: "method doesn't exist", - abiInput: `{"constant":true,"inputs":[],"name":"someName","outputs":[],"payable":false,"stateMutability":"view","type":"function"}`, + abiInput: `{"constant":true,"inputs":[],"name":"someName","payable":false,"stateMutability":"view","type":"function"}`, chainReadingDefinitions: `"TestMethod":{ "chainSpecificName": "Swap", "readType": 0 @@ -442,7 +253,7 @@ func TestValidateChainReaderConfig_BadPath(t *testing.T) { testCases = append(testCases, testCase{ name: "invalid read type", - abiInput: `{"constant":true,"inputs":[],"name":"someName","outputs":[],"payable":false,"stateMutability":"view","type":"function"}`, + abiInput: `{"constant":true,"inputs":[],"name":"someName","payable":false,"stateMutability":"view","type":"function"}`, chainReadingDefinitions: `"TestMethod":{"readType": 59}`, expected: fmt.Errorf("invalid chain reading definition read type: 59"), }) From a97bf2e42f931ab272d88e13ec1ca10416e0bf92 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 15 Nov 2023 11:01:17 -0500 Subject: [PATCH 030/112] Add types for the evm --- core/services/relay/evm/types/abi_types.go | 60 + .../relay/evm/types/byte_types_gen.go | 300 +++ core/services/relay/evm/types/gen/bytes.tmpl | 14 + core/services/relay/evm/types/gen/ints.tmpl | 64 + core/services/relay/evm/types/gen/main.go | 76 + .../services/relay/evm/types/int_types_gen.go | 2205 +++++++++++++++++ core/services/relay/evm/types/types.go | 5 + 7 files changed, 2724 insertions(+) create mode 100644 core/services/relay/evm/types/abi_types.go create mode 100644 core/services/relay/evm/types/byte_types_gen.go create mode 100644 core/services/relay/evm/types/gen/bytes.tmpl create mode 100644 core/services/relay/evm/types/gen/ints.tmpl create mode 100644 core/services/relay/evm/types/gen/main.go create mode 100644 core/services/relay/evm/types/int_types_gen.go diff --git a/core/services/relay/evm/types/abi_types.go b/core/services/relay/evm/types/abi_types.go new file mode 100644 index 00000000000..001810a2b33 --- /dev/null +++ b/core/services/relay/evm/types/abi_types.go @@ -0,0 +1,60 @@ +package types + +import ( + "reflect" +) + +//go:generate go run ./gen/main.go + +var typeMap = map[string]*AbiEncodingType{ + "bool": { + Native: reflect.TypeOf(true), + Checked: reflect.TypeOf(true), + }, + "int8": { + Native: reflect.TypeOf(int8(0)), + Checked: reflect.TypeOf(int8(0)), + }, + "int16": { + Native: reflect.TypeOf(int16(0)), + Checked: reflect.TypeOf(int16(0)), + }, + "int32": { + Native: reflect.TypeOf(int32(0)), + Checked: reflect.TypeOf(int32(0)), + }, + "int64": { + Native: reflect.TypeOf(int64(0)), + Checked: reflect.TypeOf(int64(0)), + }, + "uint8": { + Native: reflect.TypeOf(uint8(0)), + Checked: reflect.TypeOf(uint8(0)), + }, + "uint16": { + Native: reflect.TypeOf(uint16(0)), + Checked: reflect.TypeOf(uint16(0)), + }, + "uint32": { + Native: reflect.TypeOf(uint32(0)), + Checked: reflect.TypeOf(uint32(0)), + }, + "uint64": { + Native: reflect.TypeOf(uint64(0)), + Checked: reflect.TypeOf(uint64(0)), + }, + "string": { + Native: reflect.TypeOf(""), + Checked: reflect.TypeOf(""), + }, +} + +type AbiEncodingType struct { + Native reflect.Type + Checked reflect.Type +} + +func GetType(name string) (*AbiEncodingType, bool) { + abiType, ok := typeMap[name] + return abiType, ok +} diff --git a/core/services/relay/evm/types/byte_types_gen.go b/core/services/relay/evm/types/byte_types_gen.go new file mode 100644 index 00000000000..e87b11c2336 --- /dev/null +++ b/core/services/relay/evm/types/byte_types_gen.go @@ -0,0 +1,300 @@ +package types + +import "reflect" + +type bytes1 [1]byte + +func init() { + typeMap["bytes1"] = &AbiEncodingType{ + Native: reflect.TypeOf([1]byte{}), + Checked: reflect.TypeOf(bytes1{}), + } +} + +type bytes2 [2]byte + +func init() { + typeMap["bytes2"] = &AbiEncodingType{ + Native: reflect.TypeOf([2]byte{}), + Checked: reflect.TypeOf(bytes2{}), + } +} + +type bytes3 [3]byte + +func init() { + typeMap["bytes3"] = &AbiEncodingType{ + Native: reflect.TypeOf([3]byte{}), + Checked: reflect.TypeOf(bytes3{}), + } +} + +type bytes4 [4]byte + +func init() { + typeMap["bytes4"] = &AbiEncodingType{ + Native: reflect.TypeOf([4]byte{}), + Checked: reflect.TypeOf(bytes4{}), + } +} + +type bytes5 [5]byte + +func init() { + typeMap["bytes5"] = &AbiEncodingType{ + Native: reflect.TypeOf([5]byte{}), + Checked: reflect.TypeOf(bytes5{}), + } +} + +type bytes6 [6]byte + +func init() { + typeMap["bytes6"] = &AbiEncodingType{ + Native: reflect.TypeOf([6]byte{}), + Checked: reflect.TypeOf(bytes6{}), + } +} + +type bytes7 [7]byte + +func init() { + typeMap["bytes7"] = &AbiEncodingType{ + Native: reflect.TypeOf([7]byte{}), + Checked: reflect.TypeOf(bytes7{}), + } +} + +type bytes8 [8]byte + +func init() { + typeMap["bytes8"] = &AbiEncodingType{ + Native: reflect.TypeOf([8]byte{}), + Checked: reflect.TypeOf(bytes8{}), + } +} + +type bytes9 [9]byte + +func init() { + typeMap["bytes9"] = &AbiEncodingType{ + Native: reflect.TypeOf([9]byte{}), + Checked: reflect.TypeOf(bytes9{}), + } +} + +type bytes10 [10]byte + +func init() { + typeMap["bytes10"] = &AbiEncodingType{ + Native: reflect.TypeOf([10]byte{}), + Checked: reflect.TypeOf(bytes10{}), + } +} + +type bytes11 [11]byte + +func init() { + typeMap["bytes11"] = &AbiEncodingType{ + Native: reflect.TypeOf([11]byte{}), + Checked: reflect.TypeOf(bytes11{}), + } +} + +type bytes12 [12]byte + +func init() { + typeMap["bytes12"] = &AbiEncodingType{ + Native: reflect.TypeOf([12]byte{}), + Checked: reflect.TypeOf(bytes12{}), + } +} + +type bytes13 [13]byte + +func init() { + typeMap["bytes13"] = &AbiEncodingType{ + Native: reflect.TypeOf([13]byte{}), + Checked: reflect.TypeOf(bytes13{}), + } +} + +type bytes14 [14]byte + +func init() { + typeMap["bytes14"] = &AbiEncodingType{ + Native: reflect.TypeOf([14]byte{}), + Checked: reflect.TypeOf(bytes14{}), + } +} + +type bytes15 [15]byte + +func init() { + typeMap["bytes15"] = &AbiEncodingType{ + Native: reflect.TypeOf([15]byte{}), + Checked: reflect.TypeOf(bytes15{}), + } +} + +type bytes16 [16]byte + +func init() { + typeMap["bytes16"] = &AbiEncodingType{ + Native: reflect.TypeOf([16]byte{}), + Checked: reflect.TypeOf(bytes16{}), + } +} + +type bytes17 [17]byte + +func init() { + typeMap["bytes17"] = &AbiEncodingType{ + Native: reflect.TypeOf([17]byte{}), + Checked: reflect.TypeOf(bytes17{}), + } +} + +type bytes18 [18]byte + +func init() { + typeMap["bytes18"] = &AbiEncodingType{ + Native: reflect.TypeOf([18]byte{}), + Checked: reflect.TypeOf(bytes18{}), + } +} + +type bytes19 [19]byte + +func init() { + typeMap["bytes19"] = &AbiEncodingType{ + Native: reflect.TypeOf([19]byte{}), + Checked: reflect.TypeOf(bytes19{}), + } +} + +type bytes20 [20]byte + +func init() { + typeMap["bytes20"] = &AbiEncodingType{ + Native: reflect.TypeOf([20]byte{}), + Checked: reflect.TypeOf(bytes20{}), + } +} + +type bytes21 [21]byte + +func init() { + typeMap["bytes21"] = &AbiEncodingType{ + Native: reflect.TypeOf([21]byte{}), + Checked: reflect.TypeOf(bytes21{}), + } +} + +type bytes22 [22]byte + +func init() { + typeMap["bytes22"] = &AbiEncodingType{ + Native: reflect.TypeOf([22]byte{}), + Checked: reflect.TypeOf(bytes22{}), + } +} + +type bytes23 [23]byte + +func init() { + typeMap["bytes23"] = &AbiEncodingType{ + Native: reflect.TypeOf([23]byte{}), + Checked: reflect.TypeOf(bytes23{}), + } +} + +type bytes24 [24]byte + +func init() { + typeMap["bytes24"] = &AbiEncodingType{ + Native: reflect.TypeOf([24]byte{}), + Checked: reflect.TypeOf(bytes24{}), + } +} + +type bytes25 [25]byte + +func init() { + typeMap["bytes25"] = &AbiEncodingType{ + Native: reflect.TypeOf([25]byte{}), + Checked: reflect.TypeOf(bytes25{}), + } +} + +type bytes26 [26]byte + +func init() { + typeMap["bytes26"] = &AbiEncodingType{ + Native: reflect.TypeOf([26]byte{}), + Checked: reflect.TypeOf(bytes26{}), + } +} + +type bytes27 [27]byte + +func init() { + typeMap["bytes27"] = &AbiEncodingType{ + Native: reflect.TypeOf([27]byte{}), + Checked: reflect.TypeOf(bytes27{}), + } +} + +type bytes28 [28]byte + +func init() { + typeMap["bytes28"] = &AbiEncodingType{ + Native: reflect.TypeOf([28]byte{}), + Checked: reflect.TypeOf(bytes28{}), + } +} + +type bytes29 [29]byte + +func init() { + typeMap["bytes29"] = &AbiEncodingType{ + Native: reflect.TypeOf([29]byte{}), + Checked: reflect.TypeOf(bytes29{}), + } +} + +type bytes30 [30]byte + +func init() { + typeMap["bytes30"] = &AbiEncodingType{ + Native: reflect.TypeOf([30]byte{}), + Checked: reflect.TypeOf(bytes30{}), + } +} + +type bytes31 [31]byte + +func init() { + typeMap["bytes31"] = &AbiEncodingType{ + Native: reflect.TypeOf([31]byte{}), + Checked: reflect.TypeOf(bytes31{}), + } +} + +type bytes32 [32]byte + +func init() { + typeMap["bytes32"] = &AbiEncodingType{ + Native: reflect.TypeOf([32]byte{}), + Checked: reflect.TypeOf(bytes32{}), + } +} + +type bytes0 [0]byte + +func init() { + typeMap["bytes0"] = &AbiEncodingType{ + Native: reflect.TypeOf([0]byte{}), + Checked: reflect.TypeOf(bytes0{}), + } +} diff --git a/core/services/relay/evm/types/gen/bytes.tmpl b/core/services/relay/evm/types/gen/bytes.tmpl new file mode 100644 index 00000000000..cecf1868691 --- /dev/null +++ b/core/services/relay/evm/types/gen/bytes.tmpl @@ -0,0 +1,14 @@ +package types + +import "reflect" + +{{ range . }} +type bytes{{.Size}} [{{.Size}}]byte +func init() { + typeMap["bytes{{.Size}}"] = &AbiEncodingType { + Native: reflect.TypeOf([{{.Size}}]byte{}), + Checked: reflect.TypeOf(bytes{{.Size}}{}), + } +} + +{{ end }} \ No newline at end of file diff --git a/core/services/relay/evm/types/gen/ints.tmpl b/core/services/relay/evm/types/gen/ints.tmpl new file mode 100644 index 00000000000..f5c42524ff8 --- /dev/null +++ b/core/services/relay/evm/types/gen/ints.tmpl @@ -0,0 +1,64 @@ +package types + +import ( + "math/big" + "reflect" + + "github.com/fxamacker/cbor/v2" + + "github.com/smartcontractkit/chainlink-common/pkg/types" +) + +type SizedBigInt interface { + Verify() error + private() +} + +var sizedBigIntType = reflect.TypeOf((*SizedBigInt)(nil)).Elem() +func SizedBigIntType() reflect.Type { + return sizedBigIntType +} + +{{ range . }} +type {{.Prefix}}int{{.Size}} big.Int +func (i *{{.Prefix}}int{{.Size}}) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *{{.Prefix}}int{{.Size}}) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *{{.Prefix}}int{{.Size}}) Verify() error { + bi := (*big.Int)(i) + {{ if .Signed }} + if !codec.FitsInNBitsSigned({{.Size}}, bi) { + return types.ErrInvalidType + } + {{ else }} + if bi.BitLen() > {{.Size}} { + return types.ErrInvalidType + } + {{ end }} + return nil +} + +func (i *{{.Prefix}}int{{.Size}}) private() {} + +func init() { + typeMap["{{.Prefix}}int{{.Size}}"] = &AbiEncodingType { + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*{{.Prefix}}int{{.Size}})(nil)), + } +} +{{ end }} \ No newline at end of file diff --git a/core/services/relay/evm/types/gen/main.go b/core/services/relay/evm/types/gen/main.go new file mode 100644 index 00000000000..7bd35bf3d18 --- /dev/null +++ b/core/services/relay/evm/types/gen/main.go @@ -0,0 +1,76 @@ +package main + +import ( + "bytes" + _ "embed" + "go/format" + "os" + "text/template" +) + +func main() { + genInts() + genBytes() +} + +func genBytes() { + byteTypes := [33]ByteType{} + for i := 1; i < 33; i++ { + byteTypes[i-1].Size = i + } + runTemplate("bytes", bytesTemplate, "byte_types_gen.go", byteTypes) +} + +func genInts() { + var intTypes []*IntType + + // 8, 16, 32, and 64 bits have their own type in go that is used by abi. + // The test use *big.Int + for i := 24; i <= 256; i += 8 { + if i == 32 || i == 64 { + continue + } + + signed := &IntType{Size: i, Signed: false} + unsigned := &IntType{Prefix: "u", Size: i} + intTypes = append(intTypes, signed, unsigned) + } + runTemplate("ints", intsTemplate, "int_types_gen.go", intTypes) +} + +func runTemplate(name, rawTemplate, outputFile string, input any) { + t, err := template.New(name).Parse(rawTemplate) + if err != nil { + panic(err) + } + + br := bytes.Buffer{} + if err = t.Execute(&br, input); err != nil { + panic(err) + } + + res, err := format.Source([]byte(br.Bytes())) + if err != nil { + panic(err) + } + + if err = os.WriteFile(outputFile, res, 0600); err != nil { + panic(err) + } +} + +type IntType struct { + Prefix string + Size int + Signed bool +} + +type ByteType struct { + Size int +} + +//go:embed bytes.tmpl +var bytesTemplate string + +//go:embed ints.tmpl +var intsTemplate string diff --git a/core/services/relay/evm/types/int_types_gen.go b/core/services/relay/evm/types/int_types_gen.go new file mode 100644 index 00000000000..fb978926179 --- /dev/null +++ b/core/services/relay/evm/types/int_types_gen.go @@ -0,0 +1,2205 @@ +package types + +import ( + "math/big" + "reflect" + + "github.com/fxamacker/cbor/v2" + + "github.com/smartcontractkit/chainlink-common/pkg/types" +) + +type SizedBigInt interface { + Verify() error + private() +} + +var sizedBigIntType = reflect.TypeOf((*SizedBigInt)(nil)).Elem() + +func SizedBigIntType() reflect.Type { + return sizedBigIntType +} + +type int24 big.Int + +func (i *int24) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int24) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int24) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 24 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int24) private() {} + +func init() { + typeMap["int24"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int24)(nil)), + } +} + +type uint24 big.Int + +func (i *uint24) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint24) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint24) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 24 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint24) private() {} + +func init() { + typeMap["uint24"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint24)(nil)), + } +} + +type int40 big.Int + +func (i *int40) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int40) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int40) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 40 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int40) private() {} + +func init() { + typeMap["int40"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int40)(nil)), + } +} + +type uint40 big.Int + +func (i *uint40) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint40) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint40) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 40 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint40) private() {} + +func init() { + typeMap["uint40"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint40)(nil)), + } +} + +type int48 big.Int + +func (i *int48) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int48) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int48) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 48 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int48) private() {} + +func init() { + typeMap["int48"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int48)(nil)), + } +} + +type uint48 big.Int + +func (i *uint48) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint48) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint48) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 48 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint48) private() {} + +func init() { + typeMap["uint48"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint48)(nil)), + } +} + +type int56 big.Int + +func (i *int56) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int56) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int56) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 56 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int56) private() {} + +func init() { + typeMap["int56"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int56)(nil)), + } +} + +type uint56 big.Int + +func (i *uint56) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint56) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint56) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 56 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint56) private() {} + +func init() { + typeMap["uint56"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint56)(nil)), + } +} + +type int72 big.Int + +func (i *int72) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int72) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int72) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 72 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int72) private() {} + +func init() { + typeMap["int72"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int72)(nil)), + } +} + +type uint72 big.Int + +func (i *uint72) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint72) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint72) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 72 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint72) private() {} + +func init() { + typeMap["uint72"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint72)(nil)), + } +} + +type int80 big.Int + +func (i *int80) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int80) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int80) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 80 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int80) private() {} + +func init() { + typeMap["int80"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int80)(nil)), + } +} + +type uint80 big.Int + +func (i *uint80) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint80) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint80) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 80 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint80) private() {} + +func init() { + typeMap["uint80"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint80)(nil)), + } +} + +type int88 big.Int + +func (i *int88) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int88) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int88) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 88 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int88) private() {} + +func init() { + typeMap["int88"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int88)(nil)), + } +} + +type uint88 big.Int + +func (i *uint88) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint88) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint88) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 88 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint88) private() {} + +func init() { + typeMap["uint88"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint88)(nil)), + } +} + +type int96 big.Int + +func (i *int96) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int96) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int96) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 96 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int96) private() {} + +func init() { + typeMap["int96"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int96)(nil)), + } +} + +type uint96 big.Int + +func (i *uint96) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint96) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint96) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 96 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint96) private() {} + +func init() { + typeMap["uint96"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint96)(nil)), + } +} + +type int104 big.Int + +func (i *int104) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int104) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int104) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 104 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int104) private() {} + +func init() { + typeMap["int104"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int104)(nil)), + } +} + +type uint104 big.Int + +func (i *uint104) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint104) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint104) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 104 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint104) private() {} + +func init() { + typeMap["uint104"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint104)(nil)), + } +} + +type int112 big.Int + +func (i *int112) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int112) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int112) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 112 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int112) private() {} + +func init() { + typeMap["int112"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int112)(nil)), + } +} + +type uint112 big.Int + +func (i *uint112) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint112) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint112) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 112 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint112) private() {} + +func init() { + typeMap["uint112"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint112)(nil)), + } +} + +type int120 big.Int + +func (i *int120) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int120) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int120) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 120 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int120) private() {} + +func init() { + typeMap["int120"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int120)(nil)), + } +} + +type uint120 big.Int + +func (i *uint120) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint120) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint120) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 120 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint120) private() {} + +func init() { + typeMap["uint120"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint120)(nil)), + } +} + +type int128 big.Int + +func (i *int128) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int128) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int128) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 128 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int128) private() {} + +func init() { + typeMap["int128"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int128)(nil)), + } +} + +type uint128 big.Int + +func (i *uint128) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint128) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint128) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 128 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint128) private() {} + +func init() { + typeMap["uint128"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint128)(nil)), + } +} + +type int136 big.Int + +func (i *int136) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int136) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int136) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 136 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int136) private() {} + +func init() { + typeMap["int136"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int136)(nil)), + } +} + +type uint136 big.Int + +func (i *uint136) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint136) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint136) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 136 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint136) private() {} + +func init() { + typeMap["uint136"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint136)(nil)), + } +} + +type int144 big.Int + +func (i *int144) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int144) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int144) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 144 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int144) private() {} + +func init() { + typeMap["int144"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int144)(nil)), + } +} + +type uint144 big.Int + +func (i *uint144) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint144) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint144) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 144 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint144) private() {} + +func init() { + typeMap["uint144"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint144)(nil)), + } +} + +type int152 big.Int + +func (i *int152) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int152) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int152) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 152 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int152) private() {} + +func init() { + typeMap["int152"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int152)(nil)), + } +} + +type uint152 big.Int + +func (i *uint152) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint152) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint152) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 152 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint152) private() {} + +func init() { + typeMap["uint152"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint152)(nil)), + } +} + +type int160 big.Int + +func (i *int160) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int160) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int160) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 160 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int160) private() {} + +func init() { + typeMap["int160"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int160)(nil)), + } +} + +type uint160 big.Int + +func (i *uint160) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint160) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint160) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 160 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint160) private() {} + +func init() { + typeMap["uint160"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint160)(nil)), + } +} + +type int168 big.Int + +func (i *int168) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int168) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int168) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 168 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int168) private() {} + +func init() { + typeMap["int168"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int168)(nil)), + } +} + +type uint168 big.Int + +func (i *uint168) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint168) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint168) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 168 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint168) private() {} + +func init() { + typeMap["uint168"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint168)(nil)), + } +} + +type int176 big.Int + +func (i *int176) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int176) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int176) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 176 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int176) private() {} + +func init() { + typeMap["int176"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int176)(nil)), + } +} + +type uint176 big.Int + +func (i *uint176) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint176) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint176) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 176 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint176) private() {} + +func init() { + typeMap["uint176"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint176)(nil)), + } +} + +type int184 big.Int + +func (i *int184) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int184) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int184) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 184 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int184) private() {} + +func init() { + typeMap["int184"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int184)(nil)), + } +} + +type uint184 big.Int + +func (i *uint184) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint184) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint184) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 184 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint184) private() {} + +func init() { + typeMap["uint184"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint184)(nil)), + } +} + +type int192 big.Int + +func (i *int192) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int192) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int192) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 192 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int192) private() {} + +func init() { + typeMap["int192"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int192)(nil)), + } +} + +type uint192 big.Int + +func (i *uint192) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint192) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint192) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 192 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint192) private() {} + +func init() { + typeMap["uint192"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint192)(nil)), + } +} + +type int200 big.Int + +func (i *int200) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int200) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int200) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 200 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int200) private() {} + +func init() { + typeMap["int200"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int200)(nil)), + } +} + +type uint200 big.Int + +func (i *uint200) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint200) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint200) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 200 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint200) private() {} + +func init() { + typeMap["uint200"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint200)(nil)), + } +} + +type int208 big.Int + +func (i *int208) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int208) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int208) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 208 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int208) private() {} + +func init() { + typeMap["int208"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int208)(nil)), + } +} + +type uint208 big.Int + +func (i *uint208) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint208) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint208) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 208 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint208) private() {} + +func init() { + typeMap["uint208"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint208)(nil)), + } +} + +type int216 big.Int + +func (i *int216) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int216) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int216) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 216 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int216) private() {} + +func init() { + typeMap["int216"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int216)(nil)), + } +} + +type uint216 big.Int + +func (i *uint216) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint216) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint216) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 216 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint216) private() {} + +func init() { + typeMap["uint216"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint216)(nil)), + } +} + +type int224 big.Int + +func (i *int224) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int224) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int224) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 224 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int224) private() {} + +func init() { + typeMap["int224"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int224)(nil)), + } +} + +type uint224 big.Int + +func (i *uint224) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint224) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint224) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 224 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint224) private() {} + +func init() { + typeMap["uint224"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint224)(nil)), + } +} + +type int232 big.Int + +func (i *int232) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int232) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int232) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 232 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int232) private() {} + +func init() { + typeMap["int232"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int232)(nil)), + } +} + +type uint232 big.Int + +func (i *uint232) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint232) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint232) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 232 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint232) private() {} + +func init() { + typeMap["uint232"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint232)(nil)), + } +} + +type int240 big.Int + +func (i *int240) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int240) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int240) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 240 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int240) private() {} + +func init() { + typeMap["int240"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int240)(nil)), + } +} + +type uint240 big.Int + +func (i *uint240) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint240) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint240) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 240 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint240) private() {} + +func init() { + typeMap["uint240"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint240)(nil)), + } +} + +type int248 big.Int + +func (i *int248) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int248) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int248) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 248 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int248) private() {} + +func init() { + typeMap["int248"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int248)(nil)), + } +} + +type uint248 big.Int + +func (i *uint248) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint248) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint248) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 248 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint248) private() {} + +func init() { + typeMap["uint248"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint248)(nil)), + } +} + +type int256 big.Int + +func (i *int256) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int256) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int256) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 256 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int256) private() {} + +func init() { + typeMap["int256"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int256)(nil)), + } +} + +type uint256 big.Int + +func (i *uint256) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint256) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint256) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 256 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint256) private() {} + +func init() { + typeMap["uint256"] = &AbiEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint256)(nil)), + } +} diff --git a/core/services/relay/evm/types/types.go b/core/services/relay/evm/types/types.go index 24afb65c55a..d9f6a56fa4e 100644 --- a/core/services/relay/evm/types/types.go +++ b/core/services/relay/evm/types/types.go @@ -25,6 +25,11 @@ type ChainReaderConfig struct { ChainContractReaders map[string]ChainContractReader `json:"chainContractReaders"` } +type ChainCodedConfig struct { + TypeAbi string `json:"typeAbi"` + // TODO transform configs that allow hard-coding values or transforming them (max, min, median etc) +} + type ChainContractReader struct { ContractABI string `json:"contractABI"` // ChainReaderDefinitions key is chainAgnostic read name. From 17fe12329b5b78262bdf19f193bce0a7861a9895 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 15 Nov 2023 13:31:14 -0500 Subject: [PATCH 031/112] Create a codec entry with from args, allowing us to do type checking and to have structs to use with abi.Arguments's Pack function --- core/services/relay/evm/codec_entry.go | 132 +++++++++++++++++++ core/services/relay/evm/codec_entry_test.go | 139 ++++++++++++++++++++ 2 files changed, 271 insertions(+) create mode 100644 core/services/relay/evm/codec_entry.go create mode 100644 core/services/relay/evm/codec_entry_test.go diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go new file mode 100644 index 00000000000..e0c318a0495 --- /dev/null +++ b/core/services/relay/evm/codec_entry.go @@ -0,0 +1,132 @@ +package evm + +import ( + "reflect" + "strings" + + "github.com/ethereum/go-ethereum/accounts/abi" + + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" +) + +type CodecEntry struct { + Args abi.Arguments + checkedType reflect.Type + nativeType reflect.Type +} + +func (info *CodecEntry) Init() error { + if info.checkedType != nil { + return nil + } + + args := UnwrapArgs(info.Args) + argLen := len(args) + native := make([]reflect.StructField, argLen) + checked := make([]reflect.StructField, argLen) + + if len(args) == 1 && args[0].Name == "" { + nativeArg, checkedArg, err := getNativeAndCheckedTypes(&args[0].Type) + if err != nil { + return err + } + info.nativeType = nativeArg + info.checkedType = checkedArg + return nil + } + + for i, arg := range args { + tmp := arg.Type + nativeArg, checkedArg, err := getNativeAndCheckedTypes(&tmp) + if err != nil { + return err + } + tag := reflect.StructTag(`json:"` + arg.Name + `"`) + name := strings.ToUpper(arg.Name[:1]) + arg.Name[1:] + native[i] = reflect.StructField{Name: name, Type: nativeArg, Tag: tag} + checked[i] = reflect.StructField{Name: name, Type: checkedArg, Tag: tag} + } + + info.nativeType = reflect.StructOf(native) + info.checkedType = reflect.StructOf(checked) + return nil +} + +func UnwrapArgs(args abi.Arguments) abi.Arguments { + // Unwrap an unnamed tuple so that callers don't need to wrap it + // Eg: If you have struct Foo { ... } and return an unnamed Foo, you should be able ot decode to a go Foo{} directly + if len(args) != 1 || args[0].Name != "" { + return args + } + + elms := args[0].Type.TupleElems + if len(elms) != 0 { + names := args[0].Type.TupleRawNames + args = make(abi.Arguments, len(elms)) + for i, elm := range elms { + args[i] = abi.Argument{ + Name: names[i], + Type: *elm, + } + } + } + return args +} + +func getNativeAndCheckedTypes(curType *abi.Type) (reflect.Type, reflect.Type, error) { + converter := func(t reflect.Type) reflect.Type { return t } + for curType.Elem != nil { + prior := converter + switch curType.GetType().Kind() { + case reflect.Slice: + converter = func(t reflect.Type) reflect.Type { + return prior(reflect.SliceOf(t)) + } + curType = curType.Elem + case reflect.Array: + tmp := curType + converter = func(t reflect.Type) reflect.Type { + return prior(reflect.ArrayOf(tmp.Size, t)) + } + curType = curType.Elem + default: + return nil, nil, commontypes.ErrInvalidType + } + } + base, ok := types.GetType(curType.String()) + if ok { + return converter(base.Native), converter(base.Checked), nil + } + + return createTupleType(curType, converter) +} + +func createTupleType(curType *abi.Type, converter func(reflect.Type) reflect.Type) (reflect.Type, reflect.Type, error) { + if len(curType.TupleElems) == 0 { + return curType.TupleType, curType.TupleType, nil + } + + // Create native type ourselves to assure that it'll always have the exact memory layout of checked types + // Otherwise, the "unsafe" casting that will be done to convert from checked to native won't be safe. + // At the time of writing, the way the TupleType is built it will be the same, but I don't want to rely on that + // If they ever add private fields for internal tracking + // or anything it would break us if we don't build the native type. + // As an example of how it could possibly change in the future, I've seen struct{} + // added with tags to the top of generated structs to allow metadata exploration. + nativeFields := make([]reflect.StructField, len(curType.TupleElems)) + checkedFields := make([]reflect.StructField, len(curType.TupleElems)) + for i, elm := range curType.TupleElems { + name := curType.TupleRawNames[i] + nativeFields[i].Name = name + checkedFields[i].Name = name + nativeArgType, checkedArgType, err := getNativeAndCheckedTypes(elm) + if err != nil { + return nil, nil, err + } + nativeFields[i].Type = nativeArgType + checkedFields[i].Type = checkedArgType + } + return converter(reflect.StructOf(nativeFields)), converter(reflect.StructOf(checkedFields)), nil +} diff --git a/core/services/relay/evm/codec_entry_test.go b/core/services/relay/evm/codec_entry_test.go new file mode 100644 index 00000000000..17491a12f4b --- /dev/null +++ b/core/services/relay/evm/codec_entry_test.go @@ -0,0 +1,139 @@ +package evm + +import ( + "math/big" + "reflect" + "testing" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" +) + +func TestCodecEntry(t *testing.T) { + t.Run("basic types", func(t *testing.T) { + type1, err := abi.NewType("uint16", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + type2, err := abi.NewType("string", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + type3, err := abi.NewType("uint24", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + type4, err := abi.NewType("int24", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := CodecEntry{ + Args: abi.Arguments{ + {Name: "Field1", Type: type1}, + {Name: "Field2", Type: type2}, + {Name: "Field3", Type: type3}, + {Name: "Field4", Type: type4}, + }, + } + require.NoError(t, entry.Init()) + native := reflect.New(entry.nativeType) + iNative := reflect.Indirect(native) + iNative.FieldByName("Field1").Set(reflect.ValueOf(uint16(2))) + iNative.FieldByName("Field2").Set(reflect.ValueOf("any string")) + iNative.FieldByName("Field3").Set(reflect.ValueOf(big.NewInt( /*2^24 - 1*/ 16777215))) + iNative.FieldByName("Field4").Set(reflect.ValueOf(big.NewInt( /*2^23 - 1*/ 8388607))) + // native and checked point to the same item, even though they have different "types" + // they have the same memory layout so this is safe per unsafe casting rules, see unsafe.Pointer for details + checked := reflect.NewAt(entry.checkedType, native.UnsafePointer()) + iChecked := reflect.Indirect(checked) + checkedField := iChecked.FieldByName("Field3").Interface() + + sbi, ok := checkedField.(types.SizedBigInt) + require.True(t, ok) + assert.NoError(t, sbi.Verify()) + bi, ok := iNative.FieldByName("Field3").Interface().(*big.Int) + require.True(t, ok) + bi.Add(bi, big.NewInt(1)) + assert.IsType(t, commontypes.ErrInvalidType, sbi.Verify()) + bi, ok = iNative.FieldByName("Field4").Interface().(*big.Int) + require.True(t, ok) + bi.Add(bi, big.NewInt(1)) + assert.IsType(t, commontypes.ErrInvalidType, sbi.Verify()) + }) + + t.Run("tuples", func(t *testing.T) { + type1, err := abi.NewType("uint16", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + tupleType, err := abi.NewType("tuple", "", []abi.ArgumentMarshaling{ + {Name: "Field3", Type: "uint24"}, + {Name: "Field4", Type: "int24"}, + }) + require.NoError(t, err) + entry := CodecEntry{ + Args: abi.Arguments{ + {Name: "Field1", Type: type1}, + {Name: "Field2", Type: tupleType}, + }, + } + require.NoError(t, entry.Init()) + native := reflect.New(entry.nativeType) + iNative := reflect.Indirect(native) + iNative.FieldByName("Field1").Set(reflect.ValueOf(uint16(2))) + f2 := iNative.FieldByName("Field2") + f2.FieldByName("Field3").Set(reflect.ValueOf(big.NewInt( /*2^24 - 1*/ 16777215))) + f2.FieldByName("Field4").Set(reflect.ValueOf(big.NewInt( /*2^23 - 1*/ 8388607))) + // native and checked point to the same item, even though they have different "types" + // they have the same memory layout so this is safe per unsafe casting rules, see unsafe.Pointer for details + checked := reflect.NewAt(entry.checkedType, native.UnsafePointer()) + tuple := reflect.Indirect(checked).FieldByName("Field2") + checkedField := tuple.FieldByName("Field3").Interface() + + sbi, ok := checkedField.(types.SizedBigInt) + require.True(t, ok) + assert.NoError(t, sbi.Verify()) + bi, ok := f2.FieldByName("Field3").Interface().(*big.Int) + require.True(t, ok) + bi.Add(bi, big.NewInt(1)) + assert.IsType(t, commontypes.ErrInvalidType, sbi.Verify()) + bi, ok = f2.FieldByName("Field4").Interface().(*big.Int) + require.True(t, ok) + bi.Add(bi, big.NewInt(1)) + assert.IsType(t, commontypes.ErrInvalidType, sbi.Verify()) + }) + + t.Run("unwrapped types", func(t *testing.T) { + // This exists to allow you to decode single returned values without naming the parameter + wrappedTuple, err := abi.NewType("tuple", "", []abi.ArgumentMarshaling{ + {Name: "Field1", Type: "int16"}, + }) + require.NoError(t, err) + entry := CodecEntry{ + Args: abi.Arguments{{Name: "", Type: wrappedTuple}}, + } + require.NoError(t, entry.Init()) + native := reflect.New(entry.nativeType) + iNative := reflect.Indirect(native) + iNative.FieldByName("Field1").Set(reflect.ValueOf(int16(2))) + }) + + t.Run("slice types", func(t *testing.T) { + type1, err := abi.NewType("int16[]", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := CodecEntry{ + Args: abi.Arguments{{Name: "Field1", Type: type1}}, + } + require.NoError(t, entry.Init()) + native := reflect.New(entry.nativeType) + iNative := reflect.Indirect(native) + iNative.FieldByName("Field1").Set(reflect.ValueOf([]int16{2, 3})) + }) + + t.Run("array types", func(t *testing.T) { + type1, err := abi.NewType("int16[3]", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := CodecEntry{ + Args: abi.Arguments{{Name: "Field1", Type: type1}}, + } + require.NoError(t, entry.Init()) + native := reflect.New(entry.nativeType) + iNative := reflect.Indirect(native) + iNative.FieldByName("Field1").Set(reflect.ValueOf([3]int16{2, 3, 30})) + }) +} From 1690e14bfefc90928e5e89c65b71c18a96f641dd Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 15 Nov 2023 13:32:59 -0500 Subject: [PATCH 032/112] Craetes a function to get the max size for abi.Argumetns, given any outermost slices have N elements --- core/services/relay/evm/codec_entry.go | 21 +- core/services/relay/evm/size_helper.go | 65 +++++ core/services/relay/evm/size_helper_test.go | 263 ++++++++++++++++++++ 3 files changed, 342 insertions(+), 7 deletions(-) create mode 100644 core/services/relay/evm/size_helper.go create mode 100644 core/services/relay/evm/size_helper_test.go diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go index e0c318a0495..e336c4a7d9f 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/codec_entry.go @@ -17,12 +17,12 @@ type CodecEntry struct { nativeType reflect.Type } -func (info *CodecEntry) Init() error { - if info.checkedType != nil { +func (entry *CodecEntry) Init() error { + if entry.checkedType != nil { return nil } - args := UnwrapArgs(info.Args) + args := UnwrapArgs(entry.Args) argLen := len(args) native := make([]reflect.StructField, argLen) checked := make([]reflect.StructField, argLen) @@ -32,8 +32,8 @@ func (info *CodecEntry) Init() error { if err != nil { return err } - info.nativeType = nativeArg - info.checkedType = checkedArg + entry.nativeType = nativeArg + entry.checkedType = checkedArg return nil } @@ -49,11 +49,18 @@ func (info *CodecEntry) Init() error { checked[i] = reflect.StructField{Name: name, Type: checkedArg, Tag: tag} } - info.nativeType = reflect.StructOf(native) - info.checkedType = reflect.StructOf(checked) + entry.nativeType = reflect.StructOf(native) + entry.checkedType = reflect.StructOf(checked) return nil } +func (entry *CodecEntry) GetMaxSize(n int) (int, error) { + if entry == nil { + return 0, commontypes.ErrInvalidType + } + return GetMaxSize(n, entry.Args) +} + func UnwrapArgs(args abi.Arguments) abi.Arguments { // Unwrap an unnamed tuple so that callers don't need to wrap it // Eg: If you have struct Foo { ... } and return an unnamed Foo, you should be able ot decode to a go Foo{} directly diff --git a/core/services/relay/evm/size_helper.go b/core/services/relay/evm/size_helper.go new file mode 100644 index 00000000000..f14abd7d784 --- /dev/null +++ b/core/services/relay/evm/size_helper.go @@ -0,0 +1,65 @@ +package evm + +import ( + "github.com/ethereum/go-ethereum/accounts/abi" + + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" +) + +func GetMaxSize(n int, args abi.Arguments) (int, error) { + size := 0 + for _, arg := range args { + tmp := arg.Type + argSize, _, err := getTypeSize(n, &tmp, true, false) + if err != nil { + return 0, err + } + size += argSize + } + + return size, nil +} + +func getTypeSize(n int, t *abi.Type, dynamicTypeAllowed bool, isNested bool) (int, bool, error) { + // See https://docs.soliditylang.org/en/latest/abi-spec.html#formal-specification-of-the-encoding + switch t.T { + case abi.ArrayTy: + elmSize, _, err := getTypeSize(n, t.Elem, false, true) + return t.Size * elmSize, false, err + case abi.SliceTy: + if !dynamicTypeAllowed { + return 0, false, commontypes.ErrInvalidType + } + elmSize, _, err := getTypeSize(n, t.Elem, false, true) + return 32 /*header*/ + 32 /*footer*/ + elmSize*n, true, err + case abi.BytesTy, abi.StringTy: + if !dynamicTypeAllowed { + return 0, false, commontypes.ErrInvalidType + } + totalSize := (n + 31) / 32 * 32 // strings and bytes are padded to 32 bytes + return 32 /*header*/ + 32 /*footer*/ + totalSize, true, nil + case abi.TupleTy: + // No header or footer, because if the tuple is dynamically sized we would need to know the inner slice sizes + // so it would return error for that element. + size := 0 + dynamic := false + for _, elm := range t.TupleElems { + argSize, dynamicArg, err := getTypeSize(n, elm, !isNested, true) + if err != nil { + return 0, false, err + } + dynamic = dynamic || dynamicArg + size += argSize + } + + if dynamic { + // offset for the element needs to be included there are dynamic elements + size += 32 + } + + return size, dynamic, nil + default: + // types are padded to 32 bytes + return 32, false, nil + } +} diff --git a/core/services/relay/evm/size_helper_test.go b/core/services/relay/evm/size_helper_test.go new file mode 100644 index 00000000000..0368f0f4059 --- /dev/null +++ b/core/services/relay/evm/size_helper_test.go @@ -0,0 +1,263 @@ +package evm_test + +import ( + "math/big" + "testing" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" +) + +const anyNumElements = 10 + +func TestGetMaxSize(t *testing.T) { + t.Run("Basic types all encode to 32 bytes", func(t *testing.T) { + args := abi.Arguments{ + {Name: "I8", Type: mustType(t, "int8")}, + {Name: "I80", Type: mustType(t, "int80")}, + {Name: "I256", Type: mustType(t, "int256")}, + {Name: "B3", Type: mustType(t, "bytes3")}, + {Name: "B32", Type: mustType(t, "bytes32")}, + {Name: "TF", Type: mustType(t, "bool")}, + } + + runSizeTest(t, anyNumElements, args, int8(9), big.NewInt(3), big.NewInt(200), [3]byte{1, 3, 4}, make32Bytes(1), true) + }) + + t.Run("Slices of basic types all encode to 32 bytes each + header and footer", func(t *testing.T) { + args := abi.Arguments{ + {Name: "I8", Type: mustType(t, "int8[]")}, + {Name: "I80", Type: mustType(t, "int80[]")}, + {Name: "I256", Type: mustType(t, "int256[]")}, + {Name: "B3", Type: mustType(t, "bytes3[]")}, + {Name: "B32", Type: mustType(t, "bytes32[]")}, + {Name: "TF", Type: mustType(t, "bool[]")}, + } + + i8 := []int8{9, 2, 1, 3, 5, 6, 2, 1, 2, 3} + i80 := []*big.Int{big.NewInt(9), big.NewInt(2), big.NewInt(1), big.NewInt(3), big.NewInt(5), big.NewInt(6), big.NewInt(2), big.NewInt(1), big.NewInt(2), big.NewInt(3)} + i256 := []*big.Int{big.NewInt(119), big.NewInt(112), big.NewInt(1), big.NewInt(3), big.NewInt(5), big.NewInt(6), big.NewInt(2), big.NewInt(1), big.NewInt(2), big.NewInt(3)} + b3 := [][3]byte{{1, 2, 3}, {1, 2, 3}, {1, 2, 3}, {1, 2, 3}, {1, 2, 3}, {1, 2, 3}, {1, 2, 3}, {1, 2, 3}, {1, 2, 3}, {1, 2, 3}} + b32 := [][32]byte{make32Bytes(1), make32Bytes(2), make32Bytes(3), make32Bytes(4), make32Bytes(5), make32Bytes(6), make32Bytes(7), make32Bytes(8), make32Bytes(9), make32Bytes(10)} + tf := []bool{true, false, true, false, true, false, true, false, true, false} + runSizeTest(t, anyNumElements, args, i8, i80, i256, b3, b32, tf) + }) + + t.Run("Arrays of basic types all encode to 32 bytes each", func(t *testing.T) { + args := abi.Arguments{ + {Name: "I8", Type: mustType(t, "int8[3]")}, + {Name: "I80", Type: mustType(t, "int80[3]")}, + {Name: "I256", Type: mustType(t, "int256[3]")}, + {Name: "B3", Type: mustType(t, "bytes3[3]")}, + {Name: "B32", Type: mustType(t, "bytes32[3]")}, + {Name: "TF", Type: mustType(t, "bool[3]")}, + } + + i8 := [3]int8{9, 2, 1} + i80 := [3]*big.Int{big.NewInt(9), big.NewInt(2), big.NewInt(1)} + i256 := [3]*big.Int{big.NewInt(119), big.NewInt(112), big.NewInt(1)} + b3 := [3][3]byte{{1, 2, 3}, {1, 2, 3}, {1, 2, 3}} + b32 := [3][32]byte{make32Bytes(1), make32Bytes(2), make32Bytes(3)} + tf := [3]bool{true, false, true} + runSizeTest(t, anyNumElements, args, i8, i80, i256, b3, b32, tf) + }) + + t.Run("Tuples are a sum of their elements", func(t *testing.T) { + tuple1 := []abi.ArgumentMarshaling{ + {Name: "I8", Type: "int8"}, + {Name: "I80", Type: "int80"}, + {Name: "I256", Type: "int256"}, + {Name: "B3", Type: "bytes3"}, + {Name: "B32", Type: "bytes32"}, + {Name: "TF", Type: "bool"}, + } + t1, err := abi.NewType("tuple", "", tuple1) + require.NoError(t, err) + + tuple2 := []abi.ArgumentMarshaling{ + {Name: "I80", Type: "int80"}, + {Name: "TF", Type: "bool"}, + } + t2, err := abi.NewType("tuple", "", tuple2) + require.NoError(t, err) + + args := abi.Arguments{ + {Name: "t1", Type: t1}, + {Name: "t2", Type: t2}, + } + arg1 := struct { + I8 int8 + I80 *big.Int + I256 *big.Int + B3 [3]byte + B32 [32]byte + TF bool + }{ + int8(9), big.NewInt(3), big.NewInt(200), [3]byte{1, 3, 4}, make32Bytes(1), true, + } + + arg2 := struct { + I80 *big.Int + TF bool + }{ + big.NewInt(3), true, + } + runSizeTest(t, anyNumElements, args, arg1, arg2) + }) + + t.Run("Slices of tuples are a sum of their elements with header and footer", func(t *testing.T) { + tuple1 := []abi.ArgumentMarshaling{ + {Name: "I80", Type: "int80"}, + {Name: "TF", Type: "bool"}, + } + t1, err := abi.NewType("tuple[]", "", tuple1) + require.NoError(t, err) + + args := abi.Arguments{ + {Name: "t1", Type: t1}, + } + arg1 := []struct { + I80 *big.Int + TF bool + }{ + {big.NewInt(1), true}, + {big.NewInt(2), true}, + {big.NewInt(3), true}, + {big.NewInt(4), false}, + {big.NewInt(5), true}, + {big.NewInt(6), true}, + {big.NewInt(7), true}, + {big.NewInt(8), false}, + {big.NewInt(9), true}, + {big.NewInt(10), true}, + } + runSizeTest(t, anyNumElements, args, arg1) + }) + + t.Run("Arrays of tuples are a sum of their elements", func(t *testing.T) { + tuple1 := []abi.ArgumentMarshaling{ + {Name: "I80", Type: "int80"}, + {Name: "TF", Type: "bool"}, + } + t1, err := abi.NewType("tuple[3]", "", tuple1) + require.NoError(t, err) + + args := abi.Arguments{ + {Name: "t1", Type: t1}, + } + arg1 := []struct { + I80 *big.Int + TF bool + }{ + {big.NewInt(1), true}, + {big.NewInt(2), true}, + {big.NewInt(3), true}, + } + runSizeTest(t, anyNumElements, args, arg1) + + }) + + t.Run("Bytes pack themselves", func(t *testing.T) { + args := abi.Arguments{{Name: "B", Type: mustType(t, "bytes")}} + t.Run("No padding needed", func(t *testing.T) { + padded := []byte("12345789022345678903234567890412345678905123456789061234") + runSizeTest(t, 64, args, padded) + }) + t.Run("Padding needed", func(t *testing.T) { + needsPadding := []byte("12345789022345678903234567890412345678905123456") + runSizeTest(t, 56, args, needsPadding) + }) + }) + + t.Run("Strings pack themselves", func(t *testing.T) { + args := abi.Arguments{{Name: "B", Type: mustType(t, "string")}} + t.Run("No padding needed", func(t *testing.T) { + padded := "12345789022345678903234567890412345678905123456789061234" + runSizeTest(t, 64, args, padded) + }) + t.Run("Padding needed", func(t *testing.T) { + needsPadding := "12345789022345678903234567890412345678905123456" + runSizeTest(t, 56, args, needsPadding) + }) + }) + + t.Run("Nested dynamic types return errors", func(t *testing.T) { + t.Run("Slice in slice", func(t *testing.T) { + args := abi.Arguments{{Name: "B", Type: mustType(t, "int32[][]")}} + _, err := evm.GetMaxSize(anyNumElements, args) + assert.IsType(t, commontypes.ErrInvalidType, err) + }) + t.Run("Slice in array", func(t *testing.T) { + args := abi.Arguments{{Name: "B", Type: mustType(t, "int32[][2]")}} + _, err := evm.GetMaxSize(anyNumElements, args) + assert.IsType(t, commontypes.ErrInvalidType, err) + }) + }) + + t.Run("Slices in a top level tuple works as-if they are the sized element", func(t *testing.T) { + tuple1 := []abi.ArgumentMarshaling{ + {Name: "I80", Type: "int80[]"}, + {Name: "TF", Type: "bool[]"}, + } + t1, err := abi.NewType("tuple", "", tuple1) + require.NoError(t, err) + args := abi.Arguments{{Name: "tuple", Type: t1}} + + arg1 := struct { + I80 []*big.Int + TF []bool + }{ + I80: []*big.Int{big.NewInt(1), big.NewInt(2), big.NewInt(3), big.NewInt(4), big.NewInt(5), big.NewInt(6), big.NewInt(7), big.NewInt(8), big.NewInt(9), big.NewInt(10)}, + TF: []bool{true, true, true, false, true, true, true, false, true, true}, + } + + runSizeTest(t, anyNumElements, args, arg1) + }) + + t.Run("Nested dynamic tuples return errors", func(t *testing.T) { + tuple1 := []abi.ArgumentMarshaling{ + {Name: "I8", Type: "int8"}, + {Name: "I80", Type: "int80"}, + {Name: "I256", Type: "int256"}, + {Name: "B3", Type: "bytes3"}, + {Name: "B32", Type: "bytes32"}, + {Name: "TF", Type: "bool[]"}, + } + + tuple2 := []abi.ArgumentMarshaling{ + {Name: "I80", Type: "int80"}, + {Name: "T1", Type: "tuple", Components: tuple1}, + } + t2, err := abi.NewType("tuple", "", tuple2) + require.NoError(t, err) + + args := abi.Arguments{{Name: "t2", Type: t2}} + _, err = evm.GetMaxSize(anyNumElements, args) + assert.IsType(t, commontypes.ErrInvalidType, err) + }) +} + +func runSizeTest(t *testing.T, n int, args abi.Arguments, params ...any) { + + actual, err := evm.GetMaxSize(n, args) + require.NoError(t, err) + + expected, err := args.Pack(params...) + require.NoError(t, err) + assert.Equal(t, len(expected), actual) +} + +func mustType(t *testing.T, name string) abi.Type { + aType, err := abi.NewType(name, "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + return aType +} + +func make32Bytes(firstByte byte) [32]byte { + return [32]byte{firstByte, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3} +} From 103a8c550236403511c2cf81ffa85034dfb70c5d Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 15 Nov 2023 11:55:26 -0500 Subject: [PATCH 033/112] Add codec and make chain reader use it. Run the interface tests for both chain reader and codec. --- core/scripts/go.mod | 8 +- core/scripts/go.sum | 16 +- core/services/relay/evm/chain_reader.go | 190 ++++---- core/services/relay/evm/chain_reader_test.go | 456 +++++++++--------- core/services/relay/evm/codec.go | 72 +++ core/services/relay/evm/codec_entry.go | 7 +- core/services/relay/evm/codec_test.go | 189 ++++++++ core/services/relay/evm/decoder.go | 85 ++++ core/services/relay/evm/encoder.go | 141 ++++++ core/services/relay/evm/evm.go | 20 +- core/services/relay/evm/functions.go | 4 + core/services/relay/evm/mercury_provider.go | 7 + core/services/relay/evm/ocr2keeper.go | 4 + core/services/relay/evm/ocr2vrf.go | 8 + .../testfiles/chain_reader_test_contract.sol | 60 +++ .../chain_reader_test_contract_gen.abi | 1 + .../chain_reader_test_contract_gen.bin | 1 + .../chain_reader_test_contract_gen.go | 341 +++++++++++++ .../testfiles/chainlink_reader_test_setup.sh | 8 + core/services/relay/evm/types/types.go | 24 +- go.mod | 8 +- go.sum | 16 +- integration-tests/go.mod | 8 +- integration-tests/go.sum | 16 +- plugins/medianpoc/plugin_test.go | 5 + 25 files changed, 1328 insertions(+), 367 deletions(-) create mode 100644 core/services/relay/evm/codec.go create mode 100644 core/services/relay/evm/codec_test.go create mode 100644 core/services/relay/evm/decoder.go create mode 100644 core/services/relay/evm/encoder.go create mode 100644 core/services/relay/evm/testfiles/chain_reader_test_contract.sol create mode 100644 core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi create mode 100644 core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin create mode 100644 core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go create mode 100755 core/services/relay/evm/testfiles/chainlink_reader_test_setup.sh diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 25c792d4e3d..c8244a77e53 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -304,10 +304,10 @@ require ( github.com/shirou/gopsutil/v3 v3.23.9 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 // indirect - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90 // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 // indirect + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index cf278800f6d..6ba4a768b4c 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1467,14 +1467,14 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 h1:QLhOOIeFldRBc+ESAVZfEPrIpfeiduwnmHlvDt1iFmM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90 h1:tcnV7rhW0wC/oukNE/wPRQzC1K86YERbVaWF5KYda7g= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 h1:Q7Lif7+Hr3A1gsFooCp/StP93qVPuixn32XEllZnSdY= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a/go.mod h1:rioELYwPY2xBtzPRN/D08Y7iTPbIQEjPknYdJK51CzQ= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 h1:1GzOKT53e8N7ZPwsyf1hSbKsynZmXmLOIL3DMvGq9sc= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006/go.mod h1:tJLhL7gJ+V3+4N/yLxXIvJ0DAiuyqZCa31+2BSbw7zo= 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-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index ce93da70ec9..77a959f813c 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -2,15 +2,19 @@ package evm import ( "context" - "errors" "fmt" "strings" + "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" + "github.com/pkg/errors" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm" + evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services" @@ -23,19 +27,30 @@ type ChainReaderService interface { } type chainReader struct { - lggr logger.Logger - contractID common.Address - lp logpoller.LogPoller + lggr logger.Logger + lp logpoller.LogPoller + codec *evmCodec + client evmclient.Client } -// NewChainReaderService constructor for ChainReader -func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, contractID common.Address, config types.ChainReaderConfig) (*chainReader, error) { - if err := validateChainReaderConfig(config); err != nil { - return nil, fmt.Errorf("%w err: %w", commontypes.ErrInvalidConfig, err) +// NewChainReaderService is a constructor for ChainReader, returns nil if there is any error +func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, chain evm.Chain, config types.ChainReaderConfig) (ChainReaderService, error) { + + parsed := &parsedTypes{ + encoderDefs: map[string]*CodecEntry{}, + decoderDefs: map[string]*CodecEntry{}, + } + + if err := addTypes(config.ChainContractReaders, parsed); err != nil { + return nil, err } - // TODO BCF-2814 implement initialisation of chain reading definitions and pass them into chainReader - return &chainReader{lggr.Named("ChainReader"), contractID, lp}, nil + return &chainReader{ + lggr: lggr.Named("ChainReader"), + lp: lp, + codec: codecFromTypes(parsed), + client: chain.Client(), + }, nil } func (cr *chainReader) Name() string { return cr.lggr.Name() } @@ -45,117 +60,124 @@ func (cr *chainReader) initialize() error { return nil } +func (cr *chainReader) CreateType(itemType string, forEncoding bool) (any, error) { + return cr.codec.CreateType(itemType, forEncoding) +} + +var _ commontypes.TypeProvider = &chainReader{} + +func (cr *chainReader) GetLatestValue(ctx context.Context, bc commontypes.BoundContract, method string, params any, returnVal any) error { + data, err := cr.codec.Encode(ctx, params, method) + if err != nil { + return err + } + + address := common.HexToAddress(bc.Address) + callMsg := ethereum.CallMsg{ + To: &address, + From: address, + Data: data, + } + + output, err := cr.client.CallContract(ctx, callMsg, nil) + + if err != nil { + return err + } + + return cr.codec.Decode(ctx, output, returnVal, method) +} + func (cr *chainReader) Start(ctx context.Context) error { if err := cr.initialize(); err != nil { return fmt.Errorf("Failed to initialize ChainReader: %w", err) } return nil } - func (cr *chainReader) Close() error { return nil } func (cr *chainReader) Ready() error { return nil } - func (cr *chainReader) HealthReport() map[string]error { return map[string]error{cr.Name(): nil} } -func (cr *chainReader) GetLatestValue(ctx context.Context, bc commontypes.BoundContract, method string, params any, returnVal any) error { - return fmt.Errorf("Unimplemented method GetLatestValue called %w", errors.ErrUnsupported) -} - -func validateChainReaderConfig(cfg types.ChainReaderConfig) error { - if len(cfg.ChainContractReaders) == 0 { - return fmt.Errorf("config is empty") +func addEventTypes(name string, contractABI abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) error { + event, methodExists := contractABI.Events[chainReaderDefinition.ChainSpecificName] + if !methodExists { + return fmt.Errorf("method: %s doesn't exist", chainReaderDefinition.ChainSpecificName) } - for contractName, chainContractReader := range cfg.ChainContractReaders { - abi, err := abi.JSON(strings.NewReader(chainContractReader.ContractABI)) - if err != nil { - return fmt.Errorf("invalid abi: %w", err) - } - - for chainReadingDefinitionName, chainReaderDefinition := range chainContractReader.ChainReaderDefinitions { - switch chainReaderDefinition.ReadType { - case types.Method: - err = validateMethods(abi, chainReaderDefinition) - case types.Event: - err = validateEvents(abi, chainReaderDefinition) - default: - return fmt.Errorf("invalid chain reading definition read type: %d for contract: %q", chainReaderDefinition.ReadType, contractName) - } - if err != nil { - return fmt.Errorf("invalid chain reading definition: %q for contract: %q, err: %w", chainReadingDefinitionName, contractName, err) - } - } + if err := addOverrides(chainReaderDefinition, event.Inputs); err != nil { + return err } - return nil + return addDecoderDef(name, event.Inputs, parsed) } -func validateEvents(contractABI abi.ABI, chainReaderDefinition types.ChainReaderDefinition) error { - event, methodExists := contractABI.Events[chainReaderDefinition.ChainSpecificName] +func addMethods(name string, abi abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) error { + method, methodExists := abi.Methods[chainReaderDefinition.ChainSpecificName] if !methodExists { - return fmt.Errorf("event: %s doesn't exist", chainReaderDefinition.ChainSpecificName) + return fmt.Errorf("method: %q doesn't exist", chainReaderDefinition.ChainSpecificName) } - var abiEventIndexedInputs []abi.Argument - for _, eventInput := range event.Inputs { - if eventInput.Indexed { - abiEventIndexedInputs = append(abiEventIndexedInputs, eventInput) - } + if err := addOverrides(chainReaderDefinition, method.Inputs); err != nil { + return err } - var chainReaderEventParams []string - for chainReaderEventParam := range chainReaderDefinition.Params { - chainReaderEventParams = append(chainReaderEventParams, chainReaderEventParam) + // ABI.Pack prepends the method.ID to the encodings, we'll need the encoder to do the same. + input := &CodecEntry{Args: method.Inputs, encodingPrefix: method.ID} + if err := input.Init(); err != nil { + return err } - if !areChainReaderArgumentsValid(abiEventIndexedInputs, chainReaderEventParams) { - var abiEventIndexedInputsNames []string - for _, abiEventIndexedInput := range abiEventIndexedInputs { - abiEventIndexedInputsNames = append(abiEventIndexedInputsNames, abiEventIndexedInput.Name) - } - return fmt.Errorf("params: [%s] don't match abi event indexed inputs: [%s]", strings.Join(chainReaderEventParams, ","), strings.Join(abiEventIndexedInputsNames, ",")) - } - return nil + parsed.encoderDefs[name] = input + return addDecoderDef(name, method.Outputs, parsed) } -func validateMethods(abi abi.ABI, chainReaderDefinition types.ChainReaderDefinition) error { - method, methodExists := abi.Methods[chainReaderDefinition.ChainSpecificName] - if !methodExists { - return fmt.Errorf("method: %q doesn't exist", chainReaderDefinition.ChainSpecificName) - } - - var methodNames []string - for methodName := range chainReaderDefinition.Params { - methodNames = append(methodNames, methodName) - } +func addDecoderDef(name string, outputs abi.Arguments, parsed *parsedTypes) error { + output := &CodecEntry{Args: outputs} + parsed.decoderDefs[name] = output + return output.Init() +} - if !areChainReaderArgumentsValid(method.Inputs, methodNames) { - var abiMethodInputs []string - for _, input := range method.Inputs { - abiMethodInputs = append(abiMethodInputs, input.Name) +func addOverrides(chainReaderDefinition types.ChainReaderDefinition, inputs abi.Arguments) error { + // TODO add transforms to add params artificially +paramsLoop: + for argName, param := range chainReaderDefinition.Params { + // TODO add type check too + _ = param + for _, input := range inputs { + if argName == input.Name { + continue paramsLoop + } } - return fmt.Errorf("params: [%s] don't match abi method inputs: [%s]", strings.Join(methodNames, ","), strings.Join(abiMethodInputs, ",")) + return fmt.Errorf("cannot find parameter %v in %v", argName, chainReaderDefinition.ChainSpecificName) } return nil } -func areChainReaderArgumentsValid(contractArgs []abi.Argument, chainReaderArgs []string) bool { - for _, contractArg := range contractArgs { - found := false - for _, chArgName := range chainReaderArgs { - if chArgName == contractArg.Name { - found = true - break - } +func addTypes(chainContractReaders map[string]types.ChainContractReader, parsed *parsedTypes) error { + for contractName, chainContractReader := range chainContractReaders { + contractAbi, err := abi.JSON(strings.NewReader(chainContractReader.ContractABI)) + if err != nil { + return err } - if !found { - return false + + for chainReadingDefinitionName, chainReaderDefinition := range chainContractReader.ChainReaderDefinitions { + switch chainReaderDefinition.ReadType { + case types.Method: + err = addMethods(chainReadingDefinitionName, contractAbi, chainReaderDefinition, parsed) + case types.Event: + err = addEventTypes(chainReadingDefinitionName, contractAbi, chainReaderDefinition, parsed) + default: + return fmt.Errorf("invalid chain reader definition read type: %d", chainReaderDefinition.ReadType) + } + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid chain reader config for contract: %q chain reading definition: %q", contractName, chainReadingDefinitionName)) + } } } - return true + return nil } diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index d2eb5d30cd7..5e770841eb5 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -1,36 +1,81 @@ -package evm +package evm_test + +//go:generate ./testfiles/chainlink_reader_test_setup.sh import ( - "encoding/json" - "fmt" - "strings" + "context" + "crypto/ecdsa" + "math" + "math/big" "testing" - "github.com/stretchr/testify/assert" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" + "github.com/ethereum/go-ethereum/core" + evmtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/smartcontractkit/libocr/commontypes" + "github.com/stretchr/testify/require" - commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + clcommontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + . "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" //nolint common practice to import test mods with . mocklogpoller "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks" + + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/mocks" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" - evmtypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/testfiles" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) -type chainReaderTestHelper struct { +const commonGasLimitOnEvms = uint64(4712388) + +func TestChainReader(t *testing.T) { + RunChainReaderInterfaceTests(t, &chainReaderInterfaceTester{}) +} + +type chainReaderInterfaceTester struct { + chain *mocks.Chain + address string + chainConfig types.ChainReaderConfig + auth *bind.TransactOpts + sim *backends.SimulatedBackend + pk *ecdsa.PrivateKey + evmTest *testfiles.Testfiles +} + +func (it *chainReaderInterfaceTester) Setup(t *testing.T) { + if it.chain == nil { + it.setupNoClient(t) + it.chain.On("Client").Return(client.NewSimulatedBackendClient(t, it.sim, big.NewInt(1337))) + } } -func (crTestHelper chainReaderTestHelper) makeChainReaderConfig(abi string, params map[string]any) evmtypes.ChainReaderConfig { - return evmtypes.ChainReaderConfig{ - ChainContractReaders: map[string]evmtypes.ChainContractReader{ - "MyContract": { - ContractABI: abi, - ChainReaderDefinitions: map[string]evmtypes.ChainReaderDefinition{ - "MyGenericMethod": { - ChainSpecificName: "name", - Params: params, - CacheEnabled: false, - ReadType: evmtypes.Method, +func (it *chainReaderInterfaceTester) setupNoClient(t require.TestingT) { + // can re-use the same chain for tests, just make new contract for each test + if it.chain != nil { + return + } + + it.chain = &mocks.Chain{} + it.setupChainNoClient(t) + it.chain.On("LogPoller").Return(logger.NullLogger) + + it.chainConfig = types.ChainReaderConfig{ + ChainContractReaders: map[string]types.ChainContractReader{ + "LatestValueHolder": { + ContractABI: testfiles.TestfilesMetaData.ABI, + ChainReaderDefinitions: map[string]types.ChainReaderDefinition{ + MethodTakingLatestParamsReturningTestStruct: { + ChainSpecificName: "GetElementAtIndex", + }, + MethodReturningUint64: { + ChainSpecificName: "GetPrimitiveValue", + }, + MethodReturningUint64Slice: { + ChainSpecificName: "GetSliceValue", }, }, }, @@ -38,235 +83,182 @@ func (crTestHelper chainReaderTestHelper) makeChainReaderConfig(abi string, para } } -func (crTestHelper chainReaderTestHelper) makeChainReaderConfigFromStrings(abi string, chainReadingDefinitions string) (evmtypes.ChainReaderConfig, error) { - chainReaderConfigTemplate := `{ - "chainContractReaders": { - "testContract": { - "contractName": "testContract", - "contractABI": "[%s]", - "chainReaderDefinitions": { - %s - } - } - } - }` - - abi = strings.Replace(abi, `"`, `\"`, -1) - formattedCfgJsonString := fmt.Sprintf(chainReaderConfigTemplate, abi, chainReadingDefinitions) - var chainReaderConfig evmtypes.ChainReaderConfig - err := json.Unmarshal([]byte(formattedCfgJsonString), &chainReaderConfig) - return chainReaderConfig, err +func (it *chainReaderInterfaceTester) Teardown(_ *testing.T) { + it.address = "" } -func TestNewChainReader(t *testing.T) { - lggr := logger.TestLogger(t) - lp := mocklogpoller.NewLogPoller(t) - chain := mocks.NewChain(t) - contractID := testutils.NewAddress() - contractABI := `[{"inputs":[{"internalType":"string","name":"param","type":"string"}],"name":"name","stateMutability":"view","type":"function"}]` - - t.Run("happy path", func(t *testing.T) { - params := make(map[string]any) - params["param"] = "" - chainReaderConfig := chainReaderTestHelper{}.makeChainReaderConfig(contractABI, params) - chain.On("LogPoller").Return(lp) - _, err := NewChainReaderService(lggr, chain.LogPoller(), contractID, chainReaderConfig) - assert.NoError(t, err) - }) - - t.Run("invalid config", func(t *testing.T) { - invalidChainReaderConfig := chainReaderTestHelper{}.makeChainReaderConfig(contractABI, map[string]any{}) // missing param - _, err := NewChainReaderService(lggr, chain.LogPoller(), contractID, invalidChainReaderConfig) - assert.ErrorIs(t, err, commontypes.ErrInvalidConfig) - }) - - t.Run("ChainReader config is empty", func(t *testing.T) { - emptyChainReaderConfig := evmtypes.ChainReaderConfig{} - _, err := NewChainReaderService(lggr, chain.LogPoller(), contractID, emptyChainReaderConfig) - assert.ErrorIs(t, err, commontypes.ErrInvalidConfig) - assert.ErrorContains(t, err, "config is empty") - }) +func (it *chainReaderInterfaceTester) Name() string { + return "EVM" } -func TestChainReaderStartClose(t *testing.T) { - lggr := logger.TestLogger(t) - lp := mocklogpoller.NewLogPoller(t) - cr := chainReader{ - lggr: lggr, - lp: lp, +func (it *chainReaderInterfaceTester) GetAccountBytes(i int) []byte { + account := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2} + account[i%32] += byte(i) + account[(i+3)%32] += byte(i + 3) + return account +} + +func (it *chainReaderInterfaceTester) GetChainReader(t *testing.T) clcommontypes.ChainReader { + cr, err := evm.NewChainReaderService(logger.NullLogger, mocklogpoller.NewLogPoller(t), it.chain, it.chainConfig) + require.NoError(t, err) + return cr +} + +func (it *chainReaderInterfaceTester) GetPrimitiveContract(ctx context.Context, t *testing.T) clcommontypes.BoundContract { + // Since most tests don't use the contract, it's set up lazily to save time + it.deployNewContract(ctx, t) + return clcommontypes.BoundContract{ + Address: it.address, + Name: MethodReturningUint64, } - err := cr.Start(testutils.Context(t)) - assert.NoError(t, err) - err = cr.Close() - assert.NoError(t, err) } -// TODO Chain Reading Definitions return values are WIP, waiting on codec work and BCF-2789 -func TestValidateChainReaderConfig_HappyPath(t *testing.T) { - type testCase struct { - name string - abiInput string - chainReadingDefinitions string +func (it *chainReaderInterfaceTester) GetSliceContract(ctx context.Context, t *testing.T) clcommontypes.BoundContract { + // Since most tests don't use the contract, it's set up lazily to save time + it.deployNewContract(ctx, t) + return clcommontypes.BoundContract{ + Address: it.address, + Name: MethodReturningUint64Slice, } +} - var testCases []testCase - testCases = append(testCases, - testCase{ - name: "eventWithMultipleIndexedTopics", - abiInput: `{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Swap","type":"event"}`, - chainReadingDefinitions: `"Swap":{ - "chainSpecificName": "Swap", - "params":{ - "sender": "0x0", - "to": "0x0" - }, - "readType": 1 - }`, - }) - - testCases = append(testCases, - testCase{ - name: "methodWithOneParamAndMultipleResponses", - abiInput: `{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserAccountData","payable":false,"stateMutability":"view","type":"function"}`, - chainReadingDefinitions: `"getUserAccountData":{ - "chainSpecificName": "getUserAccountData", - "params":{ - "_user": "0x0" - }, - "readType": 0 - }`, - }) - - testCases = append(testCases, - testCase{ - name: "methodWithMultipleParamsAndOneResult", - abiInput: `{"inputs":[{"internalType":"address","name":"_input","type":"address"},{"internalType":"address","name":"_output","type":"address"},{"internalType":"uint256","name":"_inputQuantity","type":"uint256"}],"name":"getSwapOutput","stateMutability":"view","type":"function"}`, - chainReadingDefinitions: `"getSwapOutput":{ - "chainSpecificName": "getSwapOutput", - "params":{ - "_input":"0x0", - "_output":"0x0", - "_inputQuantity":"0x0" - }, - "readType": 0 - }`, - }) - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - cfg, err := chainReaderTestHelper{}.makeChainReaderConfigFromStrings(tc.abiInput, tc.chainReadingDefinitions) - assert.NoError(t, err) - assert.NoError(t, validateChainReaderConfig(cfg)) - }) +func (it *chainReaderInterfaceTester) SetLatestValue(ctx context.Context, t *testing.T, testStruct *TestStruct) clcommontypes.BoundContract { + // Since most tests don't use the contract, it's set up lazily to save time + it.deployNewContract(ctx, t) + + tx, err := it.evmTest.AddTestStruct( + it.auth, + testStruct.Field, + testStruct.DifferentField, + uint8(testStruct.OracleID), + convertOracleIDs(testStruct.OracleIDs), + [32]byte(testStruct.Account), + convertAccounts(testStruct.Accounts), + testStruct.BigField, + midToInternalType(testStruct.NestedStruct), + ) + require.NoError(t, err) + it.sim.Commit() + it.incNonce() + it.awaitTx(ctx, t, tx) + return clcommontypes.BoundContract{ + Address: it.address, + Name: MethodTakingLatestParamsReturningTestStruct, } +} - t.Run("large config with all test cases", func(t *testing.T) { - var largeABI string - var manyChainReadingDefinitions string - for _, tc := range testCases { - largeABI += tc.abiInput + "," - manyChainReadingDefinitions += tc.chainReadingDefinitions + "," - } - - largeABI = largeABI[:len(largeABI)-1] - manyChainReadingDefinitions = manyChainReadingDefinitions[:len(manyChainReadingDefinitions)-1] - cfg, err := chainReaderTestHelper{}.makeChainReaderConfigFromStrings(largeABI, manyChainReadingDefinitions) - assert.NoError(t, err) - assert.NoError(t, validateChainReaderConfig(cfg)) - }) +func convertOracleIDs(oracleIDs [32]commontypes.OracleID) [32]byte { + convertedIds := [32]byte{} + for i, id := range oracleIDs { + convertedIds[i] = byte(id) + } + return convertedIds } -// TODO Chain Reading Definitions return values are WIP, waiting on codec work and BCF-2789 -func TestValidateChainReaderConfig_BadPath(t *testing.T) { - type testCase struct { - name string - abiInput string - chainReadingDefinitions string - expected error +func convertAccounts(accounts [][]byte) [][32]byte { + convertedAccounts := make([][32]byte, len(accounts)) + for i, a := range accounts { + convertedAccounts[i] = [32]byte(a) } + return convertedAccounts +} - var testCases []testCase - mismatchedEventArgumentsTestABI := `{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"Swap","type":"event"}` - testCases = append(testCases, - testCase{ - name: "mismatched abi and event chain reading param values", - abiInput: mismatchedEventArgumentsTestABI, - chainReadingDefinitions: `"Swap":{ - "chainSpecificName": "Swap", - "params":{ - "malformedParam": "0x0" - }, - "readType": 1 - }`, - expected: fmt.Errorf("invalid chain reading definition: \"Swap\" for contract: \"testContract\", err: params: [malformedParam] don't match abi event indexed inputs: [sender]"), - }) - - mismatchedFunctionArgumentsTestABI := `{"constant":true,"inputs":[{"internalType":"address","name":"from","type":"address"}],"name":"Swap","payable":false,"stateMutability":"view","type":"function"}` - testCases = append(testCases, - testCase{ - name: "mismatched abi and method chain reading param values", - abiInput: mismatchedFunctionArgumentsTestABI, - chainReadingDefinitions: `"Swap":{ - "chainSpecificName": "Swap", - "params":{ - "malformedParam": "0x0" - }, - "readType": 0 - }`, - expected: fmt.Errorf("invalid chain reading definition: \"Swap\" for contract: \"testContract\", err: params: [malformedParam] don't match abi method inputs: [from]"), - }, - ) +func (it *chainReaderInterfaceTester) setupChainNoClient(t require.TestingT) { + privateKey, err := crypto.GenerateKey() + require.NoError(t, err) + it.pk = privateKey - testCases = append(testCases, - testCase{ - name: "event doesn't exist", - abiInput: `{"constant":true,"inputs":[],"name":"someName","payable":false,"stateMutability":"view","type":"function"}`, - chainReadingDefinitions: `"TestMethod":{ - "chainSpecificName": "Swap", - "readType": 1 - }`, - expected: fmt.Errorf("invalid chain reading definition: \"TestMethod\" for contract: \"testContract\", err: event: Swap doesn't exist"), - }, - ) + it.auth, err = bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1337)) + require.NoError(t, err) - testCases = append(testCases, - testCase{ - name: "method doesn't exist", - abiInput: `{"constant":true,"inputs":[],"name":"someName","payable":false,"stateMutability":"view","type":"function"}`, - chainReadingDefinitions: `"TestMethod":{ - "chainSpecificName": "Swap", - "readType": 0 - }`, - expected: fmt.Errorf("invalid chain reading definition: \"TestMethod\" for contract: \"testContract\", err: method: \"Swap\" doesn't exist"), - }, - ) + it.sim = backends.NewSimulatedBackend(core.GenesisAlloc{it.auth.From: {Balance: big.NewInt(math.MaxInt64)}}, commonGasLimitOnEvms*5000) + it.sim.Commit() +} + +func (it *chainReaderInterfaceTester) deployNewContract(ctx context.Context, t *testing.T) { + if it.address != "" { + return + } + gasPrice, err := it.sim.SuggestGasPrice(ctx) + require.NoError(t, err) + it.auth.GasPrice = gasPrice + + // 105528 was in the error: gas too low: have 0, want 105528 + // Not sure if there's a better way to get it. + it.auth.GasLimit = 1055280000 + + address, tx, ts, err := testfiles.DeployTestfiles(it.auth, it.sim) + + require.NoError(t, err) + it.sim.Commit() + it.evmTest = ts + it.incNonce() + it.awaitTx(ctx, t, tx) + it.address = address.String() +} + +func (it *chainReaderInterfaceTester) awaitTx(ctx context.Context, t *testing.T, tx *evmtypes.Transaction) { + receipt, err := it.sim.TransactionReceipt(ctx, tx.Hash()) + require.NoError(t, err) + require.Equal(t, evmtypes.ReceiptStatusSuccessful, receipt.Status) +} + +func (it *chainReaderInterfaceTester) incNonce() { + if it.auth.Nonce == nil { + it.auth.Nonce = big.NewInt(1) + } else { + it.auth.Nonce = it.auth.Nonce.Add(it.auth.Nonce, big.NewInt(1)) + } +} - testCases = append(testCases, testCase{ - name: "invalid abi", - abiInput: `broken abi`, - chainReadingDefinitions: `"TestMethod":{ - "chainSpecificName": "Swap", - "readType": 0 - }`, - expected: fmt.Errorf("invalid abi"), - }) - - testCases = append(testCases, testCase{ - name: "invalid read type", - abiInput: `{"constant":true,"inputs":[],"name":"someName","payable":false,"stateMutability":"view","type":"function"}`, - chainReadingDefinitions: `"TestMethod":{"readType": 59}`, - expected: fmt.Errorf("invalid chain reading definition read type: 59"), - }) - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - cfg, err := chainReaderTestHelper{}.makeChainReaderConfigFromStrings(tc.abiInput, tc.chainReadingDefinitions) - assert.NoError(t, err) - if tc.expected == nil { - assert.NoError(t, validateChainReaderConfig(cfg)) - } else { - assert.ErrorContains(t, validateChainReaderConfig(cfg), tc.expected.Error()) - } - }) +func getAccounts(first TestStruct) [][32]byte { + accountBytes := make([][32]byte, len(first.Accounts)) + for i, account := range first.Accounts { + accountBytes[i] = [32]byte(account) + } + return accountBytes +} + +func argsFromTestStruct(ts TestStruct) []any { + return []any{ + ts.Field, + ts.DifferentField, + uint8(ts.OracleID), + getOracleIDs(ts), + [32]byte(ts.Account), + getAccounts(ts), + ts.BigField, + midToInternalType(ts.NestedStruct), + } +} + +func getOracleIDs(first TestStruct) [32]byte { + oracleIDs := [32]byte{} + for i, oracleID := range first.OracleIDs { + oracleIDs[i] = byte(oracleID) + } + return oracleIDs +} + +func toInternalType(testStruct TestStruct) testfiles.TestStruct { + return testfiles.TestStruct{ + Field: testStruct.Field, + DifferentField: testStruct.DifferentField, + OracleId: byte(testStruct.OracleID), + OracleIds: convertOracleIDs(testStruct.OracleIDs), + Account: [32]byte(testStruct.Account), + Accounts: convertAccounts(testStruct.Accounts), + BigField: testStruct.BigField, + NestedStruct: midToInternalType(testStruct.NestedStruct), + } +} + +func midToInternalType(m MidLevelTestStruct) testfiles.MidLevelTestStruct { + return testfiles.MidLevelTestStruct{ + FixedBytes: m.FixedBytes, + Inner: testfiles.InnerTestStruct{ + I: int64(m.Inner.I), + S: m.Inner.S, + }, } } diff --git a/core/services/relay/evm/codec.go b/core/services/relay/evm/codec.go new file mode 100644 index 00000000000..f2cb447e120 --- /dev/null +++ b/core/services/relay/evm/codec.go @@ -0,0 +1,72 @@ +package evm + +import ( + "encoding/json" + + "github.com/ethereum/go-ethereum/accounts/abi" + + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" +) + +func NewCodec(conf types.CodecConfig) (commontypes.Codec, error) { + parsed := &parsedTypes{ + encoderDefs: map[string]*CodecEntry{}, + decoderDefs: map[string]*CodecEntry{}, + } + + for k, v := range conf.ChainCodecConfigs { + args := abi.Arguments{} + if err := json.Unmarshal(([]byte)(v.TypeAbi), &args); err != nil { + return nil, err + } + + item := &CodecEntry{Args: args} + if err := item.Init(); err != nil { + return nil, err + } + + parsed.encoderDefs[k] = item + parsed.decoderDefs[k] = item + } + + return codecFromTypes(parsed), nil +} + +func codecFromTypes(parsed *parsedTypes) *evmCodec { + return &evmCodec{ + encoder: &encoder{Definitions: parsed.encoderDefs}, + decoder: &decoder{Definitions: parsed.decoderDefs}, + types: parsed, + } +} + +var _ commontypes.TypeProvider = &evmCodec{} + +type evmCodec struct { + *encoder + *decoder + types *parsedTypes +} + +type parsedTypes struct { + encoderDefs map[string]*CodecEntry + decoderDefs map[string]*CodecEntry +} + +func (c *evmCodec) CreateType(itemType string, forEncoding bool) (any, error) { + var itemTypes map[string]*CodecEntry + if forEncoding { + itemTypes = c.types.encoderDefs + } else { + itemTypes = c.types.decoderDefs + } + + def, ok := itemTypes[itemType] + if !ok { + return nil, commontypes.ErrInvalidType + } + + return def.checkedType, nil +} diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go index e336c4a7d9f..4231d5b01b5 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/codec_entry.go @@ -12,9 +12,10 @@ import ( ) type CodecEntry struct { - Args abi.Arguments - checkedType reflect.Type - nativeType reflect.Type + Args abi.Arguments + encodingPrefix []byte + checkedType reflect.Type + nativeType reflect.Type } func (entry *CodecEntry) Init() error { diff --git a/core/services/relay/evm/codec_test.go b/core/services/relay/evm/codec_test.go new file mode 100644 index 00000000000..4a5d35a2870 --- /dev/null +++ b/core/services/relay/evm/codec_test.go @@ -0,0 +1,189 @@ +package evm_test + +import ( + "encoding/json" + "testing" + + "github.com/ethereum/go-ethereum/accounts/abi" + ocr2types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + . "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" //nolint common practice to import test mods with . + + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/testfiles" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" +) + +func TestCodec(t *testing.T) { + RunCodecInterfaceTests(t, &codecInterfaceTester{}) + anyN := 10 + t.Run("GetMaxEncodingSize delegates to GetMaxSize", func(t *testing.T) { + codec := getCodec(t) + + actual, err := codec.GetMaxEncodingSize(testutils.Context(t), anyN, sizeItemType) + assert.NoError(t, err) + + expected, err := evm.GetMaxSize(anyN, parseDefs(t)[sizeItemType]) + require.NoError(t, err) + assert.Equal(t, expected, actual) + }) + + t.Run("GetMaxDecodingSize delegates to GetMaxSize", func(t *testing.T) { + codec := getCodec(t) + + actual, err := codec.GetMaxDecodingSize(testutils.Context(t), anyN, sizeItemType) + assert.NoError(t, err) + + expected, err := evm.GetMaxSize(anyN, parseDefs(t)[sizeItemType]) + require.NoError(t, err) + assert.Equal(t, expected, actual) + }) +} + +type codecInterfaceTester struct{} + +func (it *codecInterfaceTester) Setup(_ *testing.T) {} + +func (it *codecInterfaceTester) Teardown(_ *testing.T) {} + +func (it *codecInterfaceTester) GetAccountBytes(i int) []byte { + account := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2} + account[i%32] += byte(i) + account[(i+3)%32] += byte(i + 3) + return account +} + +func (it *codecInterfaceTester) EncodeFields(t *testing.T, request *EncodeRequest) []byte { + if request.TestOn == TestItemType { + return encodeFieldsOnItem(t, request) + } + + return encodeFieldsOnSliceOrArray(t, request) +} + +func (it *codecInterfaceTester) GetCodec(t *testing.T) commontypes.Codec { + return getCodec(t) +} + +func (it *codecInterfaceTester) IncludeArrayEncodingSizeEnforcement() bool { + return true +} +func (it *codecInterfaceTester) Name() string { + return "EVM" +} + +func encodeFieldsOnItem(t *testing.T, request *EncodeRequest) ocr2types.Report { + return packArgs(t, argsFromTestStruct(request.TestStructs[0]), parseDefs(t)[TestItemType], request) +} + +func encodeFieldsOnSliceOrArray(t *testing.T, request *EncodeRequest) []byte { + oargs := parseDefs(t)[request.TestOn] + args := make([]any, 1) + + switch request.TestOn { + case TestItemArray1Type: + args[0] = [1]testfiles.TestStruct{toInternalType(request.TestStructs[0])} + case TestItemArray2Type: + args[0] = [2]testfiles.TestStruct{toInternalType(request.TestStructs[0]), toInternalType(request.TestStructs[1])} + default: + tmp := make([]testfiles.TestStruct, len(request.TestStructs)) + for i, ts := range request.TestStructs { + tmp[i] = toInternalType(ts) + } + args[0] = tmp + } + + return packArgs(t, args, oargs, request) +} + +func packArgs(t *testing.T, allArgs []any, oargs abi.Arguments, request *EncodeRequest) []byte { + // extra capacity in case we add an argument + args := make(abi.Arguments, len(oargs), len(oargs)+1) + copy(args, oargs) + // decoding has extra field to decode + if request.ExtraField { + fakeType, err := abi.NewType("int32", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + args = append(args, abi.Argument{Name: "FakeField", Type: fakeType}) + allArgs = append(allArgs, 11) + } + + if request.MissingField { + args = args[1:] //nolint we know it's non-zero len + allArgs = allArgs[1:] //nolint we know it's non-zero len + } + + bytes, err := args.Pack(allArgs...) + require.NoError(t, err) + return bytes +} + +var inner = []abi.ArgumentMarshaling{ + {Name: "I", Type: "int64"}, + {Name: "S", Type: "string"}, +} + +var nested = []abi.ArgumentMarshaling{ + {Name: "FixedBytes", Type: "bytes2"}, + {Name: "Inner", Type: "tuple", Components: inner}, +} + +var ts = []abi.ArgumentMarshaling{ + {Name: "Field", Type: "int32"}, + {Name: "DifferentField", Type: "string"}, + {Name: "OracleId", Type: "uint8"}, + {Name: "OracleIds", Type: "uint8[32]"}, + {Name: "Account", Type: "bytes32"}, + {Name: "Accounts", Type: "bytes32[]"}, + {Name: "BigField", Type: "int192"}, + {Name: "NestedStruct", Type: "tuple", Components: nested}, +} + +const sizeItemType = "item for size" + +var codecDefs = map[string][]abi.ArgumentMarshaling{ + TestItemType: ts, + TestItemSliceType: { + {Name: "", Type: "tuple[]", Components: ts}, + }, + TestItemArray1Type: { + {Name: "", Type: "tuple[1]", Components: ts}, + }, + TestItemArray2Type: { + {Name: "", Type: "tuple[2]", Components: ts}, + }, + sizeItemType: { + {Name: "Stuff", Type: "int256[]"}, + {Name: "OtherStuff", Type: "int256"}, + }, +} + +func getCodec(t require.TestingT) commontypes.Codec { + codecConfig := types.CodecConfig{ + ChainCodecConfigs: map[string]types.ChainCodedConfig{}, + } + + for k, v := range codecDefs { + defBytes, err := json.Marshal(v) + require.NoError(t, err) + entry := codecConfig.ChainCodecConfigs[k] + entry.TypeAbi = string(defBytes) + codecConfig.ChainCodecConfigs[k] = entry + } + + codec, err := evm.NewCodec(codecConfig) + require.NoError(t, err) + return codec +} + +func parseDefs(t *testing.T) map[string]abi.Arguments { + bytes, err := json.Marshal(codecDefs) + require.NoError(t, err) + var results map[string]abi.Arguments + require.NoError(t, json.Unmarshal(bytes, &results)) + return results +} diff --git a/core/services/relay/evm/decoder.go b/core/services/relay/evm/decoder.go new file mode 100644 index 00000000000..867f9c5037a --- /dev/null +++ b/core/services/relay/evm/decoder.go @@ -0,0 +1,85 @@ +package evm + +import ( + "context" + "reflect" + + "github.com/mitchellh/mapstructure" + + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" +) + +type decoder struct { + Definitions map[string]*CodecEntry +} + +var _ commontypes.Decoder = &decoder{} + +func (m *decoder) Decode(ctx context.Context, raw []byte, into any, itemType string) error { + info, ok := m.Definitions[itemType] + if !ok { + return commontypes.ErrInvalidType + } + + decode, err := extractDecoding(info, raw) + if err != nil { + return err + } + + rDecode := reflect.ValueOf(decode) + switch rDecode.Kind() { + case reflect.Array: + iInto := reflect.Indirect(reflect.ValueOf(into)) + length := rDecode.Len() + if length != iInto.Len() { + return commontypes.ErrWrongNumberOfElements + } + iInto.Set(reflect.New(iInto.Type()).Elem()) + return setElements(length, rDecode, iInto) + case reflect.Slice: + iInto := reflect.Indirect(reflect.ValueOf(into)) + length := rDecode.Len() + iInto.Set(reflect.MakeSlice(iInto.Type(), length, length)) + return setElements(length, rDecode, iInto) + default: + return mapstructureDecode(decode, into) + } +} + +func (m *decoder) GetMaxDecodingSize(ctx context.Context, n int, itemType string) (int, error) { + return m.Definitions[itemType].GetMaxSize(n) +} + +func extractDecoding(info *CodecEntry, raw []byte) (any, error) { + unpacked := map[string]any{} + if err := info.Args.UnpackIntoMap(unpacked, raw); err != nil { + return nil, commontypes.ErrInvalidEncoding + } + var decode any = unpacked + + if noName, ok := unpacked[""]; ok { + decode = noName + } + return decode, nil +} + +func setElements(length int, rDecode reflect.Value, iInto reflect.Value) error { + for i := 0; i < length; i++ { + if err := mapstructureDecode(rDecode.Index(i).Interface(), iInto.Index(i).Addr().Interface()); err != nil { + return err + } + } + + return nil +} + +func mapstructureDecode(src, dest any) error { + mDecoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ + DecodeHook: evmDecoderHook, + Result: dest, + }) + if err != nil || mDecoder.Decode(src) != nil { + return commontypes.ErrInvalidType + } + return nil +} diff --git a/core/services/relay/evm/encoder.go b/core/services/relay/evm/encoder.go new file mode 100644 index 00000000000..699796a31eb --- /dev/null +++ b/core/services/relay/evm/encoder.go @@ -0,0 +1,141 @@ +package evm + +import ( + "context" + "math/big" + "reflect" + + "github.com/mitchellh/mapstructure" + ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + + "github.com/smartcontractkit/chainlink-common/pkg/codec" + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" +) + +type encoder struct { + Definitions map[string]*CodecEntry +} + +var evmDecoderHook = mapstructure.ComposeDecodeHookFunc(codec.BigIntHook, codec.SliceToArrayVerifySizeHook, sizeVerifyBigIntHook) + +var _ commontypes.Encoder = &encoder{} + +func (e *encoder) Encode(ctx context.Context, item any, itemType string) ([]byte, error) { + info, ok := e.Definitions[itemType] + if !ok { + return nil, commontypes.ErrInvalidType + } + + if item == nil { + cpy := make([]byte, len(info.encodingPrefix)) + copy(cpy, info.encodingPrefix) + return cpy, nil + } + + return encode(reflect.ValueOf(item), info) +} + +func (e *encoder) GetMaxEncodingSize(ctx context.Context, n int, itemType string) (int, error) { + return e.Definitions[itemType].GetMaxSize(n) +} + +func encode(item reflect.Value, info *CodecEntry) (ocrtypes.Report, error) { + iType := item.Type() + for iType.Kind() == reflect.Pointer { + iType = iType.Elem() + } + switch iType.Kind() { + case reflect.Pointer: + return encode(item.Elem(), info) + case reflect.Array, reflect.Slice: + return encodeArray(item, info) + case reflect.Struct, reflect.Map: + return encodeItem(item, info) + default: + return nil, commontypes.ErrInvalidEncoding + } +} + +func encodeArray(item reflect.Value, info *CodecEntry) (ocrtypes.Report, error) { + length := item.Len() + var native reflect.Value + switch info.checkedType.Kind() { + case reflect.Array: + if info.checkedType.Len() != length { + return nil, commontypes.ErrWrongNumberOfElements + } + native = reflect.New(info.nativeType).Elem() + case reflect.Slice: + native = reflect.MakeSlice(info.nativeType, length, length) + default: + return nil, commontypes.ErrInvalidType + } + + checkedElm := info.checkedType.Elem() + nativeElm := info.nativeType.Elem() + for i := 0; i < length; i++ { + tmp := reflect.New(checkedElm) + if err := mapstructureDecode(item.Index(i).Interface(), tmp.Interface()); err != nil { + return nil, err + } + native.Index(i).Set(reflect.NewAt(nativeElm, tmp.UnsafePointer()).Elem()) + } + + return pack(info, native.Interface()) +} + +func encodeItem(item reflect.Value, info *CodecEntry) (ocrtypes.Report, error) { + if item.Type() == reflect.PointerTo(info.checkedType) { + item = reflect.NewAt(info.nativeType, item.UnsafePointer()) + } else if item.Type() != reflect.PointerTo(info.nativeType) { + checked := reflect.New(info.checkedType) + if err := mapstructureDecode(item.Interface(), checked.Interface()); err != nil { + return nil, err + } + item = reflect.NewAt(info.nativeType, checked.UnsafePointer()) + } + + item = reflect.Indirect(item) + length := item.NumField() + values := make([]any, length) + iType := item.Type() + for i := 0; i < length; i++ { + if iType.Field(i).IsExported() { + values[i] = item.Field(i).Interface() + } + } + + return pack(info, values...) +} + +func pack(info *CodecEntry, values ...any) (ocrtypes.Report, error) { + if bytes, err := info.Args.Pack(values...); err == nil { + withPrefix := make([]byte, 0, len(info.encodingPrefix)+len(bytes)) + withPrefix = append(withPrefix, info.encodingPrefix...) + return append(withPrefix, bytes...), nil + } + + return nil, commontypes.ErrInvalidType +} + +func sizeVerifyBigIntHook(from, to reflect.Type, data any) (any, error) { + if !to.Implements(types.SizedBigIntType()) { + return data, nil + } + + var err error + data, err = codec.BigIntHook(from, reflect.TypeOf((*big.Int)(nil)), data) + if err != nil { + return nil, err + } + + bi, ok := data.(*big.Int) + if !ok { + return data, nil + } + + converted := reflect.ValueOf(bi).Convert(to).Interface().(types.SizedBigInt) + return converted, converted.Verify() +} diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index d57cc176642..a269dbdf37b 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -55,6 +55,7 @@ type Relayer struct { eventBroadcaster pg.EventBroadcaster pgCfg pg.QConfig chainReader commontypes.ChainReader + codec commontypes.Codec } type CSAETHKeystore interface { @@ -190,7 +191,7 @@ func (r *Relayer) NewMercuryProvider(rargs commontypes.RelayArgs, pargs commonty } transmitter := mercury.NewTransmitter(lggr, cw.ContractConfigTracker(), client, privKey.PublicKey, rargs.JobID, *relayConfig.FeedID, r.db, r.pgCfg, transmitterCodec) - return NewMercuryProvider(cw, r.chainReader, NewMercuryChainReader(r.chain.HeadTracker()), transmitter, reportCodecV1, reportCodecV2, reportCodecV3, lggr), nil + return NewMercuryProvider(cw, r.chainReader, r.codec, NewMercuryChainReader(r.chain.HeadTracker()), transmitter, reportCodecV1, reportCodecV2, reportCodecV3, lggr), nil } func (r *Relayer) NewFunctionsProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.FunctionsProvider, error) { @@ -505,7 +506,6 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp if !common.IsHexAddress(relayOpts.ContractID) { return nil, fmt.Errorf("invalid contractID %s, expected hex address", relayOpts.ContractID) } - contractID := common.HexToAddress(relayOpts.ContractID) configWatcher, err := newConfigProvider(lggr, r.chain, relayOpts, r.eventBroadcaster) if err != nil { @@ -533,7 +533,7 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp // allow fallback until chain reader is default and median contract is removed, but still log just in case var chainReaderService commontypes.ChainReader if relayConfig.ChainReader != nil { - if chainReaderService, err = NewChainReaderService(lggr, r.chain.LogPoller(), contractID, *relayConfig.ChainReader); err != nil { + if chainReaderService, err = NewChainReaderService(lggr, r.chain.LogPoller(), r.chain, *relayConfig.ChainReader); err != nil { return nil, err } } else { @@ -541,6 +541,15 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp } medianProvider.chainReader = chainReaderService + if relayConfig.Codec != nil { + medianProvider.codec, err = NewCodec(*relayConfig.Codec) + if err != nil { + return nil, err + } + } else { + lggr.Info("Codec missing from RelayConfig; falling back to internal MedianContract") + } + return &medianProvider, nil } @@ -552,6 +561,7 @@ type medianProvider struct { reportCodec median.ReportCodec medianContract *medianContract chainReader commontypes.ChainReader + codec commontypes.Codec ms services.MultiStart } @@ -604,3 +614,7 @@ func (p *medianProvider) ContractConfigTracker() ocrtypes.ContractConfigTracker func (p *medianProvider) ChainReader() commontypes.ChainReader { return p.chainReader } + +func (p *medianProvider) Codec() commontypes.Codec { + return p.codec +} diff --git a/core/services/relay/evm/functions.go b/core/services/relay/evm/functions.go index 7c39c08a0be..8b0124c93a9 100644 --- a/core/services/relay/evm/functions.go +++ b/core/services/relay/evm/functions.go @@ -90,6 +90,10 @@ func (p *functionsProvider) ChainReader() commontypes.ChainReader { return nil } +func (p *functionsProvider) Codec() commontypes.Codec { + return nil +} + func NewFunctionsProvider(chain evm.Chain, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs, lggr logger.Logger, ethKeystore keystore.Eth, pluginType functionsRelay.FunctionsPluginType) (evmRelayTypes.FunctionsProvider, error) { relayOpts := evmRelayTypes.NewRelayOpts(rargs) relayConfig, err := relayOpts.RelayConfig() diff --git a/core/services/relay/evm/mercury_provider.go b/core/services/relay/evm/mercury_provider.go index 9e25597291f..59d57a4920e 100644 --- a/core/services/relay/evm/mercury_provider.go +++ b/core/services/relay/evm/mercury_provider.go @@ -24,6 +24,7 @@ var _ commontypes.MercuryProvider = (*mercuryProvider)(nil) type mercuryProvider struct { configWatcher *configWatcher chainReader commontypes.ChainReader + codec commontypes.Codec mercuryChainReader relaymercury.ChainReader transmitter mercury.Transmitter reportCodecV1 relaymercuryv1.ReportCodec @@ -37,6 +38,7 @@ type mercuryProvider struct { func NewMercuryProvider( configWatcher *configWatcher, chainReader commontypes.ChainReader, + codec commontypes.Codec, mercuryChainReader relaymercury.ChainReader, transmitter mercury.Transmitter, reportCodecV1 relaymercuryv1.ReportCodec, @@ -47,6 +49,7 @@ func NewMercuryProvider( return &mercuryProvider{ configWatcher, chainReader, + codec, mercuryChainReader, transmitter, reportCodecV1, @@ -84,6 +87,10 @@ func (p *mercuryProvider) MercuryChainReader() relaymercury.ChainReader { return p.mercuryChainReader } +func (p *mercuryProvider) Codec() commontypes.Codec { + return p.codec +} + func (p *mercuryProvider) ContractConfigTracker() ocrtypes.ContractConfigTracker { return p.configWatcher.ContractConfigTracker() } diff --git a/core/services/relay/evm/ocr2keeper.go b/core/services/relay/evm/ocr2keeper.go index 9e056e8b983..b15436e0c79 100644 --- a/core/services/relay/evm/ocr2keeper.go +++ b/core/services/relay/evm/ocr2keeper.go @@ -134,6 +134,10 @@ func (c *ocr2keeperProvider) ChainReader() commontypes.ChainReader { return nil } +func (c *ocr2keeperProvider) Codec() commontypes.Codec { + return nil +} + func newOCR2KeeperConfigProvider(lggr logger.Logger, chain evm.Chain, rargs commontypes.RelayArgs) (*configWatcher, error) { var relayConfig types.RelayConfig err := json.Unmarshal(rargs.RelayConfig, &relayConfig) diff --git a/core/services/relay/evm/ocr2vrf.go b/core/services/relay/evm/ocr2vrf.go index f4d695b4cd1..9a6608b8498 100644 --- a/core/services/relay/evm/ocr2vrf.go +++ b/core/services/relay/evm/ocr2vrf.go @@ -114,6 +114,10 @@ func (c *dkgProvider) ChainReader() commontypes.ChainReader { return nil } +func (c *dkgProvider) Codec() commontypes.Codec { + return nil +} + type ocr2vrfProvider struct { *configWatcher contractTransmitter ContractTransmitter @@ -127,6 +131,10 @@ func (c *ocr2vrfProvider) ChainReader() commontypes.ChainReader { return nil } +func (c *ocr2vrfProvider) Codec() commontypes.Codec { + return nil +} + func newOCR2VRFConfigProvider(lggr logger.Logger, chain evm.Chain, rargs commontypes.RelayArgs) (*configWatcher, error) { var relayConfig types.RelayConfig err := json.Unmarshal(rargs.RelayConfig, &relayConfig) diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract.sol b/core/services/relay/evm/testfiles/chain_reader_test_contract.sol new file mode 100644 index 00000000000..ec38c20678a --- /dev/null +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract.sol @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8; + +struct TestStruct { + int32 Field; + string DifferentField; + uint8 OracleId; + uint8[32] OracleIds; + bytes32 Account; + bytes32[] Accounts; + int192 BigField; + MidLevelTestStruct NestedStruct; +} + +struct MidLevelTestStruct { + bytes2 FixedBytes; + InnerTestStruct Inner; +} + +struct InnerTestStruct { + int64 I; + string S; +} + +contract LatestValueHolder { + TestStruct[] private seen; + uint64[] private arr; + + constructor() { + // See chain_reader_interface_tests.go in chainlink-relay + arr.push(3); + arr.push(4); + } + + function AddTestStruct( + int32 field, + string calldata differentField, + uint8 oracleId, + uint8[32] calldata oracleIds, + bytes32 account, + bytes32[] calldata accounts, + int192 bigField, + MidLevelTestStruct calldata nestedStruct) public { + seen.push(TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct)); + } + + function GetElementAtIndex(uint256 i) public view returns (TestStruct memory) { + // See chain_reader_interface_tests.go in chainlink-relay + return seen[i-1]; + } + + function GetPrimitiveValue() public pure returns (uint64) { + // See chain_reader_interface_tests.go in chainlink-relay + return 3; + } + + function GetSliceValue() public view returns (uint64[] memory) { + return arr; + } +} \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi new file mode 100644 index 00000000000..6f73e9feb88 --- /dev/null +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi @@ -0,0 +1 @@ +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"AddTestStruct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"GetElementAtIndex","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GetPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"GetSliceValue","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin new file mode 100644 index 00000000000..90c9f543f97 --- /dev/null +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin @@ -0,0 +1 @@ +608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a918202910219909216919091179055610e4d806100a96000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80637dd6af5b146100515780639ca04f6714610066578063bdb37c901461008f578063da8e7a82146100a4575b600080fd5b61006461005f366004610921565b6100b3565b005b610079610074366004610a0c565b6102e2565b6040516100869190610b71565b60405180910390f35b610097610592565b6040516100869190610b23565b60405160038152602001610086565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161018d84610cb2565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936101e49392850192919091019061061e565b50604082015160028201805460ff191660ff909216919091179055606082015161021490600383019060206106a2565b506080820151600482015560a0820151805161023a916005840191602090910190610730565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff199091161783558082015180519193926102cf9260098901929091019061061e565b5050505050505050505050505050505050565b6102ea61076a565b60006102f7600184610c8d565b8154811061030757610307610deb565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461034e90610db6565b80601f016020809104026020016040519081016040528092919081815260200182805461037a90610db6565b80156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116103fc57905050505050508152602001600482015481526020016005820180548060200260200160405190810160405280929190818152602001828054801561048c57602002820191906000526020600020905b815481526020019060010190808311610478575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061050390610db6565b80601f016020809104026020016040519081016040528092919081815260200182805461052f90610db6565b801561057c5780601f106105515761010080835404028352916020019161057c565b820191906000526020600020905b81548152906001019060200180831161055f57829003601f168201915b5050509190925250505090525090525092915050565b6060600180548060200260200160405190810160405280929190818152602001828054801561061457602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116105cf5790505b5050505050905090565b82805461062a90610db6565b90600052602060002090601f01602090048101928261064c5760008555610692565b82601f1061066557805160ff1916838001178555610692565b82800160010185558215610692579182015b82811115610692578251825591602001919060010190610677565b5061069e9291506107b9565b5090565b6001830191839082156106925791602002820160005b838211156106f657835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026106b8565b80156107235782816101000a81549060ff02191690556001016020816000010492830192600103026106f6565b505061069e9291506107b9565b8280548282559060005260206000209081019282156106925791602002820182811115610692578251825591602001919060010190610677565b60408051610100810182526000808252606060208301819052928201529081016107926107ce565b81526000602082018190526060604083018190528201526080016107b46107ed565b905290565b5b8082111561069e57600081556001016107ba565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016107b46040518060400160405280600060070b8152602001606081525090565b60008083601f84011261083b57600080fd5b50813567ffffffffffffffff81111561085357600080fd5b6020830191508360208260051b850101111561086e57600080fd5b9250929050565b80610400810183101561088757600080fd5b92915050565b8035601781900b811461089f57600080fd5b919050565b8035600381900b811461089f57600080fd5b60008083601f8401126108c857600080fd5b50813567ffffffffffffffff8111156108e057600080fd5b60208301915083602082850101111561086e57600080fd5b60006040828403121561090a57600080fd5b50919050565b803560ff8116811461089f57600080fd5b6000806000806000806000806000806104e08b8d03121561094157600080fd5b61094a8b6108a4565b995060208b013567ffffffffffffffff8082111561096757600080fd5b6109738e838f016108b6565b909b50995089915061098760408e01610910565b98506109968e60608f01610875565b97506104608d013596506104808d01359150808211156109b557600080fd5b6109c18e838f01610829565b90965094508491506109d66104a08e0161088d565b93506104c08d01359150808211156109ed57600080fd5b506109fa8d828e016108f8565b9150509295989b9194979a5092959850565b600060208284031215610a1e57600080fd5b5035919050565b600081518084526020808501945080840160005b83811015610a5557815187529582019590820190600101610a39565b509495945050505050565b8060005b6020808210610a735750610a8a565b825160ff1685529384019390910190600101610a64565b50505050565b6000815180845260005b81811015610ab657602081850181015186830182015201610a9a565b81811115610ac8576000602083870101525b50601f01601f19169290920160200192915050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610b1b6080850182610a90565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610b6557835167ffffffffffffffff1683529284019291840191600101610b3f565b50909695505050505050565b60208152610b8560208201835160030b9052565b600060208301516104e0806040850152610ba3610500850183610a90565b91506040850151610bb9606086018260ff169052565b506060850151610bcc6080860182610a60565b50608085015161048085015260a0850151601f1980868503016104a0870152610bf58483610a25565b935060c08701519150610c0e6104c087018360170b9052565b60e0870151915080868503018387015250610c298382610add565b9695505050505050565b6040805190810167ffffffffffffffff81118282101715610c5657610c56610e01565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610c8557610c85610e01565b604052919050565b600082821015610cad57634e487b7160e01b600052601160045260246000fd5b500390565b600060408236031215610cc457600080fd5b610ccc610c33565b82356001600160f01b031981168114610ce457600080fd5b815260208381013567ffffffffffffffff80821115610d0257600080fd5b818601915060408236031215610d1757600080fd5b610d1f610c33565b82358060070b8114610d3057600080fd5b81528284013582811115610d4357600080fd5b929092019136601f840112610d5757600080fd5b823582811115610d6957610d69610e01565b610d7b601f8201601f19168601610c5c565b92508083523685828601011115610d9157600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c90821680610dca57607f821691505b6020821081141561090a57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212206d3fcd0d6af66016f39be3d9948d2703697b0dfdbab6f47b494ab3d1f3d0d4c264736f6c63430008060033 \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go new file mode 100644 index 00000000000..2a8ee83e145 --- /dev/null +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go @@ -0,0 +1,341 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package testfiles + +import ( + "errors" + "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" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// InnerTestStruct is an auto generated low-level Go binding around an user-defined struct. +type InnerTestStruct struct { + I int64 + S string +} + +// MidLevelTestStruct is an auto generated low-level Go binding around an user-defined struct. +type MidLevelTestStruct struct { + FixedBytes [2]byte + Inner InnerTestStruct +} + +// TestStruct is an auto generated low-level Go binding around an user-defined struct. +type TestStruct struct { + Field int32 + DifferentField string + OracleId uint8 + OracleIds [32]uint8 + Account [32]byte + Accounts [][32]byte + BigField *big.Int + NestedStruct MidLevelTestStruct +} + +// TestfilesMetaData contains all meta data concerning the Testfiles contract. +var TestfilesMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a918202910219909216919091179055610e4d806100a96000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80637dd6af5b146100515780639ca04f6714610066578063bdb37c901461008f578063da8e7a82146100a4575b600080fd5b61006461005f366004610921565b6100b3565b005b610079610074366004610a0c565b6102e2565b6040516100869190610b71565b60405180910390f35b610097610592565b6040516100869190610b23565b60405160038152602001610086565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161018d84610cb2565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936101e49392850192919091019061061e565b50604082015160028201805460ff191660ff909216919091179055606082015161021490600383019060206106a2565b506080820151600482015560a0820151805161023a916005840191602090910190610730565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff199091161783558082015180519193926102cf9260098901929091019061061e565b5050505050505050505050505050505050565b6102ea61076a565b60006102f7600184610c8d565b8154811061030757610307610deb565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461034e90610db6565b80601f016020809104026020016040519081016040528092919081815260200182805461037a90610db6565b80156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116103fc57905050505050508152602001600482015481526020016005820180548060200260200160405190810160405280929190818152602001828054801561048c57602002820191906000526020600020905b815481526020019060010190808311610478575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061050390610db6565b80601f016020809104026020016040519081016040528092919081815260200182805461052f90610db6565b801561057c5780601f106105515761010080835404028352916020019161057c565b820191906000526020600020905b81548152906001019060200180831161055f57829003601f168201915b5050509190925250505090525090525092915050565b6060600180548060200260200160405190810160405280929190818152602001828054801561061457602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116105cf5790505b5050505050905090565b82805461062a90610db6565b90600052602060002090601f01602090048101928261064c5760008555610692565b82601f1061066557805160ff1916838001178555610692565b82800160010185558215610692579182015b82811115610692578251825591602001919060010190610677565b5061069e9291506107b9565b5090565b6001830191839082156106925791602002820160005b838211156106f657835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026106b8565b80156107235782816101000a81549060ff02191690556001016020816000010492830192600103026106f6565b505061069e9291506107b9565b8280548282559060005260206000209081019282156106925791602002820182811115610692578251825591602001919060010190610677565b60408051610100810182526000808252606060208301819052928201529081016107926107ce565b81526000602082018190526060604083018190528201526080016107b46107ed565b905290565b5b8082111561069e57600081556001016107ba565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016107b46040518060400160405280600060070b8152602001606081525090565b60008083601f84011261083b57600080fd5b50813567ffffffffffffffff81111561085357600080fd5b6020830191508360208260051b850101111561086e57600080fd5b9250929050565b80610400810183101561088757600080fd5b92915050565b8035601781900b811461089f57600080fd5b919050565b8035600381900b811461089f57600080fd5b60008083601f8401126108c857600080fd5b50813567ffffffffffffffff8111156108e057600080fd5b60208301915083602082850101111561086e57600080fd5b60006040828403121561090a57600080fd5b50919050565b803560ff8116811461089f57600080fd5b6000806000806000806000806000806104e08b8d03121561094157600080fd5b61094a8b6108a4565b995060208b013567ffffffffffffffff8082111561096757600080fd5b6109738e838f016108b6565b909b50995089915061098760408e01610910565b98506109968e60608f01610875565b97506104608d013596506104808d01359150808211156109b557600080fd5b6109c18e838f01610829565b90965094508491506109d66104a08e0161088d565b93506104c08d01359150808211156109ed57600080fd5b506109fa8d828e016108f8565b9150509295989b9194979a5092959850565b600060208284031215610a1e57600080fd5b5035919050565b600081518084526020808501945080840160005b83811015610a5557815187529582019590820190600101610a39565b509495945050505050565b8060005b6020808210610a735750610a8a565b825160ff1685529384019390910190600101610a64565b50505050565b6000815180845260005b81811015610ab657602081850181015186830182015201610a9a565b81811115610ac8576000602083870101525b50601f01601f19169290920160200192915050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610b1b6080850182610a90565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610b6557835167ffffffffffffffff1683529284019291840191600101610b3f565b50909695505050505050565b60208152610b8560208201835160030b9052565b600060208301516104e0806040850152610ba3610500850183610a90565b91506040850151610bb9606086018260ff169052565b506060850151610bcc6080860182610a60565b50608085015161048085015260a0850151601f1980868503016104a0870152610bf58483610a25565b935060c08701519150610c0e6104c087018360170b9052565b60e0870151915080868503018387015250610c298382610add565b9695505050505050565b6040805190810167ffffffffffffffff81118282101715610c5657610c56610e01565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610c8557610c85610e01565b604052919050565b600082821015610cad57634e487b7160e01b600052601160045260246000fd5b500390565b600060408236031215610cc457600080fd5b610ccc610c33565b82356001600160f01b031981168114610ce457600080fd5b815260208381013567ffffffffffffffff80821115610d0257600080fd5b818601915060408236031215610d1757600080fd5b610d1f610c33565b82358060070b8114610d3057600080fd5b81528284013582811115610d4357600080fd5b929092019136601f840112610d5757600080fd5b823582811115610d6957610d69610e01565b610d7b601f8201601f19168601610c5c565b92508083523685828601011115610d9157600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c90821680610dca57607f821691505b6020821081141561090a57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212206d3fcd0d6af66016f39be3d9948d2703697b0dfdbab6f47b494ab3d1f3d0d4c264736f6c63430008060033", +} + +// TestfilesABI is the input ABI used to generate the binding from. +// Deprecated: Use TestfilesMetaData.ABI instead. +var TestfilesABI = TestfilesMetaData.ABI + +// TestfilesBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use TestfilesMetaData.Bin instead. +var TestfilesBin = TestfilesMetaData.Bin + +// DeployTestfiles deploys a new Ethereum contract, binding an instance of Testfiles to it. +func DeployTestfiles(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Testfiles, error) { + parsed, err := TestfilesMetaData.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(TestfilesBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &Testfiles{TestfilesCaller: TestfilesCaller{contract: contract}, TestfilesTransactor: TestfilesTransactor{contract: contract}, TestfilesFilterer: TestfilesFilterer{contract: contract}}, nil +} + +// Testfiles is an auto generated Go binding around an Ethereum contract. +type Testfiles struct { + TestfilesCaller // Read-only binding to the contract + TestfilesTransactor // Write-only binding to the contract + TestfilesFilterer // Log filterer for contract events +} + +// TestfilesCaller is an auto generated read-only Go binding around an Ethereum contract. +type TestfilesCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TestfilesTransactor is an auto generated write-only Go binding around an Ethereum contract. +type TestfilesTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TestfilesFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type TestfilesFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TestfilesSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type TestfilesSession struct { + Contract *Testfiles // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// TestfilesCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type TestfilesCallerSession struct { + Contract *TestfilesCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// TestfilesTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type TestfilesTransactorSession struct { + Contract *TestfilesTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// TestfilesRaw is an auto generated low-level Go binding around an Ethereum contract. +type TestfilesRaw struct { + Contract *Testfiles // Generic contract binding to access the raw methods on +} + +// TestfilesCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type TestfilesCallerRaw struct { + Contract *TestfilesCaller // Generic read-only contract binding to access the raw methods on +} + +// TestfilesTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type TestfilesTransactorRaw struct { + Contract *TestfilesTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewTestfiles creates a new instance of Testfiles, bound to a specific deployed contract. +func NewTestfiles(address common.Address, backend bind.ContractBackend) (*Testfiles, error) { + contract, err := bindTestfiles(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Testfiles{TestfilesCaller: TestfilesCaller{contract: contract}, TestfilesTransactor: TestfilesTransactor{contract: contract}, TestfilesFilterer: TestfilesFilterer{contract: contract}}, nil +} + +// NewTestfilesCaller creates a new read-only instance of Testfiles, bound to a specific deployed contract. +func NewTestfilesCaller(address common.Address, caller bind.ContractCaller) (*TestfilesCaller, error) { + contract, err := bindTestfiles(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &TestfilesCaller{contract: contract}, nil +} + +// NewTestfilesTransactor creates a new write-only instance of Testfiles, bound to a specific deployed contract. +func NewTestfilesTransactor(address common.Address, transactor bind.ContractTransactor) (*TestfilesTransactor, error) { + contract, err := bindTestfiles(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &TestfilesTransactor{contract: contract}, nil +} + +// NewTestfilesFilterer creates a new log filterer instance of Testfiles, bound to a specific deployed contract. +func NewTestfilesFilterer(address common.Address, filterer bind.ContractFilterer) (*TestfilesFilterer, error) { + contract, err := bindTestfiles(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &TestfilesFilterer{contract: contract}, nil +} + +// bindTestfiles binds a generic wrapper to an already deployed contract. +func bindTestfiles(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := TestfilesMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Testfiles *TestfilesRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Testfiles.Contract.TestfilesCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Testfiles *TestfilesRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Testfiles.Contract.TestfilesTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Testfiles *TestfilesRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Testfiles.Contract.TestfilesTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Testfiles *TestfilesCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Testfiles.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Testfiles *TestfilesTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Testfiles.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Testfiles *TestfilesTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Testfiles.Contract.contract.Transact(opts, method, params...) +} + +// GetElementAtIndex is a free data retrieval call binding the contract method 0x9ca04f67. +// +// Solidity: function GetElementAtIndex(uint256 i) view returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) +func (_Testfiles *TestfilesCaller) GetElementAtIndex(opts *bind.CallOpts, i *big.Int) (TestStruct, error) { + var out []interface{} + err := _Testfiles.contract.Call(opts, &out, "GetElementAtIndex", i) + + if err != nil { + return *new(TestStruct), err + } + + out0 := *abi.ConvertType(out[0], new(TestStruct)).(*TestStruct) + + return out0, err + +} + +// GetElementAtIndex is a free data retrieval call binding the contract method 0x9ca04f67. +// +// Solidity: function GetElementAtIndex(uint256 i) view returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) +func (_Testfiles *TestfilesSession) GetElementAtIndex(i *big.Int) (TestStruct, error) { + return _Testfiles.Contract.GetElementAtIndex(&_Testfiles.CallOpts, i) +} + +// GetElementAtIndex is a free data retrieval call binding the contract method 0x9ca04f67. +// +// Solidity: function GetElementAtIndex(uint256 i) view returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) +func (_Testfiles *TestfilesCallerSession) GetElementAtIndex(i *big.Int) (TestStruct, error) { + return _Testfiles.Contract.GetElementAtIndex(&_Testfiles.CallOpts, i) +} + +// GetPrimitiveValue is a free data retrieval call binding the contract method 0xda8e7a82. +// +// Solidity: function GetPrimitiveValue() pure returns(uint64) +func (_Testfiles *TestfilesCaller) GetPrimitiveValue(opts *bind.CallOpts) (uint64, error) { + var out []interface{} + err := _Testfiles.contract.Call(opts, &out, "GetPrimitiveValue") + + if err != nil { + return *new(uint64), err + } + + out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + + return out0, err + +} + +// GetPrimitiveValue is a free data retrieval call binding the contract method 0xda8e7a82. +// +// Solidity: function GetPrimitiveValue() pure returns(uint64) +func (_Testfiles *TestfilesSession) GetPrimitiveValue() (uint64, error) { + return _Testfiles.Contract.GetPrimitiveValue(&_Testfiles.CallOpts) +} + +// GetPrimitiveValue is a free data retrieval call binding the contract method 0xda8e7a82. +// +// Solidity: function GetPrimitiveValue() pure returns(uint64) +func (_Testfiles *TestfilesCallerSession) GetPrimitiveValue() (uint64, error) { + return _Testfiles.Contract.GetPrimitiveValue(&_Testfiles.CallOpts) +} + +// GetSliceValue is a free data retrieval call binding the contract method 0xbdb37c90. +// +// Solidity: function GetSliceValue() view returns(uint64[]) +func (_Testfiles *TestfilesCaller) GetSliceValue(opts *bind.CallOpts) ([]uint64, error) { + var out []interface{} + err := _Testfiles.contract.Call(opts, &out, "GetSliceValue") + + if err != nil { + return *new([]uint64), err + } + + out0 := *abi.ConvertType(out[0], new([]uint64)).(*[]uint64) + + return out0, err + +} + +// GetSliceValue is a free data retrieval call binding the contract method 0xbdb37c90. +// +// Solidity: function GetSliceValue() view returns(uint64[]) +func (_Testfiles *TestfilesSession) GetSliceValue() ([]uint64, error) { + return _Testfiles.Contract.GetSliceValue(&_Testfiles.CallOpts) +} + +// GetSliceValue is a free data retrieval call binding the contract method 0xbdb37c90. +// +// Solidity: function GetSliceValue() view returns(uint64[]) +func (_Testfiles *TestfilesCallerSession) GetSliceValue() ([]uint64, error) { + return _Testfiles.Contract.GetSliceValue(&_Testfiles.CallOpts) +} + +// AddTestStruct is a paid mutator transaction binding the contract method 0x7dd6af5b. +// +// Solidity: function AddTestStruct(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() +func (_Testfiles *TestfilesTransactor) AddTestStruct(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { + return _Testfiles.contract.Transact(opts, "AddTestStruct", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +// AddTestStruct is a paid mutator transaction binding the contract method 0x7dd6af5b. +// +// Solidity: function AddTestStruct(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() +func (_Testfiles *TestfilesSession) AddTestStruct(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { + return _Testfiles.Contract.AddTestStruct(&_Testfiles.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +// AddTestStruct is a paid mutator transaction binding the contract method 0x7dd6af5b. +// +// Solidity: function AddTestStruct(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() +func (_Testfiles *TestfilesTransactorSession) AddTestStruct(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { + return _Testfiles.Contract.AddTestStruct(&_Testfiles.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} diff --git a/core/services/relay/evm/testfiles/chainlink_reader_test_setup.sh b/core/services/relay/evm/testfiles/chainlink_reader_test_setup.sh new file mode 100755 index 00000000000..60ddc6cdc1a --- /dev/null +++ b/core/services/relay/evm/testfiles/chainlink_reader_test_setup.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -e +# called from the directory above so cd to this directory +cd testfiles +solc --optimize --bin --abi chain_reader_test_contract.sol -o . +mv LatestValueHolder.bin chain_reader_test_contract_gen.bin +mv LatestValueHolder.abi chain_reader_test_contract_gen.abi +../../../../../tools/bin/abigen --bin=chain_reader_test_contract_gen.bin --abi=chain_reader_test_contract_gen.abi --pkg=testfiles --out=chain_reader_test_contract_gen.go diff --git a/core/services/relay/evm/types/types.go b/core/services/relay/evm/types/types.go index d9f6a56fa4e..6f3b6b5fc6f 100644 --- a/core/services/relay/evm/types/types.go +++ b/core/services/relay/evm/types/types.go @@ -20,11 +20,23 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/utils" ) +type RelayOpts struct { + // TODO BCF-2508 -- should anyone ever get the raw config bytes that are embedded in args? if not, + // make this private and wrap the arg fields with funcs on RelayOpts + commontypes.RelayArgs + c *RelayConfig +} + type ChainReaderConfig struct { // ChainContractReaders key is contract name ChainContractReaders map[string]ChainContractReader `json:"chainContractReaders"` } +type CodecConfig struct { + // ChainCodecConfigs is the type's name for the codec + ChainCodecConfigs map[string]ChainCodedConfig `json:"chainCodecConfig"` +} + type ChainCodedConfig struct { TypeAbi string `json:"typeAbi"` // TODO transform configs that allow hard-coding values or transforming them (max, min, median etc) @@ -32,7 +44,7 @@ type ChainCodedConfig struct { type ChainContractReader struct { ContractABI string `json:"contractABI"` - // ChainReaderDefinitions key is chainAgnostic read name. + // key is genericName from config ChainReaderDefinitions map[string]ChainReaderDefinition `json:"chainReaderDefinitions"` } @@ -41,7 +53,7 @@ type ChainReaderDefinition struct { Params map[string]any `json:"params"` ReturnValues []string `json:"returnValues"` CacheEnabled bool `json:"cacheEnabled"` - ReadType ReadType `json:"readType"` + ReadType `json:"readType"` } type ReadType int64 @@ -57,6 +69,7 @@ type RelayConfig struct { EffectiveTransmitterID null.String `json:"effectiveTransmitterID"` ConfigContractAddress *common.Address `json:"configContractAddress"` ChainReader *ChainReaderConfig `json:"chainReader"` + Codec *CodecConfig `json:"codec"` // Contract-specific SendingKeys pq.StringArray `json:"sendingKeys"` @@ -65,13 +78,6 @@ type RelayConfig struct { FeedID *common.Hash `json:"feedID"` } -type RelayOpts struct { - // TODO BCF-2508 -- should anyone ever get the raw config bytes that are embedded in args? if not, - // make this private and wrap the arg fields with funcs on RelayOpts - commontypes.RelayArgs - c *RelayConfig -} - var ErrBadRelayConfig = errors.New("bad relay config") func NewRelayOpts(args types.RelayArgs) *RelayOpts { diff --git a/go.mod b/go.mod index c1f7d4aa28a..c7bcadcf346 100644 --- a/go.mod +++ b/go.mod @@ -66,10 +66,10 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90 - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20231107151413-13e0202ae8d7 github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 diff --git a/go.sum b/go.sum index 8e68b54f53e..71526ba239f 100644 --- a/go.sum +++ b/go.sum @@ -1468,14 +1468,14 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 h1:QLhOOIeFldRBc+ESAVZfEPrIpfeiduwnmHlvDt1iFmM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90 h1:tcnV7rhW0wC/oukNE/wPRQzC1K86YERbVaWF5KYda7g= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 h1:Q7Lif7+Hr3A1gsFooCp/StP93qVPuixn32XEllZnSdY= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a/go.mod h1:rioELYwPY2xBtzPRN/D08Y7iTPbIQEjPknYdJK51CzQ= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 h1:1GzOKT53e8N7ZPwsyf1hSbKsynZmXmLOIL3DMvGq9sc= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006/go.mod h1:tJLhL7gJ+V3+4N/yLxXIvJ0DAiuyqZCa31+2BSbw7zo= 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-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 56f87166f8e..582e102986b 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 github.com/smartcontractkit/chainlink-testing-framework v1.19.5 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 @@ -390,9 +390,9 @@ require ( github.com/shopspring/decimal v1.3.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90 // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index ee9667496fc..25680abdfe1 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2375,14 +2375,14 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7 h1:QLhOOIeFldRBc+ESAVZfEPrIpfeiduwnmHlvDt1iFmM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231123003013-379db0b9e4c7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606 h1:4RUoJlw/BEonMCkh7AuoTGBWbV+7CY8n0kpesz5tlqA= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231120072345-ec92d212f606/go.mod h1:xwuKim71kn4z+8r1MO6mjlxl3bGlGPpHnqWJW6fQsuU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90 h1:tcnV7rhW0wC/oukNE/wPRQzC1K86YERbVaWF5KYda7g= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231126115247-e39408d74e90/go.mod h1:VDRlSwdE7x/7dPIzg4mr+m80dvNm/vmub/7t9T9Mf/k= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0 h1:rWrd5VnZWpFXH/UzcGI0PxhT6u4BAuoZDBr2QBy5YNc= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231120192657-3769c7fcc8f0/go.mod h1:L2d4754c/HjL8GzzdtzaRsWUxKh1OWMx2Kd6faRf/PA= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 h1:Q7Lif7+Hr3A1gsFooCp/StP93qVPuixn32XEllZnSdY= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a/go.mod h1:rioELYwPY2xBtzPRN/D08Y7iTPbIQEjPknYdJK51CzQ= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 h1:1GzOKT53e8N7ZPwsyf1hSbKsynZmXmLOIL3DMvGq9sc= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006/go.mod h1:tJLhL7gJ+V3+4N/yLxXIvJ0DAiuyqZCa31+2BSbw7zo= github.com/smartcontractkit/chainlink-testing-framework v1.19.5 h1:Iq1L7wCA8IkBBtP3p6W2ttu8v9cJp95spusnozW1UrA= github.com/smartcontractkit/chainlink-testing-framework v1.19.5/go.mod h1:+FVgkz6phTc+piVT57AcQfr3I8xvZgZ1lOpRPOu/dLQ= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/plugins/medianpoc/plugin_test.go b/plugins/medianpoc/plugin_test.go index 4384e66d4b3..e06789309e3 100644 --- a/plugins/medianpoc/plugin_test.go +++ b/plugins/medianpoc/plugin_test.go @@ -12,6 +12,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" + "github.com/smartcontractkit/chainlink/v2/core/logger" ) @@ -75,6 +76,10 @@ func (p provider) ChainReader() types.ChainReader { return nil } +func (p provider) Codec() types.Codec { + return nil +} + func TestNewPlugin(t *testing.T) { lggr := logger.TestLogger(t) p := NewPlugin(lggr) From e24cb10399b1293b55a965b286da72e3f5611916 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 1 Dec 2023 14:39:50 -0500 Subject: [PATCH 034/112] Add modifiers to evm chain reader and codec --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 +- core/services/relay/evm/chain_reader.go | 73 ++++++++-------- core/services/relay/evm/chain_reader_test.go | 42 ++++++++-- core/services/relay/evm/codec.go | 83 ++++++++++++++----- core/services/relay/evm/codec_entry.go | 3 + core/services/relay/evm/codec_test.go | 60 ++++++++------ core/services/relay/evm/decoder.go | 3 +- core/services/relay/evm/encoder.go | 36 +------- core/services/relay/evm/parsed_types.go | 46 ++++++++++ .../testfiles/chain_reader_test_contract.sol | 12 +++ .../chain_reader_test_contract_gen.abi | 2 +- .../chain_reader_test_contract_gen.bin | 2 +- .../chain_reader_test_contract_gen.go | 35 +++++++- core/services/relay/evm/types/types.go | 15 ++-- go.mod | 2 +- go.sum | 4 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- 19 files changed, 281 insertions(+), 149 deletions(-) create mode 100644 core/services/relay/evm/parsed_types.go diff --git a/core/scripts/go.mod b/core/scripts/go.mod index c8244a77e53..124d41bee3e 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -304,7 +304,7 @@ require ( github.com/shirou/gopsutil/v3 v3.23.9 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 // indirect + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 6ba4a768b4c..1d424df98e9 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1467,8 +1467,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 h1:Q7Lif7+Hr3A1gsFooCp/StP93qVPuixn32XEllZnSdY= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606 h1:7nWx4+ZTUQkzzTnzSK8WwinuJl4IiWa3nl8hvaHYd+8= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index 77a959f813c..87a4b66f12b 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -29,7 +29,7 @@ type ChainReaderService interface { type chainReader struct { lggr logger.Logger lp logpoller.LogPoller - codec *evmCodec + codec commontypes.CodecTypeProvider client evmclient.Client } @@ -45,12 +45,14 @@ func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, chain evm return nil, err } + c, err := parsed.toCodec() + return &chainReader{ lggr: lggr.Named("ChainReader"), lp: lp, - codec: codecFromTypes(parsed), + codec: c, client: chain.Client(), - }, nil + }, err } func (cr *chainReader) Name() string { return cr.lggr.Name() } @@ -60,14 +62,10 @@ func (cr *chainReader) initialize() error { return nil } -func (cr *chainReader) CreateType(itemType string, forEncoding bool) (any, error) { - return cr.codec.CreateType(itemType, forEncoding) -} - var _ commontypes.TypeProvider = &chainReader{} func (cr *chainReader) GetLatestValue(ctx context.Context, bc commontypes.BoundContract, method string, params any, returnVal any) error { - data, err := cr.codec.Encode(ctx, params, method) + data, err := cr.codec.Encode(ctx, params, wrapItemType(method, true)) if err != nil { return err } @@ -85,7 +83,7 @@ func (cr *chainReader) GetLatestValue(ctx context.Context, bc commontypes.BoundC return err } - return cr.codec.Decode(ctx, output, returnVal, method) + return cr.codec.Decode(ctx, output, returnVal, wrapItemType(method, false)) } func (cr *chainReader) Start(ctx context.Context) error { @@ -101,17 +99,17 @@ func (cr *chainReader) HealthReport() map[string]error { return map[string]error{cr.Name(): nil} } +func (cr *chainReader) CreateType(itemType string, forEncoding bool) (any, error) { + return cr.codec.CreateType(wrapItemType(itemType, forEncoding), forEncoding) +} + func addEventTypes(name string, contractABI abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) error { event, methodExists := contractABI.Events[chainReaderDefinition.ChainSpecificName] if !methodExists { return fmt.Errorf("method: %s doesn't exist", chainReaderDefinition.ChainSpecificName) } - if err := addOverrides(chainReaderDefinition, event.Inputs); err != nil { - return err - } - - return addDecoderDef(name, event.Inputs, parsed) + return addDecoderDef(name, event.Inputs, parsed, chainReaderDefinition) } func addMethods(name string, abi abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) error { @@ -120,41 +118,31 @@ func addMethods(name string, abi abi.ABI, chainReaderDefinition types.ChainReade return fmt.Errorf("method: %q doesn't exist", chainReaderDefinition.ChainSpecificName) } - if err := addOverrides(chainReaderDefinition, method.Inputs); err != nil { - return err - } - // ABI.Pack prepends the method.ID to the encodings, we'll need the encoder to do the same. input := &CodecEntry{Args: method.Inputs, encodingPrefix: method.ID} if err := input.Init(); err != nil { return err } - parsed.encoderDefs[name] = input - return addDecoderDef(name, method.Outputs, parsed) -} + inputMod, err := chainReaderDefinition.InputModifications.ToModifier(evmDecoderHooks...) + if err != nil { + return err + } + input.mod = inputMod + parsed.encoderDefs[wrapItemType(name, true)] = input -func addDecoderDef(name string, outputs abi.Arguments, parsed *parsedTypes) error { - output := &CodecEntry{Args: outputs} - parsed.decoderDefs[name] = output - return output.Init() + return addDecoderDef(name, method.Outputs, parsed, chainReaderDefinition) } -func addOverrides(chainReaderDefinition types.ChainReaderDefinition, inputs abi.Arguments) error { - // TODO add transforms to add params artificially -paramsLoop: - for argName, param := range chainReaderDefinition.Params { - // TODO add type check too - _ = param - for _, input := range inputs { - if argName == input.Name { - continue paramsLoop - } - } - return fmt.Errorf("cannot find parameter %v in %v", argName, chainReaderDefinition.ChainSpecificName) +func addDecoderDef(name string, outputs abi.Arguments, parsed *parsedTypes, def types.ChainReaderDefinition) error { + output := &CodecEntry{Args: outputs} + mod, err := def.OutputModifications.ToModifier(evmDecoderHooks...) + if err != nil { + return err } - - return nil + output.mod = mod + parsed.decoderDefs[wrapItemType(name, false)] = output + return output.Init() } func addTypes(chainContractReaders map[string]types.ChainContractReader, parsed *parsedTypes) error { @@ -181,3 +169,10 @@ func addTypes(chainContractReaders map[string]types.ChainContractReader, parsed return nil } + +func wrapItemType(itemType string, isParams bool) string { + if isParams { + return fmt.Sprintf("params.%s", itemType) + } + return fmt.Sprintf("return.%s", itemType) +} diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 5e770841eb5..81fb0e3d8be 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -11,18 +11,20 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core" evmtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/smartcontractkit/libocr/commontypes" "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink-common/pkg/codec" + clcommontypes "github.com/smartcontractkit/chainlink-common/pkg/types" . "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" //nolint common practice to import test mods with . - mocklogpoller "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" + mocklogpoller "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/mocks" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" @@ -31,6 +33,8 @@ import ( ) const commonGasLimitOnEvms = uint64(4712388) +const chainReaderContractName = "LatestValueHolder" +const returnSeenName = "ReturnSeen" func TestChainReader(t *testing.T) { RunChainReaderInterfaceTests(t, &chainReaderInterfaceTester{}) @@ -47,13 +51,10 @@ type chainReaderInterfaceTester struct { } func (it *chainReaderInterfaceTester) Setup(t *testing.T) { - if it.chain == nil { - it.setupNoClient(t) - it.chain.On("Client").Return(client.NewSimulatedBackendClient(t, it.sim, big.NewInt(1337))) + if it.chain != nil { + return } -} -func (it *chainReaderInterfaceTester) setupNoClient(t require.TestingT) { // can re-use the same chain for tests, just make new contract for each test if it.chain != nil { return @@ -63,9 +64,11 @@ func (it *chainReaderInterfaceTester) setupNoClient(t require.TestingT) { it.setupChainNoClient(t) it.chain.On("LogPoller").Return(logger.NullLogger) + testStruct := CreateTestStruct(0, it) + it.chainConfig = types.ChainReaderConfig{ ChainContractReaders: map[string]types.ChainContractReader{ - "LatestValueHolder": { + chainReaderContractName: { ContractABI: testfiles.TestfilesMetaData.ABI, ChainReaderDefinitions: map[string]types.ChainReaderDefinition{ MethodTakingLatestParamsReturningTestStruct: { @@ -77,10 +80,26 @@ func (it *chainReaderInterfaceTester) setupNoClient(t require.TestingT) { MethodReturningUint64Slice: { ChainSpecificName: "GetSliceValue", }, + MethodReturningSeenStruct: { + ChainSpecificName: returnSeenName, + InputModifications: codec.ModifiersConfig{ + &codec.HardCodeConfig{ + OnChainValues: map[string]any{ + "BigField": testStruct.BigField.String(), + "Account": hexutil.Encode(testStruct.Account), + }, + }, + }, + OutputModifications: codec.ModifiersConfig{ + &codec.HardCodeConfig{ + OffChainValues: map[string]any{"ExtraField": anyExtraValue}}, + }, + }, }, }, }, } + it.chain.On("Client").Return(client.NewSimulatedBackendClient(t, it.sim, big.NewInt(1337))) } func (it *chainReaderInterfaceTester) Teardown(_ *testing.T) { @@ -113,6 +132,13 @@ func (it *chainReaderInterfaceTester) GetPrimitiveContract(ctx context.Context, } } +func (it *chainReaderInterfaceTester) GetReturnSeenContract(ctx context.Context, t *testing.T) clcommontypes.BoundContract { + it.deployNewContract(ctx, t) + return clcommontypes.BoundContract{ + Address: it.address, + Name: returnSeenName, + } +} func (it *chainReaderInterfaceTester) GetSliceContract(ctx context.Context, t *testing.T) clcommontypes.BoundContract { // Since most tests don't use the contract, it's set up lazily to save time it.deployNewContract(ctx, t) diff --git a/core/services/relay/evm/codec.go b/core/services/relay/evm/codec.go index f2cb447e120..616fac03b44 100644 --- a/core/services/relay/evm/codec.go +++ b/core/services/relay/evm/codec.go @@ -2,15 +2,24 @@ package evm import ( "encoding/json" + "fmt" + "math/big" + "reflect" "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/mitchellh/mapstructure" + + "github.com/smartcontractkit/chainlink-common/pkg/codec" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) -func NewCodec(conf types.CodecConfig) (commontypes.Codec, error) { +var evmDecoderHooks = []mapstructure.DecodeHookFunc{decodeAccountHook, codec.BigIntHook, codec.SliceToArrayVerifySizeHook, sizeVerifyBigIntHook} + +func NewCodec(conf types.CodecConfig) (commontypes.CodecTypeProvider, error) { parsed := &parsedTypes{ encoderDefs: map[string]*CodecEntry{}, decoderDefs: map[string]*CodecEntry{}, @@ -22,7 +31,12 @@ func NewCodec(conf types.CodecConfig) (commontypes.Codec, error) { return nil, err } - item := &CodecEntry{Args: args} + mod, err := v.ModifierConfigs.ToModifier(evmDecoderHooks...) + if err != nil { + return nil, err + } + + item := &CodecEntry{Args: args, mod: mod} if err := item.Init(); err != nil { return nil, err } @@ -31,36 +45,21 @@ func NewCodec(conf types.CodecConfig) (commontypes.Codec, error) { parsed.decoderDefs[k] = item } - return codecFromTypes(parsed), nil -} - -func codecFromTypes(parsed *parsedTypes) *evmCodec { - return &evmCodec{ - encoder: &encoder{Definitions: parsed.encoderDefs}, - decoder: &decoder{Definitions: parsed.decoderDefs}, - types: parsed, - } + return parsed.toCodec() } -var _ commontypes.TypeProvider = &evmCodec{} - type evmCodec struct { *encoder *decoder - types *parsedTypes -} - -type parsedTypes struct { - encoderDefs map[string]*CodecEntry - decoderDefs map[string]*CodecEntry + *parsedTypes } func (c *evmCodec) CreateType(itemType string, forEncoding bool) (any, error) { var itemTypes map[string]*CodecEntry if forEncoding { - itemTypes = c.types.encoderDefs + itemTypes = c.encoderDefs } else { - itemTypes = c.types.decoderDefs + itemTypes = c.decoderDefs } def, ok := itemTypes[itemType] @@ -68,5 +67,45 @@ func (c *evmCodec) CreateType(itemType string, forEncoding bool) (any, error) { return nil, commontypes.ErrInvalidType } - return def.checkedType, nil + return reflect.New(def.checkedType).Interface(), nil +} + +var bigIntType = reflect.TypeOf((*big.Int)(nil)) + +func sizeVerifyBigIntHook(from, to reflect.Type, data any) (any, error) { + if from.Implements(types.SizedBigIntType()) && + !to.Implements(types.SizedBigIntType()) && + !reflect.PointerTo(to).Implements(types.SizedBigIntType()) { + return codec.BigIntHook(from, bigIntType, reflect.ValueOf(data).Convert(bigIntType).Interface()) + } + + if !to.Implements(types.SizedBigIntType()) { + return data, nil + } + + var err error + data, err = codec.BigIntHook(from, bigIntType, data) + if err != nil { + return nil, err + } + + bi, ok := data.(*big.Int) + if !ok { + return data, nil + } + + converted := reflect.ValueOf(bi).Convert(to).Interface().(types.SizedBigInt) + return converted, converted.Verify() +} + +func decodeAccountHook(from, to reflect.Type, data any) (any, error) { + b32, _ := types.GetType("bytes32") + if from.Kind() == reflect.String && to == b32.Checked { + decoded, err := hexutil.Decode(data.(string)) + if err != nil { + return nil, fmt.Errorf("%w: %w", commontypes.ErrInvalidType, err) + } + return [32]byte(decoded), nil + } + return data, nil } diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go index 4231d5b01b5..cb9a603800a 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/codec_entry.go @@ -6,6 +6,8 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/smartcontractkit/chainlink-common/pkg/codec" + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" @@ -16,6 +18,7 @@ type CodecEntry struct { encodingPrefix []byte checkedType reflect.Type nativeType reflect.Type + mod codec.Modifier } func (entry *CodecEntry) Init() error { diff --git a/core/services/relay/evm/codec_test.go b/core/services/relay/evm/codec_test.go index 4a5d35a2870..3d597b34c5b 100644 --- a/core/services/relay/evm/codec_test.go +++ b/core/services/relay/evm/codec_test.go @@ -5,10 +5,13 @@ import ( "testing" "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common/hexutil" ocr2types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink-common/pkg/codec" + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" . "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" //nolint common practice to import test mods with . @@ -18,13 +21,15 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) +const anyExtraValue = 3 + func TestCodec(t *testing.T) { - RunCodecInterfaceTests(t, &codecInterfaceTester{}) + tester := &codecInterfaceTester{} + RunCodecInterfaceTests(t, tester) anyN := 10 + c := tester.GetCodec(t) t.Run("GetMaxEncodingSize delegates to GetMaxSize", func(t *testing.T) { - codec := getCodec(t) - - actual, err := codec.GetMaxEncodingSize(testutils.Context(t), anyN, sizeItemType) + actual, err := c.GetMaxEncodingSize(testutils.Context(t), anyN, sizeItemType) assert.NoError(t, err) expected, err := evm.GetMaxSize(anyN, parseDefs(t)[sizeItemType]) @@ -33,9 +38,7 @@ func TestCodec(t *testing.T) { }) t.Run("GetMaxDecodingSize delegates to GetMaxSize", func(t *testing.T) { - codec := getCodec(t) - - actual, err := codec.GetMaxDecodingSize(testutils.Context(t), anyN, sizeItemType) + actual, err := c.GetMaxDecodingSize(testutils.Context(t), anyN, sizeItemType) assert.NoError(t, err) expected, err := evm.GetMaxSize(anyN, parseDefs(t)[sizeItemType]) @@ -66,7 +69,29 @@ func (it *codecInterfaceTester) EncodeFields(t *testing.T, request *EncodeReques } func (it *codecInterfaceTester) GetCodec(t *testing.T) commontypes.Codec { - return getCodec(t) + codecConfig := types.CodecConfig{ChainCodecConfigs: map[string]types.ChainCodedConfig{}} + testStruct := CreateTestStruct(0, it) + for k, v := range codecDefs { + defBytes, err := json.Marshal(v) + require.NoError(t, err) + entry := codecConfig.ChainCodecConfigs[k] + entry.TypeAbi = string(defBytes) + if k == TestItemWithConfigExtra { + entry.ModifierConfigs = codec.ModifiersConfig{ + &codec.HardCodeConfig{ + OnChainValues: map[string]any{ + "BigField": testStruct.BigField.String(), + "Account": hexutil.Encode(testStruct.Account), + }, + OffChainValues: map[string]any{"ExtraField": anyExtraValue}}, + } + } + codecConfig.ChainCodecConfigs[k] = entry + } + + c, err := evm.NewCodec(codecConfig) + require.NoError(t, err) + return c } func (it *codecInterfaceTester) IncludeArrayEncodingSizeEnforcement() bool { @@ -160,24 +185,7 @@ var codecDefs = map[string][]abi.ArgumentMarshaling{ {Name: "Stuff", Type: "int256[]"}, {Name: "OtherStuff", Type: "int256"}, }, -} - -func getCodec(t require.TestingT) commontypes.Codec { - codecConfig := types.CodecConfig{ - ChainCodecConfigs: map[string]types.ChainCodedConfig{}, - } - - for k, v := range codecDefs { - defBytes, err := json.Marshal(v) - require.NoError(t, err) - entry := codecConfig.ChainCodecConfigs[k] - entry.TypeAbi = string(defBytes) - codecConfig.ChainCodecConfigs[k] = entry - } - - codec, err := evm.NewCodec(codecConfig) - require.NoError(t, err) - return codec + TestItemWithConfigExtra: ts, } func parseDefs(t *testing.T) map[string]abi.Arguments { diff --git a/core/services/relay/evm/decoder.go b/core/services/relay/evm/decoder.go index 867f9c5037a..4ba84506725 100644 --- a/core/services/relay/evm/decoder.go +++ b/core/services/relay/evm/decoder.go @@ -75,8 +75,9 @@ func setElements(length int, rDecode reflect.Value, iInto reflect.Value) error { func mapstructureDecode(src, dest any) error { mDecoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ - DecodeHook: evmDecoderHook, + DecodeHook: mapstructure.ComposeDecodeHookFunc(evmDecoderHooks...), Result: dest, + Squash: true, }) if err != nil || mDecoder.Decode(src) != nil { return commontypes.ErrInvalidType diff --git a/core/services/relay/evm/encoder.go b/core/services/relay/evm/encoder.go index 699796a31eb..167e651f58e 100644 --- a/core/services/relay/evm/encoder.go +++ b/core/services/relay/evm/encoder.go @@ -2,24 +2,17 @@ package evm import ( "context" - "math/big" "reflect" - "github.com/mitchellh/mapstructure" ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - "github.com/smartcontractkit/chainlink-common/pkg/codec" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" - - "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) type encoder struct { Definitions map[string]*CodecEntry } -var evmDecoderHook = mapstructure.ComposeDecodeHookFunc(codec.BigIntHook, codec.SliceToArrayVerifySizeHook, sizeVerifyBigIntHook) - var _ commontypes.Encoder = &encoder{} func (e *encoder) Encode(ctx context.Context, item any, itemType string) ([]byte, error) { @@ -42,13 +35,10 @@ func (e *encoder) GetMaxEncodingSize(ctx context.Context, n int, itemType string } func encode(item reflect.Value, info *CodecEntry) (ocrtypes.Report, error) { - iType := item.Type() - for iType.Kind() == reflect.Pointer { - iType = iType.Elem() + for item.Kind() == reflect.Pointer { + item = reflect.Indirect(item) } - switch iType.Kind() { - case reflect.Pointer: - return encode(item.Elem(), info) + switch item.Kind() { case reflect.Array, reflect.Slice: return encodeArray(item, info) case reflect.Struct, reflect.Map: @@ -119,23 +109,3 @@ func pack(info *CodecEntry, values ...any) (ocrtypes.Report, error) { return nil, commontypes.ErrInvalidType } - -func sizeVerifyBigIntHook(from, to reflect.Type, data any) (any, error) { - if !to.Implements(types.SizedBigIntType()) { - return data, nil - } - - var err error - data, err = codec.BigIntHook(from, reflect.TypeOf((*big.Int)(nil)), data) - if err != nil { - return nil, err - } - - bi, ok := data.(*big.Int) - if !ok { - return data, nil - } - - converted := reflect.ValueOf(bi).Convert(to).Interface().(types.SizedBigInt) - return converted, converted.Verify() -} diff --git a/core/services/relay/evm/parsed_types.go b/core/services/relay/evm/parsed_types.go new file mode 100644 index 00000000000..bd4443ffca0 --- /dev/null +++ b/core/services/relay/evm/parsed_types.go @@ -0,0 +1,46 @@ +package evm + +import ( + "fmt" + "reflect" + + "github.com/smartcontractkit/chainlink-common/pkg/codec" + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" +) + +type parsedTypes struct { + encoderDefs map[string]*CodecEntry + decoderDefs map[string]*CodecEntry +} + +func (parsed *parsedTypes) toCodec() (commontypes.CodecTypeProvider, error) { + modByType := map[string]codec.Modifier{} + if err := addEntries(parsed.encoderDefs, modByType); err != nil { + return nil, err + } + if err := addEntries(parsed.decoderDefs, modByType); err != nil { + return nil, err + } + + mod, err := codec.NewByItemTypeModifier(modByType) + if err != nil { + return nil, err + } + underlying := &evmCodec{ + encoder: &encoder{Definitions: parsed.encoderDefs}, + decoder: &decoder{Definitions: parsed.decoderDefs}, + parsedTypes: parsed, + } + return codec.NewModifierCodec(underlying, mod, evmDecoderHooks...) +} + +func addEntries(defs map[string]*CodecEntry, modByType map[string]codec.Modifier) error { + for k, def := range defs { + modByType[k] = def.mod + _, err := def.mod.RetypeForOffChain(reflect.PointerTo(def.checkedType), k) + if err != nil { + return fmt.Errorf("%w: cannot retype %v: %w", commontypes.ErrInvalidConfig, k, err) + } + } + return nil +} diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract.sol b/core/services/relay/evm/testfiles/chain_reader_test_contract.sol index ec38c20678a..58d4006a1ad 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract.sol +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract.sol @@ -44,6 +44,18 @@ contract LatestValueHolder { seen.push(TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct)); } + function ReturnSeen( + int32 field, + string calldata differentField, + uint8 oracleId, + uint8[32] calldata oracleIds, + bytes32 account, + bytes32[] calldata accounts, + int192 bigField, + MidLevelTestStruct calldata nestedStruct) pure public returns (TestStruct memory) { + return TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); + } + function GetElementAtIndex(uint256 i) public view returns (TestStruct memory) { // See chain_reader_interface_tests.go in chainlink-relay return seen[i-1]; diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi index 6f73e9feb88..e16fa1803e8 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi @@ -1 +1 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"AddTestStruct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"GetElementAtIndex","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GetPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"GetSliceValue","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"}] \ No newline at end of file +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"AddTestStruct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"GetElementAtIndex","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GetPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"GetSliceValue","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"ReturnSeen","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"}] \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin index 90c9f543f97..8cb80c9d82e 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a918202910219909216919091179055610e4d806100a96000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80637dd6af5b146100515780639ca04f6714610066578063bdb37c901461008f578063da8e7a82146100a4575b600080fd5b61006461005f366004610921565b6100b3565b005b610079610074366004610a0c565b6102e2565b6040516100869190610b71565b60405180910390f35b610097610592565b6040516100869190610b23565b60405160038152602001610086565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161018d84610cb2565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936101e49392850192919091019061061e565b50604082015160028201805460ff191660ff909216919091179055606082015161021490600383019060206106a2565b506080820151600482015560a0820151805161023a916005840191602090910190610730565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff199091161783558082015180519193926102cf9260098901929091019061061e565b5050505050505050505050505050505050565b6102ea61076a565b60006102f7600184610c8d565b8154811061030757610307610deb565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461034e90610db6565b80601f016020809104026020016040519081016040528092919081815260200182805461037a90610db6565b80156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116103fc57905050505050508152602001600482015481526020016005820180548060200260200160405190810160405280929190818152602001828054801561048c57602002820191906000526020600020905b815481526020019060010190808311610478575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061050390610db6565b80601f016020809104026020016040519081016040528092919081815260200182805461052f90610db6565b801561057c5780601f106105515761010080835404028352916020019161057c565b820191906000526020600020905b81548152906001019060200180831161055f57829003601f168201915b5050509190925250505090525090525092915050565b6060600180548060200260200160405190810160405280929190818152602001828054801561061457602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116105cf5790505b5050505050905090565b82805461062a90610db6565b90600052602060002090601f01602090048101928261064c5760008555610692565b82601f1061066557805160ff1916838001178555610692565b82800160010185558215610692579182015b82811115610692578251825591602001919060010190610677565b5061069e9291506107b9565b5090565b6001830191839082156106925791602002820160005b838211156106f657835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026106b8565b80156107235782816101000a81549060ff02191690556001016020816000010492830192600103026106f6565b505061069e9291506107b9565b8280548282559060005260206000209081019282156106925791602002820182811115610692578251825591602001919060010190610677565b60408051610100810182526000808252606060208301819052928201529081016107926107ce565b81526000602082018190526060604083018190528201526080016107b46107ed565b905290565b5b8082111561069e57600081556001016107ba565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016107b46040518060400160405280600060070b8152602001606081525090565b60008083601f84011261083b57600080fd5b50813567ffffffffffffffff81111561085357600080fd5b6020830191508360208260051b850101111561086e57600080fd5b9250929050565b80610400810183101561088757600080fd5b92915050565b8035601781900b811461089f57600080fd5b919050565b8035600381900b811461089f57600080fd5b60008083601f8401126108c857600080fd5b50813567ffffffffffffffff8111156108e057600080fd5b60208301915083602082850101111561086e57600080fd5b60006040828403121561090a57600080fd5b50919050565b803560ff8116811461089f57600080fd5b6000806000806000806000806000806104e08b8d03121561094157600080fd5b61094a8b6108a4565b995060208b013567ffffffffffffffff8082111561096757600080fd5b6109738e838f016108b6565b909b50995089915061098760408e01610910565b98506109968e60608f01610875565b97506104608d013596506104808d01359150808211156109b557600080fd5b6109c18e838f01610829565b90965094508491506109d66104a08e0161088d565b93506104c08d01359150808211156109ed57600080fd5b506109fa8d828e016108f8565b9150509295989b9194979a5092959850565b600060208284031215610a1e57600080fd5b5035919050565b600081518084526020808501945080840160005b83811015610a5557815187529582019590820190600101610a39565b509495945050505050565b8060005b6020808210610a735750610a8a565b825160ff1685529384019390910190600101610a64565b50505050565b6000815180845260005b81811015610ab657602081850181015186830182015201610a9a565b81811115610ac8576000602083870101525b50601f01601f19169290920160200192915050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610b1b6080850182610a90565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610b6557835167ffffffffffffffff1683529284019291840191600101610b3f565b50909695505050505050565b60208152610b8560208201835160030b9052565b600060208301516104e0806040850152610ba3610500850183610a90565b91506040850151610bb9606086018260ff169052565b506060850151610bcc6080860182610a60565b50608085015161048085015260a0850151601f1980868503016104a0870152610bf58483610a25565b935060c08701519150610c0e6104c087018360170b9052565b60e0870151915080868503018387015250610c298382610add565b9695505050505050565b6040805190810167ffffffffffffffff81118282101715610c5657610c56610e01565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610c8557610c85610e01565b604052919050565b600082821015610cad57634e487b7160e01b600052601160045260246000fd5b500390565b600060408236031215610cc457600080fd5b610ccc610c33565b82356001600160f01b031981168114610ce457600080fd5b815260208381013567ffffffffffffffff80821115610d0257600080fd5b818601915060408236031215610d1757600080fd5b610d1f610c33565b82358060070b8114610d3057600080fd5b81528284013582811115610d4357600080fd5b929092019136601f840112610d5757600080fd5b823582811115610d6957610d69610e01565b610d7b601f8201601f19168601610c5c565b92508083523685828601011115610d9157600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c90821680610dca57607f821691505b6020821081141561090a57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212206d3fcd0d6af66016f39be3d9948d2703697b0dfdbab6f47b494ab3d1f3d0d4c264736f6c63430008060033 \ No newline at end of file +608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a918202910219909216919091179055610f5c806100a96000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80637dd6af5b1461005c5780639ca04f6714610071578063b95ad4111461009a578063bdb37c90146100ad578063da8e7a82146100c2575b600080fd5b61006f61006a366004610a30565b6100d1565b005b61008461007f366004610b1b565b610300565b6040516100919190610c80565b60405180910390f35b6100846100a8366004610a30565b6105b0565b6100b56106a1565b6040516100919190610c32565b60405160038152602001610091565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016101ab84610dc1565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936102029392850192919091019061072d565b50604082015160028201805460ff191660ff909216919091179055606082015161023290600383019060206107b1565b506080820151600482015560a0820151805161025891600584019160209091019061083f565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff199091161783558082015180519193926102ed9260098901929091019061072d565b5050505050505050505050505050505050565b610308610879565b6000610315600184610d9c565b8154811061032557610325610efa565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461036c90610ec5565b80601f016020809104026020016040519081016040528092919081815260200182805461039890610ec5565b80156103e55780601f106103ba576101008083540402835291602001916103e5565b820191906000526020600020905b8154815290600101906020018083116103c857829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff1681526020600192830181810494850194909303909202910180841161041a5790505050505050815260200160048201548152602001600582018054806020026020016040519081016040528092919081815260200182805480156104aa57602002820191906000526020600020905b815481526020019060010190808311610496575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061052190610ec5565b80601f016020809104026020016040519081016040528092919081815260200182805461054d90610ec5565b801561059a5780601f1061056f5761010080835404028352916020019161059a565b820191906000526020600020905b81548152906001019060200180831161057d57829003601f168201915b5050509190925250505090525090525092915050565b6105b8610879565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161069084610dc1565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561072357602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116106de5790505b5050505050905090565b82805461073990610ec5565b90600052602060002090601f01602090048101928261075b57600085556107a1565b82601f1061077457805160ff19168380011785556107a1565b828001600101855582156107a1579182015b828111156107a1578251825591602001919060010190610786565b506107ad9291506108c8565b5090565b6001830191839082156107a15791602002820160005b8382111561080557835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026107c7565b80156108325782816101000a81549060ff0219169055600101602081600001049283019260010302610805565b50506107ad9291506108c8565b8280548282559060005260206000209081019282156107a157916020028201828111156107a1578251825591602001919060010190610786565b60408051610100810182526000808252606060208301819052928201529081016108a16108dd565b81526000602082018190526060604083018190528201526080016108c36108fc565b905290565b5b808211156107ad57600081556001016108c9565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016108c36040518060400160405280600060070b8152602001606081525090565b60008083601f84011261094a57600080fd5b50813567ffffffffffffffff81111561096257600080fd5b6020830191508360208260051b850101111561097d57600080fd5b9250929050565b80610400810183101561099657600080fd5b92915050565b8035601781900b81146109ae57600080fd5b919050565b8035600381900b81146109ae57600080fd5b60008083601f8401126109d757600080fd5b50813567ffffffffffffffff8111156109ef57600080fd5b60208301915083602082850101111561097d57600080fd5b600060408284031215610a1957600080fd5b50919050565b803560ff811681146109ae57600080fd5b6000806000806000806000806000806104e08b8d031215610a5057600080fd5b610a598b6109b3565b995060208b013567ffffffffffffffff80821115610a7657600080fd5b610a828e838f016109c5565b909b509950899150610a9660408e01610a1f565b9850610aa58e60608f01610984565b97506104608d013596506104808d0135915080821115610ac457600080fd5b610ad08e838f01610938565b9096509450849150610ae56104a08e0161099c565b93506104c08d0135915080821115610afc57600080fd5b50610b098d828e01610a07565b9150509295989b9194979a5092959850565b600060208284031215610b2d57600080fd5b5035919050565b600081518084526020808501945080840160005b83811015610b6457815187529582019590820190600101610b48565b509495945050505050565b8060005b6020808210610b825750610b99565b825160ff1685529384019390910190600101610b73565b50505050565b6000815180845260005b81811015610bc557602081850181015186830182015201610ba9565b81811115610bd7576000602083870101525b50601f01601f19169290920160200192915050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610c2a6080850182610b9f565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610c7457835167ffffffffffffffff1683529284019291840191600101610c4e565b50909695505050505050565b60208152610c9460208201835160030b9052565b600060208301516104e0806040850152610cb2610500850183610b9f565b91506040850151610cc8606086018260ff169052565b506060850151610cdb6080860182610b6f565b50608085015161048085015260a0850151601f1980868503016104a0870152610d048483610b34565b935060c08701519150610d1d6104c087018360170b9052565b60e0870151915080868503018387015250610d388382610bec565b9695505050505050565b6040805190810167ffffffffffffffff81118282101715610d6557610d65610f10565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610d9457610d94610f10565b604052919050565b600082821015610dbc57634e487b7160e01b600052601160045260246000fd5b500390565b600060408236031215610dd357600080fd5b610ddb610d42565b82356001600160f01b031981168114610df357600080fd5b815260208381013567ffffffffffffffff80821115610e1157600080fd5b818601915060408236031215610e2657600080fd5b610e2e610d42565b82358060070b8114610e3f57600080fd5b81528284013582811115610e5257600080fd5b929092019136601f840112610e6657600080fd5b823582811115610e7857610e78610f10565b610e8a601f8201601f19168601610d6b565b92508083523685828601011115610ea057600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c90821680610ed957607f821691505b60208210811415610a1957634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212203e9087524a5a63426d26593011ef69ba9a517930f68ed2747aed8804859d3ed064736f6c63430008060033 \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go index 2a8ee83e145..d2b173c6a6e 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go @@ -55,8 +55,8 @@ type TestStruct struct { // TestfilesMetaData contains all meta data concerning the Testfiles contract. var TestfilesMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a918202910219909216919091179055610e4d806100a96000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80637dd6af5b146100515780639ca04f6714610066578063bdb37c901461008f578063da8e7a82146100a4575b600080fd5b61006461005f366004610921565b6100b3565b005b610079610074366004610a0c565b6102e2565b6040516100869190610b71565b60405180910390f35b610097610592565b6040516100869190610b23565b60405160038152602001610086565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161018d84610cb2565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936101e49392850192919091019061061e565b50604082015160028201805460ff191660ff909216919091179055606082015161021490600383019060206106a2565b506080820151600482015560a0820151805161023a916005840191602090910190610730565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff199091161783558082015180519193926102cf9260098901929091019061061e565b5050505050505050505050505050505050565b6102ea61076a565b60006102f7600184610c8d565b8154811061030757610307610deb565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461034e90610db6565b80601f016020809104026020016040519081016040528092919081815260200182805461037a90610db6565b80156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116103fc57905050505050508152602001600482015481526020016005820180548060200260200160405190810160405280929190818152602001828054801561048c57602002820191906000526020600020905b815481526020019060010190808311610478575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061050390610db6565b80601f016020809104026020016040519081016040528092919081815260200182805461052f90610db6565b801561057c5780601f106105515761010080835404028352916020019161057c565b820191906000526020600020905b81548152906001019060200180831161055f57829003601f168201915b5050509190925250505090525090525092915050565b6060600180548060200260200160405190810160405280929190818152602001828054801561061457602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116105cf5790505b5050505050905090565b82805461062a90610db6565b90600052602060002090601f01602090048101928261064c5760008555610692565b82601f1061066557805160ff1916838001178555610692565b82800160010185558215610692579182015b82811115610692578251825591602001919060010190610677565b5061069e9291506107b9565b5090565b6001830191839082156106925791602002820160005b838211156106f657835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026106b8565b80156107235782816101000a81549060ff02191690556001016020816000010492830192600103026106f6565b505061069e9291506107b9565b8280548282559060005260206000209081019282156106925791602002820182811115610692578251825591602001919060010190610677565b60408051610100810182526000808252606060208301819052928201529081016107926107ce565b81526000602082018190526060604083018190528201526080016107b46107ed565b905290565b5b8082111561069e57600081556001016107ba565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016107b46040518060400160405280600060070b8152602001606081525090565b60008083601f84011261083b57600080fd5b50813567ffffffffffffffff81111561085357600080fd5b6020830191508360208260051b850101111561086e57600080fd5b9250929050565b80610400810183101561088757600080fd5b92915050565b8035601781900b811461089f57600080fd5b919050565b8035600381900b811461089f57600080fd5b60008083601f8401126108c857600080fd5b50813567ffffffffffffffff8111156108e057600080fd5b60208301915083602082850101111561086e57600080fd5b60006040828403121561090a57600080fd5b50919050565b803560ff8116811461089f57600080fd5b6000806000806000806000806000806104e08b8d03121561094157600080fd5b61094a8b6108a4565b995060208b013567ffffffffffffffff8082111561096757600080fd5b6109738e838f016108b6565b909b50995089915061098760408e01610910565b98506109968e60608f01610875565b97506104608d013596506104808d01359150808211156109b557600080fd5b6109c18e838f01610829565b90965094508491506109d66104a08e0161088d565b93506104c08d01359150808211156109ed57600080fd5b506109fa8d828e016108f8565b9150509295989b9194979a5092959850565b600060208284031215610a1e57600080fd5b5035919050565b600081518084526020808501945080840160005b83811015610a5557815187529582019590820190600101610a39565b509495945050505050565b8060005b6020808210610a735750610a8a565b825160ff1685529384019390910190600101610a64565b50505050565b6000815180845260005b81811015610ab657602081850181015186830182015201610a9a565b81811115610ac8576000602083870101525b50601f01601f19169290920160200192915050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610b1b6080850182610a90565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610b6557835167ffffffffffffffff1683529284019291840191600101610b3f565b50909695505050505050565b60208152610b8560208201835160030b9052565b600060208301516104e0806040850152610ba3610500850183610a90565b91506040850151610bb9606086018260ff169052565b506060850151610bcc6080860182610a60565b50608085015161048085015260a0850151601f1980868503016104a0870152610bf58483610a25565b935060c08701519150610c0e6104c087018360170b9052565b60e0870151915080868503018387015250610c298382610add565b9695505050505050565b6040805190810167ffffffffffffffff81118282101715610c5657610c56610e01565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610c8557610c85610e01565b604052919050565b600082821015610cad57634e487b7160e01b600052601160045260246000fd5b500390565b600060408236031215610cc457600080fd5b610ccc610c33565b82356001600160f01b031981168114610ce457600080fd5b815260208381013567ffffffffffffffff80821115610d0257600080fd5b818601915060408236031215610d1757600080fd5b610d1f610c33565b82358060070b8114610d3057600080fd5b81528284013582811115610d4357600080fd5b929092019136601f840112610d5757600080fd5b823582811115610d6957610d69610e01565b610d7b601f8201601f19168601610c5c565b92508083523685828601011115610d9157600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c90821680610dca57607f821691505b6020821081141561090a57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212206d3fcd0d6af66016f39be3d9948d2703697b0dfdbab6f47b494ab3d1f3d0d4c264736f6c63430008060033", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"ReturnSeen\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a918202910219909216919091179055610f5c806100a96000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80637dd6af5b1461005c5780639ca04f6714610071578063b95ad4111461009a578063bdb37c90146100ad578063da8e7a82146100c2575b600080fd5b61006f61006a366004610a30565b6100d1565b005b61008461007f366004610b1b565b610300565b6040516100919190610c80565b60405180910390f35b6100846100a8366004610a30565b6105b0565b6100b56106a1565b6040516100919190610c32565b60405160038152602001610091565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016101ab84610dc1565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936102029392850192919091019061072d565b50604082015160028201805460ff191660ff909216919091179055606082015161023290600383019060206107b1565b506080820151600482015560a0820151805161025891600584019160209091019061083f565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff199091161783558082015180519193926102ed9260098901929091019061072d565b5050505050505050505050505050505050565b610308610879565b6000610315600184610d9c565b8154811061032557610325610efa565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461036c90610ec5565b80601f016020809104026020016040519081016040528092919081815260200182805461039890610ec5565b80156103e55780601f106103ba576101008083540402835291602001916103e5565b820191906000526020600020905b8154815290600101906020018083116103c857829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff1681526020600192830181810494850194909303909202910180841161041a5790505050505050815260200160048201548152602001600582018054806020026020016040519081016040528092919081815260200182805480156104aa57602002820191906000526020600020905b815481526020019060010190808311610496575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061052190610ec5565b80601f016020809104026020016040519081016040528092919081815260200182805461054d90610ec5565b801561059a5780601f1061056f5761010080835404028352916020019161059a565b820191906000526020600020905b81548152906001019060200180831161057d57829003601f168201915b5050509190925250505090525090525092915050565b6105b8610879565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161069084610dc1565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561072357602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116106de5790505b5050505050905090565b82805461073990610ec5565b90600052602060002090601f01602090048101928261075b57600085556107a1565b82601f1061077457805160ff19168380011785556107a1565b828001600101855582156107a1579182015b828111156107a1578251825591602001919060010190610786565b506107ad9291506108c8565b5090565b6001830191839082156107a15791602002820160005b8382111561080557835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026107c7565b80156108325782816101000a81549060ff0219169055600101602081600001049283019260010302610805565b50506107ad9291506108c8565b8280548282559060005260206000209081019282156107a157916020028201828111156107a1578251825591602001919060010190610786565b60408051610100810182526000808252606060208301819052928201529081016108a16108dd565b81526000602082018190526060604083018190528201526080016108c36108fc565b905290565b5b808211156107ad57600081556001016108c9565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016108c36040518060400160405280600060070b8152602001606081525090565b60008083601f84011261094a57600080fd5b50813567ffffffffffffffff81111561096257600080fd5b6020830191508360208260051b850101111561097d57600080fd5b9250929050565b80610400810183101561099657600080fd5b92915050565b8035601781900b81146109ae57600080fd5b919050565b8035600381900b81146109ae57600080fd5b60008083601f8401126109d757600080fd5b50813567ffffffffffffffff8111156109ef57600080fd5b60208301915083602082850101111561097d57600080fd5b600060408284031215610a1957600080fd5b50919050565b803560ff811681146109ae57600080fd5b6000806000806000806000806000806104e08b8d031215610a5057600080fd5b610a598b6109b3565b995060208b013567ffffffffffffffff80821115610a7657600080fd5b610a828e838f016109c5565b909b509950899150610a9660408e01610a1f565b9850610aa58e60608f01610984565b97506104608d013596506104808d0135915080821115610ac457600080fd5b610ad08e838f01610938565b9096509450849150610ae56104a08e0161099c565b93506104c08d0135915080821115610afc57600080fd5b50610b098d828e01610a07565b9150509295989b9194979a5092959850565b600060208284031215610b2d57600080fd5b5035919050565b600081518084526020808501945080840160005b83811015610b6457815187529582019590820190600101610b48565b509495945050505050565b8060005b6020808210610b825750610b99565b825160ff1685529384019390910190600101610b73565b50505050565b6000815180845260005b81811015610bc557602081850181015186830182015201610ba9565b81811115610bd7576000602083870101525b50601f01601f19169290920160200192915050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610c2a6080850182610b9f565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610c7457835167ffffffffffffffff1683529284019291840191600101610c4e565b50909695505050505050565b60208152610c9460208201835160030b9052565b600060208301516104e0806040850152610cb2610500850183610b9f565b91506040850151610cc8606086018260ff169052565b506060850151610cdb6080860182610b6f565b50608085015161048085015260a0850151601f1980868503016104a0870152610d048483610b34565b935060c08701519150610d1d6104c087018360170b9052565b60e0870151915080868503018387015250610d388382610bec565b9695505050505050565b6040805190810167ffffffffffffffff81118282101715610d6557610d65610f10565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610d9457610d94610f10565b604052919050565b600082821015610dbc57634e487b7160e01b600052601160045260246000fd5b500390565b600060408236031215610dd357600080fd5b610ddb610d42565b82356001600160f01b031981168114610df357600080fd5b815260208381013567ffffffffffffffff80821115610e1157600080fd5b818601915060408236031215610e2657600080fd5b610e2e610d42565b82358060070b8114610e3f57600080fd5b81528284013582811115610e5257600080fd5b929092019136601f840112610e6657600080fd5b823582811115610e7857610e78610f10565b610e8a601f8201601f19168601610d6b565b92508083523685828601011115610ea057600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c90821680610ed957607f821691505b60208210811415610a1957634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212203e9087524a5a63426d26593011ef69ba9a517930f68ed2747aed8804859d3ed064736f6c63430008060033", } // TestfilesABI is the input ABI used to generate the binding from. @@ -319,6 +319,37 @@ func (_Testfiles *TestfilesCallerSession) GetSliceValue() ([]uint64, error) { return _Testfiles.Contract.GetSliceValue(&_Testfiles.CallOpts) } +// ReturnSeen is a free data retrieval call binding the contract method 0xb95ad411. +// +// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) +func (_Testfiles *TestfilesCaller) ReturnSeen(opts *bind.CallOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { + var out []interface{} + err := _Testfiles.contract.Call(opts, &out, "ReturnSeen", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) + + if err != nil { + return *new(TestStruct), err + } + + out0 := *abi.ConvertType(out[0], new(TestStruct)).(*TestStruct) + + return out0, err + +} + +// ReturnSeen is a free data retrieval call binding the contract method 0xb95ad411. +// +// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) +func (_Testfiles *TestfilesSession) ReturnSeen(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { + return _Testfiles.Contract.ReturnSeen(&_Testfiles.CallOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +// ReturnSeen is a free data retrieval call binding the contract method 0xb95ad411. +// +// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) +func (_Testfiles *TestfilesCallerSession) ReturnSeen(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { + return _Testfiles.Contract.ReturnSeen(&_Testfiles.CallOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + // AddTestStruct is a paid mutator transaction binding the contract method 0x7dd6af5b. // // Solidity: function AddTestStruct(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() diff --git a/core/services/relay/evm/types/types.go b/core/services/relay/evm/types/types.go index 6f3b6b5fc6f..680570a206f 100644 --- a/core/services/relay/evm/types/types.go +++ b/core/services/relay/evm/types/types.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/lib/pq" + "github.com/smartcontractkit/chainlink-common/pkg/codec" "gopkg.in/guregu/null.v2" @@ -38,8 +39,8 @@ type CodecConfig struct { } type ChainCodedConfig struct { - TypeAbi string `json:"typeAbi"` - // TODO transform configs that allow hard-coding values or transforming them (max, min, median etc) + TypeAbi string `json:"typeAbi"` + ModifierConfigs codec.ModifiersConfig } type ChainContractReader struct { @@ -49,11 +50,11 @@ type ChainContractReader struct { } type ChainReaderDefinition struct { - ChainSpecificName string `json:"chainSpecificName"` // chain specific contract method name or event type. - Params map[string]any `json:"params"` - ReturnValues []string `json:"returnValues"` - CacheEnabled bool `json:"cacheEnabled"` - ReadType `json:"readType"` + ChainSpecificName string `json:"chainSpecificName"` // chain specific contract method name or event type. + CacheEnabled bool `json:"cacheEnabled"` + ReadType `json:"readType"` + InputModifications codec.ModifiersConfig `json:"input_modifications"` + OutputModifications codec.ModifiersConfig `json:"output_modifications"` } type ReadType int64 diff --git a/go.mod b/go.mod index c7bcadcf346..dcd2c062b9f 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 diff --git a/go.sum b/go.sum index 71526ba239f..aa409aa9292 100644 --- a/go.sum +++ b/go.sum @@ -1468,8 +1468,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 h1:Q7Lif7+Hr3A1gsFooCp/StP93qVPuixn32XEllZnSdY= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606 h1:7nWx4+ZTUQkzzTnzSK8WwinuJl4IiWa3nl8hvaHYd+8= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 582e102986b..308beb36789 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606 github.com/smartcontractkit/chainlink-testing-framework v1.19.5 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 25680abdfe1..363df863d61 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2375,8 +2375,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 h1:Q7Lif7+Hr3A1gsFooCp/StP93qVPuixn32XEllZnSdY= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606 h1:7nWx4+ZTUQkzzTnzSK8WwinuJl4IiWa3nl8hvaHYd+8= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= From eab312c2bd8da40e939fafbeb89e68e950faa1ba Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 1 Dec 2023 14:39:50 -0500 Subject: [PATCH 035/112] Add modifiers to evm chain reader and codec --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 +- core/services/relay/evm/chain_reader.go | 73 ++++++++-------- core/services/relay/evm/chain_reader_test.go | 42 ++++++++-- core/services/relay/evm/codec.go | 83 ++++++++++++++----- core/services/relay/evm/codec_entry.go | 3 + core/services/relay/evm/codec_test.go | 60 ++++++++------ core/services/relay/evm/decoder.go | 3 +- core/services/relay/evm/encoder.go | 36 +------- core/services/relay/evm/parsed_types.go | 46 ++++++++++ .../testfiles/chain_reader_test_contract.sol | 12 +++ .../chain_reader_test_contract_gen.abi | 2 +- .../chain_reader_test_contract_gen.bin | 2 +- .../chain_reader_test_contract_gen.go | 35 +++++++- core/services/relay/evm/types/types.go | 19 ++--- go.mod | 2 +- go.sum | 4 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- 19 files changed, 282 insertions(+), 152 deletions(-) create mode 100644 core/services/relay/evm/parsed_types.go diff --git a/core/scripts/go.mod b/core/scripts/go.mod index c8244a77e53..124d41bee3e 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -304,7 +304,7 @@ require ( github.com/shirou/gopsutil/v3 v3.23.9 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 // indirect + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 6ba4a768b4c..1d424df98e9 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1467,8 +1467,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 h1:Q7Lif7+Hr3A1gsFooCp/StP93qVPuixn32XEllZnSdY= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606 h1:7nWx4+ZTUQkzzTnzSK8WwinuJl4IiWa3nl8hvaHYd+8= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index 77a959f813c..87a4b66f12b 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -29,7 +29,7 @@ type ChainReaderService interface { type chainReader struct { lggr logger.Logger lp logpoller.LogPoller - codec *evmCodec + codec commontypes.CodecTypeProvider client evmclient.Client } @@ -45,12 +45,14 @@ func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, chain evm return nil, err } + c, err := parsed.toCodec() + return &chainReader{ lggr: lggr.Named("ChainReader"), lp: lp, - codec: codecFromTypes(parsed), + codec: c, client: chain.Client(), - }, nil + }, err } func (cr *chainReader) Name() string { return cr.lggr.Name() } @@ -60,14 +62,10 @@ func (cr *chainReader) initialize() error { return nil } -func (cr *chainReader) CreateType(itemType string, forEncoding bool) (any, error) { - return cr.codec.CreateType(itemType, forEncoding) -} - var _ commontypes.TypeProvider = &chainReader{} func (cr *chainReader) GetLatestValue(ctx context.Context, bc commontypes.BoundContract, method string, params any, returnVal any) error { - data, err := cr.codec.Encode(ctx, params, method) + data, err := cr.codec.Encode(ctx, params, wrapItemType(method, true)) if err != nil { return err } @@ -85,7 +83,7 @@ func (cr *chainReader) GetLatestValue(ctx context.Context, bc commontypes.BoundC return err } - return cr.codec.Decode(ctx, output, returnVal, method) + return cr.codec.Decode(ctx, output, returnVal, wrapItemType(method, false)) } func (cr *chainReader) Start(ctx context.Context) error { @@ -101,17 +99,17 @@ func (cr *chainReader) HealthReport() map[string]error { return map[string]error{cr.Name(): nil} } +func (cr *chainReader) CreateType(itemType string, forEncoding bool) (any, error) { + return cr.codec.CreateType(wrapItemType(itemType, forEncoding), forEncoding) +} + func addEventTypes(name string, contractABI abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) error { event, methodExists := contractABI.Events[chainReaderDefinition.ChainSpecificName] if !methodExists { return fmt.Errorf("method: %s doesn't exist", chainReaderDefinition.ChainSpecificName) } - if err := addOverrides(chainReaderDefinition, event.Inputs); err != nil { - return err - } - - return addDecoderDef(name, event.Inputs, parsed) + return addDecoderDef(name, event.Inputs, parsed, chainReaderDefinition) } func addMethods(name string, abi abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) error { @@ -120,41 +118,31 @@ func addMethods(name string, abi abi.ABI, chainReaderDefinition types.ChainReade return fmt.Errorf("method: %q doesn't exist", chainReaderDefinition.ChainSpecificName) } - if err := addOverrides(chainReaderDefinition, method.Inputs); err != nil { - return err - } - // ABI.Pack prepends the method.ID to the encodings, we'll need the encoder to do the same. input := &CodecEntry{Args: method.Inputs, encodingPrefix: method.ID} if err := input.Init(); err != nil { return err } - parsed.encoderDefs[name] = input - return addDecoderDef(name, method.Outputs, parsed) -} + inputMod, err := chainReaderDefinition.InputModifications.ToModifier(evmDecoderHooks...) + if err != nil { + return err + } + input.mod = inputMod + parsed.encoderDefs[wrapItemType(name, true)] = input -func addDecoderDef(name string, outputs abi.Arguments, parsed *parsedTypes) error { - output := &CodecEntry{Args: outputs} - parsed.decoderDefs[name] = output - return output.Init() + return addDecoderDef(name, method.Outputs, parsed, chainReaderDefinition) } -func addOverrides(chainReaderDefinition types.ChainReaderDefinition, inputs abi.Arguments) error { - // TODO add transforms to add params artificially -paramsLoop: - for argName, param := range chainReaderDefinition.Params { - // TODO add type check too - _ = param - for _, input := range inputs { - if argName == input.Name { - continue paramsLoop - } - } - return fmt.Errorf("cannot find parameter %v in %v", argName, chainReaderDefinition.ChainSpecificName) +func addDecoderDef(name string, outputs abi.Arguments, parsed *parsedTypes, def types.ChainReaderDefinition) error { + output := &CodecEntry{Args: outputs} + mod, err := def.OutputModifications.ToModifier(evmDecoderHooks...) + if err != nil { + return err } - - return nil + output.mod = mod + parsed.decoderDefs[wrapItemType(name, false)] = output + return output.Init() } func addTypes(chainContractReaders map[string]types.ChainContractReader, parsed *parsedTypes) error { @@ -181,3 +169,10 @@ func addTypes(chainContractReaders map[string]types.ChainContractReader, parsed return nil } + +func wrapItemType(itemType string, isParams bool) string { + if isParams { + return fmt.Sprintf("params.%s", itemType) + } + return fmt.Sprintf("return.%s", itemType) +} diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 5e770841eb5..81fb0e3d8be 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -11,18 +11,20 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core" evmtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/smartcontractkit/libocr/commontypes" "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink-common/pkg/codec" + clcommontypes "github.com/smartcontractkit/chainlink-common/pkg/types" . "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" //nolint common practice to import test mods with . - mocklogpoller "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" + mocklogpoller "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/mocks" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" @@ -31,6 +33,8 @@ import ( ) const commonGasLimitOnEvms = uint64(4712388) +const chainReaderContractName = "LatestValueHolder" +const returnSeenName = "ReturnSeen" func TestChainReader(t *testing.T) { RunChainReaderInterfaceTests(t, &chainReaderInterfaceTester{}) @@ -47,13 +51,10 @@ type chainReaderInterfaceTester struct { } func (it *chainReaderInterfaceTester) Setup(t *testing.T) { - if it.chain == nil { - it.setupNoClient(t) - it.chain.On("Client").Return(client.NewSimulatedBackendClient(t, it.sim, big.NewInt(1337))) + if it.chain != nil { + return } -} -func (it *chainReaderInterfaceTester) setupNoClient(t require.TestingT) { // can re-use the same chain for tests, just make new contract for each test if it.chain != nil { return @@ -63,9 +64,11 @@ func (it *chainReaderInterfaceTester) setupNoClient(t require.TestingT) { it.setupChainNoClient(t) it.chain.On("LogPoller").Return(logger.NullLogger) + testStruct := CreateTestStruct(0, it) + it.chainConfig = types.ChainReaderConfig{ ChainContractReaders: map[string]types.ChainContractReader{ - "LatestValueHolder": { + chainReaderContractName: { ContractABI: testfiles.TestfilesMetaData.ABI, ChainReaderDefinitions: map[string]types.ChainReaderDefinition{ MethodTakingLatestParamsReturningTestStruct: { @@ -77,10 +80,26 @@ func (it *chainReaderInterfaceTester) setupNoClient(t require.TestingT) { MethodReturningUint64Slice: { ChainSpecificName: "GetSliceValue", }, + MethodReturningSeenStruct: { + ChainSpecificName: returnSeenName, + InputModifications: codec.ModifiersConfig{ + &codec.HardCodeConfig{ + OnChainValues: map[string]any{ + "BigField": testStruct.BigField.String(), + "Account": hexutil.Encode(testStruct.Account), + }, + }, + }, + OutputModifications: codec.ModifiersConfig{ + &codec.HardCodeConfig{ + OffChainValues: map[string]any{"ExtraField": anyExtraValue}}, + }, + }, }, }, }, } + it.chain.On("Client").Return(client.NewSimulatedBackendClient(t, it.sim, big.NewInt(1337))) } func (it *chainReaderInterfaceTester) Teardown(_ *testing.T) { @@ -113,6 +132,13 @@ func (it *chainReaderInterfaceTester) GetPrimitiveContract(ctx context.Context, } } +func (it *chainReaderInterfaceTester) GetReturnSeenContract(ctx context.Context, t *testing.T) clcommontypes.BoundContract { + it.deployNewContract(ctx, t) + return clcommontypes.BoundContract{ + Address: it.address, + Name: returnSeenName, + } +} func (it *chainReaderInterfaceTester) GetSliceContract(ctx context.Context, t *testing.T) clcommontypes.BoundContract { // Since most tests don't use the contract, it's set up lazily to save time it.deployNewContract(ctx, t) diff --git a/core/services/relay/evm/codec.go b/core/services/relay/evm/codec.go index f2cb447e120..616fac03b44 100644 --- a/core/services/relay/evm/codec.go +++ b/core/services/relay/evm/codec.go @@ -2,15 +2,24 @@ package evm import ( "encoding/json" + "fmt" + "math/big" + "reflect" "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/mitchellh/mapstructure" + + "github.com/smartcontractkit/chainlink-common/pkg/codec" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) -func NewCodec(conf types.CodecConfig) (commontypes.Codec, error) { +var evmDecoderHooks = []mapstructure.DecodeHookFunc{decodeAccountHook, codec.BigIntHook, codec.SliceToArrayVerifySizeHook, sizeVerifyBigIntHook} + +func NewCodec(conf types.CodecConfig) (commontypes.CodecTypeProvider, error) { parsed := &parsedTypes{ encoderDefs: map[string]*CodecEntry{}, decoderDefs: map[string]*CodecEntry{}, @@ -22,7 +31,12 @@ func NewCodec(conf types.CodecConfig) (commontypes.Codec, error) { return nil, err } - item := &CodecEntry{Args: args} + mod, err := v.ModifierConfigs.ToModifier(evmDecoderHooks...) + if err != nil { + return nil, err + } + + item := &CodecEntry{Args: args, mod: mod} if err := item.Init(); err != nil { return nil, err } @@ -31,36 +45,21 @@ func NewCodec(conf types.CodecConfig) (commontypes.Codec, error) { parsed.decoderDefs[k] = item } - return codecFromTypes(parsed), nil -} - -func codecFromTypes(parsed *parsedTypes) *evmCodec { - return &evmCodec{ - encoder: &encoder{Definitions: parsed.encoderDefs}, - decoder: &decoder{Definitions: parsed.decoderDefs}, - types: parsed, - } + return parsed.toCodec() } -var _ commontypes.TypeProvider = &evmCodec{} - type evmCodec struct { *encoder *decoder - types *parsedTypes -} - -type parsedTypes struct { - encoderDefs map[string]*CodecEntry - decoderDefs map[string]*CodecEntry + *parsedTypes } func (c *evmCodec) CreateType(itemType string, forEncoding bool) (any, error) { var itemTypes map[string]*CodecEntry if forEncoding { - itemTypes = c.types.encoderDefs + itemTypes = c.encoderDefs } else { - itemTypes = c.types.decoderDefs + itemTypes = c.decoderDefs } def, ok := itemTypes[itemType] @@ -68,5 +67,45 @@ func (c *evmCodec) CreateType(itemType string, forEncoding bool) (any, error) { return nil, commontypes.ErrInvalidType } - return def.checkedType, nil + return reflect.New(def.checkedType).Interface(), nil +} + +var bigIntType = reflect.TypeOf((*big.Int)(nil)) + +func sizeVerifyBigIntHook(from, to reflect.Type, data any) (any, error) { + if from.Implements(types.SizedBigIntType()) && + !to.Implements(types.SizedBigIntType()) && + !reflect.PointerTo(to).Implements(types.SizedBigIntType()) { + return codec.BigIntHook(from, bigIntType, reflect.ValueOf(data).Convert(bigIntType).Interface()) + } + + if !to.Implements(types.SizedBigIntType()) { + return data, nil + } + + var err error + data, err = codec.BigIntHook(from, bigIntType, data) + if err != nil { + return nil, err + } + + bi, ok := data.(*big.Int) + if !ok { + return data, nil + } + + converted := reflect.ValueOf(bi).Convert(to).Interface().(types.SizedBigInt) + return converted, converted.Verify() +} + +func decodeAccountHook(from, to reflect.Type, data any) (any, error) { + b32, _ := types.GetType("bytes32") + if from.Kind() == reflect.String && to == b32.Checked { + decoded, err := hexutil.Decode(data.(string)) + if err != nil { + return nil, fmt.Errorf("%w: %w", commontypes.ErrInvalidType, err) + } + return [32]byte(decoded), nil + } + return data, nil } diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go index 4231d5b01b5..cb9a603800a 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/codec_entry.go @@ -6,6 +6,8 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/smartcontractkit/chainlink-common/pkg/codec" + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" @@ -16,6 +18,7 @@ type CodecEntry struct { encodingPrefix []byte checkedType reflect.Type nativeType reflect.Type + mod codec.Modifier } func (entry *CodecEntry) Init() error { diff --git a/core/services/relay/evm/codec_test.go b/core/services/relay/evm/codec_test.go index 4a5d35a2870..3d597b34c5b 100644 --- a/core/services/relay/evm/codec_test.go +++ b/core/services/relay/evm/codec_test.go @@ -5,10 +5,13 @@ import ( "testing" "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common/hexutil" ocr2types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink-common/pkg/codec" + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" . "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" //nolint common practice to import test mods with . @@ -18,13 +21,15 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) +const anyExtraValue = 3 + func TestCodec(t *testing.T) { - RunCodecInterfaceTests(t, &codecInterfaceTester{}) + tester := &codecInterfaceTester{} + RunCodecInterfaceTests(t, tester) anyN := 10 + c := tester.GetCodec(t) t.Run("GetMaxEncodingSize delegates to GetMaxSize", func(t *testing.T) { - codec := getCodec(t) - - actual, err := codec.GetMaxEncodingSize(testutils.Context(t), anyN, sizeItemType) + actual, err := c.GetMaxEncodingSize(testutils.Context(t), anyN, sizeItemType) assert.NoError(t, err) expected, err := evm.GetMaxSize(anyN, parseDefs(t)[sizeItemType]) @@ -33,9 +38,7 @@ func TestCodec(t *testing.T) { }) t.Run("GetMaxDecodingSize delegates to GetMaxSize", func(t *testing.T) { - codec := getCodec(t) - - actual, err := codec.GetMaxDecodingSize(testutils.Context(t), anyN, sizeItemType) + actual, err := c.GetMaxDecodingSize(testutils.Context(t), anyN, sizeItemType) assert.NoError(t, err) expected, err := evm.GetMaxSize(anyN, parseDefs(t)[sizeItemType]) @@ -66,7 +69,29 @@ func (it *codecInterfaceTester) EncodeFields(t *testing.T, request *EncodeReques } func (it *codecInterfaceTester) GetCodec(t *testing.T) commontypes.Codec { - return getCodec(t) + codecConfig := types.CodecConfig{ChainCodecConfigs: map[string]types.ChainCodedConfig{}} + testStruct := CreateTestStruct(0, it) + for k, v := range codecDefs { + defBytes, err := json.Marshal(v) + require.NoError(t, err) + entry := codecConfig.ChainCodecConfigs[k] + entry.TypeAbi = string(defBytes) + if k == TestItemWithConfigExtra { + entry.ModifierConfigs = codec.ModifiersConfig{ + &codec.HardCodeConfig{ + OnChainValues: map[string]any{ + "BigField": testStruct.BigField.String(), + "Account": hexutil.Encode(testStruct.Account), + }, + OffChainValues: map[string]any{"ExtraField": anyExtraValue}}, + } + } + codecConfig.ChainCodecConfigs[k] = entry + } + + c, err := evm.NewCodec(codecConfig) + require.NoError(t, err) + return c } func (it *codecInterfaceTester) IncludeArrayEncodingSizeEnforcement() bool { @@ -160,24 +185,7 @@ var codecDefs = map[string][]abi.ArgumentMarshaling{ {Name: "Stuff", Type: "int256[]"}, {Name: "OtherStuff", Type: "int256"}, }, -} - -func getCodec(t require.TestingT) commontypes.Codec { - codecConfig := types.CodecConfig{ - ChainCodecConfigs: map[string]types.ChainCodedConfig{}, - } - - for k, v := range codecDefs { - defBytes, err := json.Marshal(v) - require.NoError(t, err) - entry := codecConfig.ChainCodecConfigs[k] - entry.TypeAbi = string(defBytes) - codecConfig.ChainCodecConfigs[k] = entry - } - - codec, err := evm.NewCodec(codecConfig) - require.NoError(t, err) - return codec + TestItemWithConfigExtra: ts, } func parseDefs(t *testing.T) map[string]abi.Arguments { diff --git a/core/services/relay/evm/decoder.go b/core/services/relay/evm/decoder.go index 867f9c5037a..4ba84506725 100644 --- a/core/services/relay/evm/decoder.go +++ b/core/services/relay/evm/decoder.go @@ -75,8 +75,9 @@ func setElements(length int, rDecode reflect.Value, iInto reflect.Value) error { func mapstructureDecode(src, dest any) error { mDecoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ - DecodeHook: evmDecoderHook, + DecodeHook: mapstructure.ComposeDecodeHookFunc(evmDecoderHooks...), Result: dest, + Squash: true, }) if err != nil || mDecoder.Decode(src) != nil { return commontypes.ErrInvalidType diff --git a/core/services/relay/evm/encoder.go b/core/services/relay/evm/encoder.go index 699796a31eb..167e651f58e 100644 --- a/core/services/relay/evm/encoder.go +++ b/core/services/relay/evm/encoder.go @@ -2,24 +2,17 @@ package evm import ( "context" - "math/big" "reflect" - "github.com/mitchellh/mapstructure" ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - "github.com/smartcontractkit/chainlink-common/pkg/codec" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" - - "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) type encoder struct { Definitions map[string]*CodecEntry } -var evmDecoderHook = mapstructure.ComposeDecodeHookFunc(codec.BigIntHook, codec.SliceToArrayVerifySizeHook, sizeVerifyBigIntHook) - var _ commontypes.Encoder = &encoder{} func (e *encoder) Encode(ctx context.Context, item any, itemType string) ([]byte, error) { @@ -42,13 +35,10 @@ func (e *encoder) GetMaxEncodingSize(ctx context.Context, n int, itemType string } func encode(item reflect.Value, info *CodecEntry) (ocrtypes.Report, error) { - iType := item.Type() - for iType.Kind() == reflect.Pointer { - iType = iType.Elem() + for item.Kind() == reflect.Pointer { + item = reflect.Indirect(item) } - switch iType.Kind() { - case reflect.Pointer: - return encode(item.Elem(), info) + switch item.Kind() { case reflect.Array, reflect.Slice: return encodeArray(item, info) case reflect.Struct, reflect.Map: @@ -119,23 +109,3 @@ func pack(info *CodecEntry, values ...any) (ocrtypes.Report, error) { return nil, commontypes.ErrInvalidType } - -func sizeVerifyBigIntHook(from, to reflect.Type, data any) (any, error) { - if !to.Implements(types.SizedBigIntType()) { - return data, nil - } - - var err error - data, err = codec.BigIntHook(from, reflect.TypeOf((*big.Int)(nil)), data) - if err != nil { - return nil, err - } - - bi, ok := data.(*big.Int) - if !ok { - return data, nil - } - - converted := reflect.ValueOf(bi).Convert(to).Interface().(types.SizedBigInt) - return converted, converted.Verify() -} diff --git a/core/services/relay/evm/parsed_types.go b/core/services/relay/evm/parsed_types.go new file mode 100644 index 00000000000..bd4443ffca0 --- /dev/null +++ b/core/services/relay/evm/parsed_types.go @@ -0,0 +1,46 @@ +package evm + +import ( + "fmt" + "reflect" + + "github.com/smartcontractkit/chainlink-common/pkg/codec" + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" +) + +type parsedTypes struct { + encoderDefs map[string]*CodecEntry + decoderDefs map[string]*CodecEntry +} + +func (parsed *parsedTypes) toCodec() (commontypes.CodecTypeProvider, error) { + modByType := map[string]codec.Modifier{} + if err := addEntries(parsed.encoderDefs, modByType); err != nil { + return nil, err + } + if err := addEntries(parsed.decoderDefs, modByType); err != nil { + return nil, err + } + + mod, err := codec.NewByItemTypeModifier(modByType) + if err != nil { + return nil, err + } + underlying := &evmCodec{ + encoder: &encoder{Definitions: parsed.encoderDefs}, + decoder: &decoder{Definitions: parsed.decoderDefs}, + parsedTypes: parsed, + } + return codec.NewModifierCodec(underlying, mod, evmDecoderHooks...) +} + +func addEntries(defs map[string]*CodecEntry, modByType map[string]codec.Modifier) error { + for k, def := range defs { + modByType[k] = def.mod + _, err := def.mod.RetypeForOffChain(reflect.PointerTo(def.checkedType), k) + if err != nil { + return fmt.Errorf("%w: cannot retype %v: %w", commontypes.ErrInvalidConfig, k, err) + } + } + return nil +} diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract.sol b/core/services/relay/evm/testfiles/chain_reader_test_contract.sol index ec38c20678a..58d4006a1ad 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract.sol +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract.sol @@ -44,6 +44,18 @@ contract LatestValueHolder { seen.push(TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct)); } + function ReturnSeen( + int32 field, + string calldata differentField, + uint8 oracleId, + uint8[32] calldata oracleIds, + bytes32 account, + bytes32[] calldata accounts, + int192 bigField, + MidLevelTestStruct calldata nestedStruct) pure public returns (TestStruct memory) { + return TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); + } + function GetElementAtIndex(uint256 i) public view returns (TestStruct memory) { // See chain_reader_interface_tests.go in chainlink-relay return seen[i-1]; diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi index 6f73e9feb88..e16fa1803e8 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi @@ -1 +1 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"AddTestStruct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"GetElementAtIndex","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GetPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"GetSliceValue","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"}] \ No newline at end of file +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"AddTestStruct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"GetElementAtIndex","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GetPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"GetSliceValue","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"ReturnSeen","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"}] \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin index 90c9f543f97..8cb80c9d82e 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a918202910219909216919091179055610e4d806100a96000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80637dd6af5b146100515780639ca04f6714610066578063bdb37c901461008f578063da8e7a82146100a4575b600080fd5b61006461005f366004610921565b6100b3565b005b610079610074366004610a0c565b6102e2565b6040516100869190610b71565b60405180910390f35b610097610592565b6040516100869190610b23565b60405160038152602001610086565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161018d84610cb2565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936101e49392850192919091019061061e565b50604082015160028201805460ff191660ff909216919091179055606082015161021490600383019060206106a2565b506080820151600482015560a0820151805161023a916005840191602090910190610730565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff199091161783558082015180519193926102cf9260098901929091019061061e565b5050505050505050505050505050505050565b6102ea61076a565b60006102f7600184610c8d565b8154811061030757610307610deb565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461034e90610db6565b80601f016020809104026020016040519081016040528092919081815260200182805461037a90610db6565b80156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116103fc57905050505050508152602001600482015481526020016005820180548060200260200160405190810160405280929190818152602001828054801561048c57602002820191906000526020600020905b815481526020019060010190808311610478575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061050390610db6565b80601f016020809104026020016040519081016040528092919081815260200182805461052f90610db6565b801561057c5780601f106105515761010080835404028352916020019161057c565b820191906000526020600020905b81548152906001019060200180831161055f57829003601f168201915b5050509190925250505090525090525092915050565b6060600180548060200260200160405190810160405280929190818152602001828054801561061457602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116105cf5790505b5050505050905090565b82805461062a90610db6565b90600052602060002090601f01602090048101928261064c5760008555610692565b82601f1061066557805160ff1916838001178555610692565b82800160010185558215610692579182015b82811115610692578251825591602001919060010190610677565b5061069e9291506107b9565b5090565b6001830191839082156106925791602002820160005b838211156106f657835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026106b8565b80156107235782816101000a81549060ff02191690556001016020816000010492830192600103026106f6565b505061069e9291506107b9565b8280548282559060005260206000209081019282156106925791602002820182811115610692578251825591602001919060010190610677565b60408051610100810182526000808252606060208301819052928201529081016107926107ce565b81526000602082018190526060604083018190528201526080016107b46107ed565b905290565b5b8082111561069e57600081556001016107ba565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016107b46040518060400160405280600060070b8152602001606081525090565b60008083601f84011261083b57600080fd5b50813567ffffffffffffffff81111561085357600080fd5b6020830191508360208260051b850101111561086e57600080fd5b9250929050565b80610400810183101561088757600080fd5b92915050565b8035601781900b811461089f57600080fd5b919050565b8035600381900b811461089f57600080fd5b60008083601f8401126108c857600080fd5b50813567ffffffffffffffff8111156108e057600080fd5b60208301915083602082850101111561086e57600080fd5b60006040828403121561090a57600080fd5b50919050565b803560ff8116811461089f57600080fd5b6000806000806000806000806000806104e08b8d03121561094157600080fd5b61094a8b6108a4565b995060208b013567ffffffffffffffff8082111561096757600080fd5b6109738e838f016108b6565b909b50995089915061098760408e01610910565b98506109968e60608f01610875565b97506104608d013596506104808d01359150808211156109b557600080fd5b6109c18e838f01610829565b90965094508491506109d66104a08e0161088d565b93506104c08d01359150808211156109ed57600080fd5b506109fa8d828e016108f8565b9150509295989b9194979a5092959850565b600060208284031215610a1e57600080fd5b5035919050565b600081518084526020808501945080840160005b83811015610a5557815187529582019590820190600101610a39565b509495945050505050565b8060005b6020808210610a735750610a8a565b825160ff1685529384019390910190600101610a64565b50505050565b6000815180845260005b81811015610ab657602081850181015186830182015201610a9a565b81811115610ac8576000602083870101525b50601f01601f19169290920160200192915050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610b1b6080850182610a90565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610b6557835167ffffffffffffffff1683529284019291840191600101610b3f565b50909695505050505050565b60208152610b8560208201835160030b9052565b600060208301516104e0806040850152610ba3610500850183610a90565b91506040850151610bb9606086018260ff169052565b506060850151610bcc6080860182610a60565b50608085015161048085015260a0850151601f1980868503016104a0870152610bf58483610a25565b935060c08701519150610c0e6104c087018360170b9052565b60e0870151915080868503018387015250610c298382610add565b9695505050505050565b6040805190810167ffffffffffffffff81118282101715610c5657610c56610e01565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610c8557610c85610e01565b604052919050565b600082821015610cad57634e487b7160e01b600052601160045260246000fd5b500390565b600060408236031215610cc457600080fd5b610ccc610c33565b82356001600160f01b031981168114610ce457600080fd5b815260208381013567ffffffffffffffff80821115610d0257600080fd5b818601915060408236031215610d1757600080fd5b610d1f610c33565b82358060070b8114610d3057600080fd5b81528284013582811115610d4357600080fd5b929092019136601f840112610d5757600080fd5b823582811115610d6957610d69610e01565b610d7b601f8201601f19168601610c5c565b92508083523685828601011115610d9157600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c90821680610dca57607f821691505b6020821081141561090a57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212206d3fcd0d6af66016f39be3d9948d2703697b0dfdbab6f47b494ab3d1f3d0d4c264736f6c63430008060033 \ No newline at end of file +608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a918202910219909216919091179055610f5c806100a96000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80637dd6af5b1461005c5780639ca04f6714610071578063b95ad4111461009a578063bdb37c90146100ad578063da8e7a82146100c2575b600080fd5b61006f61006a366004610a30565b6100d1565b005b61008461007f366004610b1b565b610300565b6040516100919190610c80565b60405180910390f35b6100846100a8366004610a30565b6105b0565b6100b56106a1565b6040516100919190610c32565b60405160038152602001610091565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016101ab84610dc1565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936102029392850192919091019061072d565b50604082015160028201805460ff191660ff909216919091179055606082015161023290600383019060206107b1565b506080820151600482015560a0820151805161025891600584019160209091019061083f565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff199091161783558082015180519193926102ed9260098901929091019061072d565b5050505050505050505050505050505050565b610308610879565b6000610315600184610d9c565b8154811061032557610325610efa565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461036c90610ec5565b80601f016020809104026020016040519081016040528092919081815260200182805461039890610ec5565b80156103e55780601f106103ba576101008083540402835291602001916103e5565b820191906000526020600020905b8154815290600101906020018083116103c857829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff1681526020600192830181810494850194909303909202910180841161041a5790505050505050815260200160048201548152602001600582018054806020026020016040519081016040528092919081815260200182805480156104aa57602002820191906000526020600020905b815481526020019060010190808311610496575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061052190610ec5565b80601f016020809104026020016040519081016040528092919081815260200182805461054d90610ec5565b801561059a5780601f1061056f5761010080835404028352916020019161059a565b820191906000526020600020905b81548152906001019060200180831161057d57829003601f168201915b5050509190925250505090525090525092915050565b6105b8610879565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161069084610dc1565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561072357602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116106de5790505b5050505050905090565b82805461073990610ec5565b90600052602060002090601f01602090048101928261075b57600085556107a1565b82601f1061077457805160ff19168380011785556107a1565b828001600101855582156107a1579182015b828111156107a1578251825591602001919060010190610786565b506107ad9291506108c8565b5090565b6001830191839082156107a15791602002820160005b8382111561080557835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026107c7565b80156108325782816101000a81549060ff0219169055600101602081600001049283019260010302610805565b50506107ad9291506108c8565b8280548282559060005260206000209081019282156107a157916020028201828111156107a1578251825591602001919060010190610786565b60408051610100810182526000808252606060208301819052928201529081016108a16108dd565b81526000602082018190526060604083018190528201526080016108c36108fc565b905290565b5b808211156107ad57600081556001016108c9565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016108c36040518060400160405280600060070b8152602001606081525090565b60008083601f84011261094a57600080fd5b50813567ffffffffffffffff81111561096257600080fd5b6020830191508360208260051b850101111561097d57600080fd5b9250929050565b80610400810183101561099657600080fd5b92915050565b8035601781900b81146109ae57600080fd5b919050565b8035600381900b81146109ae57600080fd5b60008083601f8401126109d757600080fd5b50813567ffffffffffffffff8111156109ef57600080fd5b60208301915083602082850101111561097d57600080fd5b600060408284031215610a1957600080fd5b50919050565b803560ff811681146109ae57600080fd5b6000806000806000806000806000806104e08b8d031215610a5057600080fd5b610a598b6109b3565b995060208b013567ffffffffffffffff80821115610a7657600080fd5b610a828e838f016109c5565b909b509950899150610a9660408e01610a1f565b9850610aa58e60608f01610984565b97506104608d013596506104808d0135915080821115610ac457600080fd5b610ad08e838f01610938565b9096509450849150610ae56104a08e0161099c565b93506104c08d0135915080821115610afc57600080fd5b50610b098d828e01610a07565b9150509295989b9194979a5092959850565b600060208284031215610b2d57600080fd5b5035919050565b600081518084526020808501945080840160005b83811015610b6457815187529582019590820190600101610b48565b509495945050505050565b8060005b6020808210610b825750610b99565b825160ff1685529384019390910190600101610b73565b50505050565b6000815180845260005b81811015610bc557602081850181015186830182015201610ba9565b81811115610bd7576000602083870101525b50601f01601f19169290920160200192915050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610c2a6080850182610b9f565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610c7457835167ffffffffffffffff1683529284019291840191600101610c4e565b50909695505050505050565b60208152610c9460208201835160030b9052565b600060208301516104e0806040850152610cb2610500850183610b9f565b91506040850151610cc8606086018260ff169052565b506060850151610cdb6080860182610b6f565b50608085015161048085015260a0850151601f1980868503016104a0870152610d048483610b34565b935060c08701519150610d1d6104c087018360170b9052565b60e0870151915080868503018387015250610d388382610bec565b9695505050505050565b6040805190810167ffffffffffffffff81118282101715610d6557610d65610f10565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610d9457610d94610f10565b604052919050565b600082821015610dbc57634e487b7160e01b600052601160045260246000fd5b500390565b600060408236031215610dd357600080fd5b610ddb610d42565b82356001600160f01b031981168114610df357600080fd5b815260208381013567ffffffffffffffff80821115610e1157600080fd5b818601915060408236031215610e2657600080fd5b610e2e610d42565b82358060070b8114610e3f57600080fd5b81528284013582811115610e5257600080fd5b929092019136601f840112610e6657600080fd5b823582811115610e7857610e78610f10565b610e8a601f8201601f19168601610d6b565b92508083523685828601011115610ea057600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c90821680610ed957607f821691505b60208210811415610a1957634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212203e9087524a5a63426d26593011ef69ba9a517930f68ed2747aed8804859d3ed064736f6c63430008060033 \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go index 2a8ee83e145..d2b173c6a6e 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go @@ -55,8 +55,8 @@ type TestStruct struct { // TestfilesMetaData contains all meta data concerning the Testfiles contract. var TestfilesMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a918202910219909216919091179055610e4d806100a96000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80637dd6af5b146100515780639ca04f6714610066578063bdb37c901461008f578063da8e7a82146100a4575b600080fd5b61006461005f366004610921565b6100b3565b005b610079610074366004610a0c565b6102e2565b6040516100869190610b71565b60405180910390f35b610097610592565b6040516100869190610b23565b60405160038152602001610086565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161018d84610cb2565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936101e49392850192919091019061061e565b50604082015160028201805460ff191660ff909216919091179055606082015161021490600383019060206106a2565b506080820151600482015560a0820151805161023a916005840191602090910190610730565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff199091161783558082015180519193926102cf9260098901929091019061061e565b5050505050505050505050505050505050565b6102ea61076a565b60006102f7600184610c8d565b8154811061030757610307610deb565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461034e90610db6565b80601f016020809104026020016040519081016040528092919081815260200182805461037a90610db6565b80156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116103fc57905050505050508152602001600482015481526020016005820180548060200260200160405190810160405280929190818152602001828054801561048c57602002820191906000526020600020905b815481526020019060010190808311610478575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061050390610db6565b80601f016020809104026020016040519081016040528092919081815260200182805461052f90610db6565b801561057c5780601f106105515761010080835404028352916020019161057c565b820191906000526020600020905b81548152906001019060200180831161055f57829003601f168201915b5050509190925250505090525090525092915050565b6060600180548060200260200160405190810160405280929190818152602001828054801561061457602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116105cf5790505b5050505050905090565b82805461062a90610db6565b90600052602060002090601f01602090048101928261064c5760008555610692565b82601f1061066557805160ff1916838001178555610692565b82800160010185558215610692579182015b82811115610692578251825591602001919060010190610677565b5061069e9291506107b9565b5090565b6001830191839082156106925791602002820160005b838211156106f657835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026106b8565b80156107235782816101000a81549060ff02191690556001016020816000010492830192600103026106f6565b505061069e9291506107b9565b8280548282559060005260206000209081019282156106925791602002820182811115610692578251825591602001919060010190610677565b60408051610100810182526000808252606060208301819052928201529081016107926107ce565b81526000602082018190526060604083018190528201526080016107b46107ed565b905290565b5b8082111561069e57600081556001016107ba565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016107b46040518060400160405280600060070b8152602001606081525090565b60008083601f84011261083b57600080fd5b50813567ffffffffffffffff81111561085357600080fd5b6020830191508360208260051b850101111561086e57600080fd5b9250929050565b80610400810183101561088757600080fd5b92915050565b8035601781900b811461089f57600080fd5b919050565b8035600381900b811461089f57600080fd5b60008083601f8401126108c857600080fd5b50813567ffffffffffffffff8111156108e057600080fd5b60208301915083602082850101111561086e57600080fd5b60006040828403121561090a57600080fd5b50919050565b803560ff8116811461089f57600080fd5b6000806000806000806000806000806104e08b8d03121561094157600080fd5b61094a8b6108a4565b995060208b013567ffffffffffffffff8082111561096757600080fd5b6109738e838f016108b6565b909b50995089915061098760408e01610910565b98506109968e60608f01610875565b97506104608d013596506104808d01359150808211156109b557600080fd5b6109c18e838f01610829565b90965094508491506109d66104a08e0161088d565b93506104c08d01359150808211156109ed57600080fd5b506109fa8d828e016108f8565b9150509295989b9194979a5092959850565b600060208284031215610a1e57600080fd5b5035919050565b600081518084526020808501945080840160005b83811015610a5557815187529582019590820190600101610a39565b509495945050505050565b8060005b6020808210610a735750610a8a565b825160ff1685529384019390910190600101610a64565b50505050565b6000815180845260005b81811015610ab657602081850181015186830182015201610a9a565b81811115610ac8576000602083870101525b50601f01601f19169290920160200192915050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610b1b6080850182610a90565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610b6557835167ffffffffffffffff1683529284019291840191600101610b3f565b50909695505050505050565b60208152610b8560208201835160030b9052565b600060208301516104e0806040850152610ba3610500850183610a90565b91506040850151610bb9606086018260ff169052565b506060850151610bcc6080860182610a60565b50608085015161048085015260a0850151601f1980868503016104a0870152610bf58483610a25565b935060c08701519150610c0e6104c087018360170b9052565b60e0870151915080868503018387015250610c298382610add565b9695505050505050565b6040805190810167ffffffffffffffff81118282101715610c5657610c56610e01565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610c8557610c85610e01565b604052919050565b600082821015610cad57634e487b7160e01b600052601160045260246000fd5b500390565b600060408236031215610cc457600080fd5b610ccc610c33565b82356001600160f01b031981168114610ce457600080fd5b815260208381013567ffffffffffffffff80821115610d0257600080fd5b818601915060408236031215610d1757600080fd5b610d1f610c33565b82358060070b8114610d3057600080fd5b81528284013582811115610d4357600080fd5b929092019136601f840112610d5757600080fd5b823582811115610d6957610d69610e01565b610d7b601f8201601f19168601610c5c565b92508083523685828601011115610d9157600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c90821680610dca57607f821691505b6020821081141561090a57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212206d3fcd0d6af66016f39be3d9948d2703697b0dfdbab6f47b494ab3d1f3d0d4c264736f6c63430008060033", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"ReturnSeen\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a918202910219909216919091179055610f5c806100a96000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80637dd6af5b1461005c5780639ca04f6714610071578063b95ad4111461009a578063bdb37c90146100ad578063da8e7a82146100c2575b600080fd5b61006f61006a366004610a30565b6100d1565b005b61008461007f366004610b1b565b610300565b6040516100919190610c80565b60405180910390f35b6100846100a8366004610a30565b6105b0565b6100b56106a1565b6040516100919190610c32565b60405160038152602001610091565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016101ab84610dc1565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936102029392850192919091019061072d565b50604082015160028201805460ff191660ff909216919091179055606082015161023290600383019060206107b1565b506080820151600482015560a0820151805161025891600584019160209091019061083f565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff199091161783558082015180519193926102ed9260098901929091019061072d565b5050505050505050505050505050505050565b610308610879565b6000610315600184610d9c565b8154811061032557610325610efa565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461036c90610ec5565b80601f016020809104026020016040519081016040528092919081815260200182805461039890610ec5565b80156103e55780601f106103ba576101008083540402835291602001916103e5565b820191906000526020600020905b8154815290600101906020018083116103c857829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff1681526020600192830181810494850194909303909202910180841161041a5790505050505050815260200160048201548152602001600582018054806020026020016040519081016040528092919081815260200182805480156104aa57602002820191906000526020600020905b815481526020019060010190808311610496575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061052190610ec5565b80601f016020809104026020016040519081016040528092919081815260200182805461054d90610ec5565b801561059a5780601f1061056f5761010080835404028352916020019161059a565b820191906000526020600020905b81548152906001019060200180831161057d57829003601f168201915b5050509190925250505090525090525092915050565b6105b8610879565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161069084610dc1565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561072357602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116106de5790505b5050505050905090565b82805461073990610ec5565b90600052602060002090601f01602090048101928261075b57600085556107a1565b82601f1061077457805160ff19168380011785556107a1565b828001600101855582156107a1579182015b828111156107a1578251825591602001919060010190610786565b506107ad9291506108c8565b5090565b6001830191839082156107a15791602002820160005b8382111561080557835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026107c7565b80156108325782816101000a81549060ff0219169055600101602081600001049283019260010302610805565b50506107ad9291506108c8565b8280548282559060005260206000209081019282156107a157916020028201828111156107a1578251825591602001919060010190610786565b60408051610100810182526000808252606060208301819052928201529081016108a16108dd565b81526000602082018190526060604083018190528201526080016108c36108fc565b905290565b5b808211156107ad57600081556001016108c9565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016108c36040518060400160405280600060070b8152602001606081525090565b60008083601f84011261094a57600080fd5b50813567ffffffffffffffff81111561096257600080fd5b6020830191508360208260051b850101111561097d57600080fd5b9250929050565b80610400810183101561099657600080fd5b92915050565b8035601781900b81146109ae57600080fd5b919050565b8035600381900b81146109ae57600080fd5b60008083601f8401126109d757600080fd5b50813567ffffffffffffffff8111156109ef57600080fd5b60208301915083602082850101111561097d57600080fd5b600060408284031215610a1957600080fd5b50919050565b803560ff811681146109ae57600080fd5b6000806000806000806000806000806104e08b8d031215610a5057600080fd5b610a598b6109b3565b995060208b013567ffffffffffffffff80821115610a7657600080fd5b610a828e838f016109c5565b909b509950899150610a9660408e01610a1f565b9850610aa58e60608f01610984565b97506104608d013596506104808d0135915080821115610ac457600080fd5b610ad08e838f01610938565b9096509450849150610ae56104a08e0161099c565b93506104c08d0135915080821115610afc57600080fd5b50610b098d828e01610a07565b9150509295989b9194979a5092959850565b600060208284031215610b2d57600080fd5b5035919050565b600081518084526020808501945080840160005b83811015610b6457815187529582019590820190600101610b48565b509495945050505050565b8060005b6020808210610b825750610b99565b825160ff1685529384019390910190600101610b73565b50505050565b6000815180845260005b81811015610bc557602081850181015186830182015201610ba9565b81811115610bd7576000602083870101525b50601f01601f19169290920160200192915050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610c2a6080850182610b9f565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610c7457835167ffffffffffffffff1683529284019291840191600101610c4e565b50909695505050505050565b60208152610c9460208201835160030b9052565b600060208301516104e0806040850152610cb2610500850183610b9f565b91506040850151610cc8606086018260ff169052565b506060850151610cdb6080860182610b6f565b50608085015161048085015260a0850151601f1980868503016104a0870152610d048483610b34565b935060c08701519150610d1d6104c087018360170b9052565b60e0870151915080868503018387015250610d388382610bec565b9695505050505050565b6040805190810167ffffffffffffffff81118282101715610d6557610d65610f10565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610d9457610d94610f10565b604052919050565b600082821015610dbc57634e487b7160e01b600052601160045260246000fd5b500390565b600060408236031215610dd357600080fd5b610ddb610d42565b82356001600160f01b031981168114610df357600080fd5b815260208381013567ffffffffffffffff80821115610e1157600080fd5b818601915060408236031215610e2657600080fd5b610e2e610d42565b82358060070b8114610e3f57600080fd5b81528284013582811115610e5257600080fd5b929092019136601f840112610e6657600080fd5b823582811115610e7857610e78610f10565b610e8a601f8201601f19168601610d6b565b92508083523685828601011115610ea057600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c90821680610ed957607f821691505b60208210811415610a1957634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212203e9087524a5a63426d26593011ef69ba9a517930f68ed2747aed8804859d3ed064736f6c63430008060033", } // TestfilesABI is the input ABI used to generate the binding from. @@ -319,6 +319,37 @@ func (_Testfiles *TestfilesCallerSession) GetSliceValue() ([]uint64, error) { return _Testfiles.Contract.GetSliceValue(&_Testfiles.CallOpts) } +// ReturnSeen is a free data retrieval call binding the contract method 0xb95ad411. +// +// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) +func (_Testfiles *TestfilesCaller) ReturnSeen(opts *bind.CallOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { + var out []interface{} + err := _Testfiles.contract.Call(opts, &out, "ReturnSeen", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) + + if err != nil { + return *new(TestStruct), err + } + + out0 := *abi.ConvertType(out[0], new(TestStruct)).(*TestStruct) + + return out0, err + +} + +// ReturnSeen is a free data retrieval call binding the contract method 0xb95ad411. +// +// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) +func (_Testfiles *TestfilesSession) ReturnSeen(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { + return _Testfiles.Contract.ReturnSeen(&_Testfiles.CallOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +// ReturnSeen is a free data retrieval call binding the contract method 0xb95ad411. +// +// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) +func (_Testfiles *TestfilesCallerSession) ReturnSeen(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { + return _Testfiles.Contract.ReturnSeen(&_Testfiles.CallOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + // AddTestStruct is a paid mutator transaction binding the contract method 0x7dd6af5b. // // Solidity: function AddTestStruct(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() diff --git a/core/services/relay/evm/types/types.go b/core/services/relay/evm/types/types.go index 6f3b6b5fc6f..081a127e60c 100644 --- a/core/services/relay/evm/types/types.go +++ b/core/services/relay/evm/types/types.go @@ -8,11 +8,10 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/lib/pq" - - "gopkg.in/guregu/null.v2" - ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + "gopkg.in/guregu/null.v2" + "github.com/smartcontractkit/chainlink-common/pkg/codec" "github.com/smartcontractkit/chainlink-common/pkg/services" "github.com/smartcontractkit/chainlink-common/pkg/types" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" @@ -38,8 +37,8 @@ type CodecConfig struct { } type ChainCodedConfig struct { - TypeAbi string `json:"typeAbi"` - // TODO transform configs that allow hard-coding values or transforming them (max, min, median etc) + TypeAbi string `json:"typeAbi"` + ModifierConfigs codec.ModifiersConfig } type ChainContractReader struct { @@ -49,11 +48,11 @@ type ChainContractReader struct { } type ChainReaderDefinition struct { - ChainSpecificName string `json:"chainSpecificName"` // chain specific contract method name or event type. - Params map[string]any `json:"params"` - ReturnValues []string `json:"returnValues"` - CacheEnabled bool `json:"cacheEnabled"` - ReadType `json:"readType"` + ChainSpecificName string `json:"chainSpecificName"` // chain specific contract method name or event type. + CacheEnabled bool `json:"cacheEnabled"` + ReadType `json:"readType"` + InputModifications codec.ModifiersConfig `json:"input_modifications"` + OutputModifications codec.ModifiersConfig `json:"output_modifications"` } type ReadType int64 diff --git a/go.mod b/go.mod index c7bcadcf346..dcd2c062b9f 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 diff --git a/go.sum b/go.sum index 71526ba239f..aa409aa9292 100644 --- a/go.sum +++ b/go.sum @@ -1468,8 +1468,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 h1:Q7Lif7+Hr3A1gsFooCp/StP93qVPuixn32XEllZnSdY= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606 h1:7nWx4+ZTUQkzzTnzSK8WwinuJl4IiWa3nl8hvaHYd+8= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 582e102986b..308beb36789 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606 github.com/smartcontractkit/chainlink-testing-framework v1.19.5 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 25680abdfe1..363df863d61 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2375,8 +2375,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7 h1:Q7Lif7+Hr3A1gsFooCp/StP93qVPuixn32XEllZnSdY= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231128165554-4ca240b67cd7/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606 h1:7nWx4+ZTUQkzzTnzSK8WwinuJl4IiWa3nl8hvaHYd+8= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206142922-babe5ac0b606/go.mod h1:ipa32mlAXbF3uUQqfVDNxQbBiyu2KKA3AwhK3ewhSSU= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= From c0f7ff64bf8fab52007062279f2f94ee80a2e735 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 6 Dec 2023 19:41:38 -0500 Subject: [PATCH 036/112] small fixes after merging --- core/services/relay/evm/types/types.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/services/relay/evm/types/types.go b/core/services/relay/evm/types/types.go index a6857296366..cb0b910b0f5 100644 --- a/core/services/relay/evm/types/types.go +++ b/core/services/relay/evm/types/types.go @@ -8,12 +8,10 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/lib/pq" "github.com/pkg/errors" - "github.com/smartcontractkit/chainlink-common/pkg/codec" - - "gopkg.in/guregu/null.v2" - ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + "gopkg.in/guregu/null.v2" + "github.com/smartcontractkit/chainlink-common/pkg/codec" "github.com/smartcontractkit/chainlink-common/pkg/services" "github.com/smartcontractkit/chainlink-common/pkg/types" From 7423f5d8c4861bafbaf9cc7047523ba9e2d5ee40 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Thu, 7 Dec 2023 11:05:24 -0500 Subject: [PATCH 037/112] Small cleanups and comments --- core/services/relay/evm/chain_reader.go | 20 ++++++++++++++------ core/services/relay/evm/chain_reader_test.go | 9 +-------- core/services/relay/evm/codec.go | 15 +++++++++++---- core/services/relay/evm/codec_entry.go | 6 +++--- core/services/relay/evm/codec_entry_test.go | 10 +++++----- core/services/relay/evm/codec_test.go | 2 -- core/services/relay/evm/decoder.go | 4 ++-- core/services/relay/evm/encoder.go | 10 +++++----- core/services/relay/evm/parsed_types.go | 18 ++++++++++-------- 9 files changed, 51 insertions(+), 43 deletions(-) diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index 87a4b66f12b..b056a90b5ec 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -37,8 +37,8 @@ type chainReader struct { func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, chain evm.Chain, config types.ChainReaderConfig) (ChainReaderService, error) { parsed := &parsedTypes{ - encoderDefs: map[string]*CodecEntry{}, - decoderDefs: map[string]*CodecEntry{}, + encoderDefs: map[string]*codecEntry{}, + decoderDefs: map[string]*codecEntry{}, } if err := addTypes(config.ChainContractReaders, parsed); err != nil { @@ -118,8 +118,17 @@ func addMethods(name string, abi abi.ABI, chainReaderDefinition types.ChainReade return fmt.Errorf("method: %q doesn't exist", chainReaderDefinition.ChainSpecificName) } + if err := addEncoderDef(name, method, parsed, chainReaderDefinition); err != nil { + return err + } + + return addDecoderDef(name, method.Outputs, parsed, chainReaderDefinition) +} + +func addEncoderDef(name string, method abi.Method, parsed *parsedTypes, chainReaderDefinition types.ChainReaderDefinition) error { // ABI.Pack prepends the method.ID to the encodings, we'll need the encoder to do the same. - input := &CodecEntry{Args: method.Inputs, encodingPrefix: method.ID} + input := &codecEntry{Args: method.Inputs, encodingPrefix: method.ID} + if err := input.Init(); err != nil { return err } @@ -130,12 +139,11 @@ func addMethods(name string, abi abi.ABI, chainReaderDefinition types.ChainReade } input.mod = inputMod parsed.encoderDefs[wrapItemType(name, true)] = input - - return addDecoderDef(name, method.Outputs, parsed, chainReaderDefinition) + return nil } func addDecoderDef(name string, outputs abi.Arguments, parsed *parsedTypes, def types.ChainReaderDefinition) error { - output := &CodecEntry{Args: outputs} + output := &codecEntry{Args: outputs} mod, err := def.OutputModifications.ToModifier(evmDecoderHooks...) if err != nil { return err diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 81fb0e3d8be..b8a4bf49ae9 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -51,15 +51,12 @@ type chainReaderInterfaceTester struct { } func (it *chainReaderInterfaceTester) Setup(t *testing.T) { - if it.chain != nil { - return - } - // can re-use the same chain for tests, just make new contract for each test if it.chain != nil { return } + t.Cleanup(func() { it.address = "" }) it.chain = &mocks.Chain{} it.setupChainNoClient(t) it.chain.On("LogPoller").Return(logger.NullLogger) @@ -102,10 +99,6 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { it.chain.On("Client").Return(client.NewSimulatedBackendClient(t, it.sim, big.NewInt(1337))) } -func (it *chainReaderInterfaceTester) Teardown(_ *testing.T) { - it.address = "" -} - func (it *chainReaderInterfaceTester) Name() string { return "EVM" } diff --git a/core/services/relay/evm/codec.go b/core/services/relay/evm/codec.go index 616fac03b44..168c709e782 100644 --- a/core/services/relay/evm/codec.go +++ b/core/services/relay/evm/codec.go @@ -17,12 +17,19 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) +// decodeAccountHook allows strings to be converted to [32]byte allowing config to represent them as 0x... +// BigIntHook allows *big.Int to be represented as any integer type or a string and to go back to them. +// Useful for config, or if when a model may use a go type that isn't a *big.Int when Pack expects one. +// Eg: int32 in a go struct from a plugin could require a *big.Int in Pack for int24, if it fits, we shouldn't care. +// SliceToArrayVerifySizeHook verifies that slices have the correct size when converting to an array +// sizeVerifyBigIntHook allows our custom types that verify the number fits in the on-chain type to be converted as-if +// it was a *big.Int var evmDecoderHooks = []mapstructure.DecodeHookFunc{decodeAccountHook, codec.BigIntHook, codec.SliceToArrayVerifySizeHook, sizeVerifyBigIntHook} func NewCodec(conf types.CodecConfig) (commontypes.CodecTypeProvider, error) { parsed := &parsedTypes{ - encoderDefs: map[string]*CodecEntry{}, - decoderDefs: map[string]*CodecEntry{}, + encoderDefs: map[string]*codecEntry{}, + decoderDefs: map[string]*codecEntry{}, } for k, v := range conf.ChainCodecConfigs { @@ -36,7 +43,7 @@ func NewCodec(conf types.CodecConfig) (commontypes.CodecTypeProvider, error) { return nil, err } - item := &CodecEntry{Args: args, mod: mod} + item := &codecEntry{Args: args, mod: mod} if err := item.Init(); err != nil { return nil, err } @@ -55,7 +62,7 @@ type evmCodec struct { } func (c *evmCodec) CreateType(itemType string, forEncoding bool) (any, error) { - var itemTypes map[string]*CodecEntry + var itemTypes map[string]*codecEntry if forEncoding { itemTypes = c.encoderDefs } else { diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go index cb9a603800a..e8a7a51165f 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/codec_entry.go @@ -13,7 +13,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) -type CodecEntry struct { +type codecEntry struct { Args abi.Arguments encodingPrefix []byte checkedType reflect.Type @@ -21,7 +21,7 @@ type CodecEntry struct { mod codec.Modifier } -func (entry *CodecEntry) Init() error { +func (entry *codecEntry) Init() error { if entry.checkedType != nil { return nil } @@ -58,7 +58,7 @@ func (entry *CodecEntry) Init() error { return nil } -func (entry *CodecEntry) GetMaxSize(n int) (int, error) { +func (entry *codecEntry) GetMaxSize(n int) (int, error) { if entry == nil { return 0, commontypes.ErrInvalidType } diff --git a/core/services/relay/evm/codec_entry_test.go b/core/services/relay/evm/codec_entry_test.go index 17491a12f4b..df843bff85f 100644 --- a/core/services/relay/evm/codec_entry_test.go +++ b/core/services/relay/evm/codec_entry_test.go @@ -24,7 +24,7 @@ func TestCodecEntry(t *testing.T) { require.NoError(t, err) type4, err := abi.NewType("int24", "", []abi.ArgumentMarshaling{}) require.NoError(t, err) - entry := CodecEntry{ + entry := codecEntry{ Args: abi.Arguments{ {Name: "Field1", Type: type1}, {Name: "Field2", Type: type2}, @@ -66,7 +66,7 @@ func TestCodecEntry(t *testing.T) { {Name: "Field4", Type: "int24"}, }) require.NoError(t, err) - entry := CodecEntry{ + entry := codecEntry{ Args: abi.Arguments{ {Name: "Field1", Type: type1}, {Name: "Field2", Type: tupleType}, @@ -104,7 +104,7 @@ func TestCodecEntry(t *testing.T) { {Name: "Field1", Type: "int16"}, }) require.NoError(t, err) - entry := CodecEntry{ + entry := codecEntry{ Args: abi.Arguments{{Name: "", Type: wrappedTuple}}, } require.NoError(t, entry.Init()) @@ -116,7 +116,7 @@ func TestCodecEntry(t *testing.T) { t.Run("slice types", func(t *testing.T) { type1, err := abi.NewType("int16[]", "", []abi.ArgumentMarshaling{}) require.NoError(t, err) - entry := CodecEntry{ + entry := codecEntry{ Args: abi.Arguments{{Name: "Field1", Type: type1}}, } require.NoError(t, entry.Init()) @@ -128,7 +128,7 @@ func TestCodecEntry(t *testing.T) { t.Run("array types", func(t *testing.T) { type1, err := abi.NewType("int16[3]", "", []abi.ArgumentMarshaling{}) require.NoError(t, err) - entry := CodecEntry{ + entry := codecEntry{ Args: abi.Arguments{{Name: "Field1", Type: type1}}, } require.NoError(t, entry.Init()) diff --git a/core/services/relay/evm/codec_test.go b/core/services/relay/evm/codec_test.go index 3d597b34c5b..dd1977eb39c 100644 --- a/core/services/relay/evm/codec_test.go +++ b/core/services/relay/evm/codec_test.go @@ -51,8 +51,6 @@ type codecInterfaceTester struct{} func (it *codecInterfaceTester) Setup(_ *testing.T) {} -func (it *codecInterfaceTester) Teardown(_ *testing.T) {} - func (it *codecInterfaceTester) GetAccountBytes(i int) []byte { account := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2} account[i%32] += byte(i) diff --git a/core/services/relay/evm/decoder.go b/core/services/relay/evm/decoder.go index 4ba84506725..96f560ae9a8 100644 --- a/core/services/relay/evm/decoder.go +++ b/core/services/relay/evm/decoder.go @@ -10,7 +10,7 @@ import ( ) type decoder struct { - Definitions map[string]*CodecEntry + Definitions map[string]*codecEntry } var _ commontypes.Decoder = &decoder{} @@ -50,7 +50,7 @@ func (m *decoder) GetMaxDecodingSize(ctx context.Context, n int, itemType string return m.Definitions[itemType].GetMaxSize(n) } -func extractDecoding(info *CodecEntry, raw []byte) (any, error) { +func extractDecoding(info *codecEntry, raw []byte) (any, error) { unpacked := map[string]any{} if err := info.Args.UnpackIntoMap(unpacked, raw); err != nil { return nil, commontypes.ErrInvalidEncoding diff --git a/core/services/relay/evm/encoder.go b/core/services/relay/evm/encoder.go index 167e651f58e..09f1b40184b 100644 --- a/core/services/relay/evm/encoder.go +++ b/core/services/relay/evm/encoder.go @@ -10,7 +10,7 @@ import ( ) type encoder struct { - Definitions map[string]*CodecEntry + Definitions map[string]*codecEntry } var _ commontypes.Encoder = &encoder{} @@ -34,7 +34,7 @@ func (e *encoder) GetMaxEncodingSize(ctx context.Context, n int, itemType string return e.Definitions[itemType].GetMaxSize(n) } -func encode(item reflect.Value, info *CodecEntry) (ocrtypes.Report, error) { +func encode(item reflect.Value, info *codecEntry) (ocrtypes.Report, error) { for item.Kind() == reflect.Pointer { item = reflect.Indirect(item) } @@ -48,7 +48,7 @@ func encode(item reflect.Value, info *CodecEntry) (ocrtypes.Report, error) { } } -func encodeArray(item reflect.Value, info *CodecEntry) (ocrtypes.Report, error) { +func encodeArray(item reflect.Value, info *codecEntry) (ocrtypes.Report, error) { length := item.Len() var native reflect.Value switch info.checkedType.Kind() { @@ -76,7 +76,7 @@ func encodeArray(item reflect.Value, info *CodecEntry) (ocrtypes.Report, error) return pack(info, native.Interface()) } -func encodeItem(item reflect.Value, info *CodecEntry) (ocrtypes.Report, error) { +func encodeItem(item reflect.Value, info *codecEntry) (ocrtypes.Report, error) { if item.Type() == reflect.PointerTo(info.checkedType) { item = reflect.NewAt(info.nativeType, item.UnsafePointer()) } else if item.Type() != reflect.PointerTo(info.nativeType) { @@ -100,7 +100,7 @@ func encodeItem(item reflect.Value, info *CodecEntry) (ocrtypes.Report, error) { return pack(info, values...) } -func pack(info *CodecEntry, values ...any) (ocrtypes.Report, error) { +func pack(info *codecEntry, values ...any) (ocrtypes.Report, error) { if bytes, err := info.Args.Pack(values...); err == nil { withPrefix := make([]byte, 0, len(info.encodingPrefix)+len(bytes)) withPrefix = append(withPrefix, info.encodingPrefix...) diff --git a/core/services/relay/evm/parsed_types.go b/core/services/relay/evm/parsed_types.go index bd4443ffca0..9e12eafcd50 100644 --- a/core/services/relay/evm/parsed_types.go +++ b/core/services/relay/evm/parsed_types.go @@ -9,20 +9,20 @@ import ( ) type parsedTypes struct { - encoderDefs map[string]*CodecEntry - decoderDefs map[string]*CodecEntry + encoderDefs map[string]*codecEntry + decoderDefs map[string]*codecEntry } func (parsed *parsedTypes) toCodec() (commontypes.CodecTypeProvider, error) { - modByType := map[string]codec.Modifier{} - if err := addEntries(parsed.encoderDefs, modByType); err != nil { + modByTypeName := map[string]codec.Modifier{} + if err := addEntries(parsed.encoderDefs, modByTypeName); err != nil { return nil, err } - if err := addEntries(parsed.decoderDefs, modByType); err != nil { + if err := addEntries(parsed.decoderDefs, modByTypeName); err != nil { return nil, err } - mod, err := codec.NewByItemTypeModifier(modByType) + mod, err := codec.NewByItemTypeModifier(modByTypeName) if err != nil { return nil, err } @@ -34,9 +34,11 @@ func (parsed *parsedTypes) toCodec() (commontypes.CodecTypeProvider, error) { return codec.NewModifierCodec(underlying, mod, evmDecoderHooks...) } -func addEntries(defs map[string]*CodecEntry, modByType map[string]codec.Modifier) error { +// addEntries extracts the mods from codecEntry and adds them to modByTypeName use with codec.NewByItemTypeModifier +// Since each input/output can have its own modifications, we need to keep track of them by type name +func addEntries(defs map[string]*codecEntry, modByTypeName map[string]codec.Modifier) error { for k, def := range defs { - modByType[k] = def.mod + modByTypeName[k] = def.mod _, err := def.mod.RetypeForOffChain(reflect.PointerTo(def.checkedType), k) if err != nil { return fmt.Errorf("%w: cannot retype %v: %w", commontypes.ErrInvalidConfig, k, err) From c990a7a6e0b18ec36392f1d25e61cdab192ce6b3 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Thu, 7 Dec 2023 16:49:32 -0500 Subject: [PATCH 038/112] fix after merge --- core/scripts/go.mod | 1 + core/services/relay/evm/types/types.go | 5 +++-- go.mod | 2 +- integration-tests/go.mod | 1 + integration-tests/go.sum | 2 ++ 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 327208e5638..db57f375369 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -327,6 +327,7 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect + gopkg.in/guregu/null.v2 v2.1.2 // indirect gopkg.in/guregu/null.v4 v4.0.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect diff --git a/core/services/relay/evm/types/types.go b/core/services/relay/evm/types/types.go index c179251a8af..cb0b910b0f5 100644 --- a/core/services/relay/evm/types/types.go +++ b/core/services/relay/evm/types/types.go @@ -8,11 +8,12 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/lib/pq" "github.com/pkg/errors" + ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + "gopkg.in/guregu/null.v2" + "github.com/smartcontractkit/chainlink-common/pkg/codec" "github.com/smartcontractkit/chainlink-common/pkg/services" "github.com/smartcontractkit/chainlink-common/pkg/types" - ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - "gopkg.in/guregu/null.v2" "github.com/smartcontractkit/chainlink/v2/core/utils" ) diff --git a/go.mod b/go.mod index a1356934488..561ea91ed80 100644 --- a/go.mod +++ b/go.mod @@ -104,7 +104,7 @@ require ( gopkg.in/natefinch/lumberjack.v2 v2.0.0 ) -require gopkg.in/guregu/null.v2 v2.1.2 // indirect +require gopkg.in/guregu/null.v2 v2.1.2 require ( cloud.google.com/go/compute v1.23.3 // indirect diff --git a/integration-tests/go.mod b/integration-tests/go.mod index d500194878b..583d1592c71 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -434,6 +434,7 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect + gopkg.in/guregu/null.v2 v2.1.2 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 3b0631cda1d..e3be6249d42 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2326,6 +2326,8 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= +gopkg.in/guregu/null.v2 v2.1.2 h1:YOuepWdYqGnrenzPyMi+ybCjeDzjdazynbwsXXOk4i8= +gopkg.in/guregu/null.v2 v2.1.2/go.mod h1:XORrx8tyS5ZDcyUboCIxQtta/Aujk/6pfWrn9Xe33mU= gopkg.in/guregu/null.v4 v4.0.0 h1:1Wm3S1WEA2I26Kq+6vcW+w0gcDo44YKYD7YIEJNHDjg= gopkg.in/guregu/null.v4 v4.0.0/go.mod h1:YoQhUrADuG3i9WqesrCmpNRwm1ypAgSHYqoOcTu/JrI= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= From 2590e1b0459d439a304f03f308f452af333e3579 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Thu, 7 Dec 2023 10:22:53 -0500 Subject: [PATCH 039/112] add events --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 +- core/services/relay/evm/chain_reader.go | 95 ++++++---- core/services/relay/evm/chain_reader_test.go | 68 +++++-- core/services/relay/evm/codec_test.go | 3 +- core/services/relay/evm/evm.go | 3 +- .../testfiles/chain_reader_test_contract.sol | 21 +++ .../chain_reader_test_contract_gen.abi | 2 +- .../chain_reader_test_contract_gen.bin | 2 +- .../chain_reader_test_contract_gen.go | 166 +++++++++++++++++- go.mod | 2 +- go.sum | 4 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- 14 files changed, 319 insertions(+), 59 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index db57f375369..437ec17db15 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -258,7 +258,7 @@ require ( github.com/shirou/gopsutil/v3 v3.23.10 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206153113-f86b0b21496d // indirect + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 56a67fcc82b..e9de4b92a4e 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1214,8 +1214,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206153113-f86b0b21496d h1:ibnzqA27rmFXJvBKQhx1D/tg7X0Oe9tPsWNhi+GQ3sM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206153113-f86b0b21496d/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6 h1:Vqi/po+LG3J47USCh83vvjutn2KX8nr7PsU9q4qHt2o= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index de4940c177c..d14da6f290c 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -10,9 +10,11 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/pkg/errors" + commonservices "github.com/smartcontractkit/chainlink-common/pkg/services" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" @@ -27,44 +29,63 @@ type ChainReaderService interface { } type chainReader struct { - lggr logger.Logger - lp logpoller.LogPoller - codec commontypes.RemoteCodec - client evmclient.Client + lggr logger.Logger + lp logpoller.LogPoller + codec commontypes.RemoteCodec + client evmclient.Client + contractID common.Address + events map[string]common.Hash + commonservices.StateMachine } // NewChainReaderService is a constructor for ChainReader, returns nil if there is any error -func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, chain legacyevm.Chain, config types.ChainReaderConfig) (ChainReaderService, error) { - +func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, contractID common.Address, chain legacyevm.Chain, config types.ChainReaderConfig) (ChainReaderService, error) { parsed := &parsedTypes{ encoderDefs: map[string]*codecEntry{}, decoderDefs: map[string]*codecEntry{}, } - if err := addTypes(config.ChainContractReaders, parsed); err != nil { + events, err := addTypes(config.ChainContractReaders, parsed) + if err != nil { return nil, err } c, err := parsed.toCodec() return &chainReader{ - lggr: lggr.Named("ChainReader"), - lp: lp, - codec: c, - client: chain.Client(), + lggr: lggr.Named("ChainReader"), + lp: lp, + codec: c, + client: chain.Client(), + contractID: contractID, + events: events, }, err } func (cr *chainReader) Name() string { return cr.lggr.Name() } -func (cr *chainReader) initialize() error { - // Initialize chain reader, start cache polling loop, etc. - return nil -} - var _ commontypes.TypeProvider = &chainReader{} func (cr *chainReader) GetLatestValue(ctx context.Context, bc commontypes.BoundContract, method string, params any, returnVal any) error { + if hash, ok := cr.events[method]; ok { + return cr.getLatestValueFromLogPoller(ctx, bc, method, hash, returnVal) + } + return cr.getLatestValueFromContract(ctx, bc, method, params, returnVal) +} + +func (cr *chainReader) getLatestValueFromLogPoller(ctx context.Context, bc commontypes.BoundContract, method string, hash common.Hash, returnVal any) error { + contractAddr := common.HexToAddress(bc.Address) + log, err := cr.lp.LatestLogByEventSigWithConfs(hash, contractAddr, logpoller.Finalized) + if err != nil { + if strings.Contains(err.Error(), "not found") { + return fmt.Errorf("%w: %w", commontypes.ErrNotFound, err) + } + return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) + } + return cr.codec.Decode(ctx, log.Data, returnVal, wrapItemType(method, false)) +} + +func (cr *chainReader) getLatestValueFromContract(ctx context.Context, bc commontypes.BoundContract, method string, params any, returnVal any) error { data, err := cr.codec.Encode(ctx, params, wrapItemType(method, true)) if err != nil { return err @@ -86,13 +107,23 @@ func (cr *chainReader) GetLatestValue(ctx context.Context, bc commontypes.BoundC return cr.codec.Decode(ctx, output, returnVal, wrapItemType(method, false)) } -func (cr *chainReader) Start(ctx context.Context) error { - if err := cr.initialize(); err != nil { - return fmt.Errorf("Failed to initialize ChainReader: %w", err) - } +func (cr *chainReader) Start(_ context.Context) error { + return cr.StartOnce("ChainReader", func() error { + for name, eventId := range cr.events { + if err := cr.lp.RegisterFilter(logpoller.Filter{ + Name: name, + EventSigs: evmtypes.HashArray{eventId}, + Addresses: evmtypes.AddressArray{cr.contractID}, + }); err != nil { + return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) + } + } + return nil + }) +} +func (cr *chainReader) Close() error { return nil } -func (cr *chainReader) Close() error { return nil } func (cr *chainReader) Ready() error { return nil } func (cr *chainReader) HealthReport() map[string]error { @@ -103,13 +134,13 @@ func (cr *chainReader) CreateType(itemType string, forEncoding bool) (any, error return cr.codec.CreateType(wrapItemType(itemType, forEncoding), forEncoding) } -func addEventTypes(name string, contractABI abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) error { +func addEventTypes(name string, contractABI abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) (common.Hash, error) { event, methodExists := contractABI.Events[chainReaderDefinition.ChainSpecificName] if !methodExists { - return fmt.Errorf("method: %s doesn't exist", chainReaderDefinition.ChainSpecificName) + return common.Hash{}, fmt.Errorf("method: %s doesn't exist", chainReaderDefinition.ChainSpecificName) } - return addDecoderDef(name, event.Inputs, parsed, chainReaderDefinition) + return event.ID, addDecoderDef(name, event.Inputs, parsed, chainReaderDefinition) } func addMethods(name string, abi abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) error { @@ -153,11 +184,12 @@ func addDecoderDef(name string, outputs abi.Arguments, parsed *parsedTypes, def return output.Init() } -func addTypes(chainContractReaders map[string]types.ChainContractReader, parsed *parsedTypes) error { +func addTypes(chainContractReaders map[string]types.ChainContractReader, parsed *parsedTypes) (map[string]common.Hash, error) { + events := map[string]common.Hash{} for contractName, chainContractReader := range chainContractReaders { contractAbi, err := abi.JSON(strings.NewReader(chainContractReader.ContractABI)) if err != nil { - return err + return nil, err } for chainReadingDefinitionName, chainReaderDefinition := range chainContractReader.ChainReaderDefinitions { @@ -165,17 +197,20 @@ func addTypes(chainContractReaders map[string]types.ChainContractReader, parsed case types.Method: err = addMethods(chainReadingDefinitionName, contractAbi, chainReaderDefinition, parsed) case types.Event: - err = addEventTypes(chainReadingDefinitionName, contractAbi, chainReaderDefinition, parsed) + var hash common.Hash + hash, err = addEventTypes(chainReadingDefinitionName, contractAbi, chainReaderDefinition, parsed) + events[chainReadingDefinitionName] = hash default: - return fmt.Errorf("invalid chain reader definition read type: %d", chainReaderDefinition.ReadType) + return nil, fmt.Errorf("invalid chain reader definition read type: %d", chainReaderDefinition.ReadType) } + if err != nil { - return errors.Wrap(err, fmt.Sprintf("invalid chain reader config for contract: %q chain reading definition: %q", contractName, chainReadingDefinitionName)) + return nil, errors.Wrap(err, fmt.Sprintf("invalid chain reader config for contract: %q chain reading definition: %q", contractName, chainReadingDefinitionName)) } } } - return nil + return events, nil } func wrapItemType(itemType string, isParams bool) string { diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index e3c99cf4170..0dd5183c08a 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -8,9 +8,11 @@ import ( "math" "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" evmtypes "github.com/ethereum/go-ethereum/core/types" @@ -24,8 +26,10 @@ import ( . "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" //nolint common practice to import test mods with . "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" - mocklogpoller "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm/mocks" + "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/evm" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/testfiles" @@ -48,18 +52,24 @@ type chainReaderInterfaceTester struct { sim *backends.SimulatedBackend pk *ecdsa.PrivateKey evmTest *testfiles.Testfiles + cr evm.ChainReaderService } -func (it *chainReaderInterfaceTester) Setup(t *testing.T) { +func (it *chainReaderInterfaceTester) Setup(ctx context.Context, t *testing.T) { + t.Cleanup(func() { + it.address = "" + require.NoError(t, it.cr.Close()) + it.cr = nil + }) + // can re-use the same chain for tests, just make new contract for each test if it.chain != nil { + it.deployNewContract(ctx, t) return } - t.Cleanup(func() { it.address = "" }) it.chain = &mocks.Chain{} it.setupChainNoClient(t) - it.chain.On("LogPoller").Return(logger.NullLogger) testStruct := CreateTestStruct(0, it) @@ -77,6 +87,10 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { MethodReturningUint64Slice: { ChainSpecificName: "GetSliceValue", }, + EventName: { + ChainSpecificName: "Triggered", + ReadType: types.Event, + }, MethodReturningSeenStruct: { ChainSpecificName: returnSeenName, InputModifications: codec.ModifiersConfig{ @@ -97,6 +111,7 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { }, } it.chain.On("Client").Return(client.NewSimulatedBackendClient(t, it.sim, big.NewInt(1337))) + it.deployNewContract(ctx, t) } func (it *chainReaderInterfaceTester) Name() string { @@ -110,15 +125,25 @@ func (it *chainReaderInterfaceTester) GetAccountBytes(i int) []byte { return account } -func (it *chainReaderInterfaceTester) GetChainReader(t *testing.T) clcommontypes.ChainReader { - cr, err := evm.NewChainReaderService(logger.NullLogger, mocklogpoller.NewLogPoller(t), it.chain, it.chainConfig) +func (it *chainReaderInterfaceTester) GetChainReader(ctx context.Context, t *testing.T) clcommontypes.ChainReader { + if it.cr != nil { + return it.cr + } + + addr := common.HexToAddress(it.address) + lggr := logger.NullLogger + db := pgtest.NewSqlxDB(t) + lp := logpoller.NewLogPoller(logpoller.NewORM(testutils.SimulatedChainID, db, lggr, pgtest.NewQConfig(true)), it.chain.Client(), lggr, time.Millisecond, false, 0, 1, 1, 10000) + require.NoError(t, lp.Start(ctx)) + it.chain.On("LogPoller").Return(lp) + cr, err := evm.NewChainReaderService(lggr, lp, addr, it.chain, it.chainConfig) require.NoError(t, err) + require.NoError(t, cr.Start(ctx)) + it.cr = cr return cr } -func (it *chainReaderInterfaceTester) GetPrimitiveContract(ctx context.Context, t *testing.T) clcommontypes.BoundContract { - // Since most tests don't use the contract, it's set up lazily to save time - it.deployNewContract(ctx, t) +func (it *chainReaderInterfaceTester) GetPrimitiveContract(_ context.Context, t *testing.T) clcommontypes.BoundContract { return clcommontypes.BoundContract{ Address: it.address, Name: MethodReturningUint64, @@ -142,10 +167,29 @@ func (it *chainReaderInterfaceTester) GetSliceContract(ctx context.Context, t *t } func (it *chainReaderInterfaceTester) SetLatestValue(ctx context.Context, t *testing.T, testStruct *TestStruct) clcommontypes.BoundContract { + it.sendTxWithTestStruct(ctx, t, testStruct, (*testfiles.TestfilesTransactor).AddTestStruct) + return clcommontypes.BoundContract{ + Address: it.address, + Name: MethodTakingLatestParamsReturningTestStruct, + } +} + +func (it *chainReaderInterfaceTester) TriggerEvent(ctx context.Context, t *testing.T, testStruct *TestStruct) clcommontypes.BoundContract { + it.sendTxWithTestStruct(ctx, t, testStruct, (*testfiles.TestfilesTransactor).TriggerEvent) + return clcommontypes.BoundContract{ + Address: it.address, + Name: EventName, + } +} + +type testStructFn = func(*testfiles.TestfilesTransactor, *bind.TransactOpts, int32, string, uint8, [32]uint8, [32]byte, [][32]byte, *big.Int, testfiles.MidLevelTestStruct) (*evmtypes.Transaction, error) + +func (it *chainReaderInterfaceTester) sendTxWithTestStruct(ctx context.Context, t *testing.T, testStruct *TestStruct, fn testStructFn) { // Since most tests don't use the contract, it's set up lazily to save time it.deployNewContract(ctx, t) - tx, err := it.evmTest.AddTestStruct( + tx, err := fn( + &it.evmTest.TestfilesTransactor, it.auth, testStruct.Field, testStruct.DifferentField, @@ -160,10 +204,6 @@ func (it *chainReaderInterfaceTester) SetLatestValue(ctx context.Context, t *tes it.sim.Commit() it.incNonce() it.awaitTx(ctx, t, tx) - return clcommontypes.BoundContract{ - Address: it.address, - Name: MethodTakingLatestParamsReturningTestStruct, - } } func convertOracleIDs(oracleIDs [32]commontypes.OracleID) [32]byte { diff --git a/core/services/relay/evm/codec_test.go b/core/services/relay/evm/codec_test.go index dd1977eb39c..bb4ee98a44b 100644 --- a/core/services/relay/evm/codec_test.go +++ b/core/services/relay/evm/codec_test.go @@ -1,6 +1,7 @@ package evm_test import ( + "context" "encoding/json" "testing" @@ -49,7 +50,7 @@ func TestCodec(t *testing.T) { type codecInterfaceTester struct{} -func (it *codecInterfaceTester) Setup(_ *testing.T) {} +func (it *codecInterfaceTester) Setup(_ context.Context, _ *testing.T) {} func (it *codecInterfaceTester) GetAccountBytes(i int) []byte { account := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2} diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index d1061c6b415..d139d250d08 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -506,6 +506,7 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp if !common.IsHexAddress(relayOpts.ContractID) { return nil, fmt.Errorf("invalid contractID %s, expected hex address", relayOpts.ContractID) } + contractID := common.HexToAddress(relayOpts.ContractID) configWatcher, err := newConfigProvider(lggr, r.chain, relayOpts, r.eventBroadcaster) if err != nil { @@ -533,7 +534,7 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp // allow fallback until chain reader is default and median contract is removed, but still log just in case var chainReaderService commontypes.ChainReader if relayConfig.ChainReader != nil { - if chainReaderService, err = NewChainReaderService(lggr, r.chain.LogPoller(), r.chain, *relayConfig.ChainReader); err != nil { + if chainReaderService, err = NewChainReaderService(lggr, r.chain.LogPoller(), contractID, r.chain, *relayConfig.ChainReader); err != nil { return nil, err } } else { diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract.sol b/core/services/relay/evm/testfiles/chain_reader_test_contract.sol index 58d4006a1ad..fee62f1beac 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract.sol +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract.sol @@ -23,6 +23,16 @@ struct InnerTestStruct { } contract LatestValueHolder { + event Triggered( + int32 field, + string differentField, + uint8 oracleId, + uint8[32] oracleIds, + bytes32 account, + bytes32[] accounts, + int192 bigField, + MidLevelTestStruct nestedStruct); + TestStruct[] private seen; uint64[] private arr; @@ -69,4 +79,15 @@ contract LatestValueHolder { function GetSliceValue() public view returns (uint64[] memory) { return arr; } + + function TriggerEvent(int32 field, + string calldata differentField, + uint8 oracleId, + uint8[32] calldata oracleIds, + bytes32 account, + bytes32[] calldata accounts, + int192 bigField, + MidLevelTestStruct calldata nestedStruct) public { + emit Triggered(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); + } } \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi index e16fa1803e8..12d4bd4368c 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi @@ -1 +1 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"AddTestStruct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"GetElementAtIndex","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GetPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"GetSliceValue","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"ReturnSeen","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"}] \ No newline at end of file +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"int32","name":"field","type":"int32"},{"indexed":false,"internalType":"string","name":"differentField","type":"string"},{"indexed":false,"internalType":"uint8","name":"oracleId","type":"uint8"},{"indexed":false,"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"indexed":false,"internalType":"bytes32","name":"account","type":"bytes32"},{"indexed":false,"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"indexed":false,"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"indexed":false,"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"Triggered","type":"event"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"AddTestStruct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"GetElementAtIndex","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GetPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"GetSliceValue","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"ReturnSeen","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"TriggerEvent","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin index 8cb80c9d82e..8cd1c9903e0 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a918202910219909216919091179055610f5c806100a96000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80637dd6af5b1461005c5780639ca04f6714610071578063b95ad4111461009a578063bdb37c90146100ad578063da8e7a82146100c2575b600080fd5b61006f61006a366004610a30565b6100d1565b005b61008461007f366004610b1b565b610300565b6040516100919190610c80565b60405180910390f35b6100846100a8366004610a30565b6105b0565b6100b56106a1565b6040516100919190610c32565b60405160038152602001610091565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016101ab84610dc1565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936102029392850192919091019061072d565b50604082015160028201805460ff191660ff909216919091179055606082015161023290600383019060206107b1565b506080820151600482015560a0820151805161025891600584019160209091019061083f565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff199091161783558082015180519193926102ed9260098901929091019061072d565b5050505050505050505050505050505050565b610308610879565b6000610315600184610d9c565b8154811061032557610325610efa565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461036c90610ec5565b80601f016020809104026020016040519081016040528092919081815260200182805461039890610ec5565b80156103e55780601f106103ba576101008083540402835291602001916103e5565b820191906000526020600020905b8154815290600101906020018083116103c857829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff1681526020600192830181810494850194909303909202910180841161041a5790505050505050815260200160048201548152602001600582018054806020026020016040519081016040528092919081815260200182805480156104aa57602002820191906000526020600020905b815481526020019060010190808311610496575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061052190610ec5565b80601f016020809104026020016040519081016040528092919081815260200182805461054d90610ec5565b801561059a5780601f1061056f5761010080835404028352916020019161059a565b820191906000526020600020905b81548152906001019060200180831161057d57829003601f168201915b5050509190925250505090525090525092915050565b6105b8610879565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161069084610dc1565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561072357602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116106de5790505b5050505050905090565b82805461073990610ec5565b90600052602060002090601f01602090048101928261075b57600085556107a1565b82601f1061077457805160ff19168380011785556107a1565b828001600101855582156107a1579182015b828111156107a1578251825591602001919060010190610786565b506107ad9291506108c8565b5090565b6001830191839082156107a15791602002820160005b8382111561080557835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026107c7565b80156108325782816101000a81549060ff0219169055600101602081600001049283019260010302610805565b50506107ad9291506108c8565b8280548282559060005260206000209081019282156107a157916020028201828111156107a1578251825591602001919060010190610786565b60408051610100810182526000808252606060208301819052928201529081016108a16108dd565b81526000602082018190526060604083018190528201526080016108c36108fc565b905290565b5b808211156107ad57600081556001016108c9565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016108c36040518060400160405280600060070b8152602001606081525090565b60008083601f84011261094a57600080fd5b50813567ffffffffffffffff81111561096257600080fd5b6020830191508360208260051b850101111561097d57600080fd5b9250929050565b80610400810183101561099657600080fd5b92915050565b8035601781900b81146109ae57600080fd5b919050565b8035600381900b81146109ae57600080fd5b60008083601f8401126109d757600080fd5b50813567ffffffffffffffff8111156109ef57600080fd5b60208301915083602082850101111561097d57600080fd5b600060408284031215610a1957600080fd5b50919050565b803560ff811681146109ae57600080fd5b6000806000806000806000806000806104e08b8d031215610a5057600080fd5b610a598b6109b3565b995060208b013567ffffffffffffffff80821115610a7657600080fd5b610a828e838f016109c5565b909b509950899150610a9660408e01610a1f565b9850610aa58e60608f01610984565b97506104608d013596506104808d0135915080821115610ac457600080fd5b610ad08e838f01610938565b9096509450849150610ae56104a08e0161099c565b93506104c08d0135915080821115610afc57600080fd5b50610b098d828e01610a07565b9150509295989b9194979a5092959850565b600060208284031215610b2d57600080fd5b5035919050565b600081518084526020808501945080840160005b83811015610b6457815187529582019590820190600101610b48565b509495945050505050565b8060005b6020808210610b825750610b99565b825160ff1685529384019390910190600101610b73565b50505050565b6000815180845260005b81811015610bc557602081850181015186830182015201610ba9565b81811115610bd7576000602083870101525b50601f01601f19169290920160200192915050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610c2a6080850182610b9f565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610c7457835167ffffffffffffffff1683529284019291840191600101610c4e565b50909695505050505050565b60208152610c9460208201835160030b9052565b600060208301516104e0806040850152610cb2610500850183610b9f565b91506040850151610cc8606086018260ff169052565b506060850151610cdb6080860182610b6f565b50608085015161048085015260a0850151601f1980868503016104a0870152610d048483610b34565b935060c08701519150610d1d6104c087018360170b9052565b60e0870151915080868503018387015250610d388382610bec565b9695505050505050565b6040805190810167ffffffffffffffff81118282101715610d6557610d65610f10565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610d9457610d94610f10565b604052919050565b600082821015610dbc57634e487b7160e01b600052601160045260246000fd5b500390565b600060408236031215610dd357600080fd5b610ddb610d42565b82356001600160f01b031981168114610df357600080fd5b815260208381013567ffffffffffffffff80821115610e1157600080fd5b818601915060408236031215610e2657600080fd5b610e2e610d42565b82358060070b8114610e3f57600080fd5b81528284013582811115610e5257600080fd5b929092019136601f840112610e6657600080fd5b823582811115610e7857610e78610f10565b610e8a601f8201601f19168601610d6b565b92508083523685828601011115610ea057600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c90821680610ed957607f821691505b60208210811415610a1957634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212203e9087524a5a63426d26593011ef69ba9a517930f68ed2747aed8804859d3ed064736f6c63430008060033 \ No newline at end of file +608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a91820291021990921691909117905561118e806100a96000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80637dd6af5b146100675780639ca04f671461007c578063b95ad411146100a5578063bdb37c90146100b8578063da8e7a82146100cd578063e669831d146100dc575b600080fd5b61007a610075366004610acd565b6100ef565b005b61008f61008a366004610bb8565b61031e565b60405161009c9190610ed3565b60405180910390f35b61008f6100b3366004610acd565b6105ce565b6100c06106bf565b60405161009c9190610dd7565b6040516003815260200161009c565b61007a6100ea366004610acd565b61074b565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016101c98461100a565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff1990931692909217825583830151805193949293610220939285019291909101906107a0565b50604082015160028201805460ff191660ff90921691909117905560608201516102509060038301906020610824565b506080820151600482015560a082015180516102769160058401916020909101906108b2565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff1990911617835580820151805191939261030b926009890192909101906107a0565b5050505050505050505050505050505050565b6103266108ec565b6000610333600184610fe5565b815481106103435761034361112c565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461038a906110f7565b80601f01602080910402602001604051908101604052809291908181526020018280546103b6906110f7565b80156104035780601f106103d857610100808354040283529160200191610403565b820191906000526020600020905b8154815290600101906020018083116103e657829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116104385790505050505050815260200160048201548152602001600582018054806020026020016040519081016040528092919081815260200182805480156104c857602002820191906000526020600020905b8154815260200190600101908083116104b4575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061053f906110f7565b80601f016020809104026020016040519081016040528092919081815260200182805461056b906110f7565b80156105b85780601f1061058d576101008083540402835291602001916105b8565b820191906000526020600020905b81548152906001019060200180831161059b57829003601f168201915b5050509190925250505090525090525092915050565b6105d66108ec565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016106ae8461100a565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561074157602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116106fc5790505b5050505050905090565b7f7d2abe6109e46b893ac1835c9287d6ad5c5ccf3d0254d2ca72225873795e0f538a8a8a8a8a8a8a8a8a8a60405161078c9a99989796959493929190610e25565b60405180910390a150505050505050505050565b8280546107ac906110f7565b90600052602060002090601f0160209004810192826107ce5760008555610814565b82601f106107e757805160ff1916838001178555610814565b82800160010185558215610814579182015b828111156108145782518255916020019190600101906107f9565b5061082092915061093b565b5090565b6001830191839082156108145791602002820160005b8382111561087857835183826101000a81548160ff021916908360ff160217905550926020019260010160208160000104928301926001030261083a565b80156108a55782816101000a81549060ff0219169055600101602081600001049283019260010302610878565b505061082092915061093b565b82805482825590600052602060002090810192821561081457916020028201828111156108145782518255916020019190600101906107f9565b6040805161010081018252600080825260606020830181905292820152908101610914610950565b815260006020820181905260606040830181905282015260800161093661096f565b905290565b5b80821115610820576000815560010161093c565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016109366040518060400160405280600060070b8152602001606081525090565b60008083601f8401126109bd57600080fd5b50813567ffffffffffffffff8111156109d557600080fd5b6020830191508360208260051b85010111156109f057600080fd5b9250929050565b806104008101831015610a0957600080fd5b92915050565b80356001600160f01b031981168114610a2757600080fd5b919050565b8035601781900b8114610a2757600080fd5b8035600381900b8114610a2757600080fd5b8035600781900b8114610a2757600080fd5b60008083601f840112610a7457600080fd5b50813567ffffffffffffffff811115610a8c57600080fd5b6020830191508360208285010111156109f057600080fd5b600060408284031215610ab657600080fd5b50919050565b803560ff81168114610a2757600080fd5b6000806000806000806000806000806104e08b8d031215610aed57600080fd5b610af68b610a3e565b995060208b013567ffffffffffffffff80821115610b1357600080fd5b610b1f8e838f01610a62565b909b509950899150610b3360408e01610abc565b9850610b428e60608f016109f7565b97506104608d013596506104808d0135915080821115610b6157600080fd5b610b6d8e838f016109ab565b9096509450849150610b826104a08e01610a2c565b93506104c08d0135915080821115610b9957600080fd5b50610ba68d828e01610aa4565b9150509295989b9194979a5092959850565b600060208284031215610bca57600080fd5b5035919050565b81835260006001600160fb1b03831115610bea57600080fd5b8260051b8083602087013760009401602001938452509192915050565b600081518084526020808501945080840160005b83811015610c3757815187529582019590820190600101610c1b565b509495945050505050565b8060005b6020808210610c555750610c6c565b825160ff1685529384019390910190600101610c46565b50505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815180845260005b81811015610cc157602081850181015186830182015201610ca5565b81811115610cd3576000602083870101525b50601f01601f19169290920160200192915050565b6001600160f01b0319610cfa82610a0f565b16825260006020820135603e19833603018112610d1657600080fd5b604060208501528201610d2881610a50565b60070b60408501526020810135601e19823603018112610d4757600080fd5b8101803567ffffffffffffffff811115610d6057600080fd5b803603831315610d6f57600080fd5b60406060870152610d87608087018260208501610c72565b9695505050505050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610dcf6080850182610c9b565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610e1957835167ffffffffffffffff1683529284019291840191600101610df3565b50909695505050505050565b60006104e08c60030b835260208181850152610e448285018d8f610c72565b915060ff808c166040860152606085018b60005b84811015610e7d5783610e6a83610abc565b1683529184019190840190600101610e58565b505050505087610460840152828103610480840152610e9d818789610bd1565b9050610eaf6104a084018660170b9052565b8281036104c0840152610ec28185610ce8565b9d9c50505050505050505050505050565b60208152610ee760208201835160030b9052565b600060208301516104e0806040850152610f05610500850183610c9b565b91506040850151610f1b606086018260ff169052565b506060850151610f2e6080860182610c42565b50608085015161048085015260a0850151601f1980868503016104a0870152610f578483610c07565b935060c08701519150610f706104c087018360170b9052565b60e0870151915080868503018387015250610d878382610d91565b6040805190810167ffffffffffffffff81118282101715610fae57610fae611142565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610fdd57610fdd611142565b604052919050565b60008282101561100557634e487b7160e01b600052601160045260246000fd5b500390565b60006040823603121561101c57600080fd5b611024610f8b565b61102d83610a0f565b815260208084013567ffffffffffffffff8082111561104b57600080fd5b81860191506040823603121561106057600080fd5b611068610f8b565b61107183610a50565b8152838301358281111561108457600080fd5b929092019136601f84011261109857600080fd5b8235828111156110aa576110aa611142565b6110bc601f8201601f19168601610fb4565b925080835236858286010111156110d257600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c9082168061110b57607f821691505b60208210811415610ab657634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220dc7c8830d1691fb07419d1e88774f8489193b9b32a6a2406f298335883e9593b64736f6c63430008060033 \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go index d2b173c6a6e..da4f540d3c5 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go @@ -55,8 +55,8 @@ type TestStruct struct { // TestfilesMetaData contains all meta data concerning the Testfiles contract. var TestfilesMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"ReturnSeen\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a918202910219909216919091179055610f5c806100a96000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80637dd6af5b1461005c5780639ca04f6714610071578063b95ad4111461009a578063bdb37c90146100ad578063da8e7a82146100c2575b600080fd5b61006f61006a366004610a30565b6100d1565b005b61008461007f366004610b1b565b610300565b6040516100919190610c80565b60405180910390f35b6100846100a8366004610a30565b6105b0565b6100b56106a1565b6040516100919190610c32565b60405160038152602001610091565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016101ab84610dc1565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936102029392850192919091019061072d565b50604082015160028201805460ff191660ff909216919091179055606082015161023290600383019060206107b1565b506080820151600482015560a0820151805161025891600584019160209091019061083f565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff199091161783558082015180519193926102ed9260098901929091019061072d565b5050505050505050505050505050505050565b610308610879565b6000610315600184610d9c565b8154811061032557610325610efa565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461036c90610ec5565b80601f016020809104026020016040519081016040528092919081815260200182805461039890610ec5565b80156103e55780601f106103ba576101008083540402835291602001916103e5565b820191906000526020600020905b8154815290600101906020018083116103c857829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff1681526020600192830181810494850194909303909202910180841161041a5790505050505050815260200160048201548152602001600582018054806020026020016040519081016040528092919081815260200182805480156104aa57602002820191906000526020600020905b815481526020019060010190808311610496575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061052190610ec5565b80601f016020809104026020016040519081016040528092919081815260200182805461054d90610ec5565b801561059a5780601f1061056f5761010080835404028352916020019161059a565b820191906000526020600020905b81548152906001019060200180831161057d57829003601f168201915b5050509190925250505090525090525092915050565b6105b8610879565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161069084610dc1565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561072357602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116106de5790505b5050505050905090565b82805461073990610ec5565b90600052602060002090601f01602090048101928261075b57600085556107a1565b82601f1061077457805160ff19168380011785556107a1565b828001600101855582156107a1579182015b828111156107a1578251825591602001919060010190610786565b506107ad9291506108c8565b5090565b6001830191839082156107a15791602002820160005b8382111561080557835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026107c7565b80156108325782816101000a81549060ff0219169055600101602081600001049283019260010302610805565b50506107ad9291506108c8565b8280548282559060005260206000209081019282156107a157916020028201828111156107a1578251825591602001919060010190610786565b60408051610100810182526000808252606060208301819052928201529081016108a16108dd565b81526000602082018190526060604083018190528201526080016108c36108fc565b905290565b5b808211156107ad57600081556001016108c9565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016108c36040518060400160405280600060070b8152602001606081525090565b60008083601f84011261094a57600080fd5b50813567ffffffffffffffff81111561096257600080fd5b6020830191508360208260051b850101111561097d57600080fd5b9250929050565b80610400810183101561099657600080fd5b92915050565b8035601781900b81146109ae57600080fd5b919050565b8035600381900b81146109ae57600080fd5b60008083601f8401126109d757600080fd5b50813567ffffffffffffffff8111156109ef57600080fd5b60208301915083602082850101111561097d57600080fd5b600060408284031215610a1957600080fd5b50919050565b803560ff811681146109ae57600080fd5b6000806000806000806000806000806104e08b8d031215610a5057600080fd5b610a598b6109b3565b995060208b013567ffffffffffffffff80821115610a7657600080fd5b610a828e838f016109c5565b909b509950899150610a9660408e01610a1f565b9850610aa58e60608f01610984565b97506104608d013596506104808d0135915080821115610ac457600080fd5b610ad08e838f01610938565b9096509450849150610ae56104a08e0161099c565b93506104c08d0135915080821115610afc57600080fd5b50610b098d828e01610a07565b9150509295989b9194979a5092959850565b600060208284031215610b2d57600080fd5b5035919050565b600081518084526020808501945080840160005b83811015610b6457815187529582019590820190600101610b48565b509495945050505050565b8060005b6020808210610b825750610b99565b825160ff1685529384019390910190600101610b73565b50505050565b6000815180845260005b81811015610bc557602081850181015186830182015201610ba9565b81811115610bd7576000602083870101525b50601f01601f19169290920160200192915050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610c2a6080850182610b9f565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610c7457835167ffffffffffffffff1683529284019291840191600101610c4e565b50909695505050505050565b60208152610c9460208201835160030b9052565b600060208301516104e0806040850152610cb2610500850183610b9f565b91506040850151610cc8606086018260ff169052565b506060850151610cdb6080860182610b6f565b50608085015161048085015260a0850151601f1980868503016104a0870152610d048483610b34565b935060c08701519150610d1d6104c087018360170b9052565b60e0870151915080868503018387015250610d388382610bec565b9695505050505050565b6040805190810167ffffffffffffffff81118282101715610d6557610d65610f10565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610d9457610d94610f10565b604052919050565b600082821015610dbc57634e487b7160e01b600052601160045260246000fd5b500390565b600060408236031215610dd357600080fd5b610ddb610d42565b82356001600160f01b031981168114610df357600080fd5b815260208381013567ffffffffffffffff80821115610e1157600080fd5b818601915060408236031215610e2657600080fd5b610e2e610d42565b82358060070b8114610e3f57600080fd5b81528284013582811115610e5257600080fd5b929092019136601f840112610e6657600080fd5b823582811115610e7857610e78610f10565b610e8a601f8201601f19168601610d6b565b92508083523685828601011115610ea057600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c90821680610ed957607f821691505b60208210811415610a1957634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212203e9087524a5a63426d26593011ef69ba9a517930f68ed2747aed8804859d3ed064736f6c63430008060033", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"Triggered\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"ReturnSeen\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"TriggerEvent\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a91820291021990921691909117905561118e806100a96000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80637dd6af5b146100675780639ca04f671461007c578063b95ad411146100a5578063bdb37c90146100b8578063da8e7a82146100cd578063e669831d146100dc575b600080fd5b61007a610075366004610acd565b6100ef565b005b61008f61008a366004610bb8565b61031e565b60405161009c9190610ed3565b60405180910390f35b61008f6100b3366004610acd565b6105ce565b6100c06106bf565b60405161009c9190610dd7565b6040516003815260200161009c565b61007a6100ea366004610acd565b61074b565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016101c98461100a565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff1990931692909217825583830151805193949293610220939285019291909101906107a0565b50604082015160028201805460ff191660ff90921691909117905560608201516102509060038301906020610824565b506080820151600482015560a082015180516102769160058401916020909101906108b2565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff1990911617835580820151805191939261030b926009890192909101906107a0565b5050505050505050505050505050505050565b6103266108ec565b6000610333600184610fe5565b815481106103435761034361112c565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461038a906110f7565b80601f01602080910402602001604051908101604052809291908181526020018280546103b6906110f7565b80156104035780601f106103d857610100808354040283529160200191610403565b820191906000526020600020905b8154815290600101906020018083116103e657829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116104385790505050505050815260200160048201548152602001600582018054806020026020016040519081016040528092919081815260200182805480156104c857602002820191906000526020600020905b8154815260200190600101908083116104b4575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061053f906110f7565b80601f016020809104026020016040519081016040528092919081815260200182805461056b906110f7565b80156105b85780601f1061058d576101008083540402835291602001916105b8565b820191906000526020600020905b81548152906001019060200180831161059b57829003601f168201915b5050509190925250505090525090525092915050565b6105d66108ec565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016106ae8461100a565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561074157602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116106fc5790505b5050505050905090565b7f7d2abe6109e46b893ac1835c9287d6ad5c5ccf3d0254d2ca72225873795e0f538a8a8a8a8a8a8a8a8a8a60405161078c9a99989796959493929190610e25565b60405180910390a150505050505050505050565b8280546107ac906110f7565b90600052602060002090601f0160209004810192826107ce5760008555610814565b82601f106107e757805160ff1916838001178555610814565b82800160010185558215610814579182015b828111156108145782518255916020019190600101906107f9565b5061082092915061093b565b5090565b6001830191839082156108145791602002820160005b8382111561087857835183826101000a81548160ff021916908360ff160217905550926020019260010160208160000104928301926001030261083a565b80156108a55782816101000a81549060ff0219169055600101602081600001049283019260010302610878565b505061082092915061093b565b82805482825590600052602060002090810192821561081457916020028201828111156108145782518255916020019190600101906107f9565b6040805161010081018252600080825260606020830181905292820152908101610914610950565b815260006020820181905260606040830181905282015260800161093661096f565b905290565b5b80821115610820576000815560010161093c565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016109366040518060400160405280600060070b8152602001606081525090565b60008083601f8401126109bd57600080fd5b50813567ffffffffffffffff8111156109d557600080fd5b6020830191508360208260051b85010111156109f057600080fd5b9250929050565b806104008101831015610a0957600080fd5b92915050565b80356001600160f01b031981168114610a2757600080fd5b919050565b8035601781900b8114610a2757600080fd5b8035600381900b8114610a2757600080fd5b8035600781900b8114610a2757600080fd5b60008083601f840112610a7457600080fd5b50813567ffffffffffffffff811115610a8c57600080fd5b6020830191508360208285010111156109f057600080fd5b600060408284031215610ab657600080fd5b50919050565b803560ff81168114610a2757600080fd5b6000806000806000806000806000806104e08b8d031215610aed57600080fd5b610af68b610a3e565b995060208b013567ffffffffffffffff80821115610b1357600080fd5b610b1f8e838f01610a62565b909b509950899150610b3360408e01610abc565b9850610b428e60608f016109f7565b97506104608d013596506104808d0135915080821115610b6157600080fd5b610b6d8e838f016109ab565b9096509450849150610b826104a08e01610a2c565b93506104c08d0135915080821115610b9957600080fd5b50610ba68d828e01610aa4565b9150509295989b9194979a5092959850565b600060208284031215610bca57600080fd5b5035919050565b81835260006001600160fb1b03831115610bea57600080fd5b8260051b8083602087013760009401602001938452509192915050565b600081518084526020808501945080840160005b83811015610c3757815187529582019590820190600101610c1b565b509495945050505050565b8060005b6020808210610c555750610c6c565b825160ff1685529384019390910190600101610c46565b50505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815180845260005b81811015610cc157602081850181015186830182015201610ca5565b81811115610cd3576000602083870101525b50601f01601f19169290920160200192915050565b6001600160f01b0319610cfa82610a0f565b16825260006020820135603e19833603018112610d1657600080fd5b604060208501528201610d2881610a50565b60070b60408501526020810135601e19823603018112610d4757600080fd5b8101803567ffffffffffffffff811115610d6057600080fd5b803603831315610d6f57600080fd5b60406060870152610d87608087018260208501610c72565b9695505050505050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610dcf6080850182610c9b565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610e1957835167ffffffffffffffff1683529284019291840191600101610df3565b50909695505050505050565b60006104e08c60030b835260208181850152610e448285018d8f610c72565b915060ff808c166040860152606085018b60005b84811015610e7d5783610e6a83610abc565b1683529184019190840190600101610e58565b505050505087610460840152828103610480840152610e9d818789610bd1565b9050610eaf6104a084018660170b9052565b8281036104c0840152610ec28185610ce8565b9d9c50505050505050505050505050565b60208152610ee760208201835160030b9052565b600060208301516104e0806040850152610f05610500850183610c9b565b91506040850151610f1b606086018260ff169052565b506060850151610f2e6080860182610c42565b50608085015161048085015260a0850151601f1980868503016104a0870152610f578483610c07565b935060c08701519150610f706104c087018360170b9052565b60e0870151915080868503018387015250610d878382610d91565b6040805190810167ffffffffffffffff81118282101715610fae57610fae611142565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610fdd57610fdd611142565b604052919050565b60008282101561100557634e487b7160e01b600052601160045260246000fd5b500390565b60006040823603121561101c57600080fd5b611024610f8b565b61102d83610a0f565b815260208084013567ffffffffffffffff8082111561104b57600080fd5b81860191506040823603121561106057600080fd5b611068610f8b565b61107183610a50565b8152838301358281111561108457600080fd5b929092019136601f84011261109857600080fd5b8235828111156110aa576110aa611142565b6110bc601f8201601f19168601610fb4565b925080835236858286010111156110d257600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c9082168061110b57607f821691505b60208210811415610ab657634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220dc7c8830d1691fb07419d1e88774f8489193b9b32a6a2406f298335883e9593b64736f6c63430008060033", } // TestfilesABI is the input ABI used to generate the binding from. @@ -370,3 +370,165 @@ func (_Testfiles *TestfilesSession) AddTestStruct(field int32, differentField st func (_Testfiles *TestfilesTransactorSession) AddTestStruct(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { return _Testfiles.Contract.AddTestStruct(&_Testfiles.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) } + +// TriggerEvent is a paid mutator transaction binding the contract method 0xe669831d. +// +// Solidity: function TriggerEvent(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() +func (_Testfiles *TestfilesTransactor) TriggerEvent(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { + return _Testfiles.contract.Transact(opts, "TriggerEvent", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +// TriggerEvent is a paid mutator transaction binding the contract method 0xe669831d. +// +// Solidity: function TriggerEvent(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() +func (_Testfiles *TestfilesSession) TriggerEvent(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { + return _Testfiles.Contract.TriggerEvent(&_Testfiles.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +// TriggerEvent is a paid mutator transaction binding the contract method 0xe669831d. +// +// Solidity: function TriggerEvent(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() +func (_Testfiles *TestfilesTransactorSession) TriggerEvent(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { + return _Testfiles.Contract.TriggerEvent(&_Testfiles.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +// TestfilesTriggeredIterator is returned from FilterTriggered and is used to iterate over the raw logs and unpacked data for Triggered events raised by the Testfiles contract. +type TestfilesTriggeredIterator struct { + Event *TestfilesTriggered // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TestfilesTriggeredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TestfilesTriggered) + 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 + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TestfilesTriggered) + 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() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TestfilesTriggeredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TestfilesTriggeredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TestfilesTriggered represents a Triggered event raised by the Testfiles contract. +type TestfilesTriggered struct { + Field int32 + DifferentField string + OracleId uint8 + OracleIds [32]uint8 + Account [32]byte + Accounts [][32]byte + BigField *big.Int + NestedStruct MidLevelTestStruct + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTriggered is a free log retrieval operation binding the contract event 0x7d2abe6109e46b893ac1835c9287d6ad5c5ccf3d0254d2ca72225873795e0f53. +// +// Solidity: event Triggered(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) +func (_Testfiles *TestfilesFilterer) FilterTriggered(opts *bind.FilterOpts) (*TestfilesTriggeredIterator, error) { + + logs, sub, err := _Testfiles.contract.FilterLogs(opts, "Triggered") + if err != nil { + return nil, err + } + return &TestfilesTriggeredIterator{contract: _Testfiles.contract, event: "Triggered", logs: logs, sub: sub}, nil +} + +// WatchTriggered is a free log subscription operation binding the contract event 0x7d2abe6109e46b893ac1835c9287d6ad5c5ccf3d0254d2ca72225873795e0f53. +// +// Solidity: event Triggered(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) +func (_Testfiles *TestfilesFilterer) WatchTriggered(opts *bind.WatchOpts, sink chan<- *TestfilesTriggered) (event.Subscription, error) { + + logs, sub, err := _Testfiles.contract.WatchLogs(opts, "Triggered") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TestfilesTriggered) + if err := _Testfiles.contract.UnpackLog(event, "Triggered", 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 +} + +// ParseTriggered is a log parse operation binding the contract event 0x7d2abe6109e46b893ac1835c9287d6ad5c5ccf3d0254d2ca72225873795e0f53. +// +// Solidity: event Triggered(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) +func (_Testfiles *TestfilesFilterer) ParseTriggered(log types.Log) (*TestfilesTriggered, error) { + event := new(TestfilesTriggered) + if err := _Testfiles.contract.UnpackLog(event, "Triggered", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/go.mod b/go.mod index 561ea91ed80..f83a095f2a8 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206153113-f86b0b21496d + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d diff --git a/go.sum b/go.sum index 46d54a50a93..ddb8a245d68 100644 --- a/go.sum +++ b/go.sum @@ -1217,8 +1217,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206153113-f86b0b21496d h1:ibnzqA27rmFXJvBKQhx1D/tg7X0Oe9tPsWNhi+GQ3sM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206153113-f86b0b21496d/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6 h1:Vqi/po+LG3J47USCh83vvjutn2KX8nr7PsU9q4qHt2o= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 583d1592c71..2541b60bc99 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206153113-f86b0b21496d + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6 github.com/smartcontractkit/chainlink-testing-framework v1.20.0 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index e3be6249d42..df5dbc86cac 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1507,8 +1507,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206153113-f86b0b21496d h1:ibnzqA27rmFXJvBKQhx1D/tg7X0Oe9tPsWNhi+GQ3sM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206153113-f86b0b21496d/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6 h1:Vqi/po+LG3J47USCh83vvjutn2KX8nr7PsU9q4qHt2o= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From 8ac9d95e42c89ddc0e27161bf64a5dcd1a653bc2 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 8 Dec 2023 11:52:49 -0500 Subject: [PATCH 040/112] Don't pass ctx around in tests --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 +- core/services/relay/evm/chain_reader_test.go | 42 ++++++++++---------- core/services/relay/evm/codec_test.go | 3 +- go.mod | 2 +- go.sum | 4 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- 8 files changed, 32 insertions(+), 31 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 437ec17db15..4e0ba91bb1d 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -258,7 +258,7 @@ require ( github.com/shirou/gopsutil/v3 v3.23.10 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6 // indirect + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index e9de4b92a4e..b7685cd0335 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1214,8 +1214,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6 h1:Vqi/po+LG3J47USCh83vvjutn2KX8nr7PsU9q4qHt2o= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c h1:YgizNDPRAP2ObjetDIQTJlrpzLBBkYsNjA10Mo5HByo= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 0dd5183c08a..7efa27b4608 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -3,7 +3,6 @@ package evm_test //go:generate ./testfiles/chainlink_reader_test_setup.sh import ( - "context" "crypto/ecdsa" "math" "math/big" @@ -55,7 +54,7 @@ type chainReaderInterfaceTester struct { cr evm.ChainReaderService } -func (it *chainReaderInterfaceTester) Setup(ctx context.Context, t *testing.T) { +func (it *chainReaderInterfaceTester) Setup(t *testing.T) { t.Cleanup(func() { it.address = "" require.NoError(t, it.cr.Close()) @@ -64,7 +63,7 @@ func (it *chainReaderInterfaceTester) Setup(ctx context.Context, t *testing.T) { // can re-use the same chain for tests, just make new contract for each test if it.chain != nil { - it.deployNewContract(ctx, t) + it.deployNewContract(t) return } @@ -111,7 +110,7 @@ func (it *chainReaderInterfaceTester) Setup(ctx context.Context, t *testing.T) { }, } it.chain.On("Client").Return(client.NewSimulatedBackendClient(t, it.sim, big.NewInt(1337))) - it.deployNewContract(ctx, t) + it.deployNewContract(t) } func (it *chainReaderInterfaceTester) Name() string { @@ -125,7 +124,8 @@ func (it *chainReaderInterfaceTester) GetAccountBytes(i int) []byte { return account } -func (it *chainReaderInterfaceTester) GetChainReader(ctx context.Context, t *testing.T) clcommontypes.ChainReader { +func (it *chainReaderInterfaceTester) GetChainReader(t *testing.T) clcommontypes.ChainReader { + ctx := testutils.Context(t) if it.cr != nil { return it.cr } @@ -143,39 +143,39 @@ func (it *chainReaderInterfaceTester) GetChainReader(ctx context.Context, t *tes return cr } -func (it *chainReaderInterfaceTester) GetPrimitiveContract(_ context.Context, t *testing.T) clcommontypes.BoundContract { +func (it *chainReaderInterfaceTester) GetPrimitiveContract(_ *testing.T) clcommontypes.BoundContract { return clcommontypes.BoundContract{ Address: it.address, Name: MethodReturningUint64, } } -func (it *chainReaderInterfaceTester) GetReturnSeenContract(ctx context.Context, t *testing.T) clcommontypes.BoundContract { - it.deployNewContract(ctx, t) +func (it *chainReaderInterfaceTester) GetReturnSeenContract(t *testing.T) clcommontypes.BoundContract { + it.deployNewContract(t) return clcommontypes.BoundContract{ Address: it.address, Name: returnSeenName, } } -func (it *chainReaderInterfaceTester) GetSliceContract(ctx context.Context, t *testing.T) clcommontypes.BoundContract { +func (it *chainReaderInterfaceTester) GetSliceContract(t *testing.T) clcommontypes.BoundContract { // Since most tests don't use the contract, it's set up lazily to save time - it.deployNewContract(ctx, t) + it.deployNewContract(t) return clcommontypes.BoundContract{ Address: it.address, Name: MethodReturningUint64Slice, } } -func (it *chainReaderInterfaceTester) SetLatestValue(ctx context.Context, t *testing.T, testStruct *TestStruct) clcommontypes.BoundContract { - it.sendTxWithTestStruct(ctx, t, testStruct, (*testfiles.TestfilesTransactor).AddTestStruct) +func (it *chainReaderInterfaceTester) SetLatestValue(t *testing.T, testStruct *TestStruct) clcommontypes.BoundContract { + it.sendTxWithTestStruct(t, testStruct, (*testfiles.TestfilesTransactor).AddTestStruct) return clcommontypes.BoundContract{ Address: it.address, Name: MethodTakingLatestParamsReturningTestStruct, } } -func (it *chainReaderInterfaceTester) TriggerEvent(ctx context.Context, t *testing.T, testStruct *TestStruct) clcommontypes.BoundContract { - it.sendTxWithTestStruct(ctx, t, testStruct, (*testfiles.TestfilesTransactor).TriggerEvent) +func (it *chainReaderInterfaceTester) TriggerEvent(t *testing.T, testStruct *TestStruct) clcommontypes.BoundContract { + it.sendTxWithTestStruct(t, testStruct, (*testfiles.TestfilesTransactor).TriggerEvent) return clcommontypes.BoundContract{ Address: it.address, Name: EventName, @@ -184,9 +184,9 @@ func (it *chainReaderInterfaceTester) TriggerEvent(ctx context.Context, t *testi type testStructFn = func(*testfiles.TestfilesTransactor, *bind.TransactOpts, int32, string, uint8, [32]uint8, [32]byte, [][32]byte, *big.Int, testfiles.MidLevelTestStruct) (*evmtypes.Transaction, error) -func (it *chainReaderInterfaceTester) sendTxWithTestStruct(ctx context.Context, t *testing.T, testStruct *TestStruct, fn testStructFn) { +func (it *chainReaderInterfaceTester) sendTxWithTestStruct(t *testing.T, testStruct *TestStruct, fn testStructFn) { // Since most tests don't use the contract, it's set up lazily to save time - it.deployNewContract(ctx, t) + it.deployNewContract(t) tx, err := fn( &it.evmTest.TestfilesTransactor, @@ -203,7 +203,7 @@ func (it *chainReaderInterfaceTester) sendTxWithTestStruct(ctx context.Context, require.NoError(t, err) it.sim.Commit() it.incNonce() - it.awaitTx(ctx, t, tx) + it.awaitTx(t, tx) } func convertOracleIDs(oracleIDs [32]commontypes.OracleID) [32]byte { @@ -234,7 +234,8 @@ func (it *chainReaderInterfaceTester) setupChainNoClient(t require.TestingT) { it.sim.Commit() } -func (it *chainReaderInterfaceTester) deployNewContract(ctx context.Context, t *testing.T) { +func (it *chainReaderInterfaceTester) deployNewContract(t *testing.T) { + ctx := testutils.Context(t) if it.address != "" { return } @@ -252,11 +253,12 @@ func (it *chainReaderInterfaceTester) deployNewContract(ctx context.Context, t * it.sim.Commit() it.evmTest = ts it.incNonce() - it.awaitTx(ctx, t, tx) + it.awaitTx(t, tx) it.address = address.String() } -func (it *chainReaderInterfaceTester) awaitTx(ctx context.Context, t *testing.T, tx *evmtypes.Transaction) { +func (it *chainReaderInterfaceTester) awaitTx(t *testing.T, tx *evmtypes.Transaction) { + ctx := testutils.Context(t) receipt, err := it.sim.TransactionReceipt(ctx, tx.Hash()) require.NoError(t, err) require.Equal(t, evmtypes.ReceiptStatusSuccessful, receipt.Status) diff --git a/core/services/relay/evm/codec_test.go b/core/services/relay/evm/codec_test.go index bb4ee98a44b..dd1977eb39c 100644 --- a/core/services/relay/evm/codec_test.go +++ b/core/services/relay/evm/codec_test.go @@ -1,7 +1,6 @@ package evm_test import ( - "context" "encoding/json" "testing" @@ -50,7 +49,7 @@ func TestCodec(t *testing.T) { type codecInterfaceTester struct{} -func (it *codecInterfaceTester) Setup(_ context.Context, _ *testing.T) {} +func (it *codecInterfaceTester) Setup(_ *testing.T) {} func (it *codecInterfaceTester) GetAccountBytes(i int) []byte { account := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2} diff --git a/go.mod b/go.mod index f83a095f2a8..84fa78e7d4d 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d diff --git a/go.sum b/go.sum index ddb8a245d68..0573207a302 100644 --- a/go.sum +++ b/go.sum @@ -1217,8 +1217,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6 h1:Vqi/po+LG3J47USCh83vvjutn2KX8nr7PsU9q4qHt2o= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c h1:YgizNDPRAP2ObjetDIQTJlrpzLBBkYsNjA10Mo5HByo= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 2541b60bc99..198d613ba1b 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c github.com/smartcontractkit/chainlink-testing-framework v1.20.0 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index df5dbc86cac..90f8209f0f6 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1507,8 +1507,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6 h1:Vqi/po+LG3J47USCh83vvjutn2KX8nr7PsU9q4qHt2o= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208012003-888e7dbdb9c6/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c h1:YgizNDPRAP2ObjetDIQTJlrpzLBBkYsNjA10Mo5HByo= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From f2beeb459bc7a42597a4861f8e05f69e101d6d73 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Mon, 11 Dec 2023 09:37:51 -0500 Subject: [PATCH 041/112] Support multiple contract names and mapping them to multiple contracts. --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 +- core/services/relay/evm/bindings.go | 46 ++++++ core/services/relay/evm/chain_reader.go | 136 ++++++++++-------- core/services/relay/evm/chain_reader_test.go | 109 ++++++++------ core/services/relay/evm/evm.go | 10 +- .../testfiles/chain_reader_test_contract.sol | 5 + .../chain_reader_test_contract_gen.abi | 2 +- .../chain_reader_test_contract_gen.bin | 2 +- .../chain_reader_test_contract_gen.go | 35 ++++- go.mod | 2 +- go.sum | 4 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- 14 files changed, 245 insertions(+), 118 deletions(-) create mode 100644 core/services/relay/evm/bindings.go diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 4e0ba91bb1d..b66a138806b 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -258,7 +258,7 @@ require ( github.com/shirou/gopsutil/v3 v3.23.10 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c // indirect + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index b7685cd0335..9b126f9aa97 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1214,8 +1214,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c h1:YgizNDPRAP2ObjetDIQTJlrpzLBBkYsNjA10Mo5HByo= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15 h1:do3KwTWj7fatHOMwoRwRWefX0ShtbPzNbsOivgNxW3k= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/core/services/relay/evm/bindings.go b/core/services/relay/evm/bindings.go new file mode 100644 index 00000000000..d60a4ecbfc1 --- /dev/null +++ b/core/services/relay/evm/bindings.go @@ -0,0 +1,46 @@ +package evm + +import ( + "fmt" + + "github.com/ethereum/go-ethereum/common" + + "github.com/smartcontractkit/chainlink-common/pkg/types" +) + +type Bindings map[string]methodBindings + +func (b Bindings) addEvent(contractName, typeName string, evt common.Hash) error { + ae, err := b.getBinding(contractName, typeName) + if err != nil { + return err + } + + ae.evt = &evt + return nil +} + +func (b Bindings) getBinding(contractName, typeName string) (*addrEvtBinding, error) { + typeNames, ok := b[contractName] + if !ok { + return nil, fmt.Errorf("%w: contract %s not found", types.ErrInvalidConfig, contractName) + } + + ae, ok := typeNames[typeName] + if !ok { + return nil, fmt.Errorf("%w: method %s not found in contract %s", types.ErrInvalidConfig, typeName, contractName) + } + + return ae, nil +} + +type methodBindings map[string]*addrEvtBinding + +func NewAddrEvtFromAddress(address common.Address) *addrEvtBinding { + return &addrEvtBinding{addr: address} +} + +type addrEvtBinding struct { + addr common.Address + evt *common.Hash +} diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index d14da6f290c..4a7c3ae5576 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -8,7 +8,6 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" - "github.com/pkg/errors" commonservices "github.com/smartcontractkit/chainlink-common/pkg/services" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" @@ -29,48 +28,51 @@ type ChainReaderService interface { } type chainReader struct { - lggr logger.Logger - lp logpoller.LogPoller - codec commontypes.RemoteCodec - client evmclient.Client - contractID common.Address - events map[string]common.Hash + lggr logger.Logger + lp logpoller.LogPoller + codec commontypes.RemoteCodec + client evmclient.Client + bindings Bindings commonservices.StateMachine } // NewChainReaderService is a constructor for ChainReader, returns nil if there is any error -func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, contractID common.Address, chain legacyevm.Chain, config types.ChainReaderConfig) (ChainReaderService, error) { +func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, b Bindings, chain legacyevm.Chain, config types.ChainReaderConfig) (ChainReaderService, error) { parsed := &parsedTypes{ encoderDefs: map[string]*codecEntry{}, decoderDefs: map[string]*codecEntry{}, } - events, err := addTypes(config.ChainContractReaders, parsed) - if err != nil { + if err := addTypes(config.ChainContractReaders, b, parsed); err != nil { return nil, err } c, err := parsed.toCodec() return &chainReader{ - lggr: lggr.Named("ChainReader"), - lp: lp, - codec: c, - client: chain.Client(), - contractID: contractID, - events: events, + lggr: lggr.Named("ChainReader"), + lp: lp, + codec: c, + client: chain.Client(), + bindings: b, }, err } func (cr *chainReader) Name() string { return cr.lggr.Name() } -var _ commontypes.TypeProvider = &chainReader{} +var _ commontypes.ContractTypeProvider = &chainReader{} func (cr *chainReader) GetLatestValue(ctx context.Context, bc commontypes.BoundContract, method string, params any, returnVal any) error { - if hash, ok := cr.events[method]; ok { - return cr.getLatestValueFromLogPoller(ctx, bc, method, hash, returnVal) + b, err := cr.bindings.getBinding(bc.Name, method) + if err != nil { + return err + } + + if b.evt == nil { + return cr.getLatestValueFromContract(ctx, bc, method, params, returnVal) } - return cr.getLatestValueFromContract(ctx, bc, method, params, returnVal) + + return cr.getLatestValueFromLogPoller(ctx, bc, method, *b.evt, returnVal) } func (cr *chainReader) getLatestValueFromLogPoller(ctx context.Context, bc commontypes.BoundContract, method string, hash common.Hash, returnVal any) error { @@ -82,11 +84,11 @@ func (cr *chainReader) getLatestValueFromLogPoller(ctx context.Context, bc commo } return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) } - return cr.codec.Decode(ctx, log.Data, returnVal, wrapItemType(method, false)) + return cr.codec.Decode(ctx, log.Data, returnVal, wrapItemType(bc.Name, method, false)) } func (cr *chainReader) getLatestValueFromContract(ctx context.Context, bc commontypes.BoundContract, method string, params any, returnVal any) error { - data, err := cr.codec.Encode(ctx, params, wrapItemType(method, true)) + data, err := cr.codec.Encode(ctx, params, wrapItemType(bc.Name, method, true)) if err != nil { return err } @@ -104,25 +106,40 @@ func (cr *chainReader) getLatestValueFromContract(ctx context.Context, bc common return err } - return cr.codec.Decode(ctx, output, returnVal, wrapItemType(method, false)) + return cr.codec.Decode(ctx, output, returnVal, wrapItemType(bc.Name, method, false)) } func (cr *chainReader) Start(_ context.Context) error { return cr.StartOnce("ChainReader", func() error { - for name, eventId := range cr.events { - if err := cr.lp.RegisterFilter(logpoller.Filter{ - Name: name, - EventSigs: evmtypes.HashArray{eventId}, - Addresses: evmtypes.AddressArray{cr.contractID}, - }); err != nil { - return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) + for contractName, contractEvents := range cr.bindings { + for eventName, b := range contractEvents { + if b.evt == nil { + continue + } + + if err := cr.lp.RegisterFilter(logpoller.Filter{ + Name: wrapItemType(contractName, eventName, false), + EventSigs: evmtypes.HashArray{*b.evt}, + Addresses: evmtypes.AddressArray{b.addr}, + }); err != nil { + return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) + } } } return nil }) } func (cr *chainReader) Close() error { - return nil + return cr.StopOnce("ChainReader", func() error { + for contractName, contractEvents := range cr.bindings { + for eventName := range contractEvents { + if err := cr.lp.UnregisterFilter(wrapItemType(contractName, eventName, false)); err != nil { + return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) + } + } + } + return nil + }) } func (cr *chainReader) Ready() error { return nil } @@ -130,33 +147,38 @@ func (cr *chainReader) HealthReport() map[string]error { return map[string]error{cr.Name(): nil} } -func (cr *chainReader) CreateType(itemType string, forEncoding bool) (any, error) { - return cr.codec.CreateType(wrapItemType(itemType, forEncoding), forEncoding) +func (cr *chainReader) CreateContractType(contractName, methodName string, forEncoding bool) (any, error) { + return cr.codec.CreateType(wrapItemType(contractName, methodName, forEncoding), forEncoding) } -func addEventTypes(name string, contractABI abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) (common.Hash, error) { +func addEventTypes(contractName, methodName string, b Bindings, contractABI abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) error { event, methodExists := contractABI.Events[chainReaderDefinition.ChainSpecificName] if !methodExists { - return common.Hash{}, fmt.Errorf("method: %s doesn't exist", chainReaderDefinition.ChainSpecificName) + return fmt.Errorf("%w: method %s doesn't exist", commontypes.ErrInvalidConfig, chainReaderDefinition.ChainSpecificName) } - return event.ID, addDecoderDef(name, event.Inputs, parsed, chainReaderDefinition) + if err := b.addEvent(contractName, methodName, event.ID); err != nil { + return err + } + + return addDecoderDef(contractName, methodName, event.Inputs, parsed, chainReaderDefinition) } -func addMethods(name string, abi abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) error { +func addMethods( + contractName, methodName string, abi abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) error { method, methodExists := abi.Methods[chainReaderDefinition.ChainSpecificName] if !methodExists { return fmt.Errorf("method: %q doesn't exist", chainReaderDefinition.ChainSpecificName) } - if err := addEncoderDef(name, method, parsed, chainReaderDefinition); err != nil { + if err := addEncoderDef(contractName, methodName, method, parsed, chainReaderDefinition); err != nil { return err } - return addDecoderDef(name, method.Outputs, parsed, chainReaderDefinition) + return addDecoderDef(contractName, methodName, method.Outputs, parsed, chainReaderDefinition) } -func addEncoderDef(name string, method abi.Method, parsed *parsedTypes, chainReaderDefinition types.ChainReaderDefinition) error { +func addEncoderDef(contractName, methodName string, method abi.Method, parsed *parsedTypes, chainReaderDefinition types.ChainReaderDefinition) error { // ABI.Pack prepends the method.ID to the encodings, we'll need the encoder to do the same. input := &codecEntry{Args: method.Inputs, encodingPrefix: method.ID} @@ -169,53 +191,53 @@ func addEncoderDef(name string, method abi.Method, parsed *parsedTypes, chainRea return err } input.mod = inputMod - parsed.encoderDefs[wrapItemType(name, true)] = input + parsed.encoderDefs[wrapItemType(contractName, methodName, true)] = input return nil } -func addDecoderDef(name string, outputs abi.Arguments, parsed *parsedTypes, def types.ChainReaderDefinition) error { +func addDecoderDef(contractName, methodName string, outputs abi.Arguments, parsed *parsedTypes, def types.ChainReaderDefinition) error { output := &codecEntry{Args: outputs} mod, err := def.OutputModifications.ToModifier(evmDecoderHooks...) if err != nil { return err } output.mod = mod - parsed.decoderDefs[wrapItemType(name, false)] = output + parsed.decoderDefs[wrapItemType(contractName, methodName, false)] = output return output.Init() } -func addTypes(chainContractReaders map[string]types.ChainContractReader, parsed *parsedTypes) (map[string]common.Hash, error) { - events := map[string]common.Hash{} +func addTypes(chainContractReaders map[string]types.ChainContractReader, b Bindings, parsed *parsedTypes) error { for contractName, chainContractReader := range chainContractReaders { contractAbi, err := abi.JSON(strings.NewReader(chainContractReader.ContractABI)) if err != nil { - return nil, err + return err } - for chainReadingDefinitionName, chainReaderDefinition := range chainContractReader.ChainReaderDefinitions { + for typeName, chainReaderDefinition := range chainContractReader.ChainReaderDefinitions { switch chainReaderDefinition.ReadType { case types.Method: - err = addMethods(chainReadingDefinitionName, contractAbi, chainReaderDefinition, parsed) + err = addMethods(contractName, typeName, contractAbi, chainReaderDefinition, parsed) case types.Event: - var hash common.Hash - hash, err = addEventTypes(chainReadingDefinitionName, contractAbi, chainReaderDefinition, parsed) - events[chainReadingDefinitionName] = hash + err = addEventTypes(contractName, typeName, b, contractAbi, chainReaderDefinition, parsed) default: - return nil, fmt.Errorf("invalid chain reader definition read type: %d", chainReaderDefinition.ReadType) + return fmt.Errorf( + "%w: invalid chain reader definition read type: %d", + commontypes.ErrInvalidConfig, + chainReaderDefinition.ReadType) } if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("invalid chain reader config for contract: %q chain reading definition: %q", contractName, chainReadingDefinitionName)) + return err } } } - return events, nil + return nil } -func wrapItemType(itemType string, isParams bool) string { +func wrapItemType(contractName, methodName string, isParams bool) string { if isParams { - return fmt.Sprintf("params.%s", itemType) + return fmt.Sprintf("params.%s.%s", contractName, methodName) } - return fmt.Sprintf("return.%s", itemType) + return fmt.Sprintf("return.%s.%s", contractName, methodName) } diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 7efa27b4608..018c6369cea 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -36,8 +36,6 @@ import ( ) const commonGasLimitOnEvms = uint64(4712388) -const chainReaderContractName = "LatestValueHolder" -const returnSeenName = "ReturnSeen" func TestChainReader(t *testing.T) { RunChainReaderInterfaceTests(t, &chainReaderInterfaceTester{}) @@ -46,6 +44,7 @@ func TestChainReader(t *testing.T) { type chainReaderInterfaceTester struct { chain *mocks.Chain address string + address2 string chainConfig types.ChainReaderConfig auth *bind.TransactOpts sim *backends.SimulatedBackend @@ -56,14 +55,15 @@ type chainReaderInterfaceTester struct { func (it *chainReaderInterfaceTester) Setup(t *testing.T) { t.Cleanup(func() { - it.address = "" - require.NoError(t, it.cr.Close()) + // DB may be closed by the test already, ignore errors + _ = it.cr.Close() it.cr = nil + it.evmTest = nil }) // can re-use the same chain for tests, just make new contract for each test if it.chain != nil { - it.deployNewContract(t) + it.deployNewContracts(t) return } @@ -74,7 +74,7 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { it.chainConfig = types.ChainReaderConfig{ ChainContractReaders: map[string]types.ChainContractReader{ - chainReaderContractName: { + AnyContractName: { ContractABI: testfiles.TestfilesMetaData.ABI, ChainReaderDefinitions: map[string]types.ChainReaderDefinition{ MethodTakingLatestParamsReturningTestStruct: { @@ -83,6 +83,9 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { MethodReturningUint64: { ChainSpecificName: "GetPrimitiveValue", }, + DifferentMethodReturningUint64: { + ChainSpecificName: "GetDifferentPrimitiveValue", + }, MethodReturningUint64Slice: { ChainSpecificName: "GetSliceValue", }, @@ -91,7 +94,7 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { ReadType: types.Event, }, MethodReturningSeenStruct: { - ChainSpecificName: returnSeenName, + ChainSpecificName: "ReturnSeen", InputModifications: codec.ModifiersConfig{ &codec.HardCodeConfig{ OnChainValues: map[string]any{ @@ -107,10 +110,18 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { }, }, }, + AnySecondContractName: { + ContractABI: testfiles.TestfilesMetaData.ABI, + ChainReaderDefinitions: map[string]types.ChainReaderDefinition{ + MethodReturningUint64: { + ChainSpecificName: "GetDifferentPrimitiveValue", + }, + }, + }, }, } it.chain.On("Client").Return(client.NewSimulatedBackendClient(t, it.sim, big.NewInt(1337))) - it.deployNewContract(t) + it.deployNewContracts(t) } func (it *chainReaderInterfaceTester) Name() string { @@ -131,63 +142,63 @@ func (it *chainReaderInterfaceTester) GetChainReader(t *testing.T) clcommontypes } addr := common.HexToAddress(it.address) + addr2 := common.HexToAddress(it.address2) lggr := logger.NullLogger db := pgtest.NewSqlxDB(t) lp := logpoller.NewLogPoller(logpoller.NewORM(testutils.SimulatedChainID, db, lggr, pgtest.NewQConfig(true)), it.chain.Client(), lggr, time.Millisecond, false, 0, 1, 1, 10000) require.NoError(t, lp.Start(ctx)) it.chain.On("LogPoller").Return(lp) - cr, err := evm.NewChainReaderService(lggr, lp, addr, it.chain, it.chainConfig) + b := evm.Bindings{ + AnyContractName: { + MethodTakingLatestParamsReturningTestStruct: evm.NewAddrEvtFromAddress(addr), + MethodReturningUint64: evm.NewAddrEvtFromAddress(addr), + DifferentMethodReturningUint64: evm.NewAddrEvtFromAddress(addr2), + MethodReturningUint64Slice: evm.NewAddrEvtFromAddress(addr), + EventName: evm.NewAddrEvtFromAddress(addr), + MethodReturningSeenStruct: evm.NewAddrEvtFromAddress(addr), + }, + AnySecondContractName: { + MethodReturningUint64: evm.NewAddrEvtFromAddress(addr2), + }, + } + cr, err := evm.NewChainReaderService(lggr, lp, b, it.chain, it.chainConfig) require.NoError(t, err) require.NoError(t, cr.Start(ctx)) it.cr = cr return cr } -func (it *chainReaderInterfaceTester) GetPrimitiveContract(_ *testing.T) clcommontypes.BoundContract { - return clcommontypes.BoundContract{ - Address: it.address, - Name: MethodReturningUint64, - } +func (it *chainReaderInterfaceTester) GetPrimitiveContract(_ *testing.T) string { + return it.address } -func (it *chainReaderInterfaceTester) GetReturnSeenContract(t *testing.T) clcommontypes.BoundContract { - it.deployNewContract(t) - return clcommontypes.BoundContract{ - Address: it.address, - Name: returnSeenName, - } +func (it *chainReaderInterfaceTester) GetDifferentPrimitiveContract(_ *testing.T) string { + // Using the same address for a different contract name proves that we can map different logical contracts to the same contract if needed. + // Although it's unlikely that the same type name in a different contract name would have a different meaning, it's possible. + // Mapping it to a different function on the same contract address proves the most flexibility. + return it.address2 } -func (it *chainReaderInterfaceTester) GetSliceContract(t *testing.T) clcommontypes.BoundContract { - // Since most tests don't use the contract, it's set up lazily to save time - it.deployNewContract(t) - return clcommontypes.BoundContract{ - Address: it.address, - Name: MethodReturningUint64Slice, - } + +func (it *chainReaderInterfaceTester) GetReturnSeenContract(_ *testing.T) string { + return it.address +} +func (it *chainReaderInterfaceTester) GetSliceContract(_ *testing.T) string { + return it.address } -func (it *chainReaderInterfaceTester) SetLatestValue(t *testing.T, testStruct *TestStruct) clcommontypes.BoundContract { +func (it *chainReaderInterfaceTester) SetLatestValue(t *testing.T, testStruct *TestStruct) string { it.sendTxWithTestStruct(t, testStruct, (*testfiles.TestfilesTransactor).AddTestStruct) - return clcommontypes.BoundContract{ - Address: it.address, - Name: MethodTakingLatestParamsReturningTestStruct, - } + return it.address } -func (it *chainReaderInterfaceTester) TriggerEvent(t *testing.T, testStruct *TestStruct) clcommontypes.BoundContract { +func (it *chainReaderInterfaceTester) TriggerEvent(t *testing.T, testStruct *TestStruct) string { it.sendTxWithTestStruct(t, testStruct, (*testfiles.TestfilesTransactor).TriggerEvent) - return clcommontypes.BoundContract{ - Address: it.address, - Name: EventName, - } + return it.address } type testStructFn = func(*testfiles.TestfilesTransactor, *bind.TransactOpts, int32, string, uint8, [32]uint8, [32]byte, [][32]byte, *big.Int, testfiles.MidLevelTestStruct) (*evmtypes.Transaction, error) func (it *chainReaderInterfaceTester) sendTxWithTestStruct(t *testing.T, testStruct *TestStruct, fn testStructFn) { - // Since most tests don't use the contract, it's set up lazily to save time - it.deployNewContract(t) - tx, err := fn( &it.evmTest.TestfilesTransactor, it.auth, @@ -234,27 +245,31 @@ func (it *chainReaderInterfaceTester) setupChainNoClient(t require.TestingT) { it.sim.Commit() } -func (it *chainReaderInterfaceTester) deployNewContract(t *testing.T) { +func (it *chainReaderInterfaceTester) deployNewContracts(t *testing.T) { + it.address = it.deployNewContract(t) + it.address2 = it.deployNewContract(t) +} + +func (it *chainReaderInterfaceTester) deployNewContract(t *testing.T) string { ctx := testutils.Context(t) - if it.address != "" { - return - } gasPrice, err := it.sim.SuggestGasPrice(ctx) require.NoError(t, err) it.auth.GasPrice = gasPrice // 105528 was in the error: gas too low: have 0, want 105528 // Not sure if there's a better way to get it. - it.auth.GasLimit = 1055280000 + it.auth.GasLimit = 10552800 address, tx, ts, err := testfiles.DeployTestfiles(it.auth, it.sim) require.NoError(t, err) it.sim.Commit() - it.evmTest = ts + if it.evmTest == nil { + it.evmTest = ts + } it.incNonce() it.awaitTx(t, tx) - it.address = address.String() + return address.String() } func (it *chainReaderInterfaceTester) awaitTx(t *testing.T, tx *evmtypes.Transaction) { diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index d139d250d08..67a62757328 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -534,7 +534,15 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp // allow fallback until chain reader is default and median contract is removed, but still log just in case var chainReaderService commontypes.ChainReader if relayConfig.ChainReader != nil { - if chainReaderService, err = NewChainReaderService(lggr, r.chain.LogPoller(), contractID, r.chain, *relayConfig.ChainReader); err != nil { + b := Bindings{ + // TODO BCF-2837: clean up the hard-coded values. + "median": { + "LatestTransmissionDetails": &addrEvtBinding{addr: contractID}, + "LatestRoundReported": &addrEvtBinding{addr: contractID}, + }, + } + + if chainReaderService, err = NewChainReaderService(lggr, r.chain.LogPoller(), b, r.chain, *relayConfig.ChainReader); err != nil { return nil, err } } else { diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract.sol b/core/services/relay/evm/testfiles/chain_reader_test_contract.sol index fee62f1beac..feeecda1c25 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract.sol +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract.sol @@ -76,6 +76,11 @@ contract LatestValueHolder { return 3; } + function GetDifferentPrimitiveValue() public pure returns (uint64) { + // See chain_reader_interface_tests.go in chainlink-relay + return 1990; + } + function GetSliceValue() public view returns (uint64[] memory) { return arr; } diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi index 12d4bd4368c..cdefbb905ba 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi @@ -1 +1 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"int32","name":"field","type":"int32"},{"indexed":false,"internalType":"string","name":"differentField","type":"string"},{"indexed":false,"internalType":"uint8","name":"oracleId","type":"uint8"},{"indexed":false,"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"indexed":false,"internalType":"bytes32","name":"account","type":"bytes32"},{"indexed":false,"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"indexed":false,"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"indexed":false,"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"Triggered","type":"event"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"AddTestStruct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"GetElementAtIndex","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GetPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"GetSliceValue","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"ReturnSeen","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"TriggerEvent","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"int32","name":"field","type":"int32"},{"indexed":false,"internalType":"string","name":"differentField","type":"string"},{"indexed":false,"internalType":"uint8","name":"oracleId","type":"uint8"},{"indexed":false,"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"indexed":false,"internalType":"bytes32","name":"account","type":"bytes32"},{"indexed":false,"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"indexed":false,"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"indexed":false,"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"Triggered","type":"event"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"AddTestStruct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"GetDifferentPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"GetElementAtIndex","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GetPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"GetSliceValue","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"ReturnSeen","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"TriggerEvent","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin index 8cd1c9903e0..57aef1bf047 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a91820291021990921691909117905561118e806100a96000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80637dd6af5b146100675780639ca04f671461007c578063b95ad411146100a5578063bdb37c90146100b8578063da8e7a82146100cd578063e669831d146100dc575b600080fd5b61007a610075366004610acd565b6100ef565b005b61008f61008a366004610bb8565b61031e565b60405161009c9190610ed3565b60405180910390f35b61008f6100b3366004610acd565b6105ce565b6100c06106bf565b60405161009c9190610dd7565b6040516003815260200161009c565b61007a6100ea366004610acd565b61074b565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016101c98461100a565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff1990931692909217825583830151805193949293610220939285019291909101906107a0565b50604082015160028201805460ff191660ff90921691909117905560608201516102509060038301906020610824565b506080820151600482015560a082015180516102769160058401916020909101906108b2565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff1990911617835580820151805191939261030b926009890192909101906107a0565b5050505050505050505050505050505050565b6103266108ec565b6000610333600184610fe5565b815481106103435761034361112c565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461038a906110f7565b80601f01602080910402602001604051908101604052809291908181526020018280546103b6906110f7565b80156104035780601f106103d857610100808354040283529160200191610403565b820191906000526020600020905b8154815290600101906020018083116103e657829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116104385790505050505050815260200160048201548152602001600582018054806020026020016040519081016040528092919081815260200182805480156104c857602002820191906000526020600020905b8154815260200190600101908083116104b4575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061053f906110f7565b80601f016020809104026020016040519081016040528092919081815260200182805461056b906110f7565b80156105b85780601f1061058d576101008083540402835291602001916105b8565b820191906000526020600020905b81548152906001019060200180831161059b57829003601f168201915b5050509190925250505090525090525092915050565b6105d66108ec565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016106ae8461100a565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561074157602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116106fc5790505b5050505050905090565b7f7d2abe6109e46b893ac1835c9287d6ad5c5ccf3d0254d2ca72225873795e0f538a8a8a8a8a8a8a8a8a8a60405161078c9a99989796959493929190610e25565b60405180910390a150505050505050505050565b8280546107ac906110f7565b90600052602060002090601f0160209004810192826107ce5760008555610814565b82601f106107e757805160ff1916838001178555610814565b82800160010185558215610814579182015b828111156108145782518255916020019190600101906107f9565b5061082092915061093b565b5090565b6001830191839082156108145791602002820160005b8382111561087857835183826101000a81548160ff021916908360ff160217905550926020019260010160208160000104928301926001030261083a565b80156108a55782816101000a81549060ff0219169055600101602081600001049283019260010302610878565b505061082092915061093b565b82805482825590600052602060002090810192821561081457916020028201828111156108145782518255916020019190600101906107f9565b6040805161010081018252600080825260606020830181905292820152908101610914610950565b815260006020820181905260606040830181905282015260800161093661096f565b905290565b5b80821115610820576000815560010161093c565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016109366040518060400160405280600060070b8152602001606081525090565b60008083601f8401126109bd57600080fd5b50813567ffffffffffffffff8111156109d557600080fd5b6020830191508360208260051b85010111156109f057600080fd5b9250929050565b806104008101831015610a0957600080fd5b92915050565b80356001600160f01b031981168114610a2757600080fd5b919050565b8035601781900b8114610a2757600080fd5b8035600381900b8114610a2757600080fd5b8035600781900b8114610a2757600080fd5b60008083601f840112610a7457600080fd5b50813567ffffffffffffffff811115610a8c57600080fd5b6020830191508360208285010111156109f057600080fd5b600060408284031215610ab657600080fd5b50919050565b803560ff81168114610a2757600080fd5b6000806000806000806000806000806104e08b8d031215610aed57600080fd5b610af68b610a3e565b995060208b013567ffffffffffffffff80821115610b1357600080fd5b610b1f8e838f01610a62565b909b509950899150610b3360408e01610abc565b9850610b428e60608f016109f7565b97506104608d013596506104808d0135915080821115610b6157600080fd5b610b6d8e838f016109ab565b9096509450849150610b826104a08e01610a2c565b93506104c08d0135915080821115610b9957600080fd5b50610ba68d828e01610aa4565b9150509295989b9194979a5092959850565b600060208284031215610bca57600080fd5b5035919050565b81835260006001600160fb1b03831115610bea57600080fd5b8260051b8083602087013760009401602001938452509192915050565b600081518084526020808501945080840160005b83811015610c3757815187529582019590820190600101610c1b565b509495945050505050565b8060005b6020808210610c555750610c6c565b825160ff1685529384019390910190600101610c46565b50505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815180845260005b81811015610cc157602081850181015186830182015201610ca5565b81811115610cd3576000602083870101525b50601f01601f19169290920160200192915050565b6001600160f01b0319610cfa82610a0f565b16825260006020820135603e19833603018112610d1657600080fd5b604060208501528201610d2881610a50565b60070b60408501526020810135601e19823603018112610d4757600080fd5b8101803567ffffffffffffffff811115610d6057600080fd5b803603831315610d6f57600080fd5b60406060870152610d87608087018260208501610c72565b9695505050505050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610dcf6080850182610c9b565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610e1957835167ffffffffffffffff1683529284019291840191600101610df3565b50909695505050505050565b60006104e08c60030b835260208181850152610e448285018d8f610c72565b915060ff808c166040860152606085018b60005b84811015610e7d5783610e6a83610abc565b1683529184019190840190600101610e58565b505050505087610460840152828103610480840152610e9d818789610bd1565b9050610eaf6104a084018660170b9052565b8281036104c0840152610ec28185610ce8565b9d9c50505050505050505050505050565b60208152610ee760208201835160030b9052565b600060208301516104e0806040850152610f05610500850183610c9b565b91506040850151610f1b606086018260ff169052565b506060850151610f2e6080860182610c42565b50608085015161048085015260a0850151601f1980868503016104a0870152610f578483610c07565b935060c08701519150610f706104c087018360170b9052565b60e0870151915080868503018387015250610d878382610d91565b6040805190810167ffffffffffffffff81118282101715610fae57610fae611142565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610fdd57610fdd611142565b604052919050565b60008282101561100557634e487b7160e01b600052601160045260246000fd5b500390565b60006040823603121561101c57600080fd5b611024610f8b565b61102d83610a0f565b815260208084013567ffffffffffffffff8082111561104b57600080fd5b81860191506040823603121561106057600080fd5b611068610f8b565b61107183610a50565b8152838301358281111561108457600080fd5b929092019136601f84011261109857600080fd5b8235828111156110aa576110aa611142565b6110bc601f8201601f19168601610fb4565b925080835236858286010111156110d257600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c9082168061110b57607f821691505b60208210811415610ab657634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220dc7c8830d1691fb07419d1e88774f8489193b9b32a6a2406f298335883e9593b64736f6c63430008060033 \ No newline at end of file +608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a9182029102199092169190911790556111ba806100a96000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063b95ad4111161005b578063b95ad411146100d9578063bdb37c90146100ec578063da8e7a8214610101578063e669831d1461010857600080fd5b8063030d3ca2146100825780637dd6af5b146100a45780639ca04f67146100b9575b600080fd5b6107c65b60405167ffffffffffffffff90911681526020015b60405180910390f35b6100b76100b2366004610af9565b61011b565b005b6100cc6100c7366004610be4565b61034a565b60405161009b9190610eff565b6100cc6100e7366004610af9565b6105fa565b6100f46106eb565b60405161009b9190610e03565b6003610086565b6100b7610116366004610af9565b610777565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016101f584611036565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff199093169290921782558383015180519394929361024c939285019291909101906107cc565b50604082015160028201805460ff191660ff909216919091179055606082015161027c9060038301906020610850565b506080820151600482015560a082015180516102a29160058401916020909101906108de565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff19909116178355808201518051919392610337926009890192909101906107cc565b5050505050505050505050505050505050565b610352610918565b600061035f600184611011565b8154811061036f5761036f611158565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b81526020016001820180546103b690611123565b80601f01602080910402602001604051908101604052809291908181526020018280546103e290611123565b801561042f5780601f106104045761010080835404028352916020019161042f565b820191906000526020600020905b81548152906001019060200180831161041257829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116104645790505050505050815260200160048201548152602001600582018054806020026020016040519081016040528092919081815260200182805480156104f457602002820191906000526020600020905b8154815260200190600101908083116104e0575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061056b90611123565b80601f016020809104026020016040519081016040528092919081815260200182805461059790611123565b80156105e45780601f106105b9576101008083540402835291602001916105e4565b820191906000526020600020905b8154815290600101906020018083116105c757829003601f168201915b5050509190925250505090525090525092915050565b610602610918565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016106da84611036565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561076d57602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116107285790505b5050505050905090565b7f7d2abe6109e46b893ac1835c9287d6ad5c5ccf3d0254d2ca72225873795e0f538a8a8a8a8a8a8a8a8a8a6040516107b89a99989796959493929190610e51565b60405180910390a150505050505050505050565b8280546107d890611123565b90600052602060002090601f0160209004810192826107fa5760008555610840565b82601f1061081357805160ff1916838001178555610840565b82800160010185558215610840579182015b82811115610840578251825591602001919060010190610825565b5061084c929150610967565b5090565b6001830191839082156108405791602002820160005b838211156108a457835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302610866565b80156108d15782816101000a81549060ff02191690556001016020816000010492830192600103026108a4565b505061084c929150610967565b8280548282559060005260206000209081019282156108405791602002820182811115610840578251825591602001919060010190610825565b604080516101008101825260008082526060602083018190529282015290810161094061097c565b815260006020820181905260606040830181905282015260800161096261099b565b905290565b5b8082111561084c5760008155600101610968565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016109626040518060400160405280600060070b8152602001606081525090565b60008083601f8401126109e957600080fd5b50813567ffffffffffffffff811115610a0157600080fd5b6020830191508360208260051b8501011115610a1c57600080fd5b9250929050565b806104008101831015610a3557600080fd5b92915050565b80356001600160f01b031981168114610a5357600080fd5b919050565b8035601781900b8114610a5357600080fd5b8035600381900b8114610a5357600080fd5b8035600781900b8114610a5357600080fd5b60008083601f840112610aa057600080fd5b50813567ffffffffffffffff811115610ab857600080fd5b602083019150836020828501011115610a1c57600080fd5b600060408284031215610ae257600080fd5b50919050565b803560ff81168114610a5357600080fd5b6000806000806000806000806000806104e08b8d031215610b1957600080fd5b610b228b610a6a565b995060208b013567ffffffffffffffff80821115610b3f57600080fd5b610b4b8e838f01610a8e565b909b509950899150610b5f60408e01610ae8565b9850610b6e8e60608f01610a23565b97506104608d013596506104808d0135915080821115610b8d57600080fd5b610b998e838f016109d7565b9096509450849150610bae6104a08e01610a58565b93506104c08d0135915080821115610bc557600080fd5b50610bd28d828e01610ad0565b9150509295989b9194979a5092959850565b600060208284031215610bf657600080fd5b5035919050565b81835260006001600160fb1b03831115610c1657600080fd5b8260051b8083602087013760009401602001938452509192915050565b600081518084526020808501945080840160005b83811015610c6357815187529582019590820190600101610c47565b509495945050505050565b8060005b6020808210610c815750610c98565b825160ff1685529384019390910190600101610c72565b50505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815180845260005b81811015610ced57602081850181015186830182015201610cd1565b81811115610cff576000602083870101525b50601f01601f19169290920160200192915050565b6001600160f01b0319610d2682610a3b565b16825260006020820135603e19833603018112610d4257600080fd5b604060208501528201610d5481610a7c565b60070b60408501526020810135601e19823603018112610d7357600080fd5b8101803567ffffffffffffffff811115610d8c57600080fd5b803603831315610d9b57600080fd5b60406060870152610db3608087018260208501610c9e565b9695505050505050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610dfb6080850182610cc7565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610e4557835167ffffffffffffffff1683529284019291840191600101610e1f565b50909695505050505050565b60006104e08c60030b835260208181850152610e708285018d8f610c9e565b915060ff808c166040860152606085018b60005b84811015610ea95783610e9683610ae8565b1683529184019190840190600101610e84565b505050505087610460840152828103610480840152610ec9818789610bfd565b9050610edb6104a084018660170b9052565b8281036104c0840152610eee8185610d14565b9d9c50505050505050505050505050565b60208152610f1360208201835160030b9052565b600060208301516104e0806040850152610f31610500850183610cc7565b91506040850151610f47606086018260ff169052565b506060850151610f5a6080860182610c6e565b50608085015161048085015260a0850151601f1980868503016104a0870152610f838483610c33565b935060c08701519150610f9c6104c087018360170b9052565b60e0870151915080868503018387015250610db38382610dbd565b6040805190810167ffffffffffffffff81118282101715610fda57610fda61116e565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156110095761100961116e565b604052919050565b60008282101561103157634e487b7160e01b600052601160045260246000fd5b500390565b60006040823603121561104857600080fd5b611050610fb7565b61105983610a3b565b815260208084013567ffffffffffffffff8082111561107757600080fd5b81860191506040823603121561108c57600080fd5b611094610fb7565b61109d83610a7c565b815283830135828111156110b057600080fd5b929092019136601f8401126110c457600080fd5b8235828111156110d6576110d661116e565b6110e8601f8201601f19168601610fe0565b925080835236858286010111156110fe57600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c9082168061113757607f821691505b60208210811415610ae257634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212207f1ef47c84498df82a83ce9c4eed62d431c29fbd05ad8899d4ef1dfcb22f147e64736f6c63430008060033 \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go index da4f540d3c5..e4475c9b650 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go @@ -55,8 +55,8 @@ type TestStruct struct { // TestfilesMetaData contains all meta data concerning the Testfiles contract. var TestfilesMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"Triggered\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"ReturnSeen\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"TriggerEvent\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a91820291021990921691909117905561118e806100a96000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80637dd6af5b146100675780639ca04f671461007c578063b95ad411146100a5578063bdb37c90146100b8578063da8e7a82146100cd578063e669831d146100dc575b600080fd5b61007a610075366004610acd565b6100ef565b005b61008f61008a366004610bb8565b61031e565b60405161009c9190610ed3565b60405180910390f35b61008f6100b3366004610acd565b6105ce565b6100c06106bf565b60405161009c9190610dd7565b6040516003815260200161009c565b61007a6100ea366004610acd565b61074b565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016101c98461100a565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff1990931692909217825583830151805193949293610220939285019291909101906107a0565b50604082015160028201805460ff191660ff90921691909117905560608201516102509060038301906020610824565b506080820151600482015560a082015180516102769160058401916020909101906108b2565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff1990911617835580820151805191939261030b926009890192909101906107a0565b5050505050505050505050505050505050565b6103266108ec565b6000610333600184610fe5565b815481106103435761034361112c565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b815260200160018201805461038a906110f7565b80601f01602080910402602001604051908101604052809291908181526020018280546103b6906110f7565b80156104035780601f106103d857610100808354040283529160200191610403565b820191906000526020600020905b8154815290600101906020018083116103e657829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116104385790505050505050815260200160048201548152602001600582018054806020026020016040519081016040528092919081815260200182805480156104c857602002820191906000526020600020905b8154815260200190600101908083116104b4575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061053f906110f7565b80601f016020809104026020016040519081016040528092919081815260200182805461056b906110f7565b80156105b85780601f1061058d576101008083540402835291602001916105b8565b820191906000526020600020905b81548152906001019060200180831161059b57829003601f168201915b5050509190925250505090525090525092915050565b6105d66108ec565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016106ae8461100a565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561074157602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116106fc5790505b5050505050905090565b7f7d2abe6109e46b893ac1835c9287d6ad5c5ccf3d0254d2ca72225873795e0f538a8a8a8a8a8a8a8a8a8a60405161078c9a99989796959493929190610e25565b60405180910390a150505050505050505050565b8280546107ac906110f7565b90600052602060002090601f0160209004810192826107ce5760008555610814565b82601f106107e757805160ff1916838001178555610814565b82800160010185558215610814579182015b828111156108145782518255916020019190600101906107f9565b5061082092915061093b565b5090565b6001830191839082156108145791602002820160005b8382111561087857835183826101000a81548160ff021916908360ff160217905550926020019260010160208160000104928301926001030261083a565b80156108a55782816101000a81549060ff0219169055600101602081600001049283019260010302610878565b505061082092915061093b565b82805482825590600052602060002090810192821561081457916020028201828111156108145782518255916020019190600101906107f9565b6040805161010081018252600080825260606020830181905292820152908101610914610950565b815260006020820181905260606040830181905282015260800161093661096f565b905290565b5b80821115610820576000815560010161093c565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016109366040518060400160405280600060070b8152602001606081525090565b60008083601f8401126109bd57600080fd5b50813567ffffffffffffffff8111156109d557600080fd5b6020830191508360208260051b85010111156109f057600080fd5b9250929050565b806104008101831015610a0957600080fd5b92915050565b80356001600160f01b031981168114610a2757600080fd5b919050565b8035601781900b8114610a2757600080fd5b8035600381900b8114610a2757600080fd5b8035600781900b8114610a2757600080fd5b60008083601f840112610a7457600080fd5b50813567ffffffffffffffff811115610a8c57600080fd5b6020830191508360208285010111156109f057600080fd5b600060408284031215610ab657600080fd5b50919050565b803560ff81168114610a2757600080fd5b6000806000806000806000806000806104e08b8d031215610aed57600080fd5b610af68b610a3e565b995060208b013567ffffffffffffffff80821115610b1357600080fd5b610b1f8e838f01610a62565b909b509950899150610b3360408e01610abc565b9850610b428e60608f016109f7565b97506104608d013596506104808d0135915080821115610b6157600080fd5b610b6d8e838f016109ab565b9096509450849150610b826104a08e01610a2c565b93506104c08d0135915080821115610b9957600080fd5b50610ba68d828e01610aa4565b9150509295989b9194979a5092959850565b600060208284031215610bca57600080fd5b5035919050565b81835260006001600160fb1b03831115610bea57600080fd5b8260051b8083602087013760009401602001938452509192915050565b600081518084526020808501945080840160005b83811015610c3757815187529582019590820190600101610c1b565b509495945050505050565b8060005b6020808210610c555750610c6c565b825160ff1685529384019390910190600101610c46565b50505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815180845260005b81811015610cc157602081850181015186830182015201610ca5565b81811115610cd3576000602083870101525b50601f01601f19169290920160200192915050565b6001600160f01b0319610cfa82610a0f565b16825260006020820135603e19833603018112610d1657600080fd5b604060208501528201610d2881610a50565b60070b60408501526020810135601e19823603018112610d4757600080fd5b8101803567ffffffffffffffff811115610d6057600080fd5b803603831315610d6f57600080fd5b60406060870152610d87608087018260208501610c72565b9695505050505050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610dcf6080850182610c9b565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610e1957835167ffffffffffffffff1683529284019291840191600101610df3565b50909695505050505050565b60006104e08c60030b835260208181850152610e448285018d8f610c72565b915060ff808c166040860152606085018b60005b84811015610e7d5783610e6a83610abc565b1683529184019190840190600101610e58565b505050505087610460840152828103610480840152610e9d818789610bd1565b9050610eaf6104a084018660170b9052565b8281036104c0840152610ec28185610ce8565b9d9c50505050505050505050505050565b60208152610ee760208201835160030b9052565b600060208301516104e0806040850152610f05610500850183610c9b565b91506040850151610f1b606086018260ff169052565b506060850151610f2e6080860182610c42565b50608085015161048085015260a0850151601f1980868503016104a0870152610f578483610c07565b935060c08701519150610f706104c087018360170b9052565b60e0870151915080868503018387015250610d878382610d91565b6040805190810167ffffffffffffffff81118282101715610fae57610fae611142565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610fdd57610fdd611142565b604052919050565b60008282101561100557634e487b7160e01b600052601160045260246000fd5b500390565b60006040823603121561101c57600080fd5b611024610f8b565b61102d83610a0f565b815260208084013567ffffffffffffffff8082111561104b57600080fd5b81860191506040823603121561106057600080fd5b611068610f8b565b61107183610a50565b8152838301358281111561108457600080fd5b929092019136601f84011261109857600080fd5b8235828111156110aa576110aa611142565b6110bc601f8201601f19168601610fb4565b925080835236858286010111156110d257600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c9082168061110b57607f821691505b60208210811415610ab657634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220dc7c8830d1691fb07419d1e88774f8489193b9b32a6a2406f298335883e9593b64736f6c63430008060033", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"Triggered\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetDifferentPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"ReturnSeen\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"TriggerEvent\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a9182029102199092169190911790556111ba806100a96000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063b95ad4111161005b578063b95ad411146100d9578063bdb37c90146100ec578063da8e7a8214610101578063e669831d1461010857600080fd5b8063030d3ca2146100825780637dd6af5b146100a45780639ca04f67146100b9575b600080fd5b6107c65b60405167ffffffffffffffff90911681526020015b60405180910390f35b6100b76100b2366004610af9565b61011b565b005b6100cc6100c7366004610be4565b61034a565b60405161009b9190610eff565b6100cc6100e7366004610af9565b6105fa565b6100f46106eb565b60405161009b9190610e03565b6003610086565b6100b7610116366004610af9565b610777565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016101f584611036565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff199093169290921782558383015180519394929361024c939285019291909101906107cc565b50604082015160028201805460ff191660ff909216919091179055606082015161027c9060038301906020610850565b506080820151600482015560a082015180516102a29160058401916020909101906108de565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff19909116178355808201518051919392610337926009890192909101906107cc565b5050505050505050505050505050505050565b610352610918565b600061035f600184611011565b8154811061036f5761036f611158565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b81526020016001820180546103b690611123565b80601f01602080910402602001604051908101604052809291908181526020018280546103e290611123565b801561042f5780601f106104045761010080835404028352916020019161042f565b820191906000526020600020905b81548152906001019060200180831161041257829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116104645790505050505050815260200160048201548152602001600582018054806020026020016040519081016040528092919081815260200182805480156104f457602002820191906000526020600020905b8154815260200190600101908083116104e0575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061056b90611123565b80601f016020809104026020016040519081016040528092919081815260200182805461059790611123565b80156105e45780601f106105b9576101008083540402835291602001916105e4565b820191906000526020600020905b8154815290600101906020018083116105c757829003601f168201915b5050509190925250505090525090525092915050565b610602610918565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016106da84611036565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561076d57602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116107285790505b5050505050905090565b7f7d2abe6109e46b893ac1835c9287d6ad5c5ccf3d0254d2ca72225873795e0f538a8a8a8a8a8a8a8a8a8a6040516107b89a99989796959493929190610e51565b60405180910390a150505050505050505050565b8280546107d890611123565b90600052602060002090601f0160209004810192826107fa5760008555610840565b82601f1061081357805160ff1916838001178555610840565b82800160010185558215610840579182015b82811115610840578251825591602001919060010190610825565b5061084c929150610967565b5090565b6001830191839082156108405791602002820160005b838211156108a457835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302610866565b80156108d15782816101000a81549060ff02191690556001016020816000010492830192600103026108a4565b505061084c929150610967565b8280548282559060005260206000209081019282156108405791602002820182811115610840578251825591602001919060010190610825565b604080516101008101825260008082526060602083018190529282015290810161094061097c565b815260006020820181905260606040830181905282015260800161096261099b565b905290565b5b8082111561084c5760008155600101610968565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016109626040518060400160405280600060070b8152602001606081525090565b60008083601f8401126109e957600080fd5b50813567ffffffffffffffff811115610a0157600080fd5b6020830191508360208260051b8501011115610a1c57600080fd5b9250929050565b806104008101831015610a3557600080fd5b92915050565b80356001600160f01b031981168114610a5357600080fd5b919050565b8035601781900b8114610a5357600080fd5b8035600381900b8114610a5357600080fd5b8035600781900b8114610a5357600080fd5b60008083601f840112610aa057600080fd5b50813567ffffffffffffffff811115610ab857600080fd5b602083019150836020828501011115610a1c57600080fd5b600060408284031215610ae257600080fd5b50919050565b803560ff81168114610a5357600080fd5b6000806000806000806000806000806104e08b8d031215610b1957600080fd5b610b228b610a6a565b995060208b013567ffffffffffffffff80821115610b3f57600080fd5b610b4b8e838f01610a8e565b909b509950899150610b5f60408e01610ae8565b9850610b6e8e60608f01610a23565b97506104608d013596506104808d0135915080821115610b8d57600080fd5b610b998e838f016109d7565b9096509450849150610bae6104a08e01610a58565b93506104c08d0135915080821115610bc557600080fd5b50610bd28d828e01610ad0565b9150509295989b9194979a5092959850565b600060208284031215610bf657600080fd5b5035919050565b81835260006001600160fb1b03831115610c1657600080fd5b8260051b8083602087013760009401602001938452509192915050565b600081518084526020808501945080840160005b83811015610c6357815187529582019590820190600101610c47565b509495945050505050565b8060005b6020808210610c815750610c98565b825160ff1685529384019390910190600101610c72565b50505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815180845260005b81811015610ced57602081850181015186830182015201610cd1565b81811115610cff576000602083870101525b50601f01601f19169290920160200192915050565b6001600160f01b0319610d2682610a3b565b16825260006020820135603e19833603018112610d4257600080fd5b604060208501528201610d5481610a7c565b60070b60408501526020810135601e19823603018112610d7357600080fd5b8101803567ffffffffffffffff811115610d8c57600080fd5b803603831315610d9b57600080fd5b60406060870152610db3608087018260208501610c9e565b9695505050505050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610dfb6080850182610cc7565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610e4557835167ffffffffffffffff1683529284019291840191600101610e1f565b50909695505050505050565b60006104e08c60030b835260208181850152610e708285018d8f610c9e565b915060ff808c166040860152606085018b60005b84811015610ea95783610e9683610ae8565b1683529184019190840190600101610e84565b505050505087610460840152828103610480840152610ec9818789610bfd565b9050610edb6104a084018660170b9052565b8281036104c0840152610eee8185610d14565b9d9c50505050505050505050505050565b60208152610f1360208201835160030b9052565b600060208301516104e0806040850152610f31610500850183610cc7565b91506040850151610f47606086018260ff169052565b506060850151610f5a6080860182610c6e565b50608085015161048085015260a0850151601f1980868503016104a0870152610f838483610c33565b935060c08701519150610f9c6104c087018360170b9052565b60e0870151915080868503018387015250610db38382610dbd565b6040805190810167ffffffffffffffff81118282101715610fda57610fda61116e565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156110095761100961116e565b604052919050565b60008282101561103157634e487b7160e01b600052601160045260246000fd5b500390565b60006040823603121561104857600080fd5b611050610fb7565b61105983610a3b565b815260208084013567ffffffffffffffff8082111561107757600080fd5b81860191506040823603121561108c57600080fd5b611094610fb7565b61109d83610a7c565b815283830135828111156110b057600080fd5b929092019136601f8401126110c457600080fd5b8235828111156110d6576110d661116e565b6110e8601f8201601f19168601610fe0565b925080835236858286010111156110fe57600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c9082168061113757607f821691505b60208210811415610ae257634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212207f1ef47c84498df82a83ce9c4eed62d431c29fbd05ad8899d4ef1dfcb22f147e64736f6c63430008060033", } // TestfilesABI is the input ABI used to generate the binding from. @@ -226,6 +226,37 @@ func (_Testfiles *TestfilesTransactorRaw) Transact(opts *bind.TransactOpts, meth return _Testfiles.Contract.contract.Transact(opts, method, params...) } +// GetDifferentPrimitiveValue is a free data retrieval call binding the contract method 0x030d3ca2. +// +// Solidity: function GetDifferentPrimitiveValue() pure returns(uint64) +func (_Testfiles *TestfilesCaller) GetDifferentPrimitiveValue(opts *bind.CallOpts) (uint64, error) { + var out []interface{} + err := _Testfiles.contract.Call(opts, &out, "GetDifferentPrimitiveValue") + + if err != nil { + return *new(uint64), err + } + + out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + + return out0, err + +} + +// GetDifferentPrimitiveValue is a free data retrieval call binding the contract method 0x030d3ca2. +// +// Solidity: function GetDifferentPrimitiveValue() pure returns(uint64) +func (_Testfiles *TestfilesSession) GetDifferentPrimitiveValue() (uint64, error) { + return _Testfiles.Contract.GetDifferentPrimitiveValue(&_Testfiles.CallOpts) +} + +// GetDifferentPrimitiveValue is a free data retrieval call binding the contract method 0x030d3ca2. +// +// Solidity: function GetDifferentPrimitiveValue() pure returns(uint64) +func (_Testfiles *TestfilesCallerSession) GetDifferentPrimitiveValue() (uint64, error) { + return _Testfiles.Contract.GetDifferentPrimitiveValue(&_Testfiles.CallOpts) +} + // GetElementAtIndex is a free data retrieval call binding the contract method 0x9ca04f67. // // Solidity: function GetElementAtIndex(uint256 i) view returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) diff --git a/go.mod b/go.mod index 84fa78e7d4d..0edb3f83d41 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d diff --git a/go.sum b/go.sum index 0573207a302..79f544f1465 100644 --- a/go.sum +++ b/go.sum @@ -1217,8 +1217,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c h1:YgizNDPRAP2ObjetDIQTJlrpzLBBkYsNjA10Mo5HByo= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15 h1:do3KwTWj7fatHOMwoRwRWefX0ShtbPzNbsOivgNxW3k= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 198d613ba1b..6b7d572ddfe 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15 github.com/smartcontractkit/chainlink-testing-framework v1.20.0 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 90f8209f0f6..24ad1c2d503 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1507,8 +1507,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c h1:YgizNDPRAP2ObjetDIQTJlrpzLBBkYsNjA10Mo5HByo= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231208164731-2783ddbbdd8c/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15 h1:do3KwTWj7fatHOMwoRwRWefX0ShtbPzNbsOivgNxW3k= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From ba7112fc1ad69266df00cc05baea94e1ec591cb6 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Tue, 12 Dec 2023 15:05:34 -0500 Subject: [PATCH 042/112] Upadte chain reader interface --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 +- core/services/ocr2/plugins/median/services.go | 4 +- core/services/relay/evm/bindings.go | 16 +++++--- core/services/relay/evm/chain_reader.go | 37 +++++++++++-------- core/services/relay/evm/chain_reader_test.go | 24 +----------- go.mod | 2 +- go.sum | 4 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- 10 files changed, 45 insertions(+), 54 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index b66a138806b..623d7431780 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -258,7 +258,7 @@ require ( github.com/shirou/gopsutil/v3 v3.23.10 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15 // indirect + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 9b126f9aa97..cf05d697c02 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1214,8 +1214,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15 h1:do3KwTWj7fatHOMwoRwRWefX0ShtbPzNbsOivgNxW3k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b h1:nx2AI6gbMAD/Q4ZWu1pDdudV8pmRvIvxjhAyHFfd1+4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/core/services/ocr2/plugins/median/services.go b/core/services/ocr2/plugins/median/services.go index 4adfc306d64..79abbc96a4b 100644 --- a/core/services/ocr2/plugins/median/services.go +++ b/core/services/ocr2/plugins/median/services.go @@ -215,7 +215,7 @@ type latestRoundRequested struct { func (m *medianContract) LatestTransmissionDetails(ctx context.Context) (configDigest ocr2types.ConfigDigest, epoch uint32, round uint8, latestAnswer *big.Int, latestTimestamp time.Time, err error) { var resp latestTransmissionDetailsResponse - err = m.chainReader.GetLatestValue(ctx, m.contract, "LatestTransmissionDetails", nil, &resp) + err = m.chainReader.GetLatestValue(ctx, m.contract.Name, "LatestTransmissionDetails", nil, &resp) if err != nil { return } @@ -226,7 +226,7 @@ func (m *medianContract) LatestTransmissionDetails(ctx context.Context) (configD func (m *medianContract) LatestRoundRequested(ctx context.Context, lookback time.Duration) (configDigest ocr2types.ConfigDigest, epoch uint32, round uint8, err error) { var resp latestRoundRequested - err = m.chainReader.GetLatestValue(ctx, m.contract, "LatestRoundReported", map[string]string{}, &resp) + err = m.chainReader.GetLatestValue(ctx, m.contract.Name, "LatestRoundRequested", map[string]string{}, &resp) if err != nil { return } diff --git a/core/services/relay/evm/bindings.go b/core/services/relay/evm/bindings.go index d60a4ecbfc1..b1f705e2ce9 100644 --- a/core/services/relay/evm/bindings.go +++ b/core/services/relay/evm/bindings.go @@ -11,7 +11,7 @@ import ( type Bindings map[string]methodBindings func (b Bindings) addEvent(contractName, typeName string, evt common.Hash) error { - ae, err := b.getBinding(contractName, typeName) + ae, err := b.getBinding(contractName, typeName, true) if err != nil { return err } @@ -20,15 +20,19 @@ func (b Bindings) addEvent(contractName, typeName string, evt common.Hash) error return nil } -func (b Bindings) getBinding(contractName, typeName string) (*addrEvtBinding, error) { - typeNames, ok := b[contractName] +func (b Bindings) getBinding(contractName, methodName string, isConfig bool) (*addrEvtBinding, error) { + errType := types.ErrInvalidType + if isConfig { + errType = types.ErrInvalidConfig + } + methodNames, ok := b[contractName] if !ok { - return nil, fmt.Errorf("%w: contract %s not found", types.ErrInvalidConfig, contractName) + return nil, fmt.Errorf("%w: contract %s not found", errType, contractName) } - ae, ok := typeNames[typeName] + ae, ok := methodNames[methodName] if !ok { - return nil, fmt.Errorf("%w: method %s not found in contract %s", types.ErrInvalidConfig, typeName, contractName) + return nil, fmt.Errorf("%w: method %s not found in contract %s", errType, methodName, contractName) } return ae, nil diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index 4a7c3ae5576..ea3498fec94 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -62,41 +62,48 @@ func (cr *chainReader) Name() string { return cr.lggr.Name() } var _ commontypes.ContractTypeProvider = &chainReader{} -func (cr *chainReader) GetLatestValue(ctx context.Context, bc commontypes.BoundContract, method string, params any, returnVal any) error { - b, err := cr.bindings.getBinding(bc.Name, method) +func (cr *chainReader) GetLatestValue(ctx context.Context, contractName, method string, params any, returnVal any) error { + ae, err := cr.bindings.getBinding(contractName, method, false) if err != nil { return err } - if b.evt == nil { - return cr.getLatestValueFromContract(ctx, bc, method, params, returnVal) + if ae.evt == nil { + return cr.getLatestValueFromContract(ctx, contractName, method, params, returnVal) } - return cr.getLatestValueFromLogPoller(ctx, bc, method, *b.evt, returnVal) + return cr.getLatestValueFromLogPoller(ctx, contractName, method, *ae.evt, returnVal) } -func (cr *chainReader) getLatestValueFromLogPoller(ctx context.Context, bc commontypes.BoundContract, method string, hash common.Hash, returnVal any) error { - contractAddr := common.HexToAddress(bc.Address) - log, err := cr.lp.LatestLogByEventSigWithConfs(hash, contractAddr, logpoller.Finalized) +func (cr *chainReader) getLatestValueFromLogPoller(ctx context.Context, contractName, method string, hash common.Hash, returnVal any) error { + ae, err := cr.bindings.getBinding(contractName, method, false) + if err != nil { + return err + } + + log, err := cr.lp.LatestLogByEventSigWithConfs(hash, ae.addr, logpoller.Finalized) if err != nil { if strings.Contains(err.Error(), "not found") { return fmt.Errorf("%w: %w", commontypes.ErrNotFound, err) } return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) } - return cr.codec.Decode(ctx, log.Data, returnVal, wrapItemType(bc.Name, method, false)) + return cr.codec.Decode(ctx, log.Data, returnVal, wrapItemType(contractName, method, false)) } -func (cr *chainReader) getLatestValueFromContract(ctx context.Context, bc commontypes.BoundContract, method string, params any, returnVal any) error { - data, err := cr.codec.Encode(ctx, params, wrapItemType(bc.Name, method, true)) +func (cr *chainReader) getLatestValueFromContract(ctx context.Context, contractName, method string, params any, returnVal any) error { + data, err := cr.codec.Encode(ctx, params, wrapItemType(contractName, method, true)) if err != nil { return err } - address := common.HexToAddress(bc.Address) + ae, err := cr.bindings.getBinding(contractName, method, true) + if err != nil { + return err + } callMsg := ethereum.CallMsg{ - To: &address, - From: address, + To: &ae.addr, + From: ae.addr, Data: data, } @@ -106,7 +113,7 @@ func (cr *chainReader) getLatestValueFromContract(ctx context.Context, bc common return err } - return cr.codec.Decode(ctx, output, returnVal, wrapItemType(bc.Name, method, false)) + return cr.codec.Decode(ctx, output, returnVal, wrapItemType(contractName, method, false)) } func (cr *chainReader) Start(_ context.Context) error { diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 018c6369cea..a39cf07a8c1 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -168,32 +168,12 @@ func (it *chainReaderInterfaceTester) GetChainReader(t *testing.T) clcommontypes return cr } -func (it *chainReaderInterfaceTester) GetPrimitiveContract(_ *testing.T) string { - return it.address -} - -func (it *chainReaderInterfaceTester) GetDifferentPrimitiveContract(_ *testing.T) string { - // Using the same address for a different contract name proves that we can map different logical contracts to the same contract if needed. - // Although it's unlikely that the same type name in a different contract name would have a different meaning, it's possible. - // Mapping it to a different function on the same contract address proves the most flexibility. - return it.address2 -} - -func (it *chainReaderInterfaceTester) GetReturnSeenContract(_ *testing.T) string { - return it.address -} -func (it *chainReaderInterfaceTester) GetSliceContract(_ *testing.T) string { - return it.address -} - -func (it *chainReaderInterfaceTester) SetLatestValue(t *testing.T, testStruct *TestStruct) string { +func (it *chainReaderInterfaceTester) SetLatestValue(t *testing.T, testStruct *TestStruct) { it.sendTxWithTestStruct(t, testStruct, (*testfiles.TestfilesTransactor).AddTestStruct) - return it.address } -func (it *chainReaderInterfaceTester) TriggerEvent(t *testing.T, testStruct *TestStruct) string { +func (it *chainReaderInterfaceTester) TriggerEvent(t *testing.T, testStruct *TestStruct) { it.sendTxWithTestStruct(t, testStruct, (*testfiles.TestfilesTransactor).TriggerEvent) - return it.address } type testStructFn = func(*testfiles.TestfilesTransactor, *bind.TransactOpts, int32, string, uint8, [32]uint8, [32]byte, [][32]byte, *big.Int, testfiles.MidLevelTestStruct) (*evmtypes.Transaction, error) diff --git a/go.mod b/go.mod index 0edb3f83d41..3cd0c8f876b 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d diff --git a/go.sum b/go.sum index 79f544f1465..29451c98e15 100644 --- a/go.sum +++ b/go.sum @@ -1217,8 +1217,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459 h1:hJhuShYv9eUQxHJQdOmyEymVmApOrICrQdOY7kKQ5Io= github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20231120164534-d4cab696c459/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15 h1:do3KwTWj7fatHOMwoRwRWefX0ShtbPzNbsOivgNxW3k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b h1:nx2AI6gbMAD/Q4ZWu1pDdudV8pmRvIvxjhAyHFfd1+4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 6b7d572ddfe..ed90bf59aa1 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b github.com/smartcontractkit/chainlink-testing-framework v1.20.0 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 24ad1c2d503..3004db1ae89 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1507,8 +1507,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15 h1:do3KwTWj7fatHOMwoRwRWefX0ShtbPzNbsOivgNxW3k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231211005859-c9933df69e15/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b h1:nx2AI6gbMAD/Q4ZWu1pDdudV8pmRvIvxjhAyHFfd1+4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From 33f697b3b0e0ab886e06b9d2852a79f0fb04c76a Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 13 Dec 2023 15:35:47 -0500 Subject: [PATCH 043/112] update go mod --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index ca6fb05f8a9..33ae9fa5ee9 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -237,7 +237,7 @@ require ( github.com/shirou/gopsutil/v3 v3.23.11 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b // indirect + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 8235dadba60..e195e12a45d 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1148,8 +1148,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b h1:nx2AI6gbMAD/Q4ZWu1pDdudV8pmRvIvxjhAyHFfd1+4= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d h1:azq9Vi7aWsq7HOUIYKFCD3Xksuz03q+UFUUkhPwYByc= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/go.mod b/go.mod index 2aff6b05d56..2d17c802bb8 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d diff --git a/go.sum b/go.sum index 7ae89f7ad58..25e18d7e987 100644 --- a/go.sum +++ b/go.sum @@ -1134,8 +1134,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b h1:nx2AI6gbMAD/Q4ZWu1pDdudV8pmRvIvxjhAyHFfd1+4= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d h1:azq9Vi7aWsq7HOUIYKFCD3Xksuz03q+UFUUkhPwYByc= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 2b20fcb24de..6a87cf45dd4 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d github.com/smartcontractkit/chainlink-testing-framework v1.22.0 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index eb309bfb264..85fde648069 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1432,8 +1432,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b h1:nx2AI6gbMAD/Q4ZWu1pDdudV8pmRvIvxjhAyHFfd1+4= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231212195016-ad1a7257076b/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d h1:azq9Vi7aWsq7HOUIYKFCD3Xksuz03q+UFUUkhPwYByc= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From 0e1eb49d763dad49beca7b15978d28e6a48b9d92 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 13 Dec 2023 10:24:06 -0500 Subject: [PATCH 044/112] Fix address type and start the chain reader --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 +- core/services/relay/evm/chain_reader_test.go | 28 +++---- core/services/relay/evm/codec.go | 13 ++- core/services/relay/evm/codec_entry.go | 4 + core/services/relay/evm/codec_entry_test.go | 16 ++++ core/services/relay/evm/codec_test.go | 12 +-- core/services/relay/evm/encoder.go | 10 +-- core/services/relay/evm/evm.go | 12 ++- .../testfiles/chain_reader_test_contract.sol | 20 ++--- .../chain_reader_test_contract_gen.abi | 2 +- .../chain_reader_test_contract_gen.bin | 2 +- .../chain_reader_test_contract_gen.go | 84 +++++++++---------- core/services/relay/evm/types/abi_types.go | 6 ++ go.mod | 2 +- go.sum | 4 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- 18 files changed, 130 insertions(+), 97 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 33ae9fa5ee9..2711148ce4b 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -240,7 +240,7 @@ require ( github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index e195e12a45d..560dd7d7245 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1154,8 +1154,8 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff67 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d h1:w4MsbOtNk6nD/mcXLstHWk9hB6g7QLtcAfhPjhwvOaQ= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d/go.mod h1:YPAfLNowdBwiKiYOwgwtbJHi8AJWbcxkbOY0ItAvkfc= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d h1:MicPzjBP6vbcSLNDoCD6Y16/l/8O+e2jlmn7t6gQbhU= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d/go.mod h1:/gErwx/BBGs7gKXy3a3mfnNtL0TrmcODzVQkUvPTXtY= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a/go.mod h1:rioELYwPY2xBtzPRN/D08Y7iTPbIQEjPknYdJK51CzQ= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 h1:1GzOKT53e8N7ZPwsyf1hSbKsynZmXmLOIL3DMvGq9sc= diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index a39cf07a8c1..689c2941e88 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -129,10 +129,10 @@ func (it *chainReaderInterfaceTester) Name() string { } func (it *chainReaderInterfaceTester) GetAccountBytes(i int) []byte { - account := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2} - account[i%32] += byte(i) - account[(i+3)%32] += byte(i + 3) - return account + account := [20]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} + account[i%20] += byte(i) + account[(i+3)%20] += byte(i + 3) + return account[:] } func (it *chainReaderInterfaceTester) GetChainReader(t *testing.T) clcommontypes.ChainReader { @@ -176,7 +176,7 @@ func (it *chainReaderInterfaceTester) TriggerEvent(t *testing.T, testStruct *Tes it.sendTxWithTestStruct(t, testStruct, (*testfiles.TestfilesTransactor).TriggerEvent) } -type testStructFn = func(*testfiles.TestfilesTransactor, *bind.TransactOpts, int32, string, uint8, [32]uint8, [32]byte, [][32]byte, *big.Int, testfiles.MidLevelTestStruct) (*evmtypes.Transaction, error) +type testStructFn = func(*testfiles.TestfilesTransactor, *bind.TransactOpts, int32, string, uint8, [32]uint8, common.Address, []common.Address, *big.Int, testfiles.MidLevelTestStruct) (*evmtypes.Transaction, error) func (it *chainReaderInterfaceTester) sendTxWithTestStruct(t *testing.T, testStruct *TestStruct, fn testStructFn) { tx, err := fn( @@ -186,7 +186,7 @@ func (it *chainReaderInterfaceTester) sendTxWithTestStruct(t *testing.T, testStr testStruct.DifferentField, uint8(testStruct.OracleID), convertOracleIDs(testStruct.OracleIDs), - [32]byte(testStruct.Account), + common.Address(testStruct.Account), convertAccounts(testStruct.Accounts), testStruct.BigField, midToInternalType(testStruct.NestedStruct), @@ -205,10 +205,10 @@ func convertOracleIDs(oracleIDs [32]commontypes.OracleID) [32]byte { return convertedIds } -func convertAccounts(accounts [][]byte) [][32]byte { - convertedAccounts := make([][32]byte, len(accounts)) +func convertAccounts(accounts [][]byte) []common.Address { + convertedAccounts := make([]common.Address, len(accounts)) for i, a := range accounts { - convertedAccounts[i] = [32]byte(a) + convertedAccounts[i] = common.Address(a) } return convertedAccounts } @@ -267,10 +267,10 @@ func (it *chainReaderInterfaceTester) incNonce() { } } -func getAccounts(first TestStruct) [][32]byte { - accountBytes := make([][32]byte, len(first.Accounts)) +func getAccounts(first TestStruct) []common.Address { + accountBytes := make([]common.Address, len(first.Accounts)) for i, account := range first.Accounts { - accountBytes[i] = [32]byte(account) + accountBytes[i] = common.Address(account) } return accountBytes } @@ -281,7 +281,7 @@ func argsFromTestStruct(ts TestStruct) []any { ts.DifferentField, uint8(ts.OracleID), getOracleIDs(ts), - [32]byte(ts.Account), + common.Address(ts.Account), getAccounts(ts), ts.BigField, midToInternalType(ts.NestedStruct), @@ -302,7 +302,7 @@ func toInternalType(testStruct TestStruct) testfiles.TestStruct { DifferentField: testStruct.DifferentField, OracleId: byte(testStruct.OracleID), OracleIds: convertOracleIDs(testStruct.OracleIDs), - Account: [32]byte(testStruct.Account), + Account: common.Address(testStruct.Account), Accounts: convertAccounts(testStruct.Accounts), BigField: testStruct.BigField, NestedStruct: midToInternalType(testStruct.NestedStruct), diff --git a/core/services/relay/evm/codec.go b/core/services/relay/evm/codec.go index 71813de865f..2c4570a53fa 100644 --- a/core/services/relay/evm/codec.go +++ b/core/services/relay/evm/codec.go @@ -7,6 +7,7 @@ import ( "reflect" "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/mitchellh/mapstructure" @@ -44,7 +45,7 @@ func NewCodec(conf types.CodecConfig) (commontypes.RemoteCodec, error) { } item := &codecEntry{Args: args, mod: mod} - if err := item.Init(); err != nil { + if err = item.Init(); err != nil { return nil, err } @@ -106,13 +107,17 @@ func sizeVerifyBigIntHook(from, to reflect.Type, data any) (any, error) { } func decodeAccountHook(from, to reflect.Type, data any) (any, error) { - b32, _ := types.GetType("bytes32") - if from.Kind() == reflect.String && to == b32.Checked { + if from.Kind() == reflect.String && to == reflect.TypeOf(common.Address{}) { decoded, err := hexutil.Decode(data.(string)) if err != nil { return nil, fmt.Errorf("%w: %w", commontypes.ErrInvalidType, err) + } else if len(decoded) != common.AddressLength { + return nil, fmt.Errorf( + "%w: wrong number size for address expected %v got %v", + commontypes.ErrWrongNumberOfElements, + common.AddressLength, len(decoded)) } - return [32]byte(decoded), nil + return common.Address(decoded), nil } return data, nil } diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go index e8a7a51165f..1ef5d4f0591 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/codec_entry.go @@ -1,6 +1,7 @@ package evm import ( + "fmt" "reflect" "strings" @@ -116,6 +117,9 @@ func getNativeAndCheckedTypes(curType *abi.Type) (reflect.Type, reflect.Type, er func createTupleType(curType *abi.Type, converter func(reflect.Type) reflect.Type) (reflect.Type, reflect.Type, error) { if len(curType.TupleElems) == 0 { + if curType.TupleType == nil { + return nil, nil, fmt.Errorf("%w: unsupported solitidy type: %v", commontypes.ErrInvalidType, curType.String()) + } return curType.TupleType, curType.TupleType, nil } diff --git a/core/services/relay/evm/codec_entry_test.go b/core/services/relay/evm/codec_entry_test.go index df843bff85f..600afcf6669 100644 --- a/core/services/relay/evm/codec_entry_test.go +++ b/core/services/relay/evm/codec_entry_test.go @@ -1,6 +1,7 @@ package evm import ( + "fmt" "math/big" "reflect" "testing" @@ -136,4 +137,19 @@ func TestCodecEntry(t *testing.T) { iNative := reflect.Indirect(native) iNative.FieldByName("Field1").Set(reflect.ValueOf([3]int16{2, 3, 30})) }) + + t.Run("Not return values makes struct{}", func(t *testing.T) { + entry := codecEntry{Args: abi.Arguments{}} + require.NoError(t, entry.Init()) + assert.Equal(t, reflect.TypeOf(struct{}{}), entry.nativeType) + assert.Equal(t, reflect.TypeOf(struct{}{}), entry.checkedType) + }) + + t.Run("Address works", func(t *testing.T) { + address, err := abi.NewType("address", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := codecEntry{Args: abi.Arguments{{Name: "foo", Type: address}}} + fmt.Printf("%+v\n", address.GetType()) + require.NoError(t, entry.Init()) + }) } diff --git a/core/services/relay/evm/codec_test.go b/core/services/relay/evm/codec_test.go index dd1977eb39c..bc02c9957d9 100644 --- a/core/services/relay/evm/codec_test.go +++ b/core/services/relay/evm/codec_test.go @@ -52,10 +52,10 @@ type codecInterfaceTester struct{} func (it *codecInterfaceTester) Setup(_ *testing.T) {} func (it *codecInterfaceTester) GetAccountBytes(i int) []byte { - account := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2} - account[i%32] += byte(i) - account[(i+3)%32] += byte(i + 3) - return account + account := [20]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} + account[i%20] += byte(i) + account[(i+3)%20] += byte(i + 3) + return account[:] } func (it *codecInterfaceTester) EncodeFields(t *testing.T, request *EncodeRequest) []byte { @@ -160,8 +160,8 @@ var ts = []abi.ArgumentMarshaling{ {Name: "DifferentField", Type: "string"}, {Name: "OracleId", Type: "uint8"}, {Name: "OracleIds", Type: "uint8[32]"}, - {Name: "Account", Type: "bytes32"}, - {Name: "Accounts", Type: "bytes32[]"}, + {Name: "Account", Type: "address"}, + {Name: "Accounts", Type: "address[]"}, {Name: "BigField", Type: "int192"}, {Name: "NestedStruct", Type: "tuple", Components: nested}, } diff --git a/core/services/relay/evm/encoder.go b/core/services/relay/evm/encoder.go index 09f1b40184b..b3ad6d70fe6 100644 --- a/core/services/relay/evm/encoder.go +++ b/core/services/relay/evm/encoder.go @@ -4,8 +4,6 @@ import ( "context" "reflect" - ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" ) @@ -34,7 +32,7 @@ func (e *encoder) GetMaxEncodingSize(ctx context.Context, n int, itemType string return e.Definitions[itemType].GetMaxSize(n) } -func encode(item reflect.Value, info *codecEntry) (ocrtypes.Report, error) { +func encode(item reflect.Value, info *codecEntry) ([]byte, error) { for item.Kind() == reflect.Pointer { item = reflect.Indirect(item) } @@ -48,7 +46,7 @@ func encode(item reflect.Value, info *codecEntry) (ocrtypes.Report, error) { } } -func encodeArray(item reflect.Value, info *codecEntry) (ocrtypes.Report, error) { +func encodeArray(item reflect.Value, info *codecEntry) ([]byte, error) { length := item.Len() var native reflect.Value switch info.checkedType.Kind() { @@ -76,7 +74,7 @@ func encodeArray(item reflect.Value, info *codecEntry) (ocrtypes.Report, error) return pack(info, native.Interface()) } -func encodeItem(item reflect.Value, info *codecEntry) (ocrtypes.Report, error) { +func encodeItem(item reflect.Value, info *codecEntry) ([]byte, error) { if item.Type() == reflect.PointerTo(info.checkedType) { item = reflect.NewAt(info.nativeType, item.UnsafePointer()) } else if item.Type() != reflect.PointerTo(info.nativeType) { @@ -100,7 +98,7 @@ func encodeItem(item reflect.Value, info *codecEntry) (ocrtypes.Report, error) { return pack(info, values...) } -func pack(info *codecEntry, values ...any) (ocrtypes.Report, error) { +func pack(info *codecEntry, values ...any) ([]byte, error) { if bytes, err := info.Args.Pack(values...); err == nil { withPrefix := make([]byte, 0, len(info.encodingPrefix)+len(bytes)) withPrefix = append(withPrefix, info.encodingPrefix...) diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index e0934c66b4c..71845512767 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -491,13 +491,13 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp } // allow fallback until chain reader is default and median contract is removed, but still log just in case - var chainReaderService commontypes.ChainReader + var chainReaderService ChainReaderService if relayConfig.ChainReader != nil { b := Bindings{ // TODO BCF-2837: clean up the hard-coded values. "median": { "LatestTransmissionDetails": &addrEvtBinding{addr: contractID}, - "LatestRoundReported": &addrEvtBinding{addr: contractID}, + "LatestRoundRequested": &addrEvtBinding{addr: contractID}, }, } @@ -528,7 +528,7 @@ type medianProvider struct { contractTransmitter ContractTransmitter reportCodec median.ReportCodec medianContract *medianContract - chainReader commontypes.ChainReader + chainReader ChainReaderService codec commontypes.Codec ms services.MultiStart } @@ -538,7 +538,11 @@ func (p *medianProvider) Name() string { } func (p *medianProvider) Start(ctx context.Context) error { - return p.ms.Start(ctx, p.configWatcher, p.contractTransmitter) + if p.chainReader == nil { + return p.ms.Start(ctx, p.configWatcher, p.contractTransmitter) + } + + return p.ms.Start(ctx, p.configWatcher, p.contractTransmitter, p.chainReader) } func (p *medianProvider) Close() error { diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract.sol b/core/services/relay/evm/testfiles/chain_reader_test_contract.sol index feeecda1c25..169b980a327 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract.sol +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract.sol @@ -6,8 +6,8 @@ struct TestStruct { string DifferentField; uint8 OracleId; uint8[32] OracleIds; - bytes32 Account; - bytes32[] Accounts; + address Account; + address[] Accounts; int192 BigField; MidLevelTestStruct NestedStruct; } @@ -28,8 +28,8 @@ contract LatestValueHolder { string differentField, uint8 oracleId, uint8[32] oracleIds, - bytes32 account, - bytes32[] accounts, + address Account, + address[] Accounts, int192 bigField, MidLevelTestStruct nestedStruct); @@ -47,8 +47,8 @@ contract LatestValueHolder { string calldata differentField, uint8 oracleId, uint8[32] calldata oracleIds, - bytes32 account, - bytes32[] calldata accounts, + address account, + address[] calldata accounts, int192 bigField, MidLevelTestStruct calldata nestedStruct) public { seen.push(TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct)); @@ -59,8 +59,8 @@ contract LatestValueHolder { string calldata differentField, uint8 oracleId, uint8[32] calldata oracleIds, - bytes32 account, - bytes32[] calldata accounts, + address account, + address[] calldata accounts, int192 bigField, MidLevelTestStruct calldata nestedStruct) pure public returns (TestStruct memory) { return TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); @@ -89,8 +89,8 @@ contract LatestValueHolder { string calldata differentField, uint8 oracleId, uint8[32] calldata oracleIds, - bytes32 account, - bytes32[] calldata accounts, + address account, + address[] calldata accounts, int192 bigField, MidLevelTestStruct calldata nestedStruct) public { emit Triggered(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi index cdefbb905ba..603c33acdcd 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi @@ -1 +1 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"int32","name":"field","type":"int32"},{"indexed":false,"internalType":"string","name":"differentField","type":"string"},{"indexed":false,"internalType":"uint8","name":"oracleId","type":"uint8"},{"indexed":false,"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"indexed":false,"internalType":"bytes32","name":"account","type":"bytes32"},{"indexed":false,"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"indexed":false,"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"indexed":false,"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"Triggered","type":"event"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"AddTestStruct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"GetDifferentPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"GetElementAtIndex","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GetPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"GetSliceValue","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"ReturnSeen","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"Account","type":"bytes32"},{"internalType":"bytes32[]","name":"Accounts","type":"bytes32[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"bytes32","name":"account","type":"bytes32"},{"internalType":"bytes32[]","name":"accounts","type":"bytes32[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"TriggerEvent","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"int32","name":"field","type":"int32"},{"indexed":false,"internalType":"string","name":"differentField","type":"string"},{"indexed":false,"internalType":"uint8","name":"oracleId","type":"uint8"},{"indexed":false,"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"indexed":false,"internalType":"address","name":"Account","type":"address"},{"indexed":false,"internalType":"address[]","name":"Accounts","type":"address[]"},{"indexed":false,"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"indexed":false,"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"Triggered","type":"event"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"address","name":"account","type":"address"},{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"AddTestStruct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"GetDifferentPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"GetElementAtIndex","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"address","name":"Account","type":"address"},{"internalType":"address[]","name":"Accounts","type":"address[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GetPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"GetSliceValue","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"address","name":"account","type":"address"},{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"ReturnSeen","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"address","name":"Account","type":"address"},{"internalType":"address[]","name":"Accounts","type":"address[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"address","name":"account","type":"address"},{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"TriggerEvent","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin index 57aef1bf047..5617cf53e25 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a9182029102199092169190911790556111ba806100a96000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063b95ad4111161005b578063b95ad411146100d9578063bdb37c90146100ec578063da8e7a8214610101578063e669831d1461010857600080fd5b8063030d3ca2146100825780637dd6af5b146100a45780639ca04f67146100b9575b600080fd5b6107c65b60405167ffffffffffffffff90911681526020015b60405180910390f35b6100b76100b2366004610af9565b61011b565b005b6100cc6100c7366004610be4565b61034a565b60405161009b9190610eff565b6100cc6100e7366004610af9565b6105fa565b6100f46106eb565b60405161009b9190610e03565b6003610086565b6100b7610116366004610af9565b610777565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016101f584611036565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff199093169290921782558383015180519394929361024c939285019291909101906107cc565b50604082015160028201805460ff191660ff909216919091179055606082015161027c9060038301906020610850565b506080820151600482015560a082015180516102a29160058401916020909101906108de565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff19909116178355808201518051919392610337926009890192909101906107cc565b5050505050505050505050505050505050565b610352610918565b600061035f600184611011565b8154811061036f5761036f611158565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b81526020016001820180546103b690611123565b80601f01602080910402602001604051908101604052809291908181526020018280546103e290611123565b801561042f5780601f106104045761010080835404028352916020019161042f565b820191906000526020600020905b81548152906001019060200180831161041257829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116104645790505050505050815260200160048201548152602001600582018054806020026020016040519081016040528092919081815260200182805480156104f457602002820191906000526020600020905b8154815260200190600101908083116104e0575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061056b90611123565b80601f016020809104026020016040519081016040528092919081815260200182805461059790611123565b80156105e45780601f106105b9576101008083540402835291602001916105e4565b820191906000526020600020905b8154815290600101906020018083116105c757829003601f168201915b5050509190925250505090525090525092915050565b610602610918565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016106da84611036565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561076d57602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116107285790505b5050505050905090565b7f7d2abe6109e46b893ac1835c9287d6ad5c5ccf3d0254d2ca72225873795e0f538a8a8a8a8a8a8a8a8a8a6040516107b89a99989796959493929190610e51565b60405180910390a150505050505050505050565b8280546107d890611123565b90600052602060002090601f0160209004810192826107fa5760008555610840565b82601f1061081357805160ff1916838001178555610840565b82800160010185558215610840579182015b82811115610840578251825591602001919060010190610825565b5061084c929150610967565b5090565b6001830191839082156108405791602002820160005b838211156108a457835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302610866565b80156108d15782816101000a81549060ff02191690556001016020816000010492830192600103026108a4565b505061084c929150610967565b8280548282559060005260206000209081019282156108405791602002820182811115610840578251825591602001919060010190610825565b604080516101008101825260008082526060602083018190529282015290810161094061097c565b815260006020820181905260606040830181905282015260800161096261099b565b905290565b5b8082111561084c5760008155600101610968565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016109626040518060400160405280600060070b8152602001606081525090565b60008083601f8401126109e957600080fd5b50813567ffffffffffffffff811115610a0157600080fd5b6020830191508360208260051b8501011115610a1c57600080fd5b9250929050565b806104008101831015610a3557600080fd5b92915050565b80356001600160f01b031981168114610a5357600080fd5b919050565b8035601781900b8114610a5357600080fd5b8035600381900b8114610a5357600080fd5b8035600781900b8114610a5357600080fd5b60008083601f840112610aa057600080fd5b50813567ffffffffffffffff811115610ab857600080fd5b602083019150836020828501011115610a1c57600080fd5b600060408284031215610ae257600080fd5b50919050565b803560ff81168114610a5357600080fd5b6000806000806000806000806000806104e08b8d031215610b1957600080fd5b610b228b610a6a565b995060208b013567ffffffffffffffff80821115610b3f57600080fd5b610b4b8e838f01610a8e565b909b509950899150610b5f60408e01610ae8565b9850610b6e8e60608f01610a23565b97506104608d013596506104808d0135915080821115610b8d57600080fd5b610b998e838f016109d7565b9096509450849150610bae6104a08e01610a58565b93506104c08d0135915080821115610bc557600080fd5b50610bd28d828e01610ad0565b9150509295989b9194979a5092959850565b600060208284031215610bf657600080fd5b5035919050565b81835260006001600160fb1b03831115610c1657600080fd5b8260051b8083602087013760009401602001938452509192915050565b600081518084526020808501945080840160005b83811015610c6357815187529582019590820190600101610c47565b509495945050505050565b8060005b6020808210610c815750610c98565b825160ff1685529384019390910190600101610c72565b50505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815180845260005b81811015610ced57602081850181015186830182015201610cd1565b81811115610cff576000602083870101525b50601f01601f19169290920160200192915050565b6001600160f01b0319610d2682610a3b565b16825260006020820135603e19833603018112610d4257600080fd5b604060208501528201610d5481610a7c565b60070b60408501526020810135601e19823603018112610d7357600080fd5b8101803567ffffffffffffffff811115610d8c57600080fd5b803603831315610d9b57600080fd5b60406060870152610db3608087018260208501610c9e565b9695505050505050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610dfb6080850182610cc7565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610e4557835167ffffffffffffffff1683529284019291840191600101610e1f565b50909695505050505050565b60006104e08c60030b835260208181850152610e708285018d8f610c9e565b915060ff808c166040860152606085018b60005b84811015610ea95783610e9683610ae8565b1683529184019190840190600101610e84565b505050505087610460840152828103610480840152610ec9818789610bfd565b9050610edb6104a084018660170b9052565b8281036104c0840152610eee8185610d14565b9d9c50505050505050505050505050565b60208152610f1360208201835160030b9052565b600060208301516104e0806040850152610f31610500850183610cc7565b91506040850151610f47606086018260ff169052565b506060850151610f5a6080860182610c6e565b50608085015161048085015260a0850151601f1980868503016104a0870152610f838483610c33565b935060c08701519150610f9c6104c087018360170b9052565b60e0870151915080868503018387015250610db38382610dbd565b6040805190810167ffffffffffffffff81118282101715610fda57610fda61116e565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156110095761100961116e565b604052919050565b60008282101561103157634e487b7160e01b600052601160045260246000fd5b500390565b60006040823603121561104857600080fd5b611050610fb7565b61105983610a3b565b815260208084013567ffffffffffffffff8082111561107757600080fd5b81860191506040823603121561108c57600080fd5b611094610fb7565b61109d83610a7c565b815283830135828111156110b057600080fd5b929092019136601f8401126110c457600080fd5b8235828111156110d6576110d661116e565b6110e8601f8201601f19168601610fe0565b925080835236858286010111156110fe57600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c9082168061113757607f821691505b60208210811415610ae257634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212207f1ef47c84498df82a83ce9c4eed62d431c29fbd05ad8899d4ef1dfcb22f147e64736f6c63430008060033 \ No newline at end of file +608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a91820291021990921691909117905561125b806100a96000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80639ca04f671161005b5780639ca04f67146100cc578063b9dad6b0146100ec578063bdb37c90146100ff578063da8e7a821461011457600080fd5b8063030d3ca2146100825780636c7cf955146100a45780638b659d6e146100b9575b600080fd5b6107c65b60405167ffffffffffffffff90911681526020015b60405180910390f35b6100b76100b2366004610b6c565b61011b565b005b6100b76100c7366004610b6c565b610371565b6100df6100da366004610c5e565b6103c6565b60405161009b9190610f97565b6100df6100fa366004610b6c565b610685565b610107610781565b60405161009b9190610e8c565b6003610086565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526001600160a01b038816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b6020820152604001610200846110d7565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936102579392850192919091019061080d565b50604082015160028201805460ff191660ff90921691909117905560608201516102879060038301906020610891565b5060808201516004820180546001600160a01b0319166001600160a01b0390921691909117905560a082015180516102c991600584019160209091019061091f565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff1990911617835580820151805191939261035e9260098901929091019061080d565b5050505050505050505050505050505050565b7f7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d8a8a8a8a8a8a8a8a8a8a6040516103b29a99989796959493929190610eda565b60405180910390a150505050505050505050565b6103ce610974565b60006103db6001846110b2565b815481106103eb576103eb6111f9565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b8152602001600182018054610432906111c4565b80601f016020809104026020016040519081016040528092919081815260200182805461045e906111c4565b80156104ab5780601f10610480576101008083540402835291602001916104ab565b820191906000526020600020905b81548152906001019060200180831161048e57829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116104e05750505092845250505060048201546001600160a01b0316602080830191909152600583018054604080518285028101850182528281529401939283018282801561057f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610561575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b815260098801805495909701969395919486830194919392840191906105f6906111c4565b80601f0160208091040260200160405190810160405280929190818152602001828054610622906111c4565b801561066f5780601f106106445761010080835404028352916020019161066f565b820191906000526020600020905b81548152906001019060200180831161065257829003601f168201915b5050509190925250505090525090525092915050565b61068d610974565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526001600160a01b038816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b6020820152604001610770846110d7565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561080357602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116107be5790505b5050505050905090565b828054610819906111c4565b90600052602060002090601f01602090048101928261083b5760008555610881565b82601f1061085457805160ff1916838001178555610881565b82800160010185558215610881579182015b82811115610881578251825591602001919060010190610866565b5061088d9291506109c3565b5090565b6001830191839082156108815791602002820160005b838211156108e557835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026108a7565b80156109125782816101000a81549060ff02191690556001016020816000010492830192600103026108e5565b505061088d9291506109c3565b828054828255906000526020600020908101928215610881579160200282015b8281111561088157825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061093f565b604080516101008101825260008082526060602083018190529282015290810161099c6109d8565b81526000602082018190526060604083018190528201526080016109be6109f7565b905290565b5b8082111561088d57600081556001016109c4565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016109be6040518060400160405280600060070b8152602001606081525090565b80356001600160a01b0381168114610a4a57600080fd5b919050565b60008083601f840112610a6157600080fd5b50813567ffffffffffffffff811115610a7957600080fd5b6020830191508360208260051b8501011115610a9457600080fd5b9250929050565b806104008101831015610aad57600080fd5b92915050565b80356001600160f01b031981168114610a4a57600080fd5b8035601781900b8114610a4a57600080fd5b8035600381900b8114610a4a57600080fd5b8035600781900b8114610a4a57600080fd5b60008083601f840112610b1357600080fd5b50813567ffffffffffffffff811115610b2b57600080fd5b602083019150836020828501011115610a9457600080fd5b600060408284031215610b5557600080fd5b50919050565b803560ff81168114610a4a57600080fd5b6000806000806000806000806000806104e08b8d031215610b8c57600080fd5b610b958b610add565b995060208b013567ffffffffffffffff80821115610bb257600080fd5b610bbe8e838f01610b01565b909b509950899150610bd260408e01610b5b565b9850610be18e60608f01610a9b565b9750610bf06104608e01610a33565b96506104808d0135915080821115610c0757600080fd5b610c138e838f01610a4f565b9096509450849150610c286104a08e01610acb565b93506104c08d0135915080821115610c3f57600080fd5b50610c4c8d828e01610b43565b9150509295989b9194979a5092959850565b600060208284031215610c7057600080fd5b5035919050565b8183526000602080850194508260005b85811015610cb3576001600160a01b03610ca083610a33565b1687529582019590820190600101610c87565b509495945050505050565b600081518084526020808501945080840160005b83811015610cb35781516001600160a01b031687529582019590820190600101610cd2565b8060005b6020808210610d0a5750610d21565b825160ff1685529384019390910190600101610cfb565b50505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815180845260005b81811015610d7657602081850181015186830182015201610d5a565b81811115610d88576000602083870101525b50601f01601f19169290920160200192915050565b6001600160f01b0319610daf82610ab3565b16825260006020820135603e19833603018112610dcb57600080fd5b604060208501528201610ddd81610aef565b60070b60408501526020810135601e19823603018112610dfc57600080fd5b8101803567ffffffffffffffff811115610e1557600080fd5b803603831315610e2457600080fd5b60406060870152610e3c608087018260208501610d27565b9695505050505050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610e846080850182610d50565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610ece57835167ffffffffffffffff1683529284019291840191600101610ea8565b50909695505050505050565b60006104e08c60030b835260208181850152610ef98285018d8f610d27565b915060ff808c166040860152606085018b60005b84811015610f325783610f1f83610b5b565b1683529184019190840190600101610f0d565b5050505050610f4d6104608401896001600160a01b03169052565b828103610480840152610f61818789610c77565b9050610f736104a084018660170b9052565b8281036104c0840152610f868185610d9d565b9d9c50505050505050505050505050565b60208152610fab60208201835160030b9052565b600060208301516104e0806040850152610fc9610500850183610d50565b91506040850151610fdf606086018260ff169052565b506060850151610ff26080860182610cf7565b5060808501516001600160a01b031661048085015260a0850151601f1985840381016104a08701526110248483610cbe565b935060c0870151915061103d6104c087018360170b9052565b60e0870151915080868503018387015250610e3c8382610e46565b6040805190810167ffffffffffffffff8111828210171561107b5761107b61120f565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156110aa576110aa61120f565b604052919050565b6000828210156110d257634e487b7160e01b600052601160045260246000fd5b500390565b6000604082360312156110e957600080fd5b6110f1611058565b6110fa83610ab3565b815260208084013567ffffffffffffffff8082111561111857600080fd5b81860191506040823603121561112d57600080fd5b611135611058565b61113e83610aef565b8152838301358281111561115157600080fd5b929092019136601f84011261116557600080fd5b8235828111156111775761117761120f565b611189601f8201601f19168601611081565b9250808352368582860101111561119f57600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c908216806111d857607f821691505b60208210811415610b5557634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220dce1950ddad4c207dfaef7c48111c80f3a73cf85e5711bf7a3afe15473519a1664736f6c63430008060033 \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go index e4475c9b650..f6d0d120742 100644 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go +++ b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go @@ -47,16 +47,16 @@ type TestStruct struct { DifferentField string OracleId uint8 OracleIds [32]uint8 - Account [32]byte - Accounts [][32]byte + Account common.Address + Accounts []common.Address BigField *big.Int NestedStruct MidLevelTestStruct } // TestfilesMetaData contains all meta data concerning the Testfiles contract. var TestfilesMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"Triggered\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetDifferentPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"ReturnSeen\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"Account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"Accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"bytes32\",\"name\":\"account\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"accounts\",\"type\":\"bytes32[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"TriggerEvent\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a9182029102199092169190911790556111ba806100a96000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063b95ad4111161005b578063b95ad411146100d9578063bdb37c90146100ec578063da8e7a8214610101578063e669831d1461010857600080fd5b8063030d3ca2146100825780637dd6af5b146100a45780639ca04f67146100b9575b600080fd5b6107c65b60405167ffffffffffffffff90911681526020015b60405180910390f35b6100b76100b2366004610af9565b61011b565b005b6100cc6100c7366004610be4565b61034a565b60405161009b9190610eff565b6100cc6100e7366004610af9565b6105fa565b6100f46106eb565b60405161009b9190610e03565b6003610086565b6100b7610116366004610af9565b610777565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016101f584611036565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff199093169290921782558383015180519394929361024c939285019291909101906107cc565b50604082015160028201805460ff191660ff909216919091179055606082015161027c9060038301906020610850565b506080820151600482015560a082015180516102a29160058401916020909101906108de565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff19909116178355808201518051919392610337926009890192909101906107cc565b5050505050505050505050505050505050565b610352610918565b600061035f600184611011565b8154811061036f5761036f611158565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b81526020016001820180546103b690611123565b80601f01602080910402602001604051908101604052809291908181526020018280546103e290611123565b801561042f5780601f106104045761010080835404028352916020019161042f565b820191906000526020600020905b81548152906001019060200180831161041257829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116104645790505050505050815260200160048201548152602001600582018054806020026020016040519081016040528092919081815260200182805480156104f457602002820191906000526020600020905b8154815260200190600101908083116104e0575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b8152600988018054959097019693959194868301949193928401919061056b90611123565b80601f016020809104026020016040519081016040528092919081815260200182805461059790611123565b80156105e45780601f106105b9576101008083540402835291602001916105e4565b820191906000526020600020905b8154815290600101906020018083116105c757829003601f168201915b5050509190925250505090525090525092915050565b610602610918565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526020808201899052604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016106da84611036565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561076d57602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116107285790505b5050505050905090565b7f7d2abe6109e46b893ac1835c9287d6ad5c5ccf3d0254d2ca72225873795e0f538a8a8a8a8a8a8a8a8a8a6040516107b89a99989796959493929190610e51565b60405180910390a150505050505050505050565b8280546107d890611123565b90600052602060002090601f0160209004810192826107fa5760008555610840565b82601f1061081357805160ff1916838001178555610840565b82800160010185558215610840579182015b82811115610840578251825591602001919060010190610825565b5061084c929150610967565b5090565b6001830191839082156108405791602002820160005b838211156108a457835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302610866565b80156108d15782816101000a81549060ff02191690556001016020816000010492830192600103026108a4565b505061084c929150610967565b8280548282559060005260206000209081019282156108405791602002820182811115610840578251825591602001919060010190610825565b604080516101008101825260008082526060602083018190529282015290810161094061097c565b815260006020820181905260606040830181905282015260800161096261099b565b905290565b5b8082111561084c5760008155600101610968565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016109626040518060400160405280600060070b8152602001606081525090565b60008083601f8401126109e957600080fd5b50813567ffffffffffffffff811115610a0157600080fd5b6020830191508360208260051b8501011115610a1c57600080fd5b9250929050565b806104008101831015610a3557600080fd5b92915050565b80356001600160f01b031981168114610a5357600080fd5b919050565b8035601781900b8114610a5357600080fd5b8035600381900b8114610a5357600080fd5b8035600781900b8114610a5357600080fd5b60008083601f840112610aa057600080fd5b50813567ffffffffffffffff811115610ab857600080fd5b602083019150836020828501011115610a1c57600080fd5b600060408284031215610ae257600080fd5b50919050565b803560ff81168114610a5357600080fd5b6000806000806000806000806000806104e08b8d031215610b1957600080fd5b610b228b610a6a565b995060208b013567ffffffffffffffff80821115610b3f57600080fd5b610b4b8e838f01610a8e565b909b509950899150610b5f60408e01610ae8565b9850610b6e8e60608f01610a23565b97506104608d013596506104808d0135915080821115610b8d57600080fd5b610b998e838f016109d7565b9096509450849150610bae6104a08e01610a58565b93506104c08d0135915080821115610bc557600080fd5b50610bd28d828e01610ad0565b9150509295989b9194979a5092959850565b600060208284031215610bf657600080fd5b5035919050565b81835260006001600160fb1b03831115610c1657600080fd5b8260051b8083602087013760009401602001938452509192915050565b600081518084526020808501945080840160005b83811015610c6357815187529582019590820190600101610c47565b509495945050505050565b8060005b6020808210610c815750610c98565b825160ff1685529384019390910190600101610c72565b50505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815180845260005b81811015610ced57602081850181015186830182015201610cd1565b81811115610cff576000602083870101525b50601f01601f19169290920160200192915050565b6001600160f01b0319610d2682610a3b565b16825260006020820135603e19833603018112610d4257600080fd5b604060208501528201610d5481610a7c565b60070b60408501526020810135601e19823603018112610d7357600080fd5b8101803567ffffffffffffffff811115610d8c57600080fd5b803603831315610d9b57600080fd5b60406060870152610db3608087018260208501610c9e565b9695505050505050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610dfb6080850182610cc7565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610e4557835167ffffffffffffffff1683529284019291840191600101610e1f565b50909695505050505050565b60006104e08c60030b835260208181850152610e708285018d8f610c9e565b915060ff808c166040860152606085018b60005b84811015610ea95783610e9683610ae8565b1683529184019190840190600101610e84565b505050505087610460840152828103610480840152610ec9818789610bfd565b9050610edb6104a084018660170b9052565b8281036104c0840152610eee8185610d14565b9d9c50505050505050505050505050565b60208152610f1360208201835160030b9052565b600060208301516104e0806040850152610f31610500850183610cc7565b91506040850151610f47606086018260ff169052565b506060850151610f5a6080860182610c6e565b50608085015161048085015260a0850151601f1980868503016104a0870152610f838483610c33565b935060c08701519150610f9c6104c087018360170b9052565b60e0870151915080868503018387015250610db38382610dbd565b6040805190810167ffffffffffffffff81118282101715610fda57610fda61116e565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156110095761100961116e565b604052919050565b60008282101561103157634e487b7160e01b600052601160045260246000fd5b500390565b60006040823603121561104857600080fd5b611050610fb7565b61105983610a3b565b815260208084013567ffffffffffffffff8082111561107757600080fd5b81860191506040823603121561108c57600080fd5b611094610fb7565b61109d83610a7c565b815283830135828111156110b057600080fd5b929092019136601f8401126110c457600080fd5b8235828111156110d6576110d661116e565b6110e8601f8201601f19168601610fe0565b925080835236858286010111156110fe57600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c9082168061113757607f821691505b60208210811415610ae257634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212207f1ef47c84498df82a83ce9c4eed62d431c29fbd05ad8899d4ef1dfcb22f147e64736f6c63430008060033", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"Triggered\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetDifferentPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"ReturnSeen\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"TriggerEvent\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a91820291021990921691909117905561125b806100a96000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80639ca04f671161005b5780639ca04f67146100cc578063b9dad6b0146100ec578063bdb37c90146100ff578063da8e7a821461011457600080fd5b8063030d3ca2146100825780636c7cf955146100a45780638b659d6e146100b9575b600080fd5b6107c65b60405167ffffffffffffffff90911681526020015b60405180910390f35b6100b76100b2366004610b6c565b61011b565b005b6100b76100c7366004610b6c565b610371565b6100df6100da366004610c5e565b6103c6565b60405161009b9190610f97565b6100df6100fa366004610b6c565b610685565b610107610781565b60405161009b9190610e8c565b6003610086565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526001600160a01b038816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b6020820152604001610200846110d7565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936102579392850192919091019061080d565b50604082015160028201805460ff191660ff90921691909117905560608201516102879060038301906020610891565b5060808201516004820180546001600160a01b0319166001600160a01b0390921691909117905560a082015180516102c991600584019160209091019061091f565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff1990911617835580820151805191939261035e9260098901929091019061080d565b5050505050505050505050505050505050565b7f7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d8a8a8a8a8a8a8a8a8a8a6040516103b29a99989796959493929190610eda565b60405180910390a150505050505050505050565b6103ce610974565b60006103db6001846110b2565b815481106103eb576103eb6111f9565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b8152602001600182018054610432906111c4565b80601f016020809104026020016040519081016040528092919081815260200182805461045e906111c4565b80156104ab5780601f10610480576101008083540402835291602001916104ab565b820191906000526020600020905b81548152906001019060200180831161048e57829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116104e05750505092845250505060048201546001600160a01b0316602080830191909152600583018054604080518285028101850182528281529401939283018282801561057f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610561575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b815260098801805495909701969395919486830194919392840191906105f6906111c4565b80601f0160208091040260200160405190810160405280929190818152602001828054610622906111c4565b801561066f5780601f106106445761010080835404028352916020019161066f565b820191906000526020600020905b81548152906001019060200180831161065257829003601f168201915b5050509190925250505090525090525092915050565b61068d610974565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526001600160a01b038816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b6020820152604001610770846110d7565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561080357602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116107be5790505b5050505050905090565b828054610819906111c4565b90600052602060002090601f01602090048101928261083b5760008555610881565b82601f1061085457805160ff1916838001178555610881565b82800160010185558215610881579182015b82811115610881578251825591602001919060010190610866565b5061088d9291506109c3565b5090565b6001830191839082156108815791602002820160005b838211156108e557835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026108a7565b80156109125782816101000a81549060ff02191690556001016020816000010492830192600103026108e5565b505061088d9291506109c3565b828054828255906000526020600020908101928215610881579160200282015b8281111561088157825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061093f565b604080516101008101825260008082526060602083018190529282015290810161099c6109d8565b81526000602082018190526060604083018190528201526080016109be6109f7565b905290565b5b8082111561088d57600081556001016109c4565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016109be6040518060400160405280600060070b8152602001606081525090565b80356001600160a01b0381168114610a4a57600080fd5b919050565b60008083601f840112610a6157600080fd5b50813567ffffffffffffffff811115610a7957600080fd5b6020830191508360208260051b8501011115610a9457600080fd5b9250929050565b806104008101831015610aad57600080fd5b92915050565b80356001600160f01b031981168114610a4a57600080fd5b8035601781900b8114610a4a57600080fd5b8035600381900b8114610a4a57600080fd5b8035600781900b8114610a4a57600080fd5b60008083601f840112610b1357600080fd5b50813567ffffffffffffffff811115610b2b57600080fd5b602083019150836020828501011115610a9457600080fd5b600060408284031215610b5557600080fd5b50919050565b803560ff81168114610a4a57600080fd5b6000806000806000806000806000806104e08b8d031215610b8c57600080fd5b610b958b610add565b995060208b013567ffffffffffffffff80821115610bb257600080fd5b610bbe8e838f01610b01565b909b509950899150610bd260408e01610b5b565b9850610be18e60608f01610a9b565b9750610bf06104608e01610a33565b96506104808d0135915080821115610c0757600080fd5b610c138e838f01610a4f565b9096509450849150610c286104a08e01610acb565b93506104c08d0135915080821115610c3f57600080fd5b50610c4c8d828e01610b43565b9150509295989b9194979a5092959850565b600060208284031215610c7057600080fd5b5035919050565b8183526000602080850194508260005b85811015610cb3576001600160a01b03610ca083610a33565b1687529582019590820190600101610c87565b509495945050505050565b600081518084526020808501945080840160005b83811015610cb35781516001600160a01b031687529582019590820190600101610cd2565b8060005b6020808210610d0a5750610d21565b825160ff1685529384019390910190600101610cfb565b50505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815180845260005b81811015610d7657602081850181015186830182015201610d5a565b81811115610d88576000602083870101525b50601f01601f19169290920160200192915050565b6001600160f01b0319610daf82610ab3565b16825260006020820135603e19833603018112610dcb57600080fd5b604060208501528201610ddd81610aef565b60070b60408501526020810135601e19823603018112610dfc57600080fd5b8101803567ffffffffffffffff811115610e1557600080fd5b803603831315610e2457600080fd5b60406060870152610e3c608087018260208501610d27565b9695505050505050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610e846080850182610d50565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610ece57835167ffffffffffffffff1683529284019291840191600101610ea8565b50909695505050505050565b60006104e08c60030b835260208181850152610ef98285018d8f610d27565b915060ff808c166040860152606085018b60005b84811015610f325783610f1f83610b5b565b1683529184019190840190600101610f0d565b5050505050610f4d6104608401896001600160a01b03169052565b828103610480840152610f61818789610c77565b9050610f736104a084018660170b9052565b8281036104c0840152610f868185610d9d565b9d9c50505050505050505050505050565b60208152610fab60208201835160030b9052565b600060208301516104e0806040850152610fc9610500850183610d50565b91506040850151610fdf606086018260ff169052565b506060850151610ff26080860182610cf7565b5060808501516001600160a01b031661048085015260a0850151601f1985840381016104a08701526110248483610cbe565b935060c0870151915061103d6104c087018360170b9052565b60e0870151915080868503018387015250610e3c8382610e46565b6040805190810167ffffffffffffffff8111828210171561107b5761107b61120f565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156110aa576110aa61120f565b604052919050565b6000828210156110d257634e487b7160e01b600052601160045260246000fd5b500390565b6000604082360312156110e957600080fd5b6110f1611058565b6110fa83610ab3565b815260208084013567ffffffffffffffff8082111561111857600080fd5b81860191506040823603121561112d57600080fd5b611135611058565b61113e83610aef565b8152838301358281111561115157600080fd5b929092019136601f84011261116557600080fd5b8235828111156111775761117761120f565b611189601f8201601f19168601611081565b9250808352368582860101111561119f57600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c908216806111d857607f821691505b60208210811415610b5557634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220dce1950ddad4c207dfaef7c48111c80f3a73cf85e5711bf7a3afe15473519a1664736f6c63430008060033", } // TestfilesABI is the input ABI used to generate the binding from. @@ -259,7 +259,7 @@ func (_Testfiles *TestfilesCallerSession) GetDifferentPrimitiveValue() (uint64, // GetElementAtIndex is a free data retrieval call binding the contract method 0x9ca04f67. // -// Solidity: function GetElementAtIndex(uint256 i) view returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) +// Solidity: function GetElementAtIndex(uint256 i) view returns((int32,string,uint8,uint8[32],address,address[],int192,(bytes2,(int64,string)))) func (_Testfiles *TestfilesCaller) GetElementAtIndex(opts *bind.CallOpts, i *big.Int) (TestStruct, error) { var out []interface{} err := _Testfiles.contract.Call(opts, &out, "GetElementAtIndex", i) @@ -276,14 +276,14 @@ func (_Testfiles *TestfilesCaller) GetElementAtIndex(opts *bind.CallOpts, i *big // GetElementAtIndex is a free data retrieval call binding the contract method 0x9ca04f67. // -// Solidity: function GetElementAtIndex(uint256 i) view returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) +// Solidity: function GetElementAtIndex(uint256 i) view returns((int32,string,uint8,uint8[32],address,address[],int192,(bytes2,(int64,string)))) func (_Testfiles *TestfilesSession) GetElementAtIndex(i *big.Int) (TestStruct, error) { return _Testfiles.Contract.GetElementAtIndex(&_Testfiles.CallOpts, i) } // GetElementAtIndex is a free data retrieval call binding the contract method 0x9ca04f67. // -// Solidity: function GetElementAtIndex(uint256 i) view returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) +// Solidity: function GetElementAtIndex(uint256 i) view returns((int32,string,uint8,uint8[32],address,address[],int192,(bytes2,(int64,string)))) func (_Testfiles *TestfilesCallerSession) GetElementAtIndex(i *big.Int) (TestStruct, error) { return _Testfiles.Contract.GetElementAtIndex(&_Testfiles.CallOpts, i) } @@ -350,10 +350,10 @@ func (_Testfiles *TestfilesCallerSession) GetSliceValue() ([]uint64, error) { return _Testfiles.Contract.GetSliceValue(&_Testfiles.CallOpts) } -// ReturnSeen is a free data retrieval call binding the contract method 0xb95ad411. +// ReturnSeen is a free data retrieval call binding the contract method 0xb9dad6b0. // -// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) -func (_Testfiles *TestfilesCaller) ReturnSeen(opts *bind.CallOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { +// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],address,address[],int192,(bytes2,(int64,string)))) +func (_Testfiles *TestfilesCaller) ReturnSeen(opts *bind.CallOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { var out []interface{} err := _Testfiles.contract.Call(opts, &out, "ReturnSeen", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) @@ -367,59 +367,59 @@ func (_Testfiles *TestfilesCaller) ReturnSeen(opts *bind.CallOpts, field int32, } -// ReturnSeen is a free data retrieval call binding the contract method 0xb95ad411. +// ReturnSeen is a free data retrieval call binding the contract method 0xb9dad6b0. // -// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) -func (_Testfiles *TestfilesSession) ReturnSeen(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { +// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],address,address[],int192,(bytes2,(int64,string)))) +func (_Testfiles *TestfilesSession) ReturnSeen(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { return _Testfiles.Contract.ReturnSeen(&_Testfiles.CallOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) } -// ReturnSeen is a free data retrieval call binding the contract method 0xb95ad411. +// ReturnSeen is a free data retrieval call binding the contract method 0xb9dad6b0. // -// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],bytes32,bytes32[],int192,(bytes2,(int64,string)))) -func (_Testfiles *TestfilesCallerSession) ReturnSeen(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { +// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],address,address[],int192,(bytes2,(int64,string)))) +func (_Testfiles *TestfilesCallerSession) ReturnSeen(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { return _Testfiles.Contract.ReturnSeen(&_Testfiles.CallOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) } -// AddTestStruct is a paid mutator transaction binding the contract method 0x7dd6af5b. +// AddTestStruct is a paid mutator transaction binding the contract method 0x6c7cf955. // -// Solidity: function AddTestStruct(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() -func (_Testfiles *TestfilesTransactor) AddTestStruct(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { +// Solidity: function AddTestStruct(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() +func (_Testfiles *TestfilesTransactor) AddTestStruct(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { return _Testfiles.contract.Transact(opts, "AddTestStruct", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) } -// AddTestStruct is a paid mutator transaction binding the contract method 0x7dd6af5b. +// AddTestStruct is a paid mutator transaction binding the contract method 0x6c7cf955. // -// Solidity: function AddTestStruct(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() -func (_Testfiles *TestfilesSession) AddTestStruct(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { +// Solidity: function AddTestStruct(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() +func (_Testfiles *TestfilesSession) AddTestStruct(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { return _Testfiles.Contract.AddTestStruct(&_Testfiles.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) } -// AddTestStruct is a paid mutator transaction binding the contract method 0x7dd6af5b. +// AddTestStruct is a paid mutator transaction binding the contract method 0x6c7cf955. // -// Solidity: function AddTestStruct(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() -func (_Testfiles *TestfilesTransactorSession) AddTestStruct(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { +// Solidity: function AddTestStruct(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() +func (_Testfiles *TestfilesTransactorSession) AddTestStruct(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { return _Testfiles.Contract.AddTestStruct(&_Testfiles.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) } -// TriggerEvent is a paid mutator transaction binding the contract method 0xe669831d. +// TriggerEvent is a paid mutator transaction binding the contract method 0x8b659d6e. // -// Solidity: function TriggerEvent(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() -func (_Testfiles *TestfilesTransactor) TriggerEvent(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { +// Solidity: function TriggerEvent(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() +func (_Testfiles *TestfilesTransactor) TriggerEvent(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { return _Testfiles.contract.Transact(opts, "TriggerEvent", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) } -// TriggerEvent is a paid mutator transaction binding the contract method 0xe669831d. +// TriggerEvent is a paid mutator transaction binding the contract method 0x8b659d6e. // -// Solidity: function TriggerEvent(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() -func (_Testfiles *TestfilesSession) TriggerEvent(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { +// Solidity: function TriggerEvent(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() +func (_Testfiles *TestfilesSession) TriggerEvent(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { return _Testfiles.Contract.TriggerEvent(&_Testfiles.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) } -// TriggerEvent is a paid mutator transaction binding the contract method 0xe669831d. +// TriggerEvent is a paid mutator transaction binding the contract method 0x8b659d6e. // -// Solidity: function TriggerEvent(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() -func (_Testfiles *TestfilesTransactorSession) TriggerEvent(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account [32]byte, accounts [][32]byte, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { +// Solidity: function TriggerEvent(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() +func (_Testfiles *TestfilesTransactorSession) TriggerEvent(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { return _Testfiles.Contract.TriggerEvent(&_Testfiles.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) } @@ -496,16 +496,16 @@ type TestfilesTriggered struct { DifferentField string OracleId uint8 OracleIds [32]uint8 - Account [32]byte - Accounts [][32]byte + Account common.Address + Accounts []common.Address BigField *big.Int NestedStruct MidLevelTestStruct Raw types.Log // Blockchain specific contextual infos } -// FilterTriggered is a free log retrieval operation binding the contract event 0x7d2abe6109e46b893ac1835c9287d6ad5c5ccf3d0254d2ca72225873795e0f53. +// FilterTriggered is a free log retrieval operation binding the contract event 0x7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d. // -// Solidity: event Triggered(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) +// Solidity: event Triggered(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address Account, address[] Accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) func (_Testfiles *TestfilesFilterer) FilterTriggered(opts *bind.FilterOpts) (*TestfilesTriggeredIterator, error) { logs, sub, err := _Testfiles.contract.FilterLogs(opts, "Triggered") @@ -515,9 +515,9 @@ func (_Testfiles *TestfilesFilterer) FilterTriggered(opts *bind.FilterOpts) (*Te return &TestfilesTriggeredIterator{contract: _Testfiles.contract, event: "Triggered", logs: logs, sub: sub}, nil } -// WatchTriggered is a free log subscription operation binding the contract event 0x7d2abe6109e46b893ac1835c9287d6ad5c5ccf3d0254d2ca72225873795e0f53. +// WatchTriggered is a free log subscription operation binding the contract event 0x7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d. // -// Solidity: event Triggered(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) +// Solidity: event Triggered(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address Account, address[] Accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) func (_Testfiles *TestfilesFilterer) WatchTriggered(opts *bind.WatchOpts, sink chan<- *TestfilesTriggered) (event.Subscription, error) { logs, sub, err := _Testfiles.contract.WatchLogs(opts, "Triggered") @@ -552,9 +552,9 @@ func (_Testfiles *TestfilesFilterer) WatchTriggered(opts *bind.WatchOpts, sink c }), nil } -// ParseTriggered is a log parse operation binding the contract event 0x7d2abe6109e46b893ac1835c9287d6ad5c5ccf3d0254d2ca72225873795e0f53. +// ParseTriggered is a log parse operation binding the contract event 0x7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d. // -// Solidity: event Triggered(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, bytes32 account, bytes32[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) +// Solidity: event Triggered(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address Account, address[] Accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) func (_Testfiles *TestfilesFilterer) ParseTriggered(log types.Log) (*TestfilesTriggered, error) { event := new(TestfilesTriggered) if err := _Testfiles.contract.UnpackLog(event, "Triggered", log); err != nil { diff --git a/core/services/relay/evm/types/abi_types.go b/core/services/relay/evm/types/abi_types.go index 001810a2b33..6749d62fd26 100644 --- a/core/services/relay/evm/types/abi_types.go +++ b/core/services/relay/evm/types/abi_types.go @@ -2,6 +2,8 @@ package types import ( "reflect" + + "github.com/ethereum/go-ethereum/common" ) //go:generate go run ./gen/main.go @@ -47,6 +49,10 @@ var typeMap = map[string]*AbiEncodingType{ Native: reflect.TypeOf(""), Checked: reflect.TypeOf(""), }, + "address": { + Native: reflect.TypeOf(common.Address{}), + Checked: reflect.TypeOf(common.Address{}), + }, } type AbiEncodingType struct { diff --git a/go.mod b/go.mod index 2d17c802bb8..bcd71c249b0 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 - github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d + github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 diff --git a/go.sum b/go.sum index 25e18d7e987..b659192f701 100644 --- a/go.sum +++ b/go.sum @@ -1140,8 +1140,8 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff67 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d h1:w4MsbOtNk6nD/mcXLstHWk9hB6g7QLtcAfhPjhwvOaQ= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d/go.mod h1:YPAfLNowdBwiKiYOwgwtbJHi8AJWbcxkbOY0ItAvkfc= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d h1:MicPzjBP6vbcSLNDoCD6Y16/l/8O+e2jlmn7t6gQbhU= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d/go.mod h1:/gErwx/BBGs7gKXy3a3mfnNtL0TrmcODzVQkUvPTXtY= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a/go.mod h1:rioELYwPY2xBtzPRN/D08Y7iTPbIQEjPknYdJK51CzQ= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 h1:1GzOKT53e8N7ZPwsyf1hSbKsynZmXmLOIL3DMvGq9sc= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 6a87cf45dd4..b2f69186ee7 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -347,7 +347,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 85fde648069..ef3045aaa70 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1438,8 +1438,8 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff67 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d h1:w4MsbOtNk6nD/mcXLstHWk9hB6g7QLtcAfhPjhwvOaQ= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d/go.mod h1:YPAfLNowdBwiKiYOwgwtbJHi8AJWbcxkbOY0ItAvkfc= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d h1:MicPzjBP6vbcSLNDoCD6Y16/l/8O+e2jlmn7t6gQbhU= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d/go.mod h1:/gErwx/BBGs7gKXy3a3mfnNtL0TrmcODzVQkUvPTXtY= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a/go.mod h1:rioELYwPY2xBtzPRN/D08Y7iTPbIQEjPknYdJK51CzQ= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 h1:1GzOKT53e8N7ZPwsyf1hSbKsynZmXmLOIL3DMvGq9sc= From c28797107023578aa2e31d85bfb31b5f221f0204 Mon Sep 17 00:00:00 2001 From: ilija Date: Wed, 13 Dec 2023 23:20:26 +0100 Subject: [PATCH 045/112] Update go mod references --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 2711148ce4b..56c2c4deeb2 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -237,7 +237,7 @@ require ( github.com/shirou/gopsutil/v3 v3.23.11 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d // indirect + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 560dd7d7245..2ad37e037c5 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1148,8 +1148,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d h1:azq9Vi7aWsq7HOUIYKFCD3Xksuz03q+UFUUkhPwYByc= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6 h1:OFYKeLubSc7iCpNZnZtY9Zo6cuxnII41fvdQlHhJzI0= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/go.mod b/go.mod index bcd71c249b0..88a1382a501 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d diff --git a/go.sum b/go.sum index b659192f701..4b03e72c367 100644 --- a/go.sum +++ b/go.sum @@ -1134,8 +1134,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d h1:azq9Vi7aWsq7HOUIYKFCD3Xksuz03q+UFUUkhPwYByc= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6 h1:OFYKeLubSc7iCpNZnZtY9Zo6cuxnII41fvdQlHhJzI0= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index b2f69186ee7..733cbcf748c 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6 github.com/smartcontractkit/chainlink-testing-framework v1.22.0 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index ef3045aaa70..78cf41adc03 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1432,8 +1432,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d h1:azq9Vi7aWsq7HOUIYKFCD3Xksuz03q+UFUUkhPwYByc= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213203435-f213bca2982d/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6 h1:OFYKeLubSc7iCpNZnZtY9Zo6cuxnII41fvdQlHhJzI0= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From 761031f74a5e8a821d768889dbeef46144c329ea Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 20 Dec 2023 09:42:02 -0500 Subject: [PATCH 046/112] add epoch converting --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- core/services/relay/evm/chain_reader.go | 3 ++- core/services/relay/evm/codec.go | 3 ++- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 56c2c4deeb2..f334d94ba34 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -237,7 +237,7 @@ require ( github.com/shirou/gopsutil/v3 v3.23.11 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6 // indirect + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 2ad37e037c5..df6461ff55b 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1148,8 +1148,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6 h1:OFYKeLubSc7iCpNZnZtY9Zo6cuxnII41fvdQlHhJzI0= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9 h1:dca0f2dpHOPPu6raYK5nJU0A5P7JkXM5PbMGNezg2NI= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index ea3498fec94..387d411d1af 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -83,7 +83,8 @@ func (cr *chainReader) getLatestValueFromLogPoller(ctx context.Context, contract log, err := cr.lp.LatestLogByEventSigWithConfs(hash, ae.addr, logpoller.Finalized) if err != nil { - if strings.Contains(err.Error(), "not found") { + errStr := err.Error() + if strings.Contains(errStr, "not found") || strings.Contains(errStr, "noRows") { return fmt.Errorf("%w: %w", commontypes.ErrNotFound, err) } return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) diff --git a/core/services/relay/evm/codec.go b/core/services/relay/evm/codec.go index 2c4570a53fa..b953d382d83 100644 --- a/core/services/relay/evm/codec.go +++ b/core/services/relay/evm/codec.go @@ -19,13 +19,14 @@ import ( ) // decodeAccountHook allows strings to be converted to [32]byte allowing config to represent them as 0x... +// EpochToTimeHook allows times to be converted to and from integer types // BigIntHook allows *big.Int to be represented as any integer type or a string and to go back to them. // Useful for config, or if when a model may use a go type that isn't a *big.Int when Pack expects one. // Eg: int32 in a go struct from a plugin could require a *big.Int in Pack for int24, if it fits, we shouldn't care. // SliceToArrayVerifySizeHook verifies that slices have the correct size when converting to an array // sizeVerifyBigIntHook allows our custom types that verify the number fits in the on-chain type to be converted as-if // it was a *big.Int -var evmDecoderHooks = []mapstructure.DecodeHookFunc{decodeAccountHook, codec.BigIntHook, codec.SliceToArrayVerifySizeHook, sizeVerifyBigIntHook} +var evmDecoderHooks = []mapstructure.DecodeHookFunc{decodeAccountHook, codec.EpochToTimeHook, codec.BigIntHook, codec.SliceToArrayVerifySizeHook, sizeVerifyBigIntHook} func NewCodec(conf types.CodecConfig) (commontypes.RemoteCodec, error) { parsed := &parsedTypes{ diff --git a/go.mod b/go.mod index 88a1382a501..6b509a1a6ad 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d diff --git a/go.sum b/go.sum index 4b03e72c367..fbdaa58c58e 100644 --- a/go.sum +++ b/go.sum @@ -1134,8 +1134,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6 h1:OFYKeLubSc7iCpNZnZtY9Zo6cuxnII41fvdQlHhJzI0= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9 h1:dca0f2dpHOPPu6raYK5nJU0A5P7JkXM5PbMGNezg2NI= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 733cbcf748c..5b0e0c34648 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9 github.com/smartcontractkit/chainlink-testing-framework v1.22.0 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 78cf41adc03..4d8a285a00a 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1432,8 +1432,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6 h1:OFYKeLubSc7iCpNZnZtY9Zo6cuxnII41fvdQlHhJzI0= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231213221837-9cba29c897a6/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9 h1:dca0f2dpHOPPu6raYK5nJU0A5P7JkXM5PbMGNezg2NI= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From a2e92cdb03c02b251c78abcf432bf98873acd9d1 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Thu, 14 Dec 2023 13:06:51 -0500 Subject: [PATCH 047/112] Simplify chain reader's bindings. --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 +- core/services/relay/evm/binding.go | 156 +++++++++++++ core/services/relay/evm/bindings.go | 75 +++--- core/services/relay/evm/chain_reader.go | 229 ++++++++----------- core/services/relay/evm/chain_reader_test.go | 24 +- core/services/relay/evm/evm.go | 11 +- go.mod | 2 +- go.sum | 4 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- 11 files changed, 310 insertions(+), 203 deletions(-) create mode 100644 core/services/relay/evm/binding.go diff --git a/core/scripts/go.mod b/core/scripts/go.mod index f334d94ba34..148ba233dff 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -237,7 +237,7 @@ require ( github.com/shirou/gopsutil/v3 v3.23.11 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9 // indirect + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231220205429-813aebce838e // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index df6461ff55b..868c91838bd 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1148,8 +1148,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9 h1:dca0f2dpHOPPu6raYK5nJU0A5P7JkXM5PbMGNezg2NI= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231220205429-813aebce838e h1:t9yp8N8WgbCspo0JOIJaxyYNeMEzpNhQXEyr708bFT4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231220205429-813aebce838e/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/core/services/relay/evm/binding.go b/core/services/relay/evm/binding.go new file mode 100644 index 00000000000..465a10b368d --- /dev/null +++ b/core/services/relay/evm/binding.go @@ -0,0 +1,156 @@ +package evm + +import ( + "context" + "fmt" + "strings" + + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/common" + + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + + evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" +) + +type readBinding interface { + GetLatestValue(ctx context.Context, params any) ([]byte, error) + Bind(binding commontypes.BoundContract) error + SetCodec(codec commontypes.Codec) + Register() error + Unregister() error +} + +type methodBinding struct { + address common.Address + contractName string + method string + client evmclient.Client + codec commontypes.Codec + bound bool +} + +var _ readBinding = &methodBinding{} + +func (m *methodBinding) SetCodec(codec commontypes.Codec) { + m.codec = codec +} + +func (m *methodBinding) Register() error { + return nil +} + +func (m *methodBinding) Unregister() error { + return nil +} + +func (m *methodBinding) GetLatestValue(ctx context.Context, params any) ([]byte, error) { + if !m.bound { + return nil, fmt.Errorf("%w: method not bound", commontypes.ErrInvalidType) + } + + data, err := m.codec.Encode(ctx, params, wrapItemType(m.contractName, m.method, true)) + if err != nil { + return nil, err + } + + callMsg := ethereum.CallMsg{ + To: &m.address, + From: m.address, + Data: data, + } + + return m.client.CallContract(ctx, callMsg, nil) +} + +func (m *methodBinding) Bind(binding commontypes.BoundContract) error { + m.address = common.HexToAddress(binding.Address) + m.bound = true + return nil +} + +type eventBinding struct { + address common.Address + contractName string + eventName string + lp logpoller.LogPoller + hash common.Hash + codec commontypes.Codec + pending bool + subscribed bool + bound bool +} + +func (e *eventBinding) SetCodec(codec commontypes.Codec) { + e.codec = codec +} + +func (e *eventBinding) Register() error { + e.subscribed = true + if !e.bound { + return nil + } + + if err := e.lp.RegisterFilter(logpoller.Filter{ + Name: wrapItemType(e.contractName, e.eventName, false), + EventSigs: evmtypes.HashArray{e.hash}, + Addresses: evmtypes.AddressArray{e.address}, + }); err != nil { + return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) + } + return nil +} + +func (e *eventBinding) Unregister() error { + e.subscribed = false + if !e.bound { + return nil + } + + if err := e.lp.UnregisterFilter(wrapItemType(e.contractName, e.eventName, false)); err != nil { + return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) + } + return nil +} + +var _ readBinding = &eventBinding{} + +func (e *eventBinding) GetLatestValue(_ context.Context, _ any) ([]byte, error) { + if !e.bound { + return nil, fmt.Errorf("%w: event not bound", commontypes.ErrInvalidType) + } + + confs := logpoller.Finalized + if e.pending { + confs = logpoller.Unconfirmed + } + log, err := e.lp.LatestLogByEventSigWithConfs(e.hash, e.address, confs) + if err != nil { + errStr := err.Error() + if strings.Contains(errStr, "not found") || strings.Contains(errStr, "no rows") { + return nil, nil + } + return nil, err + } + + return log.Data, nil +} + +func (e *eventBinding) Bind(binding commontypes.BoundContract) error { + wasSubscribed := e.subscribed + if wasSubscribed { + if err := e.Unregister(); err != nil { + return err + } + } + e.address = common.HexToAddress(binding.Address) + e.pending = binding.Pending + e.bound = true + + if wasSubscribed { + return e.Register() + } + return nil +} diff --git a/core/services/relay/evm/bindings.go b/core/services/relay/evm/bindings.go index b1f705e2ce9..1a23128d19f 100644 --- a/core/services/relay/evm/bindings.go +++ b/core/services/relay/evm/bindings.go @@ -3,48 +3,59 @@ package evm import ( "fmt" - "github.com/ethereum/go-ethereum/common" - - "github.com/smartcontractkit/chainlink-common/pkg/types" + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" ) -type Bindings map[string]methodBindings +// key is contract name +type contractBindings map[string]readBindings -func (b Bindings) addEvent(contractName, typeName string, evt common.Hash) error { - ae, err := b.getBinding(contractName, typeName, true) - if err != nil { - return err - } +// key is read name +type readBindings map[string]readBinding - ae.evt = &evt - return nil -} - -func (b Bindings) getBinding(contractName, methodName string, isConfig bool) (*addrEvtBinding, error) { - errType := types.ErrInvalidType - if isConfig { - errType = types.ErrInvalidConfig - } - methodNames, ok := b[contractName] - if !ok { - return nil, fmt.Errorf("%w: contract %s not found", errType, contractName) +func (b contractBindings) GetReadBinding(contractName, readName string) (readBinding, error) { + rb, rbExists := b[contractName] + if !rbExists { + return nil, fmt.Errorf("%w: no contract named %s", commontypes.ErrInvalidType, contractName) } - ae, ok := methodNames[methodName] - if !ok { - return nil, fmt.Errorf("%w: method %s not found in contract %s", errType, methodName, contractName) + reader, readerExists := rb[readName] + if !readerExists { + return nil, fmt.Errorf("%w: no readName named %s in contract %s", commontypes.ErrInvalidType, readName, contractName) } - - return ae, nil + return reader, nil } -type methodBindings map[string]*addrEvtBinding +func (b contractBindings) AddReadBinding(contractName, readName string, reader readBinding) { + rbs, rbsExists := b[contractName] + if !rbsExists { + rbs = readBindings{} + b[contractName] = rbs + } + rbs[readName] = reader +} -func NewAddrEvtFromAddress(address common.Address) *addrEvtBinding { - return &addrEvtBinding{addr: address} +func (b contractBindings) Bind(boundContracts []commontypes.BoundContract) error { + for _, bc := range boundContracts { + rbs, rbsExist := b[bc.Name] + if !rbsExist { + return fmt.Errorf("%w: no contract named %s", commontypes.ErrInvalidConfig, bc.Name) + } + for _, r := range rbs { + if err := r.Bind(bc); err != nil { + return err + } + } + } + return nil } -type addrEvtBinding struct { - addr common.Address - evt *common.Hash +func (b contractBindings) ForEach(fn func(readBinding) error) error { + for _, rbs := range b { + for _, rb := range rbs { + if err := fn(rb); err != nil { + return err + } + } + } + return nil } diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index 387d411d1af..589c8e8b4e8 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -5,15 +5,12 @@ import ( "fmt" "strings" - "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" commonservices "github.com/smartcontractkit/chainlink-common/pkg/services" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" - evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" @@ -28,34 +25,40 @@ type ChainReaderService interface { } type chainReader struct { - lggr logger.Logger - lp logpoller.LogPoller - codec commontypes.RemoteCodec - client evmclient.Client - bindings Bindings + lggr logger.Logger + lp logpoller.LogPoller + client evmclient.Client + contractBindings contractBindings + parsed *parsedTypes + codec commontypes.RemoteCodec commonservices.StateMachine } // NewChainReaderService is a constructor for ChainReader, returns nil if there is any error -func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, b Bindings, chain legacyevm.Chain, config types.ChainReaderConfig) (ChainReaderService, error) { - parsed := &parsedTypes{ - encoderDefs: map[string]*codecEntry{}, - decoderDefs: map[string]*codecEntry{}, +func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, chain legacyevm.Chain, config types.ChainReaderConfig) (ChainReaderService, error) { + cr := &chainReader{ + lggr: lggr.Named("ChainReader"), + lp: lp, + client: chain.Client(), + contractBindings: contractBindings{}, + parsed: &parsedTypes{encoderDefs: map[string]*codecEntry{}, decoderDefs: map[string]*codecEntry{}}, } - if err := addTypes(config.ChainContractReaders, b, parsed); err != nil { + var err error + if err = cr.init(config.ChainContractReaders); err != nil { return nil, err } - c, err := parsed.toCodec() + if cr.codec, err = cr.parsed.toCodec(); err != nil { + return nil, err + } - return &chainReader{ - lggr: lggr.Named("ChainReader"), - lp: lp, - codec: c, - client: chain.Client(), - bindings: b, - }, err + err = cr.contractBindings.ForEach(func(b readBinding) error { + b.SetCodec(cr.codec) + return nil + }) + + return cr, err } func (cr *chainReader) Name() string { return cr.lggr.Name() } @@ -63,90 +66,59 @@ func (cr *chainReader) Name() string { return cr.lggr.Name() } var _ commontypes.ContractTypeProvider = &chainReader{} func (cr *chainReader) GetLatestValue(ctx context.Context, contractName, method string, params any, returnVal any) error { - ae, err := cr.bindings.getBinding(contractName, method, false) + b, err := cr.contractBindings.GetReadBinding(contractName, method) if err != nil { return err } - if ae.evt == nil { - return cr.getLatestValueFromContract(ctx, contractName, method, params, returnVal) - } - - return cr.getLatestValueFromLogPoller(ctx, contractName, method, *ae.evt, returnVal) -} - -func (cr *chainReader) getLatestValueFromLogPoller(ctx context.Context, contractName, method string, hash common.Hash, returnVal any) error { - ae, err := cr.bindings.getBinding(contractName, method, false) + bytes, err := b.GetLatestValue(ctx, params) if err != nil { return err } - - log, err := cr.lp.LatestLogByEventSigWithConfs(hash, ae.addr, logpoller.Finalized) - if err != nil { - errStr := err.Error() - if strings.Contains(errStr, "not found") || strings.Contains(errStr, "noRows") { - return fmt.Errorf("%w: %w", commontypes.ErrNotFound, err) - } - return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) - } - return cr.codec.Decode(ctx, log.Data, returnVal, wrapItemType(contractName, method, false)) + return cr.codec.Decode(ctx, bytes, returnVal, wrapItemType(contractName, method, false)) } -func (cr *chainReader) getLatestValueFromContract(ctx context.Context, contractName, method string, params any, returnVal any) error { - data, err := cr.codec.Encode(ctx, params, wrapItemType(contractName, method, true)) - if err != nil { - return err - } +func (cr *chainReader) Bind(_ context.Context, bindings []commontypes.BoundContract) error { + return cr.contractBindings.Bind(bindings) +} - ae, err := cr.bindings.getBinding(contractName, method, true) - if err != nil { - return err - } - callMsg := ethereum.CallMsg{ - To: &ae.addr, - From: ae.addr, - Data: data, - } +func (cr *chainReader) init(chainContractReaders map[string]types.ChainContractReader) error { + for contractName, chainContractReader := range chainContractReaders { + contractAbi, err := abi.JSON(strings.NewReader(chainContractReader.ContractABI)) + if err != nil { + return err + } - output, err := cr.client.CallContract(ctx, callMsg, nil) + for typeName, chainReaderDefinition := range chainContractReader.ChainReaderDefinitions { + switch chainReaderDefinition.ReadType { + case types.Method: + err = cr.addMethod(contractName, typeName, contractAbi, chainReaderDefinition) + case types.Event: + err = cr.addEvent(contractName, typeName, contractAbi, chainReaderDefinition) + default: + return fmt.Errorf( + "%w: invalid chain reader definition read type: %d", + commontypes.ErrInvalidConfig, + chainReaderDefinition.ReadType) + } - if err != nil { - return err + if err != nil { + return err + } + } } - - return cr.codec.Decode(ctx, output, returnVal, wrapItemType(contractName, method, false)) + return nil } func (cr *chainReader) Start(_ context.Context) error { return cr.StartOnce("ChainReader", func() error { - for contractName, contractEvents := range cr.bindings { - for eventName, b := range contractEvents { - if b.evt == nil { - continue - } - - if err := cr.lp.RegisterFilter(logpoller.Filter{ - Name: wrapItemType(contractName, eventName, false), - EventSigs: evmtypes.HashArray{*b.evt}, - Addresses: evmtypes.AddressArray{b.addr}, - }); err != nil { - return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) - } - } - } - return nil + return cr.contractBindings.ForEach(readBinding.Register) }) } + func (cr *chainReader) Close() error { return cr.StopOnce("ChainReader", func() error { - for contractName, contractEvents := range cr.bindings { - for eventName := range contractEvents { - if err := cr.lp.UnregisterFilter(wrapItemType(contractName, eventName, false)); err != nil { - return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) - } - } - } - return nil + return cr.contractBindings.ForEach(readBinding.Unregister) }) } @@ -159,34 +131,49 @@ func (cr *chainReader) CreateContractType(contractName, methodName string, forEn return cr.codec.CreateType(wrapItemType(contractName, methodName, forEncoding), forEncoding) } -func addEventTypes(contractName, methodName string, b Bindings, contractABI abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) error { - event, methodExists := contractABI.Events[chainReaderDefinition.ChainSpecificName] - if !methodExists { - return fmt.Errorf("%w: method %s doesn't exist", commontypes.ErrInvalidConfig, chainReaderDefinition.ChainSpecificName) - } - - if err := b.addEvent(contractName, methodName, event.ID); err != nil { - return err +func wrapItemType(contractName, methodName string, isParams bool) string { + if isParams { + return fmt.Sprintf("params.%s.%s", contractName, methodName) } - - return addDecoderDef(contractName, methodName, event.Inputs, parsed, chainReaderDefinition) + return fmt.Sprintf("return.%s.%s", contractName, methodName) } -func addMethods( - contractName, methodName string, abi abi.ABI, chainReaderDefinition types.ChainReaderDefinition, parsed *parsedTypes) error { +func (cr *chainReader) addMethod( + contractName, + methodName string, + abi abi.ABI, + chainReaderDefinition types.ChainReaderDefinition) error { method, methodExists := abi.Methods[chainReaderDefinition.ChainSpecificName] if !methodExists { - return fmt.Errorf("method: %q doesn't exist", chainReaderDefinition.ChainSpecificName) + return fmt.Errorf("%w: method %s doesn't exist", commontypes.ErrInvalidConfig, chainReaderDefinition.ChainSpecificName) } - if err := addEncoderDef(contractName, methodName, method, parsed, chainReaderDefinition); err != nil { + cr.contractBindings.AddReadBinding(contractName, methodName, &methodBinding{ + contractName: contractName, + method: methodName, + client: cr.client, + }) + + if err := cr.addEncoderDef(contractName, methodName, method, chainReaderDefinition); err != nil { return err } - return addDecoderDef(contractName, methodName, method.Outputs, parsed, chainReaderDefinition) + return cr.addDecoderDef(contractName, methodName, method.Outputs, chainReaderDefinition) } -func addEncoderDef(contractName, methodName string, method abi.Method, parsed *parsedTypes, chainReaderDefinition types.ChainReaderDefinition) error { +func (cr *chainReader) addEvent(contractName, eventName string, abi abi.ABI, chainReaderDefinition types.ChainReaderDefinition) error { + event, eventExists := abi.Events[chainReaderDefinition.ChainSpecificName] + if !eventExists { + return fmt.Errorf("%w: method %s doesn't exist", commontypes.ErrInvalidConfig, chainReaderDefinition.ChainSpecificName) + } + cr.contractBindings.AddReadBinding(contractName, eventName, &eventBinding{ + lp: cr.lp, + hash: event.ID, + }) + return cr.addDecoderDef(contractName, eventName, event.Inputs, chainReaderDefinition) +} + +func (cr *chainReader) addEncoderDef(contractName, methodName string, method abi.Method, chainReaderDefinition types.ChainReaderDefinition) error { // ABI.Pack prepends the method.ID to the encodings, we'll need the encoder to do the same. input := &codecEntry{Args: method.Inputs, encodingPrefix: method.ID} @@ -199,53 +186,17 @@ func addEncoderDef(contractName, methodName string, method abi.Method, parsed *p return err } input.mod = inputMod - parsed.encoderDefs[wrapItemType(contractName, methodName, true)] = input + cr.parsed.encoderDefs[wrapItemType(contractName, methodName, true)] = input return nil } -func addDecoderDef(contractName, methodName string, outputs abi.Arguments, parsed *parsedTypes, def types.ChainReaderDefinition) error { +func (cr *chainReader) addDecoderDef(contractName, methodName string, outputs abi.Arguments, def types.ChainReaderDefinition) error { output := &codecEntry{Args: outputs} mod, err := def.OutputModifications.ToModifier(evmDecoderHooks...) if err != nil { return err } output.mod = mod - parsed.decoderDefs[wrapItemType(contractName, methodName, false)] = output + cr.parsed.decoderDefs[wrapItemType(contractName, methodName, false)] = output return output.Init() } - -func addTypes(chainContractReaders map[string]types.ChainContractReader, b Bindings, parsed *parsedTypes) error { - for contractName, chainContractReader := range chainContractReaders { - contractAbi, err := abi.JSON(strings.NewReader(chainContractReader.ContractABI)) - if err != nil { - return err - } - - for typeName, chainReaderDefinition := range chainContractReader.ChainReaderDefinitions { - switch chainReaderDefinition.ReadType { - case types.Method: - err = addMethods(contractName, typeName, contractAbi, chainReaderDefinition, parsed) - case types.Event: - err = addEventTypes(contractName, typeName, b, contractAbi, chainReaderDefinition, parsed) - default: - return fmt.Errorf( - "%w: invalid chain reader definition read type: %d", - commontypes.ErrInvalidConfig, - chainReaderDefinition.ReadType) - } - - if err != nil { - return err - } - } - } - - return nil -} - -func wrapItemType(contractName, methodName string, isParams bool) string { - if isParams { - return fmt.Sprintf("params.%s.%s", contractName, methodName) - } - return fmt.Sprintf("return.%s.%s", contractName, methodName) -} diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 689c2941e88..360524bd9e1 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -141,27 +141,12 @@ func (it *chainReaderInterfaceTester) GetChainReader(t *testing.T) clcommontypes return it.cr } - addr := common.HexToAddress(it.address) - addr2 := common.HexToAddress(it.address2) lggr := logger.NullLogger db := pgtest.NewSqlxDB(t) lp := logpoller.NewLogPoller(logpoller.NewORM(testutils.SimulatedChainID, db, lggr, pgtest.NewQConfig(true)), it.chain.Client(), lggr, time.Millisecond, false, 0, 1, 1, 10000) require.NoError(t, lp.Start(ctx)) it.chain.On("LogPoller").Return(lp) - b := evm.Bindings{ - AnyContractName: { - MethodTakingLatestParamsReturningTestStruct: evm.NewAddrEvtFromAddress(addr), - MethodReturningUint64: evm.NewAddrEvtFromAddress(addr), - DifferentMethodReturningUint64: evm.NewAddrEvtFromAddress(addr2), - MethodReturningUint64Slice: evm.NewAddrEvtFromAddress(addr), - EventName: evm.NewAddrEvtFromAddress(addr), - MethodReturningSeenStruct: evm.NewAddrEvtFromAddress(addr), - }, - AnySecondContractName: { - MethodReturningUint64: evm.NewAddrEvtFromAddress(addr2), - }, - } - cr, err := evm.NewChainReaderService(lggr, lp, b, it.chain, it.chainConfig) + cr, err := evm.NewChainReaderService(lggr, lp, it.chain, it.chainConfig) require.NoError(t, err) require.NoError(t, cr.Start(ctx)) it.cr = cr @@ -176,6 +161,13 @@ func (it *chainReaderInterfaceTester) TriggerEvent(t *testing.T, testStruct *Tes it.sendTxWithTestStruct(t, testStruct, (*testfiles.TestfilesTransactor).TriggerEvent) } +func (it *chainReaderInterfaceTester) GetBindings(t *testing.T) []clcommontypes.BoundContract { + return []clcommontypes.BoundContract{ + {Name: AnyContractName, Address: it.address, Pending: true}, + {Name: AnySecondContractName, Address: it.address2, Pending: true}, + } +} + type testStructFn = func(*testfiles.TestfilesTransactor, *bind.TransactOpts, int32, string, uint8, [32]uint8, common.Address, []common.Address, *big.Int, testfiles.MidLevelTestStruct) (*evmtypes.Transaction, error) func (it *chainReaderInterfaceTester) sendTxWithTestStruct(t *testing.T, testStruct *TestStruct, fn testStructFn) { diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index 71845512767..e4901117820 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -493,15 +493,12 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp // allow fallback until chain reader is default and median contract is removed, but still log just in case var chainReaderService ChainReaderService if relayConfig.ChainReader != nil { - b := Bindings{ - // TODO BCF-2837: clean up the hard-coded values. - "median": { - "LatestTransmissionDetails": &addrEvtBinding{addr: contractID}, - "LatestRoundRequested": &addrEvtBinding{addr: contractID}, - }, + if chainReaderService, err = NewChainReaderService(lggr, r.chain.LogPoller(), r.chain, *relayConfig.ChainReader); err != nil { + return nil, err } - if chainReaderService, err = NewChainReaderService(lggr, r.chain.LogPoller(), b, r.chain, *relayConfig.ChainReader); err != nil { + boundContracts := []commontypes.BoundContract{{Name: "median", Pending: true, Address: contractID.String()}} + if err = chainReaderService.Bind(context.Background(), boundContracts); err != nil { return nil, err } } else { diff --git a/go.mod b/go.mod index 6b509a1a6ad..5b4fd8fbb80 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231220205429-813aebce838e github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d diff --git a/go.sum b/go.sum index fbdaa58c58e..a8769c28452 100644 --- a/go.sum +++ b/go.sum @@ -1134,8 +1134,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9 h1:dca0f2dpHOPPu6raYK5nJU0A5P7JkXM5PbMGNezg2NI= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231220205429-813aebce838e h1:t9yp8N8WgbCspo0JOIJaxyYNeMEzpNhQXEyr708bFT4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231220205429-813aebce838e/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 5b0e0c34648..54612b74d61 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20231220205429-813aebce838e github.com/smartcontractkit/chainlink-testing-framework v1.22.0 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 4d8a285a00a..faac9b5958d 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1432,8 +1432,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9 h1:dca0f2dpHOPPu6raYK5nJU0A5P7JkXM5PbMGNezg2NI= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231214180711-f4668ff89fe9/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231220205429-813aebce838e h1:t9yp8N8WgbCspo0JOIJaxyYNeMEzpNhQXEyr708bFT4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231220205429-813aebce838e/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From e2267054062224d3179d83a1fd594c1fe7f04fc0 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 22 Dec 2023 14:47:35 -0500 Subject: [PATCH 048/112] Add smoke test and feature test for chain reader. --- common/txmgr/confirmer.go | 2 +- core/chains/evm/logpoller/log_poller.go | 8 +- core/internal/cltest/cltest.go | 2 +- .../features/ocr2/features_ocr2_test.go | 383 +++++++++++------- core/scripts/go.mod | 9 +- core/scripts/go.sum | 20 +- core/services/job/models.go | 21 +- core/services/ocr2/plugins/median/plugin.go | 68 ---- core/services/ocr2/plugins/median/services.go | 84 +--- core/services/relay/evm/binding.go | 2 +- core/services/relay/evm/codec.go | 2 +- core/services/relay/evm/codec_entry.go | 5 +- core/services/relay/evm/decoder.go | 14 +- core/services/relay/evm/encoder.go | 18 +- core/services/relay/evm/evm.go | 6 +- go.mod | 9 +- go.sum | 20 +- integration-tests/actions/ocr2_helpers.go | 9 +- .../actions/ocr2_helpers_local.go | 6 + integration-tests/client/chainlink_models.go | 7 +- integration-tests/go.mod | 9 +- integration-tests/go.sum | 20 +- .../smoke/forwarders_ocr2_test.go | 2 +- integration-tests/smoke/ocr2_test.go | 21 +- 24 files changed, 367 insertions(+), 380 deletions(-) delete mode 100644 core/services/ocr2/plugins/median/plugin.go diff --git a/common/txmgr/confirmer.go b/common/txmgr/confirmer.go index f10481fef56..ab5e480b4e1 100644 --- a/common/txmgr/confirmer.go +++ b/common/txmgr/confirmer.go @@ -12,12 +12,12 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" + commonhex "github.com/smartcontractkit/chainlink-common/pkg/utils/hex" "go.uber.org/multierr" "github.com/smartcontractkit/chainlink-common/pkg/chains/label" "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink-common/pkg/services" - commonhex "github.com/smartcontractkit/chainlink-common/pkg/utils/hex" "github.com/smartcontractkit/chainlink-common/pkg/utils/mailbox" "github.com/smartcontractkit/chainlink/v2/common/client" diff --git a/core/chains/evm/logpoller/log_poller.go b/core/chains/evm/logpoller/log_poller.go index f82cec62b74..93d1def5d88 100644 --- a/core/chains/evm/logpoller/log_poller.go +++ b/core/chains/evm/logpoller/log_poller.go @@ -659,11 +659,9 @@ func (lp *logPoller) backfill(ctx context.Context, start, end int64) error { gethLogs, err := lp.ec.FilterLogs(ctx, lp.Filter(big.NewInt(from), big.NewInt(to), nil)) if err != nil { var rpcErr client.JsonError - if errors.As(err, &rpcErr) { - if rpcErr.Code != jsonRpcLimitExceeded { - lp.lggr.Errorw("Unable to query for logs", "err", err, "from", from, "to", to) - return err - } + if !errors.As(err, &rpcErr) || rpcErr.Code != jsonRpcLimitExceeded { + lp.lggr.Errorw("Unable to query for logs", "err", err, "from", from, "to", to) + return err } if batchSize == 1 { lp.lggr.Criticalw("Too many log results in a single block, failed to retrieve logs! Node may be running in a degraded state.", "err", err, "from", from, "to", to, "LogBackfillBatchSize", lp.backfillBatchSize) diff --git a/core/internal/cltest/cltest.go b/core/internal/cltest/cltest.go index fceb58ccdab..44ba041d31d 100644 --- a/core/internal/cltest/cltest.go +++ b/core/internal/cltest/cltest.go @@ -341,7 +341,7 @@ func NewApplicationWithConfig(t testing.TB, cfg chainlink.GeneralConfig, flagsAn } keyStore := keystore.NewInMemory(db, utils.FastScryptParams, lggr, cfg.Database()) - + mailMon := mailbox.NewMonitor(cfg.AppID().String(), lggr.Named("Mailbox")) loopRegistry := plugins.NewLoopRegistry(lggr, nil) diff --git a/core/internal/features/ocr2/features_ocr2_test.go b/core/internal/features/ocr2/features_ocr2_test.go index e3b6c1a24d1..540306802d4 100644 --- a/core/internal/features/ocr2/features_ocr2_test.go +++ b/core/internal/features/ocr2/features_ocr2_test.go @@ -187,50 +187,62 @@ func setupNodeOCR2( func TestIntegration_OCR2(t *testing.T) { t.Parallel() - owner, b, ocrContractAddress, ocrContract := setupOCR2Contracts(t) - lggr := logger.TestLogger(t) - bootstrapNodePort := freeport.GetOne(t) - bootstrapNode := setupNodeOCR2(t, owner, bootstrapNodePort, false /* useForwarders */, b, nil) - - var ( - oracles []confighelper2.OracleIdentityExtra - transmitters []common.Address - kbs []ocr2key.KeyBundle - apps []*cltest.TestApplication - ) - ports := freeport.GetN(t, 4) - for i := 0; i < 4; i++ { - node := setupNodeOCR2(t, owner, ports[i], false /* useForwarders */, b, []commontypes.BootstrapperLocator{ - // Supply the bootstrap IP and port as a V2 peer address - {PeerID: bootstrapNode.peerID, Addrs: []string{fmt.Sprintf("127.0.0.1:%d", bootstrapNodePort)}}, - }) - - kbs = append(kbs, node.keybundle) - apps = append(apps, node.app) - transmitters = append(transmitters, node.transmitter) - - 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(), - }) - } + for _, test := range []struct { + name string + chainReaderAndCodec bool + }{ + {"legacy", false}, + {"chain-reader", true}, + } { + test := test + t.Run(test.name, func(t *testing.T) { + t.Parallel() + + owner, b, ocrContractAddress, ocrContract := setupOCR2Contracts(t) + + lggr := logger.TestLogger(t) + bootstrapNodePort := freeport.GetOne(t) + bootstrapNode := setupNodeOCR2(t, owner, bootstrapNodePort, false /* useForwarders */, b, nil) + + var ( + oracles []confighelper2.OracleIdentityExtra + transmitters []common.Address + kbs []ocr2key.KeyBundle + apps []*cltest.TestApplication + ) + ports := freeport.GetN(t, 4) + for i := 0; i < 4; i++ { + node := setupNodeOCR2(t, owner, ports[i], false /* useForwarders */, b, []commontypes.BootstrapperLocator{ + // Supply the bootstrap IP and port as a V2 peer address + {PeerID: bootstrapNode.peerID, Addrs: []string{fmt.Sprintf("127.0.0.1:%d", bootstrapNodePort)}}, + }) + + kbs = append(kbs, node.keybundle) + apps = append(apps, node.app) + transmitters = append(transmitters, node.transmitter) + + 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(), + }) + } - tick := time.NewTicker(1 * time.Second) - defer tick.Stop() - go func() { - for range tick.C { - b.Commit() - } - }() + tick := time.NewTicker(1 * time.Second) + defer tick.Stop() + go func() { + for range tick.C { + b.Commit() + } + }() - blockBeforeConfig := initOCR2(t, lggr, b, ocrContract, owner, bootstrapNode, oracles, transmitters, transmitters, func(blockNum int64) string { - return fmt.Sprintf(` + blockBeforeConfig := initOCR2(t, lggr, b, ocrContract, owner, bootstrapNode, oracles, transmitters, transmitters, func(blockNum int64) string { + return fmt.Sprintf(` type = "bootstrap" name = "bootstrap" relay = "evm" @@ -240,54 +252,71 @@ contractID = "%s" chainID = 1337 fromBlock = %d `, ocrContractAddress, blockNum) - }) - - var jids []int32 - var servers, slowServers = make([]*httptest.Server, 4), make([]*httptest.Server, 4) - // We expect metadata of: - // latestAnswer:nil // First call - // latestAnswer:0 - // latestAnswer:10 - // latestAnswer:20 - // latestAnswer:30 - var metaLock sync.Mutex - expectedMeta := map[string]struct{}{ - "0": {}, "10": {}, "20": {}, "30": {}, - } - for i := 0; i < 4; i++ { - s := i - require.NoError(t, apps[i].Start(testutils.Context(t))) - - // API speed is > observation timeout set in ContractSetConfigArgsForIntegrationTest - slowServers[i] = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - time.Sleep(5 * time.Second) - res.WriteHeader(http.StatusOK) - _, err := res.Write([]byte(`{"data":10}`)) - require.NoError(t, err) - })) - t.Cleanup(slowServers[s].Close) - servers[i] = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - b, err := io.ReadAll(req.Body) - require.NoError(t, err) - var m bridges.BridgeMetaDataJSON - require.NoError(t, json.Unmarshal(b, &m)) - if m.Meta.LatestAnswer != nil && m.Meta.UpdatedAt != nil { - metaLock.Lock() - delete(expectedMeta, m.Meta.LatestAnswer.String()) - metaLock.Unlock() + }) + + var jids []int32 + var servers, slowServers = make([]*httptest.Server, 4), make([]*httptest.Server, 4) + // We expect metadata of: + // latestAnswer:nil // First call + // latestAnswer:0 + // latestAnswer:10 + // latestAnswer:20 + // latestAnswer:30 + var metaLock sync.Mutex + expectedMeta := map[string]struct{}{ + "0": {}, "10": {}, "20": {}, "30": {}, } - res.WriteHeader(http.StatusOK) - _, err = res.Write([]byte(`{"data":10}`)) - require.NoError(t, err) - })) - t.Cleanup(servers[s].Close) - u, _ := url.Parse(servers[i].URL) - require.NoError(t, apps[i].BridgeORM().CreateBridgeType(&bridges.BridgeType{ - Name: bridges.BridgeName(fmt.Sprintf("bridge%d", i)), - URL: models.WebURL(*u), - })) - - ocrJob, err := validate.ValidatedOracleSpecToml(apps[i].Config.OCR2(), apps[i].Config.Insecure(), fmt.Sprintf(` + returnData := int(10) + for i := 0; i < 4; i++ { + s := i + require.NoError(t, apps[i].Start(testutils.Context(t))) + + // API speed is > observation timeout set in ContractSetConfigArgsForIntegrationTest + slowServers[i] = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + time.Sleep(5 * time.Second) + var result string + metaLock.Lock() + result = fmt.Sprintf(`{"data":%d}`, returnData) + metaLock.Unlock() + res.WriteHeader(http.StatusOK) + t.Logf("Slow Bridge %d returning data:10", s) + _, err := res.Write([]byte(result)) + require.NoError(t, err) + })) + t.Cleanup(slowServers[s].Close) + servers[i] = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + b, err := io.ReadAll(req.Body) + require.NoError(t, err) + var m bridges.BridgeMetaDataJSON + require.NoError(t, json.Unmarshal(b, &m)) + var result string + metaLock.Lock() + result = fmt.Sprintf(`{"data":%d}`, returnData) + metaLock.Unlock() + if m.Meta.LatestAnswer != nil && m.Meta.UpdatedAt != nil { + t.Logf("Bridge %d deleting %s, from request body: %s", s, m.Meta.LatestAnswer, b) + metaLock.Lock() + delete(expectedMeta, m.Meta.LatestAnswer.String()) + metaLock.Unlock() + } + res.WriteHeader(http.StatusOK) + _, err = res.Write([]byte(result)) + require.NoError(t, err) + })) + t.Cleanup(servers[s].Close) + u, _ := url.Parse(servers[i].URL) + require.NoError(t, apps[i].BridgeORM().CreateBridgeType(&bridges.BridgeType{ + Name: bridges.BridgeName(fmt.Sprintf("bridge%d", i)), + URL: models.WebURL(*u), + })) + + var chainReaderSpec string + if test.chainReaderAndCodec { + chainReaderSpec = ` +chainReader = '{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0, "output_modifications":[{"type":"rename","fields":{"LatestAnswer_":"LatestAnswer","LatestTimestamp_":"LatestTimestamp"}}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}' +codec = '{"chainCodecConfig" :{"MedianReport":{"TypeAbi": "[{\"Name\": \"Timestamp\",\"Type\": \"uint32\"},{\"Name\": \"Observers\",\"Type\": \"bytes32\"},{\"Name\": \"Observations\",\"Type\": \"int192[]\"},{\"Name\": \"JuelsPerFeeCoin\",\"Type\": \"int192\"}]"}}}'` + } + ocrJob, err := validate.ValidatedOracleSpecToml(apps[i].Config.OCR2(), apps[i].Config.Insecure(), fmt.Sprintf(` type = "offchainreporting2" relay = "evm" schemaVersion = 1 @@ -316,7 +345,7 @@ observationSource = """ """ [relayConfig] chainID = 1337 -fromBlock = %d +fromBlock = %d%s [pluginConfig] juelsPerFeeCoinSource = """ // data source 1 @@ -334,72 +363,132 @@ juelsPerFeeCoinSource = """ answer1 [type=median index=0]; """ -`, ocrContractAddress, kbs[i].ID(), transmitters[i], fmt.Sprintf("bridge%d", i), i, slowServers[i].URL, i, blockBeforeConfig.Number().Int64(), fmt.Sprintf("bridge%d", i), i, slowServers[i].URL, i)) - require.NoError(t, err) - err = apps[i].AddJobV2(testutils.Context(t), &ocrJob) - require.NoError(t, err) - jids = append(jids, ocrJob.ID) - } +`, ocrContractAddress, kbs[i].ID(), transmitters[i], fmt.Sprintf("bridge%d", i), i, slowServers[i].URL, i, blockBeforeConfig.Number().Int64(), chainReaderSpec, fmt.Sprintf("bridge%d", i), i, slowServers[i].URL, i)) + require.NoError(t, err) + err = apps[i].AddJobV2(testutils.Context(t), &ocrJob) + require.NoError(t, err) + jids = append(jids, ocrJob.ID) + } - // Assert that all the OCR jobs get a run with valid values eventually. - var wg sync.WaitGroup - for i := 0; i < 4; i++ { - ic := i - wg.Add(1) - go func() { - defer wg.Done() - // Want at least 2 runs so we see all the metadata. - pr := cltest.WaitForPipelineComplete(t, ic, jids[ic], 2, 7, apps[ic].JobORM(), 2*time.Minute, 5*time.Second) - jb, err := pr[0].Outputs.MarshalJSON() + // Watch for OCR2AggregatorTransmitted events + start := uint64(0) + txEvents := make(chan *ocr2aggregator.OCR2AggregatorTransmitted) + _, err := ocrContract.WatchTransmitted(&bind.WatchOpts{Start: &start, Context: testutils.Context(t)}, txEvents) require.NoError(t, err) - assert.Equal(t, []byte(fmt.Sprintf("[\"%d\"]", 10*ic)), jb, "pr[0] %+v pr[1] %+v", pr[0], pr[1]) + newTxEvents := make(chan *ocr2aggregator.OCR2AggregatorNewTransmission) + _, err = ocrContract.WatchNewTransmission(&bind.WatchOpts{Start: &start, Context: testutils.Context(t)}, newTxEvents, []uint32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}) require.NoError(t, err) - }() - } - wg.Wait() - // 4 oracles reporting 0, 10, 20, 30. Answer should be 20 (results[4/2]). - gomega.NewGomegaWithT(t).Eventually(func() string { - answer, err := ocrContract.LatestAnswer(nil) - require.NoError(t, err) - return answer.String() - }, 1*time.Minute, 200*time.Millisecond).Should(gomega.Equal("20")) + go func() { + var newTxEvent *ocr2aggregator.OCR2AggregatorNewTransmission + select { + case txEvent := <-txEvents: + t.Logf("txEvent: %v", txEvent) + if newTxEvent != nil { + assert.Equal(t, txEvent.Epoch, uint32(newTxEvent.EpochAndRound.Uint64())) + } + case newTxEvent = <-newTxEvents: + t.Logf("newTxEvent: %v", newTxEvent) + } + }() - for _, app := range apps { - jobs, _, err := app.JobORM().FindJobs(0, 1000) - require.NoError(t, err) - // No spec errors - for _, j := range jobs { - ignore := 0 - for i := range j.JobSpecErrors { - // Non-fatal timing related error, ignore for testing. - if strings.Contains(j.JobSpecErrors[i].Description, "leader's phase conflicts tGrace timeout") { - ignore++ + for trial := 0; trial < 2; trial++ { + var retVal int + + metaLock.Lock() + returnData = 10 * (trial + 1) + retVal = returnData + for i := 0; i < 4; i++ { + expectedMeta[fmt.Sprintf("%d", returnData*i)] = struct{}{} + } + metaLock.Unlock() + + // Assert that all the OCR jobs get a run with valid values eventually. + var wg sync.WaitGroup + for i := 0; i < 4; i++ { + ic := i + wg.Add(1) + go func() { + defer wg.Done() + completedRuns, err := apps[ic].JobORM().FindPipelineRunIDsByJobID(jids[ic], 0, 1000) + require.NoError(t, err) + // Want at least 2 runs so we see all the metadata. + pr := cltest.WaitForPipelineComplete(t, ic, jids[ic], len(completedRuns)+2, 7, apps[ic].JobORM(), 2*time.Minute, 5*time.Second) + jb, err := pr[0].Outputs.MarshalJSON() + require.NoError(t, err) + assert.Equal(t, []byte(fmt.Sprintf("[\"%d\"]", retVal*ic)), jb, "pr[0] %+v pr[1] %+v", pr[0], pr[1]) + require.NoError(t, err) + }() + } + wg.Wait() + + // Trail #1: 4 oracles reporting 0, 10, 20, 30. Answer should be 20 (results[4/2]). + // Trial #2: 4 oracles reporting 0, 20, 40, 60. Answer should be 40 (results[4/2]). + gomega.NewGomegaWithT(t).Eventually(func() string { + answer, err := ocrContract.LatestAnswer(nil) + require.NoError(t, err) + return answer.String() + }, 1*time.Minute, 200*time.Millisecond).Should(gomega.Equal(fmt.Sprintf("%d", 2*retVal))) + + for _, app := range apps { + jobs, _, err := app.JobORM().FindJobs(0, 1000) + require.NoError(t, err) + // No spec errors + for _, j := range jobs { + ignore := 0 + for i := range j.JobSpecErrors { + // Non-fatal timing related error, ignore for testing. + if strings.Contains(j.JobSpecErrors[i].Description, "leader's phase conflicts tGrace timeout") { + ignore++ + } + } + require.Len(t, j.JobSpecErrors, ignore) + } + } + em := map[string]struct{}{} + metaLock.Lock() + maps.Copy(em, expectedMeta) + metaLock.Unlock() + assert.Len(t, em, 0, "expected metadata %v", em) + + t.Logf("======= Summary =======") + var roundId *big.Int + roundId, err = ocrContract.LatestRound(nil) + require.NoError(t, err) + for i := 0; i <= int(roundId.Int64()); i++ { + roundData, err := ocrContract.GetRoundData(nil, big.NewInt(int64(i))) + require.NoError(t, err) + t.Logf("RoundId: %d, AnsweredInRound: %d, Answer: %d, StartedAt: %v, UpdatedAt: %v", roundData.RoundId, roundData.AnsweredInRound, roundData.Answer, roundData.StartedAt, roundData.UpdatedAt) + } + + expectedAnswer := big.NewInt(2 * int64(retVal)) + + // Assert we can read the latest config digest and epoch after a report has been submitted. + contractABI, err := abi.JSON(strings.NewReader(ocr2aggregator.OCR2AggregatorABI)) + require.NoError(t, err) + apps[0].GetRelayers().LegacyEVMChains().Slice() + ct, err := evm.NewOCRContractTransmitter(ocrContractAddress, apps[0].GetRelayers().LegacyEVMChains().Slice()[0].Client(), contractABI, nil, apps[0].GetRelayers().LegacyEVMChains().Slice()[0].LogPoller(), lggr, nil) + require.NoError(t, err) + configDigest, epoch, err := ct.LatestConfigDigestAndEpoch(testutils.Context(t)) + require.NoError(t, err) + details, err := ocrContract.LatestConfigDetails(nil) + require.NoError(t, err) + assert.True(t, bytes.Equal(configDigest[:], details.ConfigDigest[:])) + digestAndEpoch, err := ocrContract.LatestConfigDigestAndEpoch(nil) + require.NoError(t, err) + assert.Equal(t, digestAndEpoch.Epoch, epoch) + latestTransmissionDetails, err := ocrContract.LatestTransmissionDetails(nil) + require.NoError(t, err) + assert.Equal(t, expectedAnswer, latestTransmissionDetails.LatestAnswer) + require.NoError(t, err) + newTransmissionEvents, err := ocrContract.FilterTransmitted(&bind.FilterOpts{Start: 0, End: nil}) + require.NoError(t, err) + for newTransmissionEvents.Next() { + assert.Equal(t, 3, newTransmissionEvents.Event.Epoch) } } - require.Len(t, j.JobSpecErrors, ignore) - } + }) } - em := map[string]struct{}{} - metaLock.Lock() - maps.Copy(em, expectedMeta) - metaLock.Unlock() - assert.Len(t, em, 0, "expected metadata %v", em) - - // Assert we can read the latest config digest and epoch after a report has been submitted. - contractABI, err := abi.JSON(strings.NewReader(ocr2aggregator.OCR2AggregatorABI)) - require.NoError(t, err) - apps[0].GetRelayers().LegacyEVMChains().Slice() - ct, err := evm.NewOCRContractTransmitter(ocrContractAddress, apps[0].GetRelayers().LegacyEVMChains().Slice()[0].Client(), contractABI, nil, apps[0].GetRelayers().LegacyEVMChains().Slice()[0].LogPoller(), lggr, nil) - require.NoError(t, err) - configDigest, epoch, err := ct.LatestConfigDigestAndEpoch(testutils.Context(t)) - require.NoError(t, err) - details, err := ocrContract.LatestConfigDetails(nil) - require.NoError(t, err) - assert.True(t, bytes.Equal(configDigest[:], details.ConfigDigest[:])) - digestAndEpoch, err := ocrContract.LatestConfigDigestAndEpoch(nil) - require.NoError(t, err) - assert.Equal(t, digestAndEpoch.Epoch, epoch) } func initOCR2(t *testing.T, lggr logger.Logger, b *backends.SimulatedBackend, diff --git a/core/scripts/go.mod b/core/scripts/go.mod index c2f57f9446f..8e566ef0f60 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -60,7 +60,6 @@ require ( github.com/blendle/zapdriver v1.3.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btcd/btcutil v1.1.3 // indirect - github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect github.com/bytedance/sonic v1.10.1 // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect @@ -237,11 +236,11 @@ require ( github.com/shirou/gopsutil/v3 v3.23.11 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 852567d01b8..98cc5715b31 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -169,6 +169,7 @@ github.com/blendle/zapdriver v1.3.1 h1:C3dydBOWYRiOk+B8X9IVZ5IOe+7cl+tGOexN4QqHf github.com/blendle/zapdriver v1.3.1/go.mod h1:mdXfREi6u5MArG4j9fewC+FGnXaBR+T4Ox4J2u4eHCc= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= +github.com/btcsuite/btcd v0.23.0 h1:V2/ZgjfDFIygAX3ZapeigkVBoVUtOJKSwrhZdlpSvaA= github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= @@ -179,8 +180,9 @@ github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUB github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.3 h1:SDlJ7bAm4ewvrmZtR0DaiYbQGdKPeaaIm7bM+qRhFeU= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.3/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= @@ -1148,16 +1150,16 @@ github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wp github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd h1:DsExL564kL/YwKWvUIMUKgdcpUE4Ryfi0aYIS/uXxmY= github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657 h1:WZuC6bBM30RoU4gosJmDWZWegSpGg+/+i4Hx5Dh5eLU= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657/go.mod h1:auN7dRwsZNRQhCvNwtRKCjrXypH7v6OeheN2mO4Qh5g= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d h1:MicPzjBP6vbcSLNDoCD6Y16/l/8O+e2jlmn7t6gQbhU= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d/go.mod h1:/gErwx/BBGs7gKXy3a3mfnNtL0TrmcODzVQkUvPTXtY= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a/go.mod h1:rioELYwPY2xBtzPRN/D08Y7iTPbIQEjPknYdJK51CzQ= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 h1:1GzOKT53e8N7ZPwsyf1hSbKsynZmXmLOIL3DMvGq9sc= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006/go.mod h1:tJLhL7gJ+V3+4N/yLxXIvJ0DAiuyqZCa31+2BSbw7zo= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 h1:YHvugDUtaJUzG3itrrvbmn5cU/aPaN2rSYIwWDnlN34= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= 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-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= diff --git a/core/services/job/models.go b/core/services/job/models.go index 50e986d8db1..0911657abdc 100644 --- a/core/services/job/models.go +++ b/core/services/job/models.go @@ -278,7 +278,21 @@ type JSONConfig map[string]interface{} // Bytes returns the raw bytes func (r JSONConfig) Bytes() []byte { - b, _ := json.Marshal(r) + var retCopy = make(JSONConfig, len(r)) + for key, value := range r { + copiedVal := value + // If the value is a json structure string, unmarshal it to preserve JSON structure + // e.g. instead of this {"key":"{\"nestedKey\":{\"nestedValue\":123}}"} + // we want this {"key":{"nestedKey":{"nestedValue":123}}}, + if strValue, ok := copiedVal.(string); ok { + if object, ok := asObject(strValue); ok { + copiedVal = object + } + } + retCopy[key] = copiedVal + } + + b, _ := json.Marshal(retCopy) return b } @@ -308,6 +322,11 @@ func (r JSONConfig) MercuryCredentialName() (string, error) { return name, nil } +func asObject(s string) (any, bool) { + var js map[string]interface{} + return js, json.Unmarshal([]byte(s), &js) == nil +} + var ForwardersSupportedPlugins = []types.OCR2PluginType{types.Median, types.DKG, types.OCR2VRF, types.OCR2Keeper, types.Functions} // OCR2OracleSpec defines the job spec for OCR2 jobs. diff --git a/core/services/ocr2/plugins/median/plugin.go b/core/services/ocr2/plugins/median/plugin.go deleted file mode 100644 index cad2099832d..00000000000 --- a/core/services/ocr2/plugins/median/plugin.go +++ /dev/null @@ -1,68 +0,0 @@ -package median - -import ( - "context" - - "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" - ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - - "github.com/smartcontractkit/chainlink-common/pkg/logger" - "github.com/smartcontractkit/chainlink-common/pkg/loop" - "github.com/smartcontractkit/chainlink-common/pkg/services" - "github.com/smartcontractkit/chainlink-common/pkg/types" -) - -type Plugin struct { - loop.Plugin - stop services.StopChan -} - -func NewPlugin(lggr logger.Logger) *Plugin { - return &Plugin{Plugin: loop.Plugin{Logger: lggr}, stop: make(services.StopChan)} -} - -func (p *Plugin) NewMedianFactory(ctx context.Context, provider types.MedianProvider, dataSource, juelsPerFeeCoin median.DataSource, errorLog loop.ErrorLog) (loop.ReportingPluginFactory, error) { - var ctxVals loop.ContextValues - ctxVals.SetValues(ctx) - lggr := logger.With(p.Logger, ctxVals.Args()...) - - factory := median.NumericalMedianFactory{ - ContractTransmitter: provider.MedianContract(), - DataSource: dataSource, - JuelsPerFeeCoinDataSource: juelsPerFeeCoin, - Logger: logger.NewOCRWrapper(lggr, true, func(msg string) { - ctx, cancelFn := p.stop.NewCtx() - defer cancelFn() - if err := errorLog.SaveError(ctx, msg); err != nil { - lggr.Errorw("Unable to save error", "err", msg) - } - }), - OnchainConfigCodec: provider.OnchainConfigCodec(), - ReportCodec: provider.ReportCodec(), - } - s := &reportingPluginFactoryService{lggr: logger.Named(lggr, "ReportingPluginFactory"), ReportingPluginFactory: factory} - - p.SubService(s) - - return s, nil -} - -type reportingPluginFactoryService struct { - services.StateMachine - lggr logger.Logger - ocrtypes.ReportingPluginFactory -} - -func (r *reportingPluginFactoryService) Name() string { return r.lggr.Name() } - -func (r *reportingPluginFactoryService) Start(ctx context.Context) error { - return r.StartOnce("ReportingPluginFactory", func() error { return nil }) -} - -func (r *reportingPluginFactoryService) Close() error { - return r.StopOnce("ReportingPluginFactory", func() error { return nil }) -} - -func (r *reportingPluginFactoryService) HealthReport() map[string]error { - return map[string]error{r.Name(): r.Healthy()} -} diff --git a/core/services/ocr2/plugins/median/services.go b/core/services/ocr2/plugins/median/services.go index 79abbc96a4b..bdf6feaed47 100644 --- a/core/services/ocr2/plugins/median/services.go +++ b/core/services/ocr2/plugins/median/services.go @@ -5,14 +5,9 @@ import ( "encoding/json" "errors" "fmt" - "math/big" "time" - "github.com/ethereum/go-ethereum/common" libocr "github.com/smartcontractkit/libocr/offchainreporting2plus" - ocr2types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - - mediantypes "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" "github.com/smartcontractkit/chainlink-common/pkg/loop" "github.com/smartcontractkit/chainlink-common/pkg/types" @@ -57,21 +52,6 @@ func (m *medianConfig) JobPipelineResultWriteQueueDepth() uint64 { return m.jobPipelineResultWriteQueueDepth } -// This wrapper avoids the need to modify the signature of NewMedianFactory in all of the non-evm -// relay repos as well as its primary definition in chainlink-common. Once ChainReader is implemented -// and working on all 4 blockchain families, we can remove the original MedianContract() method from -// MedianProvider and pass medianContract as a separate param to NewMedianFactory -type medianProviderWrapper struct { - types.MedianProvider - contract mediantypes.MedianContract -} - -// Override relay's implementation of MedianContract with product plugin's implementation of -// MedianContract, making use of product-agnostic ChainReader to read the contract instead of relay MedianContract -func (m medianProviderWrapper) MedianContract() mediantypes.MedianContract { - return m.contract -} - func NewMedianServices(ctx context.Context, jb job.Job, isNewlyCreatedJob bool, @@ -145,24 +125,10 @@ func NewMedianServices(ctx context.Context, CreatedAt: time.Now(), }, lggr) - medianPluginCmd := env.MedianPluginCmd.Get() - medianLoopEnabled := medianPluginCmd != "" - - // TODO BCF-2821 handle this properly as this blocks Solana chain reader dev - if !medianLoopEnabled && medianProvider.ChainReader() != nil { - lggr.Info("Chain Reader enabled") - medianProvider = medianProviderWrapper{ - medianProvider, // attach newer MedianContract which uses ChainReader - newMedianContract(provider.ChainReader(), common.HexToAddress(spec.ContractID)), - } - } else { - lggr.Info("Chain Reader disabled") - } - - if medianLoopEnabled { + if cmdName := env.MedianPluginCmd.Get(); cmdName != "" { // use unique logger names so we can use it to register a loop medianLggr := lggr.Named("Median").Named(spec.ContractID).Named(spec.GetID()) - cmdFn, telem, err2 := cfg.RegisterLOOP(medianLggr.Name(), medianPluginCmd) + cmdFn, telem, err2 := cfg.RegisterLOOP(medianLggr.Name(), cmdName) if err2 != nil { err = fmt.Errorf("failed to register loop: %w", err2) abort() @@ -192,49 +158,3 @@ func NewMedianServices(ctx context.Context, } return } - -type medianContract struct { - chainReader types.ChainReader - contract types.BoundContract -} - -type latestTransmissionDetailsResponse struct { - configDigest ocr2types.ConfigDigest - epoch uint32 - round uint8 - latestAnswer *big.Int - latestTimestamp time.Time -} - -type latestRoundRequested struct { - configDigest ocr2types.ConfigDigest - epoch uint32 - round uint8 -} - -func (m *medianContract) LatestTransmissionDetails(ctx context.Context) (configDigest ocr2types.ConfigDigest, epoch uint32, round uint8, latestAnswer *big.Int, latestTimestamp time.Time, err error) { - var resp latestTransmissionDetailsResponse - - err = m.chainReader.GetLatestValue(ctx, m.contract.Name, "LatestTransmissionDetails", nil, &resp) - if err != nil { - return - } - - return resp.configDigest, resp.epoch, resp.round, resp.latestAnswer, resp.latestTimestamp, err -} - -func (m *medianContract) LatestRoundRequested(ctx context.Context, lookback time.Duration) (configDigest ocr2types.ConfigDigest, epoch uint32, round uint8, err error) { - var resp latestRoundRequested - - err = m.chainReader.GetLatestValue(ctx, m.contract.Name, "LatestRoundRequested", map[string]string{}, &resp) - if err != nil { - return - } - - return resp.configDigest, resp.epoch, resp.round, err -} - -func newMedianContract(chainReader types.ChainReader, address common.Address) *medianContract { - contract := types.BoundContract{Address: address.String(), Name: "median", Pending: true} - return &medianContract{chainReader, contract} -} diff --git a/core/services/relay/evm/binding.go b/core/services/relay/evm/binding.go index 465a10b368d..32699516e18 100644 --- a/core/services/relay/evm/binding.go +++ b/core/services/relay/evm/binding.go @@ -130,7 +130,7 @@ func (e *eventBinding) GetLatestValue(_ context.Context, _ any) ([]byte, error) if err != nil { errStr := err.Error() if strings.Contains(errStr, "not found") || strings.Contains(errStr, "no rows") { - return nil, nil + return nil, fmt.Errorf("%w: %w", commontypes.ErrNotFound, err) } return nil, err } diff --git a/core/services/relay/evm/codec.go b/core/services/relay/evm/codec.go index b953d382d83..19b9c6e4f40 100644 --- a/core/services/relay/evm/codec.go +++ b/core/services/relay/evm/codec.go @@ -73,7 +73,7 @@ func (c *evmCodec) CreateType(itemType string, forEncoding bool) (any, error) { def, ok := itemTypes[itemType] if !ok { - return nil, commontypes.ErrInvalidType + return nil, fmt.Errorf("%w: cannot find type name %s", commontypes.ErrInvalidType, itemType) } return reflect.New(def.checkedType).Interface(), nil diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go index 1ef5d4f0591..17289844b4b 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/codec_entry.go @@ -61,7 +61,7 @@ func (entry *codecEntry) Init() error { func (entry *codecEntry) GetMaxSize(n int) (int, error) { if entry == nil { - return 0, commontypes.ErrInvalidType + return 0, fmt.Errorf("%w: nil entry", commontypes.ErrInvalidType) } return GetMaxSize(n, entry.Args) } @@ -104,7 +104,8 @@ func getNativeAndCheckedTypes(curType *abi.Type) (reflect.Type, reflect.Type, er } curType = curType.Elem default: - return nil, nil, commontypes.ErrInvalidType + return nil, nil, fmt.Errorf( + "%w: cannot create type for kind %v", commontypes.ErrInvalidType, curType.GetType().Kind()) } } base, ok := types.GetType(curType.String()) diff --git a/core/services/relay/evm/decoder.go b/core/services/relay/evm/decoder.go index 96f560ae9a8..6c7c1ca8949 100644 --- a/core/services/relay/evm/decoder.go +++ b/core/services/relay/evm/decoder.go @@ -2,6 +2,7 @@ package evm import ( "context" + "fmt" "reflect" "github.com/mitchellh/mapstructure" @@ -18,7 +19,7 @@ var _ commontypes.Decoder = &decoder{} func (m *decoder) Decode(ctx context.Context, raw []byte, into any, itemType string) error { info, ok := m.Definitions[itemType] if !ok { - return commontypes.ErrInvalidType + return fmt.Errorf("%w: cannot find definition for %s", commontypes.ErrInvalidType, itemType) } decode, err := extractDecoding(info, raw) @@ -53,7 +54,7 @@ func (m *decoder) GetMaxDecodingSize(ctx context.Context, n int, itemType string func extractDecoding(info *codecEntry, raw []byte) (any, error) { unpacked := map[string]any{} if err := info.Args.UnpackIntoMap(unpacked, raw); err != nil { - return nil, commontypes.ErrInvalidEncoding + return nil, fmt.Errorf("%w: %w: for args %#v", commontypes.ErrInvalidEncoding, err, info.Args) } var decode any = unpacked @@ -79,8 +80,13 @@ func mapstructureDecode(src, dest any) error { Result: dest, Squash: true, }) - if err != nil || mDecoder.Decode(src) != nil { - return commontypes.ErrInvalidType + if err != nil { + return fmt.Errorf("%w: %w", commontypes.ErrInvalidType, err) + } + + if err = mDecoder.Decode(src); err != nil { + return fmt.Errorf("%w: %w", commontypes.ErrInvalidType, err) } + return nil } diff --git a/core/services/relay/evm/encoder.go b/core/services/relay/evm/encoder.go index b3ad6d70fe6..58b6160bb8a 100644 --- a/core/services/relay/evm/encoder.go +++ b/core/services/relay/evm/encoder.go @@ -2,6 +2,7 @@ package evm import ( "context" + "fmt" "reflect" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" @@ -16,7 +17,7 @@ var _ commontypes.Encoder = &encoder{} func (e *encoder) Encode(ctx context.Context, item any, itemType string) ([]byte, error) { info, ok := e.Definitions[itemType] if !ok { - return nil, commontypes.ErrInvalidType + return nil, fmt.Errorf("%w: cannot find definition for %s", commontypes.ErrInvalidType, itemType) } if item == nil { @@ -42,7 +43,7 @@ func encode(item reflect.Value, info *codecEntry) ([]byte, error) { case reflect.Struct, reflect.Map: return encodeItem(item, info) default: - return nil, commontypes.ErrInvalidEncoding + return nil, fmt.Errorf("%w: cannot encode kind %v", commontypes.ErrInvalidType, item.Kind()) } } @@ -58,7 +59,7 @@ func encodeArray(item reflect.Value, info *codecEntry) ([]byte, error) { case reflect.Slice: native = reflect.MakeSlice(info.nativeType, length, length) default: - return nil, commontypes.ErrInvalidType + return nil, fmt.Errorf("%w: cannot encode %v as array", commontypes.ErrInvalidType, info.checkedType.Kind()) } checkedElm := info.checkedType.Elem() @@ -99,11 +100,12 @@ func encodeItem(item reflect.Value, info *codecEntry) ([]byte, error) { } func pack(info *codecEntry, values ...any) ([]byte, error) { - if bytes, err := info.Args.Pack(values...); err == nil { - withPrefix := make([]byte, 0, len(info.encodingPrefix)+len(bytes)) - withPrefix = append(withPrefix, info.encodingPrefix...) - return append(withPrefix, bytes...), nil + bytes, err := info.Args.Pack(values...) + if err != nil { + return nil, fmt.Errorf("%w: %w", commontypes.ErrInvalidType, err) } - return nil, commontypes.ErrInvalidType + withPrefix := make([]byte, 0, len(info.encodingPrefix)+len(bytes)) + withPrefix = append(withPrefix, info.encodingPrefix...) + return append(withPrefix, bytes...), nil } diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index f58a54712fd..9e3c20553ab 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -541,12 +541,12 @@ type medianProvider struct { func (p *medianProvider) Name() string { return p.lggr.Name() } func (p *medianProvider) Start(ctx context.Context) error { - startCloses := []services.StartClose{p.configWatcher, p.contractTransmitter, p.medianContract} + srvcs := []services.StartClose{p.configWatcher, p.contractTransmitter, p.medianContract} if p.chainReader != nil { - startCloses = append(startCloses, p.chainReader) + srvcs = append(srvcs, p.chainReader) } - return p.ms.Start(ctx, startCloses...) + return p.ms.Start(ctx, srvcs...) } func (p *medianProvider) Close() error { return p.ms.Close() } diff --git a/go.mod b/go.mod index d9176753cc7..1eaf13ad72a 100644 --- a/go.mod +++ b/go.mod @@ -66,11 +66,11 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 - github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 + github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 @@ -129,7 +129,6 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/blendle/zapdriver v1.3.1 // indirect - github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect github.com/bytedance/sonic v1.10.1 // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect diff --git a/go.sum b/go.sum index d5fb62247af..c57dcb04d86 100644 --- a/go.sum +++ b/go.sum @@ -176,8 +176,8 @@ github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.1.2 h1:XLMbX8JQEiwMcYft2EGi8zPUkoa0abKIU6/BJSRsjzQ= github.com/btcsuite/btcd/btcutil v1.1.2/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.3 h1:SDlJ7bAm4ewvrmZtR0DaiYbQGdKPeaaIm7bM+qRhFeU= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.3/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= @@ -1136,16 +1136,16 @@ github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wp github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd h1:DsExL564kL/YwKWvUIMUKgdcpUE4Ryfi0aYIS/uXxmY= github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657 h1:WZuC6bBM30RoU4gosJmDWZWegSpGg+/+i4Hx5Dh5eLU= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657/go.mod h1:auN7dRwsZNRQhCvNwtRKCjrXypH7v6OeheN2mO4Qh5g= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d h1:MicPzjBP6vbcSLNDoCD6Y16/l/8O+e2jlmn7t6gQbhU= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d/go.mod h1:/gErwx/BBGs7gKXy3a3mfnNtL0TrmcODzVQkUvPTXtY= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a/go.mod h1:rioELYwPY2xBtzPRN/D08Y7iTPbIQEjPknYdJK51CzQ= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 h1:1GzOKT53e8N7ZPwsyf1hSbKsynZmXmLOIL3DMvGq9sc= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006/go.mod h1:tJLhL7gJ+V3+4N/yLxXIvJ0DAiuyqZCa31+2BSbw7zo= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 h1:YHvugDUtaJUzG3itrrvbmn5cU/aPaN2rSYIwWDnlN34= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= 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-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= diff --git a/integration-tests/actions/ocr2_helpers.go b/integration-tests/actions/ocr2_helpers.go index 37db348815b..829d85a8498 100644 --- a/integration-tests/actions/ocr2_helpers.go +++ b/integration-tests/actions/ocr2_helpers.go @@ -22,6 +22,7 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" + "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/testhelpers" @@ -376,6 +377,7 @@ func StartNewOCR2Round( timeout time.Duration, logger zerolog.Logger, ) error { + time.Sleep(5 * time.Second) for i := 0; i < len(ocrInstances); i++ { err := ocrInstances[i].RequestNewRound() if err != nil { @@ -383,9 +385,12 @@ func StartNewOCR2Round( } ocrRound := contracts.NewOffchainAggregatorV2RoundConfirmer(ocrInstances[i], big.NewInt(roundNumber), timeout, logger) client.AddHeaderEventSubscription(ocrInstances[i].Address(), ocrRound) - err = client.WaitForEvents() + err = ocrRound.Wait() // wait for OCR Round to complete if err != nil { - return fmt.Errorf("failed to wait for event subscriptions of OCR instance %d: %w", i+1, err) + return fmt.Errorf("failed to wait for OCR Round %d to complete instance %d", roundNumber, i) + } + if !ocrRound.Complete() { + return fmt.Errorf("failed to complete OCR Round %d for ocr instance %d", roundNumber, i) } } return nil diff --git a/integration-tests/actions/ocr2_helpers_local.go b/integration-tests/actions/ocr2_helpers_local.go index 4a08921b8d1..ee1bef6fbdf 100644 --- a/integration-tests/actions/ocr2_helpers_local.go +++ b/integration-tests/actions/ocr2_helpers_local.go @@ -38,6 +38,7 @@ func CreateOCRv2JobsLocal( mockAdapterValue int, // Value to get from the mock server when querying the path chainId uint64, // EVM chain ID forwardingAllowed bool, + enableChainReaderAndCodec bool, ) error { // Collect P2P ID bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() @@ -125,6 +126,11 @@ func CreateOCRv2JobsLocal( P2PV2Bootstrappers: pq.StringArray{p2pV2Bootstrapper}, // bootstrap node key and address @bootstrap:6690 }, } + if enableChainReaderAndCodec { + ocrSpec.OCR2OracleSpec.RelayConfig["chainReader"] = `{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0,"output_modifications":[{"type":"rename","fields":{"LatestAnswer_":"LatestAnswer","LatestTimestamp_":"LatestTimestamp"}}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}` + ocrSpec.OCR2OracleSpec.RelayConfig["codec"] = `{"chainCodecConfig" :{"MedianReport":{"TypeAbi": "[{\"Name\": \"Timestamp\",\"Type\": \"uint32\"},{\"Name\": \"Observers\",\"Type\": \"bytes32\"},{\"Name\": \"Observations\",\"Type\": \"int192[]\"},{\"Name\": \"JuelsPerFeeCoin\",\"Type\": \"int192\"}]"}}}` + } + _, err = chainlinkNode.MustCreateJob(ocrSpec) if err != nil { return fmt.Errorf("creating OCR task job on OCR node have failed: %w", err) diff --git a/integration-tests/client/chainlink_models.go b/integration-tests/client/chainlink_models.go index e6e1de25e41..41fdebac94c 100644 --- a/integration-tests/client/chainlink_models.go +++ b/integration-tests/client/chainlink_models.go @@ -1110,7 +1110,12 @@ observationSource = """ {{$key}} = {{$value}}{{end}} {{end}} [relayConfig]{{range $key, $value := .RelayConfig}} -{{$key}} = {{$value}}{{end}} + {{if or (eq $key "chainReader") (eq $key "codec")}} + {{$key}} = '{{$value}}' + {{else}} + {{$key}} = {{$value}} + {{end}} +{{end}} ` return MarshallTemplate(specWrap, "OCR2 Job", ocr2TemplateString) } diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 1c55ce92c3a..dd60b97f64c 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -96,7 +96,6 @@ require ( github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/blendle/zapdriver v1.3.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect github.com/buger/jsonparser v1.1.1 // indirect github.com/bytedance/sonic v1.10.1 // indirect github.com/c2h5oh/datasize v0.0.0-20220606134207-859f65c6625b // indirect @@ -356,11 +355,11 @@ require ( github.com/shopspring/decimal v1.3.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect github.com/soheilhy/cmux v0.1.5 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 15f0bb18807..342b149ead1 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -222,8 +222,8 @@ github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.1.2 h1:XLMbX8JQEiwMcYft2EGi8zPUkoa0abKIU6/BJSRsjzQ= github.com/btcsuite/btcd/btcutil v1.1.2/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.3 h1:SDlJ7bAm4ewvrmZtR0DaiYbQGdKPeaaIm7bM+qRhFeU= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.3/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= @@ -1467,16 +1467,16 @@ github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wp github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd h1:DsExL564kL/YwKWvUIMUKgdcpUE4Ryfi0aYIS/uXxmY= github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679 h1:iu1pNbUoSDTrp+7BUtfTygZ2C0f5C2ZOBQhIoJjp+S0= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231128204301-ee4297eff679/go.mod h1:2Jx7bTEk4ujFQdsZpZq3A0BydvaVPs6mX8clUfxHOEM= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657 h1:WZuC6bBM30RoU4gosJmDWZWegSpGg+/+i4Hx5Dh5eLU= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657/go.mod h1:auN7dRwsZNRQhCvNwtRKCjrXypH7v6OeheN2mO4Qh5g= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d h1:MicPzjBP6vbcSLNDoCD6Y16/l/8O+e2jlmn7t6gQbhU= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231213175155-181d4a261f5d/go.mod h1:/gErwx/BBGs7gKXy3a3mfnNtL0TrmcODzVQkUvPTXtY= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a h1:JoyTazNcqXvZoMQjNfB0eapnlaoMS6pI0NeRvouRvog= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231130211003-6d1bb2f0b68a/go.mod h1:rioELYwPY2xBtzPRN/D08Y7iTPbIQEjPknYdJK51CzQ= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006 h1:1GzOKT53e8N7ZPwsyf1hSbKsynZmXmLOIL3DMvGq9sc= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231128204445-3d61b12a0006/go.mod h1:tJLhL7gJ+V3+4N/yLxXIvJ0DAiuyqZCa31+2BSbw7zo= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 h1:YHvugDUtaJUzG3itrrvbmn5cU/aPaN2rSYIwWDnlN34= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-testing-framework v1.22.1 h1:2XDxU1CTWJruUZv15/VPdaBT1W9ym4OI3I5baRbDhFg= github.com/smartcontractkit/chainlink-testing-framework v1.22.1/go.mod h1:yu6qqrppNJfutQV37fiSs4eS0uQP5QT0ebi3tlIgWN0= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/integration-tests/smoke/forwarders_ocr2_test.go b/integration-tests/smoke/forwarders_ocr2_test.go index 71d35508175..5bf7cc57030 100644 --- a/integration-tests/smoke/forwarders_ocr2_test.go +++ b/integration-tests/smoke/forwarders_ocr2_test.go @@ -78,7 +78,7 @@ func TestForwarderOCR2Basic(t *testing.T) { err = env.EVMClient.WaitForEvents() require.NoError(t, err, "Error waiting for events") - err = actions.CreateOCRv2JobsLocal(ocrInstances, bootstrapNode, workerNodes, env.MockAdapter, "ocr2", 5, env.EVMClient.GetChainID().Uint64(), true) + err = actions.CreateOCRv2JobsLocal(ocrInstances, bootstrapNode, workerNodes, env.MockAdapter, "ocr2", 5, env.EVMClient.GetChainID().Uint64(), true, false) require.NoError(t, err, "Error creating OCRv2 jobs with forwarders") err = env.EVMClient.WaitForEvents() require.NoError(t, err, "Error waiting for events") diff --git a/integration-tests/smoke/ocr2_test.go b/integration-tests/smoke/ocr2_test.go index 266fcea6382..b0a4950b5c9 100644 --- a/integration-tests/smoke/ocr2_test.go +++ b/integration-tests/smoke/ocr2_test.go @@ -23,12 +23,17 @@ import ( func TestOCRv2Basic(t *testing.T) { t.Parallel() + noMedianPlugin := map[string]string{string(env.MedianPluginCmd): ""} + medianPlugin := map[string]string{string(env.MedianPluginCmd): "chainlink-feeds"} for _, test := range []struct { - name string - env map[string]string + name string + env map[string]string + chainReaderAndCodec bool }{ - {"legacy", map[string]string{string(env.MedianPluginCmd): ""}}, - {"plugins", map[string]string{string(env.MedianPluginCmd): "chainlink-feeds"}}, + {"legacy", noMedianPlugin, false}, + {"legacy-chain-reader", noMedianPlugin, true}, + {"plugins", medianPlugin, false}, + {"plugins-chain-reader", medianPlugin, true}, } { test := test t.Run(test.name, func(t *testing.T) { @@ -81,7 +86,7 @@ func TestOCRv2Basic(t *testing.T) { aggregatorContracts, err := actions.DeployOCRv2Contracts(1, linkToken, env.ContractDeployer, transmitters, env.EVMClient, ocrOffchainOptions) require.NoError(t, err, "Error deploying OCRv2 aggregator contracts") - err = actions.CreateOCRv2JobsLocal(aggregatorContracts, bootstrapNode, workerNodes, env.MockAdapter, "ocr2", 5, env.EVMClient.GetChainID().Uint64(), false) + err = actions.CreateOCRv2JobsLocal(aggregatorContracts, bootstrapNode, workerNodes, env.MockAdapter, "ocr2", 5, env.EVMClient.GetChainID().Uint64(), false, test.chainReaderAndCodec) require.NoError(t, err, "Error creating OCRv2 jobs") ocrv2Config, err := actions.BuildMedianOCR2ConfigLocal(workerNodes, ocrOffchainOptions) @@ -163,7 +168,7 @@ func TestOCRv2Request(t *testing.T) { aggregatorContracts, err := actions.DeployOCRv2Contracts(1, linkToken, env.ContractDeployer, transmitters, env.EVMClient, ocrOffchainOptions) require.NoError(t, err, "Error deploying OCRv2 aggregator contracts") - err = actions.CreateOCRv2JobsLocal(aggregatorContracts, bootstrapNode, workerNodes, env.MockAdapter, "ocr2", 5, env.EVMClient.GetChainID().Uint64(), false) + err = actions.CreateOCRv2JobsLocal(aggregatorContracts, bootstrapNode, workerNodes, env.MockAdapter, "ocr2", 5, env.EVMClient.GetChainID().Uint64(), false, false) require.NoError(t, err, "Error creating OCRv2 jobs") ocrv2Config, err := actions.BuildMedianOCR2ConfigLocal(workerNodes, ocrOffchainOptions) @@ -239,7 +244,7 @@ func TestOCRv2JobReplacement(t *testing.T) { aggregatorContracts, err := actions.DeployOCRv2Contracts(1, linkToken, env.ContractDeployer, transmitters, env.EVMClient, ocrOffchainOptions) require.NoError(t, err, "Error deploying OCRv2 aggregator contracts") - err = actions.CreateOCRv2JobsLocal(aggregatorContracts, bootstrapNode, workerNodes, env.MockAdapter, "ocr2", 5, env.EVMClient.GetChainID().Uint64(), false) + err = actions.CreateOCRv2JobsLocal(aggregatorContracts, bootstrapNode, workerNodes, env.MockAdapter, "ocr2", 5, env.EVMClient.GetChainID().Uint64(), false, false) require.NoError(t, err, "Error creating OCRv2 jobs") ocrv2Config, err := actions.BuildMedianOCR2ConfigLocal(workerNodes, ocrOffchainOptions) @@ -275,7 +280,7 @@ func TestOCRv2JobReplacement(t *testing.T) { err = actions.DeleteBridges(nodeClients) require.NoError(t, err) - err = actions.CreateOCRv2JobsLocal(aggregatorContracts, bootstrapNode, workerNodes, env.MockAdapter, "ocr2", 15, env.EVMClient.GetChainID().Uint64(), false) + err = actions.CreateOCRv2JobsLocal(aggregatorContracts, bootstrapNode, workerNodes, env.MockAdapter, "ocr2", 15, env.EVMClient.GetChainID().Uint64(), false, false) require.NoError(t, err, "Error creating OCRv2 jobs") err = actions.WatchNewOCR2Round(3, aggregatorContracts, env.EVMClient, time.Minute*3, l) From 0e7e10a110362e4fa8e2175f7a689dbefafb9d90 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 22 Dec 2023 15:14:10 -0500 Subject: [PATCH 049/112] lint again --- core/internal/features/ocr2/features_ocr2_test.go | 13 +++++++++---- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/core/internal/features/ocr2/features_ocr2_test.go b/core/internal/features/ocr2/features_ocr2_test.go index 540306802d4..1f0c480ec08 100644 --- a/core/internal/features/ocr2/features_ocr2_test.go +++ b/core/internal/features/ocr2/features_ocr2_test.go @@ -45,6 +45,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "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/keys/keystest" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/testhelpers" @@ -410,11 +411,13 @@ juelsPerFeeCoinSource = """ wg.Add(1) go func() { defer wg.Done() - completedRuns, err := apps[ic].JobORM().FindPipelineRunIDsByJobID(jids[ic], 0, 1000) + var completedRuns []int64 + completedRuns, err = apps[ic].JobORM().FindPipelineRunIDsByJobID(jids[ic], 0, 1000) require.NoError(t, err) // Want at least 2 runs so we see all the metadata. pr := cltest.WaitForPipelineComplete(t, ic, jids[ic], len(completedRuns)+2, 7, apps[ic].JobORM(), 2*time.Minute, 5*time.Second) - jb, err := pr[0].Outputs.MarshalJSON() + var jb []byte + jb, err = pr[0].Outputs.MarshalJSON() require.NoError(t, err) assert.Equal(t, []byte(fmt.Sprintf("[\"%d\"]", retVal*ic)), jb, "pr[0] %+v pr[1] %+v", pr[0], pr[1]) require.NoError(t, err) @@ -425,13 +428,15 @@ juelsPerFeeCoinSource = """ // Trail #1: 4 oracles reporting 0, 10, 20, 30. Answer should be 20 (results[4/2]). // Trial #2: 4 oracles reporting 0, 20, 40, 60. Answer should be 40 (results[4/2]). gomega.NewGomegaWithT(t).Eventually(func() string { - answer, err := ocrContract.LatestAnswer(nil) + var answer *big.Int + answer, err = ocrContract.LatestAnswer(nil) require.NoError(t, err) return answer.String() }, 1*time.Minute, 200*time.Millisecond).Should(gomega.Equal(fmt.Sprintf("%d", 2*retVal))) for _, app := range apps { - jobs, _, err := app.JobORM().FindJobs(0, 1000) + var jobs []job.Job + jobs, _, err = app.JobORM().FindJobs(0, 1000) require.NoError(t, err) // No spec errors for _, j := range jobs { diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 8e566ef0f60..fccf4f1e858 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -236,7 +236,7 @@ require ( github.com/shirou/gopsutil/v3 v3.23.11 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657 // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 98cc5715b31..2a38d536e7c 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1150,8 +1150,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wp github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd h1:DsExL564kL/YwKWvUIMUKgdcpUE4Ryfi0aYIS/uXxmY= github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657 h1:WZuC6bBM30RoU4gosJmDWZWegSpGg+/+i4Hx5Dh5eLU= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657/go.mod h1:auN7dRwsZNRQhCvNwtRKCjrXypH7v6OeheN2mO4Qh5g= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= diff --git a/go.mod b/go.mod index 1eaf13ad72a..1e8f70b7524 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657 + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 diff --git a/go.sum b/go.sum index c57dcb04d86..82616468730 100644 --- a/go.sum +++ b/go.sum @@ -1136,8 +1136,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wp github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd h1:DsExL564kL/YwKWvUIMUKgdcpUE4Ryfi0aYIS/uXxmY= github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657 h1:WZuC6bBM30RoU4gosJmDWZWegSpGg+/+i4Hx5Dh5eLU= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657/go.mod h1:auN7dRwsZNRQhCvNwtRKCjrXypH7v6OeheN2mO4Qh5g= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index dd60b97f64c..c62080b3fc5 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -355,7 +355,7 @@ require ( github.com/shopspring/decimal v1.3.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657 // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 342b149ead1..f7e03c134c2 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1467,8 +1467,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wp github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd h1:DsExL564kL/YwKWvUIMUKgdcpUE4Ryfi0aYIS/uXxmY= github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657 h1:WZuC6bBM30RoU4gosJmDWZWegSpGg+/+i4Hx5Dh5eLU= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231221191441-469c5f7cd657/go.mod h1:auN7dRwsZNRQhCvNwtRKCjrXypH7v6OeheN2mO4Qh5g= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= From 817f81df4b6835ae7fbbc0dce01d6637a8f28317 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 22 Dec 2023 15:44:47 -0500 Subject: [PATCH 050/112] Update solana to point to newer other ones in its own integration tests... --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index fccf4f1e858..562e8795744 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -239,7 +239,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 2a38d536e7c..02b52a42092 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1156,8 +1156,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 h1:YHvugDUtaJUzG3itrrvbmn5cU/aPaN2rSYIwWDnlN34= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209 h1:JdbSJE11FRS7gB9Tc/bRUrbTtFobkAbXgoFwNsQ6pMg= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/go.mod b/go.mod index 1e8f70b7524..b9c9e8340fc 100644 --- a/go.mod +++ b/go.mod @@ -69,7 +69,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 diff --git a/go.sum b/go.sum index 82616468730..e892f13190f 100644 --- a/go.sum +++ b/go.sum @@ -1142,8 +1142,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 h1:YHvugDUtaJUzG3itrrvbmn5cU/aPaN2rSYIwWDnlN34= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209 h1:JdbSJE11FRS7gB9Tc/bRUrbTtFobkAbXgoFwNsQ6pMg= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index c62080b3fc5..0365550528a 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -358,7 +358,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index f7e03c134c2..28c65bc4d8c 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1473,8 +1473,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181 h1:YHvugDUtaJUzG3itrrvbmn5cU/aPaN2rSYIwWDnlN34= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231221190253-3d670c36e181/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209 h1:JdbSJE11FRS7gB9Tc/bRUrbTtFobkAbXgoFwNsQ6pMg= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-testing-framework v1.22.1 h1:2XDxU1CTWJruUZv15/VPdaBT1W9ym4OI3I5baRbDhFg= From fa1325e3a88cbea24b51d58dcba253aa3cd5643a Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 22 Dec 2023 15:48:38 -0500 Subject: [PATCH 051/112] linter --- common/txmgr/confirmer.go | 3 ++- core/chains/evm/logpoller/log_poller.go | 8 +++++--- core/internal/cltest/cltest.go | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/common/txmgr/confirmer.go b/common/txmgr/confirmer.go index ab5e480b4e1..d55f982c11f 100644 --- a/common/txmgr/confirmer.go +++ b/common/txmgr/confirmer.go @@ -12,9 +12,10 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - commonhex "github.com/smartcontractkit/chainlink-common/pkg/utils/hex" "go.uber.org/multierr" + commonhex "github.com/smartcontractkit/chainlink-common/pkg/utils/hex" + "github.com/smartcontractkit/chainlink-common/pkg/chains/label" "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink-common/pkg/services" diff --git a/core/chains/evm/logpoller/log_poller.go b/core/chains/evm/logpoller/log_poller.go index 93d1def5d88..f82cec62b74 100644 --- a/core/chains/evm/logpoller/log_poller.go +++ b/core/chains/evm/logpoller/log_poller.go @@ -659,9 +659,11 @@ func (lp *logPoller) backfill(ctx context.Context, start, end int64) error { gethLogs, err := lp.ec.FilterLogs(ctx, lp.Filter(big.NewInt(from), big.NewInt(to), nil)) if err != nil { var rpcErr client.JsonError - if !errors.As(err, &rpcErr) || rpcErr.Code != jsonRpcLimitExceeded { - lp.lggr.Errorw("Unable to query for logs", "err", err, "from", from, "to", to) - return err + if errors.As(err, &rpcErr) { + if rpcErr.Code != jsonRpcLimitExceeded { + lp.lggr.Errorw("Unable to query for logs", "err", err, "from", from, "to", to) + return err + } } if batchSize == 1 { lp.lggr.Criticalw("Too many log results in a single block, failed to retrieve logs! Node may be running in a degraded state.", "err", err, "from", from, "to", to, "LogBackfillBatchSize", lp.backfillBatchSize) diff --git a/core/internal/cltest/cltest.go b/core/internal/cltest/cltest.go index 44ba041d31d..fceb58ccdab 100644 --- a/core/internal/cltest/cltest.go +++ b/core/internal/cltest/cltest.go @@ -341,7 +341,7 @@ func NewApplicationWithConfig(t testing.TB, cfg chainlink.GeneralConfig, flagsAn } keyStore := keystore.NewInMemory(db, utils.FastScryptParams, lggr, cfg.Database()) - + mailMon := mailbox.NewMonitor(cfg.AppID().String(), lggr.Named("Mailbox")) loopRegistry := plugins.NewLoopRegistry(lggr, nil) From 406b8b4f099bad09a73a764a226167b0e7e2b76c Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 22 Dec 2023 16:29:27 -0500 Subject: [PATCH 052/112] . --- .../features/ocr2/features_ocr2_test.go | 62 +++++++++---------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/core/internal/features/ocr2/features_ocr2_test.go b/core/internal/features/ocr2/features_ocr2_test.go index 1f0c480ec08..7090da1dd4b 100644 --- a/core/internal/features/ocr2/features_ocr2_test.go +++ b/core/internal/features/ocr2/features_ocr2_test.go @@ -45,7 +45,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "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/keys/keystest" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/testhelpers" @@ -411,16 +410,14 @@ juelsPerFeeCoinSource = """ wg.Add(1) go func() { defer wg.Done() - var completedRuns []int64 - completedRuns, err = apps[ic].JobORM().FindPipelineRunIDsByJobID(jids[ic], 0, 1000) - require.NoError(t, err) + completedRuns, err2 := apps[ic].JobORM().FindPipelineRunIDsByJobID(jids[ic], 0, 1000) + require.NoError(t, err2) // Want at least 2 runs so we see all the metadata. pr := cltest.WaitForPipelineComplete(t, ic, jids[ic], len(completedRuns)+2, 7, apps[ic].JobORM(), 2*time.Minute, 5*time.Second) - var jb []byte - jb, err = pr[0].Outputs.MarshalJSON() - require.NoError(t, err) + jb, err2 := pr[0].Outputs.MarshalJSON() + require.NoError(t, err2) assert.Equal(t, []byte(fmt.Sprintf("[\"%d\"]", retVal*ic)), jb, "pr[0] %+v pr[1] %+v", pr[0], pr[1]) - require.NoError(t, err) + require.NoError(t, err2) }() } wg.Wait() @@ -428,16 +425,14 @@ juelsPerFeeCoinSource = """ // Trail #1: 4 oracles reporting 0, 10, 20, 30. Answer should be 20 (results[4/2]). // Trial #2: 4 oracles reporting 0, 20, 40, 60. Answer should be 40 (results[4/2]). gomega.NewGomegaWithT(t).Eventually(func() string { - var answer *big.Int - answer, err = ocrContract.LatestAnswer(nil) - require.NoError(t, err) + answer, err2 := ocrContract.LatestAnswer(nil) + require.NoError(t, err2) return answer.String() }, 1*time.Minute, 200*time.Millisecond).Should(gomega.Equal(fmt.Sprintf("%d", 2*retVal))) for _, app := range apps { - var jobs []job.Job - jobs, _, err = app.JobORM().FindJobs(0, 1000) - require.NoError(t, err) + jobs, _, err2 := app.JobORM().FindJobs(0, 1000) + require.NoError(t, err2) // No spec errors for _, j := range jobs { ignore := 0 @@ -457,37 +452,36 @@ juelsPerFeeCoinSource = """ assert.Len(t, em, 0, "expected metadata %v", em) t.Logf("======= Summary =======") - var roundId *big.Int - roundId, err = ocrContract.LatestRound(nil) - require.NoError(t, err) + roundId, err2 := ocrContract.LatestRound(nil) + require.NoError(t, err2) for i := 0; i <= int(roundId.Int64()); i++ { - roundData, err := ocrContract.GetRoundData(nil, big.NewInt(int64(i))) - require.NoError(t, err) + roundData, err3 := ocrContract.GetRoundData(nil, big.NewInt(int64(i))) + require.NoError(t, err3) t.Logf("RoundId: %d, AnsweredInRound: %d, Answer: %d, StartedAt: %v, UpdatedAt: %v", roundData.RoundId, roundData.AnsweredInRound, roundData.Answer, roundData.StartedAt, roundData.UpdatedAt) } expectedAnswer := big.NewInt(2 * int64(retVal)) // Assert we can read the latest config digest and epoch after a report has been submitted. - contractABI, err := abi.JSON(strings.NewReader(ocr2aggregator.OCR2AggregatorABI)) - require.NoError(t, err) + contractABI, err2 := abi.JSON(strings.NewReader(ocr2aggregator.OCR2AggregatorABI)) + require.NoError(t, err2) apps[0].GetRelayers().LegacyEVMChains().Slice() - ct, err := evm.NewOCRContractTransmitter(ocrContractAddress, apps[0].GetRelayers().LegacyEVMChains().Slice()[0].Client(), contractABI, nil, apps[0].GetRelayers().LegacyEVMChains().Slice()[0].LogPoller(), lggr, nil) - require.NoError(t, err) - configDigest, epoch, err := ct.LatestConfigDigestAndEpoch(testutils.Context(t)) - require.NoError(t, err) - details, err := ocrContract.LatestConfigDetails(nil) - require.NoError(t, err) + ct, err2 := evm.NewOCRContractTransmitter(ocrContractAddress, apps[0].GetRelayers().LegacyEVMChains().Slice()[0].Client(), contractABI, nil, apps[0].GetRelayers().LegacyEVMChains().Slice()[0].LogPoller(), lggr, nil) + require.NoError(t, err2) + configDigest, epoch, err2 := ct.LatestConfigDigestAndEpoch(testutils.Context(t)) + require.NoError(t, err2) + details, err2 := ocrContract.LatestConfigDetails(nil) + require.NoError(t, err2) assert.True(t, bytes.Equal(configDigest[:], details.ConfigDigest[:])) - digestAndEpoch, err := ocrContract.LatestConfigDigestAndEpoch(nil) - require.NoError(t, err) + digestAndEpoch, err2 := ocrContract.LatestConfigDigestAndEpoch(nil) + require.NoError(t, err2) assert.Equal(t, digestAndEpoch.Epoch, epoch) - latestTransmissionDetails, err := ocrContract.LatestTransmissionDetails(nil) - require.NoError(t, err) + latestTransmissionDetails, err2 := ocrContract.LatestTransmissionDetails(nil) + require.NoError(t, err2) assert.Equal(t, expectedAnswer, latestTransmissionDetails.LatestAnswer) - require.NoError(t, err) - newTransmissionEvents, err := ocrContract.FilterTransmitted(&bind.FilterOpts{Start: 0, End: nil}) - require.NoError(t, err) + require.NoError(t, err2) + newTransmissionEvents, err2 := ocrContract.FilterTransmitted(&bind.FilterOpts{Start: 0, End: nil}) + require.NoError(t, err2) for newTransmissionEvents.Next() { assert.Equal(t, 3, newTransmissionEvents.Event.Epoch) } From 81a255cc62f723e2d6f5bba03878455b0e3a65c9 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 22 Dec 2023 16:43:21 -0500 Subject: [PATCH 053/112] newer solana again --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 562e8795744..d161a307415 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -239,7 +239,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 02b52a42092..671c02d1127 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1156,8 +1156,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209 h1:JdbSJE11FRS7gB9Tc/bRUrbTtFobkAbXgoFwNsQ6pMg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce h1:OAOGLPnbVBTl+S05I5LrA7IbBzFCD+VcbHrO3pUlbcQ= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/go.mod b/go.mod index b9c9e8340fc..5f052715e86 100644 --- a/go.mod +++ b/go.mod @@ -69,7 +69,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 diff --git a/go.sum b/go.sum index e892f13190f..b2617de5b89 100644 --- a/go.sum +++ b/go.sum @@ -1142,8 +1142,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209 h1:JdbSJE11FRS7gB9Tc/bRUrbTtFobkAbXgoFwNsQ6pMg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce h1:OAOGLPnbVBTl+S05I5LrA7IbBzFCD+VcbHrO3pUlbcQ= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 0365550528a..d6d3e71201f 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -358,7 +358,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 28c65bc4d8c..85c9208bfe4 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1473,8 +1473,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209 h1:JdbSJE11FRS7gB9Tc/bRUrbTtFobkAbXgoFwNsQ6pMg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222204341-f7790636e209/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce h1:OAOGLPnbVBTl+S05I5LrA7IbBzFCD+VcbHrO3pUlbcQ= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-testing-framework v1.22.1 h1:2XDxU1CTWJruUZv15/VPdaBT1W9ym4OI3I5baRbDhFg= From d82544851ab4250e78932a44b44064f182a61623 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 22 Dec 2023 17:04:52 -0500 Subject: [PATCH 054/112] newer solana again... --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index d161a307415..dfd66d05f5c 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -239,7 +239,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 671c02d1127..d950fe52368 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1156,8 +1156,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce h1:OAOGLPnbVBTl+S05I5LrA7IbBzFCD+VcbHrO3pUlbcQ= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/go.mod b/go.mod index 5f052715e86..d79ee3dac17 100644 --- a/go.mod +++ b/go.mod @@ -69,7 +69,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 diff --git a/go.sum b/go.sum index b2617de5b89..001a2444264 100644 --- a/go.sum +++ b/go.sum @@ -1142,8 +1142,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce h1:OAOGLPnbVBTl+S05I5LrA7IbBzFCD+VcbHrO3pUlbcQ= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index d6d3e71201f..d3757cfe14a 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -358,7 +358,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 85c9208bfe4..e98b1552f96 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1473,8 +1473,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce h1:OAOGLPnbVBTl+S05I5LrA7IbBzFCD+VcbHrO3pUlbcQ= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222214113-946ba098fdce/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-testing-framework v1.22.1 h1:2XDxU1CTWJruUZv15/VPdaBT1W9ym4OI3I5baRbDhFg= From 1b520bccf0f3d94e45735bb3cc49b4612060d4c3 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 22 Dec 2023 20:27:53 -0500 Subject: [PATCH 055/112] Fix bug with unnamed return params and invalid params containing the same name multiple times --- core/services/relay/evm/codec_entry.go | 9 +++++++++ core/services/relay/evm/codec_entry_test.go | 15 +++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go index 17289844b4b..049c2196de8 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/codec_entry.go @@ -42,14 +42,23 @@ func (entry *codecEntry) Init() error { return nil } + seenNames := map[string]bool{} for i, arg := range args { tmp := arg.Type nativeArg, checkedArg, err := getNativeAndCheckedTypes(&tmp) if err != nil { return err } + if len(arg.Name) == 0 { + return fmt.Errorf("%w: empty field names are not supported for multiple returns", commontypes.ErrInvalidType) + } + tag := reflect.StructTag(`json:"` + arg.Name + `"`) name := strings.ToUpper(arg.Name[:1]) + arg.Name[1:] + if seenNames[name] { + return fmt.Errorf("%w: duplicate field name %s, first letter casing is ignored", commontypes.ErrInvalidType, name) + } + seenNames[name] = true native[i] = reflect.StructField{Name: name, Type: nativeArg, Tag: tag} checked[i] = reflect.StructField{Name: name, Type: checkedArg, Tag: tag} } diff --git a/core/services/relay/evm/codec_entry_test.go b/core/services/relay/evm/codec_entry_test.go index 600afcf6669..986ee408143 100644 --- a/core/services/relay/evm/codec_entry_test.go +++ b/core/services/relay/evm/codec_entry_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -152,4 +153,18 @@ func TestCodecEntry(t *testing.T) { fmt.Printf("%+v\n", address.GetType()) require.NoError(t, entry.Init()) }) + + t.Run("Multiple unnamed parameters are not supported", func(t *testing.T) { + anyType, err := abi.NewType("int16[3]", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := codecEntry{Args: abi.Arguments{{Name: "", Type: anyType}, {Name: "", Type: anyType}}} + assert.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidType)) + }) + + t.Run("Invalid parameters are not supported", func(t *testing.T) { + anyType, err := abi.NewType("int16[3]", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := codecEntry{Args: abi.Arguments{{Name: "Name", Type: anyType}, {Name: "Name", Type: anyType}}} + assert.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidType)) + }) } From 0e90ef4189ac57a857a847601003fc5698b8d3b3 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 22 Dec 2023 20:34:27 -0500 Subject: [PATCH 056/112] Add generated files to sonar exclude --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index c40b5f361e1..df3218c6544 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -5,7 +5,7 @@ sonar.python.version=3.8 # Full exclusions from the static analysis sonar.exclusions=**/node_modules/**/*,**/mocks/**/*, **/testdata/**/*, **/contracts/typechain/**/*, **/contracts/artifacts/**/*, **/contracts/cache/**/*, **/contracts/scripts/**/*, **/generated/**/*, **/fixtures/**/*, **/docs/**/*, **/tools/**/*, **/*.pb.go, **/*report.xml, **/*.config.ts, **/*.txt, **/*.abi, **/*.bin, **/*_codecgen.go # Coverage exclusions -sonar.coverage.exclusions=**/*.test.ts, **/*_test.go, **/contracts/test/**/*, **/contracts/**/tests/**/*, **/core/**/testutils/**/*, **/core/**/mocks/**/*, **/core/**/cltest/**/*, **/integration-tests/**/*, **/generated/**/*, **/core/scripts**/* , **/*.pb.go, ./plugins/**/*, **/main.go, **/0195_add_not_null_to_evm_chain_id_in_job_specs.go +sonar.coverage.exclusions=**/*.test.ts, **/*_test.go, **/contracts/test/**/*, **/contracts/**/tests/**/*, **/core/**/testutils/**/*, **/core/**/mocks/**/*, **/core/**/cltest/**/*, **/integration-tests/**/*, **/generated/**/*, **/core/scripts**/* , **/*.pb.go, ./plugins/**/*, **/main.go, **/0195_add_not_null_to_evm_chain_id_in_job_specs.go core/services/relay/evm/types/*_gen.go # Duplication exclusions sonar.cpd.exclusions=**/contracts/**/*.sol, **/config.go, /core/services/ocr2/plugins/ocr2keeper/evm*/* From c4a02825673210f33376fb45d42298bca7cd9817 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 22 Dec 2023 20:41:17 -0500 Subject: [PATCH 057/112] Update sonar again --- sonar-project.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index df3218c6544..cbc3640779b 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -3,9 +3,9 @@ sonar.sources=. sonar.python.version=3.8 # Full exclusions from the static analysis -sonar.exclusions=**/node_modules/**/*,**/mocks/**/*, **/testdata/**/*, **/contracts/typechain/**/*, **/contracts/artifacts/**/*, **/contracts/cache/**/*, **/contracts/scripts/**/*, **/generated/**/*, **/fixtures/**/*, **/docs/**/*, **/tools/**/*, **/*.pb.go, **/*report.xml, **/*.config.ts, **/*.txt, **/*.abi, **/*.bin, **/*_codecgen.go +sonar.exclusions=**/node_modules/**/*,**/mocks/**/*, **/testdata/**/*, **/contracts/typechain/**/*, **/contracts/artifacts/**/*, **/contracts/cache/**/*, **/contracts/scripts/**/*, **/generated/**/*, **/fixtures/**/*, **/docs/**/*, **/tools/**/*, **/*.pb.go, **/*report.xml, **/*.config.ts, **/*.txt, **/*.abi, **/*.bin, **/*_codecgen.go core/services/relay/evm/types/*_gen.go core/services/relay/evm/types/gen/main.go core/services/relay/evm/testfiles/* # Coverage exclusions -sonar.coverage.exclusions=**/*.test.ts, **/*_test.go, **/contracts/test/**/*, **/contracts/**/tests/**/*, **/core/**/testutils/**/*, **/core/**/mocks/**/*, **/core/**/cltest/**/*, **/integration-tests/**/*, **/generated/**/*, **/core/scripts**/* , **/*.pb.go, ./plugins/**/*, **/main.go, **/0195_add_not_null_to_evm_chain_id_in_job_specs.go core/services/relay/evm/types/*_gen.go +sonar.coverage.exclusions=**/*.test.ts, **/*_test.go, **/contracts/test/**/*, **/contracts/**/tests/**/*, **/core/**/testutils/**/*, **/core/**/mocks/**/*, **/core/**/cltest/**/*, **/integration-tests/**/*, **/generated/**/*, **/core/scripts**/* , **/*.pb.go, ./plugins/**/*, **/main.go, **/0195_add_not_null_to_evm_chain_id_in_job_specs.go # Duplication exclusions sonar.cpd.exclusions=**/contracts/**/*.sol, **/config.go, /core/services/ocr2/plugins/ocr2keeper/evm*/* From f7629a31cb815b23e7127c5329877dd478fb26b0 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 22 Dec 2023 20:50:31 -0500 Subject: [PATCH 058/112] Methods per sonar suggestions --- core/services/relay/evm/decoder.go | 18 ++++++----- core/services/relay/evm/size_helper.go | 42 ++++++++++++++------------ 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/core/services/relay/evm/decoder.go b/core/services/relay/evm/decoder.go index 6c7c1ca8949..8f689a58a38 100644 --- a/core/services/relay/evm/decoder.go +++ b/core/services/relay/evm/decoder.go @@ -30,13 +30,7 @@ func (m *decoder) Decode(ctx context.Context, raw []byte, into any, itemType str rDecode := reflect.ValueOf(decode) switch rDecode.Kind() { case reflect.Array: - iInto := reflect.Indirect(reflect.ValueOf(into)) - length := rDecode.Len() - if length != iInto.Len() { - return commontypes.ErrWrongNumberOfElements - } - iInto.Set(reflect.New(iInto.Type()).Elem()) - return setElements(length, rDecode, iInto) + return m.decodeArray(into, rDecode) case reflect.Slice: iInto := reflect.Indirect(reflect.ValueOf(into)) length := rDecode.Len() @@ -47,6 +41,16 @@ func (m *decoder) Decode(ctx context.Context, raw []byte, into any, itemType str } } +func (m *decoder) decodeArray(into any, rDecode reflect.Value) error { + iInto := reflect.Indirect(reflect.ValueOf(into)) + length := rDecode.Len() + if length != iInto.Len() { + return commontypes.ErrWrongNumberOfElements + } + iInto.Set(reflect.New(iInto.Type()).Elem()) + return setElements(length, rDecode, iInto) +} + func (m *decoder) GetMaxDecodingSize(ctx context.Context, n int, itemType string) (int, error) { return m.Definitions[itemType].GetMaxSize(n) } diff --git a/core/services/relay/evm/size_helper.go b/core/services/relay/evm/size_helper.go index f14abd7d784..c6ff3d82f38 100644 --- a/core/services/relay/evm/size_helper.go +++ b/core/services/relay/evm/size_helper.go @@ -39,27 +39,31 @@ func getTypeSize(n int, t *abi.Type, dynamicTypeAllowed bool, isNested bool) (in totalSize := (n + 31) / 32 * 32 // strings and bytes are padded to 32 bytes return 32 /*header*/ + 32 /*footer*/ + totalSize, true, nil case abi.TupleTy: - // No header or footer, because if the tuple is dynamically sized we would need to know the inner slice sizes - // so it would return error for that element. - size := 0 - dynamic := false - for _, elm := range t.TupleElems { - argSize, dynamicArg, err := getTypeSize(n, elm, !isNested, true) - if err != nil { - return 0, false, err - } - dynamic = dynamic || dynamicArg - size += argSize - } - - if dynamic { - // offset for the element needs to be included there are dynamic elements - size += 32 - } - - return size, dynamic, nil + return getTupleSize(n, t, isNested) default: // types are padded to 32 bytes return 32, false, nil } } + +func getTupleSize(n int, t *abi.Type, isNested bool) (int, bool, error) { + // No header or footer, because if the tuple is dynamically sized we would need to know the inner slice sizes + // so it would return error for that element. + size := 0 + dynamic := false + for _, elm := range t.TupleElems { + argSize, dynamicArg, err := getTypeSize(n, elm, !isNested, true) + if err != nil { + return 0, false, err + } + dynamic = dynamic || dynamicArg + size += argSize + } + + if dynamic { + // offset for the element needs to be included there are dynamic elements + size += 32 + } + + return size, dynamic, nil +} From 0d8d3b70a37d4761abc72bf00d8657398854c912 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 22 Dec 2023 21:01:33 -0500 Subject: [PATCH 059/112] Reanme function and type per PR feedback --- byte_types_gen.go | 300 +++ core/services/relay/evm/codec_entry.go | 2 +- core/services/relay/evm/types/abi_types.go | 6 +- .../relay/evm/types/byte_types_gen.go | 66 +- core/services/relay/evm/types/gen/bytes.tmpl | 2 +- core/services/relay/evm/types/gen/ints.tmpl | 2 +- .../services/relay/evm/types/int_types_gen.go | 112 +- int_types_gen.go | 2205 +++++++++++++++++ 8 files changed, 2600 insertions(+), 95 deletions(-) create mode 100644 byte_types_gen.go create mode 100644 int_types_gen.go diff --git a/byte_types_gen.go b/byte_types_gen.go new file mode 100644 index 00000000000..fb9fd9bdb5c --- /dev/null +++ b/byte_types_gen.go @@ -0,0 +1,300 @@ +package types + +import "reflect" + +type bytes1 [1]byte + +func init() { + typeMap["bytes1"] = &ABIEncodingType{ + Native: reflect.TypeOf([1]byte{}), + Checked: reflect.TypeOf(bytes1{}), + } +} + +type bytes2 [2]byte + +func init() { + typeMap["bytes2"] = &ABIEncodingType{ + Native: reflect.TypeOf([2]byte{}), + Checked: reflect.TypeOf(bytes2{}), + } +} + +type bytes3 [3]byte + +func init() { + typeMap["bytes3"] = &ABIEncodingType{ + Native: reflect.TypeOf([3]byte{}), + Checked: reflect.TypeOf(bytes3{}), + } +} + +type bytes4 [4]byte + +func init() { + typeMap["bytes4"] = &ABIEncodingType{ + Native: reflect.TypeOf([4]byte{}), + Checked: reflect.TypeOf(bytes4{}), + } +} + +type bytes5 [5]byte + +func init() { + typeMap["bytes5"] = &ABIEncodingType{ + Native: reflect.TypeOf([5]byte{}), + Checked: reflect.TypeOf(bytes5{}), + } +} + +type bytes6 [6]byte + +func init() { + typeMap["bytes6"] = &ABIEncodingType{ + Native: reflect.TypeOf([6]byte{}), + Checked: reflect.TypeOf(bytes6{}), + } +} + +type bytes7 [7]byte + +func init() { + typeMap["bytes7"] = &ABIEncodingType{ + Native: reflect.TypeOf([7]byte{}), + Checked: reflect.TypeOf(bytes7{}), + } +} + +type bytes8 [8]byte + +func init() { + typeMap["bytes8"] = &ABIEncodingType{ + Native: reflect.TypeOf([8]byte{}), + Checked: reflect.TypeOf(bytes8{}), + } +} + +type bytes9 [9]byte + +func init() { + typeMap["bytes9"] = &ABIEncodingType{ + Native: reflect.TypeOf([9]byte{}), + Checked: reflect.TypeOf(bytes9{}), + } +} + +type bytes10 [10]byte + +func init() { + typeMap["bytes10"] = &ABIEncodingType{ + Native: reflect.TypeOf([10]byte{}), + Checked: reflect.TypeOf(bytes10{}), + } +} + +type bytes11 [11]byte + +func init() { + typeMap["bytes11"] = &ABIEncodingType{ + Native: reflect.TypeOf([11]byte{}), + Checked: reflect.TypeOf(bytes11{}), + } +} + +type bytes12 [12]byte + +func init() { + typeMap["bytes12"] = &ABIEncodingType{ + Native: reflect.TypeOf([12]byte{}), + Checked: reflect.TypeOf(bytes12{}), + } +} + +type bytes13 [13]byte + +func init() { + typeMap["bytes13"] = &ABIEncodingType{ + Native: reflect.TypeOf([13]byte{}), + Checked: reflect.TypeOf(bytes13{}), + } +} + +type bytes14 [14]byte + +func init() { + typeMap["bytes14"] = &ABIEncodingType{ + Native: reflect.TypeOf([14]byte{}), + Checked: reflect.TypeOf(bytes14{}), + } +} + +type bytes15 [15]byte + +func init() { + typeMap["bytes15"] = &ABIEncodingType{ + Native: reflect.TypeOf([15]byte{}), + Checked: reflect.TypeOf(bytes15{}), + } +} + +type bytes16 [16]byte + +func init() { + typeMap["bytes16"] = &ABIEncodingType{ + Native: reflect.TypeOf([16]byte{}), + Checked: reflect.TypeOf(bytes16{}), + } +} + +type bytes17 [17]byte + +func init() { + typeMap["bytes17"] = &ABIEncodingType{ + Native: reflect.TypeOf([17]byte{}), + Checked: reflect.TypeOf(bytes17{}), + } +} + +type bytes18 [18]byte + +func init() { + typeMap["bytes18"] = &ABIEncodingType{ + Native: reflect.TypeOf([18]byte{}), + Checked: reflect.TypeOf(bytes18{}), + } +} + +type bytes19 [19]byte + +func init() { + typeMap["bytes19"] = &ABIEncodingType{ + Native: reflect.TypeOf([19]byte{}), + Checked: reflect.TypeOf(bytes19{}), + } +} + +type bytes20 [20]byte + +func init() { + typeMap["bytes20"] = &ABIEncodingType{ + Native: reflect.TypeOf([20]byte{}), + Checked: reflect.TypeOf(bytes20{}), + } +} + +type bytes21 [21]byte + +func init() { + typeMap["bytes21"] = &ABIEncodingType{ + Native: reflect.TypeOf([21]byte{}), + Checked: reflect.TypeOf(bytes21{}), + } +} + +type bytes22 [22]byte + +func init() { + typeMap["bytes22"] = &ABIEncodingType{ + Native: reflect.TypeOf([22]byte{}), + Checked: reflect.TypeOf(bytes22{}), + } +} + +type bytes23 [23]byte + +func init() { + typeMap["bytes23"] = &ABIEncodingType{ + Native: reflect.TypeOf([23]byte{}), + Checked: reflect.TypeOf(bytes23{}), + } +} + +type bytes24 [24]byte + +func init() { + typeMap["bytes24"] = &ABIEncodingType{ + Native: reflect.TypeOf([24]byte{}), + Checked: reflect.TypeOf(bytes24{}), + } +} + +type bytes25 [25]byte + +func init() { + typeMap["bytes25"] = &ABIEncodingType{ + Native: reflect.TypeOf([25]byte{}), + Checked: reflect.TypeOf(bytes25{}), + } +} + +type bytes26 [26]byte + +func init() { + typeMap["bytes26"] = &ABIEncodingType{ + Native: reflect.TypeOf([26]byte{}), + Checked: reflect.TypeOf(bytes26{}), + } +} + +type bytes27 [27]byte + +func init() { + typeMap["bytes27"] = &ABIEncodingType{ + Native: reflect.TypeOf([27]byte{}), + Checked: reflect.TypeOf(bytes27{}), + } +} + +type bytes28 [28]byte + +func init() { + typeMap["bytes28"] = &ABIEncodingType{ + Native: reflect.TypeOf([28]byte{}), + Checked: reflect.TypeOf(bytes28{}), + } +} + +type bytes29 [29]byte + +func init() { + typeMap["bytes29"] = &ABIEncodingType{ + Native: reflect.TypeOf([29]byte{}), + Checked: reflect.TypeOf(bytes29{}), + } +} + +type bytes30 [30]byte + +func init() { + typeMap["bytes30"] = &ABIEncodingType{ + Native: reflect.TypeOf([30]byte{}), + Checked: reflect.TypeOf(bytes30{}), + } +} + +type bytes31 [31]byte + +func init() { + typeMap["bytes31"] = &ABIEncodingType{ + Native: reflect.TypeOf([31]byte{}), + Checked: reflect.TypeOf(bytes31{}), + } +} + +type bytes32 [32]byte + +func init() { + typeMap["bytes32"] = &ABIEncodingType{ + Native: reflect.TypeOf([32]byte{}), + Checked: reflect.TypeOf(bytes32{}), + } +} + +type bytes0 [0]byte + +func init() { + typeMap["bytes0"] = &ABIEncodingType{ + Native: reflect.TypeOf([0]byte{}), + Checked: reflect.TypeOf(bytes0{}), + } +} diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go index 049c2196de8..96d60fa6c34 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/codec_entry.go @@ -117,7 +117,7 @@ func getNativeAndCheckedTypes(curType *abi.Type) (reflect.Type, reflect.Type, er "%w: cannot create type for kind %v", commontypes.ErrInvalidType, curType.GetType().Kind()) } } - base, ok := types.GetType(curType.String()) + base, ok := types.GetAbiEncodingType(curType.String()) if ok { return converter(base.Native), converter(base.Checked), nil } diff --git a/core/services/relay/evm/types/abi_types.go b/core/services/relay/evm/types/abi_types.go index 6749d62fd26..a3a02a41bc2 100644 --- a/core/services/relay/evm/types/abi_types.go +++ b/core/services/relay/evm/types/abi_types.go @@ -8,7 +8,7 @@ import ( //go:generate go run ./gen/main.go -var typeMap = map[string]*AbiEncodingType{ +var typeMap = map[string]*ABIEncodingType{ "bool": { Native: reflect.TypeOf(true), Checked: reflect.TypeOf(true), @@ -55,12 +55,12 @@ var typeMap = map[string]*AbiEncodingType{ }, } -type AbiEncodingType struct { +type ABIEncodingType struct { Native reflect.Type Checked reflect.Type } -func GetType(name string) (*AbiEncodingType, bool) { +func GetAbiEncodingType(name string) (*ABIEncodingType, bool) { abiType, ok := typeMap[name] return abiType, ok } diff --git a/core/services/relay/evm/types/byte_types_gen.go b/core/services/relay/evm/types/byte_types_gen.go index e87b11c2336..fb9fd9bdb5c 100644 --- a/core/services/relay/evm/types/byte_types_gen.go +++ b/core/services/relay/evm/types/byte_types_gen.go @@ -5,7 +5,7 @@ import "reflect" type bytes1 [1]byte func init() { - typeMap["bytes1"] = &AbiEncodingType{ + typeMap["bytes1"] = &ABIEncodingType{ Native: reflect.TypeOf([1]byte{}), Checked: reflect.TypeOf(bytes1{}), } @@ -14,7 +14,7 @@ func init() { type bytes2 [2]byte func init() { - typeMap["bytes2"] = &AbiEncodingType{ + typeMap["bytes2"] = &ABIEncodingType{ Native: reflect.TypeOf([2]byte{}), Checked: reflect.TypeOf(bytes2{}), } @@ -23,7 +23,7 @@ func init() { type bytes3 [3]byte func init() { - typeMap["bytes3"] = &AbiEncodingType{ + typeMap["bytes3"] = &ABIEncodingType{ Native: reflect.TypeOf([3]byte{}), Checked: reflect.TypeOf(bytes3{}), } @@ -32,7 +32,7 @@ func init() { type bytes4 [4]byte func init() { - typeMap["bytes4"] = &AbiEncodingType{ + typeMap["bytes4"] = &ABIEncodingType{ Native: reflect.TypeOf([4]byte{}), Checked: reflect.TypeOf(bytes4{}), } @@ -41,7 +41,7 @@ func init() { type bytes5 [5]byte func init() { - typeMap["bytes5"] = &AbiEncodingType{ + typeMap["bytes5"] = &ABIEncodingType{ Native: reflect.TypeOf([5]byte{}), Checked: reflect.TypeOf(bytes5{}), } @@ -50,7 +50,7 @@ func init() { type bytes6 [6]byte func init() { - typeMap["bytes6"] = &AbiEncodingType{ + typeMap["bytes6"] = &ABIEncodingType{ Native: reflect.TypeOf([6]byte{}), Checked: reflect.TypeOf(bytes6{}), } @@ -59,7 +59,7 @@ func init() { type bytes7 [7]byte func init() { - typeMap["bytes7"] = &AbiEncodingType{ + typeMap["bytes7"] = &ABIEncodingType{ Native: reflect.TypeOf([7]byte{}), Checked: reflect.TypeOf(bytes7{}), } @@ -68,7 +68,7 @@ func init() { type bytes8 [8]byte func init() { - typeMap["bytes8"] = &AbiEncodingType{ + typeMap["bytes8"] = &ABIEncodingType{ Native: reflect.TypeOf([8]byte{}), Checked: reflect.TypeOf(bytes8{}), } @@ -77,7 +77,7 @@ func init() { type bytes9 [9]byte func init() { - typeMap["bytes9"] = &AbiEncodingType{ + typeMap["bytes9"] = &ABIEncodingType{ Native: reflect.TypeOf([9]byte{}), Checked: reflect.TypeOf(bytes9{}), } @@ -86,7 +86,7 @@ func init() { type bytes10 [10]byte func init() { - typeMap["bytes10"] = &AbiEncodingType{ + typeMap["bytes10"] = &ABIEncodingType{ Native: reflect.TypeOf([10]byte{}), Checked: reflect.TypeOf(bytes10{}), } @@ -95,7 +95,7 @@ func init() { type bytes11 [11]byte func init() { - typeMap["bytes11"] = &AbiEncodingType{ + typeMap["bytes11"] = &ABIEncodingType{ Native: reflect.TypeOf([11]byte{}), Checked: reflect.TypeOf(bytes11{}), } @@ -104,7 +104,7 @@ func init() { type bytes12 [12]byte func init() { - typeMap["bytes12"] = &AbiEncodingType{ + typeMap["bytes12"] = &ABIEncodingType{ Native: reflect.TypeOf([12]byte{}), Checked: reflect.TypeOf(bytes12{}), } @@ -113,7 +113,7 @@ func init() { type bytes13 [13]byte func init() { - typeMap["bytes13"] = &AbiEncodingType{ + typeMap["bytes13"] = &ABIEncodingType{ Native: reflect.TypeOf([13]byte{}), Checked: reflect.TypeOf(bytes13{}), } @@ -122,7 +122,7 @@ func init() { type bytes14 [14]byte func init() { - typeMap["bytes14"] = &AbiEncodingType{ + typeMap["bytes14"] = &ABIEncodingType{ Native: reflect.TypeOf([14]byte{}), Checked: reflect.TypeOf(bytes14{}), } @@ -131,7 +131,7 @@ func init() { type bytes15 [15]byte func init() { - typeMap["bytes15"] = &AbiEncodingType{ + typeMap["bytes15"] = &ABIEncodingType{ Native: reflect.TypeOf([15]byte{}), Checked: reflect.TypeOf(bytes15{}), } @@ -140,7 +140,7 @@ func init() { type bytes16 [16]byte func init() { - typeMap["bytes16"] = &AbiEncodingType{ + typeMap["bytes16"] = &ABIEncodingType{ Native: reflect.TypeOf([16]byte{}), Checked: reflect.TypeOf(bytes16{}), } @@ -149,7 +149,7 @@ func init() { type bytes17 [17]byte func init() { - typeMap["bytes17"] = &AbiEncodingType{ + typeMap["bytes17"] = &ABIEncodingType{ Native: reflect.TypeOf([17]byte{}), Checked: reflect.TypeOf(bytes17{}), } @@ -158,7 +158,7 @@ func init() { type bytes18 [18]byte func init() { - typeMap["bytes18"] = &AbiEncodingType{ + typeMap["bytes18"] = &ABIEncodingType{ Native: reflect.TypeOf([18]byte{}), Checked: reflect.TypeOf(bytes18{}), } @@ -167,7 +167,7 @@ func init() { type bytes19 [19]byte func init() { - typeMap["bytes19"] = &AbiEncodingType{ + typeMap["bytes19"] = &ABIEncodingType{ Native: reflect.TypeOf([19]byte{}), Checked: reflect.TypeOf(bytes19{}), } @@ -176,7 +176,7 @@ func init() { type bytes20 [20]byte func init() { - typeMap["bytes20"] = &AbiEncodingType{ + typeMap["bytes20"] = &ABIEncodingType{ Native: reflect.TypeOf([20]byte{}), Checked: reflect.TypeOf(bytes20{}), } @@ -185,7 +185,7 @@ func init() { type bytes21 [21]byte func init() { - typeMap["bytes21"] = &AbiEncodingType{ + typeMap["bytes21"] = &ABIEncodingType{ Native: reflect.TypeOf([21]byte{}), Checked: reflect.TypeOf(bytes21{}), } @@ -194,7 +194,7 @@ func init() { type bytes22 [22]byte func init() { - typeMap["bytes22"] = &AbiEncodingType{ + typeMap["bytes22"] = &ABIEncodingType{ Native: reflect.TypeOf([22]byte{}), Checked: reflect.TypeOf(bytes22{}), } @@ -203,7 +203,7 @@ func init() { type bytes23 [23]byte func init() { - typeMap["bytes23"] = &AbiEncodingType{ + typeMap["bytes23"] = &ABIEncodingType{ Native: reflect.TypeOf([23]byte{}), Checked: reflect.TypeOf(bytes23{}), } @@ -212,7 +212,7 @@ func init() { type bytes24 [24]byte func init() { - typeMap["bytes24"] = &AbiEncodingType{ + typeMap["bytes24"] = &ABIEncodingType{ Native: reflect.TypeOf([24]byte{}), Checked: reflect.TypeOf(bytes24{}), } @@ -221,7 +221,7 @@ func init() { type bytes25 [25]byte func init() { - typeMap["bytes25"] = &AbiEncodingType{ + typeMap["bytes25"] = &ABIEncodingType{ Native: reflect.TypeOf([25]byte{}), Checked: reflect.TypeOf(bytes25{}), } @@ -230,7 +230,7 @@ func init() { type bytes26 [26]byte func init() { - typeMap["bytes26"] = &AbiEncodingType{ + typeMap["bytes26"] = &ABIEncodingType{ Native: reflect.TypeOf([26]byte{}), Checked: reflect.TypeOf(bytes26{}), } @@ -239,7 +239,7 @@ func init() { type bytes27 [27]byte func init() { - typeMap["bytes27"] = &AbiEncodingType{ + typeMap["bytes27"] = &ABIEncodingType{ Native: reflect.TypeOf([27]byte{}), Checked: reflect.TypeOf(bytes27{}), } @@ -248,7 +248,7 @@ func init() { type bytes28 [28]byte func init() { - typeMap["bytes28"] = &AbiEncodingType{ + typeMap["bytes28"] = &ABIEncodingType{ Native: reflect.TypeOf([28]byte{}), Checked: reflect.TypeOf(bytes28{}), } @@ -257,7 +257,7 @@ func init() { type bytes29 [29]byte func init() { - typeMap["bytes29"] = &AbiEncodingType{ + typeMap["bytes29"] = &ABIEncodingType{ Native: reflect.TypeOf([29]byte{}), Checked: reflect.TypeOf(bytes29{}), } @@ -266,7 +266,7 @@ func init() { type bytes30 [30]byte func init() { - typeMap["bytes30"] = &AbiEncodingType{ + typeMap["bytes30"] = &ABIEncodingType{ Native: reflect.TypeOf([30]byte{}), Checked: reflect.TypeOf(bytes30{}), } @@ -275,7 +275,7 @@ func init() { type bytes31 [31]byte func init() { - typeMap["bytes31"] = &AbiEncodingType{ + typeMap["bytes31"] = &ABIEncodingType{ Native: reflect.TypeOf([31]byte{}), Checked: reflect.TypeOf(bytes31{}), } @@ -284,7 +284,7 @@ func init() { type bytes32 [32]byte func init() { - typeMap["bytes32"] = &AbiEncodingType{ + typeMap["bytes32"] = &ABIEncodingType{ Native: reflect.TypeOf([32]byte{}), Checked: reflect.TypeOf(bytes32{}), } @@ -293,7 +293,7 @@ func init() { type bytes0 [0]byte func init() { - typeMap["bytes0"] = &AbiEncodingType{ + typeMap["bytes0"] = &ABIEncodingType{ Native: reflect.TypeOf([0]byte{}), Checked: reflect.TypeOf(bytes0{}), } diff --git a/core/services/relay/evm/types/gen/bytes.tmpl b/core/services/relay/evm/types/gen/bytes.tmpl index cecf1868691..2414c412c64 100644 --- a/core/services/relay/evm/types/gen/bytes.tmpl +++ b/core/services/relay/evm/types/gen/bytes.tmpl @@ -5,7 +5,7 @@ import "reflect" {{ range . }} type bytes{{.Size}} [{{.Size}}]byte func init() { - typeMap["bytes{{.Size}}"] = &AbiEncodingType { + typeMap["bytes{{.Size}}"] = &ABIEncodingType { Native: reflect.TypeOf([{{.Size}}]byte{}), Checked: reflect.TypeOf(bytes{{.Size}}{}), } diff --git a/core/services/relay/evm/types/gen/ints.tmpl b/core/services/relay/evm/types/gen/ints.tmpl index f5c42524ff8..5a13c483746 100644 --- a/core/services/relay/evm/types/gen/ints.tmpl +++ b/core/services/relay/evm/types/gen/ints.tmpl @@ -56,7 +56,7 @@ func (i *{{.Prefix}}int{{.Size}}) Verify() error { func (i *{{.Prefix}}int{{.Size}}) private() {} func init() { - typeMap["{{.Prefix}}int{{.Size}}"] = &AbiEncodingType { + typeMap["{{.Prefix}}int{{.Size}}"] = &ABIEncodingType { Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*{{.Prefix}}int{{.Size}})(nil)), } diff --git a/core/services/relay/evm/types/int_types_gen.go b/core/services/relay/evm/types/int_types_gen.go index fb978926179..c469f6ef3fd 100644 --- a/core/services/relay/evm/types/int_types_gen.go +++ b/core/services/relay/evm/types/int_types_gen.go @@ -53,7 +53,7 @@ func (i *int24) Verify() error { func (i *int24) private() {} func init() { - typeMap["int24"] = &AbiEncodingType{ + typeMap["int24"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int24)(nil)), } @@ -92,7 +92,7 @@ func (i *uint24) Verify() error { func (i *uint24) private() {} func init() { - typeMap["uint24"] = &AbiEncodingType{ + typeMap["uint24"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint24)(nil)), } @@ -131,7 +131,7 @@ func (i *int40) Verify() error { func (i *int40) private() {} func init() { - typeMap["int40"] = &AbiEncodingType{ + typeMap["int40"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int40)(nil)), } @@ -170,7 +170,7 @@ func (i *uint40) Verify() error { func (i *uint40) private() {} func init() { - typeMap["uint40"] = &AbiEncodingType{ + typeMap["uint40"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint40)(nil)), } @@ -209,7 +209,7 @@ func (i *int48) Verify() error { func (i *int48) private() {} func init() { - typeMap["int48"] = &AbiEncodingType{ + typeMap["int48"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int48)(nil)), } @@ -248,7 +248,7 @@ func (i *uint48) Verify() error { func (i *uint48) private() {} func init() { - typeMap["uint48"] = &AbiEncodingType{ + typeMap["uint48"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint48)(nil)), } @@ -287,7 +287,7 @@ func (i *int56) Verify() error { func (i *int56) private() {} func init() { - typeMap["int56"] = &AbiEncodingType{ + typeMap["int56"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int56)(nil)), } @@ -326,7 +326,7 @@ func (i *uint56) Verify() error { func (i *uint56) private() {} func init() { - typeMap["uint56"] = &AbiEncodingType{ + typeMap["uint56"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint56)(nil)), } @@ -365,7 +365,7 @@ func (i *int72) Verify() error { func (i *int72) private() {} func init() { - typeMap["int72"] = &AbiEncodingType{ + typeMap["int72"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int72)(nil)), } @@ -404,7 +404,7 @@ func (i *uint72) Verify() error { func (i *uint72) private() {} func init() { - typeMap["uint72"] = &AbiEncodingType{ + typeMap["uint72"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint72)(nil)), } @@ -443,7 +443,7 @@ func (i *int80) Verify() error { func (i *int80) private() {} func init() { - typeMap["int80"] = &AbiEncodingType{ + typeMap["int80"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int80)(nil)), } @@ -482,7 +482,7 @@ func (i *uint80) Verify() error { func (i *uint80) private() {} func init() { - typeMap["uint80"] = &AbiEncodingType{ + typeMap["uint80"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint80)(nil)), } @@ -521,7 +521,7 @@ func (i *int88) Verify() error { func (i *int88) private() {} func init() { - typeMap["int88"] = &AbiEncodingType{ + typeMap["int88"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int88)(nil)), } @@ -560,7 +560,7 @@ func (i *uint88) Verify() error { func (i *uint88) private() {} func init() { - typeMap["uint88"] = &AbiEncodingType{ + typeMap["uint88"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint88)(nil)), } @@ -599,7 +599,7 @@ func (i *int96) Verify() error { func (i *int96) private() {} func init() { - typeMap["int96"] = &AbiEncodingType{ + typeMap["int96"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int96)(nil)), } @@ -638,7 +638,7 @@ func (i *uint96) Verify() error { func (i *uint96) private() {} func init() { - typeMap["uint96"] = &AbiEncodingType{ + typeMap["uint96"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint96)(nil)), } @@ -677,7 +677,7 @@ func (i *int104) Verify() error { func (i *int104) private() {} func init() { - typeMap["int104"] = &AbiEncodingType{ + typeMap["int104"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int104)(nil)), } @@ -716,7 +716,7 @@ func (i *uint104) Verify() error { func (i *uint104) private() {} func init() { - typeMap["uint104"] = &AbiEncodingType{ + typeMap["uint104"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint104)(nil)), } @@ -755,7 +755,7 @@ func (i *int112) Verify() error { func (i *int112) private() {} func init() { - typeMap["int112"] = &AbiEncodingType{ + typeMap["int112"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int112)(nil)), } @@ -794,7 +794,7 @@ func (i *uint112) Verify() error { func (i *uint112) private() {} func init() { - typeMap["uint112"] = &AbiEncodingType{ + typeMap["uint112"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint112)(nil)), } @@ -833,7 +833,7 @@ func (i *int120) Verify() error { func (i *int120) private() {} func init() { - typeMap["int120"] = &AbiEncodingType{ + typeMap["int120"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int120)(nil)), } @@ -872,7 +872,7 @@ func (i *uint120) Verify() error { func (i *uint120) private() {} func init() { - typeMap["uint120"] = &AbiEncodingType{ + typeMap["uint120"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint120)(nil)), } @@ -911,7 +911,7 @@ func (i *int128) Verify() error { func (i *int128) private() {} func init() { - typeMap["int128"] = &AbiEncodingType{ + typeMap["int128"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int128)(nil)), } @@ -950,7 +950,7 @@ func (i *uint128) Verify() error { func (i *uint128) private() {} func init() { - typeMap["uint128"] = &AbiEncodingType{ + typeMap["uint128"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint128)(nil)), } @@ -989,7 +989,7 @@ func (i *int136) Verify() error { func (i *int136) private() {} func init() { - typeMap["int136"] = &AbiEncodingType{ + typeMap["int136"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int136)(nil)), } @@ -1028,7 +1028,7 @@ func (i *uint136) Verify() error { func (i *uint136) private() {} func init() { - typeMap["uint136"] = &AbiEncodingType{ + typeMap["uint136"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint136)(nil)), } @@ -1067,7 +1067,7 @@ func (i *int144) Verify() error { func (i *int144) private() {} func init() { - typeMap["int144"] = &AbiEncodingType{ + typeMap["int144"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int144)(nil)), } @@ -1106,7 +1106,7 @@ func (i *uint144) Verify() error { func (i *uint144) private() {} func init() { - typeMap["uint144"] = &AbiEncodingType{ + typeMap["uint144"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint144)(nil)), } @@ -1145,7 +1145,7 @@ func (i *int152) Verify() error { func (i *int152) private() {} func init() { - typeMap["int152"] = &AbiEncodingType{ + typeMap["int152"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int152)(nil)), } @@ -1184,7 +1184,7 @@ func (i *uint152) Verify() error { func (i *uint152) private() {} func init() { - typeMap["uint152"] = &AbiEncodingType{ + typeMap["uint152"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint152)(nil)), } @@ -1223,7 +1223,7 @@ func (i *int160) Verify() error { func (i *int160) private() {} func init() { - typeMap["int160"] = &AbiEncodingType{ + typeMap["int160"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int160)(nil)), } @@ -1262,7 +1262,7 @@ func (i *uint160) Verify() error { func (i *uint160) private() {} func init() { - typeMap["uint160"] = &AbiEncodingType{ + typeMap["uint160"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint160)(nil)), } @@ -1301,7 +1301,7 @@ func (i *int168) Verify() error { func (i *int168) private() {} func init() { - typeMap["int168"] = &AbiEncodingType{ + typeMap["int168"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int168)(nil)), } @@ -1340,7 +1340,7 @@ func (i *uint168) Verify() error { func (i *uint168) private() {} func init() { - typeMap["uint168"] = &AbiEncodingType{ + typeMap["uint168"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint168)(nil)), } @@ -1379,7 +1379,7 @@ func (i *int176) Verify() error { func (i *int176) private() {} func init() { - typeMap["int176"] = &AbiEncodingType{ + typeMap["int176"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int176)(nil)), } @@ -1418,7 +1418,7 @@ func (i *uint176) Verify() error { func (i *uint176) private() {} func init() { - typeMap["uint176"] = &AbiEncodingType{ + typeMap["uint176"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint176)(nil)), } @@ -1457,7 +1457,7 @@ func (i *int184) Verify() error { func (i *int184) private() {} func init() { - typeMap["int184"] = &AbiEncodingType{ + typeMap["int184"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int184)(nil)), } @@ -1496,7 +1496,7 @@ func (i *uint184) Verify() error { func (i *uint184) private() {} func init() { - typeMap["uint184"] = &AbiEncodingType{ + typeMap["uint184"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint184)(nil)), } @@ -1535,7 +1535,7 @@ func (i *int192) Verify() error { func (i *int192) private() {} func init() { - typeMap["int192"] = &AbiEncodingType{ + typeMap["int192"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int192)(nil)), } @@ -1574,7 +1574,7 @@ func (i *uint192) Verify() error { func (i *uint192) private() {} func init() { - typeMap["uint192"] = &AbiEncodingType{ + typeMap["uint192"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint192)(nil)), } @@ -1613,7 +1613,7 @@ func (i *int200) Verify() error { func (i *int200) private() {} func init() { - typeMap["int200"] = &AbiEncodingType{ + typeMap["int200"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int200)(nil)), } @@ -1652,7 +1652,7 @@ func (i *uint200) Verify() error { func (i *uint200) private() {} func init() { - typeMap["uint200"] = &AbiEncodingType{ + typeMap["uint200"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint200)(nil)), } @@ -1691,7 +1691,7 @@ func (i *int208) Verify() error { func (i *int208) private() {} func init() { - typeMap["int208"] = &AbiEncodingType{ + typeMap["int208"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int208)(nil)), } @@ -1730,7 +1730,7 @@ func (i *uint208) Verify() error { func (i *uint208) private() {} func init() { - typeMap["uint208"] = &AbiEncodingType{ + typeMap["uint208"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint208)(nil)), } @@ -1769,7 +1769,7 @@ func (i *int216) Verify() error { func (i *int216) private() {} func init() { - typeMap["int216"] = &AbiEncodingType{ + typeMap["int216"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int216)(nil)), } @@ -1808,7 +1808,7 @@ func (i *uint216) Verify() error { func (i *uint216) private() {} func init() { - typeMap["uint216"] = &AbiEncodingType{ + typeMap["uint216"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint216)(nil)), } @@ -1847,7 +1847,7 @@ func (i *int224) Verify() error { func (i *int224) private() {} func init() { - typeMap["int224"] = &AbiEncodingType{ + typeMap["int224"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int224)(nil)), } @@ -1886,7 +1886,7 @@ func (i *uint224) Verify() error { func (i *uint224) private() {} func init() { - typeMap["uint224"] = &AbiEncodingType{ + typeMap["uint224"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint224)(nil)), } @@ -1925,7 +1925,7 @@ func (i *int232) Verify() error { func (i *int232) private() {} func init() { - typeMap["int232"] = &AbiEncodingType{ + typeMap["int232"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int232)(nil)), } @@ -1964,7 +1964,7 @@ func (i *uint232) Verify() error { func (i *uint232) private() {} func init() { - typeMap["uint232"] = &AbiEncodingType{ + typeMap["uint232"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint232)(nil)), } @@ -2003,7 +2003,7 @@ func (i *int240) Verify() error { func (i *int240) private() {} func init() { - typeMap["int240"] = &AbiEncodingType{ + typeMap["int240"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int240)(nil)), } @@ -2042,7 +2042,7 @@ func (i *uint240) Verify() error { func (i *uint240) private() {} func init() { - typeMap["uint240"] = &AbiEncodingType{ + typeMap["uint240"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint240)(nil)), } @@ -2081,7 +2081,7 @@ func (i *int248) Verify() error { func (i *int248) private() {} func init() { - typeMap["int248"] = &AbiEncodingType{ + typeMap["int248"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int248)(nil)), } @@ -2120,7 +2120,7 @@ func (i *uint248) Verify() error { func (i *uint248) private() {} func init() { - typeMap["uint248"] = &AbiEncodingType{ + typeMap["uint248"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint248)(nil)), } @@ -2159,7 +2159,7 @@ func (i *int256) Verify() error { func (i *int256) private() {} func init() { - typeMap["int256"] = &AbiEncodingType{ + typeMap["int256"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*int256)(nil)), } @@ -2198,7 +2198,7 @@ func (i *uint256) Verify() error { func (i *uint256) private() {} func init() { - typeMap["uint256"] = &AbiEncodingType{ + typeMap["uint256"] = &ABIEncodingType{ Native: reflect.TypeOf((*big.Int)(nil)), Checked: reflect.TypeOf((*uint256)(nil)), } diff --git a/int_types_gen.go b/int_types_gen.go new file mode 100644 index 00000000000..c469f6ef3fd --- /dev/null +++ b/int_types_gen.go @@ -0,0 +1,2205 @@ +package types + +import ( + "math/big" + "reflect" + + "github.com/fxamacker/cbor/v2" + + "github.com/smartcontractkit/chainlink-common/pkg/types" +) + +type SizedBigInt interface { + Verify() error + private() +} + +var sizedBigIntType = reflect.TypeOf((*SizedBigInt)(nil)).Elem() + +func SizedBigIntType() reflect.Type { + return sizedBigIntType +} + +type int24 big.Int + +func (i *int24) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int24) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int24) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 24 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int24) private() {} + +func init() { + typeMap["int24"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int24)(nil)), + } +} + +type uint24 big.Int + +func (i *uint24) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint24) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint24) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 24 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint24) private() {} + +func init() { + typeMap["uint24"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint24)(nil)), + } +} + +type int40 big.Int + +func (i *int40) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int40) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int40) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 40 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int40) private() {} + +func init() { + typeMap["int40"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int40)(nil)), + } +} + +type uint40 big.Int + +func (i *uint40) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint40) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint40) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 40 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint40) private() {} + +func init() { + typeMap["uint40"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint40)(nil)), + } +} + +type int48 big.Int + +func (i *int48) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int48) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int48) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 48 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int48) private() {} + +func init() { + typeMap["int48"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int48)(nil)), + } +} + +type uint48 big.Int + +func (i *uint48) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint48) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint48) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 48 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint48) private() {} + +func init() { + typeMap["uint48"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint48)(nil)), + } +} + +type int56 big.Int + +func (i *int56) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int56) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int56) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 56 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int56) private() {} + +func init() { + typeMap["int56"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int56)(nil)), + } +} + +type uint56 big.Int + +func (i *uint56) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint56) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint56) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 56 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint56) private() {} + +func init() { + typeMap["uint56"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint56)(nil)), + } +} + +type int72 big.Int + +func (i *int72) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int72) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int72) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 72 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int72) private() {} + +func init() { + typeMap["int72"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int72)(nil)), + } +} + +type uint72 big.Int + +func (i *uint72) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint72) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint72) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 72 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint72) private() {} + +func init() { + typeMap["uint72"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint72)(nil)), + } +} + +type int80 big.Int + +func (i *int80) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int80) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int80) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 80 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int80) private() {} + +func init() { + typeMap["int80"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int80)(nil)), + } +} + +type uint80 big.Int + +func (i *uint80) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint80) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint80) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 80 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint80) private() {} + +func init() { + typeMap["uint80"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint80)(nil)), + } +} + +type int88 big.Int + +func (i *int88) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int88) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int88) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 88 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int88) private() {} + +func init() { + typeMap["int88"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int88)(nil)), + } +} + +type uint88 big.Int + +func (i *uint88) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint88) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint88) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 88 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint88) private() {} + +func init() { + typeMap["uint88"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint88)(nil)), + } +} + +type int96 big.Int + +func (i *int96) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int96) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int96) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 96 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int96) private() {} + +func init() { + typeMap["int96"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int96)(nil)), + } +} + +type uint96 big.Int + +func (i *uint96) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint96) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint96) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 96 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint96) private() {} + +func init() { + typeMap["uint96"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint96)(nil)), + } +} + +type int104 big.Int + +func (i *int104) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int104) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int104) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 104 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int104) private() {} + +func init() { + typeMap["int104"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int104)(nil)), + } +} + +type uint104 big.Int + +func (i *uint104) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint104) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint104) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 104 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint104) private() {} + +func init() { + typeMap["uint104"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint104)(nil)), + } +} + +type int112 big.Int + +func (i *int112) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int112) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int112) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 112 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int112) private() {} + +func init() { + typeMap["int112"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int112)(nil)), + } +} + +type uint112 big.Int + +func (i *uint112) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint112) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint112) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 112 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint112) private() {} + +func init() { + typeMap["uint112"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint112)(nil)), + } +} + +type int120 big.Int + +func (i *int120) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int120) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int120) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 120 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int120) private() {} + +func init() { + typeMap["int120"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int120)(nil)), + } +} + +type uint120 big.Int + +func (i *uint120) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint120) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint120) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 120 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint120) private() {} + +func init() { + typeMap["uint120"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint120)(nil)), + } +} + +type int128 big.Int + +func (i *int128) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int128) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int128) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 128 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int128) private() {} + +func init() { + typeMap["int128"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int128)(nil)), + } +} + +type uint128 big.Int + +func (i *uint128) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint128) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint128) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 128 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint128) private() {} + +func init() { + typeMap["uint128"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint128)(nil)), + } +} + +type int136 big.Int + +func (i *int136) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int136) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int136) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 136 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int136) private() {} + +func init() { + typeMap["int136"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int136)(nil)), + } +} + +type uint136 big.Int + +func (i *uint136) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint136) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint136) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 136 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint136) private() {} + +func init() { + typeMap["uint136"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint136)(nil)), + } +} + +type int144 big.Int + +func (i *int144) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int144) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int144) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 144 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int144) private() {} + +func init() { + typeMap["int144"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int144)(nil)), + } +} + +type uint144 big.Int + +func (i *uint144) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint144) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint144) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 144 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint144) private() {} + +func init() { + typeMap["uint144"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint144)(nil)), + } +} + +type int152 big.Int + +func (i *int152) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int152) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int152) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 152 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int152) private() {} + +func init() { + typeMap["int152"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int152)(nil)), + } +} + +type uint152 big.Int + +func (i *uint152) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint152) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint152) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 152 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint152) private() {} + +func init() { + typeMap["uint152"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint152)(nil)), + } +} + +type int160 big.Int + +func (i *int160) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int160) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int160) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 160 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int160) private() {} + +func init() { + typeMap["int160"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int160)(nil)), + } +} + +type uint160 big.Int + +func (i *uint160) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint160) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint160) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 160 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint160) private() {} + +func init() { + typeMap["uint160"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint160)(nil)), + } +} + +type int168 big.Int + +func (i *int168) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int168) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int168) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 168 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int168) private() {} + +func init() { + typeMap["int168"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int168)(nil)), + } +} + +type uint168 big.Int + +func (i *uint168) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint168) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint168) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 168 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint168) private() {} + +func init() { + typeMap["uint168"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint168)(nil)), + } +} + +type int176 big.Int + +func (i *int176) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int176) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int176) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 176 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int176) private() {} + +func init() { + typeMap["int176"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int176)(nil)), + } +} + +type uint176 big.Int + +func (i *uint176) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint176) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint176) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 176 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint176) private() {} + +func init() { + typeMap["uint176"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint176)(nil)), + } +} + +type int184 big.Int + +func (i *int184) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int184) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int184) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 184 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int184) private() {} + +func init() { + typeMap["int184"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int184)(nil)), + } +} + +type uint184 big.Int + +func (i *uint184) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint184) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint184) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 184 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint184) private() {} + +func init() { + typeMap["uint184"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint184)(nil)), + } +} + +type int192 big.Int + +func (i *int192) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int192) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int192) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 192 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int192) private() {} + +func init() { + typeMap["int192"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int192)(nil)), + } +} + +type uint192 big.Int + +func (i *uint192) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint192) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint192) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 192 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint192) private() {} + +func init() { + typeMap["uint192"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint192)(nil)), + } +} + +type int200 big.Int + +func (i *int200) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int200) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int200) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 200 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int200) private() {} + +func init() { + typeMap["int200"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int200)(nil)), + } +} + +type uint200 big.Int + +func (i *uint200) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint200) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint200) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 200 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint200) private() {} + +func init() { + typeMap["uint200"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint200)(nil)), + } +} + +type int208 big.Int + +func (i *int208) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int208) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int208) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 208 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int208) private() {} + +func init() { + typeMap["int208"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int208)(nil)), + } +} + +type uint208 big.Int + +func (i *uint208) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint208) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint208) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 208 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint208) private() {} + +func init() { + typeMap["uint208"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint208)(nil)), + } +} + +type int216 big.Int + +func (i *int216) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int216) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int216) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 216 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int216) private() {} + +func init() { + typeMap["int216"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int216)(nil)), + } +} + +type uint216 big.Int + +func (i *uint216) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint216) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint216) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 216 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint216) private() {} + +func init() { + typeMap["uint216"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint216)(nil)), + } +} + +type int224 big.Int + +func (i *int224) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int224) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int224) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 224 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int224) private() {} + +func init() { + typeMap["int224"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int224)(nil)), + } +} + +type uint224 big.Int + +func (i *uint224) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint224) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint224) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 224 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint224) private() {} + +func init() { + typeMap["uint224"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint224)(nil)), + } +} + +type int232 big.Int + +func (i *int232) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int232) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int232) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 232 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int232) private() {} + +func init() { + typeMap["int232"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int232)(nil)), + } +} + +type uint232 big.Int + +func (i *uint232) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint232) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint232) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 232 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint232) private() {} + +func init() { + typeMap["uint232"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint232)(nil)), + } +} + +type int240 big.Int + +func (i *int240) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int240) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int240) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 240 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int240) private() {} + +func init() { + typeMap["int240"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int240)(nil)), + } +} + +type uint240 big.Int + +func (i *uint240) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint240) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint240) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 240 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint240) private() {} + +func init() { + typeMap["uint240"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint240)(nil)), + } +} + +type int248 big.Int + +func (i *int248) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int248) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int248) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 248 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int248) private() {} + +func init() { + typeMap["int248"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int248)(nil)), + } +} + +type uint248 big.Int + +func (i *uint248) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint248) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint248) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 248 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint248) private() {} + +func init() { + typeMap["uint248"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint248)(nil)), + } +} + +type int256 big.Int + +func (i *int256) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *int256) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *int256) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 256 { + return types.ErrInvalidType + } + + return nil +} + +func (i *int256) private() {} + +func init() { + typeMap["int256"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*int256)(nil)), + } +} + +type uint256 big.Int + +func (i *uint256) UnmarshalCBOR(input []byte) error { + bi := (*big.Int)(i) + if err := cbor.Unmarshal(input, bi); err != nil { + return err + } + + return i.Verify() +} + +func (i *uint256) UnmarshalText(input []byte) error { + bi := (*big.Int)(i) + if _, ok := bi.SetString(string(input), 10); !ok { + return types.ErrInvalidType + } + + return i.Verify() +} + +func (i *uint256) Verify() error { + bi := (*big.Int)(i) + + if bi.BitLen() > 256 { + return types.ErrInvalidType + } + + return nil +} + +func (i *uint256) private() {} + +func init() { + typeMap["uint256"] = &ABIEncodingType{ + Native: reflect.TypeOf((*big.Int)(nil)), + Checked: reflect.TypeOf((*uint256)(nil)), + } +} From 51f06a618b274e6fc5f401214a399616b1a42b66 Mon Sep 17 00:00:00 2001 From: Domino Valdano <2644901+reductionista@users.noreply.github.com> Date: Fri, 22 Dec 2023 18:29:15 -0800 Subject: [PATCH 060/112] Generate abi, bin & wrapper for chainreader test with gethwrappers --- contracts/scripts/native_solc_compile_all | 2 +- .../native_solc_compile_all_chainreader | 32 + .../v0.8/tests/ChainReaderTestContract.sol | 0 .../chain_reader_example.go | 495 +++++++++++++++ core/gethwrappers/go_generate.go | 4 +- core/services/relay/evm/chain_reader_test.go | 30 +- core/services/relay/evm/codec_test.go | 8 +- .../chain_reader_test_contract_gen.abi | 1 - .../chain_reader_test_contract_gen.bin | 1 - .../chain_reader_test_contract_gen.go | 565 ------------------ .../testfiles/chainlink_reader_test_setup.sh | 8 - 11 files changed, 549 insertions(+), 597 deletions(-) create mode 100755 contracts/scripts/native_solc_compile_all_chainreader rename core/services/relay/evm/testfiles/chain_reader_test_contract.sol => contracts/src/v0.8/tests/ChainReaderTestContract.sol (100%) create mode 100644 core/gethwrappers/generated/chain_reader_example/chain_reader_example.go delete mode 100644 core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi delete mode 100644 core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin delete mode 100644 core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go delete mode 100755 core/services/relay/evm/testfiles/chainlink_reader_test_setup.sh diff --git a/contracts/scripts/native_solc_compile_all b/contracts/scripts/native_solc_compile_all index cf1226a2d5c..a7b6b3efe53 100755 --- a/contracts/scripts/native_solc_compile_all +++ b/contracts/scripts/native_solc_compile_all @@ -12,7 +12,7 @@ python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt # 6 and 7 are legacy contracts, for each other product we have a native_solc_compile_all_$product script # These scripts can be run individually, or all together with this script. # To add new CL products, simply write a native_solc_compile_all_$product script and add it to the list below. -for product in 6 7 automation events_mock feeds functions llo-feeds logpoller operatorforwarder shared transmission vrf +for product in 6 7 automation events_mock feeds functions llo-feeds logpoller operatorforwarder shared transmission vrf chainreader do $SCRIPTPATH/native_solc_compile_all_$product done diff --git a/contracts/scripts/native_solc_compile_all_chainreader b/contracts/scripts/native_solc_compile_all_chainreader new file mode 100755 index 00000000000..6f5b095667d --- /dev/null +++ b/contracts/scripts/native_solc_compile_all_chainreader @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +set -e + +echo " ┌──────────────────────────────────────────────┐" +echo " │ Compiling ChainReader contracts... │" +echo " └──────────────────────────────────────────────┘" + +SOLC_VERSION="0.8.19" +OPTIMIZE_RUNS=1000000 + + +SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; 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 + +ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )" + +compileContract () { + local contract + contract=$(basename "$1" ".sol") + + solc --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \ + -o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \ + --abi --bin --allow-paths "$ROOT"/contracts/src/v0.8\ + "$ROOT"/contracts/src/v0.8/"$1" +} + + +compileContract tests/ChainReaderTestContract.sol diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract.sol b/contracts/src/v0.8/tests/ChainReaderTestContract.sol similarity index 100% rename from core/services/relay/evm/testfiles/chain_reader_test_contract.sol rename to contracts/src/v0.8/tests/ChainReaderTestContract.sol diff --git a/core/gethwrappers/generated/chain_reader_example/chain_reader_example.go b/core/gethwrappers/generated/chain_reader_example/chain_reader_example.go new file mode 100644 index 00000000000..ef217880bba --- /dev/null +++ b/core/gethwrappers/generated/chain_reader_example/chain_reader_example.go @@ -0,0 +1,495 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package chain_reader_example + +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 InnerTestStruct struct { + I int64 + S string +} + +type MidLevelTestStruct struct { + FixedBytes [2]byte + Inner InnerTestStruct +} + +type TestStruct struct { + Field int32 + DifferentField string + OracleId uint8 + OracleIds [32]uint8 + Account common.Address + Accounts []common.Address + BigField *big.Int + NestedStruct MidLevelTestStruct +} + +var LatestValueHolderMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"Triggered\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetDifferentPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"ReturnSeen\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"TriggerEvent\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a9182029102199092169190911790556115ef806100a96000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80639ca04f671161005b5780639ca04f67146100cc578063b9dad6b0146100ec578063bdb37c90146100ff578063da8e7a821461011457600080fd5b8063030d3ca2146100825780636c7cf955146100a45780638b659d6e146100b9575b600080fd5b6107c65b60405167ffffffffffffffff90911681526020015b60405180910390f35b6100b76100b2366004610be2565b61011b565b005b6100b76100c7366004610be2565b61041e565b6100df6100da366004610cd4565b610473565b60405161009b9190610e33565b6100df6100fa366004610be2565b61074e565b610107610857565b60405161009b9190610f29565b6003610086565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b9183908390808284376000920191909152505050815273ffffffffffffffffffffffffffffffffffffffff8816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161020d84611060565b905281546001808201845560009384526020938490208351600a9093020180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff9093169290921782559282015191929091908201906102739082611207565b5060408201516002820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff90921691909117905560608201516102c190600383019060206108e3565b5060808201516004820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90921691909117905560a08201518051610328916005840191602090910190610976565b5060c08201516006820180547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff90921691909117905560e082015180516007830180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001660f09290921c91909117815560208083015180516008860180547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff90921691909117815591810151909190600986019061040b9082611207565b5050505050505050505050505050505050565b7f7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d8a8a8a8a8a8a8a8a8a8a60405161045f9a999897969594939291906114af565b60405180910390a150505050505050505050565b61047b6109f0565b6000610488600184611579565b81548110610498576104986115b3565b6000918252602091829020604080516101008101909152600a90920201805460030b825260018101805492939192918401916104d39061116b565b80601f01602080910402602001604051908101604052809291908181526020018280546104ff9061116b565b801561054c5780601f106105215761010080835404028352916020019161054c565b820191906000526020600020905b81548152906001019060200180831161052f57829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff1681526020600192830181810494850194909303909202910180841161058157505050928452505050600482015473ffffffffffffffffffffffffffffffffffffffff16602080830191909152600583018054604080518285028101850182528281529401939283018282801561063a57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161060f575b5050509183525050600682015460170b6020808301919091526040805180820182526007808601805460f01b7fffff0000000000000000000000000000000000000000000000000000000000001683528351808501855260088801805490930b815260098801805495909701969395919486830194919392840191906106bf9061116b565b80601f01602080910402602001604051908101604052809291908181526020018280546106eb9061116b565b80156107385780601f1061070d57610100808354040283529160200191610738565b820191906000526020600020905b81548152906001019060200180831161071b57829003601f168201915b5050509190925250505090525090525092915050565b6107566109f0565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b9183908390808284376000920191909152505050815273ffffffffffffffffffffffffffffffffffffffff8816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161084684611060565b90529b9a5050505050505050505050565b606060018054806020026020016040519081016040528092919081815260200182805480156108d957602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116108945790505b5050505050905090565b6001830191839082156109665791602002820160005b8382111561093757835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026108f9565b80156109645782816101000a81549060ff0219169055600101602081600001049283019260010302610937565b505b50610972929150610a3f565b5090565b828054828255906000526020600020908101928215610966579160200282015b8281111561096657825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190610996565b6040805161010081018252600080825260606020830181905292820152908101610a18610a54565b8152600060208201819052606060408301819052820152608001610a3a610a73565b905290565b5b808211156109725760008155600101610a40565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060007dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001610a3a6040518060400160405280600060070b8152602001606081525090565b8035600381900b8114610ad857600080fd5b919050565b60008083601f840112610aef57600080fd5b50813567ffffffffffffffff811115610b0757600080fd5b602083019150836020828501011115610b1f57600080fd5b9250929050565b803560ff81168114610ad857600080fd5b806104008101831015610b4957600080fd5b92915050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610ad857600080fd5b60008083601f840112610b8557600080fd5b50813567ffffffffffffffff811115610b9d57600080fd5b6020830191508360208260051b8501011115610b1f57600080fd5b8035601781900b8114610ad857600080fd5b600060408284031215610bdc57600080fd5b50919050565b6000806000806000806000806000806104e08b8d031215610c0257600080fd5b610c0b8b610ac6565b995060208b013567ffffffffffffffff80821115610c2857600080fd5b610c348e838f01610add565b909b509950899150610c4860408e01610b26565b9850610c578e60608f01610b37565b9750610c666104608e01610b4f565b96506104808d0135915080821115610c7d57600080fd5b610c898e838f01610b73565b9096509450849150610c9e6104a08e01610bb8565b93506104c08d0135915080821115610cb557600080fd5b50610cc28d828e01610bca565b9150509295989b9194979a5092959850565b600060208284031215610ce657600080fd5b5035919050565b6000815180845260005b81811015610d1357602081850181015186830182015201610cf7565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b8060005b6020808210610d645750610d7b565b825160ff1685529384019390910190600101610d55565b50505050565b600081518084526020808501945080840160005b83811015610dc757815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101610d95565b509495945050505050565b7fffff00000000000000000000000000000000000000000000000000000000000081511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610e2b6080850182610ced565b949350505050565b60208152610e4760208201835160030b9052565b600060208301516104e0806040850152610e65610500850183610ced565b91506040850151610e7b606086018260ff169052565b506060850151610e8e6080860182610d51565b50608085015173ffffffffffffffffffffffffffffffffffffffff1661048085015260a08501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe085840381016104a0870152610eeb8483610d81565b935060c08701519150610f046104c087018360170b9052565b60e0870151915080868503018387015250610f1f8382610dd2565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015610f6b57835167ffffffffffffffff1683529284019291840191600101610f45565b50909695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715610fc957610fc9610f77565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561101657611016610f77565b604052919050565b80357fffff00000000000000000000000000000000000000000000000000000000000081168114610ad857600080fd5b8035600781900b8114610ad857600080fd5b60006040823603121561107257600080fd5b61107a610fa6565b6110838361101e565b815260208084013567ffffffffffffffff808211156110a157600080fd5b8186019150604082360312156110b657600080fd5b6110be610fa6565b6110c78361104e565b815283830135828111156110da57600080fd5b929092019136601f8401126110ee57600080fd5b82358281111561110057611100610f77565b611130857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601610fcf565b9250808352368582860101111561114657600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c9082168061117f57607f821691505b602082108103610bdc577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b601f82111561120257600081815260208120601f850160051c810160208610156111df5750805b601f850160051c820191505b818110156111fe578281556001016111eb565b5050505b505050565b815167ffffffffffffffff81111561122157611221610f77565b6112358161122f845461116b565b846111b8565b602080601f83116001811461128857600084156112525750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b1785556111fe565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b828110156112d5578886015182559484019460019091019084016112b6565b508582101561131157878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b8183526000602080850194508260005b85811015610dc75773ffffffffffffffffffffffffffffffffffffffff6113a083610b4f565b168752958201959082019060010161137a565b7fffff0000000000000000000000000000000000000000000000000000000000006113dd8261101e565b168252600060208201357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc183360301811261141757600080fd5b6040602085015282016114298161104e565b60070b604085015260208101357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe182360301811261146657600080fd5b0160208101903567ffffffffffffffff81111561148257600080fd5b80360382131561149157600080fd5b604060608601526114a6608086018284611321565b95945050505050565b60006104e08c60030b8352602081818501526114ce8285018d8f611321565b915060ff808c166040860152606085018b60005b8481101561150757836114f483610b26565b16835291840191908401906001016114e2565b505050505061152f61046084018973ffffffffffffffffffffffffffffffffffffffff169052565b82810361048084015261154381878961136a565b90506115556104a084018660170b9052565b8281036104c084015261156881856113b3565b9d9c50505050505050505050505050565b81810381811115610b49577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c6343000813000a", +} + +var LatestValueHolderABI = LatestValueHolderMetaData.ABI + +var LatestValueHolderBin = LatestValueHolderMetaData.Bin + +func DeployLatestValueHolder(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *LatestValueHolder, error) { + parsed, err := LatestValueHolderMetaData.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(LatestValueHolderBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &LatestValueHolder{address: address, abi: *parsed, LatestValueHolderCaller: LatestValueHolderCaller{contract: contract}, LatestValueHolderTransactor: LatestValueHolderTransactor{contract: contract}, LatestValueHolderFilterer: LatestValueHolderFilterer{contract: contract}}, nil +} + +type LatestValueHolder struct { + address common.Address + abi abi.ABI + LatestValueHolderCaller + LatestValueHolderTransactor + LatestValueHolderFilterer +} + +type LatestValueHolderCaller struct { + contract *bind.BoundContract +} + +type LatestValueHolderTransactor struct { + contract *bind.BoundContract +} + +type LatestValueHolderFilterer struct { + contract *bind.BoundContract +} + +type LatestValueHolderSession struct { + Contract *LatestValueHolder + CallOpts bind.CallOpts + TransactOpts bind.TransactOpts +} + +type LatestValueHolderCallerSession struct { + Contract *LatestValueHolderCaller + CallOpts bind.CallOpts +} + +type LatestValueHolderTransactorSession struct { + Contract *LatestValueHolderTransactor + TransactOpts bind.TransactOpts +} + +type LatestValueHolderRaw struct { + Contract *LatestValueHolder +} + +type LatestValueHolderCallerRaw struct { + Contract *LatestValueHolderCaller +} + +type LatestValueHolderTransactorRaw struct { + Contract *LatestValueHolderTransactor +} + +func NewLatestValueHolder(address common.Address, backend bind.ContractBackend) (*LatestValueHolder, error) { + abi, err := abi.JSON(strings.NewReader(LatestValueHolderABI)) + if err != nil { + return nil, err + } + contract, err := bindLatestValueHolder(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &LatestValueHolder{address: address, abi: abi, LatestValueHolderCaller: LatestValueHolderCaller{contract: contract}, LatestValueHolderTransactor: LatestValueHolderTransactor{contract: contract}, LatestValueHolderFilterer: LatestValueHolderFilterer{contract: contract}}, nil +} + +func NewLatestValueHolderCaller(address common.Address, caller bind.ContractCaller) (*LatestValueHolderCaller, error) { + contract, err := bindLatestValueHolder(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &LatestValueHolderCaller{contract: contract}, nil +} + +func NewLatestValueHolderTransactor(address common.Address, transactor bind.ContractTransactor) (*LatestValueHolderTransactor, error) { + contract, err := bindLatestValueHolder(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &LatestValueHolderTransactor{contract: contract}, nil +} + +func NewLatestValueHolderFilterer(address common.Address, filterer bind.ContractFilterer) (*LatestValueHolderFilterer, error) { + contract, err := bindLatestValueHolder(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &LatestValueHolderFilterer{contract: contract}, nil +} + +func bindLatestValueHolder(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := LatestValueHolderMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +func (_LatestValueHolder *LatestValueHolderRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _LatestValueHolder.Contract.LatestValueHolderCaller.contract.Call(opts, result, method, params...) +} + +func (_LatestValueHolder *LatestValueHolderRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _LatestValueHolder.Contract.LatestValueHolderTransactor.contract.Transfer(opts) +} + +func (_LatestValueHolder *LatestValueHolderRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _LatestValueHolder.Contract.LatestValueHolderTransactor.contract.Transact(opts, method, params...) +} + +func (_LatestValueHolder *LatestValueHolderCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _LatestValueHolder.Contract.contract.Call(opts, result, method, params...) +} + +func (_LatestValueHolder *LatestValueHolderTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _LatestValueHolder.Contract.contract.Transfer(opts) +} + +func (_LatestValueHolder *LatestValueHolderTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _LatestValueHolder.Contract.contract.Transact(opts, method, params...) +} + +func (_LatestValueHolder *LatestValueHolderCaller) GetDifferentPrimitiveValue(opts *bind.CallOpts) (uint64, error) { + var out []interface{} + err := _LatestValueHolder.contract.Call(opts, &out, "GetDifferentPrimitiveValue") + + if err != nil { + return *new(uint64), err + } + + out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + + return out0, err + +} + +func (_LatestValueHolder *LatestValueHolderSession) GetDifferentPrimitiveValue() (uint64, error) { + return _LatestValueHolder.Contract.GetDifferentPrimitiveValue(&_LatestValueHolder.CallOpts) +} + +func (_LatestValueHolder *LatestValueHolderCallerSession) GetDifferentPrimitiveValue() (uint64, error) { + return _LatestValueHolder.Contract.GetDifferentPrimitiveValue(&_LatestValueHolder.CallOpts) +} + +func (_LatestValueHolder *LatestValueHolderCaller) GetElementAtIndex(opts *bind.CallOpts, i *big.Int) (TestStruct, error) { + var out []interface{} + err := _LatestValueHolder.contract.Call(opts, &out, "GetElementAtIndex", i) + + if err != nil { + return *new(TestStruct), err + } + + out0 := *abi.ConvertType(out[0], new(TestStruct)).(*TestStruct) + + return out0, err + +} + +func (_LatestValueHolder *LatestValueHolderSession) GetElementAtIndex(i *big.Int) (TestStruct, error) { + return _LatestValueHolder.Contract.GetElementAtIndex(&_LatestValueHolder.CallOpts, i) +} + +func (_LatestValueHolder *LatestValueHolderCallerSession) GetElementAtIndex(i *big.Int) (TestStruct, error) { + return _LatestValueHolder.Contract.GetElementAtIndex(&_LatestValueHolder.CallOpts, i) +} + +func (_LatestValueHolder *LatestValueHolderCaller) GetPrimitiveValue(opts *bind.CallOpts) (uint64, error) { + var out []interface{} + err := _LatestValueHolder.contract.Call(opts, &out, "GetPrimitiveValue") + + if err != nil { + return *new(uint64), err + } + + out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + + return out0, err + +} + +func (_LatestValueHolder *LatestValueHolderSession) GetPrimitiveValue() (uint64, error) { + return _LatestValueHolder.Contract.GetPrimitiveValue(&_LatestValueHolder.CallOpts) +} + +func (_LatestValueHolder *LatestValueHolderCallerSession) GetPrimitiveValue() (uint64, error) { + return _LatestValueHolder.Contract.GetPrimitiveValue(&_LatestValueHolder.CallOpts) +} + +func (_LatestValueHolder *LatestValueHolderCaller) GetSliceValue(opts *bind.CallOpts) ([]uint64, error) { + var out []interface{} + err := _LatestValueHolder.contract.Call(opts, &out, "GetSliceValue") + + if err != nil { + return *new([]uint64), err + } + + out0 := *abi.ConvertType(out[0], new([]uint64)).(*[]uint64) + + return out0, err + +} + +func (_LatestValueHolder *LatestValueHolderSession) GetSliceValue() ([]uint64, error) { + return _LatestValueHolder.Contract.GetSliceValue(&_LatestValueHolder.CallOpts) +} + +func (_LatestValueHolder *LatestValueHolderCallerSession) GetSliceValue() ([]uint64, error) { + return _LatestValueHolder.Contract.GetSliceValue(&_LatestValueHolder.CallOpts) +} + +func (_LatestValueHolder *LatestValueHolderCaller) ReturnSeen(opts *bind.CallOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { + var out []interface{} + err := _LatestValueHolder.contract.Call(opts, &out, "ReturnSeen", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) + + if err != nil { + return *new(TestStruct), err + } + + out0 := *abi.ConvertType(out[0], new(TestStruct)).(*TestStruct) + + return out0, err + +} + +func (_LatestValueHolder *LatestValueHolderSession) ReturnSeen(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { + return _LatestValueHolder.Contract.ReturnSeen(&_LatestValueHolder.CallOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +func (_LatestValueHolder *LatestValueHolderCallerSession) ReturnSeen(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { + return _LatestValueHolder.Contract.ReturnSeen(&_LatestValueHolder.CallOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +func (_LatestValueHolder *LatestValueHolderTransactor) AddTestStruct(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { + return _LatestValueHolder.contract.Transact(opts, "AddTestStruct", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +func (_LatestValueHolder *LatestValueHolderSession) AddTestStruct(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { + return _LatestValueHolder.Contract.AddTestStruct(&_LatestValueHolder.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +func (_LatestValueHolder *LatestValueHolderTransactorSession) AddTestStruct(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { + return _LatestValueHolder.Contract.AddTestStruct(&_LatestValueHolder.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +func (_LatestValueHolder *LatestValueHolderTransactor) TriggerEvent(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { + return _LatestValueHolder.contract.Transact(opts, "TriggerEvent", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +func (_LatestValueHolder *LatestValueHolderSession) TriggerEvent(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { + return _LatestValueHolder.Contract.TriggerEvent(&_LatestValueHolder.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +func (_LatestValueHolder *LatestValueHolderTransactorSession) TriggerEvent(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { + return _LatestValueHolder.Contract.TriggerEvent(&_LatestValueHolder.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) +} + +type LatestValueHolderTriggeredIterator struct { + Event *LatestValueHolderTriggered + + contract *bind.BoundContract + event string + + logs chan types.Log + sub ethereum.Subscription + done bool + fail error +} + +func (it *LatestValueHolderTriggeredIterator) Next() bool { + + if it.fail != nil { + return false + } + + if it.done { + select { + case log := <-it.logs: + it.Event = new(LatestValueHolderTriggered) + 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(LatestValueHolderTriggered) + 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 *LatestValueHolderTriggeredIterator) Error() error { + return it.fail +} + +func (it *LatestValueHolderTriggeredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +type LatestValueHolderTriggered struct { + Field int32 + DifferentField string + OracleId uint8 + OracleIds [32]uint8 + Account common.Address + Accounts []common.Address + BigField *big.Int + NestedStruct MidLevelTestStruct + Raw types.Log +} + +func (_LatestValueHolder *LatestValueHolderFilterer) FilterTriggered(opts *bind.FilterOpts) (*LatestValueHolderTriggeredIterator, error) { + + logs, sub, err := _LatestValueHolder.contract.FilterLogs(opts, "Triggered") + if err != nil { + return nil, err + } + return &LatestValueHolderTriggeredIterator{contract: _LatestValueHolder.contract, event: "Triggered", logs: logs, sub: sub}, nil +} + +func (_LatestValueHolder *LatestValueHolderFilterer) WatchTriggered(opts *bind.WatchOpts, sink chan<- *LatestValueHolderTriggered) (event.Subscription, error) { + + logs, sub, err := _LatestValueHolder.contract.WatchLogs(opts, "Triggered") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + + event := new(LatestValueHolderTriggered) + if err := _LatestValueHolder.contract.UnpackLog(event, "Triggered", 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 (_LatestValueHolder *LatestValueHolderFilterer) ParseTriggered(log types.Log) (*LatestValueHolderTriggered, error) { + event := new(LatestValueHolderTriggered) + if err := _LatestValueHolder.contract.UnpackLog(event, "Triggered", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +func (_LatestValueHolder *LatestValueHolder) ParseLog(log types.Log) (generated.AbigenLog, error) { + switch log.Topics[0] { + case _LatestValueHolder.abi.Events["Triggered"].ID: + return _LatestValueHolder.ParseTriggered(log) + + default: + return nil, fmt.Errorf("abigen wrapper received unknown log topic: %v", log.Topics[0]) + } +} + +func (LatestValueHolderTriggered) Topic() common.Hash { + return common.HexToHash("0x7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d") +} + +func (_LatestValueHolder *LatestValueHolder) Address() common.Address { + return _LatestValueHolder.address +} + +type LatestValueHolderInterface interface { + GetDifferentPrimitiveValue(opts *bind.CallOpts) (uint64, error) + + GetElementAtIndex(opts *bind.CallOpts, i *big.Int) (TestStruct, error) + + GetPrimitiveValue(opts *bind.CallOpts) (uint64, error) + + GetSliceValue(opts *bind.CallOpts) ([]uint64, error) + + ReturnSeen(opts *bind.CallOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) + + AddTestStruct(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) + + TriggerEvent(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) + + FilterTriggered(opts *bind.FilterOpts) (*LatestValueHolderTriggeredIterator, error) + + WatchTriggered(opts *bind.WatchOpts, sink chan<- *LatestValueHolderTriggered) (event.Subscription, error) + + ParseTriggered(log types.Log) (*LatestValueHolderTriggered, error) + + ParseLog(log types.Log) (generated.AbigenLog, error) + + Address() common.Address +} diff --git a/core/gethwrappers/go_generate.go b/core/gethwrappers/go_generate.go index 07e4fa9b8f3..5a4ef541148 100644 --- a/core/gethwrappers/go_generate.go +++ b/core/gethwrappers/go_generate.go @@ -138,7 +138,9 @@ package gethwrappers //go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/MockAggregatorProxy/MockAggregatorProxy.abi ../../contracts/solc/v0.8.6/MockAggregatorProxy/MockAggregatorProxy.bin MockAggregatorProxy mock_aggregator_proxy // Log tester -//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.19/LogEmitter/LogEmitter.abi ../../contracts/solc/v0.8.19/LogEmitter/LogEmitter.bin LogEmitter log_emitter + +// ChainReader test contract +//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.19/ChainReaderTestContract/LatestValueHolder.abi ../../contracts/solc/v0.8.19/ChainReaderTestContract/LatestValueHolder.bin LatestValueHolder chain_reader_example // Chainlink Functions //go:generate go generate ./functions diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 360524bd9e1..9969fb329e8 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -1,7 +1,5 @@ package evm_test -//go:generate ./testfiles/chainlink_reader_test_setup.sh - import ( "crypto/ecdsa" "math" @@ -27,11 +25,11 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm/mocks" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/chain_reader_example" "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/evm" - "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/testfiles" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) @@ -49,7 +47,7 @@ type chainReaderInterfaceTester struct { auth *bind.TransactOpts sim *backends.SimulatedBackend pk *ecdsa.PrivateKey - evmTest *testfiles.Testfiles + evmTest *chain_reader_example.LatestValueHolder cr evm.ChainReaderService } @@ -75,7 +73,7 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { it.chainConfig = types.ChainReaderConfig{ ChainContractReaders: map[string]types.ChainContractReader{ AnyContractName: { - ContractABI: testfiles.TestfilesMetaData.ABI, + ContractABI: chain_reader_example.LatestValueHolderMetaData.ABI, ChainReaderDefinitions: map[string]types.ChainReaderDefinition{ MethodTakingLatestParamsReturningTestStruct: { ChainSpecificName: "GetElementAtIndex", @@ -111,7 +109,7 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { }, }, AnySecondContractName: { - ContractABI: testfiles.TestfilesMetaData.ABI, + ContractABI: chain_reader_example.LatestValueHolderMetaData.ABI, ChainReaderDefinitions: map[string]types.ChainReaderDefinition{ MethodReturningUint64: { ChainSpecificName: "GetDifferentPrimitiveValue", @@ -154,11 +152,11 @@ func (it *chainReaderInterfaceTester) GetChainReader(t *testing.T) clcommontypes } func (it *chainReaderInterfaceTester) SetLatestValue(t *testing.T, testStruct *TestStruct) { - it.sendTxWithTestStruct(t, testStruct, (*testfiles.TestfilesTransactor).AddTestStruct) + it.sendTxWithTestStruct(t, testStruct, (*chain_reader_example.LatestValueHolderTransactor).AddTestStruct) } func (it *chainReaderInterfaceTester) TriggerEvent(t *testing.T, testStruct *TestStruct) { - it.sendTxWithTestStruct(t, testStruct, (*testfiles.TestfilesTransactor).TriggerEvent) + it.sendTxWithTestStruct(t, testStruct, (*chain_reader_example.LatestValueHolderTransactor).TriggerEvent) } func (it *chainReaderInterfaceTester) GetBindings(t *testing.T) []clcommontypes.BoundContract { @@ -168,11 +166,11 @@ func (it *chainReaderInterfaceTester) GetBindings(t *testing.T) []clcommontypes. } } -type testStructFn = func(*testfiles.TestfilesTransactor, *bind.TransactOpts, int32, string, uint8, [32]uint8, common.Address, []common.Address, *big.Int, testfiles.MidLevelTestStruct) (*evmtypes.Transaction, error) +type testStructFn = func(*chain_reader_example.LatestValueHolderTransactor, *bind.TransactOpts, int32, string, uint8, [32]uint8, common.Address, []common.Address, *big.Int, chain_reader_example.MidLevelTestStruct) (*evmtypes.Transaction, error) func (it *chainReaderInterfaceTester) sendTxWithTestStruct(t *testing.T, testStruct *TestStruct, fn testStructFn) { tx, err := fn( - &it.evmTest.TestfilesTransactor, + &it.evmTest.LatestValueHolderTransactor, it.auth, testStruct.Field, testStruct.DifferentField, @@ -232,7 +230,7 @@ func (it *chainReaderInterfaceTester) deployNewContract(t *testing.T) string { // Not sure if there's a better way to get it. it.auth.GasLimit = 10552800 - address, tx, ts, err := testfiles.DeployTestfiles(it.auth, it.sim) + address, tx, ts, err := chain_reader_example.DeployLatestValueHolder(it.auth, it.sim) require.NoError(t, err) it.sim.Commit() @@ -288,8 +286,8 @@ func getOracleIDs(first TestStruct) [32]byte { return oracleIDs } -func toInternalType(testStruct TestStruct) testfiles.TestStruct { - return testfiles.TestStruct{ +func toInternalType(testStruct TestStruct) chain_reader_example.TestStruct { + return chain_reader_example.TestStruct{ Field: testStruct.Field, DifferentField: testStruct.DifferentField, OracleId: byte(testStruct.OracleID), @@ -301,10 +299,10 @@ func toInternalType(testStruct TestStruct) testfiles.TestStruct { } } -func midToInternalType(m MidLevelTestStruct) testfiles.MidLevelTestStruct { - return testfiles.MidLevelTestStruct{ +func midToInternalType(m MidLevelTestStruct) chain_reader_example.MidLevelTestStruct { + return chain_reader_example.MidLevelTestStruct{ FixedBytes: m.FixedBytes, - Inner: testfiles.InnerTestStruct{ + Inner: chain_reader_example.InnerTestStruct{ I: int64(m.Inner.I), S: m.Inner.S, }, diff --git a/core/services/relay/evm/codec_test.go b/core/services/relay/evm/codec_test.go index bc02c9957d9..2ce57a36077 100644 --- a/core/services/relay/evm/codec_test.go +++ b/core/services/relay/evm/codec_test.go @@ -15,9 +15,9 @@ import ( commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" . "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" //nolint common practice to import test mods with . + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/chain_reader_example" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" - "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/testfiles" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) @@ -109,11 +109,11 @@ func encodeFieldsOnSliceOrArray(t *testing.T, request *EncodeRequest) []byte { switch request.TestOn { case TestItemArray1Type: - args[0] = [1]testfiles.TestStruct{toInternalType(request.TestStructs[0])} + args[0] = [1]chain_reader_example.TestStruct{toInternalType(request.TestStructs[0])} case TestItemArray2Type: - args[0] = [2]testfiles.TestStruct{toInternalType(request.TestStructs[0]), toInternalType(request.TestStructs[1])} + args[0] = [2]chain_reader_example.TestStruct{toInternalType(request.TestStructs[0]), toInternalType(request.TestStructs[1])} default: - tmp := make([]testfiles.TestStruct, len(request.TestStructs)) + tmp := make([]chain_reader_example.TestStruct, len(request.TestStructs)) for i, ts := range request.TestStructs { tmp[i] = toInternalType(ts) } diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi deleted file mode 100644 index 603c33acdcd..00000000000 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.abi +++ /dev/null @@ -1 +0,0 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"int32","name":"field","type":"int32"},{"indexed":false,"internalType":"string","name":"differentField","type":"string"},{"indexed":false,"internalType":"uint8","name":"oracleId","type":"uint8"},{"indexed":false,"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"indexed":false,"internalType":"address","name":"Account","type":"address"},{"indexed":false,"internalType":"address[]","name":"Accounts","type":"address[]"},{"indexed":false,"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"indexed":false,"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"Triggered","type":"event"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"address","name":"account","type":"address"},{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"AddTestStruct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"GetDifferentPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"GetElementAtIndex","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"address","name":"Account","type":"address"},{"internalType":"address[]","name":"Accounts","type":"address[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GetPrimitiveValue","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"GetSliceValue","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"address","name":"account","type":"address"},{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"ReturnSeen","outputs":[{"components":[{"internalType":"int32","name":"Field","type":"int32"},{"internalType":"string","name":"DifferentField","type":"string"},{"internalType":"uint8","name":"OracleId","type":"uint8"},{"internalType":"uint8[32]","name":"OracleIds","type":"uint8[32]"},{"internalType":"address","name":"Account","type":"address"},{"internalType":"address[]","name":"Accounts","type":"address[]"},{"internalType":"int192","name":"BigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"NestedStruct","type":"tuple"}],"internalType":"struct TestStruct","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int32","name":"field","type":"int32"},{"internalType":"string","name":"differentField","type":"string"},{"internalType":"uint8","name":"oracleId","type":"uint8"},{"internalType":"uint8[32]","name":"oracleIds","type":"uint8[32]"},{"internalType":"address","name":"account","type":"address"},{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"int192","name":"bigField","type":"int192"},{"components":[{"internalType":"bytes2","name":"FixedBytes","type":"bytes2"},{"components":[{"internalType":"int64","name":"I","type":"int64"},{"internalType":"string","name":"S","type":"string"}],"internalType":"struct InnerTestStruct","name":"Inner","type":"tuple"}],"internalType":"struct MidLevelTestStruct","name":"nestedStruct","type":"tuple"}],"name":"TriggerEvent","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin deleted file mode 100644 index 5617cf53e25..00000000000 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.bin +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a91820291021990921691909117905561125b806100a96000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80639ca04f671161005b5780639ca04f67146100cc578063b9dad6b0146100ec578063bdb37c90146100ff578063da8e7a821461011457600080fd5b8063030d3ca2146100825780636c7cf955146100a45780638b659d6e146100b9575b600080fd5b6107c65b60405167ffffffffffffffff90911681526020015b60405180910390f35b6100b76100b2366004610b6c565b61011b565b005b6100b76100c7366004610b6c565b610371565b6100df6100da366004610c5e565b6103c6565b60405161009b9190610f97565b6100df6100fa366004610b6c565b610685565b610107610781565b60405161009b9190610e8c565b6003610086565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526001600160a01b038816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b6020820152604001610200846110d7565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936102579392850192919091019061080d565b50604082015160028201805460ff191660ff90921691909117905560608201516102879060038301906020610891565b5060808201516004820180546001600160a01b0319166001600160a01b0390921691909117905560a082015180516102c991600584019160209091019061091f565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff1990911617835580820151805191939261035e9260098901929091019061080d565b5050505050505050505050505050505050565b7f7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d8a8a8a8a8a8a8a8a8a8a6040516103b29a99989796959493929190610eda565b60405180910390a150505050505050505050565b6103ce610974565b60006103db6001846110b2565b815481106103eb576103eb6111f9565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b8152602001600182018054610432906111c4565b80601f016020809104026020016040519081016040528092919081815260200182805461045e906111c4565b80156104ab5780601f10610480576101008083540402835291602001916104ab565b820191906000526020600020905b81548152906001019060200180831161048e57829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116104e05750505092845250505060048201546001600160a01b0316602080830191909152600583018054604080518285028101850182528281529401939283018282801561057f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610561575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b815260098801805495909701969395919486830194919392840191906105f6906111c4565b80601f0160208091040260200160405190810160405280929190818152602001828054610622906111c4565b801561066f5780601f106106445761010080835404028352916020019161066f565b820191906000526020600020905b81548152906001019060200180831161065257829003601f168201915b5050509190925250505090525090525092915050565b61068d610974565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526001600160a01b038816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b6020820152604001610770846110d7565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561080357602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116107be5790505b5050505050905090565b828054610819906111c4565b90600052602060002090601f01602090048101928261083b5760008555610881565b82601f1061085457805160ff1916838001178555610881565b82800160010185558215610881579182015b82811115610881578251825591602001919060010190610866565b5061088d9291506109c3565b5090565b6001830191839082156108815791602002820160005b838211156108e557835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026108a7565b80156109125782816101000a81549060ff02191690556001016020816000010492830192600103026108e5565b505061088d9291506109c3565b828054828255906000526020600020908101928215610881579160200282015b8281111561088157825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061093f565b604080516101008101825260008082526060602083018190529282015290810161099c6109d8565b81526000602082018190526060604083018190528201526080016109be6109f7565b905290565b5b8082111561088d57600081556001016109c4565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016109be6040518060400160405280600060070b8152602001606081525090565b80356001600160a01b0381168114610a4a57600080fd5b919050565b60008083601f840112610a6157600080fd5b50813567ffffffffffffffff811115610a7957600080fd5b6020830191508360208260051b8501011115610a9457600080fd5b9250929050565b806104008101831015610aad57600080fd5b92915050565b80356001600160f01b031981168114610a4a57600080fd5b8035601781900b8114610a4a57600080fd5b8035600381900b8114610a4a57600080fd5b8035600781900b8114610a4a57600080fd5b60008083601f840112610b1357600080fd5b50813567ffffffffffffffff811115610b2b57600080fd5b602083019150836020828501011115610a9457600080fd5b600060408284031215610b5557600080fd5b50919050565b803560ff81168114610a4a57600080fd5b6000806000806000806000806000806104e08b8d031215610b8c57600080fd5b610b958b610add565b995060208b013567ffffffffffffffff80821115610bb257600080fd5b610bbe8e838f01610b01565b909b509950899150610bd260408e01610b5b565b9850610be18e60608f01610a9b565b9750610bf06104608e01610a33565b96506104808d0135915080821115610c0757600080fd5b610c138e838f01610a4f565b9096509450849150610c286104a08e01610acb565b93506104c08d0135915080821115610c3f57600080fd5b50610c4c8d828e01610b43565b9150509295989b9194979a5092959850565b600060208284031215610c7057600080fd5b5035919050565b8183526000602080850194508260005b85811015610cb3576001600160a01b03610ca083610a33565b1687529582019590820190600101610c87565b509495945050505050565b600081518084526020808501945080840160005b83811015610cb35781516001600160a01b031687529582019590820190600101610cd2565b8060005b6020808210610d0a5750610d21565b825160ff1685529384019390910190600101610cfb565b50505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815180845260005b81811015610d7657602081850181015186830182015201610d5a565b81811115610d88576000602083870101525b50601f01601f19169290920160200192915050565b6001600160f01b0319610daf82610ab3565b16825260006020820135603e19833603018112610dcb57600080fd5b604060208501528201610ddd81610aef565b60070b60408501526020810135601e19823603018112610dfc57600080fd5b8101803567ffffffffffffffff811115610e1557600080fd5b803603831315610e2457600080fd5b60406060870152610e3c608087018260208501610d27565b9695505050505050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610e846080850182610d50565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610ece57835167ffffffffffffffff1683529284019291840191600101610ea8565b50909695505050505050565b60006104e08c60030b835260208181850152610ef98285018d8f610d27565b915060ff808c166040860152606085018b60005b84811015610f325783610f1f83610b5b565b1683529184019190840190600101610f0d565b5050505050610f4d6104608401896001600160a01b03169052565b828103610480840152610f61818789610c77565b9050610f736104a084018660170b9052565b8281036104c0840152610f868185610d9d565b9d9c50505050505050505050505050565b60208152610fab60208201835160030b9052565b600060208301516104e0806040850152610fc9610500850183610d50565b91506040850151610fdf606086018260ff169052565b506060850151610ff26080860182610cf7565b5060808501516001600160a01b031661048085015260a0850151601f1985840381016104a08701526110248483610cbe565b935060c0870151915061103d6104c087018360170b9052565b60e0870151915080868503018387015250610e3c8382610e46565b6040805190810167ffffffffffffffff8111828210171561107b5761107b61120f565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156110aa576110aa61120f565b604052919050565b6000828210156110d257634e487b7160e01b600052601160045260246000fd5b500390565b6000604082360312156110e957600080fd5b6110f1611058565b6110fa83610ab3565b815260208084013567ffffffffffffffff8082111561111857600080fd5b81860191506040823603121561112d57600080fd5b611135611058565b61113e83610aef565b8152838301358281111561115157600080fd5b929092019136601f84011261116557600080fd5b8235828111156111775761117761120f565b611189601f8201601f19168601611081565b9250808352368582860101111561119f57600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c908216806111d857607f821691505b60208210811415610b5557634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220dce1950ddad4c207dfaef7c48111c80f3a73cf85e5711bf7a3afe15473519a1664736f6c63430008060033 \ No newline at end of file diff --git a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go b/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go deleted file mode 100644 index f6d0d120742..00000000000 --- a/core/services/relay/evm/testfiles/chain_reader_test_contract_gen.go +++ /dev/null @@ -1,565 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package testfiles - -import ( - "errors" - "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" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// InnerTestStruct is an auto generated low-level Go binding around an user-defined struct. -type InnerTestStruct struct { - I int64 - S string -} - -// MidLevelTestStruct is an auto generated low-level Go binding around an user-defined struct. -type MidLevelTestStruct struct { - FixedBytes [2]byte - Inner InnerTestStruct -} - -// TestStruct is an auto generated low-level Go binding around an user-defined struct. -type TestStruct struct { - Field int32 - DifferentField string - OracleId uint8 - OracleIds [32]uint8 - Account common.Address - Accounts []common.Address - BigField *big.Int - NestedStruct MidLevelTestStruct -} - -// TestfilesMetaData contains all meta data concerning the Testfiles contract. -var TestfilesMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"Triggered\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetDifferentPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"ReturnSeen\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"TriggerEvent\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a91820291021990921691909117905561125b806100a96000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80639ca04f671161005b5780639ca04f67146100cc578063b9dad6b0146100ec578063bdb37c90146100ff578063da8e7a821461011457600080fd5b8063030d3ca2146100825780636c7cf955146100a45780638b659d6e146100b9575b600080fd5b6107c65b60405167ffffffffffffffff90911681526020015b60405180910390f35b6100b76100b2366004610b6c565b61011b565b005b6100b76100c7366004610b6c565b610371565b6100df6100da366004610c5e565b6103c6565b60405161009b9190610f97565b6100df6100fa366004610b6c565b610685565b610107610781565b60405161009b9190610e8c565b6003610086565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526001600160a01b038816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b6020820152604001610200846110d7565b905281546001818101845560009384526020938490208351600a90930201805460039390930b63ffffffff1663ffffffff19909316929092178255838301518051939492936102579392850192919091019061080d565b50604082015160028201805460ff191660ff90921691909117905560608201516102879060038301906020610891565b5060808201516004820180546001600160a01b0319166001600160a01b0390921691909117905560a082015180516102c991600584019160209091019061091f565b5060c082015160068201805460179290920b6001600160c01b03166001600160c01b031990921691909117905560e082015180516007808401805460f09390931c61ffff1990931692909217825560208084015180516008870180549190940b67ffffffffffffffff1667ffffffffffffffff1990911617835580820151805191939261035e9260098901929091019061080d565b5050505050505050505050505050505050565b7f7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d8a8a8a8a8a8a8a8a8a8a6040516103b29a99989796959493929190610eda565b60405180910390a150505050505050505050565b6103ce610974565b60006103db6001846110b2565b815481106103eb576103eb6111f9565b90600052602060002090600a0201604051806101000160405290816000820160009054906101000a900460030b60030b60030b8152602001600182018054610432906111c4565b80601f016020809104026020016040519081016040528092919081815260200182805461045e906111c4565b80156104ab5780601f10610480576101008083540402835291602001916104ab565b820191906000526020600020905b81548152906001019060200180831161048e57829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116104e05750505092845250505060048201546001600160a01b0316602080830191909152600583018054604080518285028101850182528281529401939283018282801561057f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610561575b50505091835250506006820154601790810b810b900b6020808301919091526040805180820182526007808601805460f01b6001600160f01b031916835283518085018552600888018054840b840b90930b815260098801805495909701969395919486830194919392840191906105f6906111c4565b80601f0160208091040260200160405190810160405280929190818152602001828054610622906111c4565b801561066f5780601f106106445761010080835404028352916020019161066f565b820191906000526020600020905b81548152906001019060200180831161065257829003601f168201915b5050509190925250505090525090525092915050565b61068d610974565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b918390839080828437600092019190915250505081526001600160a01b038816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b6020820152604001610770846110d7565b90529b9a5050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561080357602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116107be5790505b5050505050905090565b828054610819906111c4565b90600052602060002090601f01602090048101928261083b5760008555610881565b82601f1061085457805160ff1916838001178555610881565b82800160010185558215610881579182015b82811115610881578251825591602001919060010190610866565b5061088d9291506109c3565b5090565b6001830191839082156108815791602002820160005b838211156108e557835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026108a7565b80156109125782816101000a81549060ff02191690556001016020816000010492830192600103026108e5565b505061088d9291506109c3565b828054828255906000526020600020908101928215610881579160200282015b8281111561088157825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061093f565b604080516101008101825260008082526060602083018190529282015290810161099c6109d8565b81526000602082018190526060604083018190528201526080016109be6109f7565b905290565b5b8082111561088d57600081556001016109c4565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060006001600160f01b03191681526020016109be6040518060400160405280600060070b8152602001606081525090565b80356001600160a01b0381168114610a4a57600080fd5b919050565b60008083601f840112610a6157600080fd5b50813567ffffffffffffffff811115610a7957600080fd5b6020830191508360208260051b8501011115610a9457600080fd5b9250929050565b806104008101831015610aad57600080fd5b92915050565b80356001600160f01b031981168114610a4a57600080fd5b8035601781900b8114610a4a57600080fd5b8035600381900b8114610a4a57600080fd5b8035600781900b8114610a4a57600080fd5b60008083601f840112610b1357600080fd5b50813567ffffffffffffffff811115610b2b57600080fd5b602083019150836020828501011115610a9457600080fd5b600060408284031215610b5557600080fd5b50919050565b803560ff81168114610a4a57600080fd5b6000806000806000806000806000806104e08b8d031215610b8c57600080fd5b610b958b610add565b995060208b013567ffffffffffffffff80821115610bb257600080fd5b610bbe8e838f01610b01565b909b509950899150610bd260408e01610b5b565b9850610be18e60608f01610a9b565b9750610bf06104608e01610a33565b96506104808d0135915080821115610c0757600080fd5b610c138e838f01610a4f565b9096509450849150610c286104a08e01610acb565b93506104c08d0135915080821115610c3f57600080fd5b50610c4c8d828e01610b43565b9150509295989b9194979a5092959850565b600060208284031215610c7057600080fd5b5035919050565b8183526000602080850194508260005b85811015610cb3576001600160a01b03610ca083610a33565b1687529582019590820190600101610c87565b509495945050505050565b600081518084526020808501945080840160005b83811015610cb35781516001600160a01b031687529582019590820190600101610cd2565b8060005b6020808210610d0a5750610d21565b825160ff1685529384019390910190600101610cfb565b50505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815180845260005b81811015610d7657602081850181015186830182015201610d5a565b81811115610d88576000602083870101525b50601f01601f19169290920160200192915050565b6001600160f01b0319610daf82610ab3565b16825260006020820135603e19833603018112610dcb57600080fd5b604060208501528201610ddd81610aef565b60070b60408501526020810135601e19823603018112610dfc57600080fd5b8101803567ffffffffffffffff811115610e1557600080fd5b803603831315610e2457600080fd5b60406060870152610e3c608087018260208501610d27565b9695505050505050565b61ffff60f01b81511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610e846080850182610d50565b949350505050565b6020808252825182820181905260009190848201906040850190845b81811015610ece57835167ffffffffffffffff1683529284019291840191600101610ea8565b50909695505050505050565b60006104e08c60030b835260208181850152610ef98285018d8f610d27565b915060ff808c166040860152606085018b60005b84811015610f325783610f1f83610b5b565b1683529184019190840190600101610f0d565b5050505050610f4d6104608401896001600160a01b03169052565b828103610480840152610f61818789610c77565b9050610f736104a084018660170b9052565b8281036104c0840152610f868185610d9d565b9d9c50505050505050505050505050565b60208152610fab60208201835160030b9052565b600060208301516104e0806040850152610fc9610500850183610d50565b91506040850151610fdf606086018260ff169052565b506060850151610ff26080860182610cf7565b5060808501516001600160a01b031661048085015260a0850151601f1985840381016104a08701526110248483610cbe565b935060c0870151915061103d6104c087018360170b9052565b60e0870151915080868503018387015250610e3c8382610e46565b6040805190810167ffffffffffffffff8111828210171561107b5761107b61120f565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156110aa576110aa61120f565b604052919050565b6000828210156110d257634e487b7160e01b600052601160045260246000fd5b500390565b6000604082360312156110e957600080fd5b6110f1611058565b6110fa83610ab3565b815260208084013567ffffffffffffffff8082111561111857600080fd5b81860191506040823603121561112d57600080fd5b611135611058565b61113e83610aef565b8152838301358281111561115157600080fd5b929092019136601f84011261116557600080fd5b8235828111156111775761117761120f565b611189601f8201601f19168601611081565b9250808352368582860101111561119f57600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c908216806111d857607f821691505b60208210811415610b5557634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220dce1950ddad4c207dfaef7c48111c80f3a73cf85e5711bf7a3afe15473519a1664736f6c63430008060033", -} - -// TestfilesABI is the input ABI used to generate the binding from. -// Deprecated: Use TestfilesMetaData.ABI instead. -var TestfilesABI = TestfilesMetaData.ABI - -// TestfilesBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use TestfilesMetaData.Bin instead. -var TestfilesBin = TestfilesMetaData.Bin - -// DeployTestfiles deploys a new Ethereum contract, binding an instance of Testfiles to it. -func DeployTestfiles(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Testfiles, error) { - parsed, err := TestfilesMetaData.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(TestfilesBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &Testfiles{TestfilesCaller: TestfilesCaller{contract: contract}, TestfilesTransactor: TestfilesTransactor{contract: contract}, TestfilesFilterer: TestfilesFilterer{contract: contract}}, nil -} - -// Testfiles is an auto generated Go binding around an Ethereum contract. -type Testfiles struct { - TestfilesCaller // Read-only binding to the contract - TestfilesTransactor // Write-only binding to the contract - TestfilesFilterer // Log filterer for contract events -} - -// TestfilesCaller is an auto generated read-only Go binding around an Ethereum contract. -type TestfilesCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// TestfilesTransactor is an auto generated write-only Go binding around an Ethereum contract. -type TestfilesTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// TestfilesFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type TestfilesFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// TestfilesSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type TestfilesSession struct { - Contract *Testfiles // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// TestfilesCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type TestfilesCallerSession struct { - Contract *TestfilesCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// TestfilesTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type TestfilesTransactorSession struct { - Contract *TestfilesTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// TestfilesRaw is an auto generated low-level Go binding around an Ethereum contract. -type TestfilesRaw struct { - Contract *Testfiles // Generic contract binding to access the raw methods on -} - -// TestfilesCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type TestfilesCallerRaw struct { - Contract *TestfilesCaller // Generic read-only contract binding to access the raw methods on -} - -// TestfilesTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type TestfilesTransactorRaw struct { - Contract *TestfilesTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewTestfiles creates a new instance of Testfiles, bound to a specific deployed contract. -func NewTestfiles(address common.Address, backend bind.ContractBackend) (*Testfiles, error) { - contract, err := bindTestfiles(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &Testfiles{TestfilesCaller: TestfilesCaller{contract: contract}, TestfilesTransactor: TestfilesTransactor{contract: contract}, TestfilesFilterer: TestfilesFilterer{contract: contract}}, nil -} - -// NewTestfilesCaller creates a new read-only instance of Testfiles, bound to a specific deployed contract. -func NewTestfilesCaller(address common.Address, caller bind.ContractCaller) (*TestfilesCaller, error) { - contract, err := bindTestfiles(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &TestfilesCaller{contract: contract}, nil -} - -// NewTestfilesTransactor creates a new write-only instance of Testfiles, bound to a specific deployed contract. -func NewTestfilesTransactor(address common.Address, transactor bind.ContractTransactor) (*TestfilesTransactor, error) { - contract, err := bindTestfiles(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &TestfilesTransactor{contract: contract}, nil -} - -// NewTestfilesFilterer creates a new log filterer instance of Testfiles, bound to a specific deployed contract. -func NewTestfilesFilterer(address common.Address, filterer bind.ContractFilterer) (*TestfilesFilterer, error) { - contract, err := bindTestfiles(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &TestfilesFilterer{contract: contract}, nil -} - -// bindTestfiles binds a generic wrapper to an already deployed contract. -func bindTestfiles(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := TestfilesMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Testfiles *TestfilesRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Testfiles.Contract.TestfilesCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Testfiles *TestfilesRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Testfiles.Contract.TestfilesTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Testfiles *TestfilesRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Testfiles.Contract.TestfilesTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Testfiles *TestfilesCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Testfiles.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Testfiles *TestfilesTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Testfiles.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Testfiles *TestfilesTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Testfiles.Contract.contract.Transact(opts, method, params...) -} - -// GetDifferentPrimitiveValue is a free data retrieval call binding the contract method 0x030d3ca2. -// -// Solidity: function GetDifferentPrimitiveValue() pure returns(uint64) -func (_Testfiles *TestfilesCaller) GetDifferentPrimitiveValue(opts *bind.CallOpts) (uint64, error) { - var out []interface{} - err := _Testfiles.contract.Call(opts, &out, "GetDifferentPrimitiveValue") - - if err != nil { - return *new(uint64), err - } - - out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) - - return out0, err - -} - -// GetDifferentPrimitiveValue is a free data retrieval call binding the contract method 0x030d3ca2. -// -// Solidity: function GetDifferentPrimitiveValue() pure returns(uint64) -func (_Testfiles *TestfilesSession) GetDifferentPrimitiveValue() (uint64, error) { - return _Testfiles.Contract.GetDifferentPrimitiveValue(&_Testfiles.CallOpts) -} - -// GetDifferentPrimitiveValue is a free data retrieval call binding the contract method 0x030d3ca2. -// -// Solidity: function GetDifferentPrimitiveValue() pure returns(uint64) -func (_Testfiles *TestfilesCallerSession) GetDifferentPrimitiveValue() (uint64, error) { - return _Testfiles.Contract.GetDifferentPrimitiveValue(&_Testfiles.CallOpts) -} - -// GetElementAtIndex is a free data retrieval call binding the contract method 0x9ca04f67. -// -// Solidity: function GetElementAtIndex(uint256 i) view returns((int32,string,uint8,uint8[32],address,address[],int192,(bytes2,(int64,string)))) -func (_Testfiles *TestfilesCaller) GetElementAtIndex(opts *bind.CallOpts, i *big.Int) (TestStruct, error) { - var out []interface{} - err := _Testfiles.contract.Call(opts, &out, "GetElementAtIndex", i) - - if err != nil { - return *new(TestStruct), err - } - - out0 := *abi.ConvertType(out[0], new(TestStruct)).(*TestStruct) - - return out0, err - -} - -// GetElementAtIndex is a free data retrieval call binding the contract method 0x9ca04f67. -// -// Solidity: function GetElementAtIndex(uint256 i) view returns((int32,string,uint8,uint8[32],address,address[],int192,(bytes2,(int64,string)))) -func (_Testfiles *TestfilesSession) GetElementAtIndex(i *big.Int) (TestStruct, error) { - return _Testfiles.Contract.GetElementAtIndex(&_Testfiles.CallOpts, i) -} - -// GetElementAtIndex is a free data retrieval call binding the contract method 0x9ca04f67. -// -// Solidity: function GetElementAtIndex(uint256 i) view returns((int32,string,uint8,uint8[32],address,address[],int192,(bytes2,(int64,string)))) -func (_Testfiles *TestfilesCallerSession) GetElementAtIndex(i *big.Int) (TestStruct, error) { - return _Testfiles.Contract.GetElementAtIndex(&_Testfiles.CallOpts, i) -} - -// GetPrimitiveValue is a free data retrieval call binding the contract method 0xda8e7a82. -// -// Solidity: function GetPrimitiveValue() pure returns(uint64) -func (_Testfiles *TestfilesCaller) GetPrimitiveValue(opts *bind.CallOpts) (uint64, error) { - var out []interface{} - err := _Testfiles.contract.Call(opts, &out, "GetPrimitiveValue") - - if err != nil { - return *new(uint64), err - } - - out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) - - return out0, err - -} - -// GetPrimitiveValue is a free data retrieval call binding the contract method 0xda8e7a82. -// -// Solidity: function GetPrimitiveValue() pure returns(uint64) -func (_Testfiles *TestfilesSession) GetPrimitiveValue() (uint64, error) { - return _Testfiles.Contract.GetPrimitiveValue(&_Testfiles.CallOpts) -} - -// GetPrimitiveValue is a free data retrieval call binding the contract method 0xda8e7a82. -// -// Solidity: function GetPrimitiveValue() pure returns(uint64) -func (_Testfiles *TestfilesCallerSession) GetPrimitiveValue() (uint64, error) { - return _Testfiles.Contract.GetPrimitiveValue(&_Testfiles.CallOpts) -} - -// GetSliceValue is a free data retrieval call binding the contract method 0xbdb37c90. -// -// Solidity: function GetSliceValue() view returns(uint64[]) -func (_Testfiles *TestfilesCaller) GetSliceValue(opts *bind.CallOpts) ([]uint64, error) { - var out []interface{} - err := _Testfiles.contract.Call(opts, &out, "GetSliceValue") - - if err != nil { - return *new([]uint64), err - } - - out0 := *abi.ConvertType(out[0], new([]uint64)).(*[]uint64) - - return out0, err - -} - -// GetSliceValue is a free data retrieval call binding the contract method 0xbdb37c90. -// -// Solidity: function GetSliceValue() view returns(uint64[]) -func (_Testfiles *TestfilesSession) GetSliceValue() ([]uint64, error) { - return _Testfiles.Contract.GetSliceValue(&_Testfiles.CallOpts) -} - -// GetSliceValue is a free data retrieval call binding the contract method 0xbdb37c90. -// -// Solidity: function GetSliceValue() view returns(uint64[]) -func (_Testfiles *TestfilesCallerSession) GetSliceValue() ([]uint64, error) { - return _Testfiles.Contract.GetSliceValue(&_Testfiles.CallOpts) -} - -// ReturnSeen is a free data retrieval call binding the contract method 0xb9dad6b0. -// -// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],address,address[],int192,(bytes2,(int64,string)))) -func (_Testfiles *TestfilesCaller) ReturnSeen(opts *bind.CallOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { - var out []interface{} - err := _Testfiles.contract.Call(opts, &out, "ReturnSeen", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) - - if err != nil { - return *new(TestStruct), err - } - - out0 := *abi.ConvertType(out[0], new(TestStruct)).(*TestStruct) - - return out0, err - -} - -// ReturnSeen is a free data retrieval call binding the contract method 0xb9dad6b0. -// -// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],address,address[],int192,(bytes2,(int64,string)))) -func (_Testfiles *TestfilesSession) ReturnSeen(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { - return _Testfiles.Contract.ReturnSeen(&_Testfiles.CallOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) -} - -// ReturnSeen is a free data retrieval call binding the contract method 0xb9dad6b0. -// -// Solidity: function ReturnSeen(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) pure returns((int32,string,uint8,uint8[32],address,address[],int192,(bytes2,(int64,string)))) -func (_Testfiles *TestfilesCallerSession) ReturnSeen(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { - return _Testfiles.Contract.ReturnSeen(&_Testfiles.CallOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) -} - -// AddTestStruct is a paid mutator transaction binding the contract method 0x6c7cf955. -// -// Solidity: function AddTestStruct(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() -func (_Testfiles *TestfilesTransactor) AddTestStruct(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { - return _Testfiles.contract.Transact(opts, "AddTestStruct", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) -} - -// AddTestStruct is a paid mutator transaction binding the contract method 0x6c7cf955. -// -// Solidity: function AddTestStruct(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() -func (_Testfiles *TestfilesSession) AddTestStruct(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { - return _Testfiles.Contract.AddTestStruct(&_Testfiles.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) -} - -// AddTestStruct is a paid mutator transaction binding the contract method 0x6c7cf955. -// -// Solidity: function AddTestStruct(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() -func (_Testfiles *TestfilesTransactorSession) AddTestStruct(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { - return _Testfiles.Contract.AddTestStruct(&_Testfiles.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) -} - -// TriggerEvent is a paid mutator transaction binding the contract method 0x8b659d6e. -// -// Solidity: function TriggerEvent(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() -func (_Testfiles *TestfilesTransactor) TriggerEvent(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { - return _Testfiles.contract.Transact(opts, "TriggerEvent", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) -} - -// TriggerEvent is a paid mutator transaction binding the contract method 0x8b659d6e. -// -// Solidity: function TriggerEvent(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() -func (_Testfiles *TestfilesSession) TriggerEvent(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { - return _Testfiles.Contract.TriggerEvent(&_Testfiles.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) -} - -// TriggerEvent is a paid mutator transaction binding the contract method 0x8b659d6e. -// -// Solidity: function TriggerEvent(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address account, address[] accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) returns() -func (_Testfiles *TestfilesTransactorSession) TriggerEvent(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { - return _Testfiles.Contract.TriggerEvent(&_Testfiles.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) -} - -// TestfilesTriggeredIterator is returned from FilterTriggered and is used to iterate over the raw logs and unpacked data for Triggered events raised by the Testfiles contract. -type TestfilesTriggeredIterator struct { - Event *TestfilesTriggered // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *TestfilesTriggeredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(TestfilesTriggered) - 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 - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(TestfilesTriggered) - 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() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *TestfilesTriggeredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *TestfilesTriggeredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// TestfilesTriggered represents a Triggered event raised by the Testfiles contract. -type TestfilesTriggered struct { - Field int32 - DifferentField string - OracleId uint8 - OracleIds [32]uint8 - Account common.Address - Accounts []common.Address - BigField *big.Int - NestedStruct MidLevelTestStruct - Raw types.Log // Blockchain specific contextual infos -} - -// FilterTriggered is a free log retrieval operation binding the contract event 0x7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d. -// -// Solidity: event Triggered(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address Account, address[] Accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) -func (_Testfiles *TestfilesFilterer) FilterTriggered(opts *bind.FilterOpts) (*TestfilesTriggeredIterator, error) { - - logs, sub, err := _Testfiles.contract.FilterLogs(opts, "Triggered") - if err != nil { - return nil, err - } - return &TestfilesTriggeredIterator{contract: _Testfiles.contract, event: "Triggered", logs: logs, sub: sub}, nil -} - -// WatchTriggered is a free log subscription operation binding the contract event 0x7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d. -// -// Solidity: event Triggered(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address Account, address[] Accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) -func (_Testfiles *TestfilesFilterer) WatchTriggered(opts *bind.WatchOpts, sink chan<- *TestfilesTriggered) (event.Subscription, error) { - - logs, sub, err := _Testfiles.contract.WatchLogs(opts, "Triggered") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(TestfilesTriggered) - if err := _Testfiles.contract.UnpackLog(event, "Triggered", 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 -} - -// ParseTriggered is a log parse operation binding the contract event 0x7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d. -// -// Solidity: event Triggered(int32 field, string differentField, uint8 oracleId, uint8[32] oracleIds, address Account, address[] Accounts, int192 bigField, (bytes2,(int64,string)) nestedStruct) -func (_Testfiles *TestfilesFilterer) ParseTriggered(log types.Log) (*TestfilesTriggered, error) { - event := new(TestfilesTriggered) - if err := _Testfiles.contract.UnpackLog(event, "Triggered", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/core/services/relay/evm/testfiles/chainlink_reader_test_setup.sh b/core/services/relay/evm/testfiles/chainlink_reader_test_setup.sh deleted file mode 100755 index 60ddc6cdc1a..00000000000 --- a/core/services/relay/evm/testfiles/chainlink_reader_test_setup.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -e -# called from the directory above so cd to this directory -cd testfiles -solc --optimize --bin --abi chain_reader_test_contract.sol -o . -mv LatestValueHolder.bin chain_reader_test_contract_gen.bin -mv LatestValueHolder.abi chain_reader_test_contract_gen.abi -../../../../../tools/bin/abigen --bin=chain_reader_test_contract_gen.bin --abi=chain_reader_test_contract_gen.abi --pkg=testfiles --out=chain_reader_test_contract_gen.go From ff0bc8e47f6a09c83fb0bfea50ff28f15f3cd196 Mon Sep 17 00:00:00 2001 From: Domino Valdano <2644901+reductionista@users.noreply.github.com> Date: Fri, 22 Dec 2023 20:22:29 -0800 Subject: [PATCH 061/112] Update generated-wrapper-dependency-versions-do-not-edit.txt Also: remove extra unused files --- byte_types_gen.go | 300 --- ...rapper-dependency-versions-do-not-edit.txt | 1 + int_types_gen.go | 2205 ----------------- 3 files changed, 1 insertion(+), 2505 deletions(-) delete mode 100644 byte_types_gen.go delete mode 100644 int_types_gen.go diff --git a/byte_types_gen.go b/byte_types_gen.go deleted file mode 100644 index fb9fd9bdb5c..00000000000 --- a/byte_types_gen.go +++ /dev/null @@ -1,300 +0,0 @@ -package types - -import "reflect" - -type bytes1 [1]byte - -func init() { - typeMap["bytes1"] = &ABIEncodingType{ - Native: reflect.TypeOf([1]byte{}), - Checked: reflect.TypeOf(bytes1{}), - } -} - -type bytes2 [2]byte - -func init() { - typeMap["bytes2"] = &ABIEncodingType{ - Native: reflect.TypeOf([2]byte{}), - Checked: reflect.TypeOf(bytes2{}), - } -} - -type bytes3 [3]byte - -func init() { - typeMap["bytes3"] = &ABIEncodingType{ - Native: reflect.TypeOf([3]byte{}), - Checked: reflect.TypeOf(bytes3{}), - } -} - -type bytes4 [4]byte - -func init() { - typeMap["bytes4"] = &ABIEncodingType{ - Native: reflect.TypeOf([4]byte{}), - Checked: reflect.TypeOf(bytes4{}), - } -} - -type bytes5 [5]byte - -func init() { - typeMap["bytes5"] = &ABIEncodingType{ - Native: reflect.TypeOf([5]byte{}), - Checked: reflect.TypeOf(bytes5{}), - } -} - -type bytes6 [6]byte - -func init() { - typeMap["bytes6"] = &ABIEncodingType{ - Native: reflect.TypeOf([6]byte{}), - Checked: reflect.TypeOf(bytes6{}), - } -} - -type bytes7 [7]byte - -func init() { - typeMap["bytes7"] = &ABIEncodingType{ - Native: reflect.TypeOf([7]byte{}), - Checked: reflect.TypeOf(bytes7{}), - } -} - -type bytes8 [8]byte - -func init() { - typeMap["bytes8"] = &ABIEncodingType{ - Native: reflect.TypeOf([8]byte{}), - Checked: reflect.TypeOf(bytes8{}), - } -} - -type bytes9 [9]byte - -func init() { - typeMap["bytes9"] = &ABIEncodingType{ - Native: reflect.TypeOf([9]byte{}), - Checked: reflect.TypeOf(bytes9{}), - } -} - -type bytes10 [10]byte - -func init() { - typeMap["bytes10"] = &ABIEncodingType{ - Native: reflect.TypeOf([10]byte{}), - Checked: reflect.TypeOf(bytes10{}), - } -} - -type bytes11 [11]byte - -func init() { - typeMap["bytes11"] = &ABIEncodingType{ - Native: reflect.TypeOf([11]byte{}), - Checked: reflect.TypeOf(bytes11{}), - } -} - -type bytes12 [12]byte - -func init() { - typeMap["bytes12"] = &ABIEncodingType{ - Native: reflect.TypeOf([12]byte{}), - Checked: reflect.TypeOf(bytes12{}), - } -} - -type bytes13 [13]byte - -func init() { - typeMap["bytes13"] = &ABIEncodingType{ - Native: reflect.TypeOf([13]byte{}), - Checked: reflect.TypeOf(bytes13{}), - } -} - -type bytes14 [14]byte - -func init() { - typeMap["bytes14"] = &ABIEncodingType{ - Native: reflect.TypeOf([14]byte{}), - Checked: reflect.TypeOf(bytes14{}), - } -} - -type bytes15 [15]byte - -func init() { - typeMap["bytes15"] = &ABIEncodingType{ - Native: reflect.TypeOf([15]byte{}), - Checked: reflect.TypeOf(bytes15{}), - } -} - -type bytes16 [16]byte - -func init() { - typeMap["bytes16"] = &ABIEncodingType{ - Native: reflect.TypeOf([16]byte{}), - Checked: reflect.TypeOf(bytes16{}), - } -} - -type bytes17 [17]byte - -func init() { - typeMap["bytes17"] = &ABIEncodingType{ - Native: reflect.TypeOf([17]byte{}), - Checked: reflect.TypeOf(bytes17{}), - } -} - -type bytes18 [18]byte - -func init() { - typeMap["bytes18"] = &ABIEncodingType{ - Native: reflect.TypeOf([18]byte{}), - Checked: reflect.TypeOf(bytes18{}), - } -} - -type bytes19 [19]byte - -func init() { - typeMap["bytes19"] = &ABIEncodingType{ - Native: reflect.TypeOf([19]byte{}), - Checked: reflect.TypeOf(bytes19{}), - } -} - -type bytes20 [20]byte - -func init() { - typeMap["bytes20"] = &ABIEncodingType{ - Native: reflect.TypeOf([20]byte{}), - Checked: reflect.TypeOf(bytes20{}), - } -} - -type bytes21 [21]byte - -func init() { - typeMap["bytes21"] = &ABIEncodingType{ - Native: reflect.TypeOf([21]byte{}), - Checked: reflect.TypeOf(bytes21{}), - } -} - -type bytes22 [22]byte - -func init() { - typeMap["bytes22"] = &ABIEncodingType{ - Native: reflect.TypeOf([22]byte{}), - Checked: reflect.TypeOf(bytes22{}), - } -} - -type bytes23 [23]byte - -func init() { - typeMap["bytes23"] = &ABIEncodingType{ - Native: reflect.TypeOf([23]byte{}), - Checked: reflect.TypeOf(bytes23{}), - } -} - -type bytes24 [24]byte - -func init() { - typeMap["bytes24"] = &ABIEncodingType{ - Native: reflect.TypeOf([24]byte{}), - Checked: reflect.TypeOf(bytes24{}), - } -} - -type bytes25 [25]byte - -func init() { - typeMap["bytes25"] = &ABIEncodingType{ - Native: reflect.TypeOf([25]byte{}), - Checked: reflect.TypeOf(bytes25{}), - } -} - -type bytes26 [26]byte - -func init() { - typeMap["bytes26"] = &ABIEncodingType{ - Native: reflect.TypeOf([26]byte{}), - Checked: reflect.TypeOf(bytes26{}), - } -} - -type bytes27 [27]byte - -func init() { - typeMap["bytes27"] = &ABIEncodingType{ - Native: reflect.TypeOf([27]byte{}), - Checked: reflect.TypeOf(bytes27{}), - } -} - -type bytes28 [28]byte - -func init() { - typeMap["bytes28"] = &ABIEncodingType{ - Native: reflect.TypeOf([28]byte{}), - Checked: reflect.TypeOf(bytes28{}), - } -} - -type bytes29 [29]byte - -func init() { - typeMap["bytes29"] = &ABIEncodingType{ - Native: reflect.TypeOf([29]byte{}), - Checked: reflect.TypeOf(bytes29{}), - } -} - -type bytes30 [30]byte - -func init() { - typeMap["bytes30"] = &ABIEncodingType{ - Native: reflect.TypeOf([30]byte{}), - Checked: reflect.TypeOf(bytes30{}), - } -} - -type bytes31 [31]byte - -func init() { - typeMap["bytes31"] = &ABIEncodingType{ - Native: reflect.TypeOf([31]byte{}), - Checked: reflect.TypeOf(bytes31{}), - } -} - -type bytes32 [32]byte - -func init() { - typeMap["bytes32"] = &ABIEncodingType{ - Native: reflect.TypeOf([32]byte{}), - Checked: reflect.TypeOf(bytes32{}), - } -} - -type bytes0 [0]byte - -func init() { - typeMap["bytes0"] = &ABIEncodingType{ - Native: reflect.TypeOf([0]byte{}), - Checked: reflect.TypeOf(bytes0{}), - } -} diff --git a/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt b/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt index 8a61f086148..0b722020154 100644 --- a/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt +++ b/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt @@ -11,6 +11,7 @@ batch_blockhash_store: ../../contracts/solc/v0.8.6/BatchBlockhashStore/BatchBloc batch_vrf_coordinator_v2: ../../contracts/solc/v0.8.6/BatchVRFCoordinatorV2/BatchVRFCoordinatorV2.abi ../../contracts/solc/v0.8.6/BatchVRFCoordinatorV2/BatchVRFCoordinatorV2.bin d0a54963260d8c1f1bbd984b758285e6027cfb5a7e42701bcb562ab123219332 batch_vrf_coordinator_v2plus: ../../contracts/solc/v0.8.6/BatchVRFCoordinatorV2Plus/BatchVRFCoordinatorV2Plus.abi ../../contracts/solc/v0.8.6/BatchVRFCoordinatorV2Plus/BatchVRFCoordinatorV2Plus.bin 7bb76ae241cf1b37b41920830b836cb99f1ad33efd7435ca2398ff6cd2fe5d48 blockhash_store: ../../contracts/solc/v0.8.6/BlockhashStore/BlockhashStore.abi ../../contracts/solc/v0.8.6/BlockhashStore/BlockhashStore.bin 12b0662f1636a341c8863bdec7a20f2ddd97c3a4fd1a7ae353fe316609face4e +chain_reader_example: ../../contracts/solc/v0.8.19/ChainReaderTestContract/LatestValueHolder.abi ../../contracts/solc/v0.8.19/ChainReaderTestContract/LatestValueHolder.bin 0df0a592be25f8635aa07038d92f03043421fd0dc8855f4750c1c9673d2c613b chain_specific_util_helper: ../../contracts/solc/v0.8.6/ChainSpecificUtilHelper/ChainSpecificUtilHelper.abi ../../contracts/solc/v0.8.6/ChainSpecificUtilHelper/ChainSpecificUtilHelper.bin 5f10664e31abc768f4a37901cae7a3bef90146180f97303e5a1bde5a08d84595 consumer_wrapper: ../../contracts/solc/v0.7/Consumer/Consumer.abi ../../contracts/solc/v0.7/Consumer/Consumer.bin 894d1cbd920dccbd36d92918c1037c6ded34f66f417ccb18ec3f33c64ef83ec5 cron_upkeep_factory_wrapper: ../../contracts/solc/v0.8.6/CronUpkeepFactory/CronUpkeepFactory.abi - dacb0f8cdf54ae9d2781c5e720fc314b32ed5e58eddccff512c75d6067292cd7 diff --git a/int_types_gen.go b/int_types_gen.go deleted file mode 100644 index c469f6ef3fd..00000000000 --- a/int_types_gen.go +++ /dev/null @@ -1,2205 +0,0 @@ -package types - -import ( - "math/big" - "reflect" - - "github.com/fxamacker/cbor/v2" - - "github.com/smartcontractkit/chainlink-common/pkg/types" -) - -type SizedBigInt interface { - Verify() error - private() -} - -var sizedBigIntType = reflect.TypeOf((*SizedBigInt)(nil)).Elem() - -func SizedBigIntType() reflect.Type { - return sizedBigIntType -} - -type int24 big.Int - -func (i *int24) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int24) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int24) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 24 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int24) private() {} - -func init() { - typeMap["int24"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int24)(nil)), - } -} - -type uint24 big.Int - -func (i *uint24) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint24) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint24) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 24 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint24) private() {} - -func init() { - typeMap["uint24"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint24)(nil)), - } -} - -type int40 big.Int - -func (i *int40) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int40) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int40) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 40 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int40) private() {} - -func init() { - typeMap["int40"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int40)(nil)), - } -} - -type uint40 big.Int - -func (i *uint40) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint40) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint40) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 40 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint40) private() {} - -func init() { - typeMap["uint40"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint40)(nil)), - } -} - -type int48 big.Int - -func (i *int48) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int48) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int48) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 48 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int48) private() {} - -func init() { - typeMap["int48"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int48)(nil)), - } -} - -type uint48 big.Int - -func (i *uint48) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint48) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint48) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 48 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint48) private() {} - -func init() { - typeMap["uint48"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint48)(nil)), - } -} - -type int56 big.Int - -func (i *int56) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int56) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int56) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 56 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int56) private() {} - -func init() { - typeMap["int56"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int56)(nil)), - } -} - -type uint56 big.Int - -func (i *uint56) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint56) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint56) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 56 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint56) private() {} - -func init() { - typeMap["uint56"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint56)(nil)), - } -} - -type int72 big.Int - -func (i *int72) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int72) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int72) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 72 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int72) private() {} - -func init() { - typeMap["int72"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int72)(nil)), - } -} - -type uint72 big.Int - -func (i *uint72) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint72) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint72) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 72 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint72) private() {} - -func init() { - typeMap["uint72"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint72)(nil)), - } -} - -type int80 big.Int - -func (i *int80) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int80) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int80) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 80 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int80) private() {} - -func init() { - typeMap["int80"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int80)(nil)), - } -} - -type uint80 big.Int - -func (i *uint80) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint80) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint80) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 80 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint80) private() {} - -func init() { - typeMap["uint80"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint80)(nil)), - } -} - -type int88 big.Int - -func (i *int88) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int88) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int88) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 88 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int88) private() {} - -func init() { - typeMap["int88"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int88)(nil)), - } -} - -type uint88 big.Int - -func (i *uint88) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint88) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint88) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 88 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint88) private() {} - -func init() { - typeMap["uint88"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint88)(nil)), - } -} - -type int96 big.Int - -func (i *int96) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int96) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int96) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 96 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int96) private() {} - -func init() { - typeMap["int96"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int96)(nil)), - } -} - -type uint96 big.Int - -func (i *uint96) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint96) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint96) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 96 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint96) private() {} - -func init() { - typeMap["uint96"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint96)(nil)), - } -} - -type int104 big.Int - -func (i *int104) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int104) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int104) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 104 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int104) private() {} - -func init() { - typeMap["int104"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int104)(nil)), - } -} - -type uint104 big.Int - -func (i *uint104) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint104) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint104) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 104 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint104) private() {} - -func init() { - typeMap["uint104"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint104)(nil)), - } -} - -type int112 big.Int - -func (i *int112) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int112) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int112) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 112 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int112) private() {} - -func init() { - typeMap["int112"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int112)(nil)), - } -} - -type uint112 big.Int - -func (i *uint112) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint112) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint112) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 112 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint112) private() {} - -func init() { - typeMap["uint112"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint112)(nil)), - } -} - -type int120 big.Int - -func (i *int120) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int120) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int120) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 120 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int120) private() {} - -func init() { - typeMap["int120"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int120)(nil)), - } -} - -type uint120 big.Int - -func (i *uint120) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint120) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint120) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 120 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint120) private() {} - -func init() { - typeMap["uint120"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint120)(nil)), - } -} - -type int128 big.Int - -func (i *int128) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int128) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int128) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 128 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int128) private() {} - -func init() { - typeMap["int128"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int128)(nil)), - } -} - -type uint128 big.Int - -func (i *uint128) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint128) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint128) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 128 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint128) private() {} - -func init() { - typeMap["uint128"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint128)(nil)), - } -} - -type int136 big.Int - -func (i *int136) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int136) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int136) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 136 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int136) private() {} - -func init() { - typeMap["int136"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int136)(nil)), - } -} - -type uint136 big.Int - -func (i *uint136) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint136) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint136) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 136 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint136) private() {} - -func init() { - typeMap["uint136"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint136)(nil)), - } -} - -type int144 big.Int - -func (i *int144) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int144) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int144) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 144 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int144) private() {} - -func init() { - typeMap["int144"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int144)(nil)), - } -} - -type uint144 big.Int - -func (i *uint144) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint144) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint144) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 144 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint144) private() {} - -func init() { - typeMap["uint144"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint144)(nil)), - } -} - -type int152 big.Int - -func (i *int152) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int152) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int152) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 152 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int152) private() {} - -func init() { - typeMap["int152"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int152)(nil)), - } -} - -type uint152 big.Int - -func (i *uint152) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint152) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint152) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 152 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint152) private() {} - -func init() { - typeMap["uint152"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint152)(nil)), - } -} - -type int160 big.Int - -func (i *int160) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int160) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int160) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 160 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int160) private() {} - -func init() { - typeMap["int160"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int160)(nil)), - } -} - -type uint160 big.Int - -func (i *uint160) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint160) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint160) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 160 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint160) private() {} - -func init() { - typeMap["uint160"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint160)(nil)), - } -} - -type int168 big.Int - -func (i *int168) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int168) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int168) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 168 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int168) private() {} - -func init() { - typeMap["int168"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int168)(nil)), - } -} - -type uint168 big.Int - -func (i *uint168) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint168) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint168) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 168 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint168) private() {} - -func init() { - typeMap["uint168"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint168)(nil)), - } -} - -type int176 big.Int - -func (i *int176) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int176) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int176) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 176 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int176) private() {} - -func init() { - typeMap["int176"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int176)(nil)), - } -} - -type uint176 big.Int - -func (i *uint176) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint176) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint176) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 176 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint176) private() {} - -func init() { - typeMap["uint176"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint176)(nil)), - } -} - -type int184 big.Int - -func (i *int184) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int184) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int184) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 184 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int184) private() {} - -func init() { - typeMap["int184"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int184)(nil)), - } -} - -type uint184 big.Int - -func (i *uint184) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint184) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint184) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 184 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint184) private() {} - -func init() { - typeMap["uint184"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint184)(nil)), - } -} - -type int192 big.Int - -func (i *int192) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int192) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int192) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 192 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int192) private() {} - -func init() { - typeMap["int192"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int192)(nil)), - } -} - -type uint192 big.Int - -func (i *uint192) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint192) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint192) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 192 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint192) private() {} - -func init() { - typeMap["uint192"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint192)(nil)), - } -} - -type int200 big.Int - -func (i *int200) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int200) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int200) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 200 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int200) private() {} - -func init() { - typeMap["int200"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int200)(nil)), - } -} - -type uint200 big.Int - -func (i *uint200) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint200) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint200) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 200 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint200) private() {} - -func init() { - typeMap["uint200"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint200)(nil)), - } -} - -type int208 big.Int - -func (i *int208) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int208) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int208) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 208 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int208) private() {} - -func init() { - typeMap["int208"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int208)(nil)), - } -} - -type uint208 big.Int - -func (i *uint208) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint208) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint208) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 208 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint208) private() {} - -func init() { - typeMap["uint208"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint208)(nil)), - } -} - -type int216 big.Int - -func (i *int216) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int216) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int216) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 216 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int216) private() {} - -func init() { - typeMap["int216"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int216)(nil)), - } -} - -type uint216 big.Int - -func (i *uint216) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint216) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint216) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 216 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint216) private() {} - -func init() { - typeMap["uint216"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint216)(nil)), - } -} - -type int224 big.Int - -func (i *int224) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int224) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int224) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 224 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int224) private() {} - -func init() { - typeMap["int224"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int224)(nil)), - } -} - -type uint224 big.Int - -func (i *uint224) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint224) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint224) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 224 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint224) private() {} - -func init() { - typeMap["uint224"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint224)(nil)), - } -} - -type int232 big.Int - -func (i *int232) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int232) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int232) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 232 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int232) private() {} - -func init() { - typeMap["int232"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int232)(nil)), - } -} - -type uint232 big.Int - -func (i *uint232) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint232) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint232) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 232 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint232) private() {} - -func init() { - typeMap["uint232"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint232)(nil)), - } -} - -type int240 big.Int - -func (i *int240) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int240) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int240) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 240 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int240) private() {} - -func init() { - typeMap["int240"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int240)(nil)), - } -} - -type uint240 big.Int - -func (i *uint240) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint240) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint240) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 240 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint240) private() {} - -func init() { - typeMap["uint240"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint240)(nil)), - } -} - -type int248 big.Int - -func (i *int248) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int248) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int248) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 248 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int248) private() {} - -func init() { - typeMap["int248"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int248)(nil)), - } -} - -type uint248 big.Int - -func (i *uint248) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint248) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint248) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 248 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint248) private() {} - -func init() { - typeMap["uint248"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint248)(nil)), - } -} - -type int256 big.Int - -func (i *int256) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *int256) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *int256) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 256 { - return types.ErrInvalidType - } - - return nil -} - -func (i *int256) private() {} - -func init() { - typeMap["int256"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int256)(nil)), - } -} - -type uint256 big.Int - -func (i *uint256) UnmarshalCBOR(input []byte) error { - bi := (*big.Int)(i) - if err := cbor.Unmarshal(input, bi); err != nil { - return err - } - - return i.Verify() -} - -func (i *uint256) UnmarshalText(input []byte) error { - bi := (*big.Int)(i) - if _, ok := bi.SetString(string(input), 10); !ok { - return types.ErrInvalidType - } - - return i.Verify() -} - -func (i *uint256) Verify() error { - bi := (*big.Int)(i) - - if bi.BitLen() > 256 { - return types.ErrInvalidType - } - - return nil -} - -func (i *uint256) private() {} - -func init() { - typeMap["uint256"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint256)(nil)), - } -} From cdb55658a1cb52397b1d7cebc6aa67a5220e695b Mon Sep 17 00:00:00 2001 From: Domino Valdano <2644901+reductionista@users.noreply.github.com> Date: Fri, 22 Dec 2023 20:34:17 -0800 Subject: [PATCH 062/112] prettier -w ChainReaderTestContract.sol --- .../v0.8/tests/ChainReaderTestContract.sol | 157 +++++++++--------- 1 file changed, 81 insertions(+), 76 deletions(-) diff --git a/contracts/src/v0.8/tests/ChainReaderTestContract.sol b/contracts/src/v0.8/tests/ChainReaderTestContract.sol index 169b980a327..15098fd3552 100644 --- a/contracts/src/v0.8/tests/ChainReaderTestContract.sol +++ b/contracts/src/v0.8/tests/ChainReaderTestContract.sol @@ -2,97 +2,102 @@ pragma solidity ^0.8; struct TestStruct { - int32 Field; - string DifferentField; - uint8 OracleId; - uint8[32] OracleIds; - address Account; - address[] Accounts; - int192 BigField; - MidLevelTestStruct NestedStruct; + int32 Field; + string DifferentField; + uint8 OracleId; + uint8[32] OracleIds; + address Account; + address[] Accounts; + int192 BigField; + MidLevelTestStruct NestedStruct; } struct MidLevelTestStruct { - bytes2 FixedBytes; - InnerTestStruct Inner; + bytes2 FixedBytes; + InnerTestStruct Inner; } struct InnerTestStruct { - int64 I; - string S; + int64 I; + string S; } contract LatestValueHolder { - event Triggered( - int32 field, - string differentField, - uint8 oracleId, - uint8[32] oracleIds, - address Account, - address[] Accounts, - int192 bigField, - MidLevelTestStruct nestedStruct); + event Triggered( + int32 field, + string differentField, + uint8 oracleId, + uint8[32] oracleIds, + address Account, + address[] Accounts, + int192 bigField, + MidLevelTestStruct nestedStruct + ); - TestStruct[] private seen; - uint64[] private arr; + TestStruct[] private seen; + uint64[] private arr; - constructor() { - // See chain_reader_interface_tests.go in chainlink-relay - arr.push(3); - arr.push(4); - } + constructor() { + // See chain_reader_interface_tests.go in chainlink-relay + arr.push(3); + arr.push(4); + } - function AddTestStruct( - int32 field, - string calldata differentField, - uint8 oracleId, - uint8[32] calldata oracleIds, - address account, - address[] calldata accounts, - int192 bigField, - MidLevelTestStruct calldata nestedStruct) public { - seen.push(TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct)); - } + function AddTestStruct( + int32 field, + string calldata differentField, + uint8 oracleId, + uint8[32] calldata oracleIds, + address account, + address[] calldata accounts, + int192 bigField, + MidLevelTestStruct calldata nestedStruct + ) public { + seen.push(TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct)); + } - function ReturnSeen( - int32 field, - string calldata differentField, - uint8 oracleId, - uint8[32] calldata oracleIds, - address account, - address[] calldata accounts, - int192 bigField, - MidLevelTestStruct calldata nestedStruct) pure public returns (TestStruct memory) { - return TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); - } + function ReturnSeen( + int32 field, + string calldata differentField, + uint8 oracleId, + uint8[32] calldata oracleIds, + address account, + address[] calldata accounts, + int192 bigField, + MidLevelTestStruct calldata nestedStruct + ) public pure returns (TestStruct memory) { + return TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); + } - function GetElementAtIndex(uint256 i) public view returns (TestStruct memory) { - // See chain_reader_interface_tests.go in chainlink-relay - return seen[i-1]; - } + function GetElementAtIndex(uint256 i) public view returns (TestStruct memory) { + // See chain_reader_interface_tests.go in chainlink-relay + return seen[i - 1]; + } - function GetPrimitiveValue() public pure returns (uint64) { - // See chain_reader_interface_tests.go in chainlink-relay - return 3; - } + function GetPrimitiveValue() public pure returns (uint64) { + // See chain_reader_interface_tests.go in chainlink-relay + return 3; + } - function GetDifferentPrimitiveValue() public pure returns (uint64) { - // See chain_reader_interface_tests.go in chainlink-relay - return 1990; - } + function GetDifferentPrimitiveValue() public pure returns (uint64) { + // See chain_reader_interface_tests.go in chainlink-relay + return 1990; + } - function GetSliceValue() public view returns (uint64[] memory) { - return arr; - } + function GetSliceValue() public view returns (uint64[] memory) { + return arr; + } - function TriggerEvent(int32 field, - string calldata differentField, - uint8 oracleId, - uint8[32] calldata oracleIds, - address account, - address[] calldata accounts, - int192 bigField, - MidLevelTestStruct calldata nestedStruct) public { - emit Triggered(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); - } -} \ No newline at end of file + function TriggerEvent( + int32 field, + string calldata differentField, + uint8 oracleId, + uint8[32] calldata oracleIds, + address account, + address[] calldata accounts, + int192 bigField, + MidLevelTestStruct calldata nestedStruct + ) public { + emit Triggered(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); + } +} From 087b8eb87606c72fb642ad7e13a2c48b8bb70e7f Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Tue, 2 Jan 2024 14:42:29 -0500 Subject: [PATCH 063/112] Update to use the ErrSliceWrongLen --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- core/services/relay/evm/codec.go | 2 +- core/services/relay/evm/decoder.go | 2 +- core/services/relay/evm/encoder.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index dfd66d05f5c..c51c2b79c99 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index d950fe52368..bee0f973628 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1148,8 +1148,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd h1:DsExL564kL/YwKWvUIMUKgdcpUE4Ryfi0aYIS/uXxmY= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 h1:jkN1563+NFZPKnZtQfG7s0fuvaDkfQ4jOv7osmQTowg= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/core/services/relay/evm/codec.go b/core/services/relay/evm/codec.go index 19b9c6e4f40..dfa8d49949f 100644 --- a/core/services/relay/evm/codec.go +++ b/core/services/relay/evm/codec.go @@ -115,7 +115,7 @@ func decodeAccountHook(from, to reflect.Type, data any) (any, error) { } else if len(decoded) != common.AddressLength { return nil, fmt.Errorf( "%w: wrong number size for address expected %v got %v", - commontypes.ErrWrongNumberOfElements, + commontypes.ErrSliceWrongLen, common.AddressLength, len(decoded)) } return common.Address(decoded), nil diff --git a/core/services/relay/evm/decoder.go b/core/services/relay/evm/decoder.go index 8f689a58a38..b6547c08618 100644 --- a/core/services/relay/evm/decoder.go +++ b/core/services/relay/evm/decoder.go @@ -45,7 +45,7 @@ func (m *decoder) decodeArray(into any, rDecode reflect.Value) error { iInto := reflect.Indirect(reflect.ValueOf(into)) length := rDecode.Len() if length != iInto.Len() { - return commontypes.ErrWrongNumberOfElements + return commontypes.ErrSliceWrongLen } iInto.Set(reflect.New(iInto.Type()).Elem()) return setElements(length, rDecode, iInto) diff --git a/core/services/relay/evm/encoder.go b/core/services/relay/evm/encoder.go index 58b6160bb8a..43ce57d1449 100644 --- a/core/services/relay/evm/encoder.go +++ b/core/services/relay/evm/encoder.go @@ -53,7 +53,7 @@ func encodeArray(item reflect.Value, info *codecEntry) ([]byte, error) { switch info.checkedType.Kind() { case reflect.Array: if info.checkedType.Len() != length { - return nil, commontypes.ErrWrongNumberOfElements + return nil, commontypes.ErrSliceWrongLen } native = reflect.New(info.nativeType).Elem() case reflect.Slice: diff --git a/go.mod b/go.mod index d79ee3dac17..c0f98220eda 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 diff --git a/go.sum b/go.sum index 001a2444264..45511948a57 100644 --- a/go.sum +++ b/go.sum @@ -1134,8 +1134,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd h1:DsExL564kL/YwKWvUIMUKgdcpUE4Ryfi0aYIS/uXxmY= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 h1:jkN1563+NFZPKnZtQfG7s0fuvaDkfQ4jOv7osmQTowg= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 71a638e2776..f34ebe93884 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -25,7 +25,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 github.com/smartcontractkit/chainlink-testing-framework v1.22.1 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index e98b1552f96..bac754f23c7 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1465,8 +1465,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd h1:DsExL564kL/YwKWvUIMUKgdcpUE4Ryfi0aYIS/uXxmY= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 h1:jkN1563+NFZPKnZtQfG7s0fuvaDkfQ4jOv7osmQTowg= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From 1e3db657607423e18b73ae7432bfc5da3285fc97 Mon Sep 17 00:00:00 2001 From: Domino Valdano <2644901+reductionista@users.noreply.github.com> Date: Tue, 2 Jan 2024 15:54:53 -0800 Subject: [PATCH 064/112] Move test contract from contracts/tests to contrats/shared/test --- contracts/scripts/native_solc_compile_all | 2 +- .../native_solc_compile_all_chainreader | 32 ------------------- .../scripts/native_solc_compile_all_shared | 1 + .../test}/ChainReaderTestContract.sol | 0 4 files changed, 2 insertions(+), 33 deletions(-) delete mode 100755 contracts/scripts/native_solc_compile_all_chainreader rename contracts/src/v0.8/{tests => shared/test}/ChainReaderTestContract.sol (100%) diff --git a/contracts/scripts/native_solc_compile_all b/contracts/scripts/native_solc_compile_all index a7b6b3efe53..cf1226a2d5c 100755 --- a/contracts/scripts/native_solc_compile_all +++ b/contracts/scripts/native_solc_compile_all @@ -12,7 +12,7 @@ python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt # 6 and 7 are legacy contracts, for each other product we have a native_solc_compile_all_$product script # These scripts can be run individually, or all together with this script. # To add new CL products, simply write a native_solc_compile_all_$product script and add it to the list below. -for product in 6 7 automation events_mock feeds functions llo-feeds logpoller operatorforwarder shared transmission vrf chainreader +for product in 6 7 automation events_mock feeds functions llo-feeds logpoller operatorforwarder shared transmission vrf do $SCRIPTPATH/native_solc_compile_all_$product done diff --git a/contracts/scripts/native_solc_compile_all_chainreader b/contracts/scripts/native_solc_compile_all_chainreader deleted file mode 100755 index 6f5b095667d..00000000000 --- a/contracts/scripts/native_solc_compile_all_chainreader +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -set -e - -echo " ┌──────────────────────────────────────────────┐" -echo " │ Compiling ChainReader contracts... │" -echo " └──────────────────────────────────────────────┘" - -SOLC_VERSION="0.8.19" -OPTIMIZE_RUNS=1000000 - - -SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; 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 - -ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )" - -compileContract () { - local contract - contract=$(basename "$1" ".sol") - - solc --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \ - -o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \ - --abi --bin --allow-paths "$ROOT"/contracts/src/v0.8\ - "$ROOT"/contracts/src/v0.8/"$1" -} - - -compileContract tests/ChainReaderTestContract.sol diff --git a/contracts/scripts/native_solc_compile_all_shared b/contracts/scripts/native_solc_compile_all_shared index 9178237b8a5..60cdd12c6a2 100755 --- a/contracts/scripts/native_solc_compile_all_shared +++ b/contracts/scripts/native_solc_compile_all_shared @@ -32,3 +32,4 @@ compileContract shared/token/ERC677/BurnMintERC677.sol compileContract shared/token/ERC677/LinkToken.sol compileContract shared/mocks/WERC20Mock.sol compileContract vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/ERC20.sol +compileContract shared/test/ChainReaderTestContract.sol diff --git a/contracts/src/v0.8/tests/ChainReaderTestContract.sol b/contracts/src/v0.8/shared/test/ChainReaderTestContract.sol similarity index 100% rename from contracts/src/v0.8/tests/ChainReaderTestContract.sol rename to contracts/src/v0.8/shared/test/ChainReaderTestContract.sol From 7ad1d8eec66e29d70cf80a2964c137710082de40 Mon Sep 17 00:00:00 2001 From: ilija Date: Thu, 4 Jan 2024 13:10:26 +0100 Subject: [PATCH 065/112] Fix SQ coverage exclusions --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index cbc3640779b..b6f3f1567c6 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -3,7 +3,7 @@ sonar.sources=. sonar.python.version=3.8 # Full exclusions from the static analysis -sonar.exclusions=**/node_modules/**/*,**/mocks/**/*, **/testdata/**/*, **/contracts/typechain/**/*, **/contracts/artifacts/**/*, **/contracts/cache/**/*, **/contracts/scripts/**/*, **/generated/**/*, **/fixtures/**/*, **/docs/**/*, **/tools/**/*, **/*.pb.go, **/*report.xml, **/*.config.ts, **/*.txt, **/*.abi, **/*.bin, **/*_codecgen.go core/services/relay/evm/types/*_gen.go core/services/relay/evm/types/gen/main.go core/services/relay/evm/testfiles/* +sonar.exclusions=**/node_modules/**/*,**/mocks/**/*, **/testdata/**/*, **/contracts/typechain/**/*, **/contracts/artifacts/**/*, **/contracts/cache/**/*, **/contracts/scripts/**/*, **/generated/**/*, **/fixtures/**/*, **/docs/**/*, **/tools/**/*, **/*.pb.go, **/*report.xml, **/*.config.ts, **/*.txt, **/*.abi, **/*.bin, **/*_codecgen.go, core/services/relay/evm/types/*_gen.go, core/services/relay/evm/types/gen/main.go, core/services/relay/evm/testfiles/* # Coverage exclusions sonar.coverage.exclusions=**/*.test.ts, **/*_test.go, **/contracts/test/**/*, **/contracts/**/tests/**/*, **/core/**/testutils/**/*, **/core/**/mocks/**/*, **/core/**/cltest/**/*, **/integration-tests/**/*, **/generated/**/*, **/core/scripts**/* , **/*.pb.go, ./plugins/**/*, **/main.go, **/0195_add_not_null_to_evm_chain_id_in_job_specs.go # Duplication exclusions From 218073984c9f2b46b497012bb33b119096cc4150 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Thu, 4 Jan 2024 10:24:27 -0500 Subject: [PATCH 066/112] Use modifier for time --- core/internal/features/ocr2/features_ocr2_test.go | 2 +- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- core/services/relay/evm/codec.go | 3 +-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/actions/ocr2_helpers_local.go | 2 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 9 files changed, 12 insertions(+), 13 deletions(-) diff --git a/core/internal/features/ocr2/features_ocr2_test.go b/core/internal/features/ocr2/features_ocr2_test.go index 7090da1dd4b..4727d686818 100644 --- a/core/internal/features/ocr2/features_ocr2_test.go +++ b/core/internal/features/ocr2/features_ocr2_test.go @@ -313,7 +313,7 @@ fromBlock = %d var chainReaderSpec string if test.chainReaderAndCodec { chainReaderSpec = ` -chainReader = '{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0, "output_modifications":[{"type":"rename","fields":{"LatestAnswer_":"LatestAnswer","LatestTimestamp_":"LatestTimestamp"}}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}' +chainReader = '{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0, "output_modifications":[{"type" : "epoch to time", "fields" : ["LatestTimestamp_"]},{"type":"rename","fields":{"LatestAnswer_":"LatestAnswer","LatestTimestamp_":"LatestTimestamp"}}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}' codec = '{"chainCodecConfig" :{"MedianReport":{"TypeAbi": "[{\"Name\": \"Timestamp\",\"Type\": \"uint32\"},{\"Name\": \"Observers\",\"Type\": \"bytes32\"},{\"Name\": \"Observations\",\"Type\": \"int192[]\"},{\"Name\": \"JuelsPerFeeCoin\",\"Type\": \"int192\"}]"}}}'` } ocrJob, err := validate.ValidatedOracleSpecToml(apps[i].Config.OCR2(), apps[i].Config.Insecure(), fmt.Sprintf(` diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 370d402bcb0..de282b0f513 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 60ee8ffd67a..aff468d9824 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1164,8 +1164,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 h1:jkN1563+NFZPKnZtQfG7s0fuvaDkfQ4jOv7osmQTowg= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39 h1:eDlIKD5zfBro7Y1kiIskAtO/vtuNU9R7RT7qM7rUrec= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/core/services/relay/evm/codec.go b/core/services/relay/evm/codec.go index dfa8d49949f..8d146cc8616 100644 --- a/core/services/relay/evm/codec.go +++ b/core/services/relay/evm/codec.go @@ -19,14 +19,13 @@ import ( ) // decodeAccountHook allows strings to be converted to [32]byte allowing config to represent them as 0x... -// EpochToTimeHook allows times to be converted to and from integer types // BigIntHook allows *big.Int to be represented as any integer type or a string and to go back to them. // Useful for config, or if when a model may use a go type that isn't a *big.Int when Pack expects one. // Eg: int32 in a go struct from a plugin could require a *big.Int in Pack for int24, if it fits, we shouldn't care. // SliceToArrayVerifySizeHook verifies that slices have the correct size when converting to an array // sizeVerifyBigIntHook allows our custom types that verify the number fits in the on-chain type to be converted as-if // it was a *big.Int -var evmDecoderHooks = []mapstructure.DecodeHookFunc{decodeAccountHook, codec.EpochToTimeHook, codec.BigIntHook, codec.SliceToArrayVerifySizeHook, sizeVerifyBigIntHook} +var evmDecoderHooks = []mapstructure.DecodeHookFunc{decodeAccountHook, codec.BigIntHook, codec.SliceToArrayVerifySizeHook, sizeVerifyBigIntHook} func NewCodec(conf types.CodecConfig) (commontypes.RemoteCodec, error) { parsed := &parsedTypes{ diff --git a/go.mod b/go.mod index 4ee84ef3af8..70f3e95908a 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 diff --git a/go.sum b/go.sum index 1938f56bef2..6b8db2b509d 100644 --- a/go.sum +++ b/go.sum @@ -1150,8 +1150,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 h1:jkN1563+NFZPKnZtQfG7s0fuvaDkfQ4jOv7osmQTowg= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39 h1:eDlIKD5zfBro7Y1kiIskAtO/vtuNU9R7RT7qM7rUrec= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/actions/ocr2_helpers_local.go b/integration-tests/actions/ocr2_helpers_local.go index ee1bef6fbdf..9d905b7430d 100644 --- a/integration-tests/actions/ocr2_helpers_local.go +++ b/integration-tests/actions/ocr2_helpers_local.go @@ -127,7 +127,7 @@ func CreateOCRv2JobsLocal( }, } if enableChainReaderAndCodec { - ocrSpec.OCR2OracleSpec.RelayConfig["chainReader"] = `{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0,"output_modifications":[{"type":"rename","fields":{"LatestAnswer_":"LatestAnswer","LatestTimestamp_":"LatestTimestamp"}}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}` + ocrSpec.OCR2OracleSpec.RelayConfig["chainReader"] = `{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0,"output_modifications":[{"type" : "epoch to time", "fields" : ["LatestTimestamp_"]},{"type":"rename","fields":{"LatestAnswer_":"LatestAnswer","LatestTimestamp_":"LatestTimestamp"}}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}` ocrSpec.OCR2OracleSpec.RelayConfig["codec"] = `{"chainCodecConfig" :{"MedianReport":{"TypeAbi": "[{\"Name\": \"Timestamp\",\"Type\": \"uint32\"},{\"Name\": \"Observers\",\"Type\": \"bytes32\"},{\"Name\": \"Observations\",\"Type\": \"int192[]\"},{\"Name\": \"JuelsPerFeeCoin\",\"Type\": \"int192\"}]"}}}` } diff --git a/integration-tests/go.mod b/integration-tests/go.mod index c40dcfabe0a..4f1bd8dfdb6 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -25,7 +25,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39 github.com/smartcontractkit/chainlink-testing-framework v1.22.1 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 3642ada3e80..64973b8d9a4 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1481,8 +1481,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 h1:jkN1563+NFZPKnZtQfG7s0fuvaDkfQ4jOv7osmQTowg= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39 h1:eDlIKD5zfBro7Y1kiIskAtO/vtuNU9R7RT7qM7rUrec= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From b0722c327dfce905189d9661e74f19de25070a93 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Fri, 5 Jan 2024 09:31:11 -0600 Subject: [PATCH 067/112] Update go.mod --- go.mod | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 4ee84ef3af8..2fab1613806 100644 --- a/go.mod +++ b/go.mod @@ -99,12 +99,11 @@ require ( gonum.org/v1/gonum v0.14.0 google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 + gopkg.in/guregu/null.v2 v2.1.2 gopkg.in/guregu/null.v4 v4.0.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 ) -require gopkg.in/guregu/null.v2 v2.1.2 - require ( cloud.google.com/go/compute v1.23.3 // indirect contrib.go.opencensus.io/exporter/stackdriver v0.13.5 // indirect From ab616d1d3fb37cea39fd82b4ba13f527430b4179 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Mon, 8 Jan 2024 08:14:20 -0600 Subject: [PATCH 068/112] .github/workflows: dedupe log artifact name with tag_suffix --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 813d4854563..aff495e964b 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -450,7 +450,7 @@ jobs: cl_repo: ${{ env.CHAINLINK_IMAGE }} cl_image_tag: ${{ github.sha }}${{ matrix.product.tag_suffix }} aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }} - artifacts_name: ${{ matrix.product.name }}-test-logs + artifacts_name: ${{ matrix.product.name }}${{ matrix.product.tag_suffix }}-test-logs artifacts_location: ./integration-tests/smoke/logs/ publish_check_name: ${{ matrix.product.name }} token: ${{ secrets.GITHUB_TOKEN }} From 2ca115903ba2434d604426d9b232a44a13076214 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Mon, 8 Jan 2024 16:24:42 -0500 Subject: [PATCH 069/112] [TT-792] Add Resources for New OCR2 Tests (#11702) * Add Resources for New OCR2 Tests * More power to the engines * Log everything * Chill on the power now * Fix missing container env --- .github/workflows/integration-tests.yml | 9 +++++---- integration-tests/docker/test_env/cl_node.go | 1 + integration-tests/smoke/ocr2_test.go | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index aff495e964b..d505dc26224 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -310,6 +310,7 @@ jobs: CHAINLINK_COMMIT_SHA: ${{ github.sha }} CHAINLINK_ENV_USER: ${{ github.actor }} TEST_LOG_LEVEL: debug + TEST_LOG_COLLECT: "true" #DEBUG: Remove after debugging strategy: fail-fast: false matrix: @@ -328,13 +329,13 @@ jobs: file: ocr pyroscope_env: ci-smoke-ocr-evm-simulated - name: ocr2 - nodes: 1 - os: ubuntu-latest + nodes: 6 + os: ubuntu-latest-16cores-64GB file: ocr2 pyroscope_env: ci-smoke-ocr2-evm-simulated - name: ocr2 - nodes: 1 - os: ubuntu-latest + nodes: 6 + os: ubuntu-latest-16cores-64GB pyroscope_env: ci-smoke-ocr2-plugins-evm-simulated tag_suffix: "-plugins" - name: runlog diff --git a/integration-tests/docker/test_env/cl_node.go b/integration-tests/docker/test_env/cl_node.go index d7228b1ce8f..f5719277609 100644 --- a/integration-tests/docker/test_env/cl_node.go +++ b/integration-tests/docker/test_env/cl_node.go @@ -413,6 +413,7 @@ func (n *ClNode) getContainerRequest(secrets string) ( Name: n.ContainerName, Image: fmt.Sprintf("%s:%s", n.ContainerImage, n.ContainerVersion), ExposedPorts: []string{"6688/tcp"}, + Env: n.ContainerEnvs, Entrypoint: []string{"chainlink", "-c", configPath, "-s", secretsPath, diff --git a/integration-tests/smoke/ocr2_test.go b/integration-tests/smoke/ocr2_test.go index b0a4950b5c9..124bc64c433 100644 --- a/integration-tests/smoke/ocr2_test.go +++ b/integration-tests/smoke/ocr2_test.go @@ -12,11 +12,12 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext" + "github.com/smartcontractkit/chainlink/v2/core/config/env" + "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/contracts" "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" - "github.com/smartcontractkit/chainlink/v2/core/config/env" ) // Tests a basic OCRv2 median feed From 6b8636293e7c48556eded32816b9b2a22d61729c Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Mon, 8 Jan 2024 16:58:06 -0500 Subject: [PATCH 070/112] Update common --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index de282b0f513..6951bb95dc1 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index aff468d9824..fd998057b7a 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1164,8 +1164,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39 h1:eDlIKD5zfBro7Y1kiIskAtO/vtuNU9R7RT7qM7rUrec= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce h1:k52jP11oloaZ2SykQO1f9o79n/FnsDLGDcFvzYCe1Ao= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/go.mod b/go.mod index 6d32fbc2d92..8e6c7f6882f 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 diff --git a/go.sum b/go.sum index 6b8db2b509d..bebde1247c1 100644 --- a/go.sum +++ b/go.sum @@ -1150,8 +1150,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39 h1:eDlIKD5zfBro7Y1kiIskAtO/vtuNU9R7RT7qM7rUrec= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce h1:k52jP11oloaZ2SykQO1f9o79n/FnsDLGDcFvzYCe1Ao= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 4f1bd8dfdb6..8ce148d746b 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -25,7 +25,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce github.com/smartcontractkit/chainlink-testing-framework v1.22.1 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 64973b8d9a4..505f0d8b8a2 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1481,8 +1481,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39 h1:eDlIKD5zfBro7Y1kiIskAtO/vtuNU9R7RT7qM7rUrec= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240104215338-34f2ac547e39/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce h1:k52jP11oloaZ2SykQO1f9o79n/FnsDLGDcFvzYCe1Ao= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From 30d2c26c6fe3d10158d7920af00560eac0555d27 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Mon, 8 Jan 2024 17:12:01 -0500 Subject: [PATCH 071/112] Fix broken test --- core/services/relay/evm/chain_reader_test.go | 4 ++-- core/services/relay/evm/codec_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 9969fb329e8..0cb6e8ff66a 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -94,7 +94,7 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { MethodReturningSeenStruct: { ChainSpecificName: "ReturnSeen", InputModifications: codec.ModifiersConfig{ - &codec.HardCodeConfig{ + &codec.HardCodeModifierConfig{ OnChainValues: map[string]any{ "BigField": testStruct.BigField.String(), "Account": hexutil.Encode(testStruct.Account), @@ -102,7 +102,7 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { }, }, OutputModifications: codec.ModifiersConfig{ - &codec.HardCodeConfig{ + &codec.HardCodeModifierConfig{ OffChainValues: map[string]any{"ExtraField": anyExtraValue}}, }, }, diff --git a/core/services/relay/evm/codec_test.go b/core/services/relay/evm/codec_test.go index 2ce57a36077..48cf67ceb72 100644 --- a/core/services/relay/evm/codec_test.go +++ b/core/services/relay/evm/codec_test.go @@ -76,7 +76,7 @@ func (it *codecInterfaceTester) GetCodec(t *testing.T) commontypes.Codec { entry.TypeAbi = string(defBytes) if k == TestItemWithConfigExtra { entry.ModifierConfigs = codec.ModifiersConfig{ - &codec.HardCodeConfig{ + &codec.HardCodeModifierConfig{ OnChainValues: map[string]any{ "BigField": testStruct.BigField.String(), "Account": hexutil.Encode(testStruct.Account), From dd99acc5afb9a206130a6a150a832e592400bbc3 Mon Sep 17 00:00:00 2001 From: Domino Valdano <2644901+reductionista@users.noreply.github.com> Date: Mon, 8 Jan 2024 20:57:16 -0800 Subject: [PATCH 072/112] Add encoder defs for events --- core/services/relay/evm/chain_reader.go | 27 +++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index 589c8e8b4e8..ee33df4f2db 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -154,7 +154,7 @@ func (cr *chainReader) addMethod( client: cr.client, }) - if err := cr.addEncoderDef(contractName, methodName, method, chainReaderDefinition); err != nil { + if err := cr.addMethodEncoderDef(contractName, methodName, method, chainReaderDefinition); err != nil { return err } @@ -170,10 +170,15 @@ func (cr *chainReader) addEvent(contractName, eventName string, abi abi.ABI, cha lp: cr.lp, hash: event.ID, }) + + if err := cr.addEventEncoderDef(contractName, eventName, event, chainReaderDefinition); err != nil { + return err + } + return cr.addDecoderDef(contractName, eventName, event.Inputs, chainReaderDefinition) } -func (cr *chainReader) addEncoderDef(contractName, methodName string, method abi.Method, chainReaderDefinition types.ChainReaderDefinition) error { +func (cr *chainReader) addMethodEncoderDef(contractName, methodName string, method abi.Method, chainReaderDefinition types.ChainReaderDefinition) error { // ABI.Pack prepends the method.ID to the encodings, we'll need the encoder to do the same. input := &codecEntry{Args: method.Inputs, encodingPrefix: method.ID} @@ -190,6 +195,24 @@ func (cr *chainReader) addEncoderDef(contractName, methodName string, method abi return nil } +func (cr *chainReader) addEventEncoderDef(contractName, methodName string, event abi.Event, chainReaderDefinition types.ChainReaderDefinition) error { + // prepend event sig as encodingPrefix + input := &codecEntry{Args: event.Inputs, encodingPrefix: event.ID.Bytes()} + + if err := input.Init(); err != nil { + return err + } + + inputMod, err := chainReaderDefinition.InputModifications.ToModifier(evmDecoderHooks...) + if err != nil { + return err + } + input.mod = inputMod + + cr.parsed.encoderDefs[wrapItemType(contractName, methodName, true)] = input + return nil +} + func (cr *chainReader) addDecoderDef(contractName, methodName string, outputs abi.Arguments, def types.ChainReaderDefinition) error { output := &codecEntry{Args: outputs} mod, err := def.OutputModifications.ToModifier(evmDecoderHooks...) From 73f6ab66e001a0c6c38fba4cee323cc120395cd9 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Tue, 9 Jan 2024 11:56:00 -0500 Subject: [PATCH 073/112] Revert "Add encoder defs for events" This reverts commit dd99acc5afb9a206130a6a150a832e592400bbc3. --- core/services/relay/evm/chain_reader.go | 27 ++----------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index ee33df4f2db..589c8e8b4e8 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -154,7 +154,7 @@ func (cr *chainReader) addMethod( client: cr.client, }) - if err := cr.addMethodEncoderDef(contractName, methodName, method, chainReaderDefinition); err != nil { + if err := cr.addEncoderDef(contractName, methodName, method, chainReaderDefinition); err != nil { return err } @@ -170,15 +170,10 @@ func (cr *chainReader) addEvent(contractName, eventName string, abi abi.ABI, cha lp: cr.lp, hash: event.ID, }) - - if err := cr.addEventEncoderDef(contractName, eventName, event, chainReaderDefinition); err != nil { - return err - } - return cr.addDecoderDef(contractName, eventName, event.Inputs, chainReaderDefinition) } -func (cr *chainReader) addMethodEncoderDef(contractName, methodName string, method abi.Method, chainReaderDefinition types.ChainReaderDefinition) error { +func (cr *chainReader) addEncoderDef(contractName, methodName string, method abi.Method, chainReaderDefinition types.ChainReaderDefinition) error { // ABI.Pack prepends the method.ID to the encodings, we'll need the encoder to do the same. input := &codecEntry{Args: method.Inputs, encodingPrefix: method.ID} @@ -195,24 +190,6 @@ func (cr *chainReader) addMethodEncoderDef(contractName, methodName string, meth return nil } -func (cr *chainReader) addEventEncoderDef(contractName, methodName string, event abi.Event, chainReaderDefinition types.ChainReaderDefinition) error { - // prepend event sig as encodingPrefix - input := &codecEntry{Args: event.Inputs, encodingPrefix: event.ID.Bytes()} - - if err := input.Init(); err != nil { - return err - } - - inputMod, err := chainReaderDefinition.InputModifications.ToModifier(evmDecoderHooks...) - if err != nil { - return err - } - input.mod = inputMod - - cr.parsed.encoderDefs[wrapItemType(contractName, methodName, true)] = input - return nil -} - func (cr *chainReader) addDecoderDef(contractName, methodName string, outputs abi.Arguments, def types.ChainReaderDefinition) error { output := &codecEntry{Args: outputs} mod, err := def.OutputModifications.ToModifier(evmDecoderHooks...) From 50bb0a603aa2422864b43f3c27d3c62a15887b26 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Tue, 9 Jan 2024 12:25:57 -0500 Subject: [PATCH 074/112] revert the change to codec entry for event and simplify how it's done --- core/services/relay/evm/chain_reader.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index 589c8e8b4e8..db79a94e390 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -154,15 +154,15 @@ func (cr *chainReader) addMethod( client: cr.client, }) - if err := cr.addEncoderDef(contractName, methodName, method, chainReaderDefinition); err != nil { + if err := cr.addEncoderDef(contractName, methodName, method.Inputs, method.ID, chainReaderDefinition); err != nil { return err } return cr.addDecoderDef(contractName, methodName, method.Outputs, chainReaderDefinition) } -func (cr *chainReader) addEvent(contractName, eventName string, abi abi.ABI, chainReaderDefinition types.ChainReaderDefinition) error { - event, eventExists := abi.Events[chainReaderDefinition.ChainSpecificName] +func (cr *chainReader) addEvent(contractName, eventName string, a abi.ABI, chainReaderDefinition types.ChainReaderDefinition) error { + event, eventExists := a.Events[chainReaderDefinition.ChainSpecificName] if !eventExists { return fmt.Errorf("%w: method %s doesn't exist", commontypes.ErrInvalidConfig, chainReaderDefinition.ChainSpecificName) } @@ -170,12 +170,20 @@ func (cr *chainReader) addEvent(contractName, eventName string, abi abi.ABI, cha lp: cr.lp, hash: event.ID, }) + + // Though nothing is encoded encoderDef is required so that CreateType can return a struct{} for CreateType to allow "decoding" into. + // The caller isn't aware that there are no arguments and will try to encode the parameters. + // The "Arguments" must be empty so decoding is to struct{}, prefix doesn't matter, as this won't be encoded. + if err := cr.addEncoderDef(contractName, eventName, abi.Arguments{}, nil, chainReaderDefinition); err != nil { + return err + } + return cr.addDecoderDef(contractName, eventName, event.Inputs, chainReaderDefinition) } -func (cr *chainReader) addEncoderDef(contractName, methodName string, method abi.Method, chainReaderDefinition types.ChainReaderDefinition) error { +func (cr *chainReader) addEncoderDef(contractName, methodName string, args abi.Arguments, prefix []byte, chainReaderDefinition types.ChainReaderDefinition) error { // ABI.Pack prepends the method.ID to the encodings, we'll need the encoder to do the same. - input := &codecEntry{Args: method.Inputs, encodingPrefix: method.ID} + input := &codecEntry{Args: args, encodingPrefix: prefix} if err := input.Init(); err != nil { return err From fde3943ffcb670febb445afc410618bf3d9a1020 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Tue, 9 Jan 2024 14:00:20 -0500 Subject: [PATCH 075/112] Add Marshal method for custom codec types. --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 3 +- core/services/relay/evm/chain_reader_test.go | 4 + core/services/relay/evm/types/gen/ints.tmpl | 9 + .../services/relay/evm/types/int_types_gen.go | 504 ++++++++++++++++++ go.mod | 2 +- go.sum | 4 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- 9 files changed, 526 insertions(+), 8 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 6951bb95dc1..c740383d4ae 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index fd998057b7a..c9a4b6d217b 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1164,8 +1164,9 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce h1:k52jP11oloaZ2SykQO1f9o79n/FnsDLGDcFvzYCe1Ao= github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4 h1:XW/sIxViSOdThSu64Qx9sUhjuNVmXMo8kO8w2aVnx/M= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 0cb6e8ff66a..e762f909a1b 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -22,6 +22,8 @@ import ( clcommontypes "github.com/smartcontractkit/chainlink-common/pkg/types" . "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" //nolint common practice to import test mods with . + commontestutils "github.com/smartcontractkit/chainlink-common/pkg/loop/testutils" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm/mocks" @@ -36,7 +38,9 @@ import ( const commonGasLimitOnEvms = uint64(4712388) func TestChainReader(t *testing.T) { + t.Parallel() RunChainReaderInterfaceTests(t, &chainReaderInterfaceTester{}) + RunChainReaderInterfaceTests(t, commontestutils.WrapChainReaderTesterForLoop(&chainReaderInterfaceTester{})) } type chainReaderInterfaceTester struct { diff --git a/core/services/relay/evm/types/gen/ints.tmpl b/core/services/relay/evm/types/gen/ints.tmpl index 5a13c483746..38c1fae03a6 100644 --- a/core/services/relay/evm/types/gen/ints.tmpl +++ b/core/services/relay/evm/types/gen/ints.tmpl @@ -30,6 +30,10 @@ func (i *{{.Prefix}}int{{.Size}}) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *{{.Prefix}}int{{.Size}}) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *{{.Prefix}}int{{.Size}}) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -39,6 +43,11 @@ func (i *{{.Prefix}}int{{.Size}}) UnmarshalText(input []byte) error { return i.Verify() } +func (i *{{.Prefix}}int{{.Size}}) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *{{.Prefix}}int{{.Size}}) Verify() error { bi := (*big.Int)(i) {{ if .Signed }} diff --git a/core/services/relay/evm/types/int_types_gen.go b/core/services/relay/evm/types/int_types_gen.go index c469f6ef3fd..0cc1471b37d 100644 --- a/core/services/relay/evm/types/int_types_gen.go +++ b/core/services/relay/evm/types/int_types_gen.go @@ -31,6 +31,10 @@ func (i *int24) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int24) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int24) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -40,6 +44,11 @@ func (i *int24) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int24) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int24) Verify() error { bi := (*big.Int)(i) @@ -70,6 +79,10 @@ func (i *uint24) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint24) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint24) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -79,6 +92,11 @@ func (i *uint24) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint24) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint24) Verify() error { bi := (*big.Int)(i) @@ -109,6 +127,10 @@ func (i *int40) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int40) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int40) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -118,6 +140,11 @@ func (i *int40) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int40) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int40) Verify() error { bi := (*big.Int)(i) @@ -148,6 +175,10 @@ func (i *uint40) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint40) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint40) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -157,6 +188,11 @@ func (i *uint40) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint40) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint40) Verify() error { bi := (*big.Int)(i) @@ -187,6 +223,10 @@ func (i *int48) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int48) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int48) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -196,6 +236,11 @@ func (i *int48) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int48) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int48) Verify() error { bi := (*big.Int)(i) @@ -226,6 +271,10 @@ func (i *uint48) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint48) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint48) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -235,6 +284,11 @@ func (i *uint48) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint48) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint48) Verify() error { bi := (*big.Int)(i) @@ -265,6 +319,10 @@ func (i *int56) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int56) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int56) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -274,6 +332,11 @@ func (i *int56) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int56) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int56) Verify() error { bi := (*big.Int)(i) @@ -304,6 +367,10 @@ func (i *uint56) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint56) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint56) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -313,6 +380,11 @@ func (i *uint56) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint56) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint56) Verify() error { bi := (*big.Int)(i) @@ -343,6 +415,10 @@ func (i *int72) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int72) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int72) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -352,6 +428,11 @@ func (i *int72) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int72) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int72) Verify() error { bi := (*big.Int)(i) @@ -382,6 +463,10 @@ func (i *uint72) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint72) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint72) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -391,6 +476,11 @@ func (i *uint72) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint72) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint72) Verify() error { bi := (*big.Int)(i) @@ -421,6 +511,10 @@ func (i *int80) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int80) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int80) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -430,6 +524,11 @@ func (i *int80) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int80) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int80) Verify() error { bi := (*big.Int)(i) @@ -460,6 +559,10 @@ func (i *uint80) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint80) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint80) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -469,6 +572,11 @@ func (i *uint80) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint80) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint80) Verify() error { bi := (*big.Int)(i) @@ -499,6 +607,10 @@ func (i *int88) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int88) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int88) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -508,6 +620,11 @@ func (i *int88) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int88) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int88) Verify() error { bi := (*big.Int)(i) @@ -538,6 +655,10 @@ func (i *uint88) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint88) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint88) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -547,6 +668,11 @@ func (i *uint88) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint88) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint88) Verify() error { bi := (*big.Int)(i) @@ -577,6 +703,10 @@ func (i *int96) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int96) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int96) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -586,6 +716,11 @@ func (i *int96) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int96) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int96) Verify() error { bi := (*big.Int)(i) @@ -616,6 +751,10 @@ func (i *uint96) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint96) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint96) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -625,6 +764,11 @@ func (i *uint96) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint96) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint96) Verify() error { bi := (*big.Int)(i) @@ -655,6 +799,10 @@ func (i *int104) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int104) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int104) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -664,6 +812,11 @@ func (i *int104) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int104) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int104) Verify() error { bi := (*big.Int)(i) @@ -694,6 +847,10 @@ func (i *uint104) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint104) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint104) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -703,6 +860,11 @@ func (i *uint104) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint104) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint104) Verify() error { bi := (*big.Int)(i) @@ -733,6 +895,10 @@ func (i *int112) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int112) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int112) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -742,6 +908,11 @@ func (i *int112) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int112) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int112) Verify() error { bi := (*big.Int)(i) @@ -772,6 +943,10 @@ func (i *uint112) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint112) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint112) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -781,6 +956,11 @@ func (i *uint112) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint112) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint112) Verify() error { bi := (*big.Int)(i) @@ -811,6 +991,10 @@ func (i *int120) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int120) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int120) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -820,6 +1004,11 @@ func (i *int120) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int120) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int120) Verify() error { bi := (*big.Int)(i) @@ -850,6 +1039,10 @@ func (i *uint120) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint120) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint120) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -859,6 +1052,11 @@ func (i *uint120) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint120) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint120) Verify() error { bi := (*big.Int)(i) @@ -889,6 +1087,10 @@ func (i *int128) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int128) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int128) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -898,6 +1100,11 @@ func (i *int128) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int128) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int128) Verify() error { bi := (*big.Int)(i) @@ -928,6 +1135,10 @@ func (i *uint128) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint128) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint128) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -937,6 +1148,11 @@ func (i *uint128) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint128) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint128) Verify() error { bi := (*big.Int)(i) @@ -967,6 +1183,10 @@ func (i *int136) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int136) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int136) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -976,6 +1196,11 @@ func (i *int136) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int136) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int136) Verify() error { bi := (*big.Int)(i) @@ -1006,6 +1231,10 @@ func (i *uint136) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint136) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint136) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1015,6 +1244,11 @@ func (i *uint136) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint136) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint136) Verify() error { bi := (*big.Int)(i) @@ -1045,6 +1279,10 @@ func (i *int144) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int144) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int144) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1054,6 +1292,11 @@ func (i *int144) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int144) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int144) Verify() error { bi := (*big.Int)(i) @@ -1084,6 +1327,10 @@ func (i *uint144) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint144) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint144) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1093,6 +1340,11 @@ func (i *uint144) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint144) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint144) Verify() error { bi := (*big.Int)(i) @@ -1123,6 +1375,10 @@ func (i *int152) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int152) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int152) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1132,6 +1388,11 @@ func (i *int152) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int152) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int152) Verify() error { bi := (*big.Int)(i) @@ -1162,6 +1423,10 @@ func (i *uint152) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint152) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint152) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1171,6 +1436,11 @@ func (i *uint152) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint152) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint152) Verify() error { bi := (*big.Int)(i) @@ -1201,6 +1471,10 @@ func (i *int160) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int160) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int160) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1210,6 +1484,11 @@ func (i *int160) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int160) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int160) Verify() error { bi := (*big.Int)(i) @@ -1240,6 +1519,10 @@ func (i *uint160) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint160) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint160) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1249,6 +1532,11 @@ func (i *uint160) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint160) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint160) Verify() error { bi := (*big.Int)(i) @@ -1279,6 +1567,10 @@ func (i *int168) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int168) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int168) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1288,6 +1580,11 @@ func (i *int168) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int168) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int168) Verify() error { bi := (*big.Int)(i) @@ -1318,6 +1615,10 @@ func (i *uint168) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint168) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint168) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1327,6 +1628,11 @@ func (i *uint168) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint168) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint168) Verify() error { bi := (*big.Int)(i) @@ -1357,6 +1663,10 @@ func (i *int176) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int176) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int176) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1366,6 +1676,11 @@ func (i *int176) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int176) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int176) Verify() error { bi := (*big.Int)(i) @@ -1396,6 +1711,10 @@ func (i *uint176) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint176) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint176) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1405,6 +1724,11 @@ func (i *uint176) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint176) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint176) Verify() error { bi := (*big.Int)(i) @@ -1435,6 +1759,10 @@ func (i *int184) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int184) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int184) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1444,6 +1772,11 @@ func (i *int184) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int184) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int184) Verify() error { bi := (*big.Int)(i) @@ -1474,6 +1807,10 @@ func (i *uint184) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint184) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint184) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1483,6 +1820,11 @@ func (i *uint184) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint184) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint184) Verify() error { bi := (*big.Int)(i) @@ -1513,6 +1855,10 @@ func (i *int192) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int192) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int192) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1522,6 +1868,11 @@ func (i *int192) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int192) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int192) Verify() error { bi := (*big.Int)(i) @@ -1552,6 +1903,10 @@ func (i *uint192) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint192) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint192) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1561,6 +1916,11 @@ func (i *uint192) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint192) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint192) Verify() error { bi := (*big.Int)(i) @@ -1591,6 +1951,10 @@ func (i *int200) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int200) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int200) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1600,6 +1964,11 @@ func (i *int200) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int200) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int200) Verify() error { bi := (*big.Int)(i) @@ -1630,6 +1999,10 @@ func (i *uint200) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint200) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint200) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1639,6 +2012,11 @@ func (i *uint200) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint200) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint200) Verify() error { bi := (*big.Int)(i) @@ -1669,6 +2047,10 @@ func (i *int208) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int208) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int208) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1678,6 +2060,11 @@ func (i *int208) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int208) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int208) Verify() error { bi := (*big.Int)(i) @@ -1708,6 +2095,10 @@ func (i *uint208) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint208) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint208) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1717,6 +2108,11 @@ func (i *uint208) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint208) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint208) Verify() error { bi := (*big.Int)(i) @@ -1747,6 +2143,10 @@ func (i *int216) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int216) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int216) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1756,6 +2156,11 @@ func (i *int216) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int216) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int216) Verify() error { bi := (*big.Int)(i) @@ -1786,6 +2191,10 @@ func (i *uint216) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint216) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint216) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1795,6 +2204,11 @@ func (i *uint216) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint216) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint216) Verify() error { bi := (*big.Int)(i) @@ -1825,6 +2239,10 @@ func (i *int224) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int224) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int224) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1834,6 +2252,11 @@ func (i *int224) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int224) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int224) Verify() error { bi := (*big.Int)(i) @@ -1864,6 +2287,10 @@ func (i *uint224) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint224) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint224) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1873,6 +2300,11 @@ func (i *uint224) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint224) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint224) Verify() error { bi := (*big.Int)(i) @@ -1903,6 +2335,10 @@ func (i *int232) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int232) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int232) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1912,6 +2348,11 @@ func (i *int232) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int232) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int232) Verify() error { bi := (*big.Int)(i) @@ -1942,6 +2383,10 @@ func (i *uint232) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint232) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint232) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1951,6 +2396,11 @@ func (i *uint232) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint232) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint232) Verify() error { bi := (*big.Int)(i) @@ -1981,6 +2431,10 @@ func (i *int240) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int240) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int240) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -1990,6 +2444,11 @@ func (i *int240) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int240) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int240) Verify() error { bi := (*big.Int)(i) @@ -2020,6 +2479,10 @@ func (i *uint240) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint240) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint240) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -2029,6 +2492,11 @@ func (i *uint240) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint240) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint240) Verify() error { bi := (*big.Int)(i) @@ -2059,6 +2527,10 @@ func (i *int248) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int248) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int248) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -2068,6 +2540,11 @@ func (i *int248) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int248) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int248) Verify() error { bi := (*big.Int)(i) @@ -2098,6 +2575,10 @@ func (i *uint248) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint248) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint248) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -2107,6 +2588,11 @@ func (i *uint248) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint248) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint248) Verify() error { bi := (*big.Int)(i) @@ -2137,6 +2623,10 @@ func (i *int256) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *int256) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *int256) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -2146,6 +2636,11 @@ func (i *int256) UnmarshalText(input []byte) error { return i.Verify() } +func (i *int256) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *int256) Verify() error { bi := (*big.Int)(i) @@ -2176,6 +2671,10 @@ func (i *uint256) UnmarshalCBOR(input []byte) error { return i.Verify() } +func (i *uint256) MarshalCBOR() ([]byte, error) { + return cbor.Marshal((*big.Int)(i)) +} + func (i *uint256) UnmarshalText(input []byte) error { bi := (*big.Int)(i) if _, ok := bi.SetString(string(input), 10); !ok { @@ -2185,6 +2684,11 @@ func (i *uint256) UnmarshalText(input []byte) error { return i.Verify() } +func (i *uint256) MarshalText() ([]byte, error) { + bi := (*big.Int)(i) + return []byte(bi.String()), nil +} + func (i *uint256) Verify() error { bi := (*big.Int)(i) diff --git a/go.mod b/go.mod index 8e6c7f6882f..e2e2d02331e 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 diff --git a/go.sum b/go.sum index bebde1247c1..84ab25d8fee 100644 --- a/go.sum +++ b/go.sum @@ -1150,8 +1150,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce h1:k52jP11oloaZ2SykQO1f9o79n/FnsDLGDcFvzYCe1Ao= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4 h1:XW/sIxViSOdThSu64Qx9sUhjuNVmXMo8kO8w2aVnx/M= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 8ce148d746b..a7e5220c253 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -25,7 +25,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4 github.com/smartcontractkit/chainlink-testing-framework v1.22.1 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 505f0d8b8a2..d00f48b4416 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1481,8 +1481,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce h1:k52jP11oloaZ2SykQO1f9o79n/FnsDLGDcFvzYCe1Ao= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4 h1:XW/sIxViSOdThSu64Qx9sUhjuNVmXMo8kO8w2aVnx/M= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From 984f5efa33b99af4963665448e934277c30f65a0 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Tue, 9 Jan 2024 17:51:24 -0500 Subject: [PATCH 076/112] Updated common, still seeing not found, not sure why... --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 5 ++--- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index c740383d4ae..15cf5764dc3 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index c9a4b6d217b..17f474b2fbe 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1164,9 +1164,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108201526-910166b38bce/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4 h1:XW/sIxViSOdThSu64Qx9sUhjuNVmXMo8kO8w2aVnx/M= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457 h1:bgF5Df5ClSxkc0S3posRfgLxgrj1iE+vkPcsjyvKqBw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/go.mod b/go.mod index e2e2d02331e..38831c0db33 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 diff --git a/go.sum b/go.sum index 84ab25d8fee..8f55373754e 100644 --- a/go.sum +++ b/go.sum @@ -1150,8 +1150,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4 h1:XW/sIxViSOdThSu64Qx9sUhjuNVmXMo8kO8w2aVnx/M= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457 h1:bgF5Df5ClSxkc0S3posRfgLxgrj1iE+vkPcsjyvKqBw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index a7e5220c253..431f6058542 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -25,7 +25,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457 github.com/smartcontractkit/chainlink-testing-framework v1.22.1 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index d00f48b4416..21114316742 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1481,8 +1481,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4 h1:XW/sIxViSOdThSu64Qx9sUhjuNVmXMo8kO8w2aVnx/M= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109183414-aebce71992d4/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457 h1:bgF5Df5ClSxkc0S3posRfgLxgrj1iE+vkPcsjyvKqBw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From 394dd3a4d4a359174423d3af21ceac14eff72d8c Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Tue, 9 Jan 2024 21:07:28 -0500 Subject: [PATCH 077/112] Update feeds --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 15cf5764dc3..d77f81b6be2 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -244,7 +244,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 17f474b2fbe..860111e2d33 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1170,8 +1170,8 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd h1:Du67whvAFKjdNwt2vS+qOzoZTvmdgQGRNsrWPeMUyKY= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd/go.mod h1:PvShvOeIuYFytuofvpqcT4cSmwBeVPQCWShM9393uic= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= diff --git a/go.mod b/go.mod index 38831c0db33..23db8188082 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 - github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 diff --git a/go.sum b/go.sum index 8f55373754e..6d4b30b6eb8 100644 --- a/go.sum +++ b/go.sum @@ -1156,8 +1156,8 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd h1:Du67whvAFKjdNwt2vS+qOzoZTvmdgQGRNsrWPeMUyKY= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd/go.mod h1:PvShvOeIuYFytuofvpqcT4cSmwBeVPQCWShM9393uic= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 431f6058542..69006b00d32 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -363,7 +363,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 21114316742..7036b3013c0 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1487,8 +1487,8 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105 h1:UUHT19viW3IIxsELz3jsvlk5MnID7cMFZlmor4seTKE= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105/go.mod h1:vQIT9tsN85b4DNgdweUilSUPX7R6gosvCmK5fvFgJAs= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd h1:Du67whvAFKjdNwt2vS+qOzoZTvmdgQGRNsrWPeMUyKY= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd/go.mod h1:PvShvOeIuYFytuofvpqcT4cSmwBeVPQCWShM9393uic= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= From 57d871fc4d7f750a57e19d83fee8bbb3fb6870da Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 10 Jan 2024 10:57:09 -0500 Subject: [PATCH 078/112] Update feeds and common to remove accidental debugging log line --- core/scripts/go.mod | 4 ++-- core/scripts/go.sum | 8 ++++---- go.mod | 4 ++-- go.sum | 8 ++++---- integration-tests/go.mod | 4 ++-- integration-tests/go.sum | 8 ++++---- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index d77f81b6be2..a4d5ca47cff 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240110155415-407896b07206 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 @@ -244,7 +244,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 860111e2d33..2342ccea9b2 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1164,14 +1164,14 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457 h1:bgF5Df5ClSxkc0S3posRfgLxgrj1iE+vkPcsjyvKqBw= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240110155415-407896b07206 h1:CfKu1c/DBx5qi1lFC9e/aVWwO0IyWKw2poBQR2VflnA= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240110155415-407896b07206/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd h1:Du67whvAFKjdNwt2vS+qOzoZTvmdgQGRNsrWPeMUyKY= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd/go.mod h1:PvShvOeIuYFytuofvpqcT4cSmwBeVPQCWShM9393uic= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 h1:Az4gVMH2V7MCdy3Oo4r4vCm2JFQ2x9mnzM8loo/1K/E= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= diff --git a/go.mod b/go.mod index 23db8188082..280eeeb8717 100644 --- a/go.mod +++ b/go.mod @@ -65,10 +65,10 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240110155415-407896b07206 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 diff --git a/go.sum b/go.sum index 6d4b30b6eb8..ba2abb5e5c0 100644 --- a/go.sum +++ b/go.sum @@ -1150,14 +1150,14 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457 h1:bgF5Df5ClSxkc0S3posRfgLxgrj1iE+vkPcsjyvKqBw= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240110155415-407896b07206 h1:CfKu1c/DBx5qi1lFC9e/aVWwO0IyWKw2poBQR2VflnA= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240110155415-407896b07206/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd h1:Du67whvAFKjdNwt2vS+qOzoZTvmdgQGRNsrWPeMUyKY= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd/go.mod h1:PvShvOeIuYFytuofvpqcT4cSmwBeVPQCWShM9393uic= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 h1:Az4gVMH2V7MCdy3Oo4r4vCm2JFQ2x9mnzM8loo/1K/E= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 69006b00d32..0ce96501a03 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -25,7 +25,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240110155415-407896b07206 github.com/smartcontractkit/chainlink-testing-framework v1.22.1 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 @@ -363,7 +363,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 7036b3013c0..0077bd23335 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1481,14 +1481,14 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457 h1:bgF5Df5ClSxkc0S3posRfgLxgrj1iE+vkPcsjyvKqBw= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240109222055-f385b4fa6457/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240110155415-407896b07206 h1:CfKu1c/DBx5qi1lFC9e/aVWwO0IyWKw2poBQR2VflnA= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240110155415-407896b07206/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd h1:Du67whvAFKjdNwt2vS+qOzoZTvmdgQGRNsrWPeMUyKY= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110013224-0e9227c2bccd/go.mod h1:PvShvOeIuYFytuofvpqcT4cSmwBeVPQCWShM9393uic= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 h1:Az4gVMH2V7MCdy3Oo4r4vCm2JFQ2x9mnzM8loo/1K/E= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= From b89c20c25cde342731a41f94a51cfd745e937480 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 10 Jan 2024 12:04:03 -0500 Subject: [PATCH 079/112] Update feeds to remove accidental log line and to add more logging to warning messages --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 1 + go.mod | 2 +- go.sum | 2 ++ integration-tests/go.mod | 2 +- integration-tests/go.sum | 1 + 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index a4d5ca47cff..f6ecc45e5b1 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -244,7 +244,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 2342ccea9b2..1db1b00a6fa 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1172,6 +1172,7 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 h1:Az4gVMH2V7MCdy3Oo4r4vCm2JFQ2x9mnzM8loo/1K/E= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= diff --git a/go.mod b/go.mod index 280eeeb8717..bd20a94f8a6 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/smartcontractkit/chainlink-common v0.1.7-0.20240110155415-407896b07206 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 diff --git a/go.sum b/go.sum index ba2abb5e5c0..525f26dba78 100644 --- a/go.sum +++ b/go.sum @@ -1158,6 +1158,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 h1:Az4gVMH2V7MCdy3Oo4r4vCm2JFQ2x9mnzM8loo/1K/E= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 h1:eIwwTq9fvxt7z7JUZl06STwa5VrlYsZZbIjLhMeDD2k= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 0ce96501a03..a7385dfd3f4 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -363,7 +363,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 0077bd23335..854ec3cadb6 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1489,6 +1489,7 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 h1:Az4gVMH2V7MCdy3Oo4r4vCm2JFQ2x9mnzM8loo/1K/E= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= From 81340262649d84c166f1ce9d14b777bcc76ac29f Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 10 Jan 2024 12:26:39 -0500 Subject: [PATCH 080/112] Fixup go mod --- core/scripts/go.sum | 3 +-- go.sum | 2 -- integration-tests/go.sum | 3 +-- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 1db1b00a6fa..b6b55e1793c 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1170,8 +1170,7 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 h1:Az4gVMH2V7MCdy3Oo4r4vCm2JFQ2x9mnzM8loo/1K/E= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 h1:eIwwTq9fvxt7z7JUZl06STwa5VrlYsZZbIjLhMeDD2k= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= diff --git a/go.sum b/go.sum index 525f26dba78..89daa3c160d 100644 --- a/go.sum +++ b/go.sum @@ -1156,8 +1156,6 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 h1:Az4gVMH2V7MCdy3Oo4r4vCm2JFQ2x9mnzM8loo/1K/E= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 h1:eIwwTq9fvxt7z7JUZl06STwa5VrlYsZZbIjLhMeDD2k= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 854ec3cadb6..bd505144336 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1487,8 +1487,7 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394 h1:Az4gVMH2V7MCdy3Oo4r4vCm2JFQ2x9mnzM8loo/1K/E= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110155523-c8ec3ffd4394/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 h1:eIwwTq9fvxt7z7JUZl06STwa5VrlYsZZbIjLhMeDD2k= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= From c4004ace955602139a48554a131fac17f26689ef Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 12 Jan 2024 14:36:20 -0500 Subject: [PATCH 081/112] Update feeds --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index f6ecc45e5b1..10d31a3001e 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -244,7 +244,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240112193433-af835dc4b1a3 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index b6b55e1793c..00d949045b9 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1170,8 +1170,8 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 h1:eIwwTq9fvxt7z7JUZl06STwa5VrlYsZZbIjLhMeDD2k= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240112193433-af835dc4b1a3 h1:w18bLofojboL74efMvH9iePjBa3KwlpvxR0FL/DN9Wc= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240112193433-af835dc4b1a3/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= diff --git a/go.mod b/go.mod index bd20a94f8a6..46fb17f34d2 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/smartcontractkit/chainlink-common v0.1.7-0.20240110155415-407896b07206 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240112193433-af835dc4b1a3 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 diff --git a/go.sum b/go.sum index 89daa3c160d..324f4e7100c 100644 --- a/go.sum +++ b/go.sum @@ -1156,8 +1156,8 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 h1:eIwwTq9fvxt7z7JUZl06STwa5VrlYsZZbIjLhMeDD2k= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240112193433-af835dc4b1a3 h1:w18bLofojboL74efMvH9iePjBa3KwlpvxR0FL/DN9Wc= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240112193433-af835dc4b1a3/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index a7385dfd3f4..a9b4808dd8f 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -363,7 +363,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240112193433-af835dc4b1a3 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index bd505144336..4bbb4caae43 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1487,8 +1487,8 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 h1:eIwwTq9fvxt7z7JUZl06STwa5VrlYsZZbIjLhMeDD2k= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240112193433-af835dc4b1a3 h1:w18bLofojboL74efMvH9iePjBa3KwlpvxR0FL/DN9Wc= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240112193433-af835dc4b1a3/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= From 31a7beeb22c18d128b8d4df9b18d45547528cfe1 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 12 Jan 2024 20:47:37 -0500 Subject: [PATCH 082/112] Remove json tag that had no business being where it was in codec entry --- core/services/relay/evm/codec_entry.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go index 96d60fa6c34..0f333812409 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/codec_entry.go @@ -53,14 +53,14 @@ func (entry *codecEntry) Init() error { return fmt.Errorf("%w: empty field names are not supported for multiple returns", commontypes.ErrInvalidType) } - tag := reflect.StructTag(`json:"` + arg.Name + `"`) name := strings.ToUpper(arg.Name[:1]) + arg.Name[1:] if seenNames[name] { return fmt.Errorf("%w: duplicate field name %s, first letter casing is ignored", commontypes.ErrInvalidType, name) } + seenNames[name] = true - native[i] = reflect.StructField{Name: name, Type: nativeArg, Tag: tag} - checked[i] = reflect.StructField{Name: name, Type: checkedArg, Tag: tag} + native[i] = reflect.StructField{Name: name, Type: nativeArg} + checked[i] = reflect.StructField{Name: name, Type: checkedArg} } entry.nativeType = reflect.StructOf(native) From ab2672d1e4cb313ca05551321cb2c57dd36b0e48 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Sun, 14 Jan 2024 15:28:17 -0500 Subject: [PATCH 083/112] Fix small lint error, likely detected from better linter in merge from dev --- core/services/relay/evm/types/gen/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/services/relay/evm/types/gen/main.go b/core/services/relay/evm/types/gen/main.go index 7bd35bf3d18..6253c6d282d 100644 --- a/core/services/relay/evm/types/gen/main.go +++ b/core/services/relay/evm/types/gen/main.go @@ -49,7 +49,7 @@ func runTemplate(name, rawTemplate, outputFile string, input any) { panic(err) } - res, err := format.Source([]byte(br.Bytes())) + res, err := format.Source(br.Bytes()) if err != nil { panic(err) } From 954c2480c0c0d91f840bfc16053da606b525591e Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Sat, 13 Jan 2024 15:36:59 -0500 Subject: [PATCH 084/112] Add fuzz test for codec --- .github/workflows/ci-core.yml | 2 +- .gitignore | 3 ++ core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 +-- core/services/relay/evm/codec_fuzz_test.go | 12 ++++++++ core/services/relay/evm/codec_test.go | 4 +++ core/services/relay/evm/encoder.go | 9 +++++- go.mod | 2 +- go.sum | 4 +-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +-- tools/bin/go_core_fuzz | 36 ++++++++++++++++++++++ 12 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 core/services/relay/evm/codec_fuzz_test.go create mode 100755 tools/bin/go_core_fuzz diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index 0d9d2912718..30534873134 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -41,7 +41,7 @@ jobs: strategy: fail-fast: false matrix: - cmd: ["go_core_tests", "go_core_race_tests"] + cmd: ["go_core_tests", "go_core_race_tests", "go_core_fuzz"] name: Core Tests (${{ matrix.cmd }}) runs-on: ubuntu20.04-64cores-256GB env: diff --git a/.gitignore b/.gitignore index 2f68ec2c945..45ec5eb2bd4 100644 --- a/.gitignore +++ b/.gitignore @@ -85,3 +85,6 @@ tools/flakeytests/coverage.txt .test_summary/ .run.id + +# Fuzz tests can create these files +**/testdata/fuzz/* diff --git a/core/scripts/go.mod b/core/scripts/go.mod index babbbd92e0f..9b0e63283bc 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113162114-77e747a4ef17 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 61a3b70225e..8adb3b7db1d 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1164,8 +1164,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113162114-77e747a4ef17 h1:/2FBQi0y48AwRq0Rr34JKsINAf7WHcaHr8XdbVXDt54= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113162114-77e747a4ef17/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960 h1:JIWro3+Kx83V5R6RBPwdPffcKDuYlI1stJqjNYJCeQA= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/core/services/relay/evm/codec_fuzz_test.go b/core/services/relay/evm/codec_fuzz_test.go new file mode 100644 index 00000000000..5870e9d77ad --- /dev/null +++ b/core/services/relay/evm/codec_fuzz_test.go @@ -0,0 +1,12 @@ +package evm_test + +import ( + "testing" + + "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" +) + +func FuzzCodec(f *testing.F) { + tester := &codecInterfaceTester{} + interfacetests.RunCodecInterfaceFuzzTests(f, tester) +} diff --git a/core/services/relay/evm/codec_test.go b/core/services/relay/evm/codec_test.go index 48cf67ceb72..b281039759c 100644 --- a/core/services/relay/evm/codec_test.go +++ b/core/services/relay/evm/codec_test.go @@ -53,6 +53,10 @@ func (it *codecInterfaceTester) Setup(_ *testing.T) {} func (it *codecInterfaceTester) GetAccountBytes(i int) []byte { account := [20]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} + // fuzz tests can make -ve numbers + if i < 0 { + i = -i + } account[i%20] += byte(i) account[(i+3)%20] += byte(i + 3) return account[:] diff --git a/core/services/relay/evm/encoder.go b/core/services/relay/evm/encoder.go index 43ce57d1449..5672ffab5bf 100644 --- a/core/services/relay/evm/encoder.go +++ b/core/services/relay/evm/encoder.go @@ -14,7 +14,14 @@ type encoder struct { var _ commontypes.Encoder = &encoder{} -func (e *encoder) Encode(ctx context.Context, item any, itemType string) ([]byte, error) { +func (e *encoder) Encode(ctx context.Context, item any, itemType string) (res []byte, err error) { + // nil values can cause abi.Arguments.Pack to panic. + defer func() { + if r := recover(); r != nil { + res = nil + err = fmt.Errorf("%w: cannot encode type", commontypes.ErrInvalidType) + } + }() info, ok := e.Definitions[itemType] if !ok { return nil, fmt.Errorf("%w: cannot find definition for %s", commontypes.ErrInvalidType, itemType) diff --git a/go.mod b/go.mod index 6195257b835..3149d93dfd5 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113162114-77e747a4ef17 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240113162230-9b808fd915ee diff --git a/go.sum b/go.sum index 6eaf670525b..e55a4b79056 100644 --- a/go.sum +++ b/go.sum @@ -1150,8 +1150,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113162114-77e747a4ef17 h1:/2FBQi0y48AwRq0Rr34JKsINAf7WHcaHr8XdbVXDt54= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113162114-77e747a4ef17/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960 h1:JIWro3+Kx83V5R6RBPwdPffcKDuYlI1stJqjNYJCeQA= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 83e7f7847d0..7e1f976dada 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -25,7 +25,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113162114-77e747a4ef17 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960 github.com/smartcontractkit/chainlink-testing-framework v1.22.1 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 95842250b41..fa8fa20da0b 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1481,8 +1481,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113162114-77e747a4ef17 h1:/2FBQi0y48AwRq0Rr34JKsINAf7WHcaHr8XdbVXDt54= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113162114-77e747a4ef17/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960 h1:JIWro3+Kx83V5R6RBPwdPffcKDuYlI1stJqjNYJCeQA= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/tools/bin/go_core_fuzz b/tools/bin/go_core_fuzz new file mode 100755 index 00000000000..3ea7d9bb0cb --- /dev/null +++ b/tools/bin/go_core_fuzz @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +set -o pipefail +set +e + +SCRIPT_PATH=`dirname "$0"`; SCRIPT_PATH=`eval "cd \"$SCRIPT_PATH\" && pwd"` +OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"} +USE_TEE="${USE_TEE:-true}" + +echo "Failed tests and panics: ---------------------" +echo "" +GO_LDFLAGS=$(bash tools/bin/ldflags) +use_tee() { + if [ "$USE_TEE" = "true" ]; then + tee "$@" + else + cat > "$@" + fi +} +go test -json -ldflags "$GO_LDFLAGS" github.com/smartcontractkit/chainlink/v2/core/services/relay/evm -fuzz . -fuzztime 12s | use_tee $OUTPUT_FILE +EXITCODE=${PIPESTATUS[0]} + +# Assert no known sensitive strings present in test logger output +printf "\n----------------------------------------------\n\n" +echo "Beginning check of output logs for sensitive strings" +$SCRIPT_PATH/scrub_logs $OUTPUT_FILE +if [[ $? != 0 ]]; then + exit 1 +fi + +echo "Exit code: $EXITCODE" +if [[ $EXITCODE != 0 ]]; then + echo "Encountered test failures." +else + echo "All tests passed!" +fi +exit $EXITCODE From 2d4f05db64261c407e8e66861dac82c2a2c37aa7 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Thu, 11 Jan 2024 08:42:24 -0500 Subject: [PATCH 085/112] Support indexed events --- .../shared/test/ChainReaderTestContract.sol | 30 +- .../chain_reader_example.go | 351 +++++++++++++++++- ...rapper-dependency-versions-do-not-edit.txt | 2 +- .../features/ocr2/features_ocr2_test.go | 3 +- core/scripts/go.mod | 4 +- core/scripts/go.sum | 8 +- core/services/relay/evm/binding.go | 145 +------- core/services/relay/evm/chain_reader.go | 108 +++++- core/services/relay/evm/chain_reader_test.go | 109 +++++- core/services/relay/evm/codec.go | 7 + core/services/relay/evm/codec_entry.go | 44 ++- core/services/relay/evm/codec_entry_test.go | 57 ++- core/services/relay/evm/decoder.go | 1 - core/services/relay/evm/encoder.go | 22 +- core/services/relay/evm/event_binding.go | 270 ++++++++++++++ core/services/relay/evm/method_binding.go | 66 ++++ core/services/relay/evm/types/types.go | 3 + go.mod | 4 +- go.sum | 8 +- .../actions/ocr2_helpers_local.go | 2 +- integration-tests/go.mod | 4 +- integration-tests/go.sum | 8 +- 22 files changed, 1042 insertions(+), 214 deletions(-) create mode 100644 core/services/relay/evm/event_binding.go create mode 100644 core/services/relay/evm/method_binding.go diff --git a/contracts/src/v0.8/shared/test/ChainReaderTestContract.sol b/contracts/src/v0.8/shared/test/ChainReaderTestContract.sol index 15098fd3552..30005c9dd81 100644 --- a/contracts/src/v0.8/shared/test/ChainReaderTestContract.sol +++ b/contracts/src/v0.8/shared/test/ChainReaderTestContract.sol @@ -24,7 +24,7 @@ struct InnerTestStruct { contract LatestValueHolder { event Triggered( - int32 field, + int32 indexed field, string differentField, uint8 oracleId, uint8[32] oracleIds, @@ -34,6 +34,19 @@ contract LatestValueHolder { MidLevelTestStruct nestedStruct ); + event TriggeredEventWithDynamicTopic( + string indexed fieldHash, + string field + ); + + + // First topic is event hash + event TriggeredWithFourTopics( + int32 indexed field1, + int32 indexed field2, + int32 indexed field3 + ); + TestStruct[] private seen; uint64[] private arr; @@ -100,4 +113,19 @@ contract LatestValueHolder { ) public { emit Triggered(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); } + + function TriggerEventWithDynamicTopic( + string calldata field + ) public { + emit TriggeredEventWithDynamicTopic(field, field); + } + + // first topic is the event signature + function TriggerWithFourTopics( + int32 field1, + int32 field2, + int32 field3 + ) public { + emit TriggeredWithFourTopics(field1, field2, field3); + } } diff --git a/core/gethwrappers/generated/chain_reader_example/chain_reader_example.go b/core/gethwrappers/generated/chain_reader_example/chain_reader_example.go index ef217880bba..7a1ab118806 100644 --- a/core/gethwrappers/generated/chain_reader_example/chain_reader_example.go +++ b/core/gethwrappers/generated/chain_reader_example/chain_reader_example.go @@ -52,8 +52,8 @@ type TestStruct struct { } var LatestValueHolderMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"Triggered\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetDifferentPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"ReturnSeen\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"TriggerEvent\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a9182029102199092169190911790556115ef806100a96000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80639ca04f671161005b5780639ca04f67146100cc578063b9dad6b0146100ec578063bdb37c90146100ff578063da8e7a821461011457600080fd5b8063030d3ca2146100825780636c7cf955146100a45780638b659d6e146100b9575b600080fd5b6107c65b60405167ffffffffffffffff90911681526020015b60405180910390f35b6100b76100b2366004610be2565b61011b565b005b6100b76100c7366004610be2565b61041e565b6100df6100da366004610cd4565b610473565b60405161009b9190610e33565b6100df6100fa366004610be2565b61074e565b610107610857565b60405161009b9190610f29565b6003610086565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b9183908390808284376000920191909152505050815273ffffffffffffffffffffffffffffffffffffffff8816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161020d84611060565b905281546001808201845560009384526020938490208351600a9093020180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff9093169290921782559282015191929091908201906102739082611207565b5060408201516002820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff90921691909117905560608201516102c190600383019060206108e3565b5060808201516004820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90921691909117905560a08201518051610328916005840191602090910190610976565b5060c08201516006820180547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff90921691909117905560e082015180516007830180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001660f09290921c91909117815560208083015180516008860180547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff90921691909117815591810151909190600986019061040b9082611207565b5050505050505050505050505050505050565b7f7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d8a8a8a8a8a8a8a8a8a8a60405161045f9a999897969594939291906114af565b60405180910390a150505050505050505050565b61047b6109f0565b6000610488600184611579565b81548110610498576104986115b3565b6000918252602091829020604080516101008101909152600a90920201805460030b825260018101805492939192918401916104d39061116b565b80601f01602080910402602001604051908101604052809291908181526020018280546104ff9061116b565b801561054c5780601f106105215761010080835404028352916020019161054c565b820191906000526020600020905b81548152906001019060200180831161052f57829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff1681526020600192830181810494850194909303909202910180841161058157505050928452505050600482015473ffffffffffffffffffffffffffffffffffffffff16602080830191909152600583018054604080518285028101850182528281529401939283018282801561063a57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161060f575b5050509183525050600682015460170b6020808301919091526040805180820182526007808601805460f01b7fffff0000000000000000000000000000000000000000000000000000000000001683528351808501855260088801805490930b815260098801805495909701969395919486830194919392840191906106bf9061116b565b80601f01602080910402602001604051908101604052809291908181526020018280546106eb9061116b565b80156107385780601f1061070d57610100808354040283529160200191610738565b820191906000526020600020905b81548152906001019060200180831161071b57829003601f168201915b5050509190925250505090525090525092915050565b6107566109f0565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b9183908390808284376000920191909152505050815273ffffffffffffffffffffffffffffffffffffffff8816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161084684611060565b90529b9a5050505050505050505050565b606060018054806020026020016040519081016040528092919081815260200182805480156108d957602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116108945790505b5050505050905090565b6001830191839082156109665791602002820160005b8382111561093757835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026108f9565b80156109645782816101000a81549060ff0219169055600101602081600001049283019260010302610937565b505b50610972929150610a3f565b5090565b828054828255906000526020600020908101928215610966579160200282015b8281111561096657825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190610996565b6040805161010081018252600080825260606020830181905292820152908101610a18610a54565b8152600060208201819052606060408301819052820152608001610a3a610a73565b905290565b5b808211156109725760008155600101610a40565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060007dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001610a3a6040518060400160405280600060070b8152602001606081525090565b8035600381900b8114610ad857600080fd5b919050565b60008083601f840112610aef57600080fd5b50813567ffffffffffffffff811115610b0757600080fd5b602083019150836020828501011115610b1f57600080fd5b9250929050565b803560ff81168114610ad857600080fd5b806104008101831015610b4957600080fd5b92915050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610ad857600080fd5b60008083601f840112610b8557600080fd5b50813567ffffffffffffffff811115610b9d57600080fd5b6020830191508360208260051b8501011115610b1f57600080fd5b8035601781900b8114610ad857600080fd5b600060408284031215610bdc57600080fd5b50919050565b6000806000806000806000806000806104e08b8d031215610c0257600080fd5b610c0b8b610ac6565b995060208b013567ffffffffffffffff80821115610c2857600080fd5b610c348e838f01610add565b909b509950899150610c4860408e01610b26565b9850610c578e60608f01610b37565b9750610c666104608e01610b4f565b96506104808d0135915080821115610c7d57600080fd5b610c898e838f01610b73565b9096509450849150610c9e6104a08e01610bb8565b93506104c08d0135915080821115610cb557600080fd5b50610cc28d828e01610bca565b9150509295989b9194979a5092959850565b600060208284031215610ce657600080fd5b5035919050565b6000815180845260005b81811015610d1357602081850181015186830182015201610cf7565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b8060005b6020808210610d645750610d7b565b825160ff1685529384019390910190600101610d55565b50505050565b600081518084526020808501945080840160005b83811015610dc757815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101610d95565b509495945050505050565b7fffff00000000000000000000000000000000000000000000000000000000000081511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610e2b6080850182610ced565b949350505050565b60208152610e4760208201835160030b9052565b600060208301516104e0806040850152610e65610500850183610ced565b91506040850151610e7b606086018260ff169052565b506060850151610e8e6080860182610d51565b50608085015173ffffffffffffffffffffffffffffffffffffffff1661048085015260a08501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe085840381016104a0870152610eeb8483610d81565b935060c08701519150610f046104c087018360170b9052565b60e0870151915080868503018387015250610f1f8382610dd2565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015610f6b57835167ffffffffffffffff1683529284019291840191600101610f45565b50909695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715610fc957610fc9610f77565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561101657611016610f77565b604052919050565b80357fffff00000000000000000000000000000000000000000000000000000000000081168114610ad857600080fd5b8035600781900b8114610ad857600080fd5b60006040823603121561107257600080fd5b61107a610fa6565b6110838361101e565b815260208084013567ffffffffffffffff808211156110a157600080fd5b8186019150604082360312156110b657600080fd5b6110be610fa6565b6110c78361104e565b815283830135828111156110da57600080fd5b929092019136601f8401126110ee57600080fd5b82358281111561110057611100610f77565b611130857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601610fcf565b9250808352368582860101111561114657600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c9082168061117f57607f821691505b602082108103610bdc577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b601f82111561120257600081815260208120601f850160051c810160208610156111df5750805b601f850160051c820191505b818110156111fe578281556001016111eb565b5050505b505050565b815167ffffffffffffffff81111561122157611221610f77565b6112358161122f845461116b565b846111b8565b602080601f83116001811461128857600084156112525750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b1785556111fe565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b828110156112d5578886015182559484019460019091019084016112b6565b508582101561131157878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b8183526000602080850194508260005b85811015610dc75773ffffffffffffffffffffffffffffffffffffffff6113a083610b4f565b168752958201959082019060010161137a565b7fffff0000000000000000000000000000000000000000000000000000000000006113dd8261101e565b168252600060208201357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc183360301811261141757600080fd5b6040602085015282016114298161104e565b60070b604085015260208101357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe182360301811261146657600080fd5b0160208101903567ffffffffffffffff81111561148257600080fd5b80360382131561149157600080fd5b604060608601526114a6608086018284611321565b95945050505050565b60006104e08c60030b8352602081818501526114ce8285018d8f611321565b915060ff808c166040860152606085018b60005b8481101561150757836114f483610b26565b16835291840191908401906001016114e2565b505050505061152f61046084018973ffffffffffffffffffffffffffffffffffffffff169052565b82810361048084015261154381878961136a565b90506115556104a084018660170b9052565b8281036104c084015261156881856113b3565b9d9c50505050505050505050505050565b81810381811115610b49577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c6343000813000a", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"Triggered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"fieldHash\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"field\",\"type\":\"string\"}],\"name\":\"TriggeredEventWithDynamicTopic\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int32\",\"name\":\"field1\",\"type\":\"int32\"},{\"indexed\":true,\"internalType\":\"int32\",\"name\":\"field2\",\"type\":\"int32\"},{\"indexed\":true,\"internalType\":\"int32\",\"name\":\"field3\",\"type\":\"int32\"}],\"name\":\"TriggeredWithFourTopics\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetDifferentPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"ReturnSeen\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"TriggerEvent\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"field\",\"type\":\"string\"}],\"name\":\"TriggerEventWithDynamicTopic\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field1\",\"type\":\"int32\"},{\"internalType\":\"int32\",\"name\":\"field2\",\"type\":\"int32\"},{\"internalType\":\"int32\",\"name\":\"field3\",\"type\":\"int32\"}],\"name\":\"TriggerWithFourTopics\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a918202910219909216919091179055611768806100a96000396000f3fe608060405234801561001057600080fd5b50600436106100a35760003560e01c80638b659d6e11610076578063b9dad6b01161005b578063b9dad6b014610138578063bdb37c901461014b578063da8e7a821461016057600080fd5b80638b659d6e146101055780639ca04f671461011857600080fd5b8063030d3ca2146100a85780633205fb6b146100ca5780636c7cf955146100df57806383b0abee146100f2575b600080fd5b6107c65b60405167ffffffffffffffff90911681526020015b60405180910390f35b6100dd6100d8366004610bef565b610167565b005b6100dd6100ed366004610d04565b6101bc565b6100dd610100366004610df6565b6104bf565b6100dd610113366004610d04565b6104fc565b61012b610126366004610e39565b610553565b6040516100c19190610f98565b61012b610146366004610d04565b61082e565b610153610937565b6040516100c1919061108e565b60036100ac565b81816040516101779291906110dc565b60405180910390207f3d969732b1bbbb9f1d7eb9f3f14e4cb50a74d950b3ef916a397b85dfbab93c6783836040516101b0929190611135565b60405180910390a25050565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b9183908390808284376000920191909152505050815273ffffffffffffffffffffffffffffffffffffffff8816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016102ae84611232565b905281546001808201845560009384526020938490208351600a9093020180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff90931692909217825592820151919290919082019061031490826113d9565b5060408201516002820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff909216919091179055606082015161036290600383019060206109c3565b5060808201516004820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90921691909117905560a082015180516103c9916005840191602090910190610a56565b5060c08201516006820180547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff90921691909117905560e082015180516007830180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001660f09290921c91909117815560208083015180516008860180547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff9092169190911781559181015190919060098601906104ac90826113d9565b5050505050505050505050505050505050565b8060030b8260030b8460030b7f91c80dc390f3d041b3a04b0099b19634499541ea26972250986ee4b24a12fac560405160405180910390a4505050565b8960030b7f7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d8a8a8a8a8a8a8a8a8a60405161053f99989796959493929190611638565b60405180910390a250505050505050505050565b61055b610ad0565b60006105686001846116f2565b815481106105785761057861172c565b6000918252602091829020604080516101008101909152600a90920201805460030b825260018101805492939192918401916105b39061133d565b80601f01602080910402602001604051908101604052809291908181526020018280546105df9061133d565b801561062c5780601f106106015761010080835404028352916020019161062c565b820191906000526020600020905b81548152906001019060200180831161060f57829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff1681526020600192830181810494850194909303909202910180841161066157505050928452505050600482015473ffffffffffffffffffffffffffffffffffffffff16602080830191909152600583018054604080518285028101850182528281529401939283018282801561071a57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116106ef575b5050509183525050600682015460170b6020808301919091526040805180820182526007808601805460f01b7fffff0000000000000000000000000000000000000000000000000000000000001683528351808501855260088801805490930b8152600988018054959097019693959194868301949193928401919061079f9061133d565b80601f01602080910402602001604051908101604052809291908181526020018280546107cb9061133d565b80156108185780601f106107ed57610100808354040283529160200191610818565b820191906000526020600020905b8154815290600101906020018083116107fb57829003601f168201915b5050509190925250505090525090525092915050565b610836610ad0565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b9183908390808284376000920191909152505050815273ffffffffffffffffffffffffffffffffffffffff8816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161092684611232565b90529b9a5050505050505050505050565b606060018054806020026020016040519081016040528092919081815260200182805480156109b957602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116109745790505b5050505050905090565b600183019183908215610a465791602002820160005b83821115610a1757835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026109d9565b8015610a445782816101000a81549060ff0219169055600101602081600001049283019260010302610a17565b505b50610a52929150610b1f565b5090565b828054828255906000526020600020908101928215610a46579160200282015b82811115610a4657825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190610a76565b6040805161010081018252600080825260606020830181905292820152908101610af8610b34565b8152600060208201819052606060408301819052820152608001610b1a610b53565b905290565b5b80821115610a525760008155600101610b20565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060007dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001610b1a6040518060400160405280600060070b8152602001606081525090565b60008083601f840112610bb857600080fd5b50813567ffffffffffffffff811115610bd057600080fd5b602083019150836020828501011115610be857600080fd5b9250929050565b60008060208385031215610c0257600080fd5b823567ffffffffffffffff811115610c1957600080fd5b610c2585828601610ba6565b90969095509350505050565b8035600381900b8114610c4357600080fd5b919050565b803560ff81168114610c4357600080fd5b806104008101831015610c6b57600080fd5b92915050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610c4357600080fd5b60008083601f840112610ca757600080fd5b50813567ffffffffffffffff811115610cbf57600080fd5b6020830191508360208260051b8501011115610be857600080fd5b8035601781900b8114610c4357600080fd5b600060408284031215610cfe57600080fd5b50919050565b6000806000806000806000806000806104e08b8d031215610d2457600080fd5b610d2d8b610c31565b995060208b013567ffffffffffffffff80821115610d4a57600080fd5b610d568e838f01610ba6565b909b509950899150610d6a60408e01610c48565b9850610d798e60608f01610c59565b9750610d886104608e01610c71565b96506104808d0135915080821115610d9f57600080fd5b610dab8e838f01610c95565b9096509450849150610dc06104a08e01610cda565b93506104c08d0135915080821115610dd757600080fd5b50610de48d828e01610cec565b9150509295989b9194979a5092959850565b600080600060608486031215610e0b57600080fd5b610e1484610c31565b9250610e2260208501610c31565b9150610e3060408501610c31565b90509250925092565b600060208284031215610e4b57600080fd5b5035919050565b6000815180845260005b81811015610e7857602081850181015186830182015201610e5c565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b8060005b6020808210610ec95750610ee0565b825160ff1685529384019390910190600101610eba565b50505050565b600081518084526020808501945080840160005b83811015610f2c57815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101610efa565b509495945050505050565b7fffff00000000000000000000000000000000000000000000000000000000000081511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610f906080850182610e52565b949350505050565b60208152610fac60208201835160030b9052565b600060208301516104e0806040850152610fca610500850183610e52565b91506040850151610fe0606086018260ff169052565b506060850151610ff36080860182610eb6565b50608085015173ffffffffffffffffffffffffffffffffffffffff1661048085015260a08501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe085840381016104a08701526110508483610ee6565b935060c087015191506110696104c087018360170b9052565b60e08701519150808685030183870152506110848382610f37565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156110d057835167ffffffffffffffff16835292840192918401916001016110aa565b50909695505050505050565b8183823760009101908152919050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b602081526000610f906020830184866110ec565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561119b5761119b611149565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156111e8576111e8611149565b604052919050565b80357fffff00000000000000000000000000000000000000000000000000000000000081168114610c4357600080fd5b8035600781900b8114610c4357600080fd5b60006040823603121561124457600080fd5b61124c611178565b611255836111f0565b815260208084013567ffffffffffffffff8082111561127357600080fd5b81860191506040823603121561128857600080fd5b611290611178565b61129983611220565b815283830135828111156112ac57600080fd5b929092019136601f8401126112c057600080fd5b8235828111156112d2576112d2611149565b611302857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016111a1565b9250808352368582860101111561131857600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c9082168061135157607f821691505b602082108103610cfe577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b601f8211156113d457600081815260208120601f850160051c810160208610156113b15750805b601f850160051c820191505b818110156113d0578281556001016113bd565b5050505b505050565b815167ffffffffffffffff8111156113f3576113f3611149565b61140781611401845461133d565b8461138a565b602080601f83116001811461145a57600084156114245750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b1785556113d0565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b828110156114a757888601518255948401946001909101908401611488565b50858210156114e357878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b8183526000602080850194508260005b85811015610f2c5773ffffffffffffffffffffffffffffffffffffffff61152983610c71565b1687529582019590820190600101611503565b7fffff000000000000000000000000000000000000000000000000000000000000611566826111f0565b168252600060208201357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18336030181126115a057600080fd5b6040602085015282016115b281611220565b60070b604085015260208101357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18236030181126115ef57600080fd5b0160208101903567ffffffffffffffff81111561160b57600080fd5b80360382131561161a57600080fd5b6040606086015261162f6080860182846110ec565b95945050505050565b60006104c080835261164d8184018c8e6110ec565b9050602060ff808c1682860152604085018b60005b84811015611687578361167483610c48565b1683529184019190840190600101611662565b505050505073ffffffffffffffffffffffffffffffffffffffff88166104408401528281036104608401526116bd8187896114f3565b90506116cf61048084018660170b9052565b8281036104a08401526116e2818561153c565b9c9b505050505050505050505050565b81810381811115610c6b577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c6343000813000a", } var LatestValueHolderABI = LatestValueHolderMetaData.ABI @@ -326,6 +326,30 @@ func (_LatestValueHolder *LatestValueHolderTransactorSession) TriggerEvent(field return _LatestValueHolder.Contract.TriggerEvent(&_LatestValueHolder.TransactOpts, field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) } +func (_LatestValueHolder *LatestValueHolderTransactor) TriggerEventWithDynamicTopic(opts *bind.TransactOpts, field string) (*types.Transaction, error) { + return _LatestValueHolder.contract.Transact(opts, "TriggerEventWithDynamicTopic", field) +} + +func (_LatestValueHolder *LatestValueHolderSession) TriggerEventWithDynamicTopic(field string) (*types.Transaction, error) { + return _LatestValueHolder.Contract.TriggerEventWithDynamicTopic(&_LatestValueHolder.TransactOpts, field) +} + +func (_LatestValueHolder *LatestValueHolderTransactorSession) TriggerEventWithDynamicTopic(field string) (*types.Transaction, error) { + return _LatestValueHolder.Contract.TriggerEventWithDynamicTopic(&_LatestValueHolder.TransactOpts, field) +} + +func (_LatestValueHolder *LatestValueHolderTransactor) TriggerWithFourTopics(opts *bind.TransactOpts, field1 int32, field2 int32, field3 int32) (*types.Transaction, error) { + return _LatestValueHolder.contract.Transact(opts, "TriggerWithFourTopics", field1, field2, field3) +} + +func (_LatestValueHolder *LatestValueHolderSession) TriggerWithFourTopics(field1 int32, field2 int32, field3 int32) (*types.Transaction, error) { + return _LatestValueHolder.Contract.TriggerWithFourTopics(&_LatestValueHolder.TransactOpts, field1, field2, field3) +} + +func (_LatestValueHolder *LatestValueHolderTransactorSession) TriggerWithFourTopics(field1 int32, field2 int32, field3 int32) (*types.Transaction, error) { + return _LatestValueHolder.Contract.TriggerWithFourTopics(&_LatestValueHolder.TransactOpts, field1, field2, field3) +} + type LatestValueHolderTriggeredIterator struct { Event *LatestValueHolderTriggered @@ -398,18 +422,28 @@ type LatestValueHolderTriggered struct { Raw types.Log } -func (_LatestValueHolder *LatestValueHolderFilterer) FilterTriggered(opts *bind.FilterOpts) (*LatestValueHolderTriggeredIterator, error) { +func (_LatestValueHolder *LatestValueHolderFilterer) FilterTriggered(opts *bind.FilterOpts, field []int32) (*LatestValueHolderTriggeredIterator, error) { - logs, sub, err := _LatestValueHolder.contract.FilterLogs(opts, "Triggered") + var fieldRule []interface{} + for _, fieldItem := range field { + fieldRule = append(fieldRule, fieldItem) + } + + logs, sub, err := _LatestValueHolder.contract.FilterLogs(opts, "Triggered", fieldRule) if err != nil { return nil, err } return &LatestValueHolderTriggeredIterator{contract: _LatestValueHolder.contract, event: "Triggered", logs: logs, sub: sub}, nil } -func (_LatestValueHolder *LatestValueHolderFilterer) WatchTriggered(opts *bind.WatchOpts, sink chan<- *LatestValueHolderTriggered) (event.Subscription, error) { +func (_LatestValueHolder *LatestValueHolderFilterer) WatchTriggered(opts *bind.WatchOpts, sink chan<- *LatestValueHolderTriggered, field []int32) (event.Subscription, error) { + + var fieldRule []interface{} + for _, fieldItem := range field { + fieldRule = append(fieldRule, fieldItem) + } - logs, sub, err := _LatestValueHolder.contract.WatchLogs(opts, "Triggered") + logs, sub, err := _LatestValueHolder.contract.WatchLogs(opts, "Triggered", fieldRule) if err != nil { return nil, err } @@ -450,10 +484,287 @@ func (_LatestValueHolder *LatestValueHolderFilterer) ParseTriggered(log types.Lo return event, nil } +type LatestValueHolderTriggeredEventWithDynamicTopicIterator struct { + Event *LatestValueHolderTriggeredEventWithDynamicTopic + + contract *bind.BoundContract + event string + + logs chan types.Log + sub ethereum.Subscription + done bool + fail error +} + +func (it *LatestValueHolderTriggeredEventWithDynamicTopicIterator) Next() bool { + + if it.fail != nil { + return false + } + + if it.done { + select { + case log := <-it.logs: + it.Event = new(LatestValueHolderTriggeredEventWithDynamicTopic) + 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(LatestValueHolderTriggeredEventWithDynamicTopic) + 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 *LatestValueHolderTriggeredEventWithDynamicTopicIterator) Error() error { + return it.fail +} + +func (it *LatestValueHolderTriggeredEventWithDynamicTopicIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +type LatestValueHolderTriggeredEventWithDynamicTopic struct { + FieldHash common.Hash + Field string + Raw types.Log +} + +func (_LatestValueHolder *LatestValueHolderFilterer) FilterTriggeredEventWithDynamicTopic(opts *bind.FilterOpts, fieldHash []string) (*LatestValueHolderTriggeredEventWithDynamicTopicIterator, error) { + + var fieldHashRule []interface{} + for _, fieldHashItem := range fieldHash { + fieldHashRule = append(fieldHashRule, fieldHashItem) + } + + logs, sub, err := _LatestValueHolder.contract.FilterLogs(opts, "TriggeredEventWithDynamicTopic", fieldHashRule) + if err != nil { + return nil, err + } + return &LatestValueHolderTriggeredEventWithDynamicTopicIterator{contract: _LatestValueHolder.contract, event: "TriggeredEventWithDynamicTopic", logs: logs, sub: sub}, nil +} + +func (_LatestValueHolder *LatestValueHolderFilterer) WatchTriggeredEventWithDynamicTopic(opts *bind.WatchOpts, sink chan<- *LatestValueHolderTriggeredEventWithDynamicTopic, fieldHash []string) (event.Subscription, error) { + + var fieldHashRule []interface{} + for _, fieldHashItem := range fieldHash { + fieldHashRule = append(fieldHashRule, fieldHashItem) + } + + logs, sub, err := _LatestValueHolder.contract.WatchLogs(opts, "TriggeredEventWithDynamicTopic", fieldHashRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + + event := new(LatestValueHolderTriggeredEventWithDynamicTopic) + if err := _LatestValueHolder.contract.UnpackLog(event, "TriggeredEventWithDynamicTopic", 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 (_LatestValueHolder *LatestValueHolderFilterer) ParseTriggeredEventWithDynamicTopic(log types.Log) (*LatestValueHolderTriggeredEventWithDynamicTopic, error) { + event := new(LatestValueHolderTriggeredEventWithDynamicTopic) + if err := _LatestValueHolder.contract.UnpackLog(event, "TriggeredEventWithDynamicTopic", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +type LatestValueHolderTriggeredWithFourTopicsIterator struct { + Event *LatestValueHolderTriggeredWithFourTopics + + contract *bind.BoundContract + event string + + logs chan types.Log + sub ethereum.Subscription + done bool + fail error +} + +func (it *LatestValueHolderTriggeredWithFourTopicsIterator) Next() bool { + + if it.fail != nil { + return false + } + + if it.done { + select { + case log := <-it.logs: + it.Event = new(LatestValueHolderTriggeredWithFourTopics) + 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(LatestValueHolderTriggeredWithFourTopics) + 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 *LatestValueHolderTriggeredWithFourTopicsIterator) Error() error { + return it.fail +} + +func (it *LatestValueHolderTriggeredWithFourTopicsIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +type LatestValueHolderTriggeredWithFourTopics struct { + Field1 int32 + Field2 int32 + Field3 int32 + Raw types.Log +} + +func (_LatestValueHolder *LatestValueHolderFilterer) FilterTriggeredWithFourTopics(opts *bind.FilterOpts, field1 []int32, field2 []int32, field3 []int32) (*LatestValueHolderTriggeredWithFourTopicsIterator, error) { + + var field1Rule []interface{} + for _, field1Item := range field1 { + field1Rule = append(field1Rule, field1Item) + } + var field2Rule []interface{} + for _, field2Item := range field2 { + field2Rule = append(field2Rule, field2Item) + } + var field3Rule []interface{} + for _, field3Item := range field3 { + field3Rule = append(field3Rule, field3Item) + } + + logs, sub, err := _LatestValueHolder.contract.FilterLogs(opts, "TriggeredWithFourTopics", field1Rule, field2Rule, field3Rule) + if err != nil { + return nil, err + } + return &LatestValueHolderTriggeredWithFourTopicsIterator{contract: _LatestValueHolder.contract, event: "TriggeredWithFourTopics", logs: logs, sub: sub}, nil +} + +func (_LatestValueHolder *LatestValueHolderFilterer) WatchTriggeredWithFourTopics(opts *bind.WatchOpts, sink chan<- *LatestValueHolderTriggeredWithFourTopics, field1 []int32, field2 []int32, field3 []int32) (event.Subscription, error) { + + var field1Rule []interface{} + for _, field1Item := range field1 { + field1Rule = append(field1Rule, field1Item) + } + var field2Rule []interface{} + for _, field2Item := range field2 { + field2Rule = append(field2Rule, field2Item) + } + var field3Rule []interface{} + for _, field3Item := range field3 { + field3Rule = append(field3Rule, field3Item) + } + + logs, sub, err := _LatestValueHolder.contract.WatchLogs(opts, "TriggeredWithFourTopics", field1Rule, field2Rule, field3Rule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + + event := new(LatestValueHolderTriggeredWithFourTopics) + if err := _LatestValueHolder.contract.UnpackLog(event, "TriggeredWithFourTopics", 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 (_LatestValueHolder *LatestValueHolderFilterer) ParseTriggeredWithFourTopics(log types.Log) (*LatestValueHolderTriggeredWithFourTopics, error) { + event := new(LatestValueHolderTriggeredWithFourTopics) + if err := _LatestValueHolder.contract.UnpackLog(event, "TriggeredWithFourTopics", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + func (_LatestValueHolder *LatestValueHolder) ParseLog(log types.Log) (generated.AbigenLog, error) { switch log.Topics[0] { case _LatestValueHolder.abi.Events["Triggered"].ID: return _LatestValueHolder.ParseTriggered(log) + case _LatestValueHolder.abi.Events["TriggeredEventWithDynamicTopic"].ID: + return _LatestValueHolder.ParseTriggeredEventWithDynamicTopic(log) + case _LatestValueHolder.abi.Events["TriggeredWithFourTopics"].ID: + return _LatestValueHolder.ParseTriggeredWithFourTopics(log) default: return nil, fmt.Errorf("abigen wrapper received unknown log topic: %v", log.Topics[0]) @@ -464,6 +775,14 @@ func (LatestValueHolderTriggered) Topic() common.Hash { return common.HexToHash("0x7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d") } +func (LatestValueHolderTriggeredEventWithDynamicTopic) Topic() common.Hash { + return common.HexToHash("0x3d969732b1bbbb9f1d7eb9f3f14e4cb50a74d950b3ef916a397b85dfbab93c67") +} + +func (LatestValueHolderTriggeredWithFourTopics) Topic() common.Hash { + return common.HexToHash("0x91c80dc390f3d041b3a04b0099b19634499541ea26972250986ee4b24a12fac5") +} + func (_LatestValueHolder *LatestValueHolder) Address() common.Address { return _LatestValueHolder.address } @@ -483,12 +802,28 @@ type LatestValueHolderInterface interface { TriggerEvent(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) - FilterTriggered(opts *bind.FilterOpts) (*LatestValueHolderTriggeredIterator, error) + TriggerEventWithDynamicTopic(opts *bind.TransactOpts, field string) (*types.Transaction, error) + + TriggerWithFourTopics(opts *bind.TransactOpts, field1 int32, field2 int32, field3 int32) (*types.Transaction, error) - WatchTriggered(opts *bind.WatchOpts, sink chan<- *LatestValueHolderTriggered) (event.Subscription, error) + FilterTriggered(opts *bind.FilterOpts, field []int32) (*LatestValueHolderTriggeredIterator, error) + + WatchTriggered(opts *bind.WatchOpts, sink chan<- *LatestValueHolderTriggered, field []int32) (event.Subscription, error) ParseTriggered(log types.Log) (*LatestValueHolderTriggered, error) + FilterTriggeredEventWithDynamicTopic(opts *bind.FilterOpts, fieldHash []string) (*LatestValueHolderTriggeredEventWithDynamicTopicIterator, error) + + WatchTriggeredEventWithDynamicTopic(opts *bind.WatchOpts, sink chan<- *LatestValueHolderTriggeredEventWithDynamicTopic, fieldHash []string) (event.Subscription, error) + + ParseTriggeredEventWithDynamicTopic(log types.Log) (*LatestValueHolderTriggeredEventWithDynamicTopic, error) + + FilterTriggeredWithFourTopics(opts *bind.FilterOpts, field1 []int32, field2 []int32, field3 []int32) (*LatestValueHolderTriggeredWithFourTopicsIterator, error) + + WatchTriggeredWithFourTopics(opts *bind.WatchOpts, sink chan<- *LatestValueHolderTriggeredWithFourTopics, field1 []int32, field2 []int32, field3 []int32) (event.Subscription, error) + + ParseTriggeredWithFourTopics(log types.Log) (*LatestValueHolderTriggeredWithFourTopics, error) + ParseLog(log types.Log) (generated.AbigenLog, error) Address() common.Address diff --git a/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt b/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt index 2079d89580b..8f6789012a1 100644 --- a/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt +++ b/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt @@ -11,7 +11,7 @@ batch_blockhash_store: ../../contracts/solc/v0.8.6/BatchBlockhashStore/BatchBloc batch_vrf_coordinator_v2: ../../contracts/solc/v0.8.6/BatchVRFCoordinatorV2/BatchVRFCoordinatorV2.abi ../../contracts/solc/v0.8.6/BatchVRFCoordinatorV2/BatchVRFCoordinatorV2.bin d0a54963260d8c1f1bbd984b758285e6027cfb5a7e42701bcb562ab123219332 batch_vrf_coordinator_v2plus: ../../contracts/solc/v0.8.6/BatchVRFCoordinatorV2Plus/BatchVRFCoordinatorV2Plus.abi ../../contracts/solc/v0.8.6/BatchVRFCoordinatorV2Plus/BatchVRFCoordinatorV2Plus.bin 7bb76ae241cf1b37b41920830b836cb99f1ad33efd7435ca2398ff6cd2fe5d48 blockhash_store: ../../contracts/solc/v0.8.6/BlockhashStore/BlockhashStore.abi ../../contracts/solc/v0.8.6/BlockhashStore/BlockhashStore.bin 12b0662f1636a341c8863bdec7a20f2ddd97c3a4fd1a7ae353fe316609face4e -chain_reader_example: ../../contracts/solc/v0.8.19/ChainReaderTestContract/LatestValueHolder.abi ../../contracts/solc/v0.8.19/ChainReaderTestContract/LatestValueHolder.bin 0df0a592be25f8635aa07038d92f03043421fd0dc8855f4750c1c9673d2c613b +chain_reader_example: ../../contracts/solc/v0.8.19/ChainReaderTestContract/LatestValueHolder.abi ../../contracts/solc/v0.8.19/ChainReaderTestContract/LatestValueHolder.bin 77b8d15609d34d553950e3170a86a39943437f63396289935da64c001efafa25 chain_specific_util_helper: ../../contracts/solc/v0.8.6/ChainSpecificUtilHelper/ChainSpecificUtilHelper.abi ../../contracts/solc/v0.8.6/ChainSpecificUtilHelper/ChainSpecificUtilHelper.bin 5f10664e31abc768f4a37901cae7a3bef90146180f97303e5a1bde5a08d84595 consumer_wrapper: ../../contracts/solc/v0.7/Consumer/Consumer.abi ../../contracts/solc/v0.7/Consumer/Consumer.bin 894d1cbd920dccbd36d92918c1037c6ded34f66f417ccb18ec3f33c64ef83ec5 cron_upkeep_factory_wrapper: ../../contracts/solc/v0.8.6/CronUpkeepFactory/CronUpkeepFactory.abi - dacb0f8cdf54ae9d2781c5e720fc314b32ed5e58eddccff512c75d6067292cd7 diff --git a/core/internal/features/ocr2/features_ocr2_test.go b/core/internal/features/ocr2/features_ocr2_test.go index 9a1a6d7537d..12c49b992bf 100644 --- a/core/internal/features/ocr2/features_ocr2_test.go +++ b/core/internal/features/ocr2/features_ocr2_test.go @@ -35,6 +35,7 @@ import ( ocrtypes2 "github.com/smartcontractkit/libocr/offchainreporting2plus/types" commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" + "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" @@ -314,7 +315,7 @@ fromBlock = %d var chainReaderSpec string if test.chainReaderAndCodec { chainReaderSpec = ` -chainReader = '{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0, "output_modifications":[{"type" : "epoch to time", "fields" : ["LatestTimestamp_"]},{"type":"rename","fields":{"LatestAnswer_":"LatestAnswer","LatestTimestamp_":"LatestTimestamp"}}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}' +chainReader = '{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0, "output_modifications":[{"type" : "epoch to time", "fields" : ["LatestTimestamp"]}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}' codec = '{"chainCodecConfig" :{"MedianReport":{"TypeAbi": "[{\"Name\": \"Timestamp\",\"Type\": \"uint32\"},{\"Name\": \"Observers\",\"Type\": \"bytes32\"},{\"Name\": \"Observations\",\"Type\": \"int192[]\"},{\"Name\": \"JuelsPerFeeCoin\",\"Type\": \"int192\"}]"}}}'` } ocrJob, err := validate.ValidatedOracleSpecToml(apps[i].Config.OCR2(), apps[i].Config.Insecure(), fmt.Sprintf(` diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 9b0e63283bc..d5ec9beeb53 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 @@ -244,7 +244,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240113162230-9b808fd915ee // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 8adb3b7db1d..9c401125a27 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1164,14 +1164,14 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960 h1:JIWro3+Kx83V5R6RBPwdPffcKDuYlI1stJqjNYJCeQA= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f h1:7904h45vNBT+IVO7PMcucvNXSIS9ilf2cxf+RMYb7zs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240113162230-9b808fd915ee h1:EC8tcNKx3f6qYln5WD+xVhzz60PKPH+sgrbjzAm3xcw= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240113162230-9b808fd915ee/go.mod h1:kXeFFq7kA+pmeG/A27wMi3geIRGn7G+r61v787ZyJtU= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 h1:eIwwTq9fvxt7z7JUZl06STwa5VrlYsZZbIjLhMeDD2k= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= diff --git a/core/services/relay/evm/binding.go b/core/services/relay/evm/binding.go index 32699516e18..e78d9f0a770 100644 --- a/core/services/relay/evm/binding.go +++ b/core/services/relay/evm/binding.go @@ -2,155 +2,14 @@ package evm import ( "context" - "fmt" - "strings" - - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" - - evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" - evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ) type readBinding interface { - GetLatestValue(ctx context.Context, params any) ([]byte, error) + GetLatestValue(ctx context.Context, params, returnVal any) error Bind(binding commontypes.BoundContract) error - SetCodec(codec commontypes.Codec) + SetCodec(codec commontypes.RemoteCodec) Register() error Unregister() error } - -type methodBinding struct { - address common.Address - contractName string - method string - client evmclient.Client - codec commontypes.Codec - bound bool -} - -var _ readBinding = &methodBinding{} - -func (m *methodBinding) SetCodec(codec commontypes.Codec) { - m.codec = codec -} - -func (m *methodBinding) Register() error { - return nil -} - -func (m *methodBinding) Unregister() error { - return nil -} - -func (m *methodBinding) GetLatestValue(ctx context.Context, params any) ([]byte, error) { - if !m.bound { - return nil, fmt.Errorf("%w: method not bound", commontypes.ErrInvalidType) - } - - data, err := m.codec.Encode(ctx, params, wrapItemType(m.contractName, m.method, true)) - if err != nil { - return nil, err - } - - callMsg := ethereum.CallMsg{ - To: &m.address, - From: m.address, - Data: data, - } - - return m.client.CallContract(ctx, callMsg, nil) -} - -func (m *methodBinding) Bind(binding commontypes.BoundContract) error { - m.address = common.HexToAddress(binding.Address) - m.bound = true - return nil -} - -type eventBinding struct { - address common.Address - contractName string - eventName string - lp logpoller.LogPoller - hash common.Hash - codec commontypes.Codec - pending bool - subscribed bool - bound bool -} - -func (e *eventBinding) SetCodec(codec commontypes.Codec) { - e.codec = codec -} - -func (e *eventBinding) Register() error { - e.subscribed = true - if !e.bound { - return nil - } - - if err := e.lp.RegisterFilter(logpoller.Filter{ - Name: wrapItemType(e.contractName, e.eventName, false), - EventSigs: evmtypes.HashArray{e.hash}, - Addresses: evmtypes.AddressArray{e.address}, - }); err != nil { - return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) - } - return nil -} - -func (e *eventBinding) Unregister() error { - e.subscribed = false - if !e.bound { - return nil - } - - if err := e.lp.UnregisterFilter(wrapItemType(e.contractName, e.eventName, false)); err != nil { - return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) - } - return nil -} - -var _ readBinding = &eventBinding{} - -func (e *eventBinding) GetLatestValue(_ context.Context, _ any) ([]byte, error) { - if !e.bound { - return nil, fmt.Errorf("%w: event not bound", commontypes.ErrInvalidType) - } - - confs := logpoller.Finalized - if e.pending { - confs = logpoller.Unconfirmed - } - log, err := e.lp.LatestLogByEventSigWithConfs(e.hash, e.address, confs) - if err != nil { - errStr := err.Error() - if strings.Contains(errStr, "not found") || strings.Contains(errStr, "no rows") { - return nil, fmt.Errorf("%w: %w", commontypes.ErrNotFound, err) - } - return nil, err - } - - return log.Data, nil -} - -func (e *eventBinding) Bind(binding commontypes.BoundContract) error { - wasSubscribed := e.subscribed - if wasSubscribed { - if err := e.Unregister(); err != nil { - return err - } - } - e.address = common.HexToAddress(binding.Address) - e.pending = binding.Pending - e.bound = true - - if wasSubscribed { - return e.Register() - } - return nil -} diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index db79a94e390..564cfeffbe4 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -3,9 +3,11 @@ package evm import ( "context" "fmt" + "reflect" "strings" "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/google/uuid" commonservices "github.com/smartcontractkit/chainlink-common/pkg/services" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" @@ -71,11 +73,7 @@ func (cr *chainReader) GetLatestValue(ctx context.Context, contractName, method return err } - bytes, err := b.GetLatestValue(ctx, params) - if err != nil { - return err - } - return cr.codec.Decode(ctx, bytes, returnVal, wrapItemType(contractName, method, false)) + return b.GetLatestValue(ctx, params, returnVal) } func (cr *chainReader) Bind(_ context.Context, bindings []commontypes.BoundContract) error { @@ -128,10 +126,10 @@ func (cr *chainReader) HealthReport() map[string]error { } func (cr *chainReader) CreateContractType(contractName, methodName string, forEncoding bool) (any, error) { - return cr.codec.CreateType(wrapItemType(contractName, methodName, forEncoding), forEncoding) + return cr.codec.CreateType(WrapItemType(contractName, methodName, forEncoding), forEncoding) } -func wrapItemType(contractName, methodName string, isParams bool) string { +func WrapItemType(contractName, methodName string, isParams bool) string { if isParams { return fmt.Sprintf("params.%s.%s", contractName, methodName) } @@ -148,6 +146,13 @@ func (cr *chainReader) addMethod( return fmt.Errorf("%w: method %s doesn't exist", commontypes.ErrInvalidConfig, chainReaderDefinition.ChainSpecificName) } + if len(chainReaderDefinition.EventInputFields) != 0 { + return fmt.Errorf( + "%w: method %s has event topic fields defined, but is not an event", + commontypes.ErrInvalidConfig, + chainReaderDefinition.ChainSpecificName) + } + cr.contractBindings.AddReadBinding(contractName, methodName, &methodBinding{ contractName: contractName, method: methodName, @@ -164,23 +169,57 @@ func (cr *chainReader) addMethod( func (cr *chainReader) addEvent(contractName, eventName string, a abi.ABI, chainReaderDefinition types.ChainReaderDefinition) error { event, eventExists := a.Events[chainReaderDefinition.ChainSpecificName] if !eventExists { - return fmt.Errorf("%w: method %s doesn't exist", commontypes.ErrInvalidConfig, chainReaderDefinition.ChainSpecificName) + return fmt.Errorf("%w: event %s doesn't exist", commontypes.ErrInvalidConfig, chainReaderDefinition.ChainSpecificName) } - cr.contractBindings.AddReadBinding(contractName, eventName, &eventBinding{ - lp: cr.lp, - hash: event.ID, - }) - // Though nothing is encoded encoderDef is required so that CreateType can return a struct{} for CreateType to allow "decoding" into. - // The caller isn't aware that there are no arguments and will try to encode the parameters. - // The "Arguments" must be empty so decoding is to struct{}, prefix doesn't matter, as this won't be encoded. - if err := cr.addEncoderDef(contractName, eventName, abi.Arguments{}, nil, chainReaderDefinition); err != nil { + filterArgs, topicInfo, indexArgNames := setupEventInput(event, chainReaderDefinition) + + if err := verifyEventInputsUsed(chainReaderDefinition, indexArgNames); err != nil { return err } + if err := topicInfo.Init(); err != nil { + return err + } + + // Encoder def's codec won't be used to encode, only for its type as input for GetLatestValue + if err := cr.addEncoderDef(contractName, eventName, filterArgs, nil, chainReaderDefinition); err != nil { + return err + } + + ce := cr.parsed.encoderDefs[WrapItemType(contractName, eventName, true)] + inMod, err := chainReaderDefinition.InputModifications.ToModifier(evmDecoderHooks...) + if err != nil { + return err + } + + if _, err = inMod.RetypeForOffChain(reflect.PointerTo(ce.checkedType), ""); err != nil { + return err + } + + cr.contractBindings.AddReadBinding(contractName, eventName, &eventBinding{ + contractName: contractName, + eventName: eventName, + lp: cr.lp, + hash: event.ID, + inputInfo: ce, + inputModifier: inMod, + topicInfo: topicInfo, + id: WrapItemType(contractName, eventName, false) + uuid.NewString(), + }) + return cr.addDecoderDef(contractName, eventName, event.Inputs, chainReaderDefinition) } +func verifyEventInputsUsed(chainReaderDefinition types.ChainReaderDefinition, indexArgNames map[string]bool) error { + for _, value := range chainReaderDefinition.EventInputFields { + if !indexArgNames[abi.ToCamelCase(value)] { + return fmt.Errorf("%w: %s is not an indexed argument of event %s", commontypes.ErrInvalidConfig, value, chainReaderDefinition.ChainSpecificName) + } + } + return nil +} + func (cr *chainReader) addEncoderDef(contractName, methodName string, args abi.Arguments, prefix []byte, chainReaderDefinition types.ChainReaderDefinition) error { // ABI.Pack prepends the method.ID to the encodings, we'll need the encoder to do the same. input := &codecEntry{Args: args, encodingPrefix: prefix} @@ -194,7 +233,7 @@ func (cr *chainReader) addEncoderDef(contractName, methodName string, args abi.A return err } input.mod = inputMod - cr.parsed.encoderDefs[wrapItemType(contractName, methodName, true)] = input + cr.parsed.encoderDefs[WrapItemType(contractName, methodName, true)] = input return nil } @@ -205,6 +244,39 @@ func (cr *chainReader) addDecoderDef(contractName, methodName string, outputs ab return err } output.mod = mod - cr.parsed.decoderDefs[wrapItemType(contractName, methodName, false)] = output + cr.parsed.decoderDefs[WrapItemType(contractName, methodName, false)] = output return output.Init() } + +func setupEventInput(event abi.Event, def types.ChainReaderDefinition) ([]abi.Argument, *codecEntry, map[string]bool) { + topicFieldDefs := map[string]bool{} + for _, value := range def.EventInputFields { + capFirstValue := abi.ToCamelCase(value) + topicFieldDefs[capFirstValue] = true + } + + filterArgs := make([]abi.Argument, 0, maxTopicFields) + info := &codecEntry{} + indexArgNames := map[string]bool{} + + for _, input := range event.Inputs { + if !input.Indexed { + continue + } + + filterWith := topicFieldDefs[abi.ToCamelCase(input.Name)] + if filterWith { + // When presenting the filter off-chain, + // the user will provide the unindexed version of the input + // Topics will be hashed if needed to determine what to look up + inputUnindexed := input + inputUnindexed.Indexed = false + filterArgs = append(filterArgs, inputUnindexed) + } + + info.Args = append(info.Args, input) + indexArgNames[abi.ToCamelCase(input.Name)] = true + } + + return filterArgs, info, indexArgNames +} diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index e762f909a1b..9457af90d28 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -2,11 +2,16 @@ package evm_test import ( "crypto/ecdsa" + "fmt" "math" "math/big" + "os" + "reflect" + "strconv" "testing" "time" + "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/common" @@ -15,6 +20,7 @@ import ( evmtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/smartcontractkit/libocr/commontypes" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-common/pkg/codec" @@ -35,12 +41,76 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) -const commonGasLimitOnEvms = uint64(4712388) +const ( + commonGasLimitOnEvms = uint64(4712388) + triggerWithDynamicTopic = "TriggeredEventWithDynamicTopic" + triggerWithAllTopics = "TriggeredWithFourTopics" +) func TestChainReader(t *testing.T) { t.Parallel() - RunChainReaderInterfaceTests(t, &chainReaderInterfaceTester{}) - RunChainReaderInterfaceTests(t, commontestutils.WrapChainReaderTesterForLoop(&chainReaderInterfaceTester{})) + it := &chainReaderInterfaceTester{} + RunChainReaderInterfaceTests(t, it) + RunChainReaderInterfaceTests(t, commontestutils.WrapChainReaderTesterForLoop(it)) + t.Run("Dynamically typed topics can be used to filter and have type correct in return", func(t *testing.T) { + it.Setup(t) + + anyString := "foo" + tx, err := it.evmTest.LatestValueHolderTransactor.TriggerEventWithDynamicTopic(it.auth, anyString) + require.NoError(t, err) + it.sim.Commit() + it.incNonce() + it.awaitTx(t, tx) + ctx := testutils.Context(t) + + cr := it.GetChainReader(t) + require.NoError(t, cr.Bind(ctx, it.GetBindings(t))) + + input := struct{ Field string }{Field: anyString} + tp := cr.(clcommontypes.ContractTypeProvider) + output, err := tp.CreateContractType(AnyContractName, triggerWithDynamicTopic, false) + require.NoError(t, err) + rOutput := reflect.Indirect(reflect.ValueOf(output)) + + require.Eventually(t, func() bool { + return cr.GetLatestValue(ctx, AnyContractName, triggerWithDynamicTopic, input, output) == nil + }, it.MaxWaitTimeForEvents(), time.Millisecond*10) + + assert.Equal(t, anyString, rOutput.FieldByName("Field").Interface()) + topic, err := abi.MakeTopics([]any{anyString}) + require.NoError(t, err) + assert.Equal(t, topic[0][0], rOutput.FieldByName("FieldHash").Interface()) + }) + + t.Run("Multiple topics can filter together", func(t *testing.T) { + it.Setup(t) + triggerFourTopics(t, it, int32(1), int32(2), int32(3)) + triggerFourTopics(t, it, int32(2), int32(2), int32(3)) + triggerFourTopics(t, it, int32(1), int32(3), int32(3)) + triggerFourTopics(t, it, int32(1), int32(2), int32(4)) + + ctx := testutils.Context(t) + cr := it.GetChainReader(t) + require.NoError(t, cr.Bind(ctx, it.GetBindings(t))) + var latest struct{ Field1, Field2, Field3 int32 } + params := struct{ Field1, Field2, Field3 int32 }{Field1: 1, Field2: 2, Field3: 3} + + time.Sleep(it.MaxWaitTimeForEvents()) + + require.NoError(t, cr.GetLatestValue(ctx, AnyContractName, triggerWithAllTopics, params, &latest)) + assert.Equal(t, int32(1), latest.Field1) + assert.Equal(t, int32(2), latest.Field2) + assert.Equal(t, int32(3), latest.Field3) + }) +} + +func triggerFourTopics(t *testing.T, it *chainReaderInterfaceTester, i1, i2, i3 int32) { + tx, err := it.evmTest.LatestValueHolderTransactor.TriggerWithFourTopics(it.auth, i1, i2, i3) + require.NoError(t, err) + require.NoError(t, err) + it.sim.Commit() + it.incNonce() + it.awaitTx(t, tx) } type chainReaderInterfaceTester struct { @@ -55,6 +125,21 @@ type chainReaderInterfaceTester struct { cr evm.ChainReaderService } +func (it *chainReaderInterfaceTester) MaxWaitTimeForEvents() time.Duration { + // From trial and error, when running on CI, sometimes the boxes get slow + maxWaitTime := time.Second * 20 + maxWaitTimeStr, ok := os.LookupEnv("MAX_WAIT_TIME_FOR_EVENTS_S") + if ok { + wiatS, err := strconv.ParseInt(maxWaitTimeStr, 10, 64) + if err != nil { + fmt.Printf("Error parsing MAX_WAIT_TIME_FOR_EVENTS_S: %v, defaulting to %v\n", err, maxWaitTime) + } + maxWaitTime = time.Second * time.Duration(wiatS) + } + + return maxWaitTime +} + func (it *chainReaderInterfaceTester) Setup(t *testing.T) { t.Cleanup(func() { // DB may be closed by the test already, ignore errors @@ -95,6 +180,24 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { ChainSpecificName: "Triggered", ReadType: types.Event, }, + EventWithFilterName: { + ChainSpecificName: "Triggered", + ReadType: types.Event, + EventInputFields: []string{"Field"}, + }, + triggerWithDynamicTopic: { + ChainSpecificName: triggerWithDynamicTopic, + ReadType: types.Event, + EventInputFields: []string{"fieldHash"}, + InputModifications: codec.ModifiersConfig{ + &codec.RenameModifierConfig{Fields: map[string]string{"FieldHash": "Field"}}, + }, + }, + triggerWithAllTopics: { + ChainSpecificName: triggerWithAllTopics, + ReadType: types.Event, + EventInputFields: []string{"Field1", "Field2", "Field3"}, + }, MethodReturningSeenStruct: { ChainSpecificName: "ReturnSeen", InputModifications: codec.ModifiersConfig{ diff --git a/core/services/relay/evm/codec.go b/core/services/relay/evm/codec.go index 8d146cc8616..8655831a588 100644 --- a/core/services/relay/evm/codec.go +++ b/core/services/relay/evm/codec.go @@ -27,6 +27,13 @@ import ( // it was a *big.Int var evmDecoderHooks = []mapstructure.DecodeHookFunc{decodeAccountHook, codec.BigIntHook, codec.SliceToArrayVerifySizeHook, sizeVerifyBigIntHook} +// NewCodec creates a new [commontypes.RemoteCodec] for EVM. +// Note that names in the ABI are converted to Go names using [abi.ToCamelCase], +// this is per convention in [abi.MakeTopics], [abi.Arguments.Pack] etc. +// This allows names on-chain to be in go convention when generated. +// It means that if you need to use a [codec.Modifier] to reference a field +// you need to use the Go name instead of the name on-chain. +// eg: rename FooBar -> Bar, not foo_bar_ to Bar if the name on-chain is foo_bar_ func NewCodec(conf types.CodecConfig) (commontypes.RemoteCodec, error) { parsed := &parsedTypes{ encoderDefs: map[string]*codecEntry{}, diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go index 0f333812409..c77b0230e3f 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/codec_entry.go @@ -3,9 +3,9 @@ package evm import ( "fmt" "reflect" - "strings" "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/chainlink-common/pkg/codec" @@ -33,7 +33,7 @@ func (entry *codecEntry) Init() error { checked := make([]reflect.StructField, argLen) if len(args) == 1 && args[0].Name == "" { - nativeArg, checkedArg, err := getNativeAndCheckedTypes(&args[0].Type) + nativeArg, checkedArg, err := getNativeAndCheckedTypesForArg(&args[0]) if err != nil { return err } @@ -42,10 +42,18 @@ func (entry *codecEntry) Init() error { return nil } + numIndecies := 0 seenNames := map[string]bool{} for i, arg := range args { - tmp := arg.Type - nativeArg, checkedArg, err := getNativeAndCheckedTypes(&tmp) + if arg.Indexed { + if numIndecies == 3 { + return fmt.Errorf("%w: too many indexed arguments", commontypes.ErrInvalidConfig) + } + numIndecies++ + } + + tmp := arg + nativeArg, checkedArg, err := getNativeAndCheckedTypesForArg(&tmp) if err != nil { return err } @@ -53,11 +61,11 @@ func (entry *codecEntry) Init() error { return fmt.Errorf("%w: empty field names are not supported for multiple returns", commontypes.ErrInvalidType) } - name := strings.ToUpper(arg.Name[:1]) + arg.Name[1:] + // To match decoding in abi + name := abi.ToCamelCase(arg.Name) if seenNames[name] { - return fmt.Errorf("%w: duplicate field name %s, first letter casing is ignored", commontypes.ErrInvalidType, name) + return fmt.Errorf("%w: duplicate field name %s, after ToCamelCase", commontypes.ErrInvalidConfig, name) } - seenNames[name] = true native[i] = reflect.StructField{Name: name, Type: nativeArg} checked[i] = reflect.StructField{Name: name, Type: checkedArg} @@ -96,6 +104,28 @@ func UnwrapArgs(args abi.Arguments) abi.Arguments { return args } +func getNativeAndCheckedTypesForArg(arg *abi.Argument) (reflect.Type, reflect.Type, error) { + tmp := arg.Type + if arg.Indexed { + switch arg.Type.T { + case abi.StringTy: + return reflect.TypeOf(common.Hash{}), reflect.TypeOf(common.Hash{}), nil + case abi.ArrayTy: + u8, _ := types.GetAbiEncodingType("uint8") + if arg.Type.Elem.GetType() == u8.Native { + return reflect.TypeOf(common.Hash{}), reflect.TypeOf(common.Hash{}), nil + } + fallthrough + case abi.SliceTy, abi.TupleTy, abi.FixedBytesTy, abi.FixedPointTy, abi.FunctionTy: + // https://github.com/ethereum/go-ethereum/blob/release/1.12/accounts/abi/topics.go#L78 + return nil, nil, fmt.Errorf("%w: unsupported indexed type: %v", commontypes.ErrInvalidConfig, arg.Type) + default: + } + } + + return getNativeAndCheckedTypes(&tmp) +} + func getNativeAndCheckedTypes(curType *abi.Type) (reflect.Type, reflect.Type, error) { converter := func(t reflect.Type) reflect.Type { return t } for curType.Elem != nil { diff --git a/core/services/relay/evm/codec_entry_test.go b/core/services/relay/evm/codec_entry_test.go index 986ee408143..62a6bf25368 100644 --- a/core/services/relay/evm/codec_entry_test.go +++ b/core/services/relay/evm/codec_entry_test.go @@ -1,12 +1,12 @@ package evm import ( - "fmt" "math/big" "reflect" "testing" "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -150,7 +150,6 @@ func TestCodecEntry(t *testing.T) { address, err := abi.NewType("address", "", []abi.ArgumentMarshaling{}) require.NoError(t, err) entry := codecEntry{Args: abi.Arguments{{Name: "foo", Type: address}}} - fmt.Printf("%+v\n", address.GetType()) require.NoError(t, entry.Init()) }) @@ -161,10 +160,60 @@ func TestCodecEntry(t *testing.T) { assert.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidType)) }) - t.Run("Invalid parameters are not supported", func(t *testing.T) { + t.Run("Multiple abi arguments with the same name returns an error", func(t *testing.T) { anyType, err := abi.NewType("int16[3]", "", []abi.ArgumentMarshaling{}) require.NoError(t, err) entry := codecEntry{Args: abi.Arguments{{Name: "Name", Type: anyType}, {Name: "Name", Type: anyType}}} - assert.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidType)) + assert.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidConfig)) + }) + + t.Run("Indexed basic types leave their native and checked types as-is", func(t *testing.T) { + anyType, err := abi.NewType("int16", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := codecEntry{Args: abi.Arguments{{Name: "Name", Type: anyType, Indexed: true}}} + require.NoError(t, entry.Init()) + nativeField, ok := entry.nativeType.FieldByName("Name") + require.True(t, ok) + assert.Equal(t, reflect.TypeOf(int16(0)), nativeField.Type) + checkedField, ok := entry.checkedType.FieldByName("Name") + require.True(t, ok) + assert.Equal(t, reflect.TypeOf(int16(0)), checkedField.Type) + }) + + t.Run("Indexed non basic types change to hash", func(t *testing.T) { + anyType, err := abi.NewType("string", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := codecEntry{Args: abi.Arguments{{Name: "Name", Type: anyType, Indexed: true}}} + require.NoError(t, entry.Init()) + nativeField, ok := entry.nativeType.FieldByName("Name") + require.True(t, ok) + assert.Equal(t, reflect.TypeOf(common.Hash{}), nativeField.Type) + checkedField, ok := entry.checkedType.FieldByName("Name") + require.True(t, ok) + assert.Equal(t, reflect.TypeOf(common.Hash{}), checkedField.Type) + }) + + t.Run("Too many indexed items returns an error", func(t *testing.T) { + anyType, err := abi.NewType("int16", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := codecEntry{ + Args: abi.Arguments{ + {Name: "Name1", Type: anyType, Indexed: true}, + {Name: "Name2", Type: anyType, Indexed: true}, + {Name: "Name3", Type: anyType, Indexed: true}, + {Name: "Name4", Type: anyType, Indexed: true}, + }, + } + require.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidConfig)) + }) + + // TODO: when the TODO on + // https://github.com/ethereum/go-ethereum/blob/release/1.12/accounts/abi/topics.go#L78 + // is removed, remove this test. + t.Run("Using unsupported types by go-ethereum returns an error", func(t *testing.T) { + anyType, err := abi.NewType("int256[2]", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := codecEntry{Args: abi.Arguments{{Name: "Name", Type: anyType, Indexed: true}}} + assert.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidConfig)) }) } diff --git a/core/services/relay/evm/decoder.go b/core/services/relay/evm/decoder.go index b6547c08618..1520afa0fd9 100644 --- a/core/services/relay/evm/decoder.go +++ b/core/services/relay/evm/decoder.go @@ -91,6 +91,5 @@ func mapstructureDecode(src, dest any) error { if err = mDecoder.Decode(src); err != nil { return fmt.Errorf("%w: %w", commontypes.ErrInvalidType, err) } - return nil } diff --git a/core/services/relay/evm/encoder.go b/core/services/relay/evm/encoder.go index 5672ffab5bf..7af0d7f7bce 100644 --- a/core/services/relay/evm/encoder.go +++ b/core/services/relay/evm/encoder.go @@ -46,15 +46,23 @@ func encode(item reflect.Value, info *codecEntry) ([]byte, error) { } switch item.Kind() { case reflect.Array, reflect.Slice: - return encodeArray(item, info) + native, err := representArray(item, info) + if err != nil { + return nil, err + } + return pack(info, native) case reflect.Struct, reflect.Map: - return encodeItem(item, info) + values, err := unrollItem(item, info) + if err != nil { + return nil, err + } + return pack(info, values...) default: return nil, fmt.Errorf("%w: cannot encode kind %v", commontypes.ErrInvalidType, item.Kind()) } } -func encodeArray(item reflect.Value, info *codecEntry) ([]byte, error) { +func representArray(item reflect.Value, info *codecEntry) (any, error) { length := item.Len() var native reflect.Value switch info.checkedType.Kind() { @@ -78,11 +86,10 @@ func encodeArray(item reflect.Value, info *codecEntry) ([]byte, error) { } native.Index(i).Set(reflect.NewAt(nativeElm, tmp.UnsafePointer()).Elem()) } - - return pack(info, native.Interface()) + return native.Interface(), nil } -func encodeItem(item reflect.Value, info *codecEntry) ([]byte, error) { +func unrollItem(item reflect.Value, info *codecEntry) ([]any, error) { if item.Type() == reflect.PointerTo(info.checkedType) { item = reflect.NewAt(info.nativeType, item.UnsafePointer()) } else if item.Type() != reflect.PointerTo(info.nativeType) { @@ -102,8 +109,7 @@ func encodeItem(item reflect.Value, info *codecEntry) ([]byte, error) { values[i] = item.Field(i).Interface() } } - - return pack(info, values...) + return values, nil } func pack(info *codecEntry, values ...any) ([]byte, error) { diff --git a/core/services/relay/evm/event_binding.go b/core/services/relay/evm/event_binding.go new file mode 100644 index 00000000000..5b4b237acee --- /dev/null +++ b/core/services/relay/evm/event_binding.go @@ -0,0 +1,270 @@ +package evm + +import ( + "context" + "fmt" + "reflect" + "strings" + "sync" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + + "github.com/smartcontractkit/chainlink-common/pkg/codec" + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" +) + +// Max four topics on EVM, the first topic is always the event signature, so 3 topics left for fields +const maxTopicFields = 3 + +type eventBinding struct { + address common.Address + contractName string + eventName string + lp logpoller.LogPoller + hash common.Hash + codec commontypes.RemoteCodec + pending bool + bound bool + registerCalled bool + lock sync.Mutex + inputInfo *codecEntry + inputModifier codec.Modifier + topicInfo *codecEntry + // used to allow Register and Unregister to be unique in case two bindings have the same event. + // otherwise, if one unregisters, it'll unregister both with the LogPoller. + id string +} + +var _ readBinding = &eventBinding{} + +func (e *eventBinding) SetCodec(codec commontypes.RemoteCodec) { + e.codec = codec +} + +func (e *eventBinding) Register() error { + e.lock.Lock() + defer e.lock.Unlock() + + e.registerCalled = true + if !e.bound || e.lp.HasFilter(e.id) { + return nil + } + + if err := e.lp.RegisterFilter(logpoller.Filter{ + Name: e.id, + EventSigs: evmtypes.HashArray{e.hash}, + Addresses: evmtypes.AddressArray{e.address}, + }); err != nil { + return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) + } + return nil +} + +func (e *eventBinding) Unregister() error { + e.lock.Lock() + defer e.lock.Unlock() + + if !e.lp.HasFilter(e.id) { + return nil + } + + if err := e.lp.UnregisterFilter(e.id); err != nil { + return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) + } + return nil +} + +func (e *eventBinding) GetLatestValue(ctx context.Context, params, into any) error { + if !e.bound { + return fmt.Errorf("%w: event not bound", commontypes.ErrInvalidType) + } + + confs := logpoller.Finalized + if e.pending { + confs = logpoller.Unconfirmed + } + + if len(e.inputInfo.Args) == 0 { + return e.getLatestValueWithoutFilters(ctx, confs, into) + } + + return e.getLatestValueWithFilters(ctx, confs, params, into) +} + +func (e *eventBinding) Bind(binding commontypes.BoundContract) error { + if err := e.Unregister(); err != nil { + return err + } + + e.address = common.HexToAddress(binding.Address) + e.pending = binding.Pending + e.bound = true + + if e.registerCalled { + return e.Register() + } + return nil +} + +func (e *eventBinding) getLatestValueWithoutFilters(ctx context.Context, confs logpoller.Confirmations, into any) error { + log, err := e.lp.LatestLogByEventSigWithConfs(e.hash, e.address, confs) + if err = wrapInternalErr(err); err != nil { + return err + } + + return e.decodeLog(ctx, log, into) +} + +func (e *eventBinding) getLatestValueWithFilters( + ctx context.Context, confs logpoller.Confirmations, params, into any) error { + offChain, err := e.convertToOffChainType(params) + if err != nil { + return err + } + + checkedParams, err := e.inputModifier.TransformForOnChain(offChain, "" /* unused */) + if err != nil { + return err + } + + nativeParams := reflect.NewAt(e.inputInfo.nativeType, reflect.ValueOf(checkedParams).UnsafePointer()) + filtersAndIndices, err := e.encodeParams(nativeParams) + if err != nil { + return err + } + + fai := filtersAndIndices[0] + remainingFilters := filtersAndIndices[1:] + + logs, err := e.lp.IndexedLogs(e.hash, e.address, 1, []common.Hash{fai}, confs) + if err != nil { + return wrapInternalErr(err) + } + + // TODO: there should be a better way to ask log poller to filter these + // First, you should be able to ask for as many topics to match + // Second, you should be able to get the latest only + var logToUse *logpoller.Log + for _, log := range logs { + tmp := log + if compareLogs(&tmp, logToUse) > 0 && matchesRemainingFilters(&tmp, remainingFilters) { + // copy so that it's not pointing to the changing variable + logToUse = &tmp + } + } + + if logToUse == nil { + return fmt.Errorf("%w: no events found", commontypes.ErrNotFound) + } + + return e.decodeLog(ctx, logToUse, into) +} + +func (e *eventBinding) convertToOffChainType(params any) (any, error) { + itemType := WrapItemType(e.contractName, e.eventName, true) + offChain, err := e.codec.CreateType(itemType, true) + if err != nil { + return nil, err + } + + if err = mapstructureDecode(params, offChain); err != nil { + return nil, err + } + + return offChain, nil +} + +func compareLogs(log, use *logpoller.Log) int64 { + if use == nil { + return 1 + } + + if log.BlockNumber != use.BlockNumber { + return log.BlockNumber - use.BlockNumber + } + + return log.LogIndex - use.LogIndex +} + +func matchesRemainingFilters(log *logpoller.Log, filters []common.Hash) bool { + for i, rfai := range filters { + if !reflect.DeepEqual(rfai[:], log.Topics[i+2]) { + return false + } + } + + return true +} + +func (e *eventBinding) encodeParams(item reflect.Value) ([]common.Hash, error) { + for item.Kind() == reflect.Pointer { + item = reflect.Indirect(item) + } + + var topics []any + switch item.Kind() { + case reflect.Array, reflect.Slice: + native, err := representArray(item, e.inputInfo) + if err != nil { + return nil, err + } + topics = []any{native} + case reflect.Struct, reflect.Map: + var err error + if topics, err = unrollItem(item, e.inputInfo); err != nil { + return nil, err + } + default: + return nil, fmt.Errorf("%w: cannot encode kind %v", commontypes.ErrInvalidType, item.Kind()) + } + + hashes, err := abi.MakeTopics(topics) + if err != nil { + return nil, wrapInternalErr(err) + } + + if len(hashes) != 1 { + return nil, fmt.Errorf("%w: expected 1 filter set, got %d", commontypes.ErrInternal, len(hashes)) + } + + return hashes[0], nil +} + +func (e *eventBinding) decodeLog(ctx context.Context, log *logpoller.Log, into any) error { + dataType := WrapItemType(e.contractName, e.eventName, false) + if err := e.codec.Decode(ctx, log.Data, into, dataType); err != nil { + return err + } + + topics := make([]common.Hash, len(e.topicInfo.Args)) + if len(log.Topics) < len(topics)+1 { + return fmt.Errorf("%w: not enough topics to decode", commontypes.ErrInvalidType) + } + + for i := 0; i < len(topics); i++ { + topics[i] = common.Hash(log.Topics[i+1]) + } + + topicsInto := reflect.New(e.topicInfo.nativeType).Interface() + if err := abi.ParseTopics(topicsInto, e.topicInfo.Args, topics); err != nil { + return fmt.Errorf("%w: %w", commontypes.ErrInvalidType, err) + } + + return mapstructureDecode(topicsInto, into) +} + +func wrapInternalErr(err error) error { + if err == nil { + return nil + } + + errStr := err.Error() + if strings.Contains(errStr, "not found") || strings.Contains(errStr, "no rows") { + return fmt.Errorf("%w: %w", commontypes.ErrNotFound, err) + } + return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) +} diff --git a/core/services/relay/evm/method_binding.go b/core/services/relay/evm/method_binding.go new file mode 100644 index 00000000000..149c176ad4a --- /dev/null +++ b/core/services/relay/evm/method_binding.go @@ -0,0 +1,66 @@ +package evm + +import ( + "context" + "fmt" + + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/common" + + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + + evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" +) + +type methodBinding struct { + address common.Address + contractName string + method string + client evmclient.Client + codec commontypes.Codec + bound bool +} + +var _ readBinding = &methodBinding{} + +func (m *methodBinding) SetCodec(codec commontypes.RemoteCodec) { + m.codec = codec +} + +func (m *methodBinding) Register() error { + return nil +} + +func (m *methodBinding) Unregister() error { + return nil +} + +func (m *methodBinding) GetLatestValue(ctx context.Context, params, returnValue any) error { + if !m.bound { + return fmt.Errorf("%w: method not bound", commontypes.ErrInvalidType) + } + + data, err := m.codec.Encode(ctx, params, WrapItemType(m.contractName, m.method, true)) + if err != nil { + return err + } + + callMsg := ethereum.CallMsg{ + To: &m.address, + From: m.address, + Data: data, + } + + bytes, err := m.client.CallContract(ctx, callMsg, nil) + if err != nil { + return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) + } + + return m.codec.Decode(ctx, bytes, returnValue, WrapItemType(m.contractName, m.method, false)) +} + +func (m *methodBinding) Bind(binding commontypes.BoundContract) error { + m.address = common.HexToAddress(binding.Address) + m.bound = true + return nil +} diff --git a/core/services/relay/evm/types/types.go b/core/services/relay/evm/types/types.go index e0ab8e5c9ef..aca0fcedb47 100644 --- a/core/services/relay/evm/types/types.go +++ b/core/services/relay/evm/types/types.go @@ -45,6 +45,9 @@ type ChainReaderDefinition struct { ReadType `json:"readType"` InputModifications codec.ModifiersConfig `json:"input_modifications"` OutputModifications codec.ModifiersConfig `json:"output_modifications"` + + // EventInputFields allows you to choose which indexed fields are expected from the input + EventInputFields []string `json:"eventInputFields"` } type ReadType int64 diff --git a/go.mod b/go.mod index 3149d93dfd5..bb7b5147c04 100644 --- a/go.mod +++ b/go.mod @@ -65,10 +65,10 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240113162230-9b808fd915ee + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 diff --git a/go.sum b/go.sum index e55a4b79056..a9e955eb503 100644 --- a/go.sum +++ b/go.sum @@ -1150,14 +1150,14 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960 h1:JIWro3+Kx83V5R6RBPwdPffcKDuYlI1stJqjNYJCeQA= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f h1:7904h45vNBT+IVO7PMcucvNXSIS9ilf2cxf+RMYb7zs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240113162230-9b808fd915ee h1:EC8tcNKx3f6qYln5WD+xVhzz60PKPH+sgrbjzAm3xcw= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240113162230-9b808fd915ee/go.mod h1:kXeFFq7kA+pmeG/A27wMi3geIRGn7G+r61v787ZyJtU= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 h1:eIwwTq9fvxt7z7JUZl06STwa5VrlYsZZbIjLhMeDD2k= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= diff --git a/integration-tests/actions/ocr2_helpers_local.go b/integration-tests/actions/ocr2_helpers_local.go index 9d905b7430d..4b5c274b12d 100644 --- a/integration-tests/actions/ocr2_helpers_local.go +++ b/integration-tests/actions/ocr2_helpers_local.go @@ -127,7 +127,7 @@ func CreateOCRv2JobsLocal( }, } if enableChainReaderAndCodec { - ocrSpec.OCR2OracleSpec.RelayConfig["chainReader"] = `{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0,"output_modifications":[{"type" : "epoch to time", "fields" : ["LatestTimestamp_"]},{"type":"rename","fields":{"LatestAnswer_":"LatestAnswer","LatestTimestamp_":"LatestTimestamp"}}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}` + ocrSpec.OCR2OracleSpec.RelayConfig["chainReader"] = `{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0, "output_modifications":[{"type" : "epoch to time", "fields" : ["LatestTimestamp"]}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}` ocrSpec.OCR2OracleSpec.RelayConfig["codec"] = `{"chainCodecConfig" :{"MedianReport":{"TypeAbi": "[{\"Name\": \"Timestamp\",\"Type\": \"uint32\"},{\"Name\": \"Observers\",\"Type\": \"bytes32\"},{\"Name\": \"Observations\",\"Type\": \"int192[]\"},{\"Name\": \"JuelsPerFeeCoin\",\"Type\": \"int192\"}]"}}}` } diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 7e1f976dada..e85c4569e1a 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -25,7 +25,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f github.com/smartcontractkit/chainlink-testing-framework v1.22.1 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 @@ -363,7 +363,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240113162230-9b808fd915ee // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index fa8fa20da0b..63a8c1de756 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1481,14 +1481,14 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960 h1:JIWro3+Kx83V5R6RBPwdPffcKDuYlI1stJqjNYJCeQA= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240114201223-0d13e4669960/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f h1:7904h45vNBT+IVO7PMcucvNXSIS9ilf2cxf+RMYb7zs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240113162230-9b808fd915ee h1:EC8tcNKx3f6qYln5WD+xVhzz60PKPH+sgrbjzAm3xcw= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240113162230-9b808fd915ee/go.mod h1:kXeFFq7kA+pmeG/A27wMi3geIRGn7G+r61v787ZyJtU= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 h1:eIwwTq9fvxt7z7JUZl06STwa5VrlYsZZbIjLhMeDD2k= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1/go.mod h1:L2b9/3wYVUqPAeKG/SLG/T0VsMOJtg+ygw8vTmRDMGE= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= From 5ed314c173111485ff7b9514ae93d68d21ad688a Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Mon, 15 Jan 2024 10:47:02 -0500 Subject: [PATCH 086/112] PR feedback, fix typo, clear up comment, revert making a function public --- core/services/relay/evm/chain_reader.go | 16 ++++++++-------- core/services/relay/evm/codec_entry.go | 6 +++--- core/services/relay/evm/event_binding.go | 4 ++-- core/services/relay/evm/method_binding.go | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index 564cfeffbe4..92640069a83 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -126,10 +126,10 @@ func (cr *chainReader) HealthReport() map[string]error { } func (cr *chainReader) CreateContractType(contractName, methodName string, forEncoding bool) (any, error) { - return cr.codec.CreateType(WrapItemType(contractName, methodName, forEncoding), forEncoding) + return cr.codec.CreateType(wrapItemType(contractName, methodName, forEncoding), forEncoding) } -func WrapItemType(contractName, methodName string, isParams bool) string { +func wrapItemType(contractName, methodName string, isParams bool) string { if isParams { return fmt.Sprintf("params.%s.%s", contractName, methodName) } @@ -187,7 +187,7 @@ func (cr *chainReader) addEvent(contractName, eventName string, a abi.ABI, chain return err } - ce := cr.parsed.encoderDefs[WrapItemType(contractName, eventName, true)] + ce := cr.parsed.encoderDefs[wrapItemType(contractName, eventName, true)] inMod, err := chainReaderDefinition.InputModifications.ToModifier(evmDecoderHooks...) if err != nil { return err @@ -205,7 +205,7 @@ func (cr *chainReader) addEvent(contractName, eventName string, a abi.ABI, chain inputInfo: ce, inputModifier: inMod, topicInfo: topicInfo, - id: WrapItemType(contractName, eventName, false) + uuid.NewString(), + id: wrapItemType(contractName, eventName, false) + uuid.NewString(), }) return cr.addDecoderDef(contractName, eventName, event.Inputs, chainReaderDefinition) @@ -233,7 +233,7 @@ func (cr *chainReader) addEncoderDef(contractName, methodName string, args abi.A return err } input.mod = inputMod - cr.parsed.encoderDefs[WrapItemType(contractName, methodName, true)] = input + cr.parsed.encoderDefs[wrapItemType(contractName, methodName, true)] = input return nil } @@ -244,7 +244,7 @@ func (cr *chainReader) addDecoderDef(contractName, methodName string, outputs ab return err } output.mod = mod - cr.parsed.decoderDefs[WrapItemType(contractName, methodName, false)] = output + cr.parsed.decoderDefs[wrapItemType(contractName, methodName, false)] = output return output.Init() } @@ -267,8 +267,8 @@ func setupEventInput(event abi.Event, def types.ChainReaderDefinition) ([]abi.Ar filterWith := topicFieldDefs[abi.ToCamelCase(input.Name)] if filterWith { // When presenting the filter off-chain, - // the user will provide the unindexed version of the input - // Topics will be hashed if needed to determine what to look up + // the user will provide the unhashed version of the input + // The reader will hash topics if needed. inputUnindexed := input inputUnindexed.Indexed = false filterArgs = append(filterArgs, inputUnindexed) diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go index c77b0230e3f..3e1b76597b3 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/codec_entry.go @@ -42,14 +42,14 @@ func (entry *codecEntry) Init() error { return nil } - numIndecies := 0 + numIndices := 0 seenNames := map[string]bool{} for i, arg := range args { if arg.Indexed { - if numIndecies == 3 { + if numIndices == maxTopicFields { return fmt.Errorf("%w: too many indexed arguments", commontypes.ErrInvalidConfig) } - numIndecies++ + numIndices++ } tmp := arg diff --git a/core/services/relay/evm/event_binding.go b/core/services/relay/evm/event_binding.go index 5b4b237acee..5be320f4d31 100644 --- a/core/services/relay/evm/event_binding.go +++ b/core/services/relay/evm/event_binding.go @@ -165,7 +165,7 @@ func (e *eventBinding) getLatestValueWithFilters( } func (e *eventBinding) convertToOffChainType(params any) (any, error) { - itemType := WrapItemType(e.contractName, e.eventName, true) + itemType := wrapItemType(e.contractName, e.eventName, true) offChain, err := e.codec.CreateType(itemType, true) if err != nil { return nil, err @@ -235,7 +235,7 @@ func (e *eventBinding) encodeParams(item reflect.Value) ([]common.Hash, error) { } func (e *eventBinding) decodeLog(ctx context.Context, log *logpoller.Log, into any) error { - dataType := WrapItemType(e.contractName, e.eventName, false) + dataType := wrapItemType(e.contractName, e.eventName, false) if err := e.codec.Decode(ctx, log.Data, into, dataType); err != nil { return err } diff --git a/core/services/relay/evm/method_binding.go b/core/services/relay/evm/method_binding.go index 149c176ad4a..c5e10cce1c1 100644 --- a/core/services/relay/evm/method_binding.go +++ b/core/services/relay/evm/method_binding.go @@ -40,7 +40,7 @@ func (m *methodBinding) GetLatestValue(ctx context.Context, params, returnValue return fmt.Errorf("%w: method not bound", commontypes.ErrInvalidType) } - data, err := m.codec.Encode(ctx, params, WrapItemType(m.contractName, m.method, true)) + data, err := m.codec.Encode(ctx, params, wrapItemType(m.contractName, m.method, true)) if err != nil { return err } @@ -56,7 +56,7 @@ func (m *methodBinding) GetLatestValue(ctx context.Context, params, returnValue return fmt.Errorf("%w: %w", commontypes.ErrInternal, err) } - return m.codec.Decode(ctx, bytes, returnValue, WrapItemType(m.contractName, m.method, false)) + return m.codec.Decode(ctx, bytes, returnValue, wrapItemType(m.contractName, m.method, false)) } func (m *methodBinding) Bind(binding commontypes.BoundContract) error { From cb473e03b00e973dcd2c14227aaacf84ef8b6434 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Mon, 15 Jan 2024 11:18:25 -0500 Subject: [PATCH 087/112] Refactored function for getting event input. --- core/services/relay/evm/chain_reader.go | 29 +++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index 92640069a83..d72dbb7de01 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" "github.com/google/uuid" + "github.com/smartcontractkit/chainlink-common/pkg/codec" commonservices "github.com/smartcontractkit/chainlink-common/pkg/services" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" @@ -173,7 +174,6 @@ func (cr *chainReader) addEvent(contractName, eventName string, a abi.ABI, chain } filterArgs, topicInfo, indexArgNames := setupEventInput(event, chainReaderDefinition) - if err := verifyEventInputsUsed(chainReaderDefinition, indexArgNames); err != nil { return err } @@ -187,23 +187,18 @@ func (cr *chainReader) addEvent(contractName, eventName string, a abi.ABI, chain return err } - ce := cr.parsed.encoderDefs[wrapItemType(contractName, eventName, true)] - inMod, err := chainReaderDefinition.InputModifications.ToModifier(evmDecoderHooks...) + inputInfo, inputModifier, err := cr.getEventInput(chainReaderDefinition, contractName, eventName) if err != nil { return err } - if _, err = inMod.RetypeForOffChain(reflect.PointerTo(ce.checkedType), ""); err != nil { - return err - } - cr.contractBindings.AddReadBinding(contractName, eventName, &eventBinding{ contractName: contractName, eventName: eventName, lp: cr.lp, hash: event.ID, - inputInfo: ce, - inputModifier: inMod, + inputInfo: inputInfo, + inputModifier: inputModifier, topicInfo: topicInfo, id: wrapItemType(contractName, eventName, false) + uuid.NewString(), }) @@ -211,6 +206,22 @@ func (cr *chainReader) addEvent(contractName, eventName string, a abi.ABI, chain return cr.addDecoderDef(contractName, eventName, event.Inputs, chainReaderDefinition) } +func (cr *chainReader) getEventInput(def types.ChainReaderDefinition, contractName, eventName string) ( + *codecEntry, codec.Modifier, error) { + inputInfo := cr.parsed.encoderDefs[wrapItemType(contractName, eventName, true)] + inMod, err := def.InputModifications.ToModifier(evmDecoderHooks...) + if err != nil { + return nil, nil, err + } + + // initialize the modification + if _, err = inMod.RetypeForOffChain(reflect.PointerTo(inputInfo.checkedType), ""); err != nil { + return nil, nil, err + } + + return inputInfo, inMod, nil +} + func verifyEventInputsUsed(chainReaderDefinition types.ChainReaderDefinition, indexArgNames map[string]bool) error { for _, value := range chainReaderDefinition.EventInputFields { if !indexArgNames[abi.ToCamelCase(value)] { From 8ee5f12c914cdf5747f4d22d1f520308d39ce10f Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Mon, 15 Jan 2024 13:08:11 -0500 Subject: [PATCH 088/112] --fix and add comments --- core/services/relay/evm/chain_reader.go | 1 + core/services/relay/evm/codec_entry.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index d72dbb7de01..b8e7f20cc21 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" "github.com/google/uuid" + "github.com/smartcontractkit/chainlink-common/pkg/codec" commonservices "github.com/smartcontractkit/chainlink-common/pkg/services" diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go index 3e1b76597b3..bfefa0b8842 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/codec_entry.go @@ -32,6 +32,11 @@ func (entry *codecEntry) Init() error { native := make([]reflect.StructField, argLen) checked := make([]reflect.StructField, argLen) + // Single returns that aren't named will return that type + // whereas named parameters will return a struct with the fields + // Eg: function foo() returns (int256) ... will return a *big.Int for the native type + // function foo() returns (int256 i) ... will return a struct { I *big.Int } for the native type + // function foo() returns (int256 i1, int256 i2) ... will return a struct { I1 *big.Int, I2 *big.Int } for the native type if len(args) == 1 && args[0].Name == "" { nativeArg, checkedArg, err := getNativeAndCheckedTypesForArg(&args[0]) if err != nil { From bce2e3be6a0286051e2e00166d7e6470672e0f69 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Tue, 16 Jan 2024 09:23:05 -0500 Subject: [PATCH 089/112] use maps instaed fo ToCamelCase to allow consistnacy, also safer if customers have foo and foo_ both as varibles. --- core/internal/features/ocr2/features_ocr2_test.go | 3 +-- core/services/relay/evm/codec_entry.go | 4 ++-- core/services/relay/evm/event_binding.go | 4 ++-- integration-tests/actions/ocr2_helpers_local.go | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/core/internal/features/ocr2/features_ocr2_test.go b/core/internal/features/ocr2/features_ocr2_test.go index 12c49b992bf..9a1a6d7537d 100644 --- a/core/internal/features/ocr2/features_ocr2_test.go +++ b/core/internal/features/ocr2/features_ocr2_test.go @@ -35,7 +35,6 @@ import ( ocrtypes2 "github.com/smartcontractkit/libocr/offchainreporting2plus/types" commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" - "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" @@ -315,7 +314,7 @@ fromBlock = %d var chainReaderSpec string if test.chainReaderAndCodec { chainReaderSpec = ` -chainReader = '{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0, "output_modifications":[{"type" : "epoch to time", "fields" : ["LatestTimestamp"]}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}' +chainReader = '{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0, "output_modifications":[{"type" : "epoch to time", "fields" : ["LatestTimestamp_"]},{"type":"rename","fields":{"LatestAnswer_":"LatestAnswer","LatestTimestamp_":"LatestTimestamp"}}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}' codec = '{"chainCodecConfig" :{"MedianReport":{"TypeAbi": "[{\"Name\": \"Timestamp\",\"Type\": \"uint32\"},{\"Name\": \"Observers\",\"Type\": \"bytes32\"},{\"Name\": \"Observations\",\"Type\": \"int192[]\"},{\"Name\": \"JuelsPerFeeCoin\",\"Type\": \"int192\"}]"}}}'` } ocrJob, err := validate.ValidatedOracleSpecToml(apps[i].Config.OCR2(), apps[i].Config.Insecure(), fmt.Sprintf(` diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/codec_entry.go index bfefa0b8842..34be546692b 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/codec_entry.go @@ -3,6 +3,7 @@ package evm import ( "fmt" "reflect" + "strings" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" @@ -66,8 +67,7 @@ func (entry *codecEntry) Init() error { return fmt.Errorf("%w: empty field names are not supported for multiple returns", commontypes.ErrInvalidType) } - // To match decoding in abi - name := abi.ToCamelCase(arg.Name) + name := strings.ToUpper(arg.Name[:1]) + arg.Name[1:] if seenNames[name] { return fmt.Errorf("%w: duplicate field name %s, after ToCamelCase", commontypes.ErrInvalidConfig, name) } diff --git a/core/services/relay/evm/event_binding.go b/core/services/relay/evm/event_binding.go index 5be320f4d31..8ad9669c073 100644 --- a/core/services/relay/evm/event_binding.go +++ b/core/services/relay/evm/event_binding.go @@ -249,8 +249,8 @@ func (e *eventBinding) decodeLog(ctx context.Context, log *logpoller.Log, into a topics[i] = common.Hash(log.Topics[i+1]) } - topicsInto := reflect.New(e.topicInfo.nativeType).Interface() - if err := abi.ParseTopics(topicsInto, e.topicInfo.Args, topics); err != nil { + topicsInto := map[string]any{} + if err := abi.ParseTopicsIntoMap(topicsInto, e.topicInfo.Args, topics); err != nil { return fmt.Errorf("%w: %w", commontypes.ErrInvalidType, err) } diff --git a/integration-tests/actions/ocr2_helpers_local.go b/integration-tests/actions/ocr2_helpers_local.go index 4b5c274b12d..9d905b7430d 100644 --- a/integration-tests/actions/ocr2_helpers_local.go +++ b/integration-tests/actions/ocr2_helpers_local.go @@ -127,7 +127,7 @@ func CreateOCRv2JobsLocal( }, } if enableChainReaderAndCodec { - ocrSpec.OCR2OracleSpec.RelayConfig["chainReader"] = `{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0, "output_modifications":[{"type" : "epoch to time", "fields" : ["LatestTimestamp"]}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}` + ocrSpec.OCR2OracleSpec.RelayConfig["chainReader"] = `{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0,"output_modifications":[{"type" : "epoch to time", "fields" : ["LatestTimestamp_"]},{"type":"rename","fields":{"LatestAnswer_":"LatestAnswer","LatestTimestamp_":"LatestTimestamp"}}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}` ocrSpec.OCR2OracleSpec.RelayConfig["codec"] = `{"chainCodecConfig" :{"MedianReport":{"TypeAbi": "[{\"Name\": \"Timestamp\",\"Type\": \"uint32\"},{\"Name\": \"Observers\",\"Type\": \"bytes32\"},{\"Name\": \"Observations\",\"Type\": \"int192[]\"},{\"Name\": \"JuelsPerFeeCoin\",\"Type\": \"int192\"}]"}}}` } From e1f837f6301de1975b3080384b9a74089354b111 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Mon, 15 Jan 2024 12:04:22 -0500 Subject: [PATCH 090/112] Scope native and checked type conversion to a single struct and add tests to verify that NewAt is safe and fuzz tests for sanity around it too --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 +- core/services/relay/evm/chain_reader.go | 30 +- core/services/relay/evm/codec.go | 10 +- core/services/relay/evm/codec_entry_test.go | 219 ------------ core/services/relay/evm/codec_test.go | 4 +- core/services/relay/evm/decoder.go | 21 +- core/services/relay/evm/encoder.go | 79 ++-- core/services/relay/evm/event_binding.go | 20 +- core/services/relay/evm/parsed_types.go | 12 +- core/services/relay/evm/types/abi_types.go | 48 +-- .../relay/evm/types/byte_types_gen.go | 132 +++---- .../relay/evm/{ => types}/codec_entry.go | 89 ++++- .../relay/evm/types/codec_entry_test.go | 284 +++++++++++++++ core/services/relay/evm/types/gen/bytes.tmpl | 4 +- core/services/relay/evm/types/gen/ints.tmpl | 9 +- core/services/relay/evm/types/gen/main.go | 2 +- .../services/relay/evm/types/int_types_gen.go | 337 +++++++++--------- .../relay/evm/types/int_types_test.go | 54 +++ .../relay/evm/{ => types}/size_helper.go | 2 +- .../relay/evm/{ => types}/size_helper_test.go | 12 +- go.mod | 2 +- go.sum | 4 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- 25 files changed, 797 insertions(+), 589 deletions(-) delete mode 100644 core/services/relay/evm/codec_entry_test.go rename core/services/relay/evm/{ => types}/codec_entry.go (70%) create mode 100644 core/services/relay/evm/types/codec_entry_test.go create mode 100644 core/services/relay/evm/types/int_types_test.go rename core/services/relay/evm/{ => types}/size_helper.go (99%) rename core/services/relay/evm/{ => types}/size_helper_test.go (97%) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index d5ec9beeb53..9603be6368e 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 9c401125a27..d1df655c6ed 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1164,8 +1164,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f h1:7904h45vNBT+IVO7PMcucvNXSIS9ilf2cxf+RMYb7zs= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5 h1:o36okzBAbWhlxKrIeb66Iw/U7Uy3j4FsPGQREb06SUo= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index b8e7f20cc21..f9d2161460b 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -45,7 +45,7 @@ func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, chain leg lp: lp, client: chain.Client(), contractBindings: contractBindings{}, - parsed: &parsedTypes{encoderDefs: map[string]*codecEntry{}, decoderDefs: map[string]*codecEntry{}}, + parsed: &parsedTypes{encoderDefs: map[string]types.CodecEntry{}, decoderDefs: map[string]types.CodecEntry{}}, } var err error @@ -208,7 +208,7 @@ func (cr *chainReader) addEvent(contractName, eventName string, a abi.ABI, chain } func (cr *chainReader) getEventInput(def types.ChainReaderDefinition, contractName, eventName string) ( - *codecEntry, codec.Modifier, error) { + types.CodecEntry, codec.Modifier, error) { inputInfo := cr.parsed.encoderDefs[wrapItemType(contractName, eventName, true)] inMod, err := def.InputModifications.ToModifier(evmDecoderHooks...) if err != nil { @@ -216,7 +216,7 @@ func (cr *chainReader) getEventInput(def types.ChainReaderDefinition, contractNa } // initialize the modification - if _, err = inMod.RetypeForOffChain(reflect.PointerTo(inputInfo.checkedType), ""); err != nil { + if _, err = inMod.RetypeForOffChain(reflect.PointerTo(inputInfo.CheckedType()), ""); err != nil { return nil, nil, err } @@ -234,41 +234,39 @@ func verifyEventInputsUsed(chainReaderDefinition types.ChainReaderDefinition, in func (cr *chainReader) addEncoderDef(contractName, methodName string, args abi.Arguments, prefix []byte, chainReaderDefinition types.ChainReaderDefinition) error { // ABI.Pack prepends the method.ID to the encodings, we'll need the encoder to do the same. - input := &codecEntry{Args: args, encodingPrefix: prefix} - - if err := input.Init(); err != nil { + inputMod, err := chainReaderDefinition.InputModifications.ToModifier(evmDecoderHooks...) + if err != nil { return err } + input := types.NewCodecEntry(args, prefix, inputMod) - inputMod, err := chainReaderDefinition.InputModifications.ToModifier(evmDecoderHooks...) - if err != nil { + if err := input.Init(); err != nil { return err } - input.mod = inputMod + cr.parsed.encoderDefs[wrapItemType(contractName, methodName, true)] = input return nil } func (cr *chainReader) addDecoderDef(contractName, methodName string, outputs abi.Arguments, def types.ChainReaderDefinition) error { - output := &codecEntry{Args: outputs} mod, err := def.OutputModifications.ToModifier(evmDecoderHooks...) if err != nil { return err } - output.mod = mod + output := types.NewCodecEntry(outputs, nil, mod) cr.parsed.decoderDefs[wrapItemType(contractName, methodName, false)] = output return output.Init() } -func setupEventInput(event abi.Event, def types.ChainReaderDefinition) ([]abi.Argument, *codecEntry, map[string]bool) { +func setupEventInput(event abi.Event, def types.ChainReaderDefinition) ([]abi.Argument, types.CodecEntry, map[string]bool) { topicFieldDefs := map[string]bool{} for _, value := range def.EventInputFields { capFirstValue := abi.ToCamelCase(value) topicFieldDefs[capFirstValue] = true } - filterArgs := make([]abi.Argument, 0, maxTopicFields) - info := &codecEntry{} + filterArgs := make([]abi.Argument, 0, types.MaxTopicFields) + inputArgs := make([]abi.Argument, 0, len(event.Inputs)) indexArgNames := map[string]bool{} for _, input := range event.Inputs { @@ -286,9 +284,9 @@ func setupEventInput(event abi.Event, def types.ChainReaderDefinition) ([]abi.Ar filterArgs = append(filterArgs, inputUnindexed) } - info.Args = append(info.Args, input) + inputArgs = append(inputArgs, input) indexArgNames[abi.ToCamelCase(input.Name)] = true } - return filterArgs, info, indexArgNames + return filterArgs, types.NewCodecEntry(inputArgs, nil, nil), indexArgNames } diff --git a/core/services/relay/evm/codec.go b/core/services/relay/evm/codec.go index 8655831a588..c371897379e 100644 --- a/core/services/relay/evm/codec.go +++ b/core/services/relay/evm/codec.go @@ -36,8 +36,8 @@ var evmDecoderHooks = []mapstructure.DecodeHookFunc{decodeAccountHook, codec.Big // eg: rename FooBar -> Bar, not foo_bar_ to Bar if the name on-chain is foo_bar_ func NewCodec(conf types.CodecConfig) (commontypes.RemoteCodec, error) { parsed := &parsedTypes{ - encoderDefs: map[string]*codecEntry{}, - decoderDefs: map[string]*codecEntry{}, + encoderDefs: map[string]types.CodecEntry{}, + decoderDefs: map[string]types.CodecEntry{}, } for k, v := range conf.ChainCodecConfigs { @@ -51,7 +51,7 @@ func NewCodec(conf types.CodecConfig) (commontypes.RemoteCodec, error) { return nil, err } - item := &codecEntry{Args: args, mod: mod} + item := types.NewCodecEntry(args, nil, mod) if err = item.Init(); err != nil { return nil, err } @@ -70,7 +70,7 @@ type evmCodec struct { } func (c *evmCodec) CreateType(itemType string, forEncoding bool) (any, error) { - var itemTypes map[string]*codecEntry + var itemTypes map[string]types.CodecEntry if forEncoding { itemTypes = c.encoderDefs } else { @@ -82,7 +82,7 @@ func (c *evmCodec) CreateType(itemType string, forEncoding bool) (any, error) { return nil, fmt.Errorf("%w: cannot find type name %s", commontypes.ErrInvalidType, itemType) } - return reflect.New(def.checkedType).Interface(), nil + return reflect.New(def.CheckedType()).Interface(), nil } var bigIntType = reflect.TypeOf((*big.Int)(nil)) diff --git a/core/services/relay/evm/codec_entry_test.go b/core/services/relay/evm/codec_entry_test.go deleted file mode 100644 index 62a6bf25368..00000000000 --- a/core/services/relay/evm/codec_entry_test.go +++ /dev/null @@ -1,219 +0,0 @@ -package evm - -import ( - "math/big" - "reflect" - "testing" - - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - "github.com/pkg/errors" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" - - "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" -) - -func TestCodecEntry(t *testing.T) { - t.Run("basic types", func(t *testing.T) { - type1, err := abi.NewType("uint16", "", []abi.ArgumentMarshaling{}) - require.NoError(t, err) - type2, err := abi.NewType("string", "", []abi.ArgumentMarshaling{}) - require.NoError(t, err) - type3, err := abi.NewType("uint24", "", []abi.ArgumentMarshaling{}) - require.NoError(t, err) - type4, err := abi.NewType("int24", "", []abi.ArgumentMarshaling{}) - require.NoError(t, err) - entry := codecEntry{ - Args: abi.Arguments{ - {Name: "Field1", Type: type1}, - {Name: "Field2", Type: type2}, - {Name: "Field3", Type: type3}, - {Name: "Field4", Type: type4}, - }, - } - require.NoError(t, entry.Init()) - native := reflect.New(entry.nativeType) - iNative := reflect.Indirect(native) - iNative.FieldByName("Field1").Set(reflect.ValueOf(uint16(2))) - iNative.FieldByName("Field2").Set(reflect.ValueOf("any string")) - iNative.FieldByName("Field3").Set(reflect.ValueOf(big.NewInt( /*2^24 - 1*/ 16777215))) - iNative.FieldByName("Field4").Set(reflect.ValueOf(big.NewInt( /*2^23 - 1*/ 8388607))) - // native and checked point to the same item, even though they have different "types" - // they have the same memory layout so this is safe per unsafe casting rules, see unsafe.Pointer for details - checked := reflect.NewAt(entry.checkedType, native.UnsafePointer()) - iChecked := reflect.Indirect(checked) - checkedField := iChecked.FieldByName("Field3").Interface() - - sbi, ok := checkedField.(types.SizedBigInt) - require.True(t, ok) - assert.NoError(t, sbi.Verify()) - bi, ok := iNative.FieldByName("Field3").Interface().(*big.Int) - require.True(t, ok) - bi.Add(bi, big.NewInt(1)) - assert.IsType(t, commontypes.ErrInvalidType, sbi.Verify()) - bi, ok = iNative.FieldByName("Field4").Interface().(*big.Int) - require.True(t, ok) - bi.Add(bi, big.NewInt(1)) - assert.IsType(t, commontypes.ErrInvalidType, sbi.Verify()) - }) - - t.Run("tuples", func(t *testing.T) { - type1, err := abi.NewType("uint16", "", []abi.ArgumentMarshaling{}) - require.NoError(t, err) - tupleType, err := abi.NewType("tuple", "", []abi.ArgumentMarshaling{ - {Name: "Field3", Type: "uint24"}, - {Name: "Field4", Type: "int24"}, - }) - require.NoError(t, err) - entry := codecEntry{ - Args: abi.Arguments{ - {Name: "Field1", Type: type1}, - {Name: "Field2", Type: tupleType}, - }, - } - require.NoError(t, entry.Init()) - native := reflect.New(entry.nativeType) - iNative := reflect.Indirect(native) - iNative.FieldByName("Field1").Set(reflect.ValueOf(uint16(2))) - f2 := iNative.FieldByName("Field2") - f2.FieldByName("Field3").Set(reflect.ValueOf(big.NewInt( /*2^24 - 1*/ 16777215))) - f2.FieldByName("Field4").Set(reflect.ValueOf(big.NewInt( /*2^23 - 1*/ 8388607))) - // native and checked point to the same item, even though they have different "types" - // they have the same memory layout so this is safe per unsafe casting rules, see unsafe.Pointer for details - checked := reflect.NewAt(entry.checkedType, native.UnsafePointer()) - tuple := reflect.Indirect(checked).FieldByName("Field2") - checkedField := tuple.FieldByName("Field3").Interface() - - sbi, ok := checkedField.(types.SizedBigInt) - require.True(t, ok) - assert.NoError(t, sbi.Verify()) - bi, ok := f2.FieldByName("Field3").Interface().(*big.Int) - require.True(t, ok) - bi.Add(bi, big.NewInt(1)) - assert.IsType(t, commontypes.ErrInvalidType, sbi.Verify()) - bi, ok = f2.FieldByName("Field4").Interface().(*big.Int) - require.True(t, ok) - bi.Add(bi, big.NewInt(1)) - assert.IsType(t, commontypes.ErrInvalidType, sbi.Verify()) - }) - - t.Run("unwrapped types", func(t *testing.T) { - // This exists to allow you to decode single returned values without naming the parameter - wrappedTuple, err := abi.NewType("tuple", "", []abi.ArgumentMarshaling{ - {Name: "Field1", Type: "int16"}, - }) - require.NoError(t, err) - entry := codecEntry{ - Args: abi.Arguments{{Name: "", Type: wrappedTuple}}, - } - require.NoError(t, entry.Init()) - native := reflect.New(entry.nativeType) - iNative := reflect.Indirect(native) - iNative.FieldByName("Field1").Set(reflect.ValueOf(int16(2))) - }) - - t.Run("slice types", func(t *testing.T) { - type1, err := abi.NewType("int16[]", "", []abi.ArgumentMarshaling{}) - require.NoError(t, err) - entry := codecEntry{ - Args: abi.Arguments{{Name: "Field1", Type: type1}}, - } - require.NoError(t, entry.Init()) - native := reflect.New(entry.nativeType) - iNative := reflect.Indirect(native) - iNative.FieldByName("Field1").Set(reflect.ValueOf([]int16{2, 3})) - }) - - t.Run("array types", func(t *testing.T) { - type1, err := abi.NewType("int16[3]", "", []abi.ArgumentMarshaling{}) - require.NoError(t, err) - entry := codecEntry{ - Args: abi.Arguments{{Name: "Field1", Type: type1}}, - } - require.NoError(t, entry.Init()) - native := reflect.New(entry.nativeType) - iNative := reflect.Indirect(native) - iNative.FieldByName("Field1").Set(reflect.ValueOf([3]int16{2, 3, 30})) - }) - - t.Run("Not return values makes struct{}", func(t *testing.T) { - entry := codecEntry{Args: abi.Arguments{}} - require.NoError(t, entry.Init()) - assert.Equal(t, reflect.TypeOf(struct{}{}), entry.nativeType) - assert.Equal(t, reflect.TypeOf(struct{}{}), entry.checkedType) - }) - - t.Run("Address works", func(t *testing.T) { - address, err := abi.NewType("address", "", []abi.ArgumentMarshaling{}) - require.NoError(t, err) - entry := codecEntry{Args: abi.Arguments{{Name: "foo", Type: address}}} - require.NoError(t, entry.Init()) - }) - - t.Run("Multiple unnamed parameters are not supported", func(t *testing.T) { - anyType, err := abi.NewType("int16[3]", "", []abi.ArgumentMarshaling{}) - require.NoError(t, err) - entry := codecEntry{Args: abi.Arguments{{Name: "", Type: anyType}, {Name: "", Type: anyType}}} - assert.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidType)) - }) - - t.Run("Multiple abi arguments with the same name returns an error", func(t *testing.T) { - anyType, err := abi.NewType("int16[3]", "", []abi.ArgumentMarshaling{}) - require.NoError(t, err) - entry := codecEntry{Args: abi.Arguments{{Name: "Name", Type: anyType}, {Name: "Name", Type: anyType}}} - assert.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidConfig)) - }) - - t.Run("Indexed basic types leave their native and checked types as-is", func(t *testing.T) { - anyType, err := abi.NewType("int16", "", []abi.ArgumentMarshaling{}) - require.NoError(t, err) - entry := codecEntry{Args: abi.Arguments{{Name: "Name", Type: anyType, Indexed: true}}} - require.NoError(t, entry.Init()) - nativeField, ok := entry.nativeType.FieldByName("Name") - require.True(t, ok) - assert.Equal(t, reflect.TypeOf(int16(0)), nativeField.Type) - checkedField, ok := entry.checkedType.FieldByName("Name") - require.True(t, ok) - assert.Equal(t, reflect.TypeOf(int16(0)), checkedField.Type) - }) - - t.Run("Indexed non basic types change to hash", func(t *testing.T) { - anyType, err := abi.NewType("string", "", []abi.ArgumentMarshaling{}) - require.NoError(t, err) - entry := codecEntry{Args: abi.Arguments{{Name: "Name", Type: anyType, Indexed: true}}} - require.NoError(t, entry.Init()) - nativeField, ok := entry.nativeType.FieldByName("Name") - require.True(t, ok) - assert.Equal(t, reflect.TypeOf(common.Hash{}), nativeField.Type) - checkedField, ok := entry.checkedType.FieldByName("Name") - require.True(t, ok) - assert.Equal(t, reflect.TypeOf(common.Hash{}), checkedField.Type) - }) - - t.Run("Too many indexed items returns an error", func(t *testing.T) { - anyType, err := abi.NewType("int16", "", []abi.ArgumentMarshaling{}) - require.NoError(t, err) - entry := codecEntry{ - Args: abi.Arguments{ - {Name: "Name1", Type: anyType, Indexed: true}, - {Name: "Name2", Type: anyType, Indexed: true}, - {Name: "Name3", Type: anyType, Indexed: true}, - {Name: "Name4", Type: anyType, Indexed: true}, - }, - } - require.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidConfig)) - }) - - // TODO: when the TODO on - // https://github.com/ethereum/go-ethereum/blob/release/1.12/accounts/abi/topics.go#L78 - // is removed, remove this test. - t.Run("Using unsupported types by go-ethereum returns an error", func(t *testing.T) { - anyType, err := abi.NewType("int256[2]", "", []abi.ArgumentMarshaling{}) - require.NoError(t, err) - entry := codecEntry{Args: abi.Arguments{{Name: "Name", Type: anyType, Indexed: true}}} - assert.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidConfig)) - }) -} diff --git a/core/services/relay/evm/codec_test.go b/core/services/relay/evm/codec_test.go index b281039759c..e3694dc4aed 100644 --- a/core/services/relay/evm/codec_test.go +++ b/core/services/relay/evm/codec_test.go @@ -32,7 +32,7 @@ func TestCodec(t *testing.T) { actual, err := c.GetMaxEncodingSize(testutils.Context(t), anyN, sizeItemType) assert.NoError(t, err) - expected, err := evm.GetMaxSize(anyN, parseDefs(t)[sizeItemType]) + expected, err := types.GetMaxSize(anyN, parseDefs(t)[sizeItemType]) require.NoError(t, err) assert.Equal(t, expected, actual) }) @@ -41,7 +41,7 @@ func TestCodec(t *testing.T) { actual, err := c.GetMaxDecodingSize(testutils.Context(t), anyN, sizeItemType) assert.NoError(t, err) - expected, err := evm.GetMaxSize(anyN, parseDefs(t)[sizeItemType]) + expected, err := types.GetMaxSize(anyN, parseDefs(t)[sizeItemType]) require.NoError(t, err) assert.Equal(t, expected, actual) }) diff --git a/core/services/relay/evm/decoder.go b/core/services/relay/evm/decoder.go index 1520afa0fd9..f16875d80f6 100644 --- a/core/services/relay/evm/decoder.go +++ b/core/services/relay/evm/decoder.go @@ -8,15 +8,17 @@ import ( "github.com/mitchellh/mapstructure" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) type decoder struct { - Definitions map[string]*codecEntry + Definitions map[string]types.CodecEntry } var _ commontypes.Decoder = &decoder{} -func (m *decoder) Decode(ctx context.Context, raw []byte, into any, itemType string) error { +func (m *decoder) Decode(_ context.Context, raw []byte, into any, itemType string) error { info, ok := m.Definitions[itemType] if !ok { return fmt.Errorf("%w: cannot find definition for %s", commontypes.ErrInvalidType, itemType) @@ -51,14 +53,19 @@ func (m *decoder) decodeArray(into any, rDecode reflect.Value) error { return setElements(length, rDecode, iInto) } -func (m *decoder) GetMaxDecodingSize(ctx context.Context, n int, itemType string) (int, error) { - return m.Definitions[itemType].GetMaxSize(n) +func (m *decoder) GetMaxDecodingSize(_ context.Context, n int, itemType string) (int, error) { + entry, ok := m.Definitions[itemType] + if !ok { + return 0, fmt.Errorf("%w: nil entry", commontypes.ErrInvalidType) + } + return entry.GetMaxSize(n) } -func extractDecoding(info *codecEntry, raw []byte) (any, error) { +func extractDecoding(info types.CodecEntry, raw []byte) (any, error) { unpacked := map[string]any{} - if err := info.Args.UnpackIntoMap(unpacked, raw); err != nil { - return nil, fmt.Errorf("%w: %w: for args %#v", commontypes.ErrInvalidEncoding, err, info.Args) + args := info.Args() + if err := args.UnpackIntoMap(unpacked, raw); err != nil { + return nil, fmt.Errorf("%w: %w: for args %#v", commontypes.ErrInvalidEncoding, err, args) } var decode any = unpacked diff --git a/core/services/relay/evm/encoder.go b/core/services/relay/evm/encoder.go index 7af0d7f7bce..afead53f34e 100644 --- a/core/services/relay/evm/encoder.go +++ b/core/services/relay/evm/encoder.go @@ -6,15 +6,17 @@ import ( "reflect" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) type encoder struct { - Definitions map[string]*codecEntry + Definitions map[string]types.CodecEntry } var _ commontypes.Encoder = &encoder{} -func (e *encoder) Encode(ctx context.Context, item any, itemType string) (res []byte, err error) { +func (e *encoder) Encode(_ context.Context, item any, itemType string) (res []byte, err error) { // nil values can cause abi.Arguments.Pack to panic. defer func() { if r := recover(); r != nil { @@ -28,19 +30,21 @@ func (e *encoder) Encode(ctx context.Context, item any, itemType string) (res [] } if item == nil { - cpy := make([]byte, len(info.encodingPrefix)) - copy(cpy, info.encodingPrefix) - return cpy, nil + return info.EncodingPrefix(), nil } return encode(reflect.ValueOf(item), info) } -func (e *encoder) GetMaxEncodingSize(ctx context.Context, n int, itemType string) (int, error) { - return e.Definitions[itemType].GetMaxSize(n) +func (e *encoder) GetMaxEncodingSize(_ context.Context, n int, itemType string) (int, error) { + entry, ok := e.Definitions[itemType] + if !ok { + return 0, fmt.Errorf("%w: nil entry", commontypes.ErrInvalidType) + } + return entry.GetMaxSize(n) } -func encode(item reflect.Value, info *codecEntry) ([]byte, error) { +func encode(item reflect.Value, info types.CodecEntry) ([]byte, error) { for item.Kind() == reflect.Pointer { item = reflect.Indirect(item) } @@ -62,42 +66,58 @@ func encode(item reflect.Value, info *codecEntry) ([]byte, error) { } } -func representArray(item reflect.Value, info *codecEntry) (any, error) { +func representArray(item reflect.Value, info types.CodecEntry) (any, error) { length := item.Len() - var native reflect.Value - switch info.checkedType.Kind() { + checkedType := info.CheckedType() + checked := reflect.New(checkedType) + iChecked := reflect.Indirect(checked) + switch checkedType.Kind() { case reflect.Array: - if info.checkedType.Len() != length { + if checkedType.Len() != length { return nil, commontypes.ErrSliceWrongLen } - native = reflect.New(info.nativeType).Elem() case reflect.Slice: - native = reflect.MakeSlice(info.nativeType, length, length) + iChecked.Set(reflect.MakeSlice(checkedType, length, length)) default: - return nil, fmt.Errorf("%w: cannot encode %v as array", commontypes.ErrInvalidType, info.checkedType.Kind()) + return nil, fmt.Errorf("%w: cannot encode %v as array", commontypes.ErrInvalidType, checkedType.Kind()) } - checkedElm := info.checkedType.Elem() - nativeElm := info.nativeType.Elem() + checkedElm := checkedType.Elem() for i := 0; i < length; i++ { tmp := reflect.New(checkedElm) if err := mapstructureDecode(item.Index(i).Interface(), tmp.Interface()); err != nil { return nil, err } - native.Index(i).Set(reflect.NewAt(nativeElm, tmp.UnsafePointer()).Elem()) + iChecked.Index(i).Set(tmp.Elem()) } - return native.Interface(), nil + native, err := info.ToNative(checked) + if err != nil { + return nil, err + } + + return native.Elem().Interface(), nil } -func unrollItem(item reflect.Value, info *codecEntry) ([]any, error) { - if item.Type() == reflect.PointerTo(info.checkedType) { - item = reflect.NewAt(info.nativeType, item.UnsafePointer()) - } else if item.Type() != reflect.PointerTo(info.nativeType) { - checked := reflect.New(info.checkedType) - if err := mapstructureDecode(item.Interface(), checked.Interface()); err != nil { +func unrollItem(item reflect.Value, info types.CodecEntry) ([]any, error) { + checkedType := info.CheckedType() + if item.CanAddr() { + item = item.Addr() + } + + if item.Type() == reflect.PointerTo(checkedType) { + var err error + if item, err = info.ToNative(item); err != nil { + return nil, err + } + } else if !info.IsNativePointer(item.Type()) { + var err error + checked := reflect.New(checkedType) + if err = mapstructureDecode(item.Interface(), checked.Interface()); err != nil { + return nil, err + } + if item, err = info.ToNative(checked); err != nil { return nil, err } - item = reflect.NewAt(info.nativeType, checked.UnsafePointer()) } item = reflect.Indirect(item) @@ -112,13 +132,12 @@ func unrollItem(item reflect.Value, info *codecEntry) ([]any, error) { return values, nil } -func pack(info *codecEntry, values ...any) ([]byte, error) { - bytes, err := info.Args.Pack(values...) +func pack(info types.CodecEntry, values ...any) ([]byte, error) { + bytes, err := info.Args().Pack(values...) if err != nil { return nil, fmt.Errorf("%w: %w", commontypes.ErrInvalidType, err) } - withPrefix := make([]byte, 0, len(info.encodingPrefix)+len(bytes)) - withPrefix = append(withPrefix, info.encodingPrefix...) + withPrefix := info.EncodingPrefix() return append(withPrefix, bytes...), nil } diff --git a/core/services/relay/evm/event_binding.go b/core/services/relay/evm/event_binding.go index 8ad9669c073..f520e6f0f82 100644 --- a/core/services/relay/evm/event_binding.go +++ b/core/services/relay/evm/event_binding.go @@ -15,11 +15,9 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) -// Max four topics on EVM, the first topic is always the event signature, so 3 topics left for fields -const maxTopicFields = 3 - type eventBinding struct { address common.Address contractName string @@ -31,9 +29,9 @@ type eventBinding struct { bound bool registerCalled bool lock sync.Mutex - inputInfo *codecEntry + inputInfo types.CodecEntry inputModifier codec.Modifier - topicInfo *codecEntry + topicInfo types.CodecEntry // used to allow Register and Unregister to be unique in case two bindings have the same event. // otherwise, if one unregisters, it'll unregister both with the LogPoller. id string @@ -88,7 +86,7 @@ func (e *eventBinding) GetLatestValue(ctx context.Context, params, into any) err confs = logpoller.Unconfirmed } - if len(e.inputInfo.Args) == 0 { + if len(e.inputInfo.Args()) == 0 { return e.getLatestValueWithoutFilters(ctx, confs, into) } @@ -131,7 +129,11 @@ func (e *eventBinding) getLatestValueWithFilters( return err } - nativeParams := reflect.NewAt(e.inputInfo.nativeType, reflect.ValueOf(checkedParams).UnsafePointer()) + nativeParams, err := e.inputInfo.ToNative(reflect.ValueOf(checkedParams)) + if err != nil { + return err + } + filtersAndIndices, err := e.encodeParams(nativeParams) if err != nil { return err @@ -240,7 +242,7 @@ func (e *eventBinding) decodeLog(ctx context.Context, log *logpoller.Log, into a return err } - topics := make([]common.Hash, len(e.topicInfo.Args)) + topics := make([]common.Hash, len(e.topicInfo.Args())) if len(log.Topics) < len(topics)+1 { return fmt.Errorf("%w: not enough topics to decode", commontypes.ErrInvalidType) } @@ -250,7 +252,7 @@ func (e *eventBinding) decodeLog(ctx context.Context, log *logpoller.Log, into a } topicsInto := map[string]any{} - if err := abi.ParseTopicsIntoMap(topicsInto, e.topicInfo.Args, topics); err != nil { + if err := abi.ParseTopicsIntoMap(topicsInto, e.topicInfo.Args(), topics); err != nil { return fmt.Errorf("%w: %w", commontypes.ErrInvalidType, err) } diff --git a/core/services/relay/evm/parsed_types.go b/core/services/relay/evm/parsed_types.go index da54d5c15a3..8ffa9ae0a6a 100644 --- a/core/services/relay/evm/parsed_types.go +++ b/core/services/relay/evm/parsed_types.go @@ -6,11 +6,13 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/codec" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) type parsedTypes struct { - encoderDefs map[string]*codecEntry - decoderDefs map[string]*codecEntry + encoderDefs map[string]types.CodecEntry + decoderDefs map[string]types.CodecEntry } func (parsed *parsedTypes) toCodec() (commontypes.RemoteCodec, error) { @@ -36,10 +38,10 @@ func (parsed *parsedTypes) toCodec() (commontypes.RemoteCodec, error) { // addEntries extracts the mods from codecEntry and adds them to modByTypeName use with codec.NewByItemTypeModifier // Since each input/output can have its own modifications, we need to keep track of them by type name -func addEntries(defs map[string]*codecEntry, modByTypeName map[string]codec.Modifier) error { +func addEntries(defs map[string]types.CodecEntry, modByTypeName map[string]codec.Modifier) error { for k, def := range defs { - modByTypeName[k] = def.mod - _, err := def.mod.RetypeForOffChain(reflect.PointerTo(def.checkedType), k) + modByTypeName[k] = def.Modifier() + _, err := def.Modifier().RetypeForOffChain(reflect.PointerTo(def.CheckedType()), k) if err != nil { return fmt.Errorf("%w: cannot retype %v: %w", commontypes.ErrInvalidConfig, k, err) } diff --git a/core/services/relay/evm/types/abi_types.go b/core/services/relay/evm/types/abi_types.go index a3a02a41bc2..34b12d885b4 100644 --- a/core/services/relay/evm/types/abi_types.go +++ b/core/services/relay/evm/types/abi_types.go @@ -10,54 +10,54 @@ import ( var typeMap = map[string]*ABIEncodingType{ "bool": { - Native: reflect.TypeOf(true), - Checked: reflect.TypeOf(true), + native: reflect.TypeOf(true), + checked: reflect.TypeOf(true), }, "int8": { - Native: reflect.TypeOf(int8(0)), - Checked: reflect.TypeOf(int8(0)), + native: reflect.TypeOf(int8(0)), + checked: reflect.TypeOf(int8(0)), }, "int16": { - Native: reflect.TypeOf(int16(0)), - Checked: reflect.TypeOf(int16(0)), + native: reflect.TypeOf(int16(0)), + checked: reflect.TypeOf(int16(0)), }, "int32": { - Native: reflect.TypeOf(int32(0)), - Checked: reflect.TypeOf(int32(0)), + native: reflect.TypeOf(int32(0)), + checked: reflect.TypeOf(int32(0)), }, "int64": { - Native: reflect.TypeOf(int64(0)), - Checked: reflect.TypeOf(int64(0)), + native: reflect.TypeOf(int64(0)), + checked: reflect.TypeOf(int64(0)), }, "uint8": { - Native: reflect.TypeOf(uint8(0)), - Checked: reflect.TypeOf(uint8(0)), + native: reflect.TypeOf(uint8(0)), + checked: reflect.TypeOf(uint8(0)), }, "uint16": { - Native: reflect.TypeOf(uint16(0)), - Checked: reflect.TypeOf(uint16(0)), + native: reflect.TypeOf(uint16(0)), + checked: reflect.TypeOf(uint16(0)), }, "uint32": { - Native: reflect.TypeOf(uint32(0)), - Checked: reflect.TypeOf(uint32(0)), + native: reflect.TypeOf(uint32(0)), + checked: reflect.TypeOf(uint32(0)), }, "uint64": { - Native: reflect.TypeOf(uint64(0)), - Checked: reflect.TypeOf(uint64(0)), + native: reflect.TypeOf(uint64(0)), + checked: reflect.TypeOf(uint64(0)), }, "string": { - Native: reflect.TypeOf(""), - Checked: reflect.TypeOf(""), + native: reflect.TypeOf(""), + checked: reflect.TypeOf(""), }, "address": { - Native: reflect.TypeOf(common.Address{}), - Checked: reflect.TypeOf(common.Address{}), + native: reflect.TypeOf(common.Address{}), + checked: reflect.TypeOf(common.Address{}), }, } type ABIEncodingType struct { - Native reflect.Type - Checked reflect.Type + native reflect.Type + checked reflect.Type } func GetAbiEncodingType(name string) (*ABIEncodingType, bool) { diff --git a/core/services/relay/evm/types/byte_types_gen.go b/core/services/relay/evm/types/byte_types_gen.go index fb9fd9bdb5c..cf8d15ccabc 100644 --- a/core/services/relay/evm/types/byte_types_gen.go +++ b/core/services/relay/evm/types/byte_types_gen.go @@ -6,8 +6,8 @@ type bytes1 [1]byte func init() { typeMap["bytes1"] = &ABIEncodingType{ - Native: reflect.TypeOf([1]byte{}), - Checked: reflect.TypeOf(bytes1{}), + native: reflect.TypeOf([1]byte{}), + checked: reflect.TypeOf(bytes1{}), } } @@ -15,8 +15,8 @@ type bytes2 [2]byte func init() { typeMap["bytes2"] = &ABIEncodingType{ - Native: reflect.TypeOf([2]byte{}), - Checked: reflect.TypeOf(bytes2{}), + native: reflect.TypeOf([2]byte{}), + checked: reflect.TypeOf(bytes2{}), } } @@ -24,8 +24,8 @@ type bytes3 [3]byte func init() { typeMap["bytes3"] = &ABIEncodingType{ - Native: reflect.TypeOf([3]byte{}), - Checked: reflect.TypeOf(bytes3{}), + native: reflect.TypeOf([3]byte{}), + checked: reflect.TypeOf(bytes3{}), } } @@ -33,8 +33,8 @@ type bytes4 [4]byte func init() { typeMap["bytes4"] = &ABIEncodingType{ - Native: reflect.TypeOf([4]byte{}), - Checked: reflect.TypeOf(bytes4{}), + native: reflect.TypeOf([4]byte{}), + checked: reflect.TypeOf(bytes4{}), } } @@ -42,8 +42,8 @@ type bytes5 [5]byte func init() { typeMap["bytes5"] = &ABIEncodingType{ - Native: reflect.TypeOf([5]byte{}), - Checked: reflect.TypeOf(bytes5{}), + native: reflect.TypeOf([5]byte{}), + checked: reflect.TypeOf(bytes5{}), } } @@ -51,8 +51,8 @@ type bytes6 [6]byte func init() { typeMap["bytes6"] = &ABIEncodingType{ - Native: reflect.TypeOf([6]byte{}), - Checked: reflect.TypeOf(bytes6{}), + native: reflect.TypeOf([6]byte{}), + checked: reflect.TypeOf(bytes6{}), } } @@ -60,8 +60,8 @@ type bytes7 [7]byte func init() { typeMap["bytes7"] = &ABIEncodingType{ - Native: reflect.TypeOf([7]byte{}), - Checked: reflect.TypeOf(bytes7{}), + native: reflect.TypeOf([7]byte{}), + checked: reflect.TypeOf(bytes7{}), } } @@ -69,8 +69,8 @@ type bytes8 [8]byte func init() { typeMap["bytes8"] = &ABIEncodingType{ - Native: reflect.TypeOf([8]byte{}), - Checked: reflect.TypeOf(bytes8{}), + native: reflect.TypeOf([8]byte{}), + checked: reflect.TypeOf(bytes8{}), } } @@ -78,8 +78,8 @@ type bytes9 [9]byte func init() { typeMap["bytes9"] = &ABIEncodingType{ - Native: reflect.TypeOf([9]byte{}), - Checked: reflect.TypeOf(bytes9{}), + native: reflect.TypeOf([9]byte{}), + checked: reflect.TypeOf(bytes9{}), } } @@ -87,8 +87,8 @@ type bytes10 [10]byte func init() { typeMap["bytes10"] = &ABIEncodingType{ - Native: reflect.TypeOf([10]byte{}), - Checked: reflect.TypeOf(bytes10{}), + native: reflect.TypeOf([10]byte{}), + checked: reflect.TypeOf(bytes10{}), } } @@ -96,8 +96,8 @@ type bytes11 [11]byte func init() { typeMap["bytes11"] = &ABIEncodingType{ - Native: reflect.TypeOf([11]byte{}), - Checked: reflect.TypeOf(bytes11{}), + native: reflect.TypeOf([11]byte{}), + checked: reflect.TypeOf(bytes11{}), } } @@ -105,8 +105,8 @@ type bytes12 [12]byte func init() { typeMap["bytes12"] = &ABIEncodingType{ - Native: reflect.TypeOf([12]byte{}), - Checked: reflect.TypeOf(bytes12{}), + native: reflect.TypeOf([12]byte{}), + checked: reflect.TypeOf(bytes12{}), } } @@ -114,8 +114,8 @@ type bytes13 [13]byte func init() { typeMap["bytes13"] = &ABIEncodingType{ - Native: reflect.TypeOf([13]byte{}), - Checked: reflect.TypeOf(bytes13{}), + native: reflect.TypeOf([13]byte{}), + checked: reflect.TypeOf(bytes13{}), } } @@ -123,8 +123,8 @@ type bytes14 [14]byte func init() { typeMap["bytes14"] = &ABIEncodingType{ - Native: reflect.TypeOf([14]byte{}), - Checked: reflect.TypeOf(bytes14{}), + native: reflect.TypeOf([14]byte{}), + checked: reflect.TypeOf(bytes14{}), } } @@ -132,8 +132,8 @@ type bytes15 [15]byte func init() { typeMap["bytes15"] = &ABIEncodingType{ - Native: reflect.TypeOf([15]byte{}), - Checked: reflect.TypeOf(bytes15{}), + native: reflect.TypeOf([15]byte{}), + checked: reflect.TypeOf(bytes15{}), } } @@ -141,8 +141,8 @@ type bytes16 [16]byte func init() { typeMap["bytes16"] = &ABIEncodingType{ - Native: reflect.TypeOf([16]byte{}), - Checked: reflect.TypeOf(bytes16{}), + native: reflect.TypeOf([16]byte{}), + checked: reflect.TypeOf(bytes16{}), } } @@ -150,8 +150,8 @@ type bytes17 [17]byte func init() { typeMap["bytes17"] = &ABIEncodingType{ - Native: reflect.TypeOf([17]byte{}), - Checked: reflect.TypeOf(bytes17{}), + native: reflect.TypeOf([17]byte{}), + checked: reflect.TypeOf(bytes17{}), } } @@ -159,8 +159,8 @@ type bytes18 [18]byte func init() { typeMap["bytes18"] = &ABIEncodingType{ - Native: reflect.TypeOf([18]byte{}), - Checked: reflect.TypeOf(bytes18{}), + native: reflect.TypeOf([18]byte{}), + checked: reflect.TypeOf(bytes18{}), } } @@ -168,8 +168,8 @@ type bytes19 [19]byte func init() { typeMap["bytes19"] = &ABIEncodingType{ - Native: reflect.TypeOf([19]byte{}), - Checked: reflect.TypeOf(bytes19{}), + native: reflect.TypeOf([19]byte{}), + checked: reflect.TypeOf(bytes19{}), } } @@ -177,8 +177,8 @@ type bytes20 [20]byte func init() { typeMap["bytes20"] = &ABIEncodingType{ - Native: reflect.TypeOf([20]byte{}), - Checked: reflect.TypeOf(bytes20{}), + native: reflect.TypeOf([20]byte{}), + checked: reflect.TypeOf(bytes20{}), } } @@ -186,8 +186,8 @@ type bytes21 [21]byte func init() { typeMap["bytes21"] = &ABIEncodingType{ - Native: reflect.TypeOf([21]byte{}), - Checked: reflect.TypeOf(bytes21{}), + native: reflect.TypeOf([21]byte{}), + checked: reflect.TypeOf(bytes21{}), } } @@ -195,8 +195,8 @@ type bytes22 [22]byte func init() { typeMap["bytes22"] = &ABIEncodingType{ - Native: reflect.TypeOf([22]byte{}), - Checked: reflect.TypeOf(bytes22{}), + native: reflect.TypeOf([22]byte{}), + checked: reflect.TypeOf(bytes22{}), } } @@ -204,8 +204,8 @@ type bytes23 [23]byte func init() { typeMap["bytes23"] = &ABIEncodingType{ - Native: reflect.TypeOf([23]byte{}), - Checked: reflect.TypeOf(bytes23{}), + native: reflect.TypeOf([23]byte{}), + checked: reflect.TypeOf(bytes23{}), } } @@ -213,8 +213,8 @@ type bytes24 [24]byte func init() { typeMap["bytes24"] = &ABIEncodingType{ - Native: reflect.TypeOf([24]byte{}), - Checked: reflect.TypeOf(bytes24{}), + native: reflect.TypeOf([24]byte{}), + checked: reflect.TypeOf(bytes24{}), } } @@ -222,8 +222,8 @@ type bytes25 [25]byte func init() { typeMap["bytes25"] = &ABIEncodingType{ - Native: reflect.TypeOf([25]byte{}), - Checked: reflect.TypeOf(bytes25{}), + native: reflect.TypeOf([25]byte{}), + checked: reflect.TypeOf(bytes25{}), } } @@ -231,8 +231,8 @@ type bytes26 [26]byte func init() { typeMap["bytes26"] = &ABIEncodingType{ - Native: reflect.TypeOf([26]byte{}), - Checked: reflect.TypeOf(bytes26{}), + native: reflect.TypeOf([26]byte{}), + checked: reflect.TypeOf(bytes26{}), } } @@ -240,8 +240,8 @@ type bytes27 [27]byte func init() { typeMap["bytes27"] = &ABIEncodingType{ - Native: reflect.TypeOf([27]byte{}), - Checked: reflect.TypeOf(bytes27{}), + native: reflect.TypeOf([27]byte{}), + checked: reflect.TypeOf(bytes27{}), } } @@ -249,8 +249,8 @@ type bytes28 [28]byte func init() { typeMap["bytes28"] = &ABIEncodingType{ - Native: reflect.TypeOf([28]byte{}), - Checked: reflect.TypeOf(bytes28{}), + native: reflect.TypeOf([28]byte{}), + checked: reflect.TypeOf(bytes28{}), } } @@ -258,8 +258,8 @@ type bytes29 [29]byte func init() { typeMap["bytes29"] = &ABIEncodingType{ - Native: reflect.TypeOf([29]byte{}), - Checked: reflect.TypeOf(bytes29{}), + native: reflect.TypeOf([29]byte{}), + checked: reflect.TypeOf(bytes29{}), } } @@ -267,8 +267,8 @@ type bytes30 [30]byte func init() { typeMap["bytes30"] = &ABIEncodingType{ - Native: reflect.TypeOf([30]byte{}), - Checked: reflect.TypeOf(bytes30{}), + native: reflect.TypeOf([30]byte{}), + checked: reflect.TypeOf(bytes30{}), } } @@ -276,8 +276,8 @@ type bytes31 [31]byte func init() { typeMap["bytes31"] = &ABIEncodingType{ - Native: reflect.TypeOf([31]byte{}), - Checked: reflect.TypeOf(bytes31{}), + native: reflect.TypeOf([31]byte{}), + checked: reflect.TypeOf(bytes31{}), } } @@ -285,8 +285,8 @@ type bytes32 [32]byte func init() { typeMap["bytes32"] = &ABIEncodingType{ - Native: reflect.TypeOf([32]byte{}), - Checked: reflect.TypeOf(bytes32{}), + native: reflect.TypeOf([32]byte{}), + checked: reflect.TypeOf(bytes32{}), } } @@ -294,7 +294,7 @@ type bytes0 [0]byte func init() { typeMap["bytes0"] = &ABIEncodingType{ - Native: reflect.TypeOf([0]byte{}), - Checked: reflect.TypeOf(bytes0{}), + native: reflect.TypeOf([0]byte{}), + checked: reflect.TypeOf(bytes0{}), } } diff --git a/core/services/relay/evm/codec_entry.go b/core/services/relay/evm/types/codec_entry.go similarity index 70% rename from core/services/relay/evm/codec_entry.go rename to core/services/relay/evm/types/codec_entry.go index 34be546692b..df51ad7b897 100644 --- a/core/services/relay/evm/codec_entry.go +++ b/core/services/relay/evm/types/codec_entry.go @@ -1,4 +1,4 @@ -package evm +package types import ( "fmt" @@ -11,24 +11,86 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/codec" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" - - "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) +// MaxTopicFields is three because the EVM has a m of ax four topics, but the first topic is always the event signature. +const MaxTopicFields = 3 + +type CodecEntry interface { + Init() error + Args() abi.Arguments + EncodingPrefix() []byte + GetMaxSize(n int) (int, error) + Modifier() codec.Modifier + + // CheckedType provides a type that can be used to decode into with type-safety around sizes of integers etc. + CheckedType() reflect.Type + + // ToNative converts a pointer to checked value into a pointer of a type to use with the go-ethereum ABI encoder + // Note that modification of the returned value will modify the original checked value and vice versa. + ToNative(checked reflect.Value) (reflect.Value, error) + + // IsNativePointer returns if the type is a pointer to the native type + IsNativePointer(item reflect.Type) bool +} + +func NewCodecEntry(args abi.Arguments, encodingPrefix []byte, mod codec.Modifier) CodecEntry { + if mod == nil { + mod = codec.MultiModifier{} + } + return &codecEntry{args: args, encodingPrefix: encodingPrefix, mod: mod} +} + type codecEntry struct { - Args abi.Arguments + args abi.Arguments encodingPrefix []byte checkedType reflect.Type nativeType reflect.Type mod codec.Modifier } +func (entry *codecEntry) CheckedType() reflect.Type { + return entry.checkedType +} + +func (entry *codecEntry) NativeType() reflect.Type { + return entry.nativeType +} + +func (entry *codecEntry) ToNative(checked reflect.Value) (reflect.Value, error) { + if checked.Type() != reflect.PointerTo(entry.checkedType) { + return reflect.Value{}, fmt.Errorf("%w: checked type %v does not match expected type %v", commontypes.ErrInvalidType, reflect.TypeOf(checked), entry.checkedType) + } + + return reflect.NewAt(entry.nativeType, checked.UnsafePointer()), nil +} + +func (entry *codecEntry) IsNativePointer(item reflect.Type) bool { + return item == reflect.PointerTo(entry.nativeType) +} + +func (entry *codecEntry) Modifier() codec.Modifier { + return entry.mod +} + +func (entry *codecEntry) Args() abi.Arguments { + tmp := make(abi.Arguments, len(entry.args)) + copy(tmp, entry.args) + return tmp +} + +func (entry *codecEntry) EncodingPrefix() []byte { + tmp := make([]byte, len(entry.encodingPrefix)) + copy(tmp, entry.encodingPrefix) + return tmp +} + func (entry *codecEntry) Init() error { if entry.checkedType != nil { return nil } - args := UnwrapArgs(entry.Args) + args := unwrapArgs(entry.args) argLen := len(args) native := make([]reflect.StructField, argLen) checked := make([]reflect.StructField, argLen) @@ -52,7 +114,7 @@ func (entry *codecEntry) Init() error { seenNames := map[string]bool{} for i, arg := range args { if arg.Indexed { - if numIndices == maxTopicFields { + if numIndices == MaxTopicFields { return fmt.Errorf("%w: too many indexed arguments", commontypes.ErrInvalidConfig) } numIndices++ @@ -82,13 +144,10 @@ func (entry *codecEntry) Init() error { } func (entry *codecEntry) GetMaxSize(n int) (int, error) { - if entry == nil { - return 0, fmt.Errorf("%w: nil entry", commontypes.ErrInvalidType) - } - return GetMaxSize(n, entry.Args) + return GetMaxSize(n, entry.args) } -func UnwrapArgs(args abi.Arguments) abi.Arguments { +func unwrapArgs(args abi.Arguments) abi.Arguments { // Unwrap an unnamed tuple so that callers don't need to wrap it // Eg: If you have struct Foo { ... } and return an unnamed Foo, you should be able ot decode to a go Foo{} directly if len(args) != 1 || args[0].Name != "" { @@ -116,8 +175,8 @@ func getNativeAndCheckedTypesForArg(arg *abi.Argument) (reflect.Type, reflect.Ty case abi.StringTy: return reflect.TypeOf(common.Hash{}), reflect.TypeOf(common.Hash{}), nil case abi.ArrayTy: - u8, _ := types.GetAbiEncodingType("uint8") - if arg.Type.Elem.GetType() == u8.Native { + u8, _ := GetAbiEncodingType("uint8") + if arg.Type.Elem.GetType() == u8.native { return reflect.TypeOf(common.Hash{}), reflect.TypeOf(common.Hash{}), nil } fallthrough @@ -152,9 +211,9 @@ func getNativeAndCheckedTypes(curType *abi.Type) (reflect.Type, reflect.Type, er "%w: cannot create type for kind %v", commontypes.ErrInvalidType, curType.GetType().Kind()) } } - base, ok := types.GetAbiEncodingType(curType.String()) + base, ok := GetAbiEncodingType(curType.String()) if ok { - return converter(base.Native), converter(base.Checked), nil + return converter(base.native), converter(base.checked), nil } return createTupleType(curType, converter) diff --git a/core/services/relay/evm/types/codec_entry_test.go b/core/services/relay/evm/types/codec_entry_test.go new file mode 100644 index 00000000000..861fb4b96e2 --- /dev/null +++ b/core/services/relay/evm/types/codec_entry_test.go @@ -0,0 +1,284 @@ +package types + +import ( + "math/big" + "reflect" + "testing" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink-common/pkg/codec" + + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" +) + +func TestCodecEntry(t *testing.T) { + t.Run("basic types", func(t *testing.T) { + type1, err := abi.NewType("uint16", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + type2, err := abi.NewType("string", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + type3, err := abi.NewType("uint24", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + type4, err := abi.NewType("int24", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + args := abi.Arguments{ + {Name: "Field1", Type: type1}, + {Name: "Field2", Type: type2}, + {Name: "Field3", Type: type3}, + {Name: "Field4", Type: type4}, + } + entry := NewCodecEntry(args, nil, nil) + require.NoError(t, entry.Init()) + checked := reflect.New(entry.CheckedType()) + iChecked := reflect.Indirect(checked) + iChecked.FieldByName("Field1").Set(reflect.ValueOf(uint16(2))) + iChecked.FieldByName("Field2").Set(reflect.ValueOf("any string")) + + f3 := big.NewInt( /*2^24 - 1*/ 16777215) + setAndVerifyLimit(t, (*uint24)(f3), f3, iChecked.FieldByName("Field3")) + + f4 := big.NewInt( /*2^23 - 1*/ 8388607) + setAndVerifyLimit(t, (*int24)(f4), f4, iChecked.FieldByName("Field4")) + + rNative, err := entry.ToNative(checked) + require.NoError(t, err) + iNative := reflect.Indirect(rNative) + assert.Equal(t, iNative.Field(0).Interface(), iChecked.Field(0).Interface()) + assert.Equal(t, iNative.Field(1).Interface(), iChecked.Field(1).Interface()) + assert.Equal(t, iNative.Field(2).Interface(), f3) + assert.Equal(t, iNative.Field(3).Interface(), f4) + assertHaveSameStructureAndNames(t, iNative.Type(), entry.CheckedType()) + }) + + t.Run("tuples", func(t *testing.T) { + type1, err := abi.NewType("uint16", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + tupleType, err := abi.NewType("tuple", "", []abi.ArgumentMarshaling{ + {Name: "Field3", Type: "uint24"}, + {Name: "Field4", Type: "int24"}, + }) + require.NoError(t, err) + args := abi.Arguments{ + {Name: "Field1", Type: type1}, + {Name: "Field2", Type: tupleType}, + } + entry := NewCodecEntry(args, nil, nil) + require.NoError(t, entry.Init()) + + checked := reflect.New(entry.CheckedType()) + iChecked := reflect.Indirect(checked) + iChecked.FieldByName("Field1").Set(reflect.ValueOf(uint16(2))) + f2 := iChecked.FieldByName("Field2") + f3 := big.NewInt( /*2^24 - 1*/ 16777215) + setAndVerifyLimit(t, (*uint24)(f3), f3, f2.FieldByName("Field3")) + f4 := big.NewInt( /*2^23 - 1*/ 8388607) + setAndVerifyLimit(t, (*int24)(f4), f4, f2.FieldByName("Field4")) + + native, err := entry.ToNative(checked) + require.NoError(t, err) + iNative := reflect.Indirect(native) + require.Equal(t, iNative.Field(0).Interface(), iChecked.Field(0).Interface()) + nF2 := iNative.Field(1) + assert.Equal(t, nF2.Field(0).Interface(), f3) + assert.Equal(t, nF2.Field(1).Interface(), f4) + assertHaveSameStructureAndNames(t, iNative.Type(), entry.CheckedType()) + }) + + t.Run("unwrapped types", func(t *testing.T) { + // This exists to allow you to decode single returned values without naming the parameter + wrappedTuple, err := abi.NewType("tuple", "", []abi.ArgumentMarshaling{ + {Name: "Field1", Type: "int16"}, + }) + require.NoError(t, err) + entry := NewCodecEntry(abi.Arguments{{Name: "", Type: wrappedTuple}}, nil, nil) + require.NoError(t, entry.Init()) + checked := reflect.New(entry.CheckedType()) + iChecked := reflect.Indirect(checked) + anyValue := int16(2) + iChecked.FieldByName("Field1").Set(reflect.ValueOf(anyValue)) + native, err := entry.ToNative(checked) + require.NoError(t, err) + iNative := reflect.Indirect(native) + assert.Equal(t, anyValue, iNative.FieldByName("Field1").Interface()) + assertHaveSameStructureAndNames(t, iNative.Type(), entry.CheckedType()) + }) + + t.Run("slice types", func(t *testing.T) { + type1, err := abi.NewType("int16[]", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := NewCodecEntry(abi.Arguments{{Name: "Field1", Type: type1}}, nil, nil) + + require.NoError(t, entry.Init()) + checked := reflect.New(entry.CheckedType()) + iChecked := reflect.Indirect(checked) + anySliceValue := []int16{2, 3} + iChecked.FieldByName("Field1").Set(reflect.ValueOf(anySliceValue)) + native, err := entry.ToNative(checked) + require.NoError(t, err) + iNative := reflect.Indirect(native) + assert.Equal(t, anySliceValue, iNative.FieldByName("Field1").Interface()) + assertHaveSameStructureAndNames(t, iNative.Type(), entry.CheckedType()) + }) + + t.Run("array types", func(t *testing.T) { + type1, err := abi.NewType("int16[3]", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := NewCodecEntry(abi.Arguments{{Name: "Field1", Type: type1}}, nil, nil) + require.NoError(t, entry.Init()) + checked := reflect.New(entry.CheckedType()) + iChecked := reflect.Indirect(checked) + anySliceValue := [3]int16{2, 3, 30} + iChecked.FieldByName("Field1").Set(reflect.ValueOf(anySliceValue)) + native, err := entry.ToNative(checked) + require.NoError(t, err) + iNative := reflect.Indirect(native) + assert.Equal(t, anySliceValue, iNative.FieldByName("Field1").Interface()) + }) + + t.Run("Not return values makes struct{}", func(t *testing.T) { + entry := NewCodecEntry(abi.Arguments{}, nil, nil) + require.NoError(t, entry.Init()) + assert.Equal(t, reflect.TypeOf(struct{}{}), entry.CheckedType()) + native, err := entry.ToNative(reflect.ValueOf(&struct{}{})) + require.NoError(t, err) + assert.Equal(t, &struct{}{}, native.Interface()) + }) + + t.Run("Address works", func(t *testing.T) { + address, err := abi.NewType("address", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := NewCodecEntry(abi.Arguments{{Name: "foo", Type: address}}, nil, nil) + require.NoError(t, entry.Init()) + + checked := reflect.New(entry.CheckedType()) + iChecked := reflect.Indirect(checked) + anyAddr := common.Address{1, 2, 3} + iChecked.FieldByName("Foo").Set(reflect.ValueOf(anyAddr)) + + native, err := entry.ToNative(checked) + require.NoError(t, err) + iNative := reflect.Indirect(native) + assert.Equal(t, anyAddr, iNative.FieldByName("Foo").Interface()) + assertHaveSameStructureAndNames(t, iNative.Type(), entry.CheckedType()) + }) + + t.Run("Multiple unnamed parameters are not supported", func(t *testing.T) { + anyType, err := abi.NewType("int16[3]", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := NewCodecEntry(abi.Arguments{{Name: "", Type: anyType}, {Name: "", Type: anyType}}, nil, nil) + assert.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidType)) + }) + + t.Run("Multiple abi arguments with the same name returns an error", func(t *testing.T) { + anyType, err := abi.NewType("int16[3]", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := NewCodecEntry(abi.Arguments{{Name: "Name", Type: anyType}, {Name: "Name", Type: anyType}}, nil, nil) + assert.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidConfig)) + }) + + t.Run("Indexed basic types leave their native and checked types as-is", func(t *testing.T) { + anyType, err := abi.NewType("int16", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := NewCodecEntry(abi.Arguments{{Name: "Name", Type: anyType, Indexed: true}}, nil, nil) + require.NoError(t, entry.Init()) + checkedField, ok := entry.CheckedType().FieldByName("Name") + require.True(t, ok) + assert.Equal(t, reflect.TypeOf(int16(0)), checkedField.Type) + native, err := entry.ToNative(reflect.New(entry.CheckedType())) + require.NoError(t, err) + iNative := reflect.Indirect(native) + assertHaveSameStructureAndNames(t, iNative.Type(), entry.CheckedType()) + }) + + t.Run("Indexed non basic types change to hash", func(t *testing.T) { + anyType, err := abi.NewType("string", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := NewCodecEntry(abi.Arguments{{Name: "Name", Type: anyType, Indexed: true}}, nil, nil) + require.NoError(t, entry.Init()) + nativeField, ok := entry.CheckedType().FieldByName("Name") + require.True(t, ok) + assert.Equal(t, reflect.TypeOf(common.Hash{}), nativeField.Type) + native, err := entry.ToNative(reflect.New(entry.CheckedType())) + require.NoError(t, err) + assertHaveSameStructureAndNames(t, native.Type().Elem(), entry.CheckedType()) + }) + + t.Run("Too many indexed items returns an error", func(t *testing.T) { + anyType, err := abi.NewType("int16", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := NewCodecEntry( + abi.Arguments{ + {Name: "Name1", Type: anyType, Indexed: true}, + {Name: "Name2", Type: anyType, Indexed: true}, + {Name: "Name3", Type: anyType, Indexed: true}, + {Name: "Name4", Type: anyType, Indexed: true}, + }, nil, nil) + require.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidConfig)) + }) + + // TODO: when the TODO on + // https://github.com/ethereum/go-ethereum/blob/release/1.12/accounts/abi/topics.go#L78 + // is removed, remove this test. + t.Run("Using unsupported types by go-ethereum returns an error", func(t *testing.T) { + anyType, err := abi.NewType("int256[2]", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + entry := NewCodecEntry(abi.Arguments{{Name: "Name", Type: anyType, Indexed: true}}, nil, nil) + assert.True(t, errors.Is(entry.Init(), commontypes.ErrInvalidConfig)) + }) + + t.Run("Modifier returns provided modifier", func(t *testing.T) { + anyType, err := abi.NewType("int16", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + mod := codec.NewRenamer(map[string]string{"Name": "RenamedName"}) + entry := NewCodecEntry(abi.Arguments{{Name: "Name", Type: anyType, Indexed: true}}, nil, mod) + assert.Equal(t, mod, entry.Modifier()) + }) + + t.Run("EncodingPrefix returns provided prefix", func(t *testing.T) { + anyType, err := abi.NewType("int16", "", []abi.ArgumentMarshaling{}) + require.NoError(t, err) + prefix := []byte{1, 2, 3} + entry := NewCodecEntry(abi.Arguments{{Name: "Name", Type: anyType, Indexed: true}}, prefix, nil) + assert.Equal(t, prefix, entry.EncodingPrefix()) + }) +} + +// sized and bi must be the same pointer. +func setAndVerifyLimit(t *testing.T, sbi SizedBigInt, bi *big.Int, field reflect.Value) { + require.Same(t, reflect.NewAt(reflect.TypeOf(big.Int{}), reflect.ValueOf(sbi).UnsafePointer()).Interface(), bi) + field.Set(reflect.ValueOf(sbi)) + assert.NoError(t, sbi.Verify()) + bi.Add(bi, big.NewInt(1)) + assert.IsType(t, commontypes.ErrInvalidType, sbi.Verify()) +} + +// verifying the same structure allows us to use unsafe pointers to cast between them. +// This is done for perf and simplicity in mapping the two structures. +// [reflect.NewAt]'s use is the same as (*native)(unsafe.Pointer(checked)) +// See the safe usecase 1 from [unsafe.Pointer], as this is a subset of that. +// This also verifies field names are the same. +func assertHaveSameStructureAndNames(t *testing.T, t1, t2 reflect.Type) { + require.Equal(t, t1.Kind(), t2.Kind()) + + switch t1.Kind() { + case reflect.Array: + require.Equal(t, t1.Len(), t2.Len()) + assertHaveSameStructureAndNames(t, t1.Elem(), t2.Elem()) + case reflect.Slice, reflect.Pointer: + assertHaveSameStructureAndNames(t, t1.Elem(), t2.Elem()) + case reflect.Struct: + numFields := t1.NumField() + require.Equal(t, numFields, t2.NumField()) + for i := 0; i < numFields; i++ { + require.Equal(t, t1.Field(i).Name, t2.Field(i).Name) + assertHaveSameStructureAndNames(t, t1.Field(i).Type, t2.Field(i).Type) + } + default: + require.Equal(t, t1, t2) + } +} diff --git a/core/services/relay/evm/types/gen/bytes.tmpl b/core/services/relay/evm/types/gen/bytes.tmpl index 2414c412c64..3c06529b0f3 100644 --- a/core/services/relay/evm/types/gen/bytes.tmpl +++ b/core/services/relay/evm/types/gen/bytes.tmpl @@ -6,8 +6,8 @@ import "reflect" type bytes{{.Size}} [{{.Size}}]byte func init() { typeMap["bytes{{.Size}}"] = &ABIEncodingType { - Native: reflect.TypeOf([{{.Size}}]byte{}), - Checked: reflect.TypeOf(bytes{{.Size}}{}), + native: reflect.TypeOf([{{.Size}}]byte{}), + checked: reflect.TypeOf(bytes{{.Size}}{}), } } diff --git a/core/services/relay/evm/types/gen/ints.tmpl b/core/services/relay/evm/types/gen/ints.tmpl index 38c1fae03a6..b5f0fa363ca 100644 --- a/core/services/relay/evm/types/gen/ints.tmpl +++ b/core/services/relay/evm/types/gen/ints.tmpl @@ -5,7 +5,8 @@ import ( "reflect" "github.com/fxamacker/cbor/v2" - + + "github.com/smartcontractkit/chainlink-common/pkg/codec" "github.com/smartcontractkit/chainlink-common/pkg/types" ) @@ -55,7 +56,7 @@ func (i *{{.Prefix}}int{{.Size}}) Verify() error { return types.ErrInvalidType } {{ else }} - if bi.BitLen() > {{.Size}} { + if bi.BitLen() > {{.Size}} || bi.Sign() < 0 { return types.ErrInvalidType } {{ end }} @@ -66,8 +67,8 @@ func (i *{{.Prefix}}int{{.Size}}) private() {} func init() { typeMap["{{.Prefix}}int{{.Size}}"] = &ABIEncodingType { - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*{{.Prefix}}int{{.Size}})(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*{{.Prefix}}int{{.Size}})(nil)), } } {{ end }} \ No newline at end of file diff --git a/core/services/relay/evm/types/gen/main.go b/core/services/relay/evm/types/gen/main.go index 6253c6d282d..cdc1eab77e0 100644 --- a/core/services/relay/evm/types/gen/main.go +++ b/core/services/relay/evm/types/gen/main.go @@ -31,7 +31,7 @@ func genInts() { continue } - signed := &IntType{Size: i, Signed: false} + signed := &IntType{Size: i, Signed: true} unsigned := &IntType{Prefix: "u", Size: i} intTypes = append(intTypes, signed, unsigned) } diff --git a/core/services/relay/evm/types/int_types_gen.go b/core/services/relay/evm/types/int_types_gen.go index 0cc1471b37d..1ff82d5691d 100644 --- a/core/services/relay/evm/types/int_types_gen.go +++ b/core/services/relay/evm/types/int_types_gen.go @@ -6,6 +6,7 @@ import ( "github.com/fxamacker/cbor/v2" + "github.com/smartcontractkit/chainlink-common/pkg/codec" "github.com/smartcontractkit/chainlink-common/pkg/types" ) @@ -52,7 +53,7 @@ func (i *int24) MarshalText() ([]byte, error) { func (i *int24) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 24 { + if !codec.FitsInNBitsSigned(24, bi) { return types.ErrInvalidType } @@ -63,8 +64,8 @@ func (i *int24) private() {} func init() { typeMap["int24"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int24)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int24)(nil)), } } @@ -100,7 +101,7 @@ func (i *uint24) MarshalText() ([]byte, error) { func (i *uint24) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 24 { + if bi.BitLen() > 24 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -111,8 +112,8 @@ func (i *uint24) private() {} func init() { typeMap["uint24"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint24)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint24)(nil)), } } @@ -148,7 +149,7 @@ func (i *int40) MarshalText() ([]byte, error) { func (i *int40) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 40 { + if !codec.FitsInNBitsSigned(40, bi) { return types.ErrInvalidType } @@ -159,8 +160,8 @@ func (i *int40) private() {} func init() { typeMap["int40"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int40)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int40)(nil)), } } @@ -196,7 +197,7 @@ func (i *uint40) MarshalText() ([]byte, error) { func (i *uint40) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 40 { + if bi.BitLen() > 40 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -207,8 +208,8 @@ func (i *uint40) private() {} func init() { typeMap["uint40"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint40)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint40)(nil)), } } @@ -244,7 +245,7 @@ func (i *int48) MarshalText() ([]byte, error) { func (i *int48) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 48 { + if !codec.FitsInNBitsSigned(48, bi) { return types.ErrInvalidType } @@ -255,8 +256,8 @@ func (i *int48) private() {} func init() { typeMap["int48"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int48)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int48)(nil)), } } @@ -292,7 +293,7 @@ func (i *uint48) MarshalText() ([]byte, error) { func (i *uint48) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 48 { + if bi.BitLen() > 48 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -303,8 +304,8 @@ func (i *uint48) private() {} func init() { typeMap["uint48"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint48)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint48)(nil)), } } @@ -340,7 +341,7 @@ func (i *int56) MarshalText() ([]byte, error) { func (i *int56) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 56 { + if !codec.FitsInNBitsSigned(56, bi) { return types.ErrInvalidType } @@ -351,8 +352,8 @@ func (i *int56) private() {} func init() { typeMap["int56"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int56)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int56)(nil)), } } @@ -388,7 +389,7 @@ func (i *uint56) MarshalText() ([]byte, error) { func (i *uint56) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 56 { + if bi.BitLen() > 56 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -399,8 +400,8 @@ func (i *uint56) private() {} func init() { typeMap["uint56"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint56)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint56)(nil)), } } @@ -436,7 +437,7 @@ func (i *int72) MarshalText() ([]byte, error) { func (i *int72) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 72 { + if !codec.FitsInNBitsSigned(72, bi) { return types.ErrInvalidType } @@ -447,8 +448,8 @@ func (i *int72) private() {} func init() { typeMap["int72"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int72)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int72)(nil)), } } @@ -484,7 +485,7 @@ func (i *uint72) MarshalText() ([]byte, error) { func (i *uint72) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 72 { + if bi.BitLen() > 72 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -495,8 +496,8 @@ func (i *uint72) private() {} func init() { typeMap["uint72"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint72)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint72)(nil)), } } @@ -532,7 +533,7 @@ func (i *int80) MarshalText() ([]byte, error) { func (i *int80) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 80 { + if !codec.FitsInNBitsSigned(80, bi) { return types.ErrInvalidType } @@ -543,8 +544,8 @@ func (i *int80) private() {} func init() { typeMap["int80"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int80)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int80)(nil)), } } @@ -580,7 +581,7 @@ func (i *uint80) MarshalText() ([]byte, error) { func (i *uint80) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 80 { + if bi.BitLen() > 80 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -591,8 +592,8 @@ func (i *uint80) private() {} func init() { typeMap["uint80"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint80)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint80)(nil)), } } @@ -628,7 +629,7 @@ func (i *int88) MarshalText() ([]byte, error) { func (i *int88) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 88 { + if !codec.FitsInNBitsSigned(88, bi) { return types.ErrInvalidType } @@ -639,8 +640,8 @@ func (i *int88) private() {} func init() { typeMap["int88"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int88)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int88)(nil)), } } @@ -676,7 +677,7 @@ func (i *uint88) MarshalText() ([]byte, error) { func (i *uint88) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 88 { + if bi.BitLen() > 88 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -687,8 +688,8 @@ func (i *uint88) private() {} func init() { typeMap["uint88"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint88)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint88)(nil)), } } @@ -724,7 +725,7 @@ func (i *int96) MarshalText() ([]byte, error) { func (i *int96) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 96 { + if !codec.FitsInNBitsSigned(96, bi) { return types.ErrInvalidType } @@ -735,8 +736,8 @@ func (i *int96) private() {} func init() { typeMap["int96"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int96)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int96)(nil)), } } @@ -772,7 +773,7 @@ func (i *uint96) MarshalText() ([]byte, error) { func (i *uint96) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 96 { + if bi.BitLen() > 96 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -783,8 +784,8 @@ func (i *uint96) private() {} func init() { typeMap["uint96"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint96)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint96)(nil)), } } @@ -820,7 +821,7 @@ func (i *int104) MarshalText() ([]byte, error) { func (i *int104) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 104 { + if !codec.FitsInNBitsSigned(104, bi) { return types.ErrInvalidType } @@ -831,8 +832,8 @@ func (i *int104) private() {} func init() { typeMap["int104"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int104)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int104)(nil)), } } @@ -868,7 +869,7 @@ func (i *uint104) MarshalText() ([]byte, error) { func (i *uint104) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 104 { + if bi.BitLen() > 104 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -879,8 +880,8 @@ func (i *uint104) private() {} func init() { typeMap["uint104"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint104)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint104)(nil)), } } @@ -916,7 +917,7 @@ func (i *int112) MarshalText() ([]byte, error) { func (i *int112) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 112 { + if !codec.FitsInNBitsSigned(112, bi) { return types.ErrInvalidType } @@ -927,8 +928,8 @@ func (i *int112) private() {} func init() { typeMap["int112"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int112)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int112)(nil)), } } @@ -964,7 +965,7 @@ func (i *uint112) MarshalText() ([]byte, error) { func (i *uint112) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 112 { + if bi.BitLen() > 112 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -975,8 +976,8 @@ func (i *uint112) private() {} func init() { typeMap["uint112"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint112)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint112)(nil)), } } @@ -1012,7 +1013,7 @@ func (i *int120) MarshalText() ([]byte, error) { func (i *int120) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 120 { + if !codec.FitsInNBitsSigned(120, bi) { return types.ErrInvalidType } @@ -1023,8 +1024,8 @@ func (i *int120) private() {} func init() { typeMap["int120"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int120)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int120)(nil)), } } @@ -1060,7 +1061,7 @@ func (i *uint120) MarshalText() ([]byte, error) { func (i *uint120) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 120 { + if bi.BitLen() > 120 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -1071,8 +1072,8 @@ func (i *uint120) private() {} func init() { typeMap["uint120"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint120)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint120)(nil)), } } @@ -1108,7 +1109,7 @@ func (i *int128) MarshalText() ([]byte, error) { func (i *int128) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 128 { + if !codec.FitsInNBitsSigned(128, bi) { return types.ErrInvalidType } @@ -1119,8 +1120,8 @@ func (i *int128) private() {} func init() { typeMap["int128"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int128)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int128)(nil)), } } @@ -1156,7 +1157,7 @@ func (i *uint128) MarshalText() ([]byte, error) { func (i *uint128) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 128 { + if bi.BitLen() > 128 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -1167,8 +1168,8 @@ func (i *uint128) private() {} func init() { typeMap["uint128"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint128)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint128)(nil)), } } @@ -1204,7 +1205,7 @@ func (i *int136) MarshalText() ([]byte, error) { func (i *int136) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 136 { + if !codec.FitsInNBitsSigned(136, bi) { return types.ErrInvalidType } @@ -1215,8 +1216,8 @@ func (i *int136) private() {} func init() { typeMap["int136"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int136)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int136)(nil)), } } @@ -1252,7 +1253,7 @@ func (i *uint136) MarshalText() ([]byte, error) { func (i *uint136) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 136 { + if bi.BitLen() > 136 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -1263,8 +1264,8 @@ func (i *uint136) private() {} func init() { typeMap["uint136"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint136)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint136)(nil)), } } @@ -1300,7 +1301,7 @@ func (i *int144) MarshalText() ([]byte, error) { func (i *int144) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 144 { + if !codec.FitsInNBitsSigned(144, bi) { return types.ErrInvalidType } @@ -1311,8 +1312,8 @@ func (i *int144) private() {} func init() { typeMap["int144"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int144)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int144)(nil)), } } @@ -1348,7 +1349,7 @@ func (i *uint144) MarshalText() ([]byte, error) { func (i *uint144) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 144 { + if bi.BitLen() > 144 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -1359,8 +1360,8 @@ func (i *uint144) private() {} func init() { typeMap["uint144"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint144)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint144)(nil)), } } @@ -1396,7 +1397,7 @@ func (i *int152) MarshalText() ([]byte, error) { func (i *int152) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 152 { + if !codec.FitsInNBitsSigned(152, bi) { return types.ErrInvalidType } @@ -1407,8 +1408,8 @@ func (i *int152) private() {} func init() { typeMap["int152"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int152)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int152)(nil)), } } @@ -1444,7 +1445,7 @@ func (i *uint152) MarshalText() ([]byte, error) { func (i *uint152) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 152 { + if bi.BitLen() > 152 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -1455,8 +1456,8 @@ func (i *uint152) private() {} func init() { typeMap["uint152"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint152)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint152)(nil)), } } @@ -1492,7 +1493,7 @@ func (i *int160) MarshalText() ([]byte, error) { func (i *int160) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 160 { + if !codec.FitsInNBitsSigned(160, bi) { return types.ErrInvalidType } @@ -1503,8 +1504,8 @@ func (i *int160) private() {} func init() { typeMap["int160"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int160)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int160)(nil)), } } @@ -1540,7 +1541,7 @@ func (i *uint160) MarshalText() ([]byte, error) { func (i *uint160) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 160 { + if bi.BitLen() > 160 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -1551,8 +1552,8 @@ func (i *uint160) private() {} func init() { typeMap["uint160"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint160)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint160)(nil)), } } @@ -1588,7 +1589,7 @@ func (i *int168) MarshalText() ([]byte, error) { func (i *int168) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 168 { + if !codec.FitsInNBitsSigned(168, bi) { return types.ErrInvalidType } @@ -1599,8 +1600,8 @@ func (i *int168) private() {} func init() { typeMap["int168"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int168)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int168)(nil)), } } @@ -1636,7 +1637,7 @@ func (i *uint168) MarshalText() ([]byte, error) { func (i *uint168) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 168 { + if bi.BitLen() > 168 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -1647,8 +1648,8 @@ func (i *uint168) private() {} func init() { typeMap["uint168"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint168)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint168)(nil)), } } @@ -1684,7 +1685,7 @@ func (i *int176) MarshalText() ([]byte, error) { func (i *int176) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 176 { + if !codec.FitsInNBitsSigned(176, bi) { return types.ErrInvalidType } @@ -1695,8 +1696,8 @@ func (i *int176) private() {} func init() { typeMap["int176"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int176)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int176)(nil)), } } @@ -1732,7 +1733,7 @@ func (i *uint176) MarshalText() ([]byte, error) { func (i *uint176) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 176 { + if bi.BitLen() > 176 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -1743,8 +1744,8 @@ func (i *uint176) private() {} func init() { typeMap["uint176"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint176)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint176)(nil)), } } @@ -1780,7 +1781,7 @@ func (i *int184) MarshalText() ([]byte, error) { func (i *int184) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 184 { + if !codec.FitsInNBitsSigned(184, bi) { return types.ErrInvalidType } @@ -1791,8 +1792,8 @@ func (i *int184) private() {} func init() { typeMap["int184"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int184)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int184)(nil)), } } @@ -1828,7 +1829,7 @@ func (i *uint184) MarshalText() ([]byte, error) { func (i *uint184) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 184 { + if bi.BitLen() > 184 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -1839,8 +1840,8 @@ func (i *uint184) private() {} func init() { typeMap["uint184"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint184)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint184)(nil)), } } @@ -1876,7 +1877,7 @@ func (i *int192) MarshalText() ([]byte, error) { func (i *int192) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 192 { + if !codec.FitsInNBitsSigned(192, bi) { return types.ErrInvalidType } @@ -1887,8 +1888,8 @@ func (i *int192) private() {} func init() { typeMap["int192"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int192)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int192)(nil)), } } @@ -1924,7 +1925,7 @@ func (i *uint192) MarshalText() ([]byte, error) { func (i *uint192) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 192 { + if bi.BitLen() > 192 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -1935,8 +1936,8 @@ func (i *uint192) private() {} func init() { typeMap["uint192"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint192)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint192)(nil)), } } @@ -1972,7 +1973,7 @@ func (i *int200) MarshalText() ([]byte, error) { func (i *int200) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 200 { + if !codec.FitsInNBitsSigned(200, bi) { return types.ErrInvalidType } @@ -1983,8 +1984,8 @@ func (i *int200) private() {} func init() { typeMap["int200"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int200)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int200)(nil)), } } @@ -2020,7 +2021,7 @@ func (i *uint200) MarshalText() ([]byte, error) { func (i *uint200) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 200 { + if bi.BitLen() > 200 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -2031,8 +2032,8 @@ func (i *uint200) private() {} func init() { typeMap["uint200"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint200)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint200)(nil)), } } @@ -2068,7 +2069,7 @@ func (i *int208) MarshalText() ([]byte, error) { func (i *int208) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 208 { + if !codec.FitsInNBitsSigned(208, bi) { return types.ErrInvalidType } @@ -2079,8 +2080,8 @@ func (i *int208) private() {} func init() { typeMap["int208"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int208)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int208)(nil)), } } @@ -2116,7 +2117,7 @@ func (i *uint208) MarshalText() ([]byte, error) { func (i *uint208) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 208 { + if bi.BitLen() > 208 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -2127,8 +2128,8 @@ func (i *uint208) private() {} func init() { typeMap["uint208"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint208)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint208)(nil)), } } @@ -2164,7 +2165,7 @@ func (i *int216) MarshalText() ([]byte, error) { func (i *int216) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 216 { + if !codec.FitsInNBitsSigned(216, bi) { return types.ErrInvalidType } @@ -2175,8 +2176,8 @@ func (i *int216) private() {} func init() { typeMap["int216"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int216)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int216)(nil)), } } @@ -2212,7 +2213,7 @@ func (i *uint216) MarshalText() ([]byte, error) { func (i *uint216) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 216 { + if bi.BitLen() > 216 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -2223,8 +2224,8 @@ func (i *uint216) private() {} func init() { typeMap["uint216"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint216)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint216)(nil)), } } @@ -2260,7 +2261,7 @@ func (i *int224) MarshalText() ([]byte, error) { func (i *int224) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 224 { + if !codec.FitsInNBitsSigned(224, bi) { return types.ErrInvalidType } @@ -2271,8 +2272,8 @@ func (i *int224) private() {} func init() { typeMap["int224"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int224)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int224)(nil)), } } @@ -2308,7 +2309,7 @@ func (i *uint224) MarshalText() ([]byte, error) { func (i *uint224) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 224 { + if bi.BitLen() > 224 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -2319,8 +2320,8 @@ func (i *uint224) private() {} func init() { typeMap["uint224"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint224)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint224)(nil)), } } @@ -2356,7 +2357,7 @@ func (i *int232) MarshalText() ([]byte, error) { func (i *int232) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 232 { + if !codec.FitsInNBitsSigned(232, bi) { return types.ErrInvalidType } @@ -2367,8 +2368,8 @@ func (i *int232) private() {} func init() { typeMap["int232"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int232)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int232)(nil)), } } @@ -2404,7 +2405,7 @@ func (i *uint232) MarshalText() ([]byte, error) { func (i *uint232) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 232 { + if bi.BitLen() > 232 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -2415,8 +2416,8 @@ func (i *uint232) private() {} func init() { typeMap["uint232"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint232)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint232)(nil)), } } @@ -2452,7 +2453,7 @@ func (i *int240) MarshalText() ([]byte, error) { func (i *int240) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 240 { + if !codec.FitsInNBitsSigned(240, bi) { return types.ErrInvalidType } @@ -2463,8 +2464,8 @@ func (i *int240) private() {} func init() { typeMap["int240"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int240)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int240)(nil)), } } @@ -2500,7 +2501,7 @@ func (i *uint240) MarshalText() ([]byte, error) { func (i *uint240) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 240 { + if bi.BitLen() > 240 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -2511,8 +2512,8 @@ func (i *uint240) private() {} func init() { typeMap["uint240"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint240)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint240)(nil)), } } @@ -2548,7 +2549,7 @@ func (i *int248) MarshalText() ([]byte, error) { func (i *int248) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 248 { + if !codec.FitsInNBitsSigned(248, bi) { return types.ErrInvalidType } @@ -2559,8 +2560,8 @@ func (i *int248) private() {} func init() { typeMap["int248"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int248)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int248)(nil)), } } @@ -2596,7 +2597,7 @@ func (i *uint248) MarshalText() ([]byte, error) { func (i *uint248) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 248 { + if bi.BitLen() > 248 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -2607,8 +2608,8 @@ func (i *uint248) private() {} func init() { typeMap["uint248"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint248)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint248)(nil)), } } @@ -2644,7 +2645,7 @@ func (i *int256) MarshalText() ([]byte, error) { func (i *int256) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 256 { + if !codec.FitsInNBitsSigned(256, bi) { return types.ErrInvalidType } @@ -2655,8 +2656,8 @@ func (i *int256) private() {} func init() { typeMap["int256"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*int256)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*int256)(nil)), } } @@ -2692,7 +2693,7 @@ func (i *uint256) MarshalText() ([]byte, error) { func (i *uint256) Verify() error { bi := (*big.Int)(i) - if bi.BitLen() > 256 { + if bi.BitLen() > 256 || bi.Sign() < 0 { return types.ErrInvalidType } @@ -2703,7 +2704,7 @@ func (i *uint256) private() {} func init() { typeMap["uint256"] = &ABIEncodingType{ - Native: reflect.TypeOf((*big.Int)(nil)), - Checked: reflect.TypeOf((*uint256)(nil)), + native: reflect.TypeOf((*big.Int)(nil)), + checked: reflect.TypeOf((*uint256)(nil)), } } diff --git a/core/services/relay/evm/types/int_types_test.go b/core/services/relay/evm/types/int_types_test.go new file mode 100644 index 00000000000..1227773ce90 --- /dev/null +++ b/core/services/relay/evm/types/int_types_test.go @@ -0,0 +1,54 @@ +package types + +import ( + "fmt" + "math/big" + "reflect" + "testing" + + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink-common/pkg/types" +) + +func TestIntTypes(t *testing.T) { + t.Parallel() + for i := 24; i <= 256; i += 8 { + if i == 64 || i == 32 { + continue + } + t.Run(fmt.Sprintf("int%v", i), func(t *testing.T) { + tpe, ok := GetAbiEncodingType(fmt.Sprintf("int%v", i)) + require.True(t, ok) + minVal := new(big.Int).Neg(new(big.Int).Exp(big.NewInt(2), big.NewInt(int64(i-1)), nil)) + maxVal := new(big.Int).Sub(new(big.Int).Exp(big.NewInt(2), big.NewInt(int64(i-1)), nil), big.NewInt(1)) + assertBigIntBounds(t, tpe, minVal, maxVal) + }) + + t.Run(fmt.Sprintf("uint%v", i), func(t *testing.T) { + tep, ok := GetAbiEncodingType(fmt.Sprintf("uint%v", i)) + require.True(t, ok) + minVal := big.NewInt(0) + maxVal := new(big.Int).Sub(new(big.Int).Exp(big.NewInt(2), big.NewInt(int64(i)), nil), big.NewInt(1)) + assertBigIntBounds(t, tep, minVal, maxVal) + }) + } +} + +func assertBigIntBounds(t *testing.T, tpe *ABIEncodingType, min, max *big.Int) { + t.Helper() + assert.Equal(t, reflect.TypeOf(min), tpe.native) + assert.True(t, tpe.checked.ConvertibleTo(reflect.TypeOf(min))) + minMinusOne := new(big.Int).Sub(min, big.NewInt(1)) + maxPlusOne := new(big.Int).Add(max, big.NewInt(1)) + sbi := reflect.ValueOf(min).Convert(tpe.checked).Interface().(SizedBigInt) + assert.NoError(t, sbi.Verify()) + sbi = reflect.ValueOf(max).Convert(tpe.checked).Interface().(SizedBigInt) + assert.NoError(t, sbi.Verify()) + sbi = reflect.ValueOf(minMinusOne).Convert(tpe.checked).Interface().(SizedBigInt) + assert.True(t, errors.Is(types.ErrInvalidType, sbi.Verify())) + sbi = reflect.ValueOf(maxPlusOne).Convert(tpe.checked).Interface().(SizedBigInt) + assert.True(t, errors.Is(types.ErrInvalidType, sbi.Verify())) +} diff --git a/core/services/relay/evm/size_helper.go b/core/services/relay/evm/types/size_helper.go similarity index 99% rename from core/services/relay/evm/size_helper.go rename to core/services/relay/evm/types/size_helper.go index c6ff3d82f38..921b8a28315 100644 --- a/core/services/relay/evm/size_helper.go +++ b/core/services/relay/evm/types/size_helper.go @@ -1,4 +1,4 @@ -package evm +package types import ( "github.com/ethereum/go-ethereum/accounts/abi" diff --git a/core/services/relay/evm/size_helper_test.go b/core/services/relay/evm/types/size_helper_test.go similarity index 97% rename from core/services/relay/evm/size_helper_test.go rename to core/services/relay/evm/types/size_helper_test.go index 0368f0f4059..202269a4536 100644 --- a/core/services/relay/evm/size_helper_test.go +++ b/core/services/relay/evm/types/size_helper_test.go @@ -1,4 +1,4 @@ -package evm_test +package types_test import ( "math/big" @@ -10,7 +10,7 @@ import ( commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" - "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" ) const anyNumElements = 10 @@ -189,12 +189,12 @@ func TestGetMaxSize(t *testing.T) { t.Run("Nested dynamic types return errors", func(t *testing.T) { t.Run("Slice in slice", func(t *testing.T) { args := abi.Arguments{{Name: "B", Type: mustType(t, "int32[][]")}} - _, err := evm.GetMaxSize(anyNumElements, args) + _, err := types.GetMaxSize(anyNumElements, args) assert.IsType(t, commontypes.ErrInvalidType, err) }) t.Run("Slice in array", func(t *testing.T) { args := abi.Arguments{{Name: "B", Type: mustType(t, "int32[][2]")}} - _, err := evm.GetMaxSize(anyNumElements, args) + _, err := types.GetMaxSize(anyNumElements, args) assert.IsType(t, commontypes.ErrInvalidType, err) }) }) @@ -237,14 +237,14 @@ func TestGetMaxSize(t *testing.T) { require.NoError(t, err) args := abi.Arguments{{Name: "t2", Type: t2}} - _, err = evm.GetMaxSize(anyNumElements, args) + _, err = types.GetMaxSize(anyNumElements, args) assert.IsType(t, commontypes.ErrInvalidType, err) }) } func runSizeTest(t *testing.T, n int, args abi.Arguments, params ...any) { - actual, err := evm.GetMaxSize(n, args) + actual, err := types.GetMaxSize(n, args) require.NoError(t, err) expected, err := args.Pack(params...) diff --git a/go.mod b/go.mod index bb7b5147c04..b64aea78ffe 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 diff --git a/go.sum b/go.sum index a9e955eb503..74f647919fd 100644 --- a/go.sum +++ b/go.sum @@ -1150,8 +1150,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f h1:7904h45vNBT+IVO7PMcucvNXSIS9ilf2cxf+RMYb7zs= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5 h1:o36okzBAbWhlxKrIeb66Iw/U7Uy3j4FsPGQREb06SUo= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index e85c4569e1a..506277689dd 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -25,7 +25,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5 github.com/smartcontractkit/chainlink-testing-framework v1.22.1 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 63a8c1de756..fab47ad1182 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1481,8 +1481,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f h1:7904h45vNBT+IVO7PMcucvNXSIS9ilf2cxf+RMYb7zs= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240115191717-1e2676fced3f/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5 h1:o36okzBAbWhlxKrIeb66Iw/U7Uy3j4FsPGQREb06SUo= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From d5c1100d0075848be4bb15311948f1d34663ed44 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Tue, 16 Jan 2024 15:27:40 -0600 Subject: [PATCH 091/112] Chain Reader config improvements (#11679) * core/services/job: remove JSONConfig.Bytes hack * Shorten chain reader cfg abi in median test, change readType string * minimize abi; pretty formatting; use text marshaller * integrations-tests/client: use TOML for relayconfig * minimize chain reader median contract abi in features ocr2 test * pretty ABI JSON * add ModifiersConfig wrapper to include type field * fix TestOCR2TaskJobSpec_String --------- Co-authored-by: ilija --- .../features/ocr2/features_ocr2_test.go | 127 +++++++++++- core/services/job/models.go | 24 +-- core/services/job/models_test.go | 190 ++++++++++++++++++ core/services/job/testdata/compact.toml | 34 ++++ core/services/job/testdata/pretty.toml | 149 ++++++++++++++ core/services/relay/evm/chain_reader.go | 10 +- core/services/relay/evm/chain_reader_test.go | 6 +- core/services/relay/evm/codec.go | 4 +- core/services/relay/evm/codec_test.go | 8 +- core/services/relay/evm/types/types.go | 85 ++++++-- .../actions/ocr2_helpers_local.go | 38 +++- integration-tests/client/chainlink_models.go | 43 ++-- .../client/chainlink_models_test.go | 135 +++++++++++++ 13 files changed, 773 insertions(+), 80 deletions(-) create mode 100644 core/services/job/testdata/compact.toml create mode 100644 core/services/job/testdata/pretty.toml create mode 100644 integration-tests/client/chainlink_models_test.go diff --git a/core/internal/features/ocr2/features_ocr2_test.go b/core/internal/features/ocr2/features_ocr2_test.go index 9a1a6d7537d..8ecc529ba2b 100644 --- a/core/internal/features/ocr2/features_ocr2_test.go +++ b/core/internal/features/ocr2/features_ocr2_test.go @@ -314,8 +314,126 @@ fromBlock = %d var chainReaderSpec string if test.chainReaderAndCodec { chainReaderSpec = ` -chainReader = '{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0, "output_modifications":[{"type" : "epoch to time", "fields" : ["LatestTimestamp_"]},{"type":"rename","fields":{"LatestAnswer_":"LatestAnswer","LatestTimestamp_":"LatestTimestamp"}}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}' -codec = '{"chainCodecConfig" :{"MedianReport":{"TypeAbi": "[{\"Name\": \"Timestamp\",\"Type\": \"uint32\"},{\"Name\": \"Observers\",\"Type\": \"bytes32\"},{\"Name\": \"Observations\",\"Type\": \"int192[]\"},{\"Name\": \"JuelsPerFeeCoin\",\"Type\": \"int192\"}]"}}}'` +[relayConfig.chainReader.contracts.median] +contractABI = ''' +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "requester", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "configDigest", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "round", + "type": "uint8" + } + ], + "name": "RoundRequested", + "type": "event" + }, + { + "inputs": [], + "name": "latestTransmissionDetails", + "outputs": [ + { + "internalType": "bytes32", + "name": "configDigest", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + }, + { + "internalType": "uint8", + "name": "round", + "type": "uint8" + }, + { + "internalType": "int192", + "name": "latestAnswer_", + "type": "int192" + }, + { + "internalType": "uint64", + "name": "latestTimestamp_", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + } +] +''' + +[relayConfig.chainReader.contracts.median.configs] +LatestRoundRequested = ''' +{ + "chainSpecificName": "RoundRequested", + "readType": "event" +} +''' +LatestTransmissionDetails = ''' +{ + "chainSpecificName": "latestTransmissionDetails", + "output_modifications": [ + { + "Fields": [ + "LatestTimestamp_" + ], + "type": "epoch to time" + }, + { + "Fields": { + "LatestAnswer_": "LatestAnswer", + "LatestTimestamp_": "LatestTimestamp" + }, + "type": "rename" + } + ] +} +''' + +[relayConfig.codec.configs.MedianReport] +typeABI = ''' +[ + { + "Name": "Timestamp", + "Type": "uint32" + }, + { + "Name": "Observers", + "Type": "bytes32" + }, + { + "Name": "Observations", + "Type": "int192[]" + }, + { + "Name": "JuelsPerFeeCoin", + "Type": "int192" + } +] +''' +` } ocrJob, err := validate.ValidatedOracleSpecToml(apps[i].Config.OCR2(), apps[i].Config.Insecure(), fmt.Sprintf(` type = "offchainreporting2" @@ -344,9 +462,12 @@ observationSource = """ answer1 [type=median index=0]; """ + [relayConfig] chainID = 1337 -fromBlock = %d%s +fromBlock = %d +%s + [pluginConfig] juelsPerFeeCoinSource = """ // data source 1 diff --git a/core/services/job/models.go b/core/services/job/models.go index e6e8fb631c3..17bac545be1 100644 --- a/core/services/job/models.go +++ b/core/services/job/models.go @@ -277,26 +277,13 @@ func (s *OCROracleSpec) SetID(value string) error { return nil } -// JSONConfig is a Go mapping for JSON based database properties. +// JSONConfig is a map for config properties which are encoded as JSON in the database by implementing +// sql.Scanner and driver.Valuer. type JSONConfig map[string]interface{} // Bytes returns the raw bytes func (r JSONConfig) Bytes() []byte { - var retCopy = make(JSONConfig, len(r)) - for key, value := range r { - copiedVal := value - // If the value is a json structure string, unmarshal it to preserve JSON structure - // e.g. instead of this {"key":"{\"nestedKey\":{\"nestedValue\":123}}"} - // we want this {"key":{"nestedKey":{"nestedValue":123}}}, - if strValue, ok := copiedVal.(string); ok { - if object, ok := asObject(strValue); ok { - copiedVal = object - } - } - retCopy[key] = copiedVal - } - - b, _ := json.Marshal(retCopy) + b, _ := json.Marshal(r) return b } @@ -326,11 +313,6 @@ func (r JSONConfig) MercuryCredentialName() (string, error) { return name, nil } -func asObject(s string) (any, bool) { - var js map[string]interface{} - return js, json.Unmarshal([]byte(s), &js) == nil -} - var ForwardersSupportedPlugins = []types.OCR2PluginType{types.Median, types.DKG, types.OCR2VRF, types.OCR2Keeper, types.Functions} // OCR2OracleSpec defines the job spec for OCR2 jobs. diff --git a/core/services/job/models_test.go b/core/services/job/models_test.go index ddbb815e730..fa15e3b1b22 100644 --- a/core/services/job/models_test.go +++ b/core/services/job/models_test.go @@ -1,10 +1,20 @@ package job import ( + _ "embed" "reflect" "testing" + "time" + "github.com/pelletier/go-toml/v2" + "github.com/stretchr/testify/require" + "gopkg.in/guregu/null.v4" + + "github.com/smartcontractkit/chainlink-common/pkg/codec" + "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink/v2/core/services/relay" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" + "github.com/smartcontractkit/chainlink/v2/core/store/models" ) func TestOCR2OracleSpec_RelayIdentifier(t *testing.T) { @@ -71,3 +81,183 @@ func TestOCR2OracleSpec_RelayIdentifier(t *testing.T) { }) } } + +var ( + //go:embed testdata/compact.toml + compact string + //go:embed testdata/pretty.toml + pretty string +) + +func TestOCR2OracleSpec(t *testing.T) { + val := OCR2OracleSpec{ + Relay: relay.EVM, + PluginType: types.Median, + ContractID: "foo", + OCRKeyBundleID: null.StringFrom("bar"), + TransmitterID: null.StringFrom("baz"), + ContractConfigConfirmations: 1, + ContractConfigTrackerPollInterval: *models.NewInterval(time.Second), + RelayConfig: map[string]interface{}{ + "chainID": 1337, + "fromBlock": 42, + "chainReader": evmtypes.ChainReaderConfig{ + Contracts: map[string]evmtypes.ChainContractReader{ + "median": { + ContractABI: `[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "requester", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "configDigest", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "round", + "type": "uint8" + } + ], + "name": "RoundRequested", + "type": "event" + }, + { + "inputs": [], + "name": "latestTransmissionDetails", + "outputs": [ + { + "internalType": "bytes32", + "name": "configDigest", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + }, + { + "internalType": "uint8", + "name": "round", + "type": "uint8" + }, + { + "internalType": "int192", + "name": "latestAnswer_", + "type": "int192" + }, + { + "internalType": "uint64", + "name": "latestTimestamp_", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + } +] +`, + Configs: map[string]*evmtypes.ChainReaderDefinition{ + "LatestTransmissionDetails": { + ChainSpecificName: "latestTransmissionDetails", + OutputModifications: codec.ModifiersConfig{ + &codec.EpochToTimeModifierConfig{ + Fields: []string{"LatestTimestamp_"}, + }, + &codec.RenameModifierConfig{ + Fields: map[string]string{ + "LatestAnswer_": "LatestAnswer", + "LatestTimestamp_": "LatestTimestamp", + }, + }, + }, + }, + "LatestRoundRequested": { + ChainSpecificName: "RoundRequested", + ReadType: evmtypes.Event, + }, + }, + }, + }, + }, + "codec": evmtypes.CodecConfig{ + Configs: map[string]evmtypes.ChainCodecConfig{ + "MedianReport": { + TypeABI: `[ + { + "Name": "Timestamp", + "Type": "uint32" + }, + { + "Name": "Observers", + "Type": "bytes32" + }, + { + "Name": "Observations", + "Type": "int192[]" + }, + { + "Name": "JuelsPerFeeCoin", + "Type": "int192" + } +] +`, + }, + }, + }, + }, + PluginConfig: map[string]interface{}{"juelsPerFeeCoinSource": ` // data source 1 + ds1 [type=bridge name="%s"]; + ds1_parse [type=jsonparse path="data"]; + ds1_multiply [type=multiply times=2]; + + // data source 2 + ds2 [type=http method=GET url="%s"]; + ds2_parse [type=jsonparse path="data"]; + ds2_multiply [type=multiply times=2]; + + ds1 -> ds1_parse -> ds1_multiply -> answer1; + ds2 -> ds2_parse -> ds2_multiply -> answer1; + + answer1 [type=median index=0]; +`, + }, + } + + t.Run("marshal", func(t *testing.T) { + gotB, err := toml.Marshal(val) + require.NoError(t, err) + t.Log("marshaled:", string(gotB)) + require.Equal(t, compact, string(gotB)) + }) + + t.Run("round-trip", func(t *testing.T) { + var gotVal OCR2OracleSpec + require.NoError(t, toml.Unmarshal([]byte(compact), &gotVal)) + gotB, err := toml.Marshal(gotVal) + require.NoError(t, err) + require.Equal(t, compact, string(gotB)) + t.Run("pretty", func(t *testing.T) { + var gotVal OCR2OracleSpec + require.NoError(t, toml.Unmarshal([]byte(pretty), &gotVal)) + gotB, err := toml.Marshal(gotVal) + require.NoError(t, err) + t.Log("marshaled compact:", string(gotB)) + require.Equal(t, compact, string(gotB)) + }) + }) +} diff --git a/core/services/job/testdata/compact.toml b/core/services/job/testdata/compact.toml new file mode 100644 index 00000000000..10f9fdf0875 --- /dev/null +++ b/core/services/job/testdata/compact.toml @@ -0,0 +1,34 @@ +contractID = 'foo' +relay = 'evm' +chainID = '' +p2pv2Bootstrappers = [] +ocrKeyBundleID = 'bar' +monitoringEndpoint = '' +transmitterID = 'baz' +blockchainTimeout = '0s' +contractConfigTrackerPollInterval = '1s' +contractConfigConfirmations = 1 +pluginType = 'median' +captureEATelemetry = false +captureAutomationCustomTelemetry = false + +[relayConfig] +chainID = 1337 +fromBlock = 42 + +[relayConfig.chainReader] +[relayConfig.chainReader.contracts] +[relayConfig.chainReader.contracts.median] +contractABI = "[\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"internalType\": \"address\",\n \"name\": \"requester\",\n \"type\": \"address\"\n },\n {\n \"indexed\": false,\n \"internalType\": \"bytes32\",\n \"name\": \"configDigest\",\n \"type\": \"bytes32\"\n },\n {\n \"indexed\": false,\n \"internalType\": \"uint32\",\n \"name\": \"epoch\",\n \"type\": \"uint32\"\n },\n {\n \"indexed\": false,\n \"internalType\": \"uint8\",\n \"name\": \"round\",\n \"type\": \"uint8\"\n }\n ],\n \"name\": \"RoundRequested\",\n \"type\": \"event\"\n },\n {\n \"inputs\": [],\n \"name\": \"latestTransmissionDetails\",\n \"outputs\": [\n {\n \"internalType\": \"bytes32\",\n \"name\": \"configDigest\",\n \"type\": \"bytes32\"\n },\n {\n \"internalType\": \"uint32\",\n \"name\": \"epoch\",\n \"type\": \"uint32\"\n },\n {\n \"internalType\": \"uint8\",\n \"name\": \"round\",\n \"type\": \"uint8\"\n },\n {\n \"internalType\": \"int192\",\n \"name\": \"latestAnswer_\",\n \"type\": \"int192\"\n },\n {\n \"internalType\": \"uint64\",\n \"name\": \"latestTimestamp_\",\n \"type\": \"uint64\"\n }\n ],\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n }\n]\n" + +[relayConfig.chainReader.contracts.median.configs] +LatestRoundRequested = "{\n \"chainSpecificName\": \"RoundRequested\",\n \"readType\": \"event\"\n}\n" +LatestTransmissionDetails = "{\n \"chainSpecificName\": \"latestTransmissionDetails\",\n \"output_modifications\": [\n {\n \"Fields\": [\n \"LatestTimestamp_\"\n ],\n \"Type\": \"epoch to time\"\n },\n {\n \"Fields\": {\n \"LatestAnswer_\": \"LatestAnswer\",\n \"LatestTimestamp_\": \"LatestTimestamp\"\n },\n \"Type\": \"rename\"\n }\n ]\n}\n" + +[relayConfig.codec] +[relayConfig.codec.configs] +[relayConfig.codec.configs.MedianReport] +typeABI = "[\n {\n \"Name\": \"Timestamp\",\n \"Type\": \"uint32\"\n },\n {\n \"Name\": \"Observers\",\n \"Type\": \"bytes32\"\n },\n {\n \"Name\": \"Observations\",\n \"Type\": \"int192[]\"\n },\n {\n \"Name\": \"JuelsPerFeeCoin\",\n \"Type\": \"int192\"\n }\n]\n" + +[pluginConfig] +juelsPerFeeCoinSource = " // data source 1\n ds1 [type=bridge name=\"%s\"];\n ds1_parse [type=jsonparse path=\"data\"];\n ds1_multiply [type=multiply times=2];\n\n // data source 2\n ds2 [type=http method=GET url=\"%s\"];\n ds2_parse [type=jsonparse path=\"data\"];\n ds2_multiply [type=multiply times=2];\n\n ds1 -> ds1_parse -> ds1_multiply -> answer1;\n ds2 -> ds2_parse -> ds2_multiply -> answer1;\n\n answer1 [type=median index=0];\n" diff --git a/core/services/job/testdata/pretty.toml b/core/services/job/testdata/pretty.toml new file mode 100644 index 00000000000..def8ab29871 --- /dev/null +++ b/core/services/job/testdata/pretty.toml @@ -0,0 +1,149 @@ +relay = "evm" +pluginType = "median" +contractID = "foo" +ocrKeyBundleID = "bar" +transmitterID = "baz" +contractConfigConfirmations = 1 +contractConfigTrackerPollInterval = "1s" + +[relayConfig] +chainID = 1337 +fromBlock = 42 + +[relayConfig.chainReader.contracts.median] +contractABI = ''' +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "requester", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "configDigest", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "round", + "type": "uint8" + } + ], + "name": "RoundRequested", + "type": "event" + }, + { + "inputs": [], + "name": "latestTransmissionDetails", + "outputs": [ + { + "internalType": "bytes32", + "name": "configDigest", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + }, + { + "internalType": "uint8", + "name": "round", + "type": "uint8" + }, + { + "internalType": "int192", + "name": "latestAnswer_", + "type": "int192" + }, + { + "internalType": "uint64", + "name": "latestTimestamp_", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + } +] +''' + +[relayConfig.chainReader.contracts.median.configs] +LatestRoundRequested = ''' +{ + "chainSpecificName": "RoundRequested", + "readType": "event" +} +''' +LatestTransmissionDetails = ''' +{ + "chainSpecificName": "latestTransmissionDetails", + "output_modifications": [ + { + "Fields": [ + "LatestTimestamp_" + ], + "Type": "epoch to time" + }, + { + "Fields": { + "LatestAnswer_": "LatestAnswer", + "LatestTimestamp_": "LatestTimestamp" + }, + "Type": "rename" + } + ] +} +''' + +[relayConfig.codec.configs.MedianReport] +typeABI = ''' +[ + { + "Name": "Timestamp", + "Type": "uint32" + }, + { + "Name": "Observers", + "Type": "bytes32" + }, + { + "Name": "Observations", + "Type": "int192[]" + }, + { + "Name": "JuelsPerFeeCoin", + "Type": "int192" + } +] +''' + +[pluginConfig] +juelsPerFeeCoinSource = """ + // data source 1 + ds1 [type=bridge name="%s"]; + ds1_parse [type=jsonparse path="data"]; + ds1_multiply [type=multiply times=2]; + + // data source 2 + ds2 [type=http method=GET url="%s"]; + ds2_parse [type=jsonparse path="data"]; + ds2_multiply [type=multiply times=2]; + + ds1 -> ds1_parse -> ds1_multiply -> answer1; + ds2 -> ds2_parse -> ds2_multiply -> answer1; + + answer1 [type=median index=0]; +""" \ No newline at end of file diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index b8e7f20cc21..de6c4acec56 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -49,7 +49,7 @@ func NewChainReaderService(lggr logger.Logger, lp logpoller.LogPoller, chain leg } var err error - if err = cr.init(config.ChainContractReaders); err != nil { + if err = cr.init(config.Contracts); err != nil { return nil, err } @@ -89,15 +89,15 @@ func (cr *chainReader) init(chainContractReaders map[string]types.ChainContractR return err } - for typeName, chainReaderDefinition := range chainContractReader.ChainReaderDefinitions { + for typeName, chainReaderDefinition := range chainContractReader.Configs { switch chainReaderDefinition.ReadType { case types.Method: - err = cr.addMethod(contractName, typeName, contractAbi, chainReaderDefinition) + err = cr.addMethod(contractName, typeName, contractAbi, *chainReaderDefinition) case types.Event: - err = cr.addEvent(contractName, typeName, contractAbi, chainReaderDefinition) + err = cr.addEvent(contractName, typeName, contractAbi, *chainReaderDefinition) default: return fmt.Errorf( - "%w: invalid chain reader definition read type: %d", + "%w: invalid chain reader definition read type: %s", commontypes.ErrInvalidConfig, chainReaderDefinition.ReadType) } diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index 9457af90d28..a3adb6f35b3 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -160,10 +160,10 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { testStruct := CreateTestStruct(0, it) it.chainConfig = types.ChainReaderConfig{ - ChainContractReaders: map[string]types.ChainContractReader{ + Contracts: map[string]types.ChainContractReader{ AnyContractName: { ContractABI: chain_reader_example.LatestValueHolderMetaData.ABI, - ChainReaderDefinitions: map[string]types.ChainReaderDefinition{ + Configs: map[string]*types.ChainReaderDefinition{ MethodTakingLatestParamsReturningTestStruct: { ChainSpecificName: "GetElementAtIndex", }, @@ -217,7 +217,7 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { }, AnySecondContractName: { ContractABI: chain_reader_example.LatestValueHolderMetaData.ABI, - ChainReaderDefinitions: map[string]types.ChainReaderDefinition{ + Configs: map[string]*types.ChainReaderDefinition{ MethodReturningUint64: { ChainSpecificName: "GetDifferentPrimitiveValue", }, diff --git a/core/services/relay/evm/codec.go b/core/services/relay/evm/codec.go index 8655831a588..0e5ccd781bd 100644 --- a/core/services/relay/evm/codec.go +++ b/core/services/relay/evm/codec.go @@ -40,9 +40,9 @@ func NewCodec(conf types.CodecConfig) (commontypes.RemoteCodec, error) { decoderDefs: map[string]*codecEntry{}, } - for k, v := range conf.ChainCodecConfigs { + for k, v := range conf.Configs { args := abi.Arguments{} - if err := json.Unmarshal(([]byte)(v.TypeAbi), &args); err != nil { + if err := json.Unmarshal(([]byte)(v.TypeABI), &args); err != nil { return nil, err } diff --git a/core/services/relay/evm/codec_test.go b/core/services/relay/evm/codec_test.go index b281039759c..3892c945108 100644 --- a/core/services/relay/evm/codec_test.go +++ b/core/services/relay/evm/codec_test.go @@ -71,13 +71,13 @@ func (it *codecInterfaceTester) EncodeFields(t *testing.T, request *EncodeReques } func (it *codecInterfaceTester) GetCodec(t *testing.T) commontypes.Codec { - codecConfig := types.CodecConfig{ChainCodecConfigs: map[string]types.ChainCodedConfig{}} + codecConfig := types.CodecConfig{Configs: map[string]types.ChainCodecConfig{}} testStruct := CreateTestStruct(0, it) for k, v := range codecDefs { defBytes, err := json.Marshal(v) require.NoError(t, err) - entry := codecConfig.ChainCodecConfigs[k] - entry.TypeAbi = string(defBytes) + entry := codecConfig.Configs[k] + entry.TypeABI = string(defBytes) if k == TestItemWithConfigExtra { entry.ModifierConfigs = codec.ModifiersConfig{ &codec.HardCodeModifierConfig{ @@ -88,7 +88,7 @@ func (it *codecInterfaceTester) GetCodec(t *testing.T) commontypes.Codec { OffChainValues: map[string]any{"ExtraField": anyExtraValue}}, } } - codecConfig.ChainCodecConfigs[k] = entry + codecConfig.Configs[k] = entry } c, err := evm.NewCodec(codecConfig) diff --git a/core/services/relay/evm/types/types.go b/core/services/relay/evm/types/types.go index aca0fcedb47..78e420018b7 100644 --- a/core/services/relay/evm/types/types.go +++ b/core/services/relay/evm/types/types.go @@ -1,6 +1,7 @@ package types import ( + "bytes" "context" "encoding/json" "fmt" @@ -19,44 +20,90 @@ import ( ) type ChainReaderConfig struct { - // ChainContractReaders key is contract name - ChainContractReaders map[string]ChainContractReader `json:"chainContractReaders"` + // Contracts key is contract name + Contracts map[string]ChainContractReader `json:"contracts" toml:"contracts"` } type CodecConfig struct { - // ChainCodecConfigs is the type's name for the codec - ChainCodecConfigs map[string]ChainCodedConfig `json:"chainCodecConfig"` + // Configs key is the type's name for the codec + Configs map[string]ChainCodecConfig `json:"configs" toml:"configs"` } -type ChainCodedConfig struct { - TypeAbi string `json:"typeAbi"` - ModifierConfigs codec.ModifiersConfig +type ChainCodecConfig struct { + TypeABI string `json:"typeAbi" toml:"typeABI"` + ModifierConfigs codec.ModifiersConfig `toml:"modifierConfigs,omitempty"` } type ChainContractReader struct { - ContractABI string `json:"contractABI"` + ContractABI string `json:"contractABI" toml:"contractABI"` // key is genericName from config - ChainReaderDefinitions map[string]ChainReaderDefinition `json:"chainReaderDefinitions"` + Configs map[string]*ChainReaderDefinition `json:"configs" toml:"configs"` } -type ChainReaderDefinition struct { - ChainSpecificName string `json:"chainSpecificName"` // chain specific contract method name or event type. - CacheEnabled bool `json:"cacheEnabled"` - ReadType `json:"readType"` - InputModifications codec.ModifiersConfig `json:"input_modifications"` - OutputModifications codec.ModifiersConfig `json:"output_modifications"` +type ChainReaderDefinition chainReaderDefinitionFields + +// chainReaderDefinitionFields has the fields for ChainReaderDefinition but no methods. +// This is necessary because package json recognizes the text encoding methods used for TOML, +// and would infinitely recurse on itself. +type chainReaderDefinitionFields struct { + CacheEnabled bool `json:"cacheEnabled,omitempty"` + // chain specific contract method name or event type. + ChainSpecificName string `json:"chainSpecificName"` + ReadType ReadType `json:"readType,omitempty"` + InputModifications codec.ModifiersConfig `json:"input_modifications,omitempty"` + OutputModifications codec.ModifiersConfig `json:"output_modifications,omitempty"` // EventInputFields allows you to choose which indexed fields are expected from the input - EventInputFields []string `json:"eventInputFields"` + EventInputFields []string `json:"eventInputFields,omitempty"` } -type ReadType int64 +func (d *ChainReaderDefinition) MarshalText() ([]byte, error) { + var b bytes.Buffer + e := json.NewEncoder(&b) + e.SetIndent("", " ") + if err := e.Encode((*chainReaderDefinitionFields)(d)); err != nil { + return nil, err + } + return b.Bytes(), nil +} + +func (d *ChainReaderDefinition) UnmarshalText(b []byte) error { + return json.Unmarshal(b, (*chainReaderDefinitionFields)(d)) +} + +type ReadType int const ( - Method ReadType = 0 - Event ReadType = 1 + Method ReadType = iota + Event ) +func (r ReadType) String() string { + switch r { + case Method: + return "method" + case Event: + return "event" + } + return fmt.Sprintf("ReadType(%d)", r) +} + +func (r ReadType) MarshalText() ([]byte, error) { + return []byte(r.String()), nil +} + +func (r *ReadType) UnmarshalText(text []byte) error { + switch string(text) { + case "method": + *r = Method + return nil + case "event": + *r = Event + return nil + } + return fmt.Errorf("unrecognized ReadType: %s", string(text)) +} + type RelayConfig struct { ChainID *big.Big `json:"chainID"` FromBlock uint64 `json:"fromBlock"` diff --git a/integration-tests/actions/ocr2_helpers_local.go b/integration-tests/actions/ocr2_helpers_local.go index 9d905b7430d..8a0a02c050f 100644 --- a/integration-tests/actions/ocr2_helpers_local.go +++ b/integration-tests/actions/ocr2_helpers_local.go @@ -18,7 +18,9 @@ import ( "golang.org/x/sync/errgroup" "gopkg.in/guregu/null.v4" + "github.com/smartcontractkit/chainlink-common/pkg/codec" "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" @@ -127,8 +129,40 @@ func CreateOCRv2JobsLocal( }, } if enableChainReaderAndCodec { - ocrSpec.OCR2OracleSpec.RelayConfig["chainReader"] = `{"chainContractReaders":{"median":{"contractABI":"[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"link\",\"type\":\"address\"},{\"internalType\":\"int192\",\"name\":\"minAnswer_\",\"type\":\"int192\"},{\"internalType\":\"int192\",\"name\":\"maxAnswer_\",\"type\":\"int192\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"billingAccessController\",\"type\":\"address\"},{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"description_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"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\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractLinkTokenInterface\",\"name\":\"newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"observationsTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"juelsPerFeeCoin\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"epochAndRound\",\"type\":\"uint40\"}],\"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\":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\":\"contractAccessControllerInterface\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contractAccessControllerInterface\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"}],\"name\":\"acceptPayeeship\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBilling\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"getLinkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRequesterAccessController\",\"outputs\":[{\"internalType\":\"contractAccessControllerInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"}],\"name\":\"getRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId_\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTransmitters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorConfig\",\"outputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"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\":\"latestRound\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestRoundData\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"roundId\",\"type\":\"uint80\"},{\"internalType\":\"int256\",\"name\":\"answer\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint80\",\"name\":\"answeredInRound\",\"type\":\"uint80\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestTransmissionDetails\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"ConfigDigest\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"},{\"internalType\":\"int192\",\"name\":\"latestAnswer_\",\"type\":\"int192\"},{\"internalType\":\"uint64\",\"name\":\"latestTimestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"linkAvailableForPayment\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"availableBalance\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minAnswer\",\"outputs\":[{\"internalType\":\"int192\",\"name\":\"\",\"type\":\"int192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitterAddress\",\"type\":\"address\"}],\"name\":\"oracleObservationCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"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\":\"requestNewRound\",\"outputs\":[{\"internalType\":\"uint80\",\"name\":\"\",\"type\":\"uint80\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPriceGwei\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"observationPaymentGjuels\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"transmissionPaymentGjuels\",\"type\":\"uint32\"},{\"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\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setLinkToken\",\"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\":\"contractAccessControllerInterface\",\"name\":\"requesterAccessController\",\"type\":\"address\"}],\"name\":\"setRequesterAccessController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractAggregatorValidatorInterface\",\"name\":\"newValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"setValidatorConfig\",\"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\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\"}]","chainReaderDefinitions":{"LatestTransmissionDetails":{"chainSpecificName":"latestTransmissionDetails","readType":0,"output_modifications":[{"type" : "epoch to time", "fields" : ["LatestTimestamp_"]},{"type":"rename","fields":{"LatestAnswer_":"LatestAnswer","LatestTimestamp_":"LatestTimestamp"}}]},"LatestRoundRequested":{"chainSpecificName":"RoundRequested","params":{"requester":""},"readType":1}}}}}` - ocrSpec.OCR2OracleSpec.RelayConfig["codec"] = `{"chainCodecConfig" :{"MedianReport":{"TypeAbi": "[{\"Name\": \"Timestamp\",\"Type\": \"uint32\"},{\"Name\": \"Observers\",\"Type\": \"bytes32\"},{\"Name\": \"Observations\",\"Type\": \"int192[]\"},{\"Name\": \"JuelsPerFeeCoin\",\"Type\": \"int192\"}]"}}}` + ocrSpec.OCR2OracleSpec.RelayConfig["chainReader"] = evmtypes.ChainReaderConfig{ + Contracts: map[string]evmtypes.ChainContractReader{ + "median": { + ContractABI: `[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"requester","type":"address"},{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"epoch","type":"uint32"},{"indexed":false,"internalType":"uint8","name":"round","type":"uint8"}],"name":"RoundRequested","type":"event"},{"inputs":[],"name":"latestTransmissionDetails","outputs":[{"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"internalType":"uint32","name":"epoch","type":"uint32"},{"internalType":"uint8","name":"round","type":"uint8"},{"internalType":"int192","name":"latestAnswer_","type":"int192"},{"internalType":"uint64","name":"latestTimestamp_","type":"uint64"}],"stateMutability":"view","type":"function"}]`, + Configs: map[string]*evmtypes.ChainReaderDefinition{ + "LatestTransmissionDetails": { + ChainSpecificName: "latestTransmissionDetails", + OutputModifications: codec.ModifiersConfig{ + &codec.EpochToTimeModifierConfig{ + Fields: []string{"LatestTimestamp_"}, + }, + &codec.RenameModifierConfig{ + Fields: map[string]string{ + "LatestAnswer_": "LatestAnswer", + "LatestTimestamp_": "LatestTimestamp", + }, + }, + }, + }, + "LatestRoundRequested": { + ChainSpecificName: "RoundRequested", + ReadType: evmtypes.Event, + }, + }, + }, + }, + } + ocrSpec.OCR2OracleSpec.RelayConfig["codec"] = evmtypes.CodecConfig{ + Configs: map[string]evmtypes.ChainCodecConfig{ + "MedianReport": { + TypeABI: `[{"Name": "Timestamp","Type": "uint32"},{"Name": "Observers","Type": "bytes32"},{"Name": "Observations","Type": "int192[]"},{"Name": "JuelsPerFeeCoin","Type": "int192"}]`, + }, + }, + } } _, err = chainlinkNode.MustCreateJob(ocrSpec) diff --git a/integration-tests/client/chainlink_models.go b/integration-tests/client/chainlink_models.go index 41fdebac94c..9268968800d 100644 --- a/integration-tests/client/chainlink_models.go +++ b/integration-tests/client/chainlink_models.go @@ -6,6 +6,7 @@ import ( "text/template" "time" + "github.com/pelletier/go-toml/v2" "gopkg.in/guregu/null.v4" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" @@ -1027,6 +1028,12 @@ func (o *OCR2TaskJobSpec) String() (string, error) { if o.OCR2OracleSpec.FeedID != nil { feedID = o.OCR2OracleSpec.FeedID.Hex() } + relayConfig, err := toml.Marshal(struct { + RelayConfig job.JSONConfig `toml:"relayConfig"` + }{RelayConfig: o.OCR2OracleSpec.RelayConfig}) + if err != nil { + return "", fmt.Errorf("failed to marshal relay config: %w", err) + } specWrap := struct { Name string JobType string @@ -1036,7 +1043,7 @@ func (o *OCR2TaskJobSpec) String() (string, error) { FeedID string Relay string PluginType string - RelayConfig map[string]interface{} + RelayConfig string PluginConfig map[string]interface{} P2PV2Bootstrappers []string OCRKeyBundleID string @@ -1056,7 +1063,7 @@ func (o *OCR2TaskJobSpec) String() (string, error) { FeedID: feedID, Relay: string(o.OCR2OracleSpec.Relay), PluginType: string(o.OCR2OracleSpec.PluginType), - RelayConfig: o.OCR2OracleSpec.RelayConfig, + RelayConfig: string(relayConfig), PluginConfig: o.OCR2OracleSpec.PluginConfig, P2PV2Bootstrappers: o.OCR2OracleSpec.P2PV2Bootstrappers, OCRKeyBundleID: o.OCR2OracleSpec.OCRKeyBundleID.String, @@ -1071,37 +1078,37 @@ func (o *OCR2TaskJobSpec) String() (string, error) { type = "{{ .JobType }}" name = "{{.Name}}" forwardingAllowed = {{.ForwardingAllowed}} -{{if .MaxTaskDuration}} +{{- if .MaxTaskDuration}} maxTaskDuration = "{{ .MaxTaskDuration }}" {{end}} -{{if .PluginType}} +{{- if .PluginType}} pluginType = "{{ .PluginType }}" {{end}} relay = "{{.Relay}}" schemaVersion = 1 contractID = "{{.ContractID}}" -{{if .FeedID}} +{{- if .FeedID}} feedID = "{{.FeedID}}" {{end}} -{{if eq .JobType "offchainreporting2" }} +{{- if eq .JobType "offchainreporting2" }} ocrKeyBundleID = "{{.OCRKeyBundleID}}" {{end}} -{{if eq .JobType "offchainreporting2" }} +{{- if eq .JobType "offchainreporting2" }} transmitterID = "{{.TransmitterID}}" {{end}} -{{if .BlockchainTimeout}} +{{- if .BlockchainTimeout}} blockchainTimeout = "{{.BlockchainTimeout}}" {{end}} -{{if .ContractConfirmations}} +{{- if .ContractConfirmations}} contractConfigConfirmations = {{.ContractConfirmations}} {{end}} -{{if .TrackerPollInterval}} +{{- if .TrackerPollInterval}} contractConfigTrackerPollInterval = "{{.TrackerPollInterval}}" {{end}} -{{if .TrackerSubscribeInterval}} +{{- if .TrackerSubscribeInterval}} contractConfigTrackerSubscribeInterval = "{{.TrackerSubscribeInterval}}" {{end}} -{{if .P2PV2Bootstrappers}} +{{- if .P2PV2Bootstrappers}} p2pv2Bootstrappers = [{{range .P2PV2Bootstrappers}}"{{.}}",{{end}}]{{end}} -{{if .MonitoringEndpoint}} +{{- if .MonitoringEndpoint}} monitoringEndpoint = "{{.MonitoringEndpoint}}" {{end}} -{{if .ObservationSource}} +{{- if .ObservationSource}} observationSource = """ {{.ObservationSource}} """{{end}} @@ -1109,13 +1116,7 @@ observationSource = """ [pluginConfig]{{range $key, $value := .PluginConfig}} {{$key}} = {{$value}}{{end}} {{end}} -[relayConfig]{{range $key, $value := .RelayConfig}} - {{if or (eq $key "chainReader") (eq $key "codec")}} - {{$key}} = '{{$value}}' - {{else}} - {{$key}} = {{$value}} - {{end}} -{{end}} +{{.RelayConfig}} ` return MarshallTemplate(specWrap, "OCR2 Job", ocr2TemplateString) } diff --git a/integration-tests/client/chainlink_models_test.go b/integration-tests/client/chainlink_models_test.go new file mode 100644 index 00000000000..5dbac2c27c4 --- /dev/null +++ b/integration-tests/client/chainlink_models_test.go @@ -0,0 +1,135 @@ +package client + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink-common/pkg/codec" + "github.com/smartcontractkit/chainlink/v2/core/services/job" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" +) + +func TestOCR2TaskJobSpec_String(t *testing.T) { + for _, tt := range []struct { + name string + spec OCR2TaskJobSpec + exp string + }{ + { + name: "chain-reader-codec", + spec: OCR2TaskJobSpec{ + OCR2OracleSpec: job.OCR2OracleSpec{ + RelayConfig: map[string]interface{}{ + "chainID": 1337, + "fromBlock": 42, + "chainReader": evmtypes.ChainReaderConfig{ + Contracts: map[string]evmtypes.ChainContractReader{ + "median": { + ContractABI: `[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "requester", + "type": "address" + } + ], + "name": "RoundRequested", + "type": "event" + } +] +`, + Configs: map[string]*evmtypes.ChainReaderDefinition{ + "LatestTransmissionDetails": { + ChainSpecificName: "latestTransmissionDetails", + OutputModifications: codec.ModifiersConfig{ + &codec.EpochToTimeModifierConfig{ + Fields: []string{"LatestTimestamp_"}, + }, + &codec.RenameModifierConfig{ + Fields: map[string]string{ + "LatestAnswer_": "LatestAnswer", + "LatestTimestamp_": "LatestTimestamp", + }, + }, + }, + }, + "LatestRoundRequested": { + ChainSpecificName: "RoundRequested", + ReadType: evmtypes.Event, + }, + }, + }, + }, + }, + "codec": evmtypes.CodecConfig{ + Configs: map[string]evmtypes.ChainCodecConfig{ + "MedianReport": { + TypeABI: `[ + { + "Name": "Timestamp", + "Type": "uint32" + } +] +`, + }, + }, + }, + }, + PluginConfig: map[string]interface{}{"juelsPerFeeCoinSource": ` // data source 1 + ds1 [type=bridge name="%s"]; + ds1_parse [type=jsonparse path="data"]; + ds1_multiply [type=multiply times=2]; + + // data source 2 + ds2 [type=http method=GET url="%s"]; + ds2_parse [type=jsonparse path="data"]; + ds2_multiply [type=multiply times=2]; + + ds1 -> ds1_parse -> ds1_multiply -> answer1; + ds2 -> ds2_parse -> ds2_multiply -> answer1; + + answer1 [type=median index=0]; +`, + }, + }, + }, + exp: ` +type = "" +name = "" +forwardingAllowed = false +relay = "" +schemaVersion = 1 +contractID = "" + +[relayConfig] +chainID = 1337 +fromBlock = 42 + +[relayConfig.chainReader] +[relayConfig.chainReader.contracts] +[relayConfig.chainReader.contracts.median] +contractABI = "[\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"internalType\": \"address\",\n \"name\": \"requester\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"RoundRequested\",\n \"type\": \"event\"\n }\n]\n" + +[relayConfig.chainReader.contracts.median.configs] +LatestRoundRequested = "{\n \"chainSpecificName\": \"RoundRequested\",\n \"readType\": \"event\"\n}\n" +LatestTransmissionDetails = "{\n \"chainSpecificName\": \"latestTransmissionDetails\",\n \"output_modifications\": [\n {\n \"Fields\": [\n \"LatestTimestamp_\"\n ],\n \"Type\": \"epoch to time\"\n },\n {\n \"Fields\": {\n \"LatestAnswer_\": \"LatestAnswer\",\n \"LatestTimestamp_\": \"LatestTimestamp\"\n },\n \"Type\": \"rename\"\n }\n ]\n}\n" + +[relayConfig.codec] +[relayConfig.codec.configs] +[relayConfig.codec.configs.MedianReport] +typeABI = "[\n {\n \"Name\": \"Timestamp\",\n \"Type\": \"uint32\"\n }\n]\n" + +`, + }, + } { + t.Run(tt.name, func(t *testing.T) { + got, err := tt.spec.String() + require.NoError(t, err) + require.Equal(t, tt.exp, got) + }) + } +} From 0ee6c0a7f16f19b271fc5dd7fddc37ee816f3c15 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 17 Jan 2024 09:36:30 -0500 Subject: [PATCH 092/112] Template must in types gen and small json rename for mods in chain reader def fields --- core/services/relay/evm/types/gen/main.go | 13 +++++-------- core/services/relay/evm/types/types.go | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/core/services/relay/evm/types/gen/main.go b/core/services/relay/evm/types/gen/main.go index cdc1eab77e0..3d3df924985 100644 --- a/core/services/relay/evm/types/gen/main.go +++ b/core/services/relay/evm/types/gen/main.go @@ -18,7 +18,7 @@ func genBytes() { for i := 1; i < 33; i++ { byteTypes[i-1].Size = i } - runTemplate("bytes", bytesTemplate, "byte_types_gen.go", byteTypes) + mustRunTemplate("bytes", bytesTemplate, "byte_types_gen.go", byteTypes) } func genInts() { @@ -35,17 +35,14 @@ func genInts() { unsigned := &IntType{Prefix: "u", Size: i} intTypes = append(intTypes, signed, unsigned) } - runTemplate("ints", intsTemplate, "int_types_gen.go", intTypes) + mustRunTemplate("ints", intsTemplate, "int_types_gen.go", intTypes) } -func runTemplate(name, rawTemplate, outputFile string, input any) { - t, err := template.New(name).Parse(rawTemplate) - if err != nil { - panic(err) - } +func mustRunTemplate(name, rawTemplate, outputFile string, input any) { + t := template.Must(template.New(name).Parse(rawTemplate)) br := bytes.Buffer{} - if err = t.Execute(&br, input); err != nil { + if err := t.Execute(&br, input); err != nil { panic(err) } diff --git a/core/services/relay/evm/types/types.go b/core/services/relay/evm/types/types.go index 78e420018b7..2ec5c9c8034 100644 --- a/core/services/relay/evm/types/types.go +++ b/core/services/relay/evm/types/types.go @@ -50,8 +50,8 @@ type chainReaderDefinitionFields struct { // chain specific contract method name or event type. ChainSpecificName string `json:"chainSpecificName"` ReadType ReadType `json:"readType,omitempty"` - InputModifications codec.ModifiersConfig `json:"input_modifications,omitempty"` - OutputModifications codec.ModifiersConfig `json:"output_modifications,omitempty"` + InputModifications codec.ModifiersConfig `json:"inputModifications,omitempty"` + OutputModifications codec.ModifiersConfig `json:"outputModifications,omitempty"` // EventInputFields allows you to choose which indexed fields are expected from the input EventInputFields []string `json:"eventInputFields,omitempty"` From e0dea9645a1ede999734570bb2fdf9eb4456ce50 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 17 Jan 2024 09:53:05 -0500 Subject: [PATCH 093/112] Update test contract for lint, fix toml test files after renaming the mod in prior commit --- .../shared/test/ChainReaderTestContract.sol | 34 +++++++++---------- .../chain_reader_example.go | 26 +++++++------- ...rapper-dependency-versions-do-not-edit.txt | 2 +- core/services/job/testdata/compact.toml | 2 +- core/services/job/testdata/pretty.toml | 2 +- core/services/relay/evm/chain_reader_test.go | 26 ++++++++------ 6 files changed, 49 insertions(+), 43 deletions(-) diff --git a/contracts/src/v0.8/shared/test/ChainReaderTestContract.sol b/contracts/src/v0.8/shared/test/ChainReaderTestContract.sol index 30005c9dd81..9b7ddd09b26 100644 --- a/contracts/src/v0.8/shared/test/ChainReaderTestContract.sol +++ b/contracts/src/v0.8/shared/test/ChainReaderTestContract.sol @@ -18,7 +18,7 @@ struct MidLevelTestStruct { } struct InnerTestStruct { - int64 I; + int64 IntVal; string S; } @@ -47,16 +47,16 @@ contract LatestValueHolder { int32 indexed field3 ); - TestStruct[] private seen; - uint64[] private arr; + TestStruct[] private s_seen; + uint64[] private s_arr; constructor() { // See chain_reader_interface_tests.go in chainlink-relay - arr.push(3); - arr.push(4); + s_arr.push(3); + s_arr.push(4); } - function AddTestStruct( + function addTestStruct( int32 field, string calldata differentField, uint8 oracleId, @@ -66,10 +66,10 @@ contract LatestValueHolder { int192 bigField, MidLevelTestStruct calldata nestedStruct ) public { - seen.push(TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct)); + s_seen.push(TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct)); } - function ReturnSeen( + function returnSeen( int32 field, string calldata differentField, uint8 oracleId, @@ -82,26 +82,26 @@ contract LatestValueHolder { return TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); } - function GetElementAtIndex(uint256 i) public view returns (TestStruct memory) { + function getElementAtIndex(uint256 i) public view returns (TestStruct memory) { // See chain_reader_interface_tests.go in chainlink-relay - return seen[i - 1]; + return s_seen[i - 1]; } - function GetPrimitiveValue() public pure returns (uint64) { + function getPrimitiveValue() public pure returns (uint64) { // See chain_reader_interface_tests.go in chainlink-relay return 3; } - function GetDifferentPrimitiveValue() public pure returns (uint64) { + function getDifferentPrimitiveValue() public pure returns (uint64) { // See chain_reader_interface_tests.go in chainlink-relay return 1990; } - function GetSliceValue() public view returns (uint64[] memory) { - return arr; + function getSliceValue() public view returns (uint64[] memory) { + return s_arr; } - function TriggerEvent( + function triggerEvent( int32 field, string calldata differentField, uint8 oracleId, @@ -114,14 +114,14 @@ contract LatestValueHolder { emit Triggered(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); } - function TriggerEventWithDynamicTopic( + function triggerEventWithDynamicTopic( string calldata field ) public { emit TriggeredEventWithDynamicTopic(field, field); } // first topic is the event signature - function TriggerWithFourTopics( + function triggerWithFourTopics( int32 field1, int32 field2, int32 field3 diff --git a/core/gethwrappers/generated/chain_reader_example/chain_reader_example.go b/core/gethwrappers/generated/chain_reader_example/chain_reader_example.go index 7a1ab118806..f6dce0bb6c3 100644 --- a/core/gethwrappers/generated/chain_reader_example/chain_reader_example.go +++ b/core/gethwrappers/generated/chain_reader_example/chain_reader_example.go @@ -31,8 +31,8 @@ var ( ) type InnerTestStruct struct { - I int64 - S string + IntVal int64 + S string } type MidLevelTestStruct struct { @@ -52,8 +52,8 @@ type TestStruct struct { } var LatestValueHolderMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"Triggered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"fieldHash\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"field\",\"type\":\"string\"}],\"name\":\"TriggeredEventWithDynamicTopic\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int32\",\"name\":\"field1\",\"type\":\"int32\"},{\"indexed\":true,\"internalType\":\"int32\",\"name\":\"field2\",\"type\":\"int32\"},{\"indexed\":true,\"internalType\":\"int32\",\"name\":\"field3\",\"type\":\"int32\"}],\"name\":\"TriggeredWithFourTopics\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"AddTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetDifferentPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"GetElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"ReturnSeen\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"I\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"TriggerEvent\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"field\",\"type\":\"string\"}],\"name\":\"TriggerEventWithDynamicTopic\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field1\",\"type\":\"int32\"},{\"internalType\":\"int32\",\"name\":\"field2\",\"type\":\"int32\"},{\"internalType\":\"int32\",\"name\":\"field3\",\"type\":\"int32\"}],\"name\":\"TriggerWithFourTopics\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a918202910219909216919091179055611768806100a96000396000f3fe608060405234801561001057600080fd5b50600436106100a35760003560e01c80638b659d6e11610076578063b9dad6b01161005b578063b9dad6b014610138578063bdb37c901461014b578063da8e7a821461016057600080fd5b80638b659d6e146101055780639ca04f671461011857600080fd5b8063030d3ca2146100a85780633205fb6b146100ca5780636c7cf955146100df57806383b0abee146100f2575b600080fd5b6107c65b60405167ffffffffffffffff90911681526020015b60405180910390f35b6100dd6100d8366004610bef565b610167565b005b6100dd6100ed366004610d04565b6101bc565b6100dd610100366004610df6565b6104bf565b6100dd610113366004610d04565b6104fc565b61012b610126366004610e39565b610553565b6040516100c19190610f98565b61012b610146366004610d04565b61082e565b610153610937565b6040516100c1919061108e565b60036100ac565b81816040516101779291906110dc565b60405180910390207f3d969732b1bbbb9f1d7eb9f3f14e4cb50a74d950b3ef916a397b85dfbab93c6783836040516101b0929190611135565b60405180910390a25050565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b9183908390808284376000920191909152505050815273ffffffffffffffffffffffffffffffffffffffff8816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016102ae84611232565b905281546001808201845560009384526020938490208351600a9093020180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff90931692909217825592820151919290919082019061031490826113d9565b5060408201516002820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff909216919091179055606082015161036290600383019060206109c3565b5060808201516004820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90921691909117905560a082015180516103c9916005840191602090910190610a56565b5060c08201516006820180547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff90921691909117905560e082015180516007830180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001660f09290921c91909117815560208083015180516008860180547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff9092169190911781559181015190919060098601906104ac90826113d9565b5050505050505050505050505050505050565b8060030b8260030b8460030b7f91c80dc390f3d041b3a04b0099b19634499541ea26972250986ee4b24a12fac560405160405180910390a4505050565b8960030b7f7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d8a8a8a8a8a8a8a8a8a60405161053f99989796959493929190611638565b60405180910390a250505050505050505050565b61055b610ad0565b60006105686001846116f2565b815481106105785761057861172c565b6000918252602091829020604080516101008101909152600a90920201805460030b825260018101805492939192918401916105b39061133d565b80601f01602080910402602001604051908101604052809291908181526020018280546105df9061133d565b801561062c5780601f106106015761010080835404028352916020019161062c565b820191906000526020600020905b81548152906001019060200180831161060f57829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff1681526020600192830181810494850194909303909202910180841161066157505050928452505050600482015473ffffffffffffffffffffffffffffffffffffffff16602080830191909152600583018054604080518285028101850182528281529401939283018282801561071a57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116106ef575b5050509183525050600682015460170b6020808301919091526040805180820182526007808601805460f01b7fffff0000000000000000000000000000000000000000000000000000000000001683528351808501855260088801805490930b8152600988018054959097019693959194868301949193928401919061079f9061133d565b80601f01602080910402602001604051908101604052809291908181526020018280546107cb9061133d565b80156108185780601f106107ed57610100808354040283529160200191610818565b820191906000526020600020905b8154815290600101906020018083116107fb57829003601f168201915b5050509190925250505090525090525092915050565b610836610ad0565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b9183908390808284376000920191909152505050815273ffffffffffffffffffffffffffffffffffffffff8816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161092684611232565b90529b9a5050505050505050505050565b606060018054806020026020016040519081016040528092919081815260200182805480156109b957602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116109745790505b5050505050905090565b600183019183908215610a465791602002820160005b83821115610a1757835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026109d9565b8015610a445782816101000a81549060ff0219169055600101602081600001049283019260010302610a17565b505b50610a52929150610b1f565b5090565b828054828255906000526020600020908101928215610a46579160200282015b82811115610a4657825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190610a76565b6040805161010081018252600080825260606020830181905292820152908101610af8610b34565b8152600060208201819052606060408301819052820152608001610b1a610b53565b905290565b5b80821115610a525760008155600101610b20565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060007dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001610b1a6040518060400160405280600060070b8152602001606081525090565b60008083601f840112610bb857600080fd5b50813567ffffffffffffffff811115610bd057600080fd5b602083019150836020828501011115610be857600080fd5b9250929050565b60008060208385031215610c0257600080fd5b823567ffffffffffffffff811115610c1957600080fd5b610c2585828601610ba6565b90969095509350505050565b8035600381900b8114610c4357600080fd5b919050565b803560ff81168114610c4357600080fd5b806104008101831015610c6b57600080fd5b92915050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610c4357600080fd5b60008083601f840112610ca757600080fd5b50813567ffffffffffffffff811115610cbf57600080fd5b6020830191508360208260051b8501011115610be857600080fd5b8035601781900b8114610c4357600080fd5b600060408284031215610cfe57600080fd5b50919050565b6000806000806000806000806000806104e08b8d031215610d2457600080fd5b610d2d8b610c31565b995060208b013567ffffffffffffffff80821115610d4a57600080fd5b610d568e838f01610ba6565b909b509950899150610d6a60408e01610c48565b9850610d798e60608f01610c59565b9750610d886104608e01610c71565b96506104808d0135915080821115610d9f57600080fd5b610dab8e838f01610c95565b9096509450849150610dc06104a08e01610cda565b93506104c08d0135915080821115610dd757600080fd5b50610de48d828e01610cec565b9150509295989b9194979a5092959850565b600080600060608486031215610e0b57600080fd5b610e1484610c31565b9250610e2260208501610c31565b9150610e3060408501610c31565b90509250925092565b600060208284031215610e4b57600080fd5b5035919050565b6000815180845260005b81811015610e7857602081850181015186830182015201610e5c565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b8060005b6020808210610ec95750610ee0565b825160ff1685529384019390910190600101610eba565b50505050565b600081518084526020808501945080840160005b83811015610f2c57815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101610efa565b509495945050505050565b7fffff00000000000000000000000000000000000000000000000000000000000081511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610f906080850182610e52565b949350505050565b60208152610fac60208201835160030b9052565b600060208301516104e0806040850152610fca610500850183610e52565b91506040850151610fe0606086018260ff169052565b506060850151610ff36080860182610eb6565b50608085015173ffffffffffffffffffffffffffffffffffffffff1661048085015260a08501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe085840381016104a08701526110508483610ee6565b935060c087015191506110696104c087018360170b9052565b60e08701519150808685030183870152506110848382610f37565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156110d057835167ffffffffffffffff16835292840192918401916001016110aa565b50909695505050505050565b8183823760009101908152919050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b602081526000610f906020830184866110ec565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561119b5761119b611149565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156111e8576111e8611149565b604052919050565b80357fffff00000000000000000000000000000000000000000000000000000000000081168114610c4357600080fd5b8035600781900b8114610c4357600080fd5b60006040823603121561124457600080fd5b61124c611178565b611255836111f0565b815260208084013567ffffffffffffffff8082111561127357600080fd5b81860191506040823603121561128857600080fd5b611290611178565b61129983611220565b815283830135828111156112ac57600080fd5b929092019136601f8401126112c057600080fd5b8235828111156112d2576112d2611149565b611302857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016111a1565b9250808352368582860101111561131857600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b600181811c9082168061135157607f821691505b602082108103610cfe577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b601f8211156113d457600081815260208120601f850160051c810160208610156113b15750805b601f850160051c820191505b818110156113d0578281556001016113bd565b5050505b505050565b815167ffffffffffffffff8111156113f3576113f3611149565b61140781611401845461133d565b8461138a565b602080601f83116001811461145a57600084156114245750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b1785556113d0565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b828110156114a757888601518255948401946001909101908401611488565b50858210156114e357878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b8183526000602080850194508260005b85811015610f2c5773ffffffffffffffffffffffffffffffffffffffff61152983610c71565b1687529582019590820190600101611503565b7fffff000000000000000000000000000000000000000000000000000000000000611566826111f0565b168252600060208201357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18336030181126115a057600080fd5b6040602085015282016115b281611220565b60070b604085015260208101357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18236030181126115ef57600080fd5b0160208101903567ffffffffffffffff81111561160b57600080fd5b80360382131561161a57600080fd5b6040606086015261162f6080860182846110ec565b95945050505050565b60006104c080835261164d8184018c8e6110ec565b9050602060ff808c1682860152604085018b60005b84811015611687578361167483610c48565b1683529184019190840190600101611662565b505050505073ffffffffffffffffffffffffffffffffffffffff88166104408401528281036104608401526116bd8187896114f3565b90506116cf61048084018660170b9052565b8281036104a08401526116e2818561153c565b9c9b505050505050505050505050565b81810381811115610c6b577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c6343000813000a", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"IntVal\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"Triggered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"fieldHash\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"field\",\"type\":\"string\"}],\"name\":\"TriggeredEventWithDynamicTopic\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int32\",\"name\":\"field1\",\"type\":\"int32\"},{\"indexed\":true,\"internalType\":\"int32\",\"name\":\"field2\",\"type\":\"int32\"},{\"indexed\":true,\"internalType\":\"int32\",\"name\":\"field3\",\"type\":\"int32\"}],\"name\":\"TriggeredWithFourTopics\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"IntVal\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"addTestStruct\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDifferentPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"getElementAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"IntVal\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPrimitiveValue\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSliceValue\",\"outputs\":[{\"internalType\":\"uint64[]\",\"name\":\"\",\"type\":\"uint64[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"IntVal\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"returnSeen\",\"outputs\":[{\"components\":[{\"internalType\":\"int32\",\"name\":\"Field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"DifferentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"OracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"OracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"Account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"Accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"BigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"IntVal\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"NestedStruct\",\"type\":\"tuple\"}],\"internalType\":\"structTestStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"differentField\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"oracleId\",\"type\":\"uint8\"},{\"internalType\":\"uint8[32]\",\"name\":\"oracleIds\",\"type\":\"uint8[32]\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"int192\",\"name\":\"bigField\",\"type\":\"int192\"},{\"components\":[{\"internalType\":\"bytes2\",\"name\":\"FixedBytes\",\"type\":\"bytes2\"},{\"components\":[{\"internalType\":\"int64\",\"name\":\"IntVal\",\"type\":\"int64\"},{\"internalType\":\"string\",\"name\":\"S\",\"type\":\"string\"}],\"internalType\":\"structInnerTestStruct\",\"name\":\"Inner\",\"type\":\"tuple\"}],\"internalType\":\"structMidLevelTestStruct\",\"name\":\"nestedStruct\",\"type\":\"tuple\"}],\"name\":\"triggerEvent\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"field\",\"type\":\"string\"}],\"name\":\"triggerEventWithDynamicTopic\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"field1\",\"type\":\"int32\"},{\"internalType\":\"int32\",\"name\":\"field2\",\"type\":\"int32\"},{\"internalType\":\"int32\",\"name\":\"field3\",\"type\":\"int32\"}],\"name\":\"triggerWithFourTopics\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x608060405234801561001057600080fd5b50600180548082018255600082905260048082047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6908101805460086003958616810261010090810a8088026001600160401b0391820219909416939093179093558654808801909755848704909301805496909516909202900a91820291021990921691909117905561176c806100a96000396000f3fe608060405234801561001057600080fd5b50600436106100a35760003560e01c80637f002d6711610076578063dbfd73321161005b578063dbfd73321461013e578063ef4e1ced14610151578063f6f871c81461015857600080fd5b80637f002d671461010e578063ab5e0b381461012157600080fd5b80632c45576f146100a85780633272b66c146100d157806349eac2ac146100e6578063679004a4146100f9575b600080fd5b6100bb6100b6366004610baa565b61016b565b6040516100c89190610d09565b60405180910390f35b6100e46100df366004610e48565b610446565b005b6100e46100f4366004610f5d565b61049b565b61010161079e565b6040516100c8919061104f565b6100e461011c366004610f5d565b61082a565b6107c65b60405167ffffffffffffffff90911681526020016100c8565b6100e461014c36600461109d565b610881565b6003610125565b6100bb610166366004610f5d565b6108be565b6101736109c7565b60006101806001846110e0565b815481106101905761019061111a565b6000918252602091829020604080516101008101909152600a90920201805460030b825260018101805492939192918401916101cb90611149565b80601f01602080910402602001604051908101604052809291908181526020018280546101f790611149565b80156102445780601f1061021957610100808354040283529160200191610244565b820191906000526020600020905b81548152906001019060200180831161022757829003601f168201915b5050509183525050600282015460ff166020808301919091526040805161040081018083529190930192916003850191826000855b825461010083900a900460ff1681526020600192830181810494850194909303909202910180841161027957505050928452505050600482015473ffffffffffffffffffffffffffffffffffffffff16602080830191909152600583018054604080518285028101850182528281529401939283018282801561033257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610307575b5050509183525050600682015460170b6020808301919091526040805180820182526007808601805460f01b7fffff0000000000000000000000000000000000000000000000000000000000001683528351808501855260088801805490930b815260098801805495909701969395919486830194919392840191906103b790611149565b80601f01602080910402602001604051908101604052809291908181526020018280546103e390611149565b80156104305780601f1061040557610100808354040283529160200191610430565b820191906000526020600020905b81548152906001019060200180831161041357829003601f168201915b5050509190925250505090525090525092915050565b8181604051610456929190611196565b60405180910390207f3d969732b1bbbb9f1d7eb9f3f14e4cb50a74d950b3ef916a397b85dfbab93c67838360405161048f9291906111ef565b60405180910390a25050565b60006040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b9183908390808284376000920191909152505050815273ffffffffffffffffffffffffffffffffffffffff8816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b602082015260400161058d846112ec565b905281546001808201845560009384526020938490208351600a9093020180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff9093169290921782559282015191929091908201906105f39082611446565b5060408201516002820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff90921691909117905560608201516106419060038301906020610a16565b5060808201516004820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90921691909117905560a082015180516106a8916005840191602090910190610aa9565b5060c08201516006820180547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff90921691909117905560e082015180516007830180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001660f09290921c91909117815560208083015180516008860180547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff90921691909117815591810151909190600986019061078b9082611446565b5050505050505050505050505050505050565b6060600180548060200260200160405190810160405280929190818152602001828054801561082057602002820191906000526020600020906000905b82829054906101000a900467ffffffffffffffff1667ffffffffffffffff16815260200190600801906020826007010492830192600103820291508084116107db5790505b5050505050905090565b8960030b7f7188419dcd8b51877b71766f075f3626586c0ff190e7d056aa65ce9acb649a3d8a8a8a8a8a8a8a8a8a60405161086d999897969594939291906116a5565b60405180910390a250505050505050505050565b8060030b8260030b8460030b7f91c80dc390f3d041b3a04b0099b19634499541ea26972250986ee4b24a12fac560405160405180910390a4505050565b6108c66109c7565b6040518061010001604052808c60030b81526020018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060ff8a166020808301919091526040805161040081810183529190930192918b9183908390808284376000920191909152505050815273ffffffffffffffffffffffffffffffffffffffff8816602080830191909152604080518883028181018401835289825291909301929189918991829190850190849080828437600092019190915250505090825250601785900b60208201526040016109b6846112ec565b90529b9a5050505050505050505050565b60408051610100810182526000808252606060208301819052928201529081016109ef610b23565b8152600060208201819052606060408301819052820152608001610a11610b42565b905290565b600183019183908215610a995791602002820160005b83821115610a6a57835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302610a2c565b8015610a975782816101000a81549060ff0219169055600101602081600001049283019260010302610a6a565b505b50610aa5929150610b95565b5090565b828054828255906000526020600020908101928215610a99579160200282015b82811115610a9957825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190610ac9565b6040518061040001604052806020906020820280368337509192915050565b604051806040016040528060007dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001610a116040518060400160405280600060070b8152602001606081525090565b5b80821115610aa55760008155600101610b96565b600060208284031215610bbc57600080fd5b5035919050565b6000815180845260005b81811015610be957602081850181015186830182015201610bcd565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b8060005b6020808210610c3a5750610c51565b825160ff1685529384019390910190600101610c2b565b50505050565b600081518084526020808501945080840160005b83811015610c9d57815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101610c6b565b509495945050505050565b7fffff00000000000000000000000000000000000000000000000000000000000081511682526000602082015160406020850152805160070b60408501526020810151905060406060850152610d016080850182610bc3565b949350505050565b60208152610d1d60208201835160030b9052565b600060208301516104e0806040850152610d3b610500850183610bc3565b91506040850151610d51606086018260ff169052565b506060850151610d646080860182610c27565b50608085015173ffffffffffffffffffffffffffffffffffffffff1661048085015260a08501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe085840381016104a0870152610dc18483610c57565b935060c08701519150610dda6104c087018360170b9052565b60e0870151915080868503018387015250610df58382610ca8565b9695505050505050565b60008083601f840112610e1157600080fd5b50813567ffffffffffffffff811115610e2957600080fd5b602083019150836020828501011115610e4157600080fd5b9250929050565b60008060208385031215610e5b57600080fd5b823567ffffffffffffffff811115610e7257600080fd5b610e7e85828601610dff565b90969095509350505050565b8035600381900b8114610e9c57600080fd5b919050565b803560ff81168114610e9c57600080fd5b806104008101831015610ec457600080fd5b92915050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610e9c57600080fd5b60008083601f840112610f0057600080fd5b50813567ffffffffffffffff811115610f1857600080fd5b6020830191508360208260051b8501011115610e4157600080fd5b8035601781900b8114610e9c57600080fd5b600060408284031215610f5757600080fd5b50919050565b6000806000806000806000806000806104e08b8d031215610f7d57600080fd5b610f868b610e8a565b995060208b013567ffffffffffffffff80821115610fa357600080fd5b610faf8e838f01610dff565b909b509950899150610fc360408e01610ea1565b9850610fd28e60608f01610eb2565b9750610fe16104608e01610eca565b96506104808d0135915080821115610ff857600080fd5b6110048e838f01610eee565b90965094508491506110196104a08e01610f33565b93506104c08d013591508082111561103057600080fd5b5061103d8d828e01610f45565b9150509295989b9194979a5092959850565b6020808252825182820181905260009190848201906040850190845b8181101561109157835167ffffffffffffffff168352928401929184019160010161106b565b50909695505050505050565b6000806000606084860312156110b257600080fd5b6110bb84610e8a565b92506110c960208501610e8a565b91506110d760408501610e8a565b90509250925092565b81810381811115610ec4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600181811c9082168061115d57607f821691505b602082108103610f57577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b8183823760009101908152919050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b602081526000610d016020830184866111a6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561125557611255611203565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156112a2576112a2611203565b604052919050565b80357fffff00000000000000000000000000000000000000000000000000000000000081168114610e9c57600080fd5b8035600781900b8114610e9c57600080fd5b6000604082360312156112fe57600080fd5b611306611232565b61130f836112aa565b815260208084013567ffffffffffffffff8082111561132d57600080fd5b81860191506040823603121561134257600080fd5b61134a611232565b611353836112da565b8152838301358281111561136657600080fd5b929092019136601f84011261137a57600080fd5b82358281111561138c5761138c611203565b6113bc857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160161125b565b925080835236858286010111156113d257600080fd5b8085850186850137600090830185015280840191909152918301919091525092915050565b601f82111561144157600081815260208120601f850160051c8101602086101561141e5750805b601f850160051c820191505b8181101561143d5782815560010161142a565b5050505b505050565b815167ffffffffffffffff81111561146057611460611203565b6114748161146e8454611149565b846113f7565b602080601f8311600181146114c757600084156114915750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b17855561143d565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b82811015611514578886015182559484019460019091019084016114f5565b508582101561155057878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b8183526000602080850194508260005b85811015610c9d5773ffffffffffffffffffffffffffffffffffffffff61159683610eca565b1687529582019590820190600101611570565b7fffff0000000000000000000000000000000000000000000000000000000000006115d3826112aa565b168252600060208201357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc183360301811261160d57600080fd5b60406020850152820161161f816112da565b60070b604085015260208101357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe182360301811261165c57600080fd5b0160208101903567ffffffffffffffff81111561167857600080fd5b80360382131561168757600080fd5b6040606086015261169c6080860182846111a6565b95945050505050565b60006104c08083526116ba8184018c8e6111a6565b9050602060ff808c1682860152604085018b60005b848110156116f457836116e183610ea1565b16835291840191908401906001016116cf565b505050505073ffffffffffffffffffffffffffffffffffffffff881661044084015282810361046084015261172a818789611560565b905061173c61048084018660170b9052565b8281036104a084015261174f81856115a9565b9c9b50505050505050505050505056fea164736f6c6343000813000a", } var LatestValueHolderABI = LatestValueHolderMetaData.ABI @@ -194,7 +194,7 @@ func (_LatestValueHolder *LatestValueHolderTransactorRaw) Transact(opts *bind.Tr func (_LatestValueHolder *LatestValueHolderCaller) GetDifferentPrimitiveValue(opts *bind.CallOpts) (uint64, error) { var out []interface{} - err := _LatestValueHolder.contract.Call(opts, &out, "GetDifferentPrimitiveValue") + err := _LatestValueHolder.contract.Call(opts, &out, "getDifferentPrimitiveValue") if err != nil { return *new(uint64), err @@ -216,7 +216,7 @@ func (_LatestValueHolder *LatestValueHolderCallerSession) GetDifferentPrimitiveV func (_LatestValueHolder *LatestValueHolderCaller) GetElementAtIndex(opts *bind.CallOpts, i *big.Int) (TestStruct, error) { var out []interface{} - err := _LatestValueHolder.contract.Call(opts, &out, "GetElementAtIndex", i) + err := _LatestValueHolder.contract.Call(opts, &out, "getElementAtIndex", i) if err != nil { return *new(TestStruct), err @@ -238,7 +238,7 @@ func (_LatestValueHolder *LatestValueHolderCallerSession) GetElementAtIndex(i *b func (_LatestValueHolder *LatestValueHolderCaller) GetPrimitiveValue(opts *bind.CallOpts) (uint64, error) { var out []interface{} - err := _LatestValueHolder.contract.Call(opts, &out, "GetPrimitiveValue") + err := _LatestValueHolder.contract.Call(opts, &out, "getPrimitiveValue") if err != nil { return *new(uint64), err @@ -260,7 +260,7 @@ func (_LatestValueHolder *LatestValueHolderCallerSession) GetPrimitiveValue() (u func (_LatestValueHolder *LatestValueHolderCaller) GetSliceValue(opts *bind.CallOpts) ([]uint64, error) { var out []interface{} - err := _LatestValueHolder.contract.Call(opts, &out, "GetSliceValue") + err := _LatestValueHolder.contract.Call(opts, &out, "getSliceValue") if err != nil { return *new([]uint64), err @@ -282,7 +282,7 @@ func (_LatestValueHolder *LatestValueHolderCallerSession) GetSliceValue() ([]uin func (_LatestValueHolder *LatestValueHolderCaller) ReturnSeen(opts *bind.CallOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (TestStruct, error) { var out []interface{} - err := _LatestValueHolder.contract.Call(opts, &out, "ReturnSeen", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) + err := _LatestValueHolder.contract.Call(opts, &out, "returnSeen", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) if err != nil { return *new(TestStruct), err @@ -303,7 +303,7 @@ func (_LatestValueHolder *LatestValueHolderCallerSession) ReturnSeen(field int32 } func (_LatestValueHolder *LatestValueHolderTransactor) AddTestStruct(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { - return _LatestValueHolder.contract.Transact(opts, "AddTestStruct", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) + return _LatestValueHolder.contract.Transact(opts, "addTestStruct", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) } func (_LatestValueHolder *LatestValueHolderSession) AddTestStruct(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { @@ -315,7 +315,7 @@ func (_LatestValueHolder *LatestValueHolderTransactorSession) AddTestStruct(fiel } func (_LatestValueHolder *LatestValueHolderTransactor) TriggerEvent(opts *bind.TransactOpts, field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { - return _LatestValueHolder.contract.Transact(opts, "TriggerEvent", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) + return _LatestValueHolder.contract.Transact(opts, "triggerEvent", field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct) } func (_LatestValueHolder *LatestValueHolderSession) TriggerEvent(field int32, differentField string, oracleId uint8, oracleIds [32]uint8, account common.Address, accounts []common.Address, bigField *big.Int, nestedStruct MidLevelTestStruct) (*types.Transaction, error) { @@ -327,7 +327,7 @@ func (_LatestValueHolder *LatestValueHolderTransactorSession) TriggerEvent(field } func (_LatestValueHolder *LatestValueHolderTransactor) TriggerEventWithDynamicTopic(opts *bind.TransactOpts, field string) (*types.Transaction, error) { - return _LatestValueHolder.contract.Transact(opts, "TriggerEventWithDynamicTopic", field) + return _LatestValueHolder.contract.Transact(opts, "triggerEventWithDynamicTopic", field) } func (_LatestValueHolder *LatestValueHolderSession) TriggerEventWithDynamicTopic(field string) (*types.Transaction, error) { @@ -339,7 +339,7 @@ func (_LatestValueHolder *LatestValueHolderTransactorSession) TriggerEventWithDy } func (_LatestValueHolder *LatestValueHolderTransactor) TriggerWithFourTopics(opts *bind.TransactOpts, field1 int32, field2 int32, field3 int32) (*types.Transaction, error) { - return _LatestValueHolder.contract.Transact(opts, "TriggerWithFourTopics", field1, field2, field3) + return _LatestValueHolder.contract.Transact(opts, "triggerWithFourTopics", field1, field2, field3) } func (_LatestValueHolder *LatestValueHolderSession) TriggerWithFourTopics(field1 int32, field2 int32, field3 int32) (*types.Transaction, error) { diff --git a/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt b/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt index 8f6789012a1..4ac82a5fab8 100644 --- a/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt +++ b/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt @@ -11,7 +11,7 @@ batch_blockhash_store: ../../contracts/solc/v0.8.6/BatchBlockhashStore/BatchBloc batch_vrf_coordinator_v2: ../../contracts/solc/v0.8.6/BatchVRFCoordinatorV2/BatchVRFCoordinatorV2.abi ../../contracts/solc/v0.8.6/BatchVRFCoordinatorV2/BatchVRFCoordinatorV2.bin d0a54963260d8c1f1bbd984b758285e6027cfb5a7e42701bcb562ab123219332 batch_vrf_coordinator_v2plus: ../../contracts/solc/v0.8.6/BatchVRFCoordinatorV2Plus/BatchVRFCoordinatorV2Plus.abi ../../contracts/solc/v0.8.6/BatchVRFCoordinatorV2Plus/BatchVRFCoordinatorV2Plus.bin 7bb76ae241cf1b37b41920830b836cb99f1ad33efd7435ca2398ff6cd2fe5d48 blockhash_store: ../../contracts/solc/v0.8.6/BlockhashStore/BlockhashStore.abi ../../contracts/solc/v0.8.6/BlockhashStore/BlockhashStore.bin 12b0662f1636a341c8863bdec7a20f2ddd97c3a4fd1a7ae353fe316609face4e -chain_reader_example: ../../contracts/solc/v0.8.19/ChainReaderTestContract/LatestValueHolder.abi ../../contracts/solc/v0.8.19/ChainReaderTestContract/LatestValueHolder.bin 77b8d15609d34d553950e3170a86a39943437f63396289935da64c001efafa25 +chain_reader_example: ../../contracts/solc/v0.8.19/ChainReaderTestContract/LatestValueHolder.abi ../../contracts/solc/v0.8.19/ChainReaderTestContract/LatestValueHolder.bin de88c7e68de36b96aa2bec844bdc96fcd7c9017b38e25062b3b9f9cec42c814f chain_specific_util_helper: ../../contracts/solc/v0.8.6/ChainSpecificUtilHelper/ChainSpecificUtilHelper.abi ../../contracts/solc/v0.8.6/ChainSpecificUtilHelper/ChainSpecificUtilHelper.bin 5f10664e31abc768f4a37901cae7a3bef90146180f97303e5a1bde5a08d84595 consumer_wrapper: ../../contracts/solc/v0.7/Consumer/Consumer.abi ../../contracts/solc/v0.7/Consumer/Consumer.bin 894d1cbd920dccbd36d92918c1037c6ded34f66f417ccb18ec3f33c64ef83ec5 cron_upkeep_factory_wrapper: ../../contracts/solc/v0.8.6/CronUpkeepFactory/CronUpkeepFactory.abi - dacb0f8cdf54ae9d2781c5e720fc314b32ed5e58eddccff512c75d6067292cd7 diff --git a/core/services/job/testdata/compact.toml b/core/services/job/testdata/compact.toml index 10f9fdf0875..9f0f54027d2 100644 --- a/core/services/job/testdata/compact.toml +++ b/core/services/job/testdata/compact.toml @@ -23,7 +23,7 @@ contractABI = "[\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n [relayConfig.chainReader.contracts.median.configs] LatestRoundRequested = "{\n \"chainSpecificName\": \"RoundRequested\",\n \"readType\": \"event\"\n}\n" -LatestTransmissionDetails = "{\n \"chainSpecificName\": \"latestTransmissionDetails\",\n \"output_modifications\": [\n {\n \"Fields\": [\n \"LatestTimestamp_\"\n ],\n \"Type\": \"epoch to time\"\n },\n {\n \"Fields\": {\n \"LatestAnswer_\": \"LatestAnswer\",\n \"LatestTimestamp_\": \"LatestTimestamp\"\n },\n \"Type\": \"rename\"\n }\n ]\n}\n" +LatestTransmissionDetails = "{\n \"chainSpecificName\": \"latestTransmissionDetails\",\n \"outputModifications\": [\n {\n \"Fields\": [\n \"LatestTimestamp_\"\n ],\n \"Type\": \"epoch to time\"\n },\n {\n \"Fields\": {\n \"LatestAnswer_\": \"LatestAnswer\",\n \"LatestTimestamp_\": \"LatestTimestamp\"\n },\n \"Type\": \"rename\"\n }\n ]\n}\n" [relayConfig.codec] [relayConfig.codec.configs] diff --git a/core/services/job/testdata/pretty.toml b/core/services/job/testdata/pretty.toml index def8ab29871..88bacff7db2 100644 --- a/core/services/job/testdata/pretty.toml +++ b/core/services/job/testdata/pretty.toml @@ -90,7 +90,7 @@ LatestRoundRequested = ''' LatestTransmissionDetails = ''' { "chainSpecificName": "latestTransmissionDetails", - "output_modifications": [ + "outputModifications": [ { "Fields": [ "LatestTimestamp_" diff --git a/core/services/relay/evm/chain_reader_test.go b/core/services/relay/evm/chain_reader_test.go index a3adb6f35b3..4981dc3696a 100644 --- a/core/services/relay/evm/chain_reader_test.go +++ b/core/services/relay/evm/chain_reader_test.go @@ -165,20 +165,26 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { ContractABI: chain_reader_example.LatestValueHolderMetaData.ABI, Configs: map[string]*types.ChainReaderDefinition{ MethodTakingLatestParamsReturningTestStruct: { - ChainSpecificName: "GetElementAtIndex", + ChainSpecificName: "getElementAtIndex", + OutputModifications: codec.ModifiersConfig{ + &codec.RenameModifierConfig{Fields: map[string]string{"NestedStruct.Inner.IntVal": "I"}}, + }, }, MethodReturningUint64: { - ChainSpecificName: "GetPrimitiveValue", + ChainSpecificName: "getPrimitiveValue", }, DifferentMethodReturningUint64: { - ChainSpecificName: "GetDifferentPrimitiveValue", + ChainSpecificName: "getDifferentPrimitiveValue", }, MethodReturningUint64Slice: { - ChainSpecificName: "GetSliceValue", + ChainSpecificName: "getSliceValue", }, EventName: { ChainSpecificName: "Triggered", ReadType: types.Event, + OutputModifications: codec.ModifiersConfig{ + &codec.RenameModifierConfig{Fields: map[string]string{"NestedStruct.Inner.IntVal": "I"}}, + }, }, EventWithFilterName: { ChainSpecificName: "Triggered", @@ -199,7 +205,7 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { EventInputFields: []string{"Field1", "Field2", "Field3"}, }, MethodReturningSeenStruct: { - ChainSpecificName: "ReturnSeen", + ChainSpecificName: "returnSeen", InputModifications: codec.ModifiersConfig{ &codec.HardCodeModifierConfig{ OnChainValues: map[string]any{ @@ -209,8 +215,8 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { }, }, OutputModifications: codec.ModifiersConfig{ - &codec.HardCodeModifierConfig{ - OffChainValues: map[string]any{"ExtraField": anyExtraValue}}, + &codec.HardCodeModifierConfig{OffChainValues: map[string]any{"ExtraField": anyExtraValue}}, + &codec.RenameModifierConfig{Fields: map[string]string{"NestedStruct.Inner.IntVal": "I"}}, }, }, }, @@ -219,7 +225,7 @@ func (it *chainReaderInterfaceTester) Setup(t *testing.T) { ContractABI: chain_reader_example.LatestValueHolderMetaData.ABI, Configs: map[string]*types.ChainReaderDefinition{ MethodReturningUint64: { - ChainSpecificName: "GetDifferentPrimitiveValue", + ChainSpecificName: "getDifferentPrimitiveValue", }, }, }, @@ -410,8 +416,8 @@ func midToInternalType(m MidLevelTestStruct) chain_reader_example.MidLevelTestSt return chain_reader_example.MidLevelTestStruct{ FixedBytes: m.FixedBytes, Inner: chain_reader_example.InnerTestStruct{ - I: int64(m.Inner.I), - S: m.Inner.S, + IntVal: int64(m.Inner.I), + S: m.Inner.S, }, } } From 2ee2a95d9d8e520b4da72b8847c2e9c425860fbd Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 17 Jan 2024 10:55:46 -0500 Subject: [PATCH 094/112] Update common for a rename and fix tests that I broke a couple commits ago --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- core/services/relay/evm/chain_reader.go | 2 +- core/services/relay/evm/codec_test.go | 23 +++++++++++++++-------- core/services/relay/evm/event_binding.go | 2 +- core/services/relay/evm/parsed_types.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 10 files changed, 27 insertions(+), 20 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 9603be6368e..b4db6b9e2d9 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index d1df655c6ed..84f656e7e4c 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1164,8 +1164,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5 h1:o36okzBAbWhlxKrIeb66Iw/U7Uy3j4FsPGQREb06SUo= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e h1:dbFIpyD+w0sgxGfgVa24ZGZZdJyQ6el648K4Ih+YAUo= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index 1f64ef40839..dba05af7e3c 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -216,7 +216,7 @@ func (cr *chainReader) getEventInput(def types.ChainReaderDefinition, contractNa } // initialize the modification - if _, err = inMod.RetypeForOffChain(reflect.PointerTo(inputInfo.CheckedType()), ""); err != nil { + if _, err = inMod.RetypeToOffChain(reflect.PointerTo(inputInfo.CheckedType()), ""); err != nil { return nil, nil, err } diff --git a/core/services/relay/evm/codec_test.go b/core/services/relay/evm/codec_test.go index e3304686b47..c5c0521dff5 100644 --- a/core/services/relay/evm/codec_test.go +++ b/core/services/relay/evm/codec_test.go @@ -78,15 +78,22 @@ func (it *codecInterfaceTester) GetCodec(t *testing.T) commontypes.Codec { require.NoError(t, err) entry := codecConfig.Configs[k] entry.TypeABI = string(defBytes) - if k == TestItemWithConfigExtra { + + if k != sizeItemType { entry.ModifierConfigs = codec.ModifiersConfig{ - &codec.HardCodeModifierConfig{ - OnChainValues: map[string]any{ - "BigField": testStruct.BigField.String(), - "Account": hexutil.Encode(testStruct.Account), - }, - OffChainValues: map[string]any{"ExtraField": anyExtraValue}}, + &codec.RenameModifierConfig{Fields: map[string]string{"NestedStruct.Inner.IntVal": "I"}}, + } + } + + if k == TestItemWithConfigExtra { + hardCode := &codec.HardCodeModifierConfig{ + OnChainValues: map[string]any{ + "BigField": testStruct.BigField.String(), + "Account": hexutil.Encode(testStruct.Account), + }, + OffChainValues: map[string]any{"ExtraField": anyExtraValue}, } + entry.ModifierConfigs = append(entry.ModifierConfigs, hardCode) } codecConfig.Configs[k] = entry } @@ -150,7 +157,7 @@ func packArgs(t *testing.T, allArgs []any, oargs abi.Arguments, request *EncodeR } var inner = []abi.ArgumentMarshaling{ - {Name: "I", Type: "int64"}, + {Name: "IntVal", Type: "int64"}, {Name: "S", Type: "string"}, } diff --git a/core/services/relay/evm/event_binding.go b/core/services/relay/evm/event_binding.go index f520e6f0f82..85028853c79 100644 --- a/core/services/relay/evm/event_binding.go +++ b/core/services/relay/evm/event_binding.go @@ -124,7 +124,7 @@ func (e *eventBinding) getLatestValueWithFilters( return err } - checkedParams, err := e.inputModifier.TransformForOnChain(offChain, "" /* unused */) + checkedParams, err := e.inputModifier.TransformToOnChain(offChain, "" /* unused */) if err != nil { return err } diff --git a/core/services/relay/evm/parsed_types.go b/core/services/relay/evm/parsed_types.go index 8ffa9ae0a6a..168057e998d 100644 --- a/core/services/relay/evm/parsed_types.go +++ b/core/services/relay/evm/parsed_types.go @@ -41,7 +41,7 @@ func (parsed *parsedTypes) toCodec() (commontypes.RemoteCodec, error) { func addEntries(defs map[string]types.CodecEntry, modByTypeName map[string]codec.Modifier) error { for k, def := range defs { modByTypeName[k] = def.Modifier() - _, err := def.Modifier().RetypeForOffChain(reflect.PointerTo(def.CheckedType()), k) + _, err := def.Modifier().RetypeToOffChain(reflect.PointerTo(def.CheckedType()), k) if err != nil { return fmt.Errorf("%w: cannot retype %v: %w", commontypes.ErrInvalidConfig, k, err) } diff --git a/go.mod b/go.mod index b64aea78ffe..f9bfbf7281c 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 diff --git a/go.sum b/go.sum index 74f647919fd..2fd13762e3d 100644 --- a/go.sum +++ b/go.sum @@ -1150,8 +1150,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5 h1:o36okzBAbWhlxKrIeb66Iw/U7Uy3j4FsPGQREb06SUo= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e h1:dbFIpyD+w0sgxGfgVa24ZGZZdJyQ6el648K4Ih+YAUo= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 506277689dd..a63f6318817 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -25,7 +25,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e github.com/smartcontractkit/chainlink-testing-framework v1.22.1 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index fab47ad1182..d38cf2ce6e8 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1481,8 +1481,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5 h1:o36okzBAbWhlxKrIeb66Iw/U7Uy3j4FsPGQREb06SUo= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240116201354-23cd46ccbbe5/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e h1:dbFIpyD+w0sgxGfgVa24ZGZZdJyQ6el648K4Ih+YAUo= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From 5ad3eca4653e6d6b13268f389c7a84fae41ba726 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 17 Jan 2024 11:25:18 -0500 Subject: [PATCH 095/112] Move test contract --- contracts/scripts/native_solc_compile_all_shared | 2 +- .../v0.8/shared/test/{ => helpers}/ChainReaderTestContract.sol | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename contracts/src/v0.8/shared/test/{ => helpers}/ChainReaderTestContract.sol (100%) diff --git a/contracts/scripts/native_solc_compile_all_shared b/contracts/scripts/native_solc_compile_all_shared index 60cdd12c6a2..eeaa9902346 100755 --- a/contracts/scripts/native_solc_compile_all_shared +++ b/contracts/scripts/native_solc_compile_all_shared @@ -32,4 +32,4 @@ compileContract shared/token/ERC677/BurnMintERC677.sol compileContract shared/token/ERC677/LinkToken.sol compileContract shared/mocks/WERC20Mock.sol compileContract vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/ERC20.sol -compileContract shared/test/ChainReaderTestContract.sol +compileContract shared/test/helpers/ChainReaderTestContract.sol diff --git a/contracts/src/v0.8/shared/test/ChainReaderTestContract.sol b/contracts/src/v0.8/shared/test/helpers/ChainReaderTestContract.sol similarity index 100% rename from contracts/src/v0.8/shared/test/ChainReaderTestContract.sol rename to contracts/src/v0.8/shared/test/helpers/ChainReaderTestContract.sol From 308f8d710ac61d2aad163471eb91098a4937879e Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 17 Jan 2024 11:52:45 -0500 Subject: [PATCH 096/112] Commit with fixed contract for codec test and add small check to if statement for arg len --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- core/services/relay/evm/codec_test.go | 6 +++++- core/services/relay/evm/encoder.go | 5 ++++- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 8 files changed, 18 insertions(+), 11 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index b4db6b9e2d9..85fe9e0486a 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117164837-8f313a76c76a github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 84f656e7e4c..34b492e0a85 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1164,8 +1164,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e h1:dbFIpyD+w0sgxGfgVa24ZGZZdJyQ6el648K4Ih+YAUo= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117164837-8f313a76c76a h1:NgvQ7y7D5fTH9pE+kHBOceXv4O0hZ3ydAvIMTGoe2BA= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117164837-8f313a76c76a/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/core/services/relay/evm/codec_test.go b/core/services/relay/evm/codec_test.go index c5c0521dff5..b13051cb010 100644 --- a/core/services/relay/evm/codec_test.go +++ b/core/services/relay/evm/codec_test.go @@ -12,6 +12,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/codec" + looptestutils "github.com/smartcontractkit/chainlink-common/pkg/loop/testutils" //nolint common practice to import test mods with . commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" . "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" //nolint common practice to import test mods with . @@ -26,6 +27,8 @@ const anyExtraValue = 3 func TestCodec(t *testing.T) { tester := &codecInterfaceTester{} RunCodecInterfaceTests(t, tester) + RunCodecInterfaceTests(t, looptestutils.WrapCodecTesterForLoop(tester)) + anyN := 10 c := tester.GetCodec(t) t.Run("GetMaxEncodingSize delegates to GetMaxSize", func(t *testing.T) { @@ -79,7 +82,7 @@ func (it *codecInterfaceTester) GetCodec(t *testing.T) commontypes.Codec { entry := codecConfig.Configs[k] entry.TypeABI = string(defBytes) - if k != sizeItemType { + if k != sizeItemType && k != NilType { entry.ModifierConfigs = codec.ModifiersConfig{ &codec.RenameModifierConfig{Fields: map[string]string{"NestedStruct.Inner.IntVal": "I"}}, } @@ -195,6 +198,7 @@ var codecDefs = map[string][]abi.ArgumentMarshaling{ {Name: "OtherStuff", Type: "int256"}, }, TestItemWithConfigExtra: ts, + NilType: {}, } func parseDefs(t *testing.T) map[string]abi.Arguments { diff --git a/core/services/relay/evm/encoder.go b/core/services/relay/evm/encoder.go index afead53f34e..aa0487c7216 100644 --- a/core/services/relay/evm/encoder.go +++ b/core/services/relay/evm/encoder.go @@ -30,7 +30,10 @@ func (e *encoder) Encode(_ context.Context, item any, itemType string) (res []by } if item == nil { - return info.EncodingPrefix(), nil + if len(info.Args()) == 0 { + return info.EncodingPrefix(), nil + } + return nil, fmt.Errorf("%w: cannot encode nil value for %s", commontypes.ErrInvalidType, itemType) } return encode(reflect.ValueOf(item), info) diff --git a/go.mod b/go.mod index f9bfbf7281c..5a2557e3a95 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117164837-8f313a76c76a github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240110170252-c27581c17dc1 diff --git a/go.sum b/go.sum index 2fd13762e3d..6e8e7d675d9 100644 --- a/go.sum +++ b/go.sum @@ -1150,8 +1150,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e h1:dbFIpyD+w0sgxGfgVa24ZGZZdJyQ6el648K4Ih+YAUo= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117164837-8f313a76c76a h1:NgvQ7y7D5fTH9pE+kHBOceXv4O0hZ3ydAvIMTGoe2BA= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117164837-8f313a76c76a/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index a63f6318817..37e6e3a7fa7 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -25,7 +25,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117164837-8f313a76c76a github.com/smartcontractkit/chainlink-testing-framework v1.22.1 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index d38cf2ce6e8..7334e072cf9 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1481,8 +1481,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e h1:dbFIpyD+w0sgxGfgVa24ZGZZdJyQ6el648K4Ih+YAUo= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117153340-99068ae17c7e/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117164837-8f313a76c76a h1:NgvQ7y7D5fTH9pE+kHBOceXv4O0hZ3ydAvIMTGoe2BA= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240117164837-8f313a76c76a/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From 7ac5618bcef17420ea6e230d2453ec16dbc47304 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 17 Jan 2024 15:13:28 -0500 Subject: [PATCH 097/112] small fix to encoder, and fix config in feature test --- core/internal/features/ocr2/features_ocr2_test.go | 3 ++- core/services/relay/evm/encoder.go | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/internal/features/ocr2/features_ocr2_test.go b/core/internal/features/ocr2/features_ocr2_test.go index 8ecc529ba2b..002f1d192ae 100644 --- a/core/internal/features/ocr2/features_ocr2_test.go +++ b/core/internal/features/ocr2/features_ocr2_test.go @@ -35,6 +35,7 @@ import ( ocrtypes2 "github.com/smartcontractkit/libocr/offchainreporting2plus/types" commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" + "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" @@ -394,7 +395,7 @@ LatestRoundRequested = ''' LatestTransmissionDetails = ''' { "chainSpecificName": "latestTransmissionDetails", - "output_modifications": [ + "outputModifications": [ { "Fields": [ "LatestTimestamp_" diff --git a/core/services/relay/evm/encoder.go b/core/services/relay/evm/encoder.go index aa0487c7216..ae60e4ab35a 100644 --- a/core/services/relay/evm/encoder.go +++ b/core/services/relay/evm/encoder.go @@ -29,10 +29,9 @@ func (e *encoder) Encode(_ context.Context, item any, itemType string) (res []by return nil, fmt.Errorf("%w: cannot find definition for %s", commontypes.ErrInvalidType, itemType) } - if item == nil { - if len(info.Args()) == 0 { - return info.EncodingPrefix(), nil - } + if len(info.Args()) == 0 { + return info.EncodingPrefix(), nil + } else if item == nil { return nil, fmt.Errorf("%w: cannot encode nil value for %s", commontypes.ErrInvalidType, itemType) } From 2981f927bfee7aa002aa101c092470704d0abd07 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Thu, 18 Jan 2024 09:51:22 -0500 Subject: [PATCH 098/112] Remove debug line since smoke test is passing now and I need to be ready to merge --- .github/workflows/integration-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 27a95d85eb1..365fc4f712c 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -310,7 +310,6 @@ jobs: CHAINLINK_COMMIT_SHA: ${{ github.sha }} CHAINLINK_ENV_USER: ${{ github.actor }} TEST_LOG_LEVEL: debug - TEST_LOG_COLLECT: "true" #DEBUG: Remove after debugging strategy: fail-fast: false matrix: From 3d2875640754ca83c8e1e66e57069f587da306ca Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Thu, 18 Jan 2024 10:01:23 -0500 Subject: [PATCH 099/112] Fix bad merge conflict --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c767fd28b64..95b0b79ca0c 100644 --- a/go.mod +++ b/go.mod @@ -64,7 +64,7 @@ require ( github.com/shirou/gopsutil/v3 v3.23.11 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 - github.com/smartcontractkit/chainlink-automation v1.0.1 + github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 github.com/smartcontractkit/chainlink-common v0.1.7-0.20240118144452-7fcb73fb88c8 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 diff --git a/go.sum b/go.sum index 549b875f43b..9f2719de7c2 100644 --- a/go.sum +++ b/go.sum @@ -1151,8 +1151,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumvbfM1u/etVq42Afwq/jtNSBSOA8n5jntnNPo= github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= -github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= -github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= +github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= +github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= github.com/smartcontractkit/chainlink-common v0.1.7-0.20240118144452-7fcb73fb88c8 h1:6pL+DzkEGLT4NTd1SoGk1vL0/cbkDuvBsV0DRUb4lrc= github.com/smartcontractkit/chainlink-common v0.1.7-0.20240118144452-7fcb73fb88c8/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= From bc0bcbccdbbd772102e899563adc4cc1a8ad3fdb Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Thu, 18 Jan 2024 18:59:03 -0500 Subject: [PATCH 100/112] small PR fixes --- .github/workflows/integration-tests.yml | 4 ++-- .../relay/evm/types/gen/{bytes.tmpl => bytes.go.tmpl} | 0 core/services/relay/evm/types/gen/{ints.tmpl => ints.go.tmpl} | 0 core/services/relay/evm/types/gen/main.go | 4 ++-- core/services/relay/evm/types/int_types_test.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename core/services/relay/evm/types/gen/{bytes.tmpl => bytes.go.tmpl} (100%) rename core/services/relay/evm/types/gen/{ints.tmpl => ints.go.tmpl} (100%) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 365fc4f712c..2874e11fe58 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -329,12 +329,12 @@ jobs: pyroscope_env: ci-smoke-ocr-evm-simulated - name: ocr2 nodes: 6 - os: ubuntu-latest-16cores-64GB + os: ubuntu-latest file: ocr2 pyroscope_env: ci-smoke-ocr2-evm-simulated - name: ocr2 nodes: 6 - os: ubuntu-latest-16cores-64GB + os: ubuntu-latest pyroscope_env: ci-smoke-ocr2-plugins-evm-simulated tag_suffix: "-plugins" - name: runlog diff --git a/core/services/relay/evm/types/gen/bytes.tmpl b/core/services/relay/evm/types/gen/bytes.go.tmpl similarity index 100% rename from core/services/relay/evm/types/gen/bytes.tmpl rename to core/services/relay/evm/types/gen/bytes.go.tmpl diff --git a/core/services/relay/evm/types/gen/ints.tmpl b/core/services/relay/evm/types/gen/ints.go.tmpl similarity index 100% rename from core/services/relay/evm/types/gen/ints.tmpl rename to core/services/relay/evm/types/gen/ints.go.tmpl diff --git a/core/services/relay/evm/types/gen/main.go b/core/services/relay/evm/types/gen/main.go index 3d3df924985..84e7c008ee0 100644 --- a/core/services/relay/evm/types/gen/main.go +++ b/core/services/relay/evm/types/gen/main.go @@ -66,8 +66,8 @@ type ByteType struct { Size int } -//go:embed bytes.tmpl +//go:embed bytes.go.tmpl var bytesTemplate string -//go:embed ints.tmpl +//go:embed ints.go.tmpl var intsTemplate string diff --git a/core/services/relay/evm/types/int_types_test.go b/core/services/relay/evm/types/int_types_test.go index 1227773ce90..6930287c869 100644 --- a/core/services/relay/evm/types/int_types_test.go +++ b/core/services/relay/evm/types/int_types_test.go @@ -1,12 +1,12 @@ package types import ( + "errors" "fmt" "math/big" "reflect" "testing" - "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" From 469296b2553f2664b84cb27a744547778799752c Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Thu, 18 Jan 2024 19:06:55 -0500 Subject: [PATCH 101/112] Couple more error fixes --- core/services/relay/evm/types/codec_entry_test.go | 2 +- core/services/relay/evm/types/types.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/services/relay/evm/types/codec_entry_test.go b/core/services/relay/evm/types/codec_entry_test.go index 861fb4b96e2..8cd5e661c9f 100644 --- a/core/services/relay/evm/types/codec_entry_test.go +++ b/core/services/relay/evm/types/codec_entry_test.go @@ -1,13 +1,13 @@ package types import ( + "errors" "math/big" "reflect" "testing" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" - "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/core/services/relay/evm/types/types.go b/core/services/relay/evm/types/types.go index 2ec5c9c8034..0697605edab 100644 --- a/core/services/relay/evm/types/types.go +++ b/core/services/relay/evm/types/types.go @@ -4,11 +4,11 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" "github.com/ethereum/go-ethereum/common" "github.com/lib/pq" - "github.com/pkg/errors" ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "gopkg.in/guregu/null.v2" From 139bf167d84b9985e2e587324bcf2587850a6007 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Thu, 18 Jan 2024 21:11:13 -0500 Subject: [PATCH 102/112] update common --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 9c81c91d11f..4693cfb4a8e 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240118144452-7fcb73fb88c8 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240112202000-6359502d2ff1 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 65021ed0c83..69ea4527581 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1167,8 +1167,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240118144452-7fcb73fb88c8 h1:6pL+DzkEGLT4NTd1SoGk1vL0/cbkDuvBsV0DRUb4lrc= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240118144452-7fcb73fb88c8/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be h1:ahwXHg5kImjhq85kWRxylXJBqClZpdrBvip9ApQJTP8= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/go.mod b/go.mod index 95b0b79ca0c..c89744ae384 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240118144452-7fcb73fb88c8 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240118144557-d4e74bc6a6ff diff --git a/go.sum b/go.sum index 9f2719de7c2..3c8f05ee4e0 100644 --- a/go.sum +++ b/go.sum @@ -1153,8 +1153,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240118144452-7fcb73fb88c8 h1:6pL+DzkEGLT4NTd1SoGk1vL0/cbkDuvBsV0DRUb4lrc= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240118144452-7fcb73fb88c8/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be h1:ahwXHg5kImjhq85kWRxylXJBqClZpdrBvip9ApQJTP8= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 0e3919f615e..05bf6a226b4 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -25,7 +25,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240118144452-7fcb73fb88c8 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be github.com/smartcontractkit/chainlink-testing-framework v1.22.4 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 5e1aecb2d3f..f7e0402f20d 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1486,8 +1486,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240118144452-7fcb73fb88c8 h1:6pL+DzkEGLT4NTd1SoGk1vL0/cbkDuvBsV0DRUb4lrc= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240118144452-7fcb73fb88c8/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be h1:ahwXHg5kImjhq85kWRxylXJBqClZpdrBvip9ApQJTP8= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From 7acd8a5ce4cb71e81c376021d40a48f171184086 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Thu, 18 Jan 2024 21:15:13 -0500 Subject: [PATCH 103/112] update feeds to point to main --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 4693cfb4a8e..7ea30dfb1a7 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -246,7 +246,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240118144557-d4e74bc6a6ff // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 69ea4527581..1687e776007 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1173,8 +1173,8 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240118144557-d4e74bc6a6ff h1:mGY0TLvBCJPfWVsp/oiIhcFZdEnbZO7Xmydtw+K2pSM= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240118144557-d4e74bc6a6ff/go.mod h1:dq0bKvJNqJ2ur7zDUqOh+IdZUFAAiXz65j2q/Mt/FkA= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= diff --git a/go.mod b/go.mod index c89744ae384..ae78cfbefe6 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240118144557-d4e74bc6a6ff + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 diff --git a/go.sum b/go.sum index 3c8f05ee4e0..ed69fd980bd 100644 --- a/go.sum +++ b/go.sum @@ -1159,8 +1159,8 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240118144557-d4e74bc6a6ff h1:mGY0TLvBCJPfWVsp/oiIhcFZdEnbZO7Xmydtw+K2pSM= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240118144557-d4e74bc6a6ff/go.mod h1:dq0bKvJNqJ2ur7zDUqOh+IdZUFAAiXz65j2q/Mt/FkA= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 05bf6a226b4..fc2a773f2f6 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -366,7 +366,7 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240118144557-d4e74bc6a6ff // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index f7e0402f20d..d18ddfef9c7 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1492,8 +1492,8 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f7 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240118144557-d4e74bc6a6ff h1:mGY0TLvBCJPfWVsp/oiIhcFZdEnbZO7Xmydtw+K2pSM= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240118144557-d4e74bc6a6ff/go.mod h1:dq0bKvJNqJ2ur7zDUqOh+IdZUFAAiXz65j2q/Mt/FkA= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= From d0becd70bfb2e9622a0509454863ae7784d47b42 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Thu, 18 Jan 2024 22:28:34 -0500 Subject: [PATCH 104/112] Fix typo --- core/services/relay/evm/types/codec_entry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/services/relay/evm/types/codec_entry.go b/core/services/relay/evm/types/codec_entry.go index df51ad7b897..70948ecd6b3 100644 --- a/core/services/relay/evm/types/codec_entry.go +++ b/core/services/relay/evm/types/codec_entry.go @@ -13,7 +13,7 @@ import ( commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" ) -// MaxTopicFields is three because the EVM has a m of ax four topics, but the first topic is always the event signature. +// MaxTopicFields is three because the EVM has a max of four topics, but the first topic is always the event signature. const MaxTopicFields = 3 type CodecEntry interface { From 97a484b6cca875192f0ab83b6355e4c8dcadfca3 Mon Sep 17 00:00:00 2001 From: ilija Date: Fri, 19 Jan 2024 16:17:53 +0100 Subject: [PATCH 105/112] Update Solana repo refs --- core/scripts/go.mod | 4 ++-- core/scripts/go.sum | 8 ++++---- go.mod | 4 ++-- go.sum | 8 ++++---- integration-tests/go.mod | 4 ++-- integration-tests/go.sum | 8 ++++---- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 7ea30dfb1a7..f721fa82ba9 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240112202000-6359502d2ff1 @@ -247,7 +247,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 1687e776007..3290f4fa761 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1167,16 +1167,16 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be h1:ahwXHg5kImjhq85kWRxylXJBqClZpdrBvip9ApQJTP8= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a h1:lgM0yPo0KqSntLY4Y42RAH3avdv+Kyne8n+VM7cwlxo= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a/go.mod h1:05rRF84QKlIOF5LfTBPkHdw4UpBI2G3zxRcuZ65bPjk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5 h1:SwzJg8HWQXkxRyDJpfsmF+7AHCVtmpSjSlbwQa0TGdM= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/go.mod b/go.mod index ae78cfbefe6..f055a53b961 100644 --- a/go.mod +++ b/go.mod @@ -65,11 +65,11 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20240112202000-6359502d2ff1 diff --git a/go.sum b/go.sum index ed69fd980bd..cdb606d1f17 100644 --- a/go.sum +++ b/go.sum @@ -1153,16 +1153,16 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be h1:ahwXHg5kImjhq85kWRxylXJBqClZpdrBvip9ApQJTP8= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a h1:lgM0yPo0KqSntLY4Y42RAH3avdv+Kyne8n+VM7cwlxo= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a/go.mod h1:05rRF84QKlIOF5LfTBPkHdw4UpBI2G3zxRcuZ65bPjk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5 h1:SwzJg8HWQXkxRyDJpfsmF+7AHCVtmpSjSlbwQa0TGdM= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index fc2a773f2f6..61fce20cd2f 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -25,7 +25,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a github.com/smartcontractkit/chainlink-testing-framework v1.22.4 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 @@ -367,7 +367,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index d18ddfef9c7..1fdf8a4e89d 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1486,16 +1486,16 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be h1:ahwXHg5kImjhq85kWRxylXJBqClZpdrBvip9ApQJTP8= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119014733-5ea50bbe81be/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a h1:lgM0yPo0KqSntLY4Y42RAH3avdv+Kyne8n+VM7cwlxo= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a/go.mod h1:05rRF84QKlIOF5LfTBPkHdw4UpBI2G3zxRcuZ65bPjk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd h1:9xSwDgRJDIfDw6171PQEyn5IQ1JKpaJnG5NX6KfCaHQ= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231222220348-c7d81beaf8fd/go.mod h1:kY435jBtHbyzhe+ImAxZ6G229uHbB0ablA+A0tJkDn8= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5 h1:SwzJg8HWQXkxRyDJpfsmF+7AHCVtmpSjSlbwQa0TGdM= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-testing-framework v1.22.4 h1:617FyrN/wQNFLsGDofqKAQ5/P+swmIPo8sIJZqBPvsQ= From 119386a71ed260414115aa86cb8ca448f3ca38ae Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 19 Jan 2024 14:44:47 -0500 Subject: [PATCH 106/112] Pretty chain reader test solitidty file --- .../test/helpers/ChainReaderTestContract.sol | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/contracts/src/v0.8/shared/test/helpers/ChainReaderTestContract.sol b/contracts/src/v0.8/shared/test/helpers/ChainReaderTestContract.sol index 9b7ddd09b26..050f5fb390e 100644 --- a/contracts/src/v0.8/shared/test/helpers/ChainReaderTestContract.sol +++ b/contracts/src/v0.8/shared/test/helpers/ChainReaderTestContract.sol @@ -34,18 +34,10 @@ contract LatestValueHolder { MidLevelTestStruct nestedStruct ); - event TriggeredEventWithDynamicTopic( - string indexed fieldHash, - string field - ); - + event TriggeredEventWithDynamicTopic(string indexed fieldHash, string field); // First topic is event hash - event TriggeredWithFourTopics( - int32 indexed field1, - int32 indexed field2, - int32 indexed field3 - ); + event TriggeredWithFourTopics(int32 indexed field1, int32 indexed field2, int32 indexed field3); TestStruct[] private s_seen; uint64[] private s_arr; @@ -114,18 +106,12 @@ contract LatestValueHolder { emit Triggered(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); } - function triggerEventWithDynamicTopic( - string calldata field - ) public { - emit TriggeredEventWithDynamicTopic(field, field); - } + function triggerEventWithDynamicTopic(string calldata field) public { + emit TriggeredEventWithDynamicTopic(field, field); + } // first topic is the event signature - function triggerWithFourTopics( - int32 field1, - int32 field2, - int32 field3 - ) public { + function triggerWithFourTopics(int32 field1, int32 field2, int32 field3) public { emit TriggeredWithFourTopics(field1, field2, field3); } } From 6deae11cc1cfa0ab5a5c5bcab66197d2357d93a1 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 19 Jan 2024 16:02:22 -0500 Subject: [PATCH 107/112] Update solana --- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/integration-tests/go.mod b/integration-tests/go.mod index d7664d02944..4c4a1f2553b 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -367,7 +367,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119204136-c1d151c2cf32 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 653e115be59..c76f1a32513 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1494,8 +1494,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5 h1:SwzJg8HWQXkxRyDJpfsmF+7AHCVtmpSjSlbwQa0TGdM= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119204136-c1d151c2cf32 h1:QNU7UlRQ3DlTOvU7q0H3PFwH3pDjP5sxvh6Bn9dhzOI= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119204136-c1d151c2cf32/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-testing-framework v1.22.6 h1:5kWMlo99RY/ys4EWGMPsEg1sfY67f5YQogI8PohdRvw= From 5f8b77c144a9f2d781cdae485b48dc9ada1af511 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 19 Jan 2024 16:42:15 -0500 Subject: [PATCH 108/112] Update solana in integation tests --- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 4c4a1f2553b..482c67b27c6 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -367,7 +367,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119204136-c1d151c2cf32 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index c76f1a32513..af047ab3899 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1494,8 +1494,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119204136-c1d151c2cf32 h1:QNU7UlRQ3DlTOvU7q0H3PFwH3pDjP5sxvh6Bn9dhzOI= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119204136-c1d151c2cf32/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53 h1:9Q0RN7+UDilzNUxc+0vt9s7eCJeIeJlS2j2dqY92OEg= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-testing-framework v1.22.6 h1:5kWMlo99RY/ys4EWGMPsEg1sfY67f5YQogI8PohdRvw= From 8ffca9abebe6c4675856c9fa0f82623aa1b51672 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Fri, 19 Jan 2024 16:55:45 -0500 Subject: [PATCH 109/112] Needed to update more than just integation tests for solana. --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index f721fa82ba9..cf115cb4065 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -247,7 +247,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 3290f4fa761..072a7f5f822 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1175,8 +1175,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5 h1:SwzJg8HWQXkxRyDJpfsmF+7AHCVtmpSjSlbwQa0TGdM= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53 h1:9Q0RN7+UDilzNUxc+0vt9s7eCJeIeJlS2j2dqY92OEg= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/go.mod b/go.mod index f055a53b961..ec3d559a864 100644 --- a/go.mod +++ b/go.mod @@ -69,7 +69,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20240112202000-6359502d2ff1 diff --git a/go.sum b/go.sum index cdb606d1f17..81539668074 100644 --- a/go.sum +++ b/go.sum @@ -1161,8 +1161,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5 h1:SwzJg8HWQXkxRyDJpfsmF+7AHCVtmpSjSlbwQa0TGdM= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119150605-bbac0e5e53a5/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53 h1:9Q0RN7+UDilzNUxc+0vt9s7eCJeIeJlS2j2dqY92OEg= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= From 63922754b8e349c84ad5261a193c9acc9a449504 Mon Sep 17 00:00:00 2001 From: Domino Valdano <2644901+reductionista@users.noreply.github.com> Date: Fri, 19 Jan 2024 17:20:16 -0800 Subject: [PATCH 110/112] Update Solana ref to fix relayConfig --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index cf115cb4065..1c6aa0c6367 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -247,7 +247,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 072a7f5f822..2576027de3c 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1175,8 +1175,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53 h1:9Q0RN7+UDilzNUxc+0vt9s7eCJeIeJlS2j2dqY92OEg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104 h1:/TZAHuIfuSR6MZr4AwIzIxtZWLbELdsSmAlPwzg/LWQ= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/go.mod b/go.mod index ec3d559a864..3d778f00478 100644 --- a/go.mod +++ b/go.mod @@ -69,7 +69,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20240112202000-6359502d2ff1 diff --git a/go.sum b/go.sum index 81539668074..b12fb3c199b 100644 --- a/go.sum +++ b/go.sum @@ -1161,8 +1161,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53 h1:9Q0RN7+UDilzNUxc+0vt9s7eCJeIeJlS2j2dqY92OEg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104 h1:/TZAHuIfuSR6MZr4AwIzIxtZWLbELdsSmAlPwzg/LWQ= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 482c67b27c6..e074391dfc9 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -367,7 +367,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index af047ab3899..edf5bd5ee40 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1494,8 +1494,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53 h1:9Q0RN7+UDilzNUxc+0vt9s7eCJeIeJlS2j2dqY92OEg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240119214126-6fa12ac7dd53/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104 h1:/TZAHuIfuSR6MZr4AwIzIxtZWLbELdsSmAlPwzg/LWQ= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-testing-framework v1.22.6 h1:5kWMlo99RY/ys4EWGMPsEg1sfY67f5YQogI8PohdRvw= From caf1d1ed00fb7e3dc0bbe5787b2cdfec84118262 Mon Sep 17 00:00:00 2001 From: Domino Valdano <2644901+reductionista@users.noreply.github.com> Date: Fri, 19 Jan 2024 18:21:00 -0800 Subject: [PATCH 111/112] Update Solana ref again --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 1c6aa0c6367..504b383950c 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -247,7 +247,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 2576027de3c..645fdef674e 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1175,8 +1175,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104 h1:/TZAHuIfuSR6MZr4AwIzIxtZWLbELdsSmAlPwzg/LWQ= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83 h1:OS2ugTw41dBM86dZQYynNvsVxAKB2rzcc+8ajHioGRg= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/go.mod b/go.mod index 3d778f00478..3f4b8a96879 100644 --- a/go.mod +++ b/go.mod @@ -69,7 +69,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20240112202000-6359502d2ff1 diff --git a/go.sum b/go.sum index b12fb3c199b..646683c7ad2 100644 --- a/go.sum +++ b/go.sum @@ -1161,8 +1161,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104 h1:/TZAHuIfuSR6MZr4AwIzIxtZWLbELdsSmAlPwzg/LWQ= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83 h1:OS2ugTw41dBM86dZQYynNvsVxAKB2rzcc+8ajHioGRg= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index e074391dfc9..bfa8251191d 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -367,7 +367,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index edf5bd5ee40..f53272ac618 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1494,8 +1494,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104 h1:/TZAHuIfuSR6MZr4AwIzIxtZWLbELdsSmAlPwzg/LWQ= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120011631-68c7c44e7104/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83 h1:OS2ugTw41dBM86dZQYynNvsVxAKB2rzcc+8ajHioGRg= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-testing-framework v1.22.6 h1:5kWMlo99RY/ys4EWGMPsEg1sfY67f5YQogI8PohdRvw= From 12489ff7330a18c400e037c97883d413091aeb5c Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Mon, 22 Jan 2024 10:54:36 -0500 Subject: [PATCH 112/112] Update solana and starknet to point to the develop branches. --- core/scripts/go.mod | 4 ++-- core/scripts/go.sum | 8 ++++---- go.mod | 4 ++-- go.sum | 8 ++++---- integration-tests/go.mod | 4 ++-- integration-tests/go.sum | 8 ++++---- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 504b383950c..247cc460780 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -244,10 +244,10 @@ require ( github.com/shirou/gopsutil/v3 v3.23.11 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240122152632-38444d2ad8ba // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 645fdef674e..5ccfaedccac 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1169,14 +1169,14 @@ github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a h1:lgM0yPo0KqSntLY4Y42RAH3avdv+Kyne8n+VM7cwlxo= github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a/go.mod h1:05rRF84QKlIOF5LfTBPkHdw4UpBI2G3zxRcuZ65bPjk= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83 h1:OS2ugTw41dBM86dZQYynNvsVxAKB2rzcc+8ajHioGRg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240122152632-38444d2ad8ba h1:6rnQrD8NaLfLOPHszW1hbpviqpU8011gzdZk6wKP1xY= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240122152632-38444d2ad8ba/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/go.mod b/go.mod index 3f4b8a96879..66a723b6235 100644 --- a/go.mod +++ b/go.mod @@ -66,10 +66,10 @@ require ( github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240122152632-38444d2ad8ba github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20240112202000-6359502d2ff1 diff --git a/go.sum b/go.sum index 646683c7ad2..dd27946a43f 100644 --- a/go.sum +++ b/go.sum @@ -1155,14 +1155,14 @@ github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a h1:lgM0yPo0KqSntLY4Y42RAH3avdv+Kyne8n+VM7cwlxo= github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a/go.mod h1:05rRF84QKlIOF5LfTBPkHdw4UpBI2G3zxRcuZ65bPjk= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83 h1:OS2ugTw41dBM86dZQYynNvsVxAKB2rzcc+8ajHioGRg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240122152632-38444d2ad8ba h1:6rnQrD8NaLfLOPHszW1hbpviqpU8011gzdZk6wKP1xY= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240122152632-38444d2ad8ba/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index bfa8251191d..9533f9cb13f 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -364,10 +364,10 @@ require ( github.com/shopspring/decimal v1.3.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240122152632-38444d2ad8ba // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index f53272ac618..25413d9e005 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1488,14 +1488,14 @@ github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a h1:lgM0yPo0KqSntLY4Y42RAH3avdv+Kyne8n+VM7cwlxo= github.com/smartcontractkit/chainlink-common v0.1.7-0.20240119143538-04c7f63ad53a/go.mod h1:05rRF84QKlIOF5LfTBPkHdw4UpBI2G3zxRcuZ65bPjk= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 h1:1BcjXuviSAKttOX7BZoVHRZZGfxqoA2+AL8tykmkdoc= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8/go.mod h1:vy1L7NybTy2F/Yv7BOh+oZBa1MACD6gzd1+DkcSkfp8= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83 h1:OS2ugTw41dBM86dZQYynNvsVxAKB2rzcc+8ajHioGRg= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240120021841-1ef3a9face83/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240122152632-38444d2ad8ba h1:6rnQrD8NaLfLOPHszW1hbpviqpU8011gzdZk6wKP1xY= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240122152632-38444d2ad8ba/go.mod h1:OZfzyayUdwsVBqxvbEMqwUntQT8HbFbgyqoudvwfVN0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea h1:WzMa0O6DEauMYMIjzS/T1JF8zvFDt4aG6EUTDlStaZo= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231221191127-1f32389044ea/go.mod h1:J4A5pQh3CiVs5S2eQMHezToXHoC+Wj0UHBtMXCiTIJA= github.com/smartcontractkit/chainlink-testing-framework v1.22.6 h1:5kWMlo99RY/ys4EWGMPsEg1sfY67f5YQogI8PohdRvw=