Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ members = [
"frame/try-runtime",
"miner-api",
"node",
"pallets/assets",
"pallets/assets-holder",
"pallets/balances",
"pallets/frame-system",
"pallets/mining-rewards",
Expand Down Expand Up @@ -255,8 +253,6 @@ frame-system-benchmarking = { path = "./frame/system-benchmarking", default-feat
frame-system-rpc-runtime-api = { path = "./frame/system-rpc-runtime-api", default-features = false }
frame-try-runtime = { path = "./frame/try-runtime", default-features = false }
hickory-resolver = { version = "0.26.1" }
pallet-assets = { path = "./pallets/assets", default-features = false }
pallet-assets-holder = { path = "./pallets/assets-holder", default-features = false }
pallet-preimage = { path = "./pallets/preimage", default-features = false }
pallet-ranked-collective = { path = "./pallets/ranked-collective", default-features = false }
pallet-recovery = { path = "./pallets/recovery", default-features = false }
Expand Down
24 changes: 8 additions & 16 deletions docs/RUNTIME_SURFACE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ the runtime, their dispatchable calls, the runtime APIs, transaction extensions,
genesis logic, and the workspace primitive crates pulled in.

- **Crate:** `quantus-runtime` (`runtime/`), version `0.7.1-q-day-2`
- **Spec:** `spec_name = quantus-runtime`, `spec_version = 131`, `transaction_version = 2`, `authoring_version = 1`
- **Spec:** `spec_name = quantus-runtime`, `spec_version = 138`, `transaction_version = 3`, `authoring_version = 1`
- **Build:** `no_std` WASM via `substrate-wasm-builder` (`runtime/build.rs`); native `std` build for the node/client
- **Block time target:** 12s (`TARGET_BLOCK_TIME_MS = 12_000`)
- **Consensus:** QPoW (quantum-resistant Proof of Work, Poseidon2-based)
Expand Down Expand Up @@ -77,13 +77,13 @@ The runtime derives `RuntimeCall`, `RuntimeEvent`, `RuntimeError`, `RuntimeOrigi
| 14 | `TechReferenda` | `pallet-referenda::Pallet<Runtime, Instance1>` `45.0.0` | **Inlined** (2nd instance) | yes |
| 15 | `TreasuryPallet` | `pallet-treasury` | **Local** (`pallets/treasury`) | yes |
| 16 | `Recovery` | `pallet-recovery` `45.0.0` | **Inlined** (`pallets/recovery`) | yes |
| 17 | `Assets` | `pallet-assets` `48.1.0` | **Inlined** (`pallets/assets`) | yes |
| 18 | `AssetsHolder` | `pallet-assets-holder` `0.8.0` | **Inlined** (`pallets/assets-holder`) | (no extrinsics) |
| 17 | | *(vacant; was `pallet-assets`)* | — | — |
| 18 | | *(vacant; was `pallet-assets-holder`)* | — | — |
| 19 | `Multisig` | `pallet-multisig` | **Local** (`pallets/multisig`) | yes |
| 20 | `Wormhole` | `pallet-wormhole` | **Local** (`pallets/wormhole`) | yes |
| 21 | `ZkTree` | `pallet-zk-tree` | **Local** (`pallets/zk-tree`) | no |

> Index 4 is intentionally left vacant after `pallet-sudo` removal so downstream indices stay stable.
> Indices 4, 17, and 18 are intentionally left vacant after pallet removals so downstream indices stay stable.

---

Expand Down Expand Up @@ -137,8 +137,8 @@ All `Config` impls live in `runtime/src/configs/mod.rs` unless noted.
- **Calls:** `submit`, `place_decision_deposit`, `refund_decision_deposit`, `cancel`, `kill`, `nudge_referendum`, `one_fewer_deciding`, `refund_submission_deposit`, `set_metadata`.

### Index 11 — `ReversibleTransfers` (`pallet-reversible-transfers`, local)
- `Scheduler = Scheduler`, `DefaultDelay = 1 DAY`, `MinDelayPeriodBlocks = 2`, `MaxGuardianAccounts = 32`, `MaxPendingPerAccount = 16`, `VolumeFee = 1%` (high-security reversals, burned), `ProofRecorder = Wormhole`, `PalletId = "rtpallet"`.
- **Calls:** `set_high_security`(0), `cancel`(1), `execute_transfer`(2), `schedule_transfer`(3), `schedule_transfer_with_delay`(4), `schedule_asset_transfer`(5), `schedule_asset_transfer_with_delay`(6), `recover_funds`(7).
- `AssetId = u32` (retained for wire-format compatibility; asset transfers are rejected), `Scheduler = Scheduler`, `DefaultDelay = 1 DAY`, `MinDelayPeriodBlocks = 2`, `MaxGuardianAccounts = 32`, `MaxPendingPerAccount = 16`, `VolumeFee = 1%` (high-security reversals, burned), `ProofRecorder = Wormhole`, `PalletId = "rtpallet"`.
- **Calls:** `set_high_security`(0), `cancel`(1), `execute_transfer`(2), `schedule_transfer`(3), `schedule_transfer_with_delay`(4), `recover_funds`(7). Call indices 5/6 were `schedule_asset_transfer` / `schedule_asset_transfer_with_delay` (removed with assets); kept vacant so `recover_funds` stays at 7. Pending transfers with `Some(asset_id)` fail with `AssetsNotSupported`.
- Backs `HighSecurityConfig` (account whitelist/guardian logic).

### Index 12 — `ConvictionVoting` (`pallet-conviction-voting`)
Expand All @@ -161,19 +161,12 @@ All `Config` impls live in `runtime/src/configs/mod.rs` unless noted.
- `ConfigDepositBase = 10 UNIT`, `FriendDepositFactor = 1 UNIT`, `MaxFriends = 9`, `RecoveryDeposit = 10 UNIT`.
- **Calls:** `as_recovered`, `set_recovered`, `create_recovery`, `initiate_recovery`, `vouch_recovery`, `claim_recovery`, `close_recovery`, `remove_recovery`, `cancel_recovered`.

### Index 17 — `Assets` (`pallet-assets`)
- `AssetId = u32`, `CreateOrigin = AsEnsureOriginWithArg<EnsureSigned>`, `ForceOrigin = EnsureRoot`, `AssetDeposit/AccountDeposit/Metadata = MILLI_UNIT`, `StringLimit = 50`, `CallbackHandle = AutoIncAssetId`, `Holder = AssetsHolder`, `RemoveItemsLimit = 1000`.
- **Calls:** full `pallet-assets` surface (`create`, `force_create`, `mint`, `burn`, `transfer`, `transfer_keep_alive`, `force_transfer`, `freeze`/`thaw`, `set_metadata`, `approve_transfer`, `transfer_approved`, etc.).

### Index 18 — `AssetsHolder` (`pallet-assets-holder`)
- `RuntimeEvent`, `RuntimeHoldReason`. No standalone extrinsics; provides hold support to `Assets`.

### Index 19 — `Multisig` (`pallet-multisig`, local)
- `MaxSigners = 100`, `MaxTotalProposalsInStorage = 200`, `MaxCallSize = 10 KB`, `MultisigFee = 0.6 UNIT` (burned), `ProposalDeposit = 1 UNIT`, `ProposalFee = 1 UNIT`, `MaxExpiryDuration ≈ 2 weeks`, `MaxInnerCallWeight = (10^12, 2.5 MB)`, `HighSecurity = HighSecurityConfig`, `PalletId = "py/mltsg"`.
- **Calls:** `create_multisig`(0), `propose`(1), `approve`(2), `cancel`(3), `remove_expired`(4), `claim_deposits`(5), `execute`(6). Exposes `derive_multisig_address`.

### Index 20 — `Wormhole` (`pallet-wormhole`, local)
- `Currency = Balances`, `Assets = Assets`, `VolumeFeeRateBps = 4` (0.04%; circuit ceil-rounds to ≥0.01 QUAN per exit), `VolumeFeesBurnRate = 50%`, `MintingAccount`, `WormholeAccountId = AccountId32`, `ZkTree = ZkTree`. No separate minimum exit amount.
- `Currency = Balances`, `AssetId = u32` (native leaves tagged as asset id 0 internally; non-native exits unsupported), `VolumeFeeRateBps = 4` (0.04%; circuit ceil-rounds to ≥0.01 QUAN per exit), `VolumeFeesBurnRate = 50%`, `MintingAccount`, `WormholeAccountId = AccountId32`, `ZkTree = ZkTree`. No separate minimum exit amount. No `pallet-assets` dependency.
- **Calls:** `verify_private_batch`(2) — verifies a private-batch ZK proof and processes batched transfers; `verify_public_batch`(3) — verifies a public-batch proof with per-segment denial and aggregator fee rebate.
- Implements `TransferProofRecorder` (`record_transfer`) consumed by mining-rewards, reversible-transfers, and the wormhole tx-extension. `on_initialize` emits genesis endowment proofs at block 1. Loads a static aggregated verifier (`get_aggregated_verifier`).

Expand Down Expand Up @@ -219,7 +212,7 @@ Signed-extension pipeline applied to every extrinsic, in order:
8. `pallet_transaction_payment::ChargeTransactionPayment`
9. `frame_metadata_hash_extension::CheckMetadataHash`
10. `transaction_extensions::ReversibleTransactionExtension` — **custom**: blocks non-whitelisted calls from high-security accounts.
11. `transaction_extensions::WormholeProofRecorderExtension` — **custom**: in `post_dispatch`, scans emitted `Transfer`/`Transferred`/`Minted`/`Issued` events and records transfer proofs into the ZK tree (event-based, covers direct/batch/multisig/recovery/scheduled transfers).
11. `transaction_extensions::WormholeProofRecorderExtension` — **custom**: in `post_dispatch`, scans emitted native `Balances::Transfer` / `Balances::Minted` events and records transfer proofs into the ZK tree (event-based, covers direct/batch/multisig/recovery/scheduled native transfers).

---

Expand All @@ -244,7 +237,6 @@ Signed-extension pipeline applied to every extrinsic, in order:
- Dilithium well-known accounts: `crystal_alice`, `dilithium_bob`, `crystal_charlie` (public seeds `[0]` / `[1]` / `[2]`). Used by `dev` and **intentionally also by `heisenberg`** so integrators and CI can exercise governance, treasury, and transfer flows without distributing secrets. Those private keys are public by design; do **not** reuse this pattern on a mainnet or any value-bearing chain (Planck already uses distinct live treasury signers).
- Treasury = 2-of-3 multisig of the three signers for `dev`/`heisenberg` (distinct nonce per preset); no genesis endowment (funded from mining-reward share only).
- Tech-collective seeded via the chain-spec-only `tech_collective_seed_members` JSON field (`prepare_genesis_build_input` + `seed_tech_collective`).
- Reserves asset id 0 for the native-token-in-assets wormhole path.
- Endows all genesis balances with wormhole transfer proofs (ZK-spendable). `dev` also endows `TEST_WORMHOLE_SECRET`'s address.

---
Expand Down
2 changes: 0 additions & 2 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ futures = { features = ["thread-pool"], workspace = true }
hex = { workspace = true, default-features = false }
jsonrpsee = { features = ["server"], workspace = true }
log.workspace = true
pallet-assets.default-features = true
pallet-assets.workspace = true
pallet-balances.default-features = true
pallet-balances.workspace = true
pallet-transaction-payment.default-features = true
Expand Down
60 changes: 7 additions & 53 deletions node/src/txwatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,6 @@ fn extract_all_transfers(
if let MultiAddress::Id(id) = dest {
results.push((id.clone(), *value, None));
},
RuntimeCall::Assets(pallet_assets::Call::transfer { id, target: dest, amount }) |
RuntimeCall::Assets(pallet_assets::Call::transfer_keep_alive {
id,
target: dest,
amount,
}) =>
if let MultiAddress::Id(d) = dest {
results.push((d.clone(), *amount, Some(id.0)));
},
RuntimeCall::Utility(pallet_utility::Call::batch { calls }) |
RuntimeCall::Utility(pallet_utility::Call::batch_all { calls }) |
RuntimeCall::Utility(pallet_utility::Call::force_batch { calls }) =>
Expand Down Expand Up @@ -286,22 +277,6 @@ mod tests {
})
}

fn asset_transfer(asset_id: u32, dest: &AccountId, amount: Balance) -> RuntimeCall {
RuntimeCall::Assets(pallet_assets::Call::transfer {
id: codec::Compact(asset_id),
target: addr(dest),
amount,
})
}

fn asset_transfer_keep_alive(asset_id: u32, dest: &AccountId, amount: Balance) -> RuntimeCall {
RuntimeCall::Assets(pallet_assets::Call::transfer_keep_alive {
id: codec::Compact(asset_id),
target: addr(dest),
amount,
})
}

fn batch(calls: Vec<RuntimeCall>) -> RuntimeCall {
RuntimeCall::Utility(pallet_utility::Call::batch { calls })
}
Expand Down Expand Up @@ -335,46 +310,25 @@ mod tests {
assert!(result.is_empty());
}

#[test]
fn detects_asset_transfer() {
let call = asset_transfer(42, &merchant(), 500);
let result = extract_transfers_to(&call, &merchant());
assert_eq!(result, vec![(500, Some(42))]);
}

#[test]
fn detects_asset_transfer_keep_alive() {
let call = asset_transfer_keep_alive(7, &merchant(), 1000);
let result = extract_transfers_to(&call, &merchant());
assert_eq!(result, vec![(1000, Some(7))]);
}

#[test]
fn ignores_asset_transfer_to_different_address() {
let call = asset_transfer(42, &other(), 500);
let result = extract_transfers_to(&call, &merchant());
assert!(result.is_empty());
}

#[test]
fn detects_transfers_inside_batch() {
let call = batch(vec![
native_transfer(&merchant(), 10 * UNIT),
native_transfer(&other(), 20 * UNIT),
asset_transfer(5, &merchant(), 300),
native_transfer(&merchant(), 300),
]);
let result = extract_transfers_to(&call, &merchant());
assert_eq!(result, vec![(10 * UNIT, None), (300, Some(5))]);
assert_eq!(result, vec![(10 * UNIT, None), (300, None)]);
}

#[test]
fn detects_transfers_inside_batch_all() {
let call = batch_all(vec![
native_transfer(&merchant(), 10 * UNIT),
asset_transfer(1, &merchant(), 200),
native_transfer(&merchant(), 200),
]);
let result = extract_transfers_to(&call, &merchant());
assert_eq!(result, vec![(10 * UNIT, None), (200, Some(1))]);
assert_eq!(result, vec![(10 * UNIT, None), (200, None)]);
}

#[test]
Expand Down Expand Up @@ -406,7 +360,7 @@ mod tests {
let call = batch(vec![
native_transfer(&other(), 100 * UNIT),
RuntimeCall::System(frame_system::Call::remark { remark: vec![] }),
asset_transfer(1, &customer(), 50),
native_transfer(&customer(), 50),
]);
let result = extract_transfers_to(&call, &merchant());
assert!(result.is_empty());
Expand Down Expand Up @@ -475,12 +429,12 @@ mod tests {
let call = batch(vec![
native_transfer(&merchant(), 10 * UNIT),
native_transfer(&other(), 20 * UNIT),
asset_transfer(5, &customer(), 300),
native_transfer(&customer(), 300),
]);
let all = extract_all_transfers(&call, 0);
assert_eq!(all.len(), 3);
assert_eq!(all[0], (merchant(), 10 * UNIT, None));
assert_eq!(all[1], (other(), 20 * UNIT, None));
assert_eq!(all[2], (customer(), 300, Some(5)));
assert_eq!(all[2], (customer(), 300, None));
}
}
56 changes: 0 additions & 56 deletions pallets/assets-holder/Cargo.toml

This file was deleted.

Loading
Loading