Repository navigation
proof of work (restored) - #34
CassOnMars wants to merge 22 commits into
Conversation
felirami
left a comment
There was a problem hiding this comment.
Comment-only review on head f4fc4af. I did not modify code, approval state, labels, settings, or resolve any threads. The Rust workspace check and Solidity tests passed locally; the inline comments capture the blocking correctness/build findings.
| let blinding_diff = extract_blinding_diff(tx_proto) | ||
| .map_err(|e| RoutingError::Transfer(format!("codec: {}", e)))?; | ||
| typed | ||
| .validate_against_store(&self.note_store) |
There was a problem hiding this comment.
[P1] Bind the transfer envelope during validation. This still calls validate_against_store, which verifies the legacy bare signing_payload(). The new signing_payload_with_envelope(...) is therefore not enforced here, and the block-import path repeats the same bare validation. A relay can replace an output's valid one_time_pubkey without invalidating the input signature, changing or stranding the recorded output owner. Please verify the envelope-bound digest at both admission and import, and make the wallet sign that same digest.
| bytes commitment = 1; | ||
| // Bulletproofs range proof bytes proving 0 ≤ value < 2^DEFAULT_RANGE_BITS. | ||
| bytes range_proof = 2; | ||
| // 56-byte compressed Decaf448 one-time pubkey the recipient must |
There was a problem hiding this comment.
[P1] The wire output lacks the data required to recover and spend a confidential note. scan_stealth_note needs the sender's ephemeral tx_pubkey, and a later spend needs the note's value/blinding (the crypto module already provides an encrypted note payload for this). Neither is carried here, while the wallet drops the generated tx_pubkey and returns only the message. As written, recipients cannot independently discover/open these outputs and construct a subsequent spend without an undocumented out-of-band channel.
| destination_chain_id, | ||
| destination_address, | ||
| blinding_diff_scalar: blinding_diff.to_bytes().to_vec(), | ||
| range_proof: Vec::new(), |
There was a problem hiding this comment.
[P1] Messages produced by this builder cannot pass runtime validation. The builder subtracts a random output_blinding associated with an output_commitment that is never included in the lock, so the runtime's balance-closure check does not match. It also always sends an empty range_proof, while validate_against_store explicitly rejects empty proofs. The builder should construct the exact blinding delta and range proof expected by the runtime.
| import React, { useMemo, useState } from "react"; | ||
| import { useAccount } from "wagmi"; | ||
| import { isAddress, isHex, type Address, type Hex } from "viem"; | ||
| import { buildRoot, proofFor, sortHexAscending } from "../lib/merkle"; |
There was a problem hiding this comment.
[P1] The deployer UI does not build from this PR. These imports reference missing src/lib/merkle and src/lib/leaf modules; RootSigner also imports a missing src/lib/recover. After npm ci and forge build, npm run build fails on these modules and on missing Node typings for the build scripts (node:fs, process, ImportMeta.url). Please add the missing sources/configuration so a clean build succeeds.
| // commits could leave the trie at height H and | ||
| // the header at H-1, diverging the chain on | ||
| // restart. | ||
| if let Err(e) = self.stores.block_store.stage_block(&mut txn, block) { |
There was a problem hiding this comment.
[P1] Do not commit the state batch after block staging fails. This logs stage_block errors and then still commits the state mutations without the block, recreating the state/header divergence this atomicity change is intended to prevent. The shard-chunk path in src/storage/store/engine.rs has the same pattern. Staging failures should abort or propagate before commit.
|
We read through this PR at Overall the core is in good shape: shard-0 ledger math is checked everywhere, emission is integer-only with BTreeMap ordering, the Rust/Solidity header, leaf and action encodings match byte for byte, Falcon decoding is strict, the pivot boot is crash-safe, and the relay dedupes on recomputed hashes. The issues below are what we'd want resolved before mainnet. Bridge
Emission and PoQ
Consensus and node behavior (these also affect pre-pivot nodes)
Crypto, CI and scope
Happy to help with fixes or tests on any of these, especially 1, 8, 15 and 21. |
No description provided.