fix: P0-P2 hardening — consensus safety, OOM prevention, error unification

P0 consensus-critical:
- FHE: deterministic keygen from SHA-256("LUX_FHE_KEYGEN_v1"), StateDB
  ciphertext storage (replaces ephemeral in-memory ctStore), remove
  crypto/rand fallback
- time.Now() eliminated from 20 state-modifying paths across bridge (12),
  dex (7), attestation (5) — all now use blockTimestamp parameter
- WebSocket: 1024-client semaphore, 64KB read limit, 60s deadline, pong
  handler, origin check on chain/dag/evm indexer subscribers

P1 correctness:
- I-Chain indexer: identity.Health → identity.getLatestBlock
- Graph pagination: min(limit, 1000) cap across 25 resolver files
- Error sentinels: 31 packages unified to contract.ErrInvalidInput

P2 standardization:
- 14 packages migrated from manual gas checks to contract.DeductGas()
- Gas naming: {Name}Gas → Gas{Name} in secp256r1, ed25519, math, quasar
- Registry address format comment clarified (PCII vs legacy ranges)

37/37 precompile tests pass.
This commit is contained in:
2026-03-02 10:11:20 +00:00
parent 3d48a72d2e
commit e79a887d0e
45 changed files with 481 additions and 337 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ var (
_ contract.StatefulPrecompiledContract = Precompile
ErrInvalidInput = errors.New("invalid compute input")
ErrInvalidInput = contract.ErrInvalidInput
ErrUnknownOp = errors.New("unknown compute operation")
ErrNotProvider = errors.New("caller is not registered provider")
ErrJobNotFound = errors.New("job not found")