Skip to content

Start with 2^128 instead of 2^256 eth#808

Merged
samalws-tob merged 1 commit intomasterfrom
fix/128gas
Mar 4, 2026
Merged

Start with 2^128 instead of 2^256 eth#808
samalws-tob merged 1 commit intomasterfrom
fix/128gas

Conversation

@samalws-tob
Copy link
Contributor

@samalws-tob samalws-tob commented Mar 4, 2026

Very simple code change. Start sender addresses with 2^128 eth instead of 2^256. This should prevent overflow over 2^256 while still preventing out-of-gas. Fixes the following test case which previously caused medusa to error:

contract SimpleBalanceDrain {
    function deposit() public payable {}

    function withdraw() public {
        uint256 amount = address(this).balance;
        payable(msg.sender).call{value: amount}("");
    }
}

Previously we got the following error:

error Encountered an error in the main fuzzing loop
‣ test chain state write error when adding tx to pending block: insufficient funds for gas * price + value: address 0x0000000000000000000000000000000000010000 have 4026804785036390882 want 18446744073709551615

This is because we overflowed a uint256 when adding onto 2^256-1

@samalws-tob samalws-tob merged commit 8f6bbe0 into master Mar 4, 2026
15 checks passed
@samalws-tob samalws-tob deleted the fix/128gas branch March 4, 2026 19:32
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.

2 participants