Skip to content

Commit

Permalink
add modifier config, unit test passes
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhen1997 committed Nov 29, 2024
1 parent 2a4e659 commit 9804484
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions core/services/relay/evm/codec/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,19 @@ func TestCodec_CommitReport(t *testing.T) {
},
}
config := `[{"components":[{"name":"chainSel","type":"uint64","internalType":"uint64"},{"name":"onRampAddress","type":"bytes","internalType":"bytes"},{"name":"seqNumsRange","type":"uint64[2]","internalType":"uint64[2]"},{"name":"merkleRoot","type":"bytes32","internalType":"bytes32"}],"name":"merkleRoots","type":"tuple[]","internalType":"struct MerkleRootChain[]"},{"components":[{"components":[{"name":"tokenID","type":"string","internalType":"string"},{"name":"price","type":"uint256","internalType":"uint256"}],"name":"tokenPriceUpdates","type":"tuple[]","internalType":"struct TokenPrice[]"},{"components":[{"name":"chainSel","type":"uint64","internalType":"uint64"},{"name":"gasPrice","type":"uint256","internalType":"uint256"}],"name":"gasPriceUpdates","type":"tuple[]","internalType":"struct GasPriceChain[]"}],"name":"priceUpdates","type":"tuple","internalType":"struct PriceUpdates"},{"components":[{"name":"r","type":"bytes32","internalType":"bytes32"},{"name":"s","type":"bytes32","internalType":"bytes32"}],"name":"rmnSignatures","type":"tuple[]"}]`
codecConfig := types.CodecConfig{Configs: map[string]types.ChainCodecConfig{
"CommitPluginReport": {TypeABI: config},
}}
codecConfig := types.CodecConfig{
Configs: map[string]types.ChainCodecConfig{
"CommitPluginReport": {
TypeABI: config,
ModifierConfigs: commoncodec.ModifiersConfig{
&commoncodec.WrapperModifierConfig{Fields: map[string]string{
"PriceUpdates.TokenPriceUpdates.Price": "Int",
"PriceUpdates.GasPriceUpdates.GasPrice": "Int",
}},
},
},
},
}
c, err := codec.NewCodec(codecConfig)
require.NoError(t, err)

Expand All @@ -228,7 +238,7 @@ func TestCodec_CommitReport(t *testing.T) {
output := cciptypes.CommitPluginReport{}
err = c.Decode(testutils.Context(t), result, &output, "CommitPluginReport")
require.NoError(t, err)
//require.Equal(t, input, output)
require.Equal(t, input, output)
}

type codecInterfaceTester struct {
Expand Down

0 comments on commit 9804484

Please sign in to comment.