Skip to content

Repository files navigation

megaeth-audit

megaeth-audit

Solidity contract and project scanner for MegaETH. Catches dual gas model issues, volatile opcode throttling, EVM incompatibilities, and deprecated dependencies before deployment.

Install

npx megaeth-audit

Or install globally:

npm install -g megaeth-audit
megaeth-audit

Usage

# Scan current directory
megaeth-audit
# Scan a specific project
megaeth-audit ./my-contracts
# JSON output (for CI/CD)
megaeth-audit --json
# Only show high+ severity
megaeth-audit --severity high

Rules

Solidity Rules

IDSeverityDescription
MGA001CriticalHardcoded 21000 gas is insufficient (dual gas model, minimum 60,000)
MGA002HighVolatile opcode caps remaining compute gas to 20M
MGA003High98/100 gas forwarding, not Ethereum's 63/64
MGA004Highselfdestruct only works in creation transaction (EIP-6780)
MGA005HighHardcoded block counts assume 12s (MegaETH is ~1s)
MGA006Highprevrandao not reliable (centralized sequencer)
MGA007Highblock.coinbase is sequencer address
MGA008HighBlob opcodes not supported (EigenDA, not EIP-4844)
MGA009Moderategasleft() only reflects compute gas, not storage gas
MGA010Moderateblock.difficulty maps to prevrandao
MGA011InfoVerify EVM version compatibility (Prague-based, 512 KB contracts)

Dependency Rules

IDSeverityDescription
DEP001Highethers v5 is end-of-life
DEP002Highweb3.js < 4.0 is deprecated
DEP003HighTruffle is sunset
DEP004HighGanache is sunset
DEP005Moderate@openzeppelin/contracts < 5.0 is outdated
DEP006Moderate@arbitrum/sdk irrelevant for MegaETH
DEP007ModerateFoundry simulation won't account for storage gas
DEP008InfoConsider MegaETH RPC for gas estimation

Exit Codes

  • 0 - No issues (or info only)
  • 1 - High or moderate issues found
  • 2 - Critical issues found

Programmatic API

import{scan,formatHuman,formatJson}from"megaeth-audit";constresult=scan("./my-contracts");console.log(formatHuman(result));

Part of the MegaETH Developer Toolkit

ToolWhat it does
megaeth-audit (this tool)Catch dual gas model issues, volatile opcode throttling, and EVM incompatibilities in your Solidity contracts
megaeth-gasEstimate gas costs on MegaETH vs Ethereum

License

MIT

About

Solidity contract and project scanner for MegaETH. Catches dual gas model issues, volatile opcode throttling, EVM incompatibilities, and deprecated dependencies before deployment.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages