yearn / veYFI

Voting YFI
75 stars 38 forks source link

fix: limit lock duration to prevent replay issues #205

Closed pandadefi closed 2 years ago

pandadefi commented 2 years ago

Description

test failing on master:

def test_lock_exceed_replay_slope_changes_range(chain, accounts, yfi, ve_yfi):
    alice = accounts[0]
    amount = 1000 * 10**18
    power = amount // MAXTIME * MAXTIME
    yfi.mint(alice, amount * 20, sender=alice)
    yfi.approve(ve_yfi.address, amount * 20, sender=alice)
    now = chain.blocks.head.timestamp
    unlock_time = now + MAXTIME + 501 * WEEK
    ve_yfi.modify_lock(amount, unlock_time, sender=alice)
    chain.pending_timestamp += MAXTIME + 502 * WEEK
    chain.mine()
    assert ve_yfi.balanceOf(alice) == 0

Make sure lock unlock is within range of the replay_slope_changes function.

Checklist