Skip to content

Fix/gas usage monitoring - #152

Closed
Achievers-sketch wants to merge 16 commits into
Vero-protocol:mainfrom
Achievers-sketch:fix/gas-usage-monitoring
Closed

Fix/gas usage monitoring#152
Achievers-sketch wants to merge 16 commits into
Vero-protocol:mainfrom
Achievers-sketch:fix/gas-usage-monitoring

Conversation

@Achievers-sketch

Copy link
Copy Markdown
Contributor

Closes #47
Closes #52


Fix/gas usage monitoring

Achievers-sketch and others added 16 commits June 23, 2026 05:38
Predict the gas (Soroban resource) cost of a contract call from its
simulation, compare against configurable per-transaction limits, and log
over-budget calls to guard against gas-exhaustion DoS.

Closes Vero-protocol#6

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…e-monitor

Predict the gas (Soroban resource) cost of a contract call from its
simulation, compare against configurable per-transaction limits, and log
over-budget calls to guard against gas-exhaustion DoS.

Closes Vero-protocol#6

Co-authored-by: Olusegun Kehinde <olusegunkehindejones@gmail.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Move the Windows-only @next/swc-win32-x64-msvc binary from dependencies
to optionalDependencies so npm ci skips it on non-Windows platforms
instead of failing with EBADPLATFORM. Next.js resolves the correct
platform swc binary on its own.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…x-ci-install

fix: make npm ci succeed on Linux/CI
- jest.setup: polyfill TextEncoder/TextDecoder and Web Crypto subtle
  (jsdom lacks them) so session encryption paths run in tests
- logger: pass Uint8Array views (not raw ArrayBuffer) to subtle.decrypt
  so it works across the jsdom/node realm boundary
- txBuilder test: mark simulation mock as parsed with a result so
  assembleTransaction consumes it instead of re-parsing
- VoteButton test: declare missing mockUseNetwork
- wallet tests: assert persisted values via getSessionItem (decrypts)
  now that the wallet stores encrypted session data

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ing-tests

- jest.setup: polyfill TextEncoder/TextDecoder and Web Crypto subtle
  (jsdom lacks them) so session encryption paths run in tests
- logger: pass Uint8Array views (not raw ArrayBuffer) to subtle.decrypt
  so it works across the jsdom/node realm boundary
- txBuilder test: mark simulation mock as parsed with a result so
  assembleTransaction consumes it instead of re-parsing
- VoteButton test: declare missing mockUseNetwork
- wallet tests: assert persisted values via getSessionItem (decrypts)
  now that the wallet stores encrypted session data

Co-authored-by: Olusegun Kehinde <olusegunkehindejones@gmail.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Add a maxHistory option (default DEFAULT_MAX_HISTORY=1000) so the
records array no longer grows without limit in a long-running relayer.
Oldest records are dropped once the cap is exceeded; maxHistory <= 0
keeps history unbounded. Addresses Devin Review feedback on #1.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…or-maxhistory

fix: cap GasUsageMonitor retained history to bound memory
Signed-off-by: Olusegun Kehinde <olusegunkehindejones@gmail.com>
Signed-off-by: Olusegun Kehinde <olusegunkehindejones@gmail.com>
Signed-off-by: Olusegun Kehinde <olusegunkehindejones@gmail.com>
Signed-off-by: Olusegun Kehinde <olusegunkehindejones@gmail.com>
@N-thnI

N-thnI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for this — the gas-usage monitor itself (src/audit-guard/gasMonitor.ts + tests + index.ts) is solid, well-tested, and fully self-contained.

This branch has drifted quite far from main since it was opened (missing the CSP/security headers work, .env.example, the CodeQL workflow, and more), which produces merge conflicts in socketClient.ts, logger.ts, and a couple of test files that are unrelated to gas monitoring. The CI failures on this PR (TaskCard, useSearchIndex, txBuilder, wallet-multiprovider) are also artifacts of that drift rather than issues with the gas-monitor code itself.

I've cherry-picked the gas-monitor module as-is onto a fresh branch off current main in #197 and merged it, with credit to you as co-author, so the feature lands cleanly without dragging in the unrelated conflicts. Closing this one in favor of that.

@N-thnI N-thnI closed this Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add automated contributor leaderboard feat: implement real-time activity log export

2 participants