Skip to content

CAIP-10 and CAIP-19: mandate case-normalization #351

@u59149403

Description

@u59149403

Let's talk about eip155/caip10 ( https://namespaces.chainagnostic.org/eip155/caip10 ). Currently the text says that generators SHOULD generate EIP-55-normalized addresses and SHOULD consume both EIP-55 normalized and all-lowercase addresses.

I don't like this wording and propose that eip155/caip10 addresses simply always MUST be EIP-55-normalized (i. e. generators MUST generate EIP-55-normalized addresses only and consumers MUST consume EIP-55-normalized addresses only).

Here is my reasons.

  • My proposal allows one to check two EIP-155/CAIP-10 addresses for equality using simple byte comparison. Moreover, if all namespaces accept some normalization scheme, then one will be able to check any two CAIP-10 addresses for equality by byte comparison. (Note that CAIP-10 says in "Rationale" that "uniqueness between chains" is one of the goals.) But in current CAIP-10 version we have to use namespace-specific comparison. I. e. implementations forced to have complicated comparison function, which includes special cases for every namespace. This is very difficult. Moreover, implementations have to be updated every time CAIP introduces new namespace
  • As well as I understand, one of the goals of CAIP-10 is to be usable in smart contracts, i. e. on-chain. Obviously, complicated namespace-specific comparison procedure will be too difficult to implement on-chain. Moreover, it will be very gas-intensive, compared to simple byte-string equality. Moreover, the procedure should be updated every time new namespace is added to CAIP-10, which is impossible for immutable contracts!
  • Current wording makes checksum optional, which simply goes against checksum purpose. Whole raison d'etre of checksum is to be checked every time! Bank card numbers use last digit as a checksum, and it is always checked!
  • We already have precedent: eip 3770 says that we MUST use EIP-55. And Gnosis Safe implements EIP 3770
  • eip155/caip10 uses Postel's law as motivation for accepting all-lowercase address. eip155/caip10 links to IETF RFC 760 from year 1980. But later IETF RFC 3117 ( https://datatracker.ietf.org/doc/html/rfc3117 ) from year 2001 criticizes Postel's law in subsection "4.5 Robustness". Postel's law was important for early internet, but today security concerns outweigh Postel's law's flexibility

For all these reasons I propose to mandate EIP-55 encoding in eip155/caip10 and also to choose some normalization scheme for all namespaces, i. e. to make all CAIP-10 addresses case-normal. Also the same applies to CAIP-19.

Why this is important for me? I plan to create my personal accounting system for my cryptocurrency operations. I plan to use CAIP-10 and CAIP-19 to refer to addresses and assets. So high quality CAIP specs are important for me.

If you want, I can write pull request for EIP-155 namespace. (Unfortunately, I'm not expert for other namespaces, so I cannot write PR for them.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions