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
7 changes: 2 additions & 5 deletions contracts/deploy/020-ContractInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,9 @@ export const ContractInit = async (
// import genesis batch
const batchHeader: string = config.batchHeader

// submitter and challenger
const submitter: string = config.rollupProposer
// challenger
const challenger: string = config.rollupChallenger
if (!ethers.utils.isAddress(submitter)
|| !ethers.utils.isAddress(challenger)
) {
if (!ethers.utils.isAddress(challenger)) {
console.error('please check your address')
return ''
}
Comment on lines +57 to 62
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Same validation hardening for challenger.

Mirror the checksum and zero-address guard here.

-        // challenger
-        const challenger: string = config.rollupChallenger
-        if (!ethers.utils.isAddress(challenger)) {
-            console.error('please check your address')
-            return ''
-        }
+        // challenger
+        let challenger: string
+        try {
+            challenger = hre.ethers.utils.getAddress(config.rollupChallenger)
+        } catch {
+            console.error('Invalid rollupChallenger in deploy config:', config.rollupChallenger)
+            return ''
+        }
+        if (challenger === hre.ethers.constants.AddressZero) {
+            console.error('rollupChallenger must not be the zero address')
+            return ''
+        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// challenger
const challenger: string = config.rollupChallenger
if (!ethers.utils.isAddress(submitter)
|| !ethers.utils.isAddress(challenger)
) {
if (!ethers.utils.isAddress(challenger)) {
console.error('please check your address')
return ''
}
// challenger
- const challenger: string = config.rollupChallenger
- if (!ethers.utils.isAddress(challenger)) {
- console.error('please check your address')
- return ''
let challenger: string
try {
challenger = hre.ethers.utils.getAddress(config.rollupChallenger)
} catch {
console.error('Invalid rollupChallenger in deploy config:', config.rollupChallenger)
return ''
}
if (challenger === hre.ethers.constants.AddressZero) {
console.error('rollupChallenger must not be the zero address')
return ''
}
🤖 Prompt for AI Agents
In contracts/deploy/020-ContractInit.ts around lines 57 to 62, the challenger
address only uses isAddress and lacks the same checksum/zero-address guards as
elsewhere; update validation to mirror the other checks by first ensuring
challenger is not the zero address (compare to ethers.constants.AddressZero),
then normalize/validate it via ethers.utils.getAddress inside a try/catch to
enforce checksum (catch invalid checksum errors), and on failure log a clear
error mentioning "challenger" and return an empty string.

Expand Down
8 changes: 4 additions & 4 deletions contracts/scripts/localDeploy.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rm -rf ./deployFile.json &&
yarn hardhat deploy --storagepath ./deployFile.json --network local &&
yarn hardhat initialize --storagepath ./deployFile.json --network local &&
yarn hardhat fund --network local &&
yarn hardhat register --storagepath ./deployFile.json --network local
yarn hardhat deploy --storagepath ./deployFile.json --network l1 &&
yarn hardhat initialize --storagepath ./deployFile.json --network l1 &&
yarn hardhat fund --network l1 &&
yarn hardhat register --storagepath ./deployFile.json --network l1
1 change: 0 additions & 1 deletion contracts/src/deploy-config/l1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const config = {
rollupProofWindow: 86400,
proofRewardPercent: 70,
// challenge config
rollupProposer: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
rollupChallenger: '0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65',
// genesis config
batchHeader: '0x0000000000000000000000000000000000000000000000000043a758882ae97327ffcc63373e26fcd144a5a738eac834c167175d69713780c0010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c444014000000000000000000000000000000000000000000000000000000000000000020cd420e20d610897b8f2c5ac5259ab8b57cce1074212cec2815b2b73ff93d9f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
Expand Down
1 change: 0 additions & 1 deletion contracts/src/deploy-config/qanetl1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const config = {
rollupProofWindow: 86400,
proofRewardPercent: 70,
// challenge config
rollupProposer: '0x7161aE5B767Df97BAc34e5776311Ded4Cb01691d',
rollupChallenger: '0x71616250f7CAaa8a5DC295dc5851D6b1E49188a7',
// genesis config
batchHeader: '',
Expand Down
101 changes: 0 additions & 101 deletions contracts/src/deploy-config/sepolia.ts

This file was deleted.

60 changes: 0 additions & 60 deletions contracts/src/deploy-config/testnetl1.ts

This file was deleted.

5 changes: 2 additions & 3 deletions contracts/tasks/staking_upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,9 @@ task("rollup-import-genesis-batch")
// import genesis batch
const batchHeader: string = config.batchHeader

// submitter and challenger
const submitter: string = config.rollupProposer
//challenger
const challenger: string = config.rollupChallenger
if (!ethers.utils.isAddress(submitter) || !ethers.utils.isAddress(challenger)) {
if (!ethers.utils.isAddress(challenger)) {
Comment on lines +225 to +227
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Repo-wide sweep for removed submitter config.

Confirm there are no lingering references to rollupProposer/submitter after this change.


🏁 Script executed:

#!/bin/bash
# From repo root
set -euo pipefail
echo "Searching for deprecated submitter config/variables..."
rg -nP -C2 '\brollupProposer\b|\bsubmitter\b'
echo "Where is rollupChallenger used?"
rg -nP -C3 '\brollupChallenger\b' contracts

Length of output: 70406


Remove deprecated rollupProposer config from deploy files
Delete the rollupProposer entry in contracts/src/deploy-config/holesky.ts (line 26) and update the config type to drop rollupProposer.

🤖 Prompt for AI Agents
In contracts/tasks/staking_upgrade.ts around lines 225 to 227, the project still
references a config type that includes the now-deprecated rollupProposer; remove
the deprecated rollupProposer from the deploy config
(contracts/src/deploy-config/holesky.ts line ~26) and update the shared config
type definition to drop the rollupProposer property so the type no longer
expects it. Delete the rollupProposer entry in holesky.ts, update any
deploy-config type/interface definition files to remove that property, and then
rebuild/fix any TypeScript errors by removing or adjusting any remaining
references to rollupProposer across the codebase so only rollupChallenger (and
other valid fields) remain.

console.error("please check your address")
return ""
}
Expand Down
Loading