Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add chainId for security purposes #202

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ New V5 `SupplyController` (increased cap to account for the governance-induced b
New V5 `SupplyController` (increase cap again to account for governance-induced burn):
* Mainnet: https://etherscan.io/address/0xD4628FA47AAe2d0f4c8a204f36c2d93AA8dc31F5

New V5 `SupplyController` (increase cap again to account for governance-induced burn and discount treasury tokens):
New V5 `SupplyController` (increase cap again to account for governance-induced burn by discounting treasury tokens):
* Mainnet: https://etherscan.io/address/0x9B370599B2bf61806DDca1379257F26377472BEe
* Was later updated by setting the incentive rate on 05 Feb 2024 following another halving governance vote

StakingPool:

Expand Down
6 changes: 3 additions & 3 deletions contracts/OUTPACE.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.7;
pragma solidity 0.8.19;

import "./libs/SafeERC20.sol";
import "./libs/MerkleProof.sol";
Expand Down Expand Up @@ -88,7 +88,7 @@ contract OUTPACE {
if (challengeExpirationTime != 0) lastStateRoot[channelId] = withdrawal.stateRoot;

// Check the signatures
bytes32 hashToSign = keccak256(abi.encode(address(this), channelId, withdrawal.stateRoot));
bytes32 hashToSign = keccak256(abi.encode(address(this), channelId, withdrawal.stateRoot, block.chainid));
require(SignatureValidator.isValid(hashToSign, withdrawal.channel.leader, withdrawal.sigLeader), 'LEADER_SIG');
require(SignatureValidator.isValid(hashToSign, withdrawal.channel.follower, withdrawal.sigFollower), 'FOLLOWER_SIG');
// adds like 8k gas for 10 withdrawals (2% increase)
Expand Down Expand Up @@ -128,7 +128,7 @@ contract OUTPACE {
uint challengeExpires = challenges[channelId];
require(challengeExpires != 0 && challengeExpires != CLOSED, 'CHANNEL_NOT_CHALLENGED');
// NOTE: we can resume the channel by mutual consent even if it's closable, so we won't check whether challengeExpires is in the future
bytes32 hashToSign = keccak256(abi.encodePacked('resume', channelId, challengeExpires));
bytes32 hashToSign = keccak256(abi.encodePacked('resume', channelId, challengeExpires, block.chainid));
require(SignatureValidator.isValid(hashToSign, channel.leader, sigLeader), 'INVALID_LEADER_SIG');
require(SignatureValidator.isValid(hashToSign, channel.follower, sigFollower), 'INVALID_FOLLOWER_SIG');

Expand Down
2 changes: 1 addition & 1 deletion contracts/libs/BytesLib.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.7;
pragma solidity 0.8.19;

// @TODO: Formatting
library LibBytes {
Expand Down
2 changes: 1 addition & 1 deletion contracts/libs/MerkleProof.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.7;
pragma solidity 0.8.19;

library MerkleProof {
function isContained(bytes32 valueHash, bytes32[] memory proof, bytes32 root) internal pure returns (bool) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/libs/SafeERC20.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.7;
pragma solidity 0.8.19;

// NOTE: this interface lacks return values for transfer/transferFrom/approve on purpose,
// as we use the SafeERC20 library to check the return value
Expand Down
2 changes: 1 addition & 1 deletion contracts/libs/SignatureValidator.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.7;
pragma solidity 0.8.19;

library SignatureValidator {
enum SignatureMode {
Expand Down
2 changes: 1 addition & 1 deletion contracts/libs/SignatureValidatorV2.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.7;
pragma solidity 0.8.19;

import "./BytesLib.sol";

Expand Down