diff --git a/deployment/address_book.go b/deployment/address_book.go index fbac20586c1..f02ef35ec77 100644 --- a/deployment/address_book.go +++ b/deployment/address_book.go @@ -94,7 +94,7 @@ type AddressBookMap struct { } // Save will save an address for a given chain selector. It will error if there is a conflicting existing address. -func (m *AddressBookMap) Save(chainSelector uint64, address string, typeAndVersion TypeAndVersion) error { +func (m *AddressBookMap) save(chainSelector uint64, address string, typeAndVersion TypeAndVersion) error { family, err := chainsel.GetSelectorFamily(chainSelector) if err != nil { return errors.Wrapf(ErrInvalidChainSelector, "chain selector %d", chainSelector) @@ -110,6 +110,9 @@ func (m *AddressBookMap) Save(chainSelector uint64, address string, typeAndVersi return errors.Wrapf(ErrInvalidAddress, "address %s is not a valid Ethereum address, only Ethereum addresses supported for EVM chains", address) } } + + // TODO NONEVM-960: Add validation for non-EVM chain addresses + if typeAndVersion.Type == "" { return fmt.Errorf("type cannot be empty") } diff --git a/deployment/address_book_test.go b/deployment/address_book_test.go index 9040902a169..4a3d3d95853 100644 --- a/deployment/address_book_test.go +++ b/deployment/address_book_test.go @@ -44,6 +44,10 @@ func TestAddressBook_Save(t *testing.T) { err = ab.Save(chainsel.TEST_90000001.Selector, common.HexToAddress("0x0").Hex(), onRamp100) require.Error(t, err) + // Zero address but non evm chain + err = NewMemoryAddressBook().Save(chainsel.APTOS_MAINNET.Selector, common.HexToAddress("0x0").Hex(), onRamp100) + require.NoError(t, err) + // Distinct address same TV will not err = ab.Save(chainsel.TEST_90000001.Selector, addr2, onRamp100) require.NoError(t, err)