Skip to content

Commit d90691d

Browse files
committed
Add improved documentation for chain id constant(s)
1 parent c37d88d commit d90691d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

massa-models/src/config/constants.rs

+10
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ lazy_static::lazy_static! {
7878
.unwrap()
7979
};
8080
/// node chain id (to avoid replay attacks)
81+
///
82+
/// By signing an operation with an ID of the target chain
83+
/// (e.g. whether the operation targets LABNET, BUILDNET or MAINNET), the user is protected from
84+
/// a malicious actor that could steal operations created on BUILDNET / LABNET and try to replay
85+
/// them on the Massa MAINNET (and potentially stealing real coins)
86+
/// Chain id idea and implementation come from Ethereum EIPs:
87+
/// * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md
88+
/// * https://eips.ethereum.org/EIPS/eip-1344
89+
/// Chain id can be queried in Smart contracts (AssemblyScript: chain_id call) and in the
90+
/// jsonrpc get_status call
8191
pub static ref CHAINID: u64 = {
8292
// MASM (MainNet): 77658377
8393
// MASS (SecureNet): 77658383

0 commit comments

Comments
 (0)