Cyfrin / foundry-smart-contract-lottery-cu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test with Sepolia fails

MarcosPosseB opened this issue · comments

When I type forge test --fork-url $SEPOLIA_RPC_URL to test all the contract. It shows me this error message:

[FAIL. Reason: Setup failed: Custom Error d8a3fb52:(0xA725D004FA87A5202Df119fE5AaCEc95043Db7b9)] setUp()

I passed the deployerKey to vm.startBrodcast() than got this error. I checked the code lots of times and nothing seems to be wrong with it.
Can someone help me? Thanks!

Hello @MarcosPosseB

Could you find a fix for this issue? I'm also getting a lot of custom errors with no "proper" context. Here are the logs if it helps.

Compiling 4 files with 0.8.21
Solc 0.8.21 finished in 15.48s
Compiler run successful!

Running 1 test for test/unit/RaffleTest.t.sol:RaffleTest
[FAIL. Reason: Custom Error a7386976:(0x0000000000000000000000000000000000000002, false, 200)] testPerformKeepRaffleUpdatesAndEmitsRequestId() (gas: 104891)
Logs:
  Adding consumer 0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496
  Using vrfCoordinator 0x8103B0A8A00be2DDC778e6e7eaa21791Cd364625
  Using subId 1111

Traces:
  [33044865] RaffleTest::setUp() 
    ├─ [23508959] → new RaffleDeploy@0xFEfC6BAF87cF3684058D62Da40Ff3A795946Ab06
    │   └─ ← 117193 bytes of code
    ├─ [9295441] RaffleDeploy::run() 
    │   ├─ [2818015] → new HelperConfig@0x6d2eed85750d316088343D6d5e91ca59eb052768
    │   │   ├─ [0] VM::envUint(PRIVATE_KEY) [staticcall]
    │   │   │   └─ ← <env var value>
    │   │   └─ ← 13284 bytes of code
    │   ├─ [1099] HelperConfig::activeConfig() [staticcall]
    │   │   └─ ← 10000000000000000 [1e16], 30, 0x8103B0A8A00be2DDC778e6e7eaa21791Cd364625, 0x474e34a077df58807dbe9c96d3c009b23b3c6d0cce433e59bbf5b34f823bc56c, 1111, 500000 [5e5], 0x779877A7B0D9E8603169DdbD7836e478b4624789, 102588126239213932040297453371325654560903449232971148784421880088503136578448 [1.025e77]
    │   ├─ [0] VM::startBroadcast() 
    │   │   └─ ← ()
    │   ├─ [622261] → new Raffle@0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496
    │   │   └─ ← 2983 bytes of code
    │   ├─ [0] VM::stopBroadcast() 
    │   │   └─ ← ()
    │   ├─ [5663576] → new AddConsumer@0x8Bbbb5d294c78bd70dd88E6D63498dECa0C7BBCe
    │   │   └─ ← 28173 bytes of code
    │   ├─ [82108] AddConsumer::addConsumer(Raffle: [0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496], 0x8103B0A8A00be2DDC778e6e7eaa21791Cd364625, 1111, 102588126239213932040297453371325654560903449232971148784421880088503136578448 [1.025e77]) 
    │   │   ├─ [0] console::log(Adding consumer, Raffle: [0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496]) [staticcall]
    │   │   │   └─ ← ()
    │   │   ├─ [0] console::log(Using vrfCoordinator, 0x8103B0A8A00be2DDC778e6e7eaa21791Cd364625) [staticcall]
    │   │   │   └─ ← ()
    │   │   ├─ [0] console::9710a9d0(000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000016a6000000000000000000000000000000000000000000000000000000000000000b5573696e67207375624964000000000000000000000000000000000000000000) [staticcall]
    │   │   │   └─ ← ()
    │   │   ├─ [0] VM::startBroadcast(<pk>) 
    │   │   │   └─ ← ()
    │   │   ├─ [73410] 0x8103B0A8A00be2DDC778e6e7eaa21791Cd364625::addConsumer(1111, Raffle: [0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496]) 
    │   │   │   ├─ emit SubscriptionConsumerAdded(param0: 960653276687538929172835136434361334704054994070 [9.606e47], param1: 0x00000000000000000000000000000000000016a6)
    │   │   │   └─ ← ()
    │   │   ├─ [0] VM::stopBroadcast() 
    │   │   │   └─ ← ()
    │   │   └─ ← ()
    │   └─ ← 0x000000000000000000000000a8452ec99ce0c64f20701db7dd3abdb607c004960000000000000000000000006d2eed85750d316088343d6d5e91ca59eb052768
    ├─ [1099] HelperConfig::activeConfig() [staticcall]
    │   └─ ← 10000000000000000 [1e16], 30, 0x8103B0A8A00be2DDC778e6e7eaa21791Cd364625, 0x474e34a077df58807dbe9c96d3c009b23b3c6d0cce433e59bbf5b34f823bc56c, 1111, 500000 [5e5], 0x779877A7B0D9E8603169DdbD7836e478b4624789, 102588126239213932040297453371325654560903449232971148784421880088503136578448 [1.025e77]
    ├─ [0] VM::deal(player: [0x44E97aF4418b7a17AABD8090bEA0A471a366305C], 1000000000000000000 [1e18]) 
    │   └─ ← ()
    └─ ← ()

  [104891] RaffleTest::testPerformKeepRaffleUpdatesAndEmitsRequestId() 
    ├─ [0] VM::prank(player: [0x44E97aF4418b7a17AABD8090bEA0A471a366305C]) 
    │   └─ ← ()
    ├─ [47779] Raffle::enterRaffle{value: 10000000000000000}() 
    │   ├─ emit EnteredRaffle(player: player: [0x44E97aF4418b7a17AABD8090bEA0A471a366305C])
    │   └─ ← ()
    ├─ [0] VM::warp(1700744239 [1.7e9]) 
    │   └─ ← ()
    ├─ [0] VM::roll(4750409 [4.75e6]) 
    │   └─ ← ()
    ├─ [0] VM::recordLogs() 
    │   └─ ← ()
    ├─ [34119] Raffle::performUpkeep(0x) 
    │   ├─ [7682] 0x8103B0A8A00be2DDC778e6e7eaa21791Cd364625::requestRandomWords(0x474e34a077df58807dbe9c96d3c009b23b3c6d0cce433e59bbf5b34f823bc56c, 1111, 2, 500000 [5e5], 2) 
    │   │   └─ ← "Custom Error a7386976:(0x0000000000000000000000000000000000000002, false, 200)"
    │   └─ ← "Custom Error a7386976:(0x0000000000000000000000000000000000000002, false, 200)"
    └─ ← "Custom Error a7386976:(0x0000000000000000000000000000000000000002, false, 200)"

Test result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 12.43s
 
Ran 1 test suites: 0 tests passed, 1 failed, 0 skipped (1 total tests)

Failing tests:
Encountered 1 failing test in test/unit/RaffleTest.t.sol:RaffleTest
[FAIL. Reason: Custom Error a7386976:(0x0000000000000000000000000000000000000002, false, 200)] testPerformKeepRaffleUpdatesAndEmitsRequestId() (gas: 104891)

Encountered a total of 1 failing tests, 0 tests succeeded