Skip to content

Commit

Permalink
Update deployment code for M2 mainnet contracts (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
mooselumph authored Jan 25, 2024
1 parent 3c38f51 commit 8ccb524
Show file tree
Hide file tree
Showing 19 changed files with 10,528 additions and 1,482 deletions.
1,345 changes: 1,345 additions & 0 deletions contracts/bindings/BLSApkRegistry/binding.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/BN254/binding.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contracts/bindings/BitmapUtils/binding.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4,574 changes: 4,574 additions & 0 deletions contracts/bindings/DelegationManager/binding.go

Large diffs are not rendered by default.

676 changes: 325 additions & 351 deletions contracts/bindings/EigenDAServiceManager/binding.go

Large diffs are not rendered by default.

549 changes: 205 additions & 344 deletions contracts/bindings/IEigenDAServiceManager/binding.go

Large diffs are not rendered by default.

189 changes: 105 additions & 84 deletions contracts/bindings/IndexRegistry/binding.go

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions contracts/bindings/MockRollup/binding.go

Large diffs are not rendered by default.

311 changes: 311 additions & 0 deletions contracts/bindings/OperatorStateRetriever/binding.go

Large diffs are not rendered by default.

3,261 changes: 3,261 additions & 0 deletions contracts/bindings/RegistryCoordinator/binding.go

Large diffs are not rendered by default.

1,004 changes: 347 additions & 657 deletions contracts/bindings/StakeRegistry/binding.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function create_binding {
forge clean
forge build

contracts="BitmapUtils BLSOperatorStateRetriever BN254 BLSRegistryCoordinatorWithIndices BLSPublicKeyCompendium BLSPubkeyRegistry IBLSPubkeyRegistry IndexRegistry StakeRegistry EigenDAServiceManager IEigenDAServiceManager MockRollup"
contracts="DelegationManager BitmapUtils OperatorStateRetriever RegistryCoordinator BLSApkRegistry IndexRegistry StakeRegistry BN254 EigenDAServiceManager IEigenDAServiceManager MockRollup"
for contract in $contracts; do
create_binding ./ $contract ./bindings
done
Expand Down
1 change: 1 addition & 0 deletions contracts/script/EigenDADeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ contract EigenDADeployer is DeployOpenEigenLayer {
address eigenDAPauser;
address churner;
address ejector;
address confirmer;
}

function _deployEigenDAAndEigenLayerContracts(
Expand Down
10 changes: 8 additions & 2 deletions contracts/script/SetUpEigenDA.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ contract SetupEigenDA is EigenDADeployer, EigenLayerUtils {
addressConfig.eigenDAPauser = msg.sender;
addressConfig.churner = msg.sender;
addressConfig.ejector = msg.sender;
addressConfig.confirmer = msg.sender;

uint256 initialSupply = 1000 ether;
address tokenOwner = msg.sender;
Expand All @@ -65,6 +66,9 @@ contract SetupEigenDA is EigenDADeployer, EigenLayerUtils {
maxOperatorCount = stdJson.readUint(config_data, ".maxOperatorCount");
}


addressConfig.confirmer = vm.addr(stdJson.readUint(config_data, ".confirmerPrivateKey"));


vm.startBroadcast();

Expand All @@ -75,6 +79,8 @@ contract SetupEigenDA is EigenDADeployer, EigenLayerUtils {
tokenOwner,
maxOperatorCount
);

eigenDAServiceManager.setBatchConfirmer(addressConfig.confirmer);

vm.stopBroadcast();
}
Expand Down Expand Up @@ -169,9 +175,9 @@ contract SetupEigenDA is EigenDADeployer, EigenLayerUtils {

string memory output = "eigenDA deployment output";
vm.serializeAddress(output, "eigenDAServiceManager", address(eigenDAServiceManager));
vm.serializeAddress(output, "blsOperatorStateRetriever", address(operatorStateRetriever));
vm.serializeAddress(output, "operatorStateRetriever", address(operatorStateRetriever));
vm.serializeAddress(output, "blsApkRegistry" , address(apkRegistry));
vm.serializeAddress(output, "blsRegistryCoordinatorWithIndices", address(registryCoordinator));
vm.serializeAddress(output, "registryCoordinator", address(registryCoordinator));

string memory finalJson = vm.serializeString(output, "object", output);

Expand Down
5 changes: 5 additions & 0 deletions inabox/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ new-anvil:
mkdir -p "testdata/$(dt)"
cp ./templates/testconfig-anvil.yaml "testdata/$(dt)/config.yaml"

new-anvil-nochurner:
mkdir -p "testdata/$(dt)"
cp ./templates/testconfig-anvil-nochurner.yaml "testdata/$(dt)/config.yaml"


new-docker-anvil:
mkdir -p "testdata/$(dt)"
cp ./templates/testconfig-anvil-docker.yaml "testdata/$(dt)/config.yaml"
Expand Down
21 changes: 11 additions & 10 deletions inabox/deploy/config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type EigenDADeployConfig struct {
NumStrategies int `json:"numStrategies"`
MaxOperatorCount int `json:"maxOperatorCount"`
StakerPrivateKeys []string `json:"stakerPrivateKeys"`
ConfirmerPrivateKey string `json:"confirmerPrivateKey"`
StakerTokenAmounts [][]string `json:"-"`
OperatorPrivateKeys []string `json:"-"`
}
Expand All @@ -79,10 +80,11 @@ func (cfg *EigenDADeployConfig) MarshalJSON() ([]byte, error) {

// Marshal the remaining fields
remainingFields := map[string]interface{}{
"useDefaults": cfg.UseDefaults,
"numStrategies": cfg.NumStrategies,
"maxOperatorCount": cfg.MaxOperatorCount,
"stakerPrivateKeys": cfg.StakerPrivateKeys,
"useDefaults": cfg.UseDefaults,
"numStrategies": cfg.NumStrategies,
"maxOperatorCount": cfg.MaxOperatorCount,
"stakerPrivateKeys": cfg.StakerPrivateKeys,
"confirmerPrivateKey": cfg.ConfirmerPrivateKey,
}

remainingJSON, err := json.Marshal(remainingFields)
Expand All @@ -96,12 +98,11 @@ func (cfg *EigenDADeployConfig) MarshalJSON() ([]byte, error) {
}

type EigenDAContract struct {
Deployer string `yaml:"deployer"`
ServiceManager string `json:"eigenDAServiceManager"`
OperatorStateRetreiver string `json:"blsOperatorStateRetriever"`
PubkeyRegistry string `json:"blsPubkeyRegistry"`
PubkeyCompendium string `json:"pubkeyCompendium"`
RegistryCoordinatorWithIndices string `json:"blsRegistryCoordinatorWithIndices"`
Deployer string `yaml:"deployer"`
ServiceManager string `json:"eigenDAServiceManager"`
OperatorStateRetreiver string `json:"operatorStateRetriever"`
BlsApkRegistry string `json:"blsApkRegistry"`
RegistryCoordinator string `json:"registryCoordinator"`
}

type ServicesSpec struct {
Expand Down
3 changes: 2 additions & 1 deletion inabox/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func (env *Config) generateEigenDADeployConfig() EigenDADeployConfig {
StakerPrivateKeys: stakers,
StakerTokenAmounts: stakes,
OperatorPrivateKeys: operators,
ConfirmerPrivateKey: env.getKeyString("batcher0"),
}

return config
Expand Down Expand Up @@ -219,7 +220,7 @@ func (env *Config) RunNodePluginBinary(operation string, operator OperatorVars)
"NODE_CHURNER_URL=" + operator.NODE_CHURNER_URL,
"NODE_NUM_CONFIRMATIONS=0",
}

err := execCmd("./node-plugin.sh", []string{}, envVars)

if err != nil {
Expand Down
37 changes: 16 additions & 21 deletions inabox/deploy/subgraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,35 +73,30 @@ type eigenDAOperatorStateSubgraphUpdater struct {
}

func (u eigenDAOperatorStateSubgraphUpdater) UpdateSubgraph(s *Subgraph, startBlock int) {
s.DataSources[0].Source.Address = strings.TrimPrefix(u.c.EigenDA.RegistryCoordinatorWithIndices, "0x")
s.DataSources[0].Source.Address = strings.TrimPrefix(u.c.EigenDA.RegistryCoordinator, "0x")
s.DataSources[0].Source.StartBlock = startBlock
s.DataSources[1].Source.Address = strings.TrimPrefix(u.c.EigenDA.PubkeyRegistry, "0x")
s.DataSources[1].Source.Address = strings.TrimPrefix(u.c.EigenDA.BlsApkRegistry, "0x")
s.DataSources[1].Source.StartBlock = startBlock
s.DataSources[2].Source.Address = strings.TrimPrefix(u.c.EigenDA.PubkeyCompendium, "0x")
s.DataSources[2].Source.Address = strings.TrimPrefix(u.c.EigenDA.BlsApkRegistry, "0x")
s.DataSources[2].Source.StartBlock = startBlock
s.DataSources[3].Source.Address = strings.TrimPrefix(u.c.EigenDA.PubkeyCompendium, "0x")
s.DataSources[3].Source.Address = strings.TrimPrefix(u.c.EigenDA.RegistryCoordinator, "0x")
s.DataSources[3].Source.StartBlock = startBlock
s.DataSources[4].Source.Address = strings.TrimPrefix(u.c.EigenDA.RegistryCoordinatorWithIndices, "0x")
s.DataSources[4].Source.Address = strings.TrimPrefix(u.c.EigenDA.BlsApkRegistry, "0x")
s.DataSources[4].Source.StartBlock = startBlock
s.DataSources[5].Source.Address = strings.TrimPrefix(u.c.EigenDA.PubkeyRegistry, "0x")
s.DataSources[5].Source.StartBlock = startBlock
}

func (u eigenDAOperatorStateSubgraphUpdater) UpdateNetworks(n Networks, startBlock int) {
n["devnet"]["BLSRegistryCoordinatorWithIndices"]["address"] = u.c.EigenDA.RegistryCoordinatorWithIndices
n["devnet"]["BLSRegistryCoordinatorWithIndices"]["startBlock"] = startBlock
n["devnet"]["BLSRegistryCoordinatorWithIndices_Operator"]["address"] = u.c.EigenDA.RegistryCoordinatorWithIndices
n["devnet"]["BLSRegistryCoordinatorWithIndices_Operator"]["startBlock"] = startBlock

n["devnet"]["BLSPubkeyRegistry"]["address"] = u.c.EigenDA.PubkeyRegistry
n["devnet"]["BLSPubkeyRegistry"]["startBlock"] = startBlock
n["devnet"]["BLSPubkeyRegistry_QuorumApkUpdates"]["address"] = u.c.EigenDA.PubkeyRegistry
n["devnet"]["BLSPubkeyRegistry_QuorumApkUpdates"]["startBlock"] = startBlock

n["devnet"]["BLSPubkeyCompendium"]["address"] = u.c.EigenDA.PubkeyCompendium
n["devnet"]["BLSPubkeyCompendium"]["startBlock"] = startBlock
n["devnet"]["BLSPubkeyCompendium_Operator"]["address"] = u.c.EigenDA.PubkeyCompendium
n["devnet"]["BLSPubkeyCompendium_Operator"]["startBlock"] = startBlock
n["devnet"]["RegistryCoordinator"]["address"] = u.c.EigenDA.RegistryCoordinator
n["devnet"]["RegistryCoordinator"]["startBlock"] = startBlock
n["devnet"]["RegistryCoordinator_Operator"]["address"] = u.c.EigenDA.RegistryCoordinator
n["devnet"]["RegistryCoordinator_Operator"]["startBlock"] = startBlock

n["devnet"]["BLSApkRegistry"]["address"] = u.c.EigenDA.BlsApkRegistry
n["devnet"]["BLSApkRegistry"]["startBlock"] = startBlock
n["devnet"]["BLSApkRegistry_Operator"]["address"] = u.c.EigenDA.BlsApkRegistry
n["devnet"]["BLSApkRegistry_Operator"]["startBlock"] = startBlock
n["devnet"]["BLSApkRegistry_QuorumApkUpdates"]["address"] = u.c.EigenDA.BlsApkRegistry
n["devnet"]["BLSApkRegistry_QuorumApkUpdates"]["startBlock"] = startBlock
}

type eigenDAUIMonitoringUpdater struct {
Expand Down
4 changes: 2 additions & 2 deletions inabox/tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func blobHeaderFromProto(blobHeader *disperserpb.BlobHeader) rollupbindings.IEig
}
}

func blobVerificationProofFromProto(verificationProof *disperserpb.BlobVerificationProof) rollupbindings.EigenDABlobUtilsBlobVerificationProof {
func blobVerificationProofFromProto(verificationProof *disperserpb.BlobVerificationProof) rollupbindings.EigenDARollupUtilsBlobVerificationProof {
batchMetadataProto := verificationProof.GetBatchMetadata()
batchHeaderProto := verificationProof.GetBatchMetadata().GetBatchHeader()
var batchRoot [32]byte
Expand All @@ -168,7 +168,7 @@ func blobVerificationProofFromProto(verificationProof *disperserpb.BlobVerificat
Fee: fee,
ConfirmationBlockNumber: batchMetadataProto.GetConfirmationBlockNumber(),
}
return rollupbindings.EigenDABlobUtilsBlobVerificationProof{
return rollupbindings.EigenDARollupUtilsBlobVerificationProof{
BatchId: verificationProof.GetBatchId(),
BlobIndex: uint8(verificationProof.GetBlobIndex()),
BatchMetadata: batchMetadata,
Expand Down

0 comments on commit 8ccb524

Please sign in to comment.