Skip to content

Commit 9663c32

Browse files
authored
fix: be more conservative with checks leave (#1339)
1 parent a01f507 commit 9663c32

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

contracts/contracts/subnet/SubnetActorManagerFacet.sol

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,17 @@ contract SubnetActorManagerFacet is SubnetActorModifiers, ReentrancyGuard, Pausa
296296
LibSubnetActor.rmAddressFromBalanceKey(msg.sender);
297297
s.supplySource.transferFunds(payable(msg.sender), genesisBalance);
298298
}
299+
}
300+
// stake might be racing with `bootstrapSubnetIfNeeded` so we need to check again
299301

300-
// interaction must be performed after checks and changes
302+
// interaction must be performed after checks and changes
303+
// we do check bootstrapping again, deliberately to avoid a complex exploit scenario
304+
if (!s.bootstrapped) {
301305
LibPower.withdrawWithConfirm(msg.sender, amount);
302306
s.collateralSource.transferFunds(payable(msg.sender), amount);
303-
return;
307+
} else {
308+
LibPower.withdraw(msg.sender, amount);
304309
}
305-
LibPower.withdraw(msg.sender, amount);
306310
}
307311

308312
/// @notice method that allows to kill the subnet when all validators left.

0 commit comments

Comments
 (0)