Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DA: EigenDA integration #218

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions cmd/run_xlayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/0xPolygonHermez/zkevm-node/config/apollo"
"github.com/0xPolygonHermez/zkevm-node/dataavailability"
"github.com/0xPolygonHermez/zkevm-node/dataavailability/datacommittee"
"github.com/0xPolygonHermez/zkevm-node/dataavailability/eigenda"
"github.com/0xPolygonHermez/zkevm-node/etherman"
"github.com/0xPolygonHermez/zkevm-node/ethtxmanager"
"github.com/0xPolygonHermez/zkevm-node/event"
Expand Down Expand Up @@ -123,6 +124,19 @@ func newDataAvailability(c config.Config, st *state.State, etherman *etherman.Cl
if err != nil {
return nil, err
}
case string(dataavailability.DataAvailabilityEigenDA):
var (
pk *ecdsa.PrivateKey
err error
)
if isSequenceSender {
_, pk, err = etherman.LoadAuthFromKeyStoreXLayer(c.SequenceSender.DAPermitApiPrivateKey.Path, c.SequenceSender.DAPermitApiPrivateKey.Password)
if err != nil {
return nil, err
}
log.Infof("from pk %s", crypto.PubkeyToAddress(pk.PublicKey))
}
daBackend = eigenda.NewDataAvailabilityProvider(c.DataAvailability)
default:
return nil, fmt.Errorf("unexpected / unsupported DA protocol: %s", daProtocolName)
}
Expand Down
3 changes: 3 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/0xPolygonHermez/zkevm-node/aggregator"
"github.com/0xPolygonHermez/zkevm-node/config/types"
"github.com/0xPolygonHermez/zkevm-node/dataavailability"
"github.com/0xPolygonHermez/zkevm-node/db"
"github.com/0xPolygonHermez/zkevm-node/etherman"
"github.com/0xPolygonHermez/zkevm-node/ethtxmanager"
Expand Down Expand Up @@ -102,6 +103,8 @@ type Config struct {
SequenceSender sequencesender.Config
// Configuration of the aggregator service
Aggregator aggregator.Config
// Configuration of the data availability service
DataAvailability dataavailability.Config
// Configuration of the genesis of the network. This is used to known the initial state of the network
NetworkConfig NetworkConfig
// Configuration of the gas price suggester service
Expand Down
8 changes: 8 additions & 0 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,14 @@ AggLayerTxTimeout = "5m"
AggLayerURL = ""
SequencerPrivateKey = {}

[DataAvailability]
Hostname = "disperser-holesky.eigenda.xyz"
Port = 443
Timeout = "30s"
UseSecureGrpcFlag = true
RetrieveBlobStatusPeriod = "5s"
BlobStatusConfirmedTimeout = "15m"

[L2GasPriceSuggester]
Type = "follower"
UpdatePeriod = "10s"
Expand Down
8 changes: 8 additions & 0 deletions config/environments/local/local.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ GeneratingProofCleanupThreshold = "10m"
UpgradeEtrogBatchNumber = 0
BatchProofL1BlockConfirmations = 2

[DataAvailability]
Hostname = "disperser-holesky.eigenda.xyz"
Port = 443
Timeout = "30s"
UseSecureGrpcFlag = true
RetrieveBlobStatusPeriod = "5s"
BlobStatusConfirmedTimeout = "15m"

[EthTxManager]
ForcedGas = 0
PrivateKeys = [
Expand Down
8 changes: 8 additions & 0 deletions config/environments/mainnet/node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ SyncInterval = "2s"
SyncChunkSize = 100
TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc

[DataAvailability]
Hostname = "disperser-holesky.eigenda.xyz"
Port = 443
Timeout = "30s"
UseSecureGrpcFlag = true
RetrieveBlobStatusPeriod = "5s"
BlobStatusConfirmedTimeout = "15m"

[MTClient]
URI = "zkevm-prover:50061"

Expand Down
14 changes: 14 additions & 0 deletions dataavailability/config.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
package dataavailability

import "github.com/0xPolygonHermez/zkevm-node/config/types"

// DABackendType is the data availability protocol for the CDK
type DABackendType string

const (
// DataAvailabilityCommittee is the DAC protocol backend
DataAvailabilityCommittee DABackendType = "DataAvailabilityCommittee"
// DataAvailabilityEigenDA is the EigenDA protocol backend
DataAvailabilityEigenDA DABackendType = "EigenDA"
)

// Config is the EigenDA network config
type Config struct {
Hostname string `mapstructure:"Hostname"`
Port string `mapstructure:"Port"`
Timeout types.Duration `mapstructure:"Timeout"`
UseSecureGrpcFlag bool `mapstructure:"UseSecureGrpcFlag"`
RetrieveBlobStatusPeriod types.Duration `mapstructure:"RetrieveBlobStatusPeriod"`
BlobStatusConfirmedTimeout types.Duration `mapstructure:"BlobStatusConfirmedTimeout"`
}
2 changes: 1 addition & 1 deletion dataavailability/datacommittee/datacommittee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func newSimulatedDacman(t *testing.T, auth *bind.TransactOpts) (
// 10000000 ETH in wei
balance, _ := new(big.Int).SetString("10000000000000000000000000", 10) //nolint:gomnd
address := auth.From
genesisAlloc := map[common.Address]core.GenesisAccount{
genesisAlloc := map[common.Address]core.GenesisAccount{ //nolint:staticcheck
address: {
Balance: balance,
},
Expand Down
171 changes: 171 additions & 0 deletions dataavailability/eigenda/abi.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
package eigenda

const blobDataABI = `[
{
"type": "function",
"name": "BlobData",
"inputs": [
{
"name": "blobData",
"type": "tuple",
"internalType": "struct EigenDAVerifier.BlobData",
"components": [
{
"name": "blobHeader",
"type": "tuple",
"internalType": "struct IEigenDAServiceManager.BlobHeader",
"components": [
{
"name": "commitment",
"type": "tuple",
"internalType": "struct BN254.G1Point",
"components": [
{
"name": "X",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "Y",
"type": "uint256",
"internalType": "uint256"
}
]
},
{
"name": "dataLength",
"type": "uint32",
"internalType": "uint32"
},
{
"name": "quorumBlobParams",
"type": "tuple[]",
"internalType": "struct IEigenDAServiceManager.QuorumBlobParam[]",
"components": [
{
"name": "quorumNumber",
"type": "uint8",
"internalType": "uint8"
},
{
"name": "adversaryThresholdPercentage",
"type": "uint8",
"internalType": "uint8"
},
{
"name": "confirmationThresholdPercentage",
"type": "uint8",
"internalType": "uint8"
},
{
"name": "chunkLength",
"type": "uint32",
"internalType": "uint32"
}
]
}
]
},
{
"name": "blobVerificationProof",
"type": "tuple",
"internalType": "struct EigenDARollupUtils.BlobVerificationProof",
"components": [
{
"name": "batchId",
"type": "uint32",
"internalType": "uint32"
},
{
"name": "blobIndex",
"type": "uint32",
"internalType": "uint32"
},
{
"name": "batchMetadata",
"type": "tuple",
"internalType": "struct IEigenDAServiceManager.BatchMetadata",
"components": [
{
"name": "batchHeader",
"type": "tuple",
"internalType": "struct IEigenDAServiceManager.BatchHeader",
"components": [
{
"name": "blobHeadersRoot",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "quorumNumbers",
"type": "bytes",
"internalType": "bytes"
},
{
"name": "signedStakeForQuorums",
"type": "bytes",
"internalType": "bytes"
},
{
"name": "referenceBlockNumber",
"type": "uint32",
"internalType": "uint32"
}
]
},
{
"name": "signatoryRecordHash",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "confirmationBlockNumber",
"type": "uint32",
"internalType": "uint32"
}
]
},
{
"name": "inclusionProof",
"type": "bytes",
"internalType": "bytes"
},
{
"name": "quorumIndices",
"type": "bytes",
"internalType": "bytes"
}
]
}
]
}
],
"stateMutability": "pure"
}
]`

const batchHeaderABI = `[
{
"type": "function",
"name": "ReducedBatchHeader",
"inputs": [
{
"name": "batchHeader",
"type": "tuple",
"internalType": "struct IEigenDAServiceManager.BatchHeader",
"components": [
{
"name": "blobHeadersRoot",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "referenceBlockNumber",
"type": "uint32",
"internalType": "uint32"
}
]
}
]
}
]`
Loading