Skip to content

Conversation

@RonTuretzky
Copy link

Summary

Changes

  • Created MiddlewareShimGasTest.t.sol with multiple test scenarios:
    • Varying operator counts (10-500)
    • Varying history lengths (5-100)
    • Gas growth rate analysis
    • Worst-case scenario testing
  • Added GAS_FINDINGS.md documentation with detailed analysis

Key Findings

Gas Usage Exceeds Block Limits:

  • 500 operators: 38.46M gas (128% of 30M block limit) ❌
  • 100 history entries (with 100 operators): 52.58M gas (175% of block limit) ❌
  • 250 operators + 50 history: 82.99M gas (276% of block limit) ❌

Growth Rates:

  • Operator count has super-linear growth: 2x operators = 2.09x gas
  • History length has super-linear growth: 2x history = 1.58x gas

Safe Operating Thresholds:

  • Maximum ~400 operators with minimal history
  • Maximum ~80 history entries with 100 operators

Recommendations

  1. Immediate: Implement gas limit checks and circuit breakers
  2. Long-term: Consider multi-step updates, history trimming, or pagination

Test Results

All gas tests pass and provide clear metrics:

✓ testGasUsageWithVaryingOperatorCounts
✓ testGasUsageWithVaryingHistoryLengths  
✓ testGasGrowthRate
✓ testWorstCaseScenario

Related Issues

Fixes #1

🤖 Generated with Claude Code

- Created comprehensive gas tests to measure usage with varying operator counts and history lengths
- Tests confirm the function exceeds block gas limits with 500+ operators or 100+ history entries
- Added detailed findings document with risk assessment and recommendations
- Gas usage shows super-linear growth with both operator count and history length

Key findings:
- 500 operators: 128% of block limit (EXCEEDS)
- 100 history entries with 100 operators: 175% of block limit (EXCEEDS)
- Critical threshold: ~400 operators or ~80 history entries
- Recommended solutions: multi-step updates, history trimming, or pagination

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

Check that updateMiddlewareDataHash function won't pass gas block limit

1 participant