Skip to content

Commit 1e32bf1

Browse files
Merge pull request #177 from threshold-network/fix/testnet4-security-and-correctness
fix: security and correctness follow-ups for Sepolia operator tooling (PR #176)
2 parents b5a532f + ea8ae81 commit 1e32bf1

8 files changed

Lines changed: 1502 additions & 99 deletions

File tree

contracts/staking/TokenStaking.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ contract TokenStaking is Initializable, IStaking, Checkpoints {
300300
address application,
301301
uint96 amount
302302
) external virtual override onlyAuthorizerOf(stakingProvider) {
303+
require(application != address(0), "Parameters must be specified");
303304
require(amount > 0, "Parameters must be specified");
304305
ApplicationInfo storage applicationStruct = applicationInfo[
305306
application

deploy/54_upgrade_token_staking_extended.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { HardhatRuntimeEnvironment } from "hardhat/types"
22
import { DeployFunction } from "hardhat-deploy/types"
3+
import * as fs from "fs"
34

45
import { ethers, upgrades } from "hardhat"
56

@@ -29,7 +30,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2930
proxyAddress = existing.address
3031
} else {
3132
// 07_deploy_token_staking saves to TokenStaking.json in deployments dir
32-
const fs = require("fs")
3333
const deploymentPath = `deployments/${hre.network.name}/TokenStaking.json`
3434
if (!fs.existsSync(deploymentPath)) {
3535
log("TokenStaking not deployed, skipping upgrade")
@@ -47,12 +47,16 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
4747
"ExtendedTokenStaking"
4848
)
4949

50+
// 07_deploy_token_staking uses deployProxy without specifying kind;
51+
// the OZ plugin defaults to transparent for contracts that lack upgradeTo().
52+
// Verify on-chain with:
53+
// cast storage <PROXY_ADDR> 0xb53127684a568b3173ae13b9f8a6016e243e63b4 --rpc-url $RPC
54+
// Non-zero = transparent proxy (ProxyAdmin slot); zero = UUPS.
5055
const upgraded = await upgrades.upgradeProxy(
5156
proxyAddress,
5257
ExtendedTokenStaking,
5358
{
5459
constructorArgs: [T.address],
55-
kind: "transparent",
5660
}
5761
)
5862
await upgraded.deployed()
@@ -66,7 +70,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
6670
address: upgraded.address,
6771
abi: JSON.parse(jsonAbi as string),
6872
}
69-
const fs = require("fs")
7073
const deploymentsDir = `deployments/${hre.network.name}`
7174
fs.writeFileSync(
7275
`${deploymentsDir}/TokenStaking.json`,

0 commit comments

Comments
 (0)