Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
30 changes: 29 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 Down Expand Up @@ -34,6 +36,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 +84,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