I view this as an opportunity to nail down what the value of CHAIN_ID
can be. It’s not well defined.
The yellow paper defines v
as 1 byte (Appendix F, v is a member of open bar B sub 1), and per the spurious dragon fork chain_id
is encoded into v (0x35+CHAIN_ID) which leaves room for only 101 networks. However EIP-155 where this scheme was introduced defines 1337 as a Geth devnet, which breaks this.
When RLP encoded technically the size is unlimited, so Geth uses a big.Int
(go library for arbitrary precision). But Parity uses a u64
(unsigned 64 int byte) and pantheon uses an int
(32 bit signed) since none of the known networks have CHAIN_IDs > 4 million… yet.
EIP-712 is still draft so it shouldn’t be authoritative, and can still be updated as well.
Any of the fixed length values sounds fine to me (256, 64, 32), but there should be test cases testing some common known values, values up to the limit, and values over the limit of the chain_id. We also should look into updating Appendix F of the Yellow Paper with the correct values to give some specification weight to the limit.