- Increase noise distribution - Centered binomial (k=16, sigma~2.83) in LWEUtils
- Run lattice estimator - tools/estimate_lwe.py confirms >128-bit security
- Centralize parameters - Created
LWEParameters.solwith Q, N, PACKED_SIZE, MASK - Fix parameter mismatch - BlindOptionVault now uses n=768 from LWEParameters
- Add input validation - Validate
b < q,strategyId < strategyCount(in V2) - Add access control - Restrict
addStrategyto owner (in V2)
- Bitmask modulo - Replace
mod 4096with& 0xFFF(q is power of two) - Internal dispatch - Replace
this.writeConservativeCall()with internal functions - Fixed-size storage - Use
uint256[37]instead of dynamic arrays - Smaller types - Use
uint16forbsince q=4096 fits - Benchmark on Tenderly - Deploy V1 vs V2 and compare actual on-chain gas
- Extract LWE library - Deduplicate packed/unpacked eval logic
- Fix RustyLock payout - Replace
transferwithcall{value:} - Fix Debug event - Currently emits
inner=0always in BlindOptionVault - Remove/gate Debug events - Production builds shouldn't emit debug info
4. Advanced Feature: "Hidden State Machine"
Goal: Enable encrypted state transitions (Private Finite State Automata).
- Define Architecture: Design how "Encrypted State" is stored (e.g., recursive LWE ciphertexts)
- Implement
SecretQuest.sol: Contract where users submit witness sequences to progress through hidden states - Homomorphic Addition: Implement
add(ciphertext, ciphertext)in Solidity for state accumulation
None
- Security: Parameter Hardening (Upgraded to n=768, q=4096)
- Gas Optimization: "Packed" LWE (Reduced gas from ~1.3M to ~110k)
- Core Primitive:
BlindOptionVault(Hidden Strategy Dispatch) - Gamification:
RustyLock(Lattice Mining Game) - Refactoring: Removed Python dependencies; 100% Solidity/Yul codebase
- Bug Fix: Fixed
calldatapointer arithmetic inexecuteStrategy