Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Etch error when using address (N < 10) #979

Closed
EnbangWu opened this issue Aug 11, 2023 · 1 comment
Closed

Etch error when using address (N < 10) #979

EnbangWu opened this issue Aug 11, 2023 · 1 comment

Comments

@EnbangWu
Copy link

When running the test from creating an NFT with Solmate, I ran into this problem

function test_RevertUnSafeContractReceiver() public {
        vm.etch(address(1), bytes("mock code"));
        vm.expectRevert(bytes(""));
        nft.mintTo{value: 0.08 ether}(address(1));
    }
FAIL. Reason: Etch cannot be used on precompile addresses (N < 10). Please use an address bigger than 10 instead] test_RevertUnSafeContractReceiver() (gas: 3548)

Change this into below codes will solve the problem.Please make the change to the documentation.

    function test_RevertUnSafeContractReceiver() public {
        vm.etch(address(11), bytes("mock code"));
        vm.expectRevert(bytes(""));
        nft.mintTo{value: 0.08 ether}(address(11));
    }
[PASS] test_SafeContractReceiver() (gas: 272635)
@onbjerg
Copy link
Member

onbjerg commented Jan 24, 2024

Solved on main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants