Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e411755
Add DKGContract scaffold and wire it into deploy scripts
jannikluhn May 20, 2026
f323d62
Add DKG phase-arithmetic helpers (issue #002)
jannikluhn May 20, 2026
6c057ea
Add ECIESKeyRegistry contract (issue #005)
jannikluhn May 20, 2026
33ec3a5
Add DKG bulletin-board message functions (issue #003)
jannikluhn May 20, 2026
e05fff3
Add DKG success-voting mechanism (issue #004)
jannikluhn May 20, 2026
c79c637
Change submitDealing/DealingSubmitted polyEval to bytes[]
jannikluhn May 20, 2026
f0d8cac
Add dkgContract address field to KeyperSet
jannikluhn May 20, 2026
748f5aa
Add happy-path DKG gas benchmark
jannikluhn May 20, 2026
b21b311
Add worst-case DKG gas benchmark
jannikluhn May 20, 2026
892cb92
feat(scripts): deploy DKG/ECIES in service deployment; wire DKG into …
jannikluhn May 20, 2026
d7e14c7
feat(dkg): add WrongDKGContract guard to all submit functions
jannikluhn May 21, 2026
a79dc72
fix(benchmark): add missing setDKGContract call in DKGBenchmark._setup
jannikluhn May 22, 2026
c18cb30
fix(benchmark): exclude setup gas from Forge per-test gas reporting
jannikluhn May 26, 2026
8a3180f
chore: format
jannikluhn May 27, 2026
8c43092
feat(dkg): add IDKGContract interface and implement it on DKGContract
jannikluhn May 27, 2026
ef231f8
feat(keyper-set-manager): validate DKG contract pairing on addKeyperSet
jannikluhn May 27, 2026
4ea147c
feat(scripts): require DKG_CONTRACT_ADDRESS in AddKeyperSet
jannikluhn May 27, 2026
0c9a998
fix: set dkg contract for fake keyper set
jannikluhn Jun 3, 2026
c768ee9
feat: add zero/empty guards
jannikluhn Jun 3, 2026
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
56 changes: 54 additions & 2 deletions bindings/keyperset/keyperset.go

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions foundry.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"lib/openzeppelin-foundry-upgrades": {
"lib/forge-std": {
"tag": {
"name": "v0.4.0",
"rev": "cbce1e00305e943aa1661d43f41e5ac72c662b07"
"name": "v1.10.0",
"rev": "8bbcf6e3f8f62f419e5429a0bd89331c85c37824"
}
},
"lib/openzeppelin": {
"rev": "932fddf69a699a9a80fd2396fd1a2ab91cdda123"
},
"lib/openzeppelin-contracts-upgradeable": {
"tag": {
"name": "v5.4.0",
"rev": "e725abddf1e01cf05ace496e950fc8e243cc7cab"
}
},
"lib/openzeppelin": {
"rev": "932fddf69a699a9a80fd2396fd1a2ab91cdda123"
},
"lib/forge-std": {
"lib/openzeppelin-foundry-upgrades": {
"tag": {
"name": "v1.10.0",
"rev": "8bbcf6e3f8f62f419e5429a0bd89331c85c37824"
"name": "v0.4.0",
"rev": "cbce1e00305e943aa1661d43f41e5ac72c662b07"
}
}
}
5 changes: 5 additions & 0 deletions script/AddKeyperSet.gnosh.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ contract AddKeyperSet is Script {
keyBroadcastContractAddress
);

address dkgContract = vm.envOr("DKG_CONTRACT_ADDRESS", address(0));

address[] memory keypers = vm.envAddress("KEYPER_ADDRESSES", ",");
uint256 threshold = vm.envUint("THRESHOLD");
if (threshold > keypers.length) {
Expand All @@ -57,6 +59,9 @@ contract AddKeyperSet is Script {
keyperSet.addMembers(keypers);
keyperSet.setThreshold(uint64(threshold));
keyperSet.setPublisher(address(eonKeyPublish));
if (dkgContract != address(0)) {
keyperSet.setDKGContract(dkgContract);
}
keyperSet.setFinalized();
console.log("keyperSet:", address(keyperSet));
console.log("eonKeyPublish:", address(eonKeyPublish));
Expand Down
3 changes: 3 additions & 0 deletions script/AddKeyperSet.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ contract AddKeyperSet is Script {
keyBroadcastContractAddress
);

address dkgContract = vm.envAddress("DKG_CONTRACT_ADDRESS");

address[] memory keypers = vm.envAddress("KEYPER_ADDRESSES", ",");
uint256 threshold = vm.envUint("THRESHOLD");
if (threshold > keypers.length) {
Expand All @@ -57,6 +59,7 @@ contract AddKeyperSet is Script {
keyperSet.addMembers(keypers);
keyperSet.setThreshold(uint64(threshold));
keyperSet.setPublisher(address(eonKeyPublish));
keyperSet.setDKGContract(dkgContract);
keyperSet.setFinalized();
console.log("keyperSet:", address(keyperSet));
console.log("eonKeyPublish:", address(eonKeyPublish));
Expand Down
30 changes: 29 additions & 1 deletion script/Deploy.gnosh.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "../src/common/DKGContract.sol";
import "../src/common/ECIESKeyRegistry.sol";
import "../src/common/KeyBroadcastContract.sol";
import "../src/common/KeyperSet.sol";
import "../src/common/KeyperSetManager.sol";
Expand Down Expand Up @@ -31,6 +33,30 @@ contract Deploy is Script {
return kbc;
}

function deployDKGContract(
KeyperSetManager ksm,
KeyBroadcastContract kbc
) public returns (DKGContract) {
uint64 phaseLength = uint64(vm.envOr("DKG_PHASE_LENGTH", uint256(10)));
uint64 dkgLeadLength = uint64(vm.envOr("DKG_LEAD_LENGTH", uint256(40)));
DKGContract dkg = new DKGContract(
phaseLength,
dkgLeadLength,
address(ksm),
address(kbc)
);
console.log("DKGContract:", address(dkg));
return dkg;
}

function deployECIESKeyRegistry(
KeyperSetManager ksm
) public returns (ECIESKeyRegistry) {
ECIESKeyRegistry registry = new ECIESKeyRegistry(address(ksm));
console.log("ECIESKeyRegistry:", address(registry));
return registry;
}

function deploySequencer() public returns (Sequencer) {
Sequencer s = new Sequencer();
console.log("Sequencer:", address(s));
Expand All @@ -50,7 +76,9 @@ contract Deploy is Script {
vm.startBroadcast(deployKey);

KeyperSetManager ksm = deployKeyperSetManager(deployerAddress);
deployKeyBroadcastContract(ksm);
KeyBroadcastContract kbc = deployKeyBroadcastContract(ksm);
deployDKGContract(ksm, kbc);
deployECIESKeyRegistry(ksm);
deploySequencer();
deployValidatorRegistry();

Expand Down
45 changes: 42 additions & 3 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ pragma solidity ^0.8.22;

import "forge-std/Script.sol";
import "../src/shop/Inbox.sol";
import "../src/common/DKGContract.sol";
import "../src/common/ECIESKeyRegistry.sol";
import "../src/common/KeyperSet.sol";
import "../src/common/KeyperSetManager.sol";
import "../src/common/KeyBroadcastContract.sol";
Expand All @@ -14,19 +16,25 @@ contract DeployScript is Script {
KeyperSet keyperSet;
KeyperSetManager keyperSetManager;
KeyBroadcastContract keyBroadcastContract;
DKGContract dkgContract;
ECIESKeyRegistry eciesKeyRegistry;

uint256 deployerPrivateKey;
address sequencerAddress;
address deployerAddress;
uint64 blockGasLimit;
uint256 activationDelta;
uint256 threshold;
uint64 dkgPhaseLength;
uint64 dkgLeadLength;
// address[] memory keypers;

address inboxAddress;
address keyperSetManagerAddress;
address keyBroadcastContractAddress;
address keyperSetAddress;
address dkgContractAddress;
address eciesKeyRegistryAddress;

function setUp() public {
deployerPrivateKey = vm.envUint("PRIVATE_KEY");
Expand All @@ -51,6 +59,14 @@ contract DeployScript is Script {
address(0)
);
keyperSetAddress = vm.envOr("KEYPERSET_ADDRESS", address(0));
dkgContractAddress = vm.envOr("DKG_CONTRACT_ADDRESS", address(0));
eciesKeyRegistryAddress = vm.envOr(
"ECIES_KEY_REGISTRY_ADDRESS",
address(0)
);

dkgPhaseLength = uint64(vm.envOr("DKG_PHASE_LENGTH", uint256(10)));
dkgLeadLength = uint64(vm.envOr("DKG_LEAD_LENGTH", uint256(40)));
}

function deploy() public {
Expand Down Expand Up @@ -91,6 +107,26 @@ contract DeployScript is Script {
} else {
keyperSet = KeyperSet(keyperSetAddress);
}
if (dkgContractAddress == address(0)) {
dkgContract = new DKGContract(
dkgPhaseLength,
dkgLeadLength,
address(keyperSetManager),
address(keyBroadcastContract)
);
console.log("DKGContract deployed at:", address(dkgContract));
} else {
dkgContract = DKGContract(dkgContractAddress);
}
if (eciesKeyRegistryAddress == address(0)) {
eciesKeyRegistry = new ECIESKeyRegistry(address(keyperSetManager));
console.log(
"ECIESKeyRegistry deployed at:",
address(eciesKeyRegistry)
);
} else {
eciesKeyRegistry = ECIESKeyRegistry(eciesKeyRegistryAddress);
}
vm.stopBroadcast();
}

Expand Down Expand Up @@ -132,9 +168,12 @@ contract DeployScript is Script {
keyperSet.addMembers(keypers);
keyperSet.setThreshold(uint64(threshold));

// Step 2: Call setPublisher with deployer address (the sender)
keyperSet.setPublisher(deployerAddress);
console.log("Eon Key Publisher set to deployer's address");
// Step 2: Set the DKG Contract as publisher so it can broadcast eon keys
keyperSet.setPublisher(address(dkgContract));
console.log(
"Eon Key Publisher set to DKGContract:",
address(dkgContract)
);

keyperSet.setFinalized();
console.log("KeyperSet finalized");
Expand Down
41 changes: 40 additions & 1 deletion script/Deploy.service.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "../src/common/DKGContract.sol";
import "../src/common/ECIESKeyRegistry.sol";
import "../src/common/KeyBroadcastContract.sol";
import "../src/common/KeyperSet.sol";
import "../src/common/KeyperSetManager.sol";
Expand All @@ -19,6 +21,17 @@ contract Deploy is Script {

// add bootstrap keyper set
KeyperSet fakeKeyperset = new KeyperSet();
// The bootstrap keyper set must designate a DKG Contract bound to this
// manager, otherwise addKeyperSet reverts DKGContractNotSet (registration
// -time validation from the check-dkg-address change). The bootstrap set
// never runs DKG, so a placeholder KeyBroadcastContract address is fine.
DKGContract bootstrapDkg = new DKGContract(
10,
40,
address(ksm),
address(0)
);
fakeKeyperset.setDKGContract(address(bootstrapDkg));
fakeKeyperset.setFinalized();
ksm.addKeyperSet(0, address(fakeKeyperset));

Expand All @@ -34,6 +47,30 @@ contract Deploy is Script {
return kbc;
}

function deployDKGContract(
KeyperSetManager ksm,
KeyBroadcastContract kbc
) public returns (DKGContract) {
uint64 phaseLength = uint64(vm.envOr("DKG_PHASE_LENGTH", uint256(10)));
uint64 dkgLeadLength = uint64(vm.envOr("DKG_LEAD_LENGTH", uint256(40)));
DKGContract dkg = new DKGContract(
phaseLength,
dkgLeadLength,
address(ksm),
address(kbc)
);
console.log("DKGContract:", address(dkg));
return dkg;
}

function deployECIESKeyRegistry(
KeyperSetManager ksm
) public returns (ECIESKeyRegistry) {
ECIESKeyRegistry registry = new ECIESKeyRegistry(address(ksm));
console.log("ECIESKeyRegistry:", address(registry));
return registry;
}

function deployRegistry() public returns (ShutterRegistry) {
ShutterRegistry s = new ShutterRegistry();
console.log("Registry:", address(s));
Expand All @@ -58,7 +95,9 @@ contract Deploy is Script {
vm.startBroadcast(deployKey);

KeyperSetManager ksm = deployKeyperSetManager(deployerAddress);
deployKeyBroadcastContract(ksm);
KeyBroadcastContract kbc = deployKeyBroadcastContract(ksm);
deployDKGContract(ksm, kbc);
deployECIESKeyRegistry(ksm);
deployRegistry();
deployEventTriggerRegistry();

Expand Down
Loading
Loading