-
Patrick demonstrates that his code works:
For me I get the error that my assert is not true:
The difference is 86.574.296.450.644 Wei which seems to me like there are Gas costs for entering the raffle and getting it payed out, which makes sense bc hardhat locoal node does have Gas costs enabled by default. But it works for Patrick and nobody else seems to have this problem... Drives me crazy 😄 Also for me it is always the Deployer winning the lottery. That seems odd to me, does that make sense? Why would the Mock be set up to always let the first address win? Sounds like shitty test enviroment to me honestly... |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 18 replies
-
Update (Still not solved tho): I proofed my theory ( beeing really proud of myself :D):
But why do I seem to be the only one with this? I didnt change any settings where I would have manually enabled gascosts. |
Beta Was this translation helpful? Give feedback.
-
uhh, Actually in my case earlier i was getting an assertion error as :
But I noticed that I wasn't wating for the transaction to complete hence i added the line
as in the following code snippet
But now I'm getting this new error
|
Beta Was this translation helpful? Give feedback.
-
Also regarding the issue with only one address being the winner, In my case, I've completed the frontend part of the project and when i connect my metamask to the localhost testnet, and enter the raffle with the address(local hardhat address). I end up getting the winner as my own address, everytime. I don't know how to counter that issue. I'm not sure about how the players are to be logged in to the Raffle, Do we need to connect with a new address and then enter the raffle again ? I tried doing this, but my whole raffle gets refreshed and the number of players is set back to 0 and then i am able to enter the raffle with only same connected address each time. Can you please help me out? |
Beta Was this translation helpful? Give feedback.
-
@WolfgangNI I did not read some comments so maybe you found the answer but still, I am going to confirm your reason for why the winner is always the same. This is because you are testing on Mocks and mocks always return the same result. And for the number difference issue, I need to see your full code or if you are confirming that you did exactly the same then it might be possible that hardhat new versions change the behaviour of deducting the gas cost. |
Beta Was this translation helpful? Give feedback.
-
Hi @alymurtazamemon and @bagariaraj23, |
Beta Was this translation helpful? Give feedback.
Hi @alymurtazamemon and @bagariaraj23,
pacelliv said that it might just be the testing enviroment that causes my issues, so i'll just move on with the course and hope i won't have this issue in Real Live