Skip to content

Feat/be 074 wasm gas metering - #1995

Open
Ukorstack wants to merge 2 commits into
StellarDevHub:mainfrom
Ukorstack:feat/BE-074-wasm-gas-metering
Open

Ukorstack wants to merge 2 commits into
StellarDevHub:mainfrom
Ukorstack:feat/BE-074-wasm-gas-metering

Conversation

@Ukorstack

Copy link
Copy Markdown

closes #1821

ayomideadeniran and others added 2 commits November 25, 2026 12:46
Add three files to enforce supply-chain security on every PR and push
to main:

- .github/workflows/malware-pr-guard.yml
  * Lockfile integrity check (pnpm install --frozen-lockfile)
  * pnpm audit --audit-level=high blocks High/Critical CVEs
  * Snyk SCA scan with SARIF upload to GitHub Security tab

- .github/workflows/secret-scan.yml
  * Gitleaks v2 secret detection on full history (push) and PR diff
  * SARIF report uploaded to GitHub Security tab on every run

- .gitleaks.toml
  * Extends Gitleaks built-in ruleset
  * Adds Stellar secret key, BIP-39 mnemonic, Ethereum private key,
    generic API token, and Snyk token detectors
  * Allowlist suppresses .wasm artifacts, Cargo.lock hashes,
    test fixtures, and GHA secrets expressions

Closes StellarDevHub#1836
…nforcer

- Add wasmAstInspector.ts: single-pass opcode scanner that walks the Code
  section at the binary level, accumulating a weighted instruction budget
  before wasm-metering runs. Rejects modules exceeding MAX_WEIGHTED_INSTRUCTIONS
  (2,000,000) with 'ast-too-complex', preventing the metering pass from
  becoming a pre-instantiation DoS vector.

- GAS_COST_TABLE: trivial=1, memory=3, branch=5, call=10, memoryGrow=100.

- wasmValidator.ts: add 'ast-too-complex' WasmValidationCode, call
  countWasmInstructions() after WebAssembly.validate() and before any worker
  is spawned.

- wasmExecutionSandbox.ts: pass calibrated costTable to meterWASM so loop
  and call blocks cost 10 gas units each. Re-export GAS_COST_TABLE and
  MAX_WEIGHTED_INSTRUCTIONS. Add 'ast-too-complex' to SandboxTerminationReason.

- wasmAstInspector.test.ts: unit + integration tests covering ceiling
  rejection, calibration invariants, and loop gas amplification.

Closes StellarDevHub#1821
@vercel

vercel Bot commented Nov 25, 2026

Copy link
Copy Markdown

@nishantpurohit04 is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

[BE-074] Sandboxed WASM Gas Metering Calibration & AST Instruction Ceiling Enforcer

2 participants