Skip to content

Commit 4ea147c

Browse files
jannikluhnclaude
andcommitted
feat(scripts): require DKG_CONTRACT_ADDRESS in AddKeyperSet
The AddKeyperSet deployment script now reads the DKG contract address with vm.envAddress("DKG_CONTRACT_ADDRESS") instead of the vm.envOr(..., address(0)) fallback, and calls setDKGContract unconditionally. This is the deployment-path complement to the on-chain addKeyperSet validation added in ef231f8: a zero DKG address would now revert DKGContractNotSet at the contract call, so failing earlier at env-resolution time with Foundry's clear "environment variable not found" message is strictly better than a silent zero-address branch that always fails downstream. Key decisions: - Scope limited to AddKeyperSet.s.sol per the PRD/issue. The byte- identical AddKeyperSet.gnosh.s.sol is left untouched; it is not on any automated path (the e2e add-keyper-set mise-task always invokes AddKeyperSet.s.sol regardless of deployment type), so hardening it is a separate, out-of-scope follow-up. - No new forge test: scripts are not unit-tested in this repo, and the new revert-on-missing-env behavior is Foundry framework semantics (vm.envAddress), not our logic. Files changed: - script/AddKeyperSet.s.sol Verification: forge clean && forge build clean (only pre-existing unsafe-typecast lints in scripts/benchmarks); forge test 133/133 pass. The e2e add-keyper-set task already derives DKG_CONTRACT_ADDRESS from the deployed DKGContract (both Deploy.service and Deploy.gnosh create one), so the success path is preserved. Notes: e2e suite (test-dkg-happy-path, test-dkg-offline-recovery) not run -- mise is absent and its mise.run | sh bootstrap is blocked by the sandbox classifier (Code-from-External), as in every prior commit in this PRD area. The change is a one-line deployment-script edit with no ABI/runtime impact on correctly-configured keyper sets, so the Go e2e flows are unaffected. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ef231f8 commit 4ea147c

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

script/AddKeyperSet.s.sol

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ contract AddKeyperSet is Script {
4141
keyBroadcastContractAddress
4242
);
4343

44-
address dkgContract = vm.envOr("DKG_CONTRACT_ADDRESS", address(0));
44+
address dkgContract = vm.envAddress("DKG_CONTRACT_ADDRESS");
4545

4646
address[] memory keypers = vm.envAddress("KEYPER_ADDRESSES", ",");
4747
uint256 threshold = vm.envUint("THRESHOLD");
@@ -59,9 +59,7 @@ contract AddKeyperSet is Script {
5959
keyperSet.addMembers(keypers);
6060
keyperSet.setThreshold(uint64(threshold));
6161
keyperSet.setPublisher(address(eonKeyPublish));
62-
if (dkgContract != address(0)) {
63-
keyperSet.setDKGContract(dkgContract);
64-
}
62+
keyperSet.setDKGContract(dkgContract);
6563
keyperSet.setFinalized();
6664
console.log("keyperSet:", address(keyperSet));
6765
console.log("eonKeyPublish:", address(eonKeyPublish));

0 commit comments

Comments
 (0)