This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes consensus-shipyard/ipc#339
The PR is an opinionated (quick and dirty if you like) implementation of a domain separation of chains by hashing the chain ID together with the message CID, so the signature cannot be validated on a different chain, preventing replay attacks.
It doesn't implement delegated signatures. My goal was just to thread the necessary settings through the CLI, RPC, interpreters, genesis, etc.
The way it works is:
chain_name
is configured in the genesis file.chain_id
duringinit_chain
and becomes part of the state (it might change during the life of the chain if there is a fork or state migration).chain_id
from the state and uses it to validate signatures.--chain-name
argument which is turned into achain_id
and used to produce signatures.How the
chain_name
is turned into achain_id
is full of ad-hoc decisions:BigInt
, then we take the modulo of the highest chain ID Javascript tools can handle (the chain ID must work with EVM tools).u64
that is the chain ID, append it to the CID, then use this as the input for signing.