Commit ab10532
committed
perf(contracts): gas optimizations for analytics contract (Ndifreke000#620)
- Extract require_admin() helper to eliminate repeated storage reads
- Extract validate_epoch() helper to deduplicate epoch validation logic
- Add write_snapshot() helper: single per-epoch key write + shared map update
- Fix double-write bug in submit_snapshot (was writing to map twice)
- get_snapshot now reads cheap per-epoch DataKey::Snapshot(epoch) key
instead of loading the entire Snapshots map
- get_latest_snapshot uses per-epoch key directly (avoids full map load)
- is_snapshot_expired reads per-epoch key instead of full map
- Add batch_submit: single auth + admin check for N snapshots in one call
- Fix benches criterion default-features to resolve wasm-bindgen conflict1 parent 0bc81a7 commit ab10532
3 files changed
+278
-347
lines changed
0 commit comments