Skip to content

Commit 2ee35a6

Browse files
Merge remote-tracking branch 'origin/main' into document-contracts-gitbook
2 parents 3b61056 + 3ed292e commit 2ee35a6

File tree

13 files changed

+12933
-285
lines changed

13 files changed

+12933
-285
lines changed

.github/workflows/npm.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ jobs:
2020

2121
- uses: actions/setup-node@v3
2222
with:
23-
node-version: "18.x"
23+
# Using fixed version, because 18.16 may cause issues with the
24+
# artifacts generation during `hardhat compile` - see
25+
# https://github.com/NomicFoundation/hardhat/issues/3877.
26+
node-version: "18.15.0"
2427
registry-url: "https://registry.npmjs.org"
2528
cache: "yarn"
2629

SECURITY.md

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,32 @@
11
# Security Policy
22

3-
## Reporting a Vulnerability
4-
5-
If you identify vulnerabilities with any Threshold Network code, please email `security@threshold.network` with relevant information to your findings. We will work with researchers to coordinate vulnerability disclosure between our stakers, partners, and users to ensure the successful mitigation of vulnerabilities.
6-
7-
Throughout the reporting process, we expect researchers to honor an embargo period that may vary depending on the severity of the disclosure. This ensures that we have the opportunity to fix any issues, identify further issues (if any), and inform our users.
8-
9-
Sometimes vulnerabilities are more sensitive in nature and require extra precautions. We are happy to work together to use a more secure medium, such as Signal. Email security@threshold.network and we will coordinate a communication channel that we're both comfortable with.
10-
11-
A great place to begin your research is by working on our testnet. Please see our [documentation](https://docs.threshold.network) to get started. We ask that you please respect network machines and their owners. If you find a vulnerability that you suspect has given you access to a machine against the owner's permission, stop what you're doing and immediately email `security@threshold.network`.
3+
## Bug Bounty Program
124

13-
The Threshold team will make a best effort to respond to a new report **within 48 hours**. This response may be a simple acknowledgement that the report was received, or may be an initial assessment from the team. Unless the report is assessed as irrelevant or incorrect, this response will include expected next steps and communication time frames from the Threshold team.
5+
Threshold Network has a [Bug Bounty program with Immunefi](https://immunefi.com/bounty/thresholdnetwork/).
146

15-
The Threshold team will try to make an initial assessment of a bug's relevance, severity, and exploitability, and communicate this back to the reporter.
7+
The details for the Bug Bounty are maintained and updated at the [Immunefi Threshold page](https://immunefi.com/bounty/thresholdnetwork/). There you can explore the assets in scope for the bounty and the different rewards by threat level. As a guide, the initial bounty program launched with the following rewards according to the severity of the threats found:
168

17-
The Threshold DAO does have a bug bounty available, which is dispensed on a case-by-case basis.
9+
Smart Contracts
1810

19-
## Bug Bounty Program
11+
- Critical Level: USD $100,000 to USD $500,000
12+
- High Level: USD $10,000 to USD $50,000
13+
- Medium Level: USD $1,000 to USD $5,000
14+
- Low Level: USD $1,000
2015

21-
The following Bug Bounty amounts were approved by the DAO in [TIP-041](https://forum.threshold.network/t/tip-041-establish-a-bug-bounty-program/453) proposal:
16+
Websites and Applications
2217

23-
- Critical: Up to $500,000 in T tokens.
24-
- High: Up to $50,000 in T tokens.
25-
- Medium: Up to $5,000 in T tokens.
26-
- Low: Up to $500 in T tokens.
18+
- Critical Level: USD $10,000 to USD $25,000
19+
- High Level: USD $1,000 to USD $10,000
20+
- Medium Level: USD $1,000
2721

28-
The following attacks are excluded from the Bug Bounty program:
22+
A great place to begin your research is by working on our testnet. Please see our [documentation](https://docs.threshold.network) to get started. We ask that you please respect network machines and their owners. If you find a vulnerability that you suspect has given you access to a machine against the owner's permission, stop what you're doing and create a report using the Immunefi dashboard for researchers.
2923

30-
- Attacks that the reporter has already exploited themselves, leading to damage.
31-
- Attacks requiring access to leaked keys/credentials.
32-
- Basic economic governance attacks (e.g. 51% attack).
33-
- Lack of liquidity.
34-
- Sybil attacks.
24+
Rewards are distributed according to the impact of the vulnerability based on the [Immunefi Vulnerability Severity Classification System V2.3](https://immunefi.com/immunefi-vulnerability-severity-classification-system-v2-3/). This is a simplified 4-level scale, with separate scales for websites/apps, smart contracts, and blockchains/DLTs, focusing on the impact of the vulnerability reported.
3525

36-
The following activities are prohibited by this bug bounty program:
26+
## Reporting a Vulnerability Not Covered by the Bug Bounty Program
3727

38-
- Any testing with mainnet or public testnet contracts; all testing should be done on private testnets.
39-
- Attempting phishing or other social engineering attacks against our contributors and/or users.
40-
- Any denial of service attacks.
41-
- Automated testing of services that generates significant amounts of traffic.
42-
- Public disclosure of an unpatched vulnerability in an embargoed bounty.
28+
Please verify the list of assets in-scope and out-of-scope available as part of the [Threshold Bug Bounty details](https://immunefi.com/bounty/thresholdnetwork/). Additionally, security researchers are encouraged to submit issues outside of the outlined "Impacts" and "Assets in Scope". If you can demonstrate a critical impact on code in production for an asset not in scope, Threshold DAO encourages you to submit your bug report using the “primacy of impact exception” asset in Immunefi.
4329

44-
Rewards are distributed according to the impact of the vulnerability based on the [Immunefi Vulnerability Severity Classification System V2.2](https://immunefi.com/immunefi-vulnerability-severity-classification-system-v2-2/). This is a simplified 5-level scale, with separate scales for websites/apps, smart contracts, and blockchains/DLTs, focusing on the impact of the vulnerability reported.
30+
Threshold DAO will try to make an initial assessment of a bug's relevance, severity, and exploitability, and communicate this back to the reporter. The Threshold DAO will compensate important findings on a case-by-case basis. We value security researchers and we encourage you to contact us to discuss your findings.
4531

46-
Threshold DAO is currently in the process of establishing a Bug Bounty program on Immunefi.
32+
We also ask all researchers to please submit their reports in English.

contracts/staking/IStaking.sol

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ interface IStaking {
7070
address authorizer
7171
) external;
7272

73-
/// @notice Refresh Keep stake owner. Can be called only by the old owner
74-
/// or their staking provider.
75-
/// @dev The staking provider in T staking contract is the legacy KEEP
76-
/// staking contract operator.
77-
function refreshKeepStakeOwner(address stakingProvider) external;
78-
7973
/// @notice Allows the Governance to set the minimum required stake amount.
8074
/// This amount is required to protect against griefing the staking
8175
/// contract and individual applications are allowed to require

contracts/staking/TokenStaking.sol

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,15 @@ contract TokenStaking is Initializable, IStaking, Checkpoints {
214214
_;
215215
}
216216

217+
modifier onlyOwnerOf(address stakingProvider) {
218+
// slither-disable-next-line incorrect-equality
219+
require(
220+
stakingProviders[stakingProvider].owner == msg.sender,
221+
"Caller is not owner"
222+
);
223+
_;
224+
}
225+
217226
/// @param _token Address of T token contract
218227
/// @param _keepStakingContract Address of Keep staking contract
219228
/// @param _nucypherStakingContract Address of NuCypher staking contract
@@ -400,28 +409,6 @@ contract TokenStaking is Initializable, IStaking, Checkpoints {
400409
);
401410
}
402411

403-
/// @notice Refresh Keep stake owner. Can be called only by the old owner
404-
/// or their staking provider.
405-
/// @dev The staking provider in T staking contract is the legacy KEEP
406-
/// staking contract operator.
407-
function refreshKeepStakeOwner(address stakingProvider)
408-
external
409-
override
410-
onlyOwnerOrStakingProvider(stakingProvider)
411-
{
412-
StakingProviderInfo storage stakingProviderStruct = stakingProviders[
413-
stakingProvider
414-
];
415-
address newOwner = keepStake.resolveOwner(stakingProvider);
416-
417-
emit OwnerRefreshed(
418-
stakingProvider,
419-
stakingProviderStruct.owner,
420-
newOwner
421-
);
422-
stakingProviderStruct.owner = newOwner;
423-
}
424-
425412
/// @notice Allows the Governance to set the minimum required stake amount.
426413
/// This amount is required to protect against griefing the staking
427414
/// contract and individual applications are allowed to require
@@ -480,6 +467,7 @@ contract TokenStaking is Initializable, IStaking, Checkpoints {
480467
address application,
481468
uint96 amount
482469
) external override onlyAuthorizerOf(stakingProvider) {
470+
require(amount > 0, "Parameters must be specified");
483471
ApplicationInfo storage applicationStruct = applicationInfo[
484472
application
485473
];
@@ -763,7 +751,7 @@ contract TokenStaking is Initializable, IStaking, Checkpoints {
763751
function topUpNu(address stakingProvider)
764752
external
765753
override
766-
onlyOwnerOrStakingProvider(stakingProvider)
754+
onlyOwnerOf(stakingProvider)
767755
{
768756
StakingProviderInfo storage stakingProviderStruct = stakingProviders[
769757
stakingProvider
@@ -1420,14 +1408,11 @@ contract TokenStaking is Initializable, IStaking, Checkpoints {
14201408
internal
14211409
virtual
14221410
override
1411+
onlyOwnerOf(stakingProvider)
14231412
{
14241413
StakingProviderInfo storage stakingProviderStruct = stakingProviders[
14251414
stakingProvider
14261415
];
1427-
require(
1428-
stakingProviderStruct.owner == msg.sender,
1429-
"Caller is not owner"
1430-
);
14311416
uint96 stakingProviderBalance = stakingProviderStruct.tStake +
14321417
stakingProviderStruct.keepInTStake +
14331418
stakingProviderStruct.nuInTStake;

contracts/test/KeepRegistryStub.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ contract KeepRegistryStub is IKeepRegistry {
99

1010
event OperatorContractApproved(address operatorContract);
1111

12-
constructor() public {
12+
constructor() {
1313
registryKeeper = msg.sender;
1414
}
1515

docs/rfc-1-staking-contract.adoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,6 @@ additionally appointing beneficiary and authorizer roles. Caches the amount
307307
staked in NU staking contract. Can be called only by the original delegation
308308
owner.
309309

310-
==== `refreshKeepStakeOwner(address stakingProvider) external onlyOwnerOf(stakingProvider)`
311-
312-
Refresh Keep stake owner. Can be called only by the old owner.
313-
314310
==== `setMinimumStakeAmount(uint96 amount) external onlyGovernance`
315311

316312
Allows the governance to set the minimum required stake amount. This amount is

0 commit comments

Comments
 (0)