Skip to content

New test_many_accounts_balance_change#10

Open
pdobacz wants to merge 1 commit intoupstreamfrom
new-resbal-test
Open

New test_many_accounts_balance_change#10
pdobacz wants to merge 1 commit intoupstreamfrom
new-resbal-test

Conversation

@pdobacz
Copy link
Collaborator

@pdobacz pdobacz commented Feb 13, 2026

New test for the reserve balance logic, where the number of accounts spending in a single transaction is maxed out (~2.5K, I think this is pretty at maximum).

The test is passing.

Opening against upstream, as #9 must merge first

Co-Authored-By: Claude claude-opus-4-5-20251101
@greptile-apps
Copy link

greptile-apps bot commented Feb 13, 2026

Greptile Overview

Greptile Summary

This PR adds a new stress test test_many_accounts_balance_change that verifies reserve balance enforcement at scale with approximately 2,560+ accounts in a single transaction.

Key Changes:

  • Adds parametrized test with 4 scenarios: no violation, first account violates, middle account violates, last account violates
  • Calculates the maximum number of accounts that can be processed within the 30M gas limit cap
  • Uses access lists to minimize gas costs per account (warmed CALL operations)
  • Tests the edge case where any single account violation should revert the entire transaction
  • Includes assertion to verify at least 2,560 accounts are tested

Technical Implementation:

  • Dynamically calculates num_accounts based on gas costs and the fork's transaction gas limit cap
  • Creates a shared wallet contract that each EOA delegates to
  • Each account is funded with either exactly RESERVE_BALANCE (violation case) or RESERVE_BALANCE + 1 (valid case)
  • Validates that a single violating account causes full transaction revert

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The test is well-designed with proper gas calculations, clear parametrization, and follows existing patterns in the test suite. The author confirms the test is passing, and the implementation correctly tests the reserve balance logic at scale.
  • No files require special attention

Important Files Changed

Filename Overview
tests/monad_eight/reserve_balance/test_transfers.py Added comprehensive stress test for reserve balance with ~2.5K accounts testing violation detection at various positions

Last reviewed commit: dd1ec21

@pdobacz pdobacz requested review from QEDK and mijovic February 13, 2026 17:14
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.

1 participant