Skip to content

Commit

Permalink
fix bad deadline in test crowdfund
Browse files Browse the repository at this point in the history
the previous code depended on eth-tester mining a block within 1 second.
this fixes it to be invariant wrt eth-tester speed.
  • Loading branch information
charles-cooper committed Dec 7, 2023
1 parent 81202bb commit c617908
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/functional/codegen/integration/test_crowdfund.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ def refund():
"""
a0, a1, a2, a3, a4, a5, a6 = w3.eth.accounts[:7]

c = get_contract_with_gas_estimation_for_constants(crowdfund, *[a1, 50, 60])
start_timestamp = w3.eth.get_block(w3.eth.block_number).timestamp

c.participate(transact={"value": 5})
assert c.timelimit() == 60
assert c.deadline() - c.block_timestamp() == 59
assert c.deadline() - start_timestamp == 60
assert not c.expired()
assert not c.reached()
c.participate(transact={"value": 49})
Expand Down

0 comments on commit c617908

Please sign in to comment.