Skip to content

Commit

Permalink
Onchain verification v2 inabox test (Layr-Labs#1077)
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-shim authored Jan 8, 2025
1 parent 77a8fec commit c33ad29
Show file tree
Hide file tree
Showing 10 changed files with 238 additions and 23 deletions.
4 changes: 4 additions & 0 deletions api/clients/v2/retrieval_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ func (r *retrievalClient) GetBlob(ctx context.Context, blobHeader *corev2.BlobHe
indices = append(indices, assignmentIndices...)
}

if len(chunks) == 0 {
return nil, errors.New("failed to retrieve any chunks")
}

return r.verifier.Decode(
chunks,
indices,
Expand Down
2 changes: 1 addition & 1 deletion contracts/script/EigenDADeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ contract EigenDADeployer is DeployOpenEigenLayer {
eigenDAThresholdRegistryImplementation = new EigenDAThresholdRegistry();

VersionedBlobParams[] memory versionedBlobParams = new VersionedBlobParams[](0);
SecurityThresholds memory defaultSecurityThresholds = SecurityThresholds(33, 55);
SecurityThresholds memory defaultSecurityThresholds = SecurityThresholds(55, 33);

eigenDAProxyAdmin.upgradeAndCall(
TransparentUpgradeableProxy(payable(address(eigenDAThresholdRegistry))),
Expand Down
1 change: 1 addition & 0 deletions contracts/script/SetUpEigenDA.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ contract SetupEigenDA is EigenDADeployer, EigenLayerUtils {
vm.serializeAddress(output, "operatorStateRetriever", address(operatorStateRetriever));
vm.serializeAddress(output, "blsApkRegistry" , address(apkRegistry));
vm.serializeAddress(output, "registryCoordinator", address(registryCoordinator));
vm.serializeAddress(output, "blobVerifier", address(eigenDABlobVerifier));

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

Expand Down
2 changes: 1 addition & 1 deletion contracts/test/rollup/MockRollup.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ contract MockRollupTest is BLSMockAVSDeployer {
bytes quorumAdversaryThresholdPercentages = hex"212121";
bytes quorumConfirmationThresholdPercentages = hex"373737";
bytes quorumNumbersRequired = hex"0001";
SecurityThresholds defaultSecurityThresholds = SecurityThresholds(33, 55);
SecurityThresholds defaultSecurityThresholds = SecurityThresholds(55, 33);

uint8 defaultCodingRatioPercentage = 10;
uint32 defaultReferenceBlockNumber = 100;
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/unit/EigenDABlobUtils.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ contract EigenDABlobUtilsUnit is BLSMockAVSDeployer {
bytes quorumAdversaryThresholdPercentages = hex"212121";
bytes quorumConfirmationThresholdPercentages = hex"373737";
bytes quorumNumbersRequired = hex"0001";
SecurityThresholds defaultSecurityThresholds = SecurityThresholds(33, 55);
SecurityThresholds defaultSecurityThresholds = SecurityThresholds(55, 33);

uint32 defaultReferenceBlockNumber = 100;
uint32 defaultConfirmationBlockNumber = 1000;
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/unit/EigenDAServiceManagerUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
bytes quorumAdversaryThresholdPercentages = hex"212121";
bytes quorumConfirmationThresholdPercentages = hex"373737";
bytes quorumNumbersRequired = hex"0001";
SecurityThresholds defaultSecurityThresholds = SecurityThresholds(33, 55);
SecurityThresholds defaultSecurityThresholds = SecurityThresholds(55, 33);

uint256 feePerBytePerTime = 0;

Expand Down
1 change: 1 addition & 0 deletions inabox/deploy/config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ type EigenDAContract struct {
OperatorStateRetreiver string `json:"operatorStateRetriever"`
BlsApkRegistry string `json:"blsApkRegistry"`
RegistryCoordinator string `json:"registryCoordinator"`
BlobVerifier string `json:"blobVerifier"`
}

type Stakes struct {
Expand Down
9 changes: 8 additions & 1 deletion inabox/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ func (env *Config) RegisterBlobVersionAndRelays(ethClient common.EthClient) map[
if err != nil {
log.Panicf("Error: %s", err)
}
fmt.Println("thresholds reigstry address", thresholdRegistryAddr.Hex())
defaultThes, err := contractThresholdRegistry.GetDefaultSecurityThresholdsV2(&bind.CallOpts{})
if err != nil {
log.Panicf("Error: %s", err)
}
fmt.Println("thresholds", defaultThes.AdversaryThreshold, defaultThes.ConfirmationThreshold)
for _, blobVersionParam := range env.BlobVersionParams {
txn, err := contractThresholdRegistry.AddVersionedBlobParams(opts, thresholdreg.VersionedBlobParams{
MaxNumOperators: blobVersionParam.MaxNumOperators,
Expand All @@ -203,10 +209,11 @@ func (env *Config) RegisterBlobVersionAndRelays(ethClient common.EthClient) map[
log.Panicf("Error: %s", err)
}
relays := map[uint32]string{}
ethAddr := ethClient.GetAccountAddress()
for i, relayVars := range env.Relays {
url := fmt.Sprintf("0.0.0.0:%s", relayVars.RELAY_GRPC_PORT)
txn, err := contractRelayRegistry.AddRelayInfo(opts, relayreg.RelayInfo{
RelayAddress: gcommon.Address{0},
RelayAddress: ethAddr,
RelayURL: url,
})
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions inabox/tests/integration_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
clientsv2 "github.com/Layr-Labs/eigenda/api/clients/v2"
"github.com/Layr-Labs/eigenda/common"
"github.com/Layr-Labs/eigenda/common/geth"
verifierbindings "github.com/Layr-Labs/eigenda/contracts/bindings/EigenDABlobVerifier"
rollupbindings "github.com/Layr-Labs/eigenda/contracts/bindings/MockRollup"
"github.com/Layr-Labs/eigenda/core"
"github.com/Layr-Labs/eigenda/core/eth"
Expand Down Expand Up @@ -47,6 +48,7 @@ var (
ethClient common.EthClient
rpcClient common.RPCEthClient
mockRollup *rollupbindings.ContractMockRollup
verifierContract *verifierbindings.ContractEigenDABlobVerifier
retrievalClient clients.RetrievalClient
retrievalClientV2 clientsv2.RetrievalClient
numConfirmations int = 3
Expand Down Expand Up @@ -137,6 +139,8 @@ var _ = BeforeSuite(func() {

mockRollup, err = rollupbindings.NewContractMockRollup(gcommon.HexToAddress(testConfig.MockRollup), ethClient)
Expect(err).To(BeNil())
verifierContract, err = verifierbindings.NewContractEigenDABlobVerifier(gcommon.HexToAddress(testConfig.EigenDA.BlobVerifier), ethClient)
Expect(err).To(BeNil())
err = setupRetrievalClient(testConfig)
Expect(err).To(BeNil())
}
Expand Down
Loading

0 comments on commit c33ad29

Please sign in to comment.