Skip to content

Commit

Permalink
Merge branch 'master' into quaq/disperser-registry
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0aa0 committed Dec 17, 2024
2 parents 5586d22 + f8afd92 commit 1db5031
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 32 deletions.
12 changes: 6 additions & 6 deletions contracts/src/core/EigenDAServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ contract EigenDAServiceManager is EigenDAServiceManagerStorage, ServiceManagerBa

/// @notice when applied to a function, ensures that the function is only callable by the `batchConfirmer`.
modifier onlyBatchConfirmer() {
require(isBatchConfirmer[msg.sender], "onlyBatchConfirmer: not from batch confirmer");
require(isBatchConfirmer[msg.sender]);
_;
}

Expand Down Expand Up @@ -82,21 +82,21 @@ contract EigenDAServiceManager is EigenDAServiceManagerStorage, ServiceManagerBa
NonSignerStakesAndSignature memory nonSignerStakesAndSignature
) external onlyWhenNotPaused(PAUSED_CONFIRM_BATCH) onlyBatchConfirmer() {
// make sure the information needed to derive the non-signers and batch is in calldata to avoid emitting events
require(tx.origin == msg.sender, "EigenDAServiceManager.confirmBatch: header and nonsigner data must be in calldata");
require(tx.origin == msg.sender, "header and nonsigner data must be in calldata");
// make sure the stakes against which the Batch is being confirmed are not stale
require(
batchHeader.referenceBlockNumber < block.number, "EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is in future"
batchHeader.referenceBlockNumber < block.number, "specified referenceBlockNumber is in future"
);

require(
(batchHeader.referenceBlockNumber + BLOCK_STALE_MEASURE) >= uint32(block.number),
"EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is too far in past"
"specified referenceBlockNumber is too far in past"
);

//make sure that the quorumNumbers and signedStakeForQuorums are of the same length
require(
batchHeader.quorumNumbers.length == batchHeader.signedStakeForQuorums.length,
"EigenDAServiceManager.confirmBatch: quorumNumbers and signedStakeForQuorums must be of the same length"
"quorumNumbers and signedStakeForQuorums must be same length"
);

// calculate reducedBatchHeaderHash which nodes signed
Expand All @@ -120,7 +120,7 @@ contract EigenDAServiceManager is EigenDAServiceManagerStorage, ServiceManagerBa
require(
quorumStakeTotals.signedStakeForQuorum[i] * THRESHOLD_DENOMINATOR >=
quorumStakeTotals.totalStakeForQuorum[i] * uint8(batchHeader.signedStakeForQuorums[i]),
"EigenDAServiceManager.confirmBatch: signatories do not own at least threshold percentage of a quorum"
"signatories do not own threshold percentage of a quorum"
);
}

Expand Down
12 changes: 6 additions & 6 deletions contracts/test/unit/EigenDAServiceManagerUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
(BatchHeader memory batchHeader, BLSSignatureChecker.NonSignerStakesAndSignature memory nonSignerStakesAndSignature)
= _getHeaderandNonSigners(0, pseudoRandomNumber, 100);

cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: header and nonsigner data must be in calldata"));
cheats.expectRevert(bytes("header and nonsigner data must be in calldata"));
cheats.prank(confirmer, notConfirmer);
eigenDAServiceManager.confirmBatch(
batchHeader,
Expand All @@ -172,7 +172,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
(BatchHeader memory batchHeader, BLSSignatureChecker.NonSignerStakesAndSignature memory nonSignerStakesAndSignature)
= _getHeaderandNonSigners(0, pseudoRandomNumber, 100);

cheats.expectRevert(bytes("onlyBatchConfirmer: not from batch confirmer"));
cheats.expectRevert();
cheats.prank(notConfirmer, notConfirmer);
eigenDAServiceManager.confirmBatch(
batchHeader,
Expand All @@ -194,7 +194,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
bytes32 batchHeaderHash = batchHeader.hashBatchHeaderMemory();
nonSignerStakesAndSignature.sigma = BN254.hashToG1(batchHeaderHash).scalar_mul(aggSignerPrivKey);

cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is in future"));
cheats.expectRevert(bytes("specified referenceBlockNumber is in future"));
cheats.prank(confirmer, confirmer);
eigenDAServiceManager.confirmBatch(
batchHeader,
Expand All @@ -207,7 +207,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
= _getHeaderandNonSigners(0, pseudoRandomNumber, 100);

cheats.roll(block.number + eigenDAServiceManager.BLOCK_STALE_MEASURE());
cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is too far in past"));
cheats.expectRevert(bytes("specified referenceBlockNumber is too far in past"));
cheats.prank(confirmer, confirmer);
eigenDAServiceManager.confirmBatch(
batchHeader,
Expand All @@ -219,7 +219,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
(BatchHeader memory batchHeader, BLSSignatureChecker.NonSignerStakesAndSignature memory nonSignerStakesAndSignature)
= _getHeaderandNonSigners(1, pseudoRandomNumber, 100);

cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: signatories do not own at least threshold percentage of a quorum"));
cheats.expectRevert(bytes("signatories do not own threshold percentage of a quorum"));
cheats.prank(confirmer, confirmer);
eigenDAServiceManager.confirmBatch(
batchHeader,
Expand Down Expand Up @@ -253,7 +253,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
= _getHeaderandNonSigners(0, pseudoRandomNumber, 100);
batchHeader.signedStakeForQuorums = new bytes(0);

cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: quorumNumbers and signedStakeForQuorums must be of the same length"));
cheats.expectRevert(bytes("quorumNumbers and signedStakeForQuorums must be same length"));
cheats.prank(confirmer, confirmer);
eigenDAServiceManager.confirmBatch(
batchHeader,
Expand Down
2 changes: 0 additions & 2 deletions disperser/controller/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"math"
"time"

"github.com/prometheus/client_golang/prometheus"

"github.com/Layr-Labs/eigenda/api/clients/v2"
"github.com/Layr-Labs/eigenda/common"
"github.com/Layr-Labs/eigenda/core"
Expand Down
4 changes: 2 additions & 2 deletions disperser/dataapi/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/batch/{batch_header_hash}": {
"/batches/{batch_header_hash}": {
"get": {
"produces": [
"application/json"
Expand Down Expand Up @@ -61,7 +61,7 @@ const docTemplate = `{
}
}
},
"/blob/{blob_key}": {
"/blobs/{blob_key}": {
"get": {
"produces": [
"application/json"
Expand Down
4 changes: 2 additions & 2 deletions disperser/dataapi/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"version": "1"
},
"paths": {
"/batch/{batch_header_hash}": {
"/batches/{batch_header_hash}": {
"get": {
"produces": [
"application/json"
Expand Down Expand Up @@ -57,7 +57,7 @@
}
}
},
"/blob/{blob_key}": {
"/blobs/{blob_key}": {
"get": {
"produces": [
"application/json"
Expand Down
4 changes: 2 additions & 2 deletions disperser/dataapi/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ info:
title: EigenDA Data Access API
version: "1"
paths:
/batch/{batch_header_hash}:
/batches/{batch_header_hash}:
get:
parameters:
- description: Batch header hash in hex string
Expand Down Expand Up @@ -391,7 +391,7 @@ paths:
summary: Fetch batch by the batch header hash
tags:
- Feed
/blob/{blob_key}:
/blobs/{blob_key}:
get:
parameters:
- description: Blob key in hex string
Expand Down
12 changes: 6 additions & 6 deletions disperser/dataapi/server_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ func (s *ServerV2) Start() error {
{
blob := v2.Group("/blob")
{
blob.GET("/blob/feed", s.FetchBlobFeedHandler)
blob.GET("/blob/:blob_key", s.FetchBlobHandler)
blob.GET("/blobs/feed", s.FetchBlobFeedHandler)
blob.GET("/blobs/:blob_key", s.FetchBlobHandler)
}
batch := v2.Group("/batch")
{
batch.GET("/batch/feed", s.FetchBatchFeedHandler)
batch.GET("/batch/:batch_header_hash", s.FetchBatchHandler)
batch.GET("/batches/feed", s.FetchBatchFeedHandler)
batch.GET("/batches/:batch_header_hash", s.FetchBatchHandler)
}
operators := v2.Group("/operators")
{
Expand Down Expand Up @@ -180,7 +180,7 @@ func (s *ServerV2) FetchBlobFeedHandler(c *gin.Context) {
// @Failure 400 {object} ErrorResponse "error: Bad request"
// @Failure 404 {object} ErrorResponse "error: Not found"
// @Failure 500 {object} ErrorResponse "error: Server error"
// @Router /blob/{blob_key} [get]
// @Router /blobs/{blob_key} [get]
func (s *ServerV2) FetchBlobHandler(c *gin.Context) {
start := time.Now()
blobKey, err := corev2.HexToBlobKey(c.Param("blob_key"))
Expand Down Expand Up @@ -221,7 +221,7 @@ func (s *ServerV2) FetchBatchFeedHandler(c *gin.Context) {
// @Failure 400 {object} ErrorResponse "error: Bad request"
// @Failure 404 {object} ErrorResponse "error: Not found"
// @Failure 500 {object} ErrorResponse "error: Server error"
// @Router /batch/{batch_header_hash} [get]
// @Router /batches/{batch_header_hash} [get]
func (s *ServerV2) FetchBatchHandler(c *gin.Context) {
start := time.Now()
batchHeaderHashHex := c.Param("batch_header_hash")
Expand Down
8 changes: 4 additions & 4 deletions disperser/dataapi/server_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ func TestFetchBlobHandlerV2(t *testing.T) {
require.NoError(t, err)
require.NoError(t, err)

r.GET("/v2/blob/:blob_key", testDataApiServerV2.FetchBlobHandler)
r.GET("/v2/blobs/:blob_key", testDataApiServerV2.FetchBlobHandler)
w := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodGet, "/v2/blob/"+blobKey.Hex(), nil)
req := httptest.NewRequest(http.MethodGet, "/v2/blobs/"+blobKey.Hex(), nil)
r.ServeHTTP(w, req)
res := w.Result()
defer res.Body.Close()
Expand Down Expand Up @@ -232,9 +232,9 @@ func TestFetchBatchHandlerV2(t *testing.T) {
err = blobMetadataStore.PutAttestation(context.Background(), attestation)
require.NoError(t, err)

r.GET("/v2/batch/:batch_header_hash", testDataApiServerV2.FetchBatchHandler)
r.GET("/v2/batches/:batch_header_hash", testDataApiServerV2.FetchBatchHandler)
w := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodGet, "/v2/batch/"+batchHeaderHash, nil)
req := httptest.NewRequest(http.MethodGet, "/v2/batches/"+batchHeaderHash, nil)
r.ServeHTTP(w, req)
res := w.Result()
defer res.Body.Close()
Expand Down
2 changes: 1 addition & 1 deletion tools/kzgpad/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ clean:

build: clean
go mod tidy
go build -o ./bin/kzgpad ./cmd
go build -o ./bin/kzgpad .
File renamed without changes.

0 comments on commit 1db5031

Please sign in to comment.