feat(primitives): add Chain::Midnight and its epsilon derivation - #1075
feat(primitives): add Chain::Midnight and its epsilon derivation#1075Pessina wants to merge 6 commits into
Conversation
| // ChainAgnostic/namespaces. "canton:global" follows the | ||
| // namespace:reference format as a project-local identifier. | ||
| Chain::Canton => "canton:global", | ||
| Chain::Midnight => "midnight:testnet", |
There was a problem hiding this comment.
So midnight doesn't have a caip id either or is testnet actually expected for it?
There was a problem hiding this comment.
They have a draft proposal for the caip2id: https://github.com/midnightntwrk/midnight-improvement-proposals/blob/main/mips/mip-0008-caip-2-network-identifiers.md
I would say we can use midnight:mainnet for now (per #1075 (comment), cc @ppca)
Later when they settle we update it. Anyways we won't go live on mainnet before they release the new ledger version (expected to be released end of September)
| Chain::Bitcoin => "bip122:000000000019d6689c085ae165831e93", | ||
| Chain::Hydration => "polkadot:2034", | ||
| Chain::Canton => "canton:global", | ||
| Chain::Midnight => "midnight:testnet", |
There was a problem hiding this comment.
I think MPC only uses caip2_id for the mainnet of the network, it does not differentiate testnet and mainnet because one node will only connect to either testnet or mainnet at the same time.
|
|
Regenerates the epsilon golden fixture from @sig-net/midnight@0.14.0.
dca1a5e to
c6ea68a
Compare
Carves
Chain::Midnightandderive_epsilon_midnightout of #1059 so the one change in that stack that touches a wire format is reviewed on its own rather than inside a 7.5k-line diff. Adds the enum variant, the KDF wrapper and its re-export, the per-chain config arms, and epsilon plussender_stringrouting on both bidirectional extension traits. The rest of #1059 rebases on top once this lands.The chain id is
midnight:mainnet. It is a chain-level constant here, not a per-environment one:Chain::Ethereumiseip155:1while tests run against 31337, and NEAR and Solana pin mainnet the same way. It is also the most stable of the candidates. Midnight has no registered CAIP-2 namespace at all (MIP-0008 proposesmidnightbut is still Draft, with the reference format undecided), and its illustrative registry keepsmidnight:mainnetwhile flaggingmidnight:testnetas pending a core decision on whethertestnetstays distinct frompreprodandpreview.Follow-up required before anything derives keys against this:
@sig-net/midnightstill exportsMIDNIGHT_TESTNET_CHAIN_ID = "midnight:testnet"as the default third argument ofderiveEpsilon. The golden fixture here passes the chain id explicitly so its values stay anchored to that package, but the constant in midnight-integration has to move with this commit or integrators calling the default will derive different addresses than the node does.