From ed5ca715fbac753b9bf6bc1e6f196ff7d4f9e661 Mon Sep 17 00:00:00 2001 From: ilija Date: Fri, 9 Feb 2024 14:51:52 -0500 Subject: [PATCH 1/4] Fix potential JAID collisions in multi chain env This fixes some rest api responses getting omitted when the JAID was same across multiple chains --- core/cmd/cosmos_node_commands_test.go | 2 +- core/cmd/evm_node_commands_test.go | 4 +- core/cmd/ocr2_keys_commands_test.go | 2 +- core/cmd/solana_node_commands_test.go | 4 +- core/cmd/starknet_node_commands_test.go | 4 +- core/internal/cltest/cltest.go | 4 + core/web/eth_keys_controller.go | 2 +- core/web/eth_keys_controller_test.go | 15 ++- core/web/presenters/chain_msg_test.go | 69 ++++++++++++++ core/web/presenters/cosmos_chain.go | 2 +- core/web/presenters/cosmos_msg.go | 2 +- core/web/presenters/eth_key.go | 2 +- core/web/presenters/eth_key_test.go | 4 +- core/web/presenters/eth_tx.go | 1 + core/web/presenters/eth_tx_test.go | 8 +- core/web/presenters/evm_chain.go | 2 +- core/web/presenters/evm_forwarder_test.go | 64 +++++++++++++ core/web/presenters/jsonapi.go | 6 ++ core/web/presenters/node_test.go | 92 +++++++++++++++++++ core/web/presenters/solana_chain.go | 2 +- core/web/presenters/solana_msg.go | 2 +- core/web/presenters/starknet_chain.go | 2 +- .../actions/vrfv2_actions/vrfv2_steps.go | 4 +- .../actions/vrfv2plus/vrfv2plus_steps.go | 4 +- integration-tests/client/chainlink_models.go | 4 +- integration-tests/smoke/vrfv2_test.go | 2 +- integration-tests/smoke/vrfv2plus_test.go | 2 +- 27 files changed, 277 insertions(+), 34 deletions(-) create mode 100644 core/web/presenters/chain_msg_test.go create mode 100644 core/web/presenters/evm_forwarder_test.go create mode 100644 core/web/presenters/node_test.go diff --git a/core/cmd/cosmos_node_commands_test.go b/core/cmd/cosmos_node_commands_test.go index 728be9396f9..32256b451f1 100644 --- a/core/cmd/cosmos_node_commands_test.go +++ b/core/cmd/cosmos_node_commands_test.go @@ -48,8 +48,8 @@ func TestShell_IndexCosmosNodes(t *testing.T) { nodes := *r.Renders[0].(*cmd.CosmosNodePresenters) require.Len(t, nodes, 1) n := nodes[0] + assert.Equal(t, cltest.FormatWithPrefixedChainID(*node.Name, chainID), n.ID) assert.Equal(t, chainID, n.ChainID) - assert.Equal(t, *node.Name, n.ID) assert.Equal(t, *node.Name, n.Name) wantConfig, err := toml.Marshal(node) require.NoError(t, err) diff --git a/core/cmd/evm_node_commands_test.go b/core/cmd/evm_node_commands_test.go index dae950fce01..b78a88e02e2 100644 --- a/core/cmd/evm_node_commands_test.go +++ b/core/cmd/evm_node_commands_test.go @@ -60,13 +60,13 @@ func TestShell_IndexEVMNodes(t *testing.T) { n1 := nodes[0] n2 := nodes[1] assert.Equal(t, chainID.String(), n1.ChainID) - assert.Equal(t, *node1.Name, n1.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(*node1.Name, chainID.String()), n1.ID) assert.Equal(t, *node1.Name, n1.Name) wantConfig, err := toml.Marshal(node1) require.NoError(t, err) assert.Equal(t, string(wantConfig), n1.Config) assert.Equal(t, chainID.String(), n2.ChainID) - assert.Equal(t, *node2.Name, n2.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(*node2.Name, chainID.String()), n2.ID) assert.Equal(t, *node2.Name, n2.Name) wantConfig2, err := toml.Marshal(node2) require.NoError(t, err) diff --git a/core/cmd/ocr2_keys_commands_test.go b/core/cmd/ocr2_keys_commands_test.go index 5a861fafa7c..eff44685612 100644 --- a/core/cmd/ocr2_keys_commands_test.go +++ b/core/cmd/ocr2_keys_commands_test.go @@ -32,7 +32,7 @@ func TestOCR2KeyBundlePresenter_RenderTable(t *testing.T) { pubKeyConfig := key.ConfigEncryptionPublicKey() pubKey := key.OffchainPublicKey() p := cmd.OCR2KeyBundlePresenter{ - JAID: cmd.JAID{ID: bundleID}, + JAID: cmd.NewJAID(bundleID), OCR2KeysBundleResource: presenters.OCR2KeysBundleResource{ JAID: presenters.NewJAID(key.ID()), ChainType: "evm", diff --git a/core/cmd/solana_node_commands_test.go b/core/cmd/solana_node_commands_test.go index 316cf16212d..5192cacfb92 100644 --- a/core/cmd/solana_node_commands_test.go +++ b/core/cmd/solana_node_commands_test.go @@ -55,13 +55,13 @@ func TestShell_IndexSolanaNodes(t *testing.T) { n1 := nodes[0] n2 := nodes[1] assert.Equal(t, id, n1.ChainID) - assert.Equal(t, *node1.Name, n1.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(*node1.Name, id), n1.ID) assert.Equal(t, *node1.Name, n1.Name) wantConfig, err := toml.Marshal(node1) require.NoError(t, err) assert.Equal(t, string(wantConfig), n1.Config) assert.Equal(t, id, n2.ChainID) - assert.Equal(t, *node2.Name, n2.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(*node2.Name, id), n2.ID) assert.Equal(t, *node2.Name, n2.Name) wantConfig2, err := toml.Marshal(node2) require.NoError(t, err) diff --git a/core/cmd/starknet_node_commands_test.go b/core/cmd/starknet_node_commands_test.go index 0347cdd18f7..0feef94efbe 100644 --- a/core/cmd/starknet_node_commands_test.go +++ b/core/cmd/starknet_node_commands_test.go @@ -54,13 +54,13 @@ func TestShell_IndexStarkNetNodes(t *testing.T) { n1 := nodes[0] n2 := nodes[1] assert.Equal(t, id, n1.ChainID) - assert.Equal(t, *node1.Name, n1.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(*node1.Name, id), n1.ID) assert.Equal(t, *node1.Name, n1.Name) wantConfig, err := toml.Marshal(node1) require.NoError(t, err) assert.Equal(t, string(wantConfig), n1.Config) assert.Equal(t, id, n2.ChainID) - assert.Equal(t, *node2.Name, n2.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(*node2.Name, id), n2.ID) assert.Equal(t, *node2.Name, n2.Name) wantConfig2, err := toml.Marshal(node2) require.NoError(t, err) diff --git a/core/internal/cltest/cltest.go b/core/internal/cltest/cltest.go index c7abfb31a2a..b5c2e4676c5 100644 --- a/core/internal/cltest/cltest.go +++ b/core/internal/cltest/cltest.go @@ -165,6 +165,10 @@ func MustRandomBytes(t *testing.T, l int) (b []byte) { return b } +func FormatWithPrefixedChainID(id, chainID string) string { + return fmt.Sprintf("%s/%s", chainID, id) +} + type JobPipelineV2TestHelper struct { Prm pipeline.ORM Jrm job.ORM diff --git a/core/web/eth_keys_controller.go b/core/web/eth_keys_controller.go index fe76e8863ef..4e95bc3cb89 100644 --- a/core/web/eth_keys_controller.go +++ b/core/web/eth_keys_controller.go @@ -270,7 +270,7 @@ func (ekc *ETHKeysController) Chain(c *gin.Context) { jsonAPIError(c, http.StatusBadRequest, errors.Errorf("invalid address: %s, must be hex address", keyID)) return } - address := common.HexToAddress((keyID)) + address := common.HexToAddress(keyID) cid := c.Query("evmChainID") chain, ok := ekc.getChain(c, cid) diff --git a/core/web/eth_keys_controller_test.go b/core/web/eth_keys_controller_test.go index 739af5820c9..e4208124f73 100644 --- a/core/web/eth_keys_controller_test.go +++ b/core/web/eth_keys_controller_test.go @@ -284,7 +284,8 @@ func TestETHKeysController_ChainSuccess_UpdateNonce(t *testing.T) { err := cltest.ParseJSONAPIResponse(t, resp, &updatedKey) assert.NoError(t, err) - assert.Equal(t, key.ID(), updatedKey.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(key.Address.String(), cltest.FixtureChainID.String()), updatedKey.ID) + assert.Equal(t, key.Address.String(), updatedKey.Address) assert.Equal(t, cltest.FixtureChainID.String(), updatedKey.EVMChainID.String()) assert.Equal(t, false, updatedKey.Disabled) } @@ -328,7 +329,8 @@ func TestETHKeysController_ChainSuccess_Disable(t *testing.T) { err := cltest.ParseJSONAPIResponse(t, resp, &updatedKey) assert.NoError(t, err) - assert.Equal(t, key.ID(), updatedKey.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(key.Address.String(), updatedKey.EVMChainID.String()), updatedKey.ID) + assert.Equal(t, key.Address.String(), updatedKey.Address) assert.Equal(t, cltest.FixtureChainID.String(), updatedKey.EVMChainID.String()) assert.Equal(t, true, updatedKey.Disabled) } @@ -371,7 +373,8 @@ func TestETHKeysController_ChainSuccess_Enable(t *testing.T) { err := cltest.ParseJSONAPIResponse(t, resp, &updatedKey) assert.NoError(t, err) - assert.Equal(t, key.ID(), updatedKey.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(key.Address.String(), cltest.FixtureChainID.String()), updatedKey.ID) + assert.Equal(t, key.Address.String(), updatedKey.Address) assert.Equal(t, cltest.FixtureChainID.String(), updatedKey.EVMChainID.String()) assert.Equal(t, false, updatedKey.Disabled) } @@ -436,7 +439,8 @@ func TestETHKeysController_ChainSuccess_ResetWithAbandon(t *testing.T) { err = cltest.ParseJSONAPIResponse(t, resp, &updatedKey) assert.NoError(t, err) - assert.Equal(t, key.ID(), updatedKey.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(key.Address.String(), cltest.FixtureChainID.String()), updatedKey.ID) + assert.Equal(t, key.Address.String(), updatedKey.Address) assert.Equal(t, cltest.FixtureChainID.String(), updatedKey.EVMChainID.String()) assert.Equal(t, false, updatedKey.Disabled) @@ -663,7 +667,8 @@ func TestETHKeysController_DeleteSuccess(t *testing.T) { err := cltest.ParseJSONAPIResponse(t, resp, &deletedKey) assert.NoError(t, err) - assert.Equal(t, key0.ID(), deletedKey.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(key0.Address.String(), cltest.FixtureChainID.String()), deletedKey.ID) + assert.Equal(t, key0.Address.String(), deletedKey.Address) assert.Equal(t, cltest.FixtureChainID.String(), deletedKey.EVMChainID.String()) assert.Equal(t, false, deletedKey.Disabled) diff --git a/core/web/presenters/chain_msg_test.go b/core/web/presenters/chain_msg_test.go new file mode 100644 index 00000000000..58192caef71 --- /dev/null +++ b/core/web/presenters/chain_msg_test.go @@ -0,0 +1,69 @@ +package presenters + +import ( + "fmt" + "testing" + + "github.com/manyminds/api2go/jsonapi" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/cosmostest" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/solanatest" +) + +func TestSolanaMessageResource(t *testing.T) { + id := "1" + chainID := solanatest.RandomChainID() + r := NewSolanaMsgResource(id, chainID) + assert.Equal(t, chainID, r.ChainID) + + b, err := jsonapi.Marshal(r) + require.NoError(t, err) + + expected := fmt.Sprintf(` + { + "data":{ + "type":"solana_messages", + "id":"%s/%s", + "attributes":{ + "ChainID":"%s", + "from":"", + "to":"", + "amount":0 + } + } + } + `, chainID, id, chainID) + + assert.JSONEq(t, expected, string(b)) +} + +func TestCosmosMessageResource(t *testing.T) { + id := "1" + chainID := cosmostest.RandomChainID() + contractID := "cosmos1p3ucd3ptpw902fluyjzkq3fflq4btddac9sa3s" + r := NewCosmosMsgResource(id, chainID, contractID) + assert.Equal(t, chainID, r.ChainID) + assert.Equal(t, contractID, r.ContractID) + + b, err := jsonapi.Marshal(r) + require.NoError(t, err) + + expected := fmt.Sprintf(` + { + "data":{ + "type":"cosmos_messages", + "id":"%s/%s", + "attributes":{ + "ChainID":"%s", + "ContractID":"%s", + "State":"", + "TxHash":null + } + } + } + `, chainID, id, chainID, contractID) + + assert.JSONEq(t, expected, string(b)) +} diff --git a/core/web/presenters/cosmos_chain.go b/core/web/presenters/cosmos_chain.go index c3b006e5c7e..5cddd51909d 100644 --- a/core/web/presenters/cosmos_chain.go +++ b/core/web/presenters/cosmos_chain.go @@ -36,7 +36,7 @@ func (r CosmosNodeResource) GetName() string { // NewCosmosNodeResource returns a new CosmosNodeResource for node. func NewCosmosNodeResource(node types.NodeStatus) CosmosNodeResource { return CosmosNodeResource{NodeResource{ - JAID: NewJAID(node.Name), + JAID: NewJAID(node.Name).GetWithPrefixedChainID(node.ChainID), ChainID: node.ChainID, Name: node.Name, State: node.State, diff --git a/core/web/presenters/cosmos_msg.go b/core/web/presenters/cosmos_msg.go index 5bf0bb9b4f8..c0626d5e28f 100644 --- a/core/web/presenters/cosmos_msg.go +++ b/core/web/presenters/cosmos_msg.go @@ -17,7 +17,7 @@ func (CosmosMsgResource) GetName() string { // NewCosmosMsgResource returns a new partial CosmosMsgResource. func NewCosmosMsgResource(id string, chainID string, contractID string) CosmosMsgResource { return CosmosMsgResource{ - JAID: NewJAID(id), + JAID: NewJAID(id).GetWithPrefixedChainID(chainID), ChainID: chainID, ContractID: contractID, } diff --git a/core/web/presenters/eth_key.go b/core/web/presenters/eth_key.go index d661d4334cd..29610a42882 100644 --- a/core/web/presenters/eth_key.go +++ b/core/web/presenters/eth_key.go @@ -40,7 +40,7 @@ type NewETHKeyOption func(*ETHKeyResource) // Use the functional options to inject the ETH and LINK balances func NewETHKeyResource(k ethkey.KeyV2, state ethkey.State, opts ...NewETHKeyOption) *ETHKeyResource { r := ÐKeyResource{ - JAID: NewJAID(k.Address.Hex()), + JAID: NewJAID(k.Address.Hex()).GetWithPrefixedChainID(state.EVMChainID.String()), EVMChainID: state.EVMChainID, Address: k.Address.Hex(), EthBalance: nil, diff --git a/core/web/presenters/eth_key_test.go b/core/web/presenters/eth_key_test.go index 8be13de74a1..46402141a4c 100644 --- a/core/web/presenters/eth_key_test.go +++ b/core/web/presenters/eth_key_test.go @@ -55,7 +55,7 @@ func TestETHKeyResource(t *testing.T) { { "data":{ "type":"eTHKeys", - "id":"%s", + "id":"42/%s", "attributes":{ "address":"%s", "evmChainID":"42", @@ -84,7 +84,7 @@ func TestETHKeyResource(t *testing.T) { { "data": { "type":"eTHKeys", - "id":"%s", + "id":"42/%s", "attributes":{ "address":"%s", "evmChainID":"42", diff --git a/core/web/presenters/eth_tx.go b/core/web/presenters/eth_tx.go index f944a99213f..a7d195a3f64 100644 --- a/core/web/presenters/eth_tx.go +++ b/core/web/presenters/eth_tx.go @@ -66,6 +66,7 @@ func NewEthTxResourceFromAttempt(txa txmgr.TxAttempt) EthTxResource { if txa.Tx.ChainID != nil { r.EVMChainID = *big.New(txa.Tx.ChainID) + r.JAID = r.JAID.GetWithPrefixedChainID(txa.Tx.ChainID.String()) } if tx.Sequence != nil { diff --git a/core/web/presenters/eth_tx_test.go b/core/web/presenters/eth_tx_test.go index 2ed8e23c76a..193fa774ce9 100644 --- a/core/web/presenters/eth_tx_test.go +++ b/core/web/presenters/eth_tx_test.go @@ -20,12 +20,14 @@ import ( func TestEthTxResource(t *testing.T) { t.Parallel() + chainID := big.NewInt(54321) tx := txmgr.Tx{ ID: 1, EncodedPayload: []byte(`{"data": "is wilding out"}`), FromAddress: common.HexToAddress("0x1"), ToAddress: common.HexToAddress("0x2"), FeeLimit: uint32(5000), + ChainID: chainID, State: txmgrcommon.TxConfirmed, Value: big.Int(assets.NewEthValue(1)), } @@ -52,7 +54,7 @@ func TestEthTxResource(t *testing.T) { "sentAt": "", "to": "0x0000000000000000000000000000000000000002", "value": "0.000000000000000001", - "evmChainID": "0" + "evmChainID": "54321" } } } @@ -85,7 +87,7 @@ func TestEthTxResource(t *testing.T) { { "data": { "type": "evm_transactions", - "id": "0x0000000000000000000000000000000000000000000000000000000000010203", + "id": "54321/0x0000000000000000000000000000000000000000000000000000000000010203", "attributes": { "state": "confirmed", "data": "0x7b2264617461223a202269732077696c64696e67206f7574227d", @@ -98,7 +100,7 @@ func TestEthTxResource(t *testing.T) { "sentAt": "300", "to": "0x0000000000000000000000000000000000000002", "value": "0.000000000000000001", - "evmChainID": "0" + "evmChainID": "54321" } } } diff --git a/core/web/presenters/evm_chain.go b/core/web/presenters/evm_chain.go index 8cc6da46a77..d0d0e196853 100644 --- a/core/web/presenters/evm_chain.go +++ b/core/web/presenters/evm_chain.go @@ -34,7 +34,7 @@ func (r EVMNodeResource) GetName() string { // NewEVMNodeResource returns a new EVMNodeResource for node. func NewEVMNodeResource(node types.NodeStatus) EVMNodeResource { return EVMNodeResource{NodeResource{ - JAID: NewJAID(node.Name), + JAID: NewJAID(node.Name).GetWithPrefixedChainID(node.ChainID), ChainID: node.ChainID, Name: node.Name, State: node.State, diff --git a/core/web/presenters/evm_forwarder_test.go b/core/web/presenters/evm_forwarder_test.go new file mode 100644 index 00000000000..80eb6b190ef --- /dev/null +++ b/core/web/presenters/evm_forwarder_test.go @@ -0,0 +1,64 @@ +package presenters + +import ( + "fmt" + "strings" + "testing" + "time" + + "github.com/manyminds/api2go/jsonapi" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" +) + +func TestEVMForwarderResource(t *testing.T) { + var ( + ID = int64(1) + address = utils.RandomAddress() + chainID = *big.NewI(4) + createdAt = time.Now() + updatedAt = time.Now().Add(time.Second) + ) + fwd := forwarders.Forwarder{ + ID: ID, + Address: address, + EVMChainID: chainID, + CreatedAt: createdAt, + UpdatedAt: updatedAt, + } + + r := NewEVMForwarderResource(fwd) + assert.Equal(t, fmt.Sprint(ID), r.ID) + assert.Equal(t, address, r.Address) + assert.Equal(t, chainID, r.EVMChainID) + assert.Equal(t, createdAt, r.CreatedAt) + assert.Equal(t, updatedAt, r.UpdatedAt) + + b, err := jsonapi.Marshal(r) + require.NoError(t, err) + + createdAtMarshalled, err := createdAt.MarshalText() + require.NoError(t, err) + updatedAtMarshalled, err := updatedAt.MarshalText() + require.NoError(t, err) + + expected := fmt.Sprintf(` + { + "data":{ + "type":"evm_forwarder", + "id":"%d", + "attributes":{ + "address":"%s", + "evmChainId":"%s", + "createdAt":"%s", + "updatedAt":"%s" + } + } + } + `, ID, strings.ToLower(address.String()), chainID.String(), string(createdAtMarshalled), string(updatedAtMarshalled)) + assert.JSONEq(t, expected, string(b)) +} diff --git a/core/web/presenters/jsonapi.go b/core/web/presenters/jsonapi.go index ee3a2a7de8a..db12e0bab84 100644 --- a/core/web/presenters/jsonapi.go +++ b/core/web/presenters/jsonapi.go @@ -1,6 +1,7 @@ package presenters import ( + "fmt" "strconv" ) @@ -35,3 +36,8 @@ func (jaid *JAID) SetID(value string) error { return nil } + +// GetWithPrefixedChainID returns JAID formatted with chainID, this is done to prevent cross chain ID collision. +func (jaid JAID) GetWithPrefixedChainID(chainID string) JAID { + return JAID{ID: fmt.Sprintf("%s/%s", chainID, jaid.ID)} +} diff --git a/core/web/presenters/node_test.go b/core/web/presenters/node_test.go new file mode 100644 index 00000000000..34210a52166 --- /dev/null +++ b/core/web/presenters/node_test.go @@ -0,0 +1,92 @@ +package presenters + +import ( + "fmt" + "testing" + + "github.com/manyminds/api2go/jsonapi" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink-common/pkg/types" +) + +func TestNodeResource(t *testing.T) { + var nodeResource NodeResource + var r interface{} + state := "test" + cfg := "cfg" + testCases := []string{"solana", "cosmos", "starknet"} + for _, tc := range testCases { + chainID := fmt.Sprintf("%s chain ID", tc) + nodeName := fmt.Sprintf("%s_node", tc) + + switch tc { + case "evm": + evmNodeResource := NewEVMNodeResource( + types.NodeStatus{ + ChainID: chainID, + Name: nodeName, + Config: cfg, + State: state, + }) + r = evmNodeResource + nodeResource = evmNodeResource.NodeResource + case "solana": + solanaNodeResource := NewSolanaNodeResource( + types.NodeStatus{ + ChainID: chainID, + Name: nodeName, + Config: cfg, + State: state, + }) + r = solanaNodeResource + nodeResource = solanaNodeResource.NodeResource + case "cosmos": + cosmosNodeResource := NewCosmosNodeResource( + types.NodeStatus{ + ChainID: chainID, + Name: nodeName, + Config: cfg, + State: state, + }) + r = cosmosNodeResource + nodeResource = cosmosNodeResource.NodeResource + case "starknet": + starknetNodeResource := NewStarkNetNodeResource( + types.NodeStatus{ + ChainID: chainID, + Name: nodeName, + Config: cfg, + State: state, + }) + r = starknetNodeResource + nodeResource = starknetNodeResource.NodeResource + default: + t.Fail() + } + assert.Equal(t, chainID, nodeResource.ChainID) + assert.Equal(t, nodeName, nodeResource.Name) + assert.Equal(t, cfg, nodeResource.Config) + assert.Equal(t, state, nodeResource.State) + + b, err := jsonapi.Marshal(r) + require.NoError(t, err) + + expected := fmt.Sprintf(` + { + "data":{ + "type":"%s_node", + "id":"%s/%s", + "attributes":{ + "chainID":"%s", + "name":"%s", + "config":"%s", + "state":"%s" + } + } + } + `, tc, chainID, nodeName, chainID, nodeName, cfg, state) + assert.JSONEq(t, expected, string(b)) + } +} diff --git a/core/web/presenters/solana_chain.go b/core/web/presenters/solana_chain.go index f04d2b65d55..70ee604c910 100644 --- a/core/web/presenters/solana_chain.go +++ b/core/web/presenters/solana_chain.go @@ -36,7 +36,7 @@ func (r SolanaNodeResource) GetName() string { // NewSolanaNodeResource returns a new SolanaNodeResource for node. func NewSolanaNodeResource(node types.NodeStatus) SolanaNodeResource { return SolanaNodeResource{NodeResource{ - JAID: NewJAID(node.Name), + JAID: NewJAID(node.Name).GetWithPrefixedChainID(node.ChainID), ChainID: node.ChainID, Name: node.Name, State: node.State, diff --git a/core/web/presenters/solana_msg.go b/core/web/presenters/solana_msg.go index b7330754e38..8a5b9c7256a 100644 --- a/core/web/presenters/solana_msg.go +++ b/core/web/presenters/solana_msg.go @@ -17,7 +17,7 @@ func (SolanaMsgResource) GetName() string { // NewSolanaMsgResource returns a new partial SolanaMsgResource. func NewSolanaMsgResource(id string, chainID string) SolanaMsgResource { return SolanaMsgResource{ - JAID: NewJAID(id), + JAID: NewJAID(id).GetWithPrefixedChainID(chainID), ChainID: chainID, } } diff --git a/core/web/presenters/starknet_chain.go b/core/web/presenters/starknet_chain.go index ec1cd453a55..06d2fcf1bcc 100644 --- a/core/web/presenters/starknet_chain.go +++ b/core/web/presenters/starknet_chain.go @@ -36,7 +36,7 @@ func (r StarkNetNodeResource) GetName() string { // NewStarkNetNodeResource returns a new StarkNetNodeResource for node. func NewStarkNetNodeResource(node types.NodeStatus) StarkNetNodeResource { return StarkNetNodeResource{NodeResource{ - JAID: NewJAID(node.Name), + JAID: NewJAID(node.Name).GetWithPrefixedChainID(node.ChainID), ChainID: node.ChainID, Name: node.Name, State: node.State, diff --git a/integration-tests/actions/vrfv2_actions/vrfv2_steps.go b/integration-tests/actions/vrfv2_actions/vrfv2_steps.go index d6288e58bf6..7178174a2ba 100644 --- a/integration-tests/actions/vrfv2_actions/vrfv2_steps.go +++ b/integration-tests/actions/vrfv2_actions/vrfv2_steps.go @@ -433,8 +433,8 @@ func CreateAndFundSendingKeys(env *test_env.CLClusterTestEnv, vrfv2Config vrfv2_ if response.StatusCode != 200 { return nil, fmt.Errorf("error creating transaction key - response code, err %d", response.StatusCode) } - newNativeTokenKeyAddresses = append(newNativeTokenKeyAddresses, newTxKey.Data.ID) - err = actions.FundAddress(env.EVMClient, newTxKey.Data.ID, big.NewFloat(vrfv2Config.ChainlinkNodeFunding)) + newNativeTokenKeyAddresses = append(newNativeTokenKeyAddresses, newTxKey.Data.Attributes.Address) + err = actions.FundAddress(env.EVMClient, newTxKey.Data.Attributes.Address, big.NewFloat(vrfv2Config.ChainlinkNodeFunding)) if err != nil { return nil, err } diff --git a/integration-tests/actions/vrfv2plus/vrfv2plus_steps.go b/integration-tests/actions/vrfv2plus/vrfv2plus_steps.go index d0c83e85841..5c1b01a5575 100644 --- a/integration-tests/actions/vrfv2plus/vrfv2plus_steps.go +++ b/integration-tests/actions/vrfv2plus/vrfv2plus_steps.go @@ -333,8 +333,8 @@ func CreateAndFundSendingKeys(env *test_env.CLClusterTestEnv, vrfv2PlusConfig vr if response.StatusCode != 200 { return nil, fmt.Errorf("error creating transaction key - response code, err %d", response.StatusCode) } - newNativeTokenKeyAddresses = append(newNativeTokenKeyAddresses, newTxKey.Data.ID) - err = actions.FundAddress(env.EVMClient, newTxKey.Data.ID, big.NewFloat(vrfv2PlusConfig.ChainlinkNodeFunding)) + newNativeTokenKeyAddresses = append(newNativeTokenKeyAddresses, newTxKey.Data.Attributes.Address) + err = actions.FundAddress(env.EVMClient, newTxKey.Data.Attributes.Address, big.NewFloat(vrfv2PlusConfig.ChainlinkNodeFunding)) if err != nil { return nil, err } diff --git a/integration-tests/client/chainlink_models.go b/integration-tests/client/chainlink_models.go index e6e1de25e41..f3d99403da7 100644 --- a/integration-tests/client/chainlink_models.go +++ b/integration-tests/client/chainlink_models.go @@ -379,8 +379,8 @@ type TxKeyData struct { // TxKeyAttributes is the model that represents the created keys when read type TxKeyAttributes struct { PublicKey string `json:"publicKey"` - - StarkKey string `json:"starkPubKey,omitempty"` + Address string `json:"address"` + StarkKey string `json:"starkPubKey,omitempty"` } type SingleTransactionDataWrapper struct { diff --git a/integration-tests/smoke/vrfv2_test.go b/integration-tests/smoke/vrfv2_test.go index 8958480d51e..29c221816c2 100644 --- a/integration-tests/smoke/vrfv2_test.go +++ b/integration-tests/smoke/vrfv2_test.go @@ -512,7 +512,7 @@ func TestVRFv2MultipleSendingKeys(t *testing.T) { require.Equal(t, numberOfTxKeysToCreate+1, len(fulfillmentTxFromAddresses)) var txKeyAddresses []string for _, txKey := range txKeys.Data { - txKeyAddresses = append(txKeyAddresses, txKey.ID) + txKeyAddresses = append(txKeyAddresses, txKey.Attributes.Address) } less := func(a, b string) bool { return a < b } equalIgnoreOrder := cmp.Diff(txKeyAddresses, fulfillmentTxFromAddresses, cmpopts.SortSlices(less)) == "" diff --git a/integration-tests/smoke/vrfv2plus_test.go b/integration-tests/smoke/vrfv2plus_test.go index 6cc4a07237f..277c62b0a2a 100644 --- a/integration-tests/smoke/vrfv2plus_test.go +++ b/integration-tests/smoke/vrfv2plus_test.go @@ -686,7 +686,7 @@ func TestVRFv2PlusMultipleSendingKeys(t *testing.T) { require.Equal(t, numberOfTxKeysToCreate+1, len(fulfillmentTxFromAddresses)) var txKeyAddresses []string for _, txKey := range txKeys.Data { - txKeyAddresses = append(txKeyAddresses, txKey.ID) + txKeyAddresses = append(txKeyAddresses, txKey.Attributes.Address) } less := func(a, b string) bool { return a < b } equalIgnoreOrder := cmp.Diff(txKeyAddresses, fulfillmentTxFromAddresses, cmpopts.SortSlices(less)) == "" From 729defc4adde6ff56f395ad3f1ab65300c4d603e Mon Sep 17 00:00:00 2001 From: ilija Date: Fri, 9 Feb 2024 14:53:01 -0500 Subject: [PATCH 2/4] Add JAID constructor that formats JAID with chainID prefix --- core/web/presenters/cosmos_chain.go | 2 +- core/web/presenters/cosmos_msg.go | 2 +- core/web/presenters/eth_key.go | 2 +- core/web/presenters/eth_tx.go | 2 +- core/web/presenters/evm_chain.go | 2 +- core/web/presenters/jsonapi.go | 10 +++++----- core/web/presenters/solana_chain.go | 2 +- core/web/presenters/solana_msg.go | 2 +- core/web/presenters/starknet_chain.go | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/core/web/presenters/cosmos_chain.go b/core/web/presenters/cosmos_chain.go index 5cddd51909d..c2bc4b52b61 100644 --- a/core/web/presenters/cosmos_chain.go +++ b/core/web/presenters/cosmos_chain.go @@ -36,7 +36,7 @@ func (r CosmosNodeResource) GetName() string { // NewCosmosNodeResource returns a new CosmosNodeResource for node. func NewCosmosNodeResource(node types.NodeStatus) CosmosNodeResource { return CosmosNodeResource{NodeResource{ - JAID: NewJAID(node.Name).GetWithPrefixedChainID(node.ChainID), + JAID: NewPrefixedJAID(node.Name, node.ChainID), ChainID: node.ChainID, Name: node.Name, State: node.State, diff --git a/core/web/presenters/cosmos_msg.go b/core/web/presenters/cosmos_msg.go index c0626d5e28f..ab43d394ede 100644 --- a/core/web/presenters/cosmos_msg.go +++ b/core/web/presenters/cosmos_msg.go @@ -17,7 +17,7 @@ func (CosmosMsgResource) GetName() string { // NewCosmosMsgResource returns a new partial CosmosMsgResource. func NewCosmosMsgResource(id string, chainID string, contractID string) CosmosMsgResource { return CosmosMsgResource{ - JAID: NewJAID(id).GetWithPrefixedChainID(chainID), + JAID: NewPrefixedJAID(id, chainID), ChainID: chainID, ContractID: contractID, } diff --git a/core/web/presenters/eth_key.go b/core/web/presenters/eth_key.go index 29610a42882..812adeb13fa 100644 --- a/core/web/presenters/eth_key.go +++ b/core/web/presenters/eth_key.go @@ -40,7 +40,7 @@ type NewETHKeyOption func(*ETHKeyResource) // Use the functional options to inject the ETH and LINK balances func NewETHKeyResource(k ethkey.KeyV2, state ethkey.State, opts ...NewETHKeyOption) *ETHKeyResource { r := ÐKeyResource{ - JAID: NewJAID(k.Address.Hex()).GetWithPrefixedChainID(state.EVMChainID.String()), + JAID: NewPrefixedJAID(k.Address.Hex(), state.EVMChainID.String()), EVMChainID: state.EVMChainID, Address: k.Address.Hex(), EthBalance: nil, diff --git a/core/web/presenters/eth_tx.go b/core/web/presenters/eth_tx.go index a7d195a3f64..65df01ef095 100644 --- a/core/web/presenters/eth_tx.go +++ b/core/web/presenters/eth_tx.go @@ -66,7 +66,7 @@ func NewEthTxResourceFromAttempt(txa txmgr.TxAttempt) EthTxResource { if txa.Tx.ChainID != nil { r.EVMChainID = *big.New(txa.Tx.ChainID) - r.JAID = r.JAID.GetWithPrefixedChainID(txa.Tx.ChainID.String()) + r.JAID = NewPrefixedJAID(r.JAID.ID, txa.Tx.ChainID.String()) } if tx.Sequence != nil { diff --git a/core/web/presenters/evm_chain.go b/core/web/presenters/evm_chain.go index d0d0e196853..adf399d4b01 100644 --- a/core/web/presenters/evm_chain.go +++ b/core/web/presenters/evm_chain.go @@ -34,7 +34,7 @@ func (r EVMNodeResource) GetName() string { // NewEVMNodeResource returns a new EVMNodeResource for node. func NewEVMNodeResource(node types.NodeStatus) EVMNodeResource { return EVMNodeResource{NodeResource{ - JAID: NewJAID(node.Name).GetWithPrefixedChainID(node.ChainID), + JAID: NewPrefixedJAID(node.Name, node.ChainID), ChainID: node.ChainID, Name: node.Name, State: node.State, diff --git a/core/web/presenters/jsonapi.go b/core/web/presenters/jsonapi.go index db12e0bab84..d14e24a7455 100644 --- a/core/web/presenters/jsonapi.go +++ b/core/web/presenters/jsonapi.go @@ -15,6 +15,11 @@ func NewJAID(id string) JAID { return JAID{id} } +// NewPrefixedJAID prefixes JAID with chain id in %s/%s format. +func NewPrefixedJAID(id string, chainID string) JAID { + return JAID{ID: fmt.Sprintf("%s/%s", chainID, id)} +} + // NewJAIDInt32 converts an int32 into a JAID func NewJAIDInt32(id int32) JAID { return JAID{strconv.Itoa(int(id))} @@ -36,8 +41,3 @@ func (jaid *JAID) SetID(value string) error { return nil } - -// GetWithPrefixedChainID returns JAID formatted with chainID, this is done to prevent cross chain ID collision. -func (jaid JAID) GetWithPrefixedChainID(chainID string) JAID { - return JAID{ID: fmt.Sprintf("%s/%s", chainID, jaid.ID)} -} diff --git a/core/web/presenters/solana_chain.go b/core/web/presenters/solana_chain.go index 70ee604c910..798d98124a5 100644 --- a/core/web/presenters/solana_chain.go +++ b/core/web/presenters/solana_chain.go @@ -36,7 +36,7 @@ func (r SolanaNodeResource) GetName() string { // NewSolanaNodeResource returns a new SolanaNodeResource for node. func NewSolanaNodeResource(node types.NodeStatus) SolanaNodeResource { return SolanaNodeResource{NodeResource{ - JAID: NewJAID(node.Name).GetWithPrefixedChainID(node.ChainID), + JAID: NewPrefixedJAID(node.Name, node.ChainID), ChainID: node.ChainID, Name: node.Name, State: node.State, diff --git a/core/web/presenters/solana_msg.go b/core/web/presenters/solana_msg.go index 8a5b9c7256a..3acf2aac0dc 100644 --- a/core/web/presenters/solana_msg.go +++ b/core/web/presenters/solana_msg.go @@ -17,7 +17,7 @@ func (SolanaMsgResource) GetName() string { // NewSolanaMsgResource returns a new partial SolanaMsgResource. func NewSolanaMsgResource(id string, chainID string) SolanaMsgResource { return SolanaMsgResource{ - JAID: NewJAID(id).GetWithPrefixedChainID(chainID), + JAID: NewPrefixedJAID(id, chainID), ChainID: chainID, } } diff --git a/core/web/presenters/starknet_chain.go b/core/web/presenters/starknet_chain.go index 06d2fcf1bcc..addf798fe9f 100644 --- a/core/web/presenters/starknet_chain.go +++ b/core/web/presenters/starknet_chain.go @@ -36,7 +36,7 @@ func (r StarkNetNodeResource) GetName() string { // NewStarkNetNodeResource returns a new StarkNetNodeResource for node. func NewStarkNetNodeResource(node types.NodeStatus) StarkNetNodeResource { return StarkNetNodeResource{NodeResource{ - JAID: NewJAID(node.Name).GetWithPrefixedChainID(node.ChainID), + JAID: NewPrefixedJAID(node.Name, node.ChainID), ChainID: node.ChainID, Name: node.Name, State: node.State, From f40dc3d3aa7d3e32d4788a4376b4f44df6164b19 Mon Sep 17 00:00:00 2001 From: ilija Date: Fri, 9 Feb 2024 18:13:56 -0500 Subject: [PATCH 3/4] minor test fix --- integration-tests/actions/vrf/common/actions.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/actions/vrf/common/actions.go b/integration-tests/actions/vrf/common/actions.go index ec7972de597..0c779ea90e5 100644 --- a/integration-tests/actions/vrf/common/actions.go +++ b/integration-tests/actions/vrf/common/actions.go @@ -54,8 +54,8 @@ func CreateAndFundSendingKeys( if response.StatusCode != 200 { return nil, fmt.Errorf("error creating transaction key - response code, err %d", response.StatusCode) } - newNativeTokenKeyAddresses = append(newNativeTokenKeyAddresses, newTxKey.Data.ID) - err = actions.FundAddress(client, newTxKey.Data.ID, big.NewFloat(chainlinkNodeFunding)) + newNativeTokenKeyAddresses = append(newNativeTokenKeyAddresses, newTxKey.Data.Attributes.Address) + err = actions.FundAddress(client, newTxKey.Data.Attributes.Address, big.NewFloat(chainlinkNodeFunding)) if err != nil { return nil, err } From 0d5a5c0bfa04b2500067dd7207eaaa521df9798e Mon Sep 17 00:00:00 2001 From: ilija Date: Mon, 12 Feb 2024 17:31:31 +0100 Subject: [PATCH 4/4] Flip FormatWithPrefixedChainID params to make more sense --- core/cmd/cosmos_node_commands_test.go | 2 +- core/cmd/evm_node_commands_test.go | 4 ++-- core/cmd/solana_node_commands_test.go | 4 ++-- core/cmd/starknet_node_commands_test.go | 4 ++-- core/internal/cltest/cltest.go | 2 +- core/web/eth_keys_controller_test.go | 10 +++++----- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/core/cmd/cosmos_node_commands_test.go b/core/cmd/cosmos_node_commands_test.go index 32256b451f1..3197c48aa94 100644 --- a/core/cmd/cosmos_node_commands_test.go +++ b/core/cmd/cosmos_node_commands_test.go @@ -48,7 +48,7 @@ func TestShell_IndexCosmosNodes(t *testing.T) { nodes := *r.Renders[0].(*cmd.CosmosNodePresenters) require.Len(t, nodes, 1) n := nodes[0] - assert.Equal(t, cltest.FormatWithPrefixedChainID(*node.Name, chainID), n.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(chainID, *node.Name), n.ID) assert.Equal(t, chainID, n.ChainID) assert.Equal(t, *node.Name, n.Name) wantConfig, err := toml.Marshal(node) diff --git a/core/cmd/evm_node_commands_test.go b/core/cmd/evm_node_commands_test.go index b78a88e02e2..96269c9e028 100644 --- a/core/cmd/evm_node_commands_test.go +++ b/core/cmd/evm_node_commands_test.go @@ -60,13 +60,13 @@ func TestShell_IndexEVMNodes(t *testing.T) { n1 := nodes[0] n2 := nodes[1] assert.Equal(t, chainID.String(), n1.ChainID) - assert.Equal(t, cltest.FormatWithPrefixedChainID(*node1.Name, chainID.String()), n1.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(chainID.String(), *node1.Name), n1.ID) assert.Equal(t, *node1.Name, n1.Name) wantConfig, err := toml.Marshal(node1) require.NoError(t, err) assert.Equal(t, string(wantConfig), n1.Config) assert.Equal(t, chainID.String(), n2.ChainID) - assert.Equal(t, cltest.FormatWithPrefixedChainID(*node2.Name, chainID.String()), n2.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(chainID.String(), *node2.Name), n2.ID) assert.Equal(t, *node2.Name, n2.Name) wantConfig2, err := toml.Marshal(node2) require.NoError(t, err) diff --git a/core/cmd/solana_node_commands_test.go b/core/cmd/solana_node_commands_test.go index 5192cacfb92..ebe9502d1fa 100644 --- a/core/cmd/solana_node_commands_test.go +++ b/core/cmd/solana_node_commands_test.go @@ -55,13 +55,13 @@ func TestShell_IndexSolanaNodes(t *testing.T) { n1 := nodes[0] n2 := nodes[1] assert.Equal(t, id, n1.ChainID) - assert.Equal(t, cltest.FormatWithPrefixedChainID(*node1.Name, id), n1.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(id, *node1.Name), n1.ID) assert.Equal(t, *node1.Name, n1.Name) wantConfig, err := toml.Marshal(node1) require.NoError(t, err) assert.Equal(t, string(wantConfig), n1.Config) assert.Equal(t, id, n2.ChainID) - assert.Equal(t, cltest.FormatWithPrefixedChainID(*node2.Name, id), n2.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(id, *node2.Name), n2.ID) assert.Equal(t, *node2.Name, n2.Name) wantConfig2, err := toml.Marshal(node2) require.NoError(t, err) diff --git a/core/cmd/starknet_node_commands_test.go b/core/cmd/starknet_node_commands_test.go index 0feef94efbe..95f712d29bd 100644 --- a/core/cmd/starknet_node_commands_test.go +++ b/core/cmd/starknet_node_commands_test.go @@ -54,13 +54,13 @@ func TestShell_IndexStarkNetNodes(t *testing.T) { n1 := nodes[0] n2 := nodes[1] assert.Equal(t, id, n1.ChainID) - assert.Equal(t, cltest.FormatWithPrefixedChainID(*node1.Name, id), n1.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(id, *node1.Name), n1.ID) assert.Equal(t, *node1.Name, n1.Name) wantConfig, err := toml.Marshal(node1) require.NoError(t, err) assert.Equal(t, string(wantConfig), n1.Config) assert.Equal(t, id, n2.ChainID) - assert.Equal(t, cltest.FormatWithPrefixedChainID(*node2.Name, id), n2.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(id, *node2.Name), n2.ID) assert.Equal(t, *node2.Name, n2.Name) wantConfig2, err := toml.Marshal(node2) require.NoError(t, err) diff --git a/core/internal/cltest/cltest.go b/core/internal/cltest/cltest.go index b5c2e4676c5..332513b28d4 100644 --- a/core/internal/cltest/cltest.go +++ b/core/internal/cltest/cltest.go @@ -165,7 +165,7 @@ func MustRandomBytes(t *testing.T, l int) (b []byte) { return b } -func FormatWithPrefixedChainID(id, chainID string) string { +func FormatWithPrefixedChainID(chainID, id string) string { return fmt.Sprintf("%s/%s", chainID, id) } diff --git a/core/web/eth_keys_controller_test.go b/core/web/eth_keys_controller_test.go index e895d18a792..e075b3196e1 100644 --- a/core/web/eth_keys_controller_test.go +++ b/core/web/eth_keys_controller_test.go @@ -284,7 +284,7 @@ func TestETHKeysController_ChainSuccess_UpdateNonce(t *testing.T) { err := cltest.ParseJSONAPIResponse(t, resp, &updatedKey) assert.NoError(t, err) - assert.Equal(t, cltest.FormatWithPrefixedChainID(key.Address.String(), cltest.FixtureChainID.String()), updatedKey.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(cltest.FixtureChainID.String(), key.Address.String()), updatedKey.ID) assert.Equal(t, key.Address.String(), updatedKey.Address) assert.Equal(t, cltest.FixtureChainID.String(), updatedKey.EVMChainID.String()) assert.Equal(t, false, updatedKey.Disabled) @@ -329,7 +329,7 @@ func TestETHKeysController_ChainSuccess_Disable(t *testing.T) { err := cltest.ParseJSONAPIResponse(t, resp, &updatedKey) assert.NoError(t, err) - assert.Equal(t, cltest.FormatWithPrefixedChainID(key.Address.String(), updatedKey.EVMChainID.String()), updatedKey.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(updatedKey.EVMChainID.String(), key.Address.String()), updatedKey.ID) assert.Equal(t, key.Address.String(), updatedKey.Address) assert.Equal(t, cltest.FixtureChainID.String(), updatedKey.EVMChainID.String()) assert.Equal(t, true, updatedKey.Disabled) @@ -373,7 +373,7 @@ func TestETHKeysController_ChainSuccess_Enable(t *testing.T) { err := cltest.ParseJSONAPIResponse(t, resp, &updatedKey) assert.NoError(t, err) - assert.Equal(t, cltest.FormatWithPrefixedChainID(key.Address.String(), cltest.FixtureChainID.String()), updatedKey.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(cltest.FixtureChainID.String(), key.Address.String()), updatedKey.ID) assert.Equal(t, key.Address.String(), updatedKey.Address) assert.Equal(t, cltest.FixtureChainID.String(), updatedKey.EVMChainID.String()) assert.Equal(t, false, updatedKey.Disabled) @@ -439,7 +439,7 @@ func TestETHKeysController_ChainSuccess_ResetWithAbandon(t *testing.T) { err = cltest.ParseJSONAPIResponse(t, resp, &updatedKey) assert.NoError(t, err) - assert.Equal(t, cltest.FormatWithPrefixedChainID(key.Address.String(), cltest.FixtureChainID.String()), updatedKey.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(cltest.FixtureChainID.String(), key.Address.String()), updatedKey.ID) assert.Equal(t, key.Address.String(), updatedKey.Address) assert.Equal(t, cltest.FixtureChainID.String(), updatedKey.EVMChainID.String()) assert.Equal(t, false, updatedKey.Disabled) @@ -667,7 +667,7 @@ func TestETHKeysController_DeleteSuccess(t *testing.T) { err := cltest.ParseJSONAPIResponse(t, resp, &deletedKey) assert.NoError(t, err) - assert.Equal(t, cltest.FormatWithPrefixedChainID(key0.Address.String(), cltest.FixtureChainID.String()), deletedKey.ID) + assert.Equal(t, cltest.FormatWithPrefixedChainID(cltest.FixtureChainID.String(), key0.Address.String()), deletedKey.ID) assert.Equal(t, key0.Address.String(), deletedKey.Address) assert.Equal(t, cltest.FixtureChainID.String(), deletedKey.EVMChainID.String()) assert.Equal(t, false, deletedKey.Disabled)