Commit b8ae2bc
committed
feat: add TypeScript SDK, PQ-EVM opcodes, contract examples, fix all compiler warnings
TypeScript SDK (@qnet/sdk):
- Add QNetClient with full HTTP API coverage (blocks, txs, balances, contracts, faucet)
- Add ContractHandle for PQ-EVM contract interaction (deploy, call, send)
- Add address utilities: EON format, publicKeyHashToAddress, formatQNC/parseQNC
- Add QNetSubscription for real-time block/tx polling-based subscriptions
- Add polling helpers: pollBlocks, waitForHeight, waitForTransaction
- Add structured error hierarchy: QNetApiError, QNetTransactionError, QNetAddressError
- Add Jest test suite for client methods
- Add build pipeline: rollup (CJS + ESM + .d.ts), tsconfig, package.json
PQ-EVM (pq_evm.rs):
- Switch Dilithium from ML-DSA-87 (level 5) to ML-DSA-65 (level 3) to align with quantum_crypto.rs
- Implement full EVM opcode subset: arithmetic (SUB/DIV/MOD/ADDMOD/MULMOD/EXP),
comparison/bitwise (LT/GT/EQ/ISZERO/AND/OR/XOR/NOT/BYTE/SHL/SHR),
hashing (KECCAK256), stack ops (POP/DUP1-3/SWAP1-2), memory (MLOAD/MSTORE/MSTORE8),
storage (SLOAD/SSTORE), control flow (JUMP/JUMPI/JUMPDEST), environment opcodes,
PUSH1-8, LOG0-1
- Replace stub PQ_SIGN with real dilithium3 sign() writing signature to memory
- Replace stub PQ_VERIFY with real dilithium3 open() returning 1/0
- Replace stub PQ_ENCRYPT with real kyber1024 encapsulate() writing ciphertext to memory
- Remove PQ_DECRYPT stub (KEM decap belongs at account layer, not contract layer)
- Fix deploy_standard_contract: replace missing include_bytes with minimal init-code
Contract examples (qnet-contracts/examples/):
- Add qnet_token.rs: QNC-compatible fungible token (ERC-20 analogue for PQ-EVM)
- Add node_stake_registry.rs: stake registry with Dilithium-authenticated node entries
- Add pq_multisig.rs: m-of-n multisig wallet using post-quantum signatures
- Add qnc_yield_pool.rs: yield pool with epoch-based reward distribution
- Add README.md documenting contract examples and PQ-EVM usage
Compiler warnings (qnet-integration): 318 to 0
- Remove blanket allow(unused_imports/variables/dead_code/unused_mut) from lib.rs
- Remove all unused imports across 17 files (sha3, aes_gcm, chacha20poly1305, flate2,
HashMap, DashMap, Mutex, rayon, bincode, chrono, once_cell, various qnet_state types)
- Remove unused constants: HEALTH_CHECK_INTERVAL_SECS, MAX_CACHE_SIZE, MAX_PARALLEL_TX
- Fix ~60 unused variables: prefix _ on params and locals across node.rs, unified_p2p.rs,
rpc.rs, activation_validation.rs, storage.rs, reward_sharding.rs, quantum_crypto.rs
- Remove unnecessary mut qualifiers in parallel_executor.rs, rpc.rs, storage.rs
- Add targeted allow(dead_code) on ~50 specific items (protocol methods kept for
future use, struct fields in serialized types, serde helper modules)
- Mark tests module with cfg(test) so it only compiles during cargo test
- Fix base64::engine::general_purpose import in unified_p2p.rs functions
Made-with: Cursor1 parent 6cad853 commit b8ae2bc
40 files changed
Lines changed: 3964 additions & 563 deletions
File tree
- development
- qnet-contracts/examples
- qnet-integration/src
- crypto
- qnet-sdk
- src
- qnet-vm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
0 commit comments