Skip to content
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
34e73cb
initial implementation of the blacklist addition
May 21, 2025
1c0d36b
adding the blacklist struct and funcs
May 21, 2025
a06a450
checking if the blacklist was hit or not
May 21, 2025
17bbddb
changing to use disperser id
May 22, 2025
3f96d9c
removing api
May 22, 2025
09626e6
add explicit flags
May 22, 2025
f56bf17
fixing naming
May 22, 2025
eb77485
small changes
May 22, 2025
86d9126
adding basic unit tests
anupsv May 27, 2025
8f9d527
interfaces and comments
anupsv May 27, 2025
e08f06a
small changes, logs
anupsv May 27, 2025
e3cec98
fixing mock calls
anupsv May 27, 2025
c602f80
linter fix
anupsv May 27, 2025
0c9a7be
adding more test
anupsv May 27, 2025
375b817
naming fix
anupsv May 27, 2025
118c972
testing validator e2e
anupsv Jun 2, 2025
4bcdc62
Merge branch 'master' into validator-blacklisting
anupsv Jun 3, 2025
1ddc7b7
adding latest block
anupsv Jun 3, 2025
8646055
unmerged
anupsv Jun 3, 2025
90499ff
getting test working
anupsv Jun 4, 2025
42d9288
final all parts tested
anupsv Jun 4, 2025
9e41318
Merge branch 'master' into validator-blacklisting
anupsv Jun 5, 2025
e74c5d5
Merge branch 'master' into validator-blacklisting
anupsv Jun 9, 2025
ac0a119
Update golangci-lint.yml
anupsv Jun 10, 2025
b57ff74
Update kms_fuzz_test.go
anupsv Jun 10, 2025
5a42ace
Update config.go
anupsv Jun 10, 2025
8e16b11
Merge branch 'master' into validator-blacklisting
anupsv Jun 10, 2025
ad2b514
adding cleanup
anupsv Jun 10, 2025
0cc5f16
merge conflict fixes
anupsv Jun 10, 2025
cc55cd1
clean up, comments and old tests
anupsv Jun 10, 2025
0119cde
adding deletions after 2 weeks
anupsv Jun 10, 2025
f39b482
fixing share state problem in tests
anupsv Jun 10, 2025
6a470dd
fixing test
anupsv Jun 10, 2025
c029044
cleanup of test
anupsv Jun 10, 2025
fd444a2
Merge branch 'master' into validator-blacklisting
anupsv Jun 17, 2025
fe118ce
Merge branch 'master' into validator-blacklisting
anupsv Jun 17, 2025
500311b
Merge branch 'master' into validator-blacklisting
anupsv Jun 18, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/buf-proto.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #4.2.2
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,24 @@ jobs:
name: Linter
runs-on: ubuntu-latest
steps:
<<<<<<< Updated upstream
- name: Checkout EigenDA
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #4.2.2

- uses: jdx/mise-action@v2
=======
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 #5.3.0
>>>>>>> Stashed changes
with:
version: ${{ env.MISE_VERSION }}
experimental: true
- run: go version

<<<<<<< Updated upstream
- run: make lint
=======
- name: Checkout EigenDA
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #4.2.2
>>>>>>> Stashed changes

- run: make fmt-check
2 changes: 1 addition & 1 deletion common/aws/kms_fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func generateValidSignature() (*ecdsa.PublicKey, []byte, []byte, error) {

// Define a message and compute its SHA-256 hash.
message := "Test message for ECDSA signature"
hash := sha256.Sum256([]byte(message))
hash := 56.Sum256([]byte(message))

// Sign the hash using the private key.
signatureBytes, err := crypto.Sign(hash[:], privateKey)
Expand Down
1 change: 1 addition & 0 deletions inabox/deploy/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ func (env *Config) GenerateAllVariables() {
if err != nil {
log.Panicf("Error: %s", err.Error())
}
fmt.Println("composeFile", string(composeFile))
writeFile(composeFile, composeYaml)
}
}
1 change: 0 additions & 1 deletion inabox/tests/integration_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ var _ = BeforeSuite(func() {

fmt.Println("Deploying experiment")
testConfig.DeployExperiment()

pk := testConfig.Pks.EcdsaMap[deployer.Name].PrivateKey
pk = strings.TrimPrefix(pk, "0x")
pk = strings.TrimPrefix(pk, "0X")
Expand Down
187 changes: 185 additions & 2 deletions inabox/tests/integration_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,198 @@ import (
"encoding/hex"
"fmt"

"github.com/Layr-Labs/eigenda/api/clients/v2/coretypes"
"github.com/Layr-Labs/eigenda/api"
"github.com/Layr-Labs/eigenda/encoding"
"github.com/Layr-Labs/eigenda/encoding/utils/codec"
"github.com/docker/go-units"
"google.golang.org/grpc"

dispv2 "github.com/Layr-Labs/eigenda/disperser/common/v2"

"github.com/Layr-Labs/eigenda/api/clients/v2"
"github.com/Layr-Labs/eigenda/api/clients/v2/relay"
commonpb "github.com/Layr-Labs/eigenda/api/grpc/common/v2"
disperserpb "github.com/Layr-Labs/eigenda/api/grpc/disperser/v2"
nodegrpc "github.com/Layr-Labs/eigenda/api/grpc/validator"
"github.com/Layr-Labs/eigenda/api/hashing"
verifierbindings "github.com/Layr-Labs/eigenda/contracts/bindings/EigenDACertVerifierV2"
"github.com/Layr-Labs/eigenda/core"

aws2 "github.com/Layr-Labs/eigenda/common/aws"
caws "github.com/Layr-Labs/eigenda/common/aws"
auth "github.com/Layr-Labs/eigenda/core/auth/v2"
corev2 "github.com/Layr-Labs/eigenda/core/v2"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/kms"
"github.com/consensys/gnark-crypto/ecc/bn254"
"github.com/consensys/gnark-crypto/ecc/bn254/fr"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
gethcommon "github.com/ethereum/go-ethereum/common"
"github.com/Layr-Labs/eigenda/api/clients/codecs"
"github.com/Layr-Labs/eigenda/api/clients/v2/coretypes"
"golang.org/x/crypto/sha3"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

func RandomG1Point() (encoding.G1Commitment, error) {
// 1) pick r ← 𝐹ᵣ at random
var r fr.Element
if _, err := r.SetRandom(); err != nil {
return encoding.G1Commitment{}, err
}

// 2) compute P = r·G₁ in Jacobian form
G1Jac, _, _, _ := bn254.Generators()
var Pjac bn254.G1Jac

var rBigInt big.Int
r.BigInt(&rBigInt)
Pjac.ScalarMultiplication(&G1Jac, &rBigInt)

// 3) convert to affine (x, y)
var Paff bn254.G1Affine
Paff.FromJacobian(&Pjac)
return encoding.G1Commitment(Paff), nil
}

func RandomG2Point() (encoding.G2Commitment, error) {

// 1) pick r ← 𝐹ᵣ at random
var r fr.Element
if _, err := r.SetRandom(); err != nil {
return encoding.G2Commitment{}, err
}

// 2) compute P = r·G₂ in Jacobian form
_, g2Jac, _, _ := bn254.Generators()
var Pjac bn254.G2Jac

var rBigInt big.Int
r.BigInt(&rBigInt)
Pjac.ScalarMultiplication(&g2Jac, &rBigInt)

// 3) convert to affine (x, y)
var Paff bn254.G2Affine
Paff.FromJacobian(&Pjac)
return encoding.G2Commitment(Paff), nil
}

var _ = Describe("Inabox v2 blacklisting Integration test", func() {
It("test end to end scenario of blacklisting", func() {
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()

// random G1 point
g1Commitment, err := RandomG1Point()
if err != nil {
Fail("failed to generate random G1 point")
}

g2Commitment, err := RandomG2Point()
if err != nil {
Fail("failed to generate random G2 point")
}

// random data blob certificate
blobCert := &corev2.BlobCertificate{
BlobHeader: &corev2.BlobHeader{
BlobVersion: 2,
BlobCommitments: encoding.BlobCommitments{
Commitment: &g1Commitment,
LengthCommitment: &g2Commitment,
LengthProof: &g2Commitment,
Length: 100,
},
QuorumNumbers: []core.QuorumID{0, 1},
PaymentMetadata: core.PaymentMetadata{
AccountID: gethcommon.HexToAddress("0x1234567890123456789012345678901234567890"),
Timestamp: time.Now().UnixNano(),
CumulativePayment: big.NewInt(100),
},
},
Signature: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65},
RelayKeys: []corev2.RelayKey{0, 1},
}

blobCertProto, err := blobCert.ToProtobuf()
if err != nil {
Fail("failed to convert blob certificate to protobuf")
}
fmt.Println("blobCertProto size", len(blobCertProto.String()))

mineAnvilBlocks(1)
// println("latest block number", deploy.GetLatestBlockNumber("http://localhost:8545"))

request := &nodegrpc.StoreChunksRequest{
Batch: &commonpb.Batch{
Header: &commonpb.BatchHeader{
BatchRoot: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32},
ReferenceBlockNumber: 70,
},
BlobCertificates: []*commonpb.BlobCertificate{
blobCertProto,
},
},
DisperserID: api.EigenLabsDisperserID,
Timestamp: uint32(time.Now().Unix()),
Signature: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65},
}

hash, err := hashing.HashStoreChunksRequest(request)
if err != nil {
Fail("failed to hash request")
}

keyManager := kms.New(kms.Options{
Region: "us-east-1",
BaseEndpoint: aws.String("http://localhost:4570"),
})

// pick the first key in the key manager
keys, err := keyManager.ListKeys(ctx, &kms.ListKeysInput{})
if err != nil {
Fail("failed to list keys")
}
keyID := keys.Keys[0].KeyId

publicKey, err := caws.LoadPublicKeyKMS(ctx, keyManager, *keyID)
if err != nil {
Fail("failed to load public key")
}

signature, err := aws2.SignKMS(ctx, keyManager, *keyID, publicKey, hash)
if err != nil {
Fail("failed to sign request")
}

request.Signature = signature

addr := fmt.Sprintf("%v:%v", "localhost", "32017")
dialOptions := clients.GetGrpcDialOptions(false, 4*units.MiB)
// conn, err := grpc.NewClient(addr, dialOptions...)
// if err != nil {
// Fail("failed to create grpc connection")
// }
conn, err := grpc.NewClient(addr, dialOptions...)
if err != nil {
Fail("failed to create grpc connection")
}
dispersalClient := nodegrpc.NewDispersalClient(conn)

// after this request, the disperser should be blacklisted
_, err = dispersalClient.StoreChunks(ctx, request)
Expect(err).To(Not(BeNil()))
Expect(err.Error()).To(ContainSubstring("failed to validate blob request"))

// should get error saying disperser is blacklisted
_, err = dispersalClient.StoreChunks(ctx, request)
Expect(err).To(Not(BeNil()))
Expect(err.Error()).To(ContainSubstring("disperser is blacklisted"))

})
})

var _ = Describe("Inabox v2 Integration", func() {
/*
This end to end test ensures that:
Expand Down
50 changes: 50 additions & 0 deletions node/blacklist.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// This file contains the structs which are converted to JSON and stored in the blacklist store

package node

import (
"encoding/json"
"time"
)

// Blacklist contains entries of blacklisted dispersers
type Blacklist struct {
Entries []BlacklistEntry `json:"entries"`
LastUpdated uint64 `json:"last_updated"`
}

// BlacklistEntry represents a single blacklist record
type BlacklistEntry struct {
DisperserID uint32 `json:"disperser_id"`
Metadata BlacklistMetadata `json:"metadata"`
Timestamp uint64 `json:"timestamp"`
}

// BlacklistMetadata contains additional information about the blacklisting
type BlacklistMetadata struct {
ContextId string `json:"context_id"`
Reason string `json:"reason"`
}

// ToBytes serializes the Blacklist to JSON bytes
func (b *Blacklist) ToBytes() ([]byte, error) {
return json.Marshal(b)
}

// FromBytes deserializes JSON bytes into the current Blacklist
func (b *Blacklist) FromBytes(data []byte) error {
return json.Unmarshal(data, b)
}

// AddEntry adds a new blacklist entry
func (b *Blacklist) AddEntry(disperserId uint32, contextId, reason string) {
b.LastUpdated = uint64(time.Now().Unix())
b.Entries = append(b.Entries, BlacklistEntry{
DisperserID: disperserId,
Metadata: BlacklistMetadata{
ContextId: contextId,
Reason: reason,
},
Timestamp: b.LastUpdated,
})
}
Loading
Loading