From 2ee2a95d9d8e520b4da72b8847c2e9c425860fbd Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 17 Jan 2024 10:55:46 -0500 Subject: [PATCH] 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=