Переглянути джерело

event_graph: Document staked registration boundary

x 1 місяць тому
батько
коміт
b7bb386493

+ 8 - 8
bin/darkirc/src/crypto/rln.rs

@@ -78,11 +78,10 @@ impl RlnIdentity {
                 pallas::Base::random(&mut rng),
             ]),
             trapdoor: poseidon_hash([RLN_TRAPDOOR_DERIVATION_PATH, pallas::Base::random(&mut rng)]),
-            // Default to the free-tier cap. The operator can request
-            // a higher limit at registration time (subject to the
-            // attestation gating in `RegistrationAttestation::permits`,
-            // which currently only honours the free-tier cap until
-            // staking lands).
+            // Default to the pregenerated-identity budget. Fresh
+            // identities are useful for generating future genesis bundles,
+            // but the live network currently admits only commitments already
+            // present in the configured pregenerated set.
             user_message_limit: RegistrationAttestation::SPECIAL_TIER_LIMIT,
             message_id: 0,
             last_epoch: 0,
@@ -130,9 +129,10 @@ impl RlnIdentity {
         Some(m)
     }
 
-    // /// Build a [`RegistrationBlob`] suitable for broadcast as a
-    // /// `StaticPut`. The proving key comes from the EventGraph's
-    // /// shared `ZkKeys` cache.
+    // /// Build a [`RegistrationBlob`] for the dormant registration-proof
+    // /// path. Do not broadcast this on the live network until event graph
+    // /// verifies DarkFi contract-backed staked attestations; current
+    // /// admission accepts only pregenerated guard registrations.
     // pub fn create_registration(&self, eg: &EventGraphPtr) -> Result<RegistrationBlob> {
     //     let zkbin = ZkBinary::decode(RLN2_REGISTER_ZKBIN, false)?;
 

+ 13 - 11
bin/darkirc/src/irc/services/nickserv.rs

@@ -128,22 +128,23 @@ scrollback or logs.
 
 const NICKSERV_REGISTER_HELP: &str = r#"***** NickServ Help: REGISTER *****
 
-REGISTER creates a new RLN identity from the supplied secrets,
-broadcasts a registration proof to the network, and stores the
-account locally. The first account registered also becomes the
-active one.
+REGISTER stores one of this network's pregenerated RLN identities
+under a local account name. Pregenerated identities are already
+bootstrapped into the static DAG; this command does not broadcast a
+public free-tier registration proof. The first account registered
+also becomes the active one.
 
-To generate a fresh nullifier/trapdoor pair, run:
-
-  darkirc --gen-rln-identity
+Use the nullifier/trapdoor pair from the network's pregenerated
+identity bundle. A freshly generated identity is rejected unless its
+commitment is already present in the configured pregenerated set.
 
   REGISTER <account_name> <nullifier> <trapdoor> <user_msg_limit>
 
   account_name      - any local label, e.g. "alice" or "throwaway"
   nullifier         - base58-encoded pallas::Base scalar
   trapdoor          - base58-encoded pallas::Base scalar
-  user_msg_limit    - per-epoch message budget; max 10 on the free
-                      tier (RegistrationAttestation::FREE_TIER_LIMIT)
+  user_msg_limit    - pregenerated account budget; must match the
+                      configured genesis limit
 
 ***** End of Help *****
 "#;
@@ -532,8 +533,9 @@ impl NickServ {
             ));
         }
         // Pregenerated identities are already bootstrapped into
-        // the static DAG. Future staked registration will need to
-        // add a contract-backed network broadcast path here.
+        // the static DAG. Future staked registration must add a
+        // contract-backed network broadcast path here, after event
+        // graph can verify the DarkFi attestation.
         Ok(replies)
     }
 

+ 7 - 1
bin/darkirc/src/main.rs

@@ -233,7 +233,13 @@ async fn realmain(args: Args, ex: Arc<Executor<'static>>) -> Result<()> {
         let user_msg_limit: u64 = 10;
 
         println!("Generated a fresh RLN identity.\n");
-        println!("To register on the network, paste this into your IRC client:\n");
+        println!(
+            "Current DarkIRC registration accepts only identities whose commitments are in \
+             the configured pregenerated set. Use this output for a genesis bundle or future \
+             staked-registration testing; it will not register on the live network unless its \
+             commitment is pregenerated.\n"
+        );
+        println!("Local account import command:\n");
         println!(
             "  /msg NickServ REGISTER <account_name> {nullifier} {trapdoor} {user_msg_limit}\n"
         );

+ 8 - 6
src/event_graph/mod.rs

@@ -2752,10 +2752,12 @@ impl EventGraph {
                     }
                 }
 
-                // Free non-pregenerated registration is intentionally disabled:
-                // it is a sybil attack surface. Keep the proof scaffolding
-                // below for the future staked tier, where acceptance must be
-                // backed by a DarkFi smart-contract attestation.
+                // Non-pregenerated registration is intentionally disabled:
+                // an unstaked public tier is a sybil attack surface. Keep
+                // the proof scaffold below for the future staked tier, where
+                // acceptance must be backed by a DarkFi smart-contract
+                // attestation verified by event graph before mutating the
+                // identity tree.
                 StaticEventCheck::Rejected
                 /*
                 #[allow(unreachable_code)]
@@ -2773,8 +2775,8 @@ impl EventGraph {
                 }
 
                 // Attestation must permit the claimed limit.
-                // (Free-tier cap; `Staked` rejected until the stake
-                // contract is online.)
+                // (Dormant SPECIAL proof cap; `Staked` rejected until
+                // the DarkFi contract verifier is online.)
                 if !reg.attestation.permits(reg.user_message_limit) {
                     return StaticEventCheck::Malicious
                 }

+ 31 - 17
src/event_graph/rln.rs

@@ -120,42 +120,56 @@ impl RlnAppId {
     }
 }
 
-/// Versioned attestation accompanying a registration.
+/// Versioned attestation accompanying a registration proof.
 ///
-/// Runtime admission currently accepts only configured pregenerated
-/// identities. This enum is retained for the future staked tier,
-/// where a DarkFi smart-contract attestation must back new identity
-/// registration.
+/// Runtime admission currently accepts only app-configured pregenerated
+/// commitments paired with [`GENESIS_BLOB_GUARD`]. No serialized
+/// [`RegistrationBlob`] is accepted from the network today; the enum is
+/// retained as scaffolding for the future staked tier, where the
+/// `Staked` variant must carry a DarkFi smart-contract attestation that
+/// event graph can verify before admitting a new identity.
 #[derive(Clone, Debug, SerialEncodable, SerialDecodable)]
 pub enum RegistrationAttestation {
+    /// Dormant proof-path scaffold for the currently disabled
+    /// non-pregenerated registration flow. This is not an active public
+    /// free tier; live admission bypasses `RegistrationBlob` entirely and
+    /// accepts only pregenerated guard registrations.
     SPECIAL,
-    /// Reserved for the future staking integration.
+    /// Reserved for the future staking integration. The bytes are opaque
+    /// until the DarkFi contract attestation format and verifier exist.
     Staked(Vec<u8>),
 }
 
 impl RegistrationAttestation {
-    /// In special-tier mode.
+    /// Message limit used by the dormant SPECIAL proof scaffold.
     pub const SPECIAL_TIER_LIMIT: u64 = 100;
 
-    /// Validate the attestation against a claimed limit.
+    /// Validate the attestation against a claimed limit in the dormant
+    /// registration-proof path.
+    ///
+    /// This helper is not sufficient for live admission. The live path
+    /// rejects all serialized registration blobs until staked admission is
+    /// backed by a verifiable DarkFi contract attestation.
     pub fn permits(&self, user_message_limit: u64) -> bool {
         match self {
             Self::SPECIAL => user_message_limit <= Self::SPECIAL_TIER_LIMIT,
-            // Until staking is implemented, refuse to honor any
-            // "Staked" attestation
             Self::Staked(_) => false,
         }
     }
 }
 
-/// The complete blob attached to a registration `EventPut` /
-/// `StaticPut`. The proof's public inputs commit to the
-/// `(commitment, user_message_limit, max_message_limit)` tuple,
-/// and `attestation` carries the staking proof.
+/// The complete blob for the disabled registration-proof path.
+///
+/// The proof's public inputs commit to the
+/// `(commitment, user_message_limit, max_message_limit)` tuple, and
+/// `attestation` is reserved for the future staking proof. Runtime
+/// verification intentionally rejects these blobs today because an
+/// unstaked public registration tier is a sybil attack surface.
 ///
-/// Non-pregenerated registration is disabled until contract-backed
-/// staked admission is implemented; current admission accepts only
-/// app-configured commitments paired with [`GENESIS_BLOB_GUARD`].
+/// Current admission accepts only app-configured pregenerated
+/// commitments paired with [`GENESIS_BLOB_GUARD`]. Future staked
+/// admission must deserialize this type only after it can verify the
+/// DarkFi contract attestation carried by [`RegistrationAttestation::Staked`].
 #[derive(Clone, SerialEncodable, SerialDecodable)]
 pub struct RegistrationBlob {
     pub proof: Proof,