Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const config: HardhatUserConfig = {
viaIR: process.env.VIA_IR !== "false", // Defaults to true
optimizer: {
enabled: true,
runs: 1000,
runs: 800, // Constrained by the size of the KlerosCore contract
},
outputSelection: {
"*": {
Expand Down
5 changes: 3 additions & 2 deletions contracts/src/arbitration/KlerosCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,10 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
/// @param _account The account whose stake is being set.
/// @param _courtID The ID of the court.
/// @param _newStake The new stake.
function setStakeBySortitionModule(address _account, uint96 _courtID, uint256 _newStake) external {
/// @return True if the stake was set successfully.
function setStakeBySortitionModule(address _account, uint96 _courtID, uint256 _newStake) external returns (bool) {
if (msg.sender != address(sortitionModule)) revert SortitionModuleOnly();
_setStake(_account, _courtID, _newStake, true, OnError.Return);
return _setStake(_account, _courtID, _newStake, true, OnError.Return);
}

/// @notice Transfers PNK to the juror by SortitionModule.
Expand Down
10 changes: 9 additions & 1 deletion contracts/src/arbitration/SortitionModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ contract SortitionModule is ISortitionModule, Initializable, UUPSProxiable {
/// @param _amount The amount of tokens staked in the court.
event StakeDelayed(address indexed _address, uint96 indexed _courtID, uint256 _amount);

/// @notice Emitted when a juror's stake is delayed execution fails.
/// @param _address The address of the juror.
/// @param _courtID The ID of the court.
/// @param _amount The amount of tokens staked in the court.
event StakeDelayedExecutionFailed(address indexed _address, uint96 indexed _courtID, uint256 _amount);

/// @notice Emitted when a juror's stake is locked.
/// @param _address The address of the juror.
/// @param _relativeAmount The amount of tokens locked.
Expand Down Expand Up @@ -235,7 +241,9 @@ contract SortitionModule is ISortitionModule, Initializable, UUPSProxiable {

for (uint256 i = delayedStakeReadIndex; i < newDelayedStakeReadIndex; i++) {
DelayedStake storage delayedStake = delayedStakes[i];
core.setStakeBySortitionModule(delayedStake.account, delayedStake.courtID, delayedStake.stake);
if (!core.setStakeBySortitionModule(delayedStake.account, delayedStake.courtID, delayedStake.stake)) {
emit StakeDelayedExecutionFailed(delayedStake.account, delayedStake.courtID, delayedStake.stake);
}
delete delayedStakes[i];
}
delayedStakeReadIndex = newDelayedStakeReadIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,10 @@ contract KlerosCoreUniversity is IArbitratorV2, UUPSProxiable, Initializable {
/// @param _account The account whose stake is being set.
/// @param _courtID The ID of the court.
/// @param _newStake The new stake.
function setStakeBySortitionModule(address _account, uint96 _courtID, uint256 _newStake) external {
/// @return True if the stake was set successfully.
function setStakeBySortitionModule(address _account, uint96 _courtID, uint256 _newStake) external returns (bool) {
if (msg.sender != address(sortitionModule)) revert SortitionModuleOnly();
_setStake(_account, _courtID, _newStake, true, OnError.Return);
return _setStake(_account, _courtID, _newStake, true, OnError.Return);
}

/// @notice Transfers PNK to the juror by SortitionModule.
Expand Down
Loading