Skip to content

Commit 2882c13

Browse files
authored
feat: eth client address directory (#1691)
* feat: integrate address directory to eth reader - Add NewReaderWithAddressDirectory() for address directory-based initialization - ContractNames constants matching AddressDirectoryConstants.sol - optional AddressDirectoryFlag, BlsOperatorStateRetrieverFlag, and EigenDAServiceManagerFlag - validation to require either address directory OR both legacy flags - backward compatibility for existing deployments without address directory * feat: fix BLS_OPERATOR_STATE_RETRIEVER typo * refactor: config valid check, interface binding, getAddress0 * fix: check zero addr, rm unused binding, err msg * feat: address directory reader * refactor: abstract the getter * rebase: master; add check of contract names * refactor: remove old new eth reader/writer method * refactor: update flags and configs for address dir * fix: chuner config lint * fix: more lints * fix: more lints * fix: inabox config * refactor(ethClient): comment cleanup * refactor(EigenDADirectory): update names and validation * refactor(EigenDADirectory): always get latest list of contract names * fix(EigenDADirectory): add service manager flag back to retreiver * refactor(proxy): add address directory config * refactor(proxy): add address directory config in test setup * refactor(EigenDADirectory): rename more address directory to eigenda directory * refactor(EigenDADirectory): more renaming * fix(EigenDADirectory): relay inabox config * fix(EigenDADirectory): add back flags and configs * fix(EigenDADirectory): add back flags and configs * fix(EigenDADirectory): inabox config * fix(EigenDADirectory): make all three flags optional * chore(proxy): gen-static-help-output * refactor(EigenDADirectory): help msgs
1 parent 7ac688d commit 2882c13

File tree

62 files changed

+1298
-134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1298
-134
lines changed

api/clients/v2/examples/client_construction.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,16 @@ import (
2828
// These constants are specific to the EigenDA holesky testnet. To execute the provided examples on a different
2929
// network, you will need to set these constants to the correct values, based on the chosen network.
3030
const (
31-
ethRPCURL = "https://ethereum-holesky-rpc.publicnode.com"
32-
disperserHostname = "disperser-testnet-holesky.eigenda.xyz"
33-
certVerifierRouterAddress = "0x7F40A8e1B62aa1c8Afed23f6E8bAe0D340A4BC4e"
34-
registryCoordinatorAddress = "0x53012C69A189cfA2D9d29eb6F19B32e0A2EA3490"
31+
ethRPCURL = "https://ethereum-holesky-rpc.publicnode.com"
32+
disperserHostname = "disperser-testnet-holesky.eigenda.xyz"
33+
certVerifierRouterAddress = "0x7F40A8e1B62aa1c8Afed23f6E8bAe0D340A4BC4e"
34+
registryCoordinatorAddress = "0x53012C69A189cfA2D9d29eb6F19B32e0A2EA3490"
35+
// To build Eth Client
36+
eigendaDirectoryAddress = "0x90776Ea0E99E4c38aA1Efe575a61B3E40160A2FE"
37+
// These two addresses are no longer required for the Eth Client, but parameter is still being taken until we deprecate the flags
38+
eigenDAServiceManagerAddress = ""
39+
// blsOperatorStateRetrieverAddress is still used for CertBuilder
3540
blsOperatorStateRetrieverAddress = "0x003497Dd77E5B73C40e8aCbB562C8bb0410320E7"
36-
eigenDAServiceManagerAddress = "0xD4A7E1Bd8015057293f0D0A557088c286942e84b"
3741
)
3842

3943
func createPayloadDisperser(privateKey string) (*payloaddispersal.PayloadDisperser, error) {
@@ -332,6 +336,7 @@ func createEthReader(logger logging.Logger, ethClient common.EthClient) (*eth.Re
332336
ethReader, err := eth.NewReader(
333337
logger,
334338
ethClient,
339+
eigendaDirectoryAddress,
335340
blsOperatorStateRetrieverAddress,
336341
eigenDAServiceManagerAddress,
337342
)

api/proxy/common/client_config_v2.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type ClientConfigV2 struct {
3737
// Fields required for validator payload retrieval
3838
BLSOperatorStateRetrieverAddr string
3939
EigenDAServiceManagerAddr string
40+
EigenDADirectory string
4041

4142
// Allowed distance (in L1 blocks) between the eigenDA cert's reference block number (RBN)
4243
// and the L1 block number at which the cert was included in the rollup's batch inbox.
@@ -77,6 +78,10 @@ func (cfg *ClientConfigV2) Check() error {
7778
}
7879

7980
if slices.Contains(cfg.RetrieversToEnable, ValidatorRetrieverType) {
81+
if cfg.EigenDADirectory == "" {
82+
return fmt.Errorf("EigenDA directory is required for validator retrieval in EigenDA V2 backend")
83+
}
84+
8085
if cfg.BLSOperatorStateRetrieverAddr == "" {
8186
return fmt.Errorf(
8287
"BLS operator state retriever address is required for validator retrieval in EigenDA V2 backend")

api/proxy/common/eigenda_network.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ const (
1010
SepoliaTestnetEigenDANetwork EigenDANetwork = "sepolia_testnet"
1111
)
1212

13+
// GetEigenDADirectory returns, as a string, the address of the EigenDADirectory contract for the network.
14+
func (n EigenDANetwork) GetEigenDADirectory() (string, error) {
15+
switch n {
16+
case HoleskyTestnetEigenDANetwork:
17+
return "0x90776Ea0E99E4c38aA1Efe575a61B3E40160A2FE", nil
18+
case HoleskyPreprodEigenDANetwork:
19+
return "0xfB676e909f376efFDbDee7F17342aCF55f6Ec502", nil
20+
case SepoliaTestnetEigenDANetwork:
21+
return "0x9620dC4B3564198554e4D2b06dEFB7A369D90257", nil
22+
default:
23+
return "", fmt.Errorf("unknown network type: %s", n)
24+
}
25+
}
26+
1327
// GetServiceManagerAddress returns, as a string, the address of the EigenDAServiceManager contract for the network.
1428
func (n EigenDANetwork) GetServiceManagerAddress() (string, error) {
1529
switch n {

api/proxy/config/v2/eigendaflags/cli.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ var (
2929
)
3030
ServiceManagerAddrFlagName = withFlagPrefix("service-manager-addr")
3131
BLSOperatorStateRetrieverFlagName = withFlagPrefix("bls-operator-state-retriever-addr")
32+
EigenDADirectoryFlagName = withFlagPrefix("eigenda-directory")
3233
RelayTimeoutFlagName = withFlagPrefix("relay-timeout")
3334
ValidatorTimeoutFlagName = withFlagPrefix("validator-timeout")
3435
ContractCallTimeoutFlagName = withFlagPrefix("contract-call-timeout")
@@ -118,18 +119,25 @@ func CLIFlags(envPrefix, category string) []cli.Flag {
118119
},
119120
&cli.StringFlag{
120121
Name: ServiceManagerAddrFlagName,
121-
Usage: "Address of the EigenDA service manager contract.",
122+
Usage: "[Deprecated: use EigenDADirectory instead] Address of the EigenDA Service Manager contract.",
122123
EnvVars: []string{withEnvPrefix(envPrefix, "SERVICE_MANAGER_ADDR")},
123124
Category: category,
124125
Required: false,
125126
},
126127
&cli.StringFlag{
127128
Name: BLSOperatorStateRetrieverFlagName,
128-
Usage: "Address of the BLS operator state retriever contract.",
129+
Usage: "[Deprecated: use EigenDADirectory instead] Address of the BLS operator state retriever contract.",
129130
EnvVars: []string{withEnvPrefix(envPrefix, "BLS_OPERATOR_STATE_RETRIEVER_ADDR")},
130131
Category: category,
131132
Required: false,
132133
},
134+
&cli.StringFlag{
135+
Name: EigenDADirectoryFlagName,
136+
Usage: "Address of the EigenDA directory contract, which points to all other EigenDA contract addresses. This is the only contract entrypoint needed offchain..",
137+
EnvVars: []string{withEnvPrefix(envPrefix, "EIGENDA_DIRECTORY")},
138+
Category: category,
139+
Required: false,
140+
},
133141
&cli.DurationFlag{
134142
Name: ContractCallTimeoutFlagName,
135143
Usage: "Timeout used when performing smart contract call operation (i.e, eth_call).",
@@ -234,6 +242,15 @@ func ReadClientConfigV2(ctx *cli.Context) (common.ClientConfigV2, error) {
234242
}
235243
}
236244

245+
eigenDADirectory := ctx.String(EigenDADirectoryFlagName)
246+
if eigenDADirectory == "" {
247+
eigenDADirectory, err = eigenDANetwork.GetEigenDADirectory()
248+
if err != nil {
249+
return common.ClientConfigV2{}, fmt.Errorf(
250+
"service manager address wasn't specified, and failed to get it from the specified network: %w", err)
251+
}
252+
}
253+
237254
serviceManagerAddress := ctx.String(ServiceManagerAddrFlagName)
238255
if serviceManagerAddress == "" {
239256
serviceManagerAddress, err = eigenDANetwork.GetServiceManagerAddress()
@@ -271,6 +288,7 @@ func ReadClientConfigV2(ctx *cli.Context) (common.ClientConfigV2, error) {
271288
BLSOperatorStateRetrieverAddr: blsOperatorStateRetrieverAddress,
272289
EigenDACertVerifierOrRouterAddress: ctx.String(CertVerifierRouterOrImmutableVerifierAddrFlagName),
273290
EigenDAServiceManagerAddr: serviceManagerAddress,
291+
EigenDADirectory: eigenDADirectory,
274292
RBNRecencyWindowSize: ctx.Uint64(RBNRecencyWindowSizeFlagName),
275293
EigenDANetwork: eigenDANetwork,
276294
}, nil

api/proxy/docs/help_out.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,14 @@ GLOBAL OPTIONS:
5555
--eigenda.v2.blob-status-poll-interval value Duration to query for blob status updates during dispersal. (default: 1s) [$EIGENDA_PROXY_EIGENDA_V2_BLOB_STATUS_POLL_INTERVAL]
5656
--eigenda.v2.blob-version value Blob params version used when dispersing. This refers to a global version maintained by EigenDA
5757
governance and is injected in the BlobHeader before dispersing. Currently only supports (0). (default: 0) [$EIGENDA_PROXY_EIGENDA_V2_BLOB_PARAMS_VERSION]
58-
--eigenda.v2.bls-operator-state-retriever-addr value Address of the BLS operator state retriever contract. [$EIGENDA_PROXY_EIGENDA_V2_BLS_OPERATOR_STATE_RETRIEVER_ADDR]
58+
--eigenda.v2.bls-operator-state-retriever-addr value [Deprecated: use EigenDADirectory instead] Address of the BLS operator state retriever contract. [$EIGENDA_PROXY_EIGENDA_V2_BLS_OPERATOR_STATE_RETRIEVER_ADDR]
5959
--eigenda.v2.cert-verifier-router-or-immutable-verifier-addr value Address of either the EigenDACertVerifierRouter or immutable EigenDACertVerifier contract. Required for performing eth_calls to verify EigenDA certificates. [$EIGENDA_PROXY_EIGENDA_V2_CERT_VERIFIER_ROUTER_OR_IMMUTABLE_VERIFIER_ADDR]
6060
--eigenda.v2.contract-call-timeout value Timeout used when performing smart contract call operation (i.e, eth_call). (default: 10s) [$EIGENDA_PROXY_EIGENDA_V2_CONTRACT_CALL_TIMEOUT]
6161
--eigenda.v2.disable-point-evaluation Disables IFFT transformation done during payload encoding. Using this mode results in blobs that can't be proven. (default: false) [$EIGENDA_PROXY_EIGENDA_V2_DISABLE_POINT_EVALUATION]
6262
--eigenda.v2.disable-tls Disable TLS for gRPC communication with the EigenDA disperser and retrieval subnet. (default: false) [$EIGENDA_PROXY_EIGENDA_V2_GRPC_DISABLE_TLS]
6363
--eigenda.v2.disperse-blob-timeout value Maximum amount of time to wait for a blob to disperse against v2 protocol. (default: 2m0s) [$EIGENDA_PROXY_EIGENDA_V2_DISPERSE_BLOB_TIMEOUT]
6464
--eigenda.v2.disperser-rpc value RPC endpoint of the EigenDA disperser. [$EIGENDA_PROXY_EIGENDA_V2_DISPERSER_RPC]
65+
--eigenda.v2.eigenda-directory value Address of the EigenDA directory contract, which points to all other EigenDA contract addresses. This is the only contract entrypoint needed offchain.. [$EIGENDA_PROXY_EIGENDA_V2_EIGENDA_DIRECTORY]
6566
--eigenda.v2.eth-rpc value URL of the Ethereum RPC endpoint. [$EIGENDA_PROXY_EIGENDA_V2_ETH_RPC]
6667
--eigenda.v2.max-blob-length value Maximum blob length to be written or read from EigenDA. Determines the number of SRS points
6768
loaded into memory for KZG commitments. Example units: '30MiB', '4Kb', '30MB'. Maximum size
@@ -78,7 +79,7 @@ in the rollup's batch inbox. A cert is valid when cert.RBN < certL1InclusionBloc
7879
and otherwise is considered stale and verification will fail, and a 418 HTTP error will be returned.
7980
This check is optional and will be skipped when set to 0. (default: 0) [$EIGENDA_PROXY_EIGENDA_V2_RBN_RECENCY_WINDOW_SIZE]
8081
--eigenda.v2.relay-timeout value Timeout used when querying an individual relay for blob contents. (default: 10s) [$EIGENDA_PROXY_EIGENDA_V2_RELAY_TIMEOUT]
81-
--eigenda.v2.service-manager-addr value Address of the EigenDA service manager contract. [$EIGENDA_PROXY_EIGENDA_V2_SERVICE_MANAGER_ADDR]
82+
--eigenda.v2.service-manager-addr value [Deprecated: use EigenDADirectory instead] Address of the EigenDA Service Manager contract. [$EIGENDA_PROXY_EIGENDA_V2_SERVICE_MANAGER_ADDR]
8283
--eigenda.v2.signer-payment-key-hex value Hex-encoded signer private key. Used for authorizing payments with EigenDA disperser. Should not be associated with an Ethereum address holding any funds. [$EIGENDA_PROXY_EIGENDA_V2_SIGNER_PRIVATE_KEY_HEX]
8384
--eigenda.v2.validator-timeout value Timeout used when retrieving chunks directly from EigenDA validators. This is a secondary retrieval method, in case retrieval from the relay network fails. (default: 2m0s) [$EIGENDA_PROXY_EIGENDA_V2_VALIDATOR_TIMEOUT]
8485

api/proxy/store/builder/config_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ func validCfg() Config {
7070
MaxBlobSizeBytes: maxBlobLengthBytes,
7171
BLSOperatorStateRetrieverAddr: "0x000000000004324311",
7272
EigenDAServiceManagerAddr: "0x000000000005324322",
73+
EigenDADirectory: "0x000000000006324333",
7374
RetrieversToEnable: []common.RetrieverType{
7475
common.RelayRetrieverType,
7576
common.ValidatorRetrieverType,

api/proxy/store/builder/storage_manager_builder.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ func buildEthReader(log logging.Logger,
521521
ethReader, err := eth.NewReader(
522522
log,
523523
ethClient,
524+
clientConfigV2.EigenDADirectory,
524525
clientConfigV2.BLSOperatorStateRetrieverAddr,
525526
clientConfigV2.EigenDAServiceManagerAddr,
526527
)

api/proxy/test/testutils/setup.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,19 @@ const (
4747
preprodCertVerifierAddress = "0xCCFE3d87fB7D369f1eeE65221a29A83f1323043C"
4848
preprodSvcManagerAddress = "0x54A03db2784E3D0aCC08344D05385d0b62d4F432"
4949
preprodBLSOperatorStateRetrieverAddress = "0x003497Dd77E5B73C40e8aCbB562C8bb0410320E7"
50+
preprodEigenDADirectory = "0xfB676e909f376efFDbDee7F17342aCF55f6Ec502"
5051

5152
disperserTestnetHostname = "disperser-testnet-holesky.eigenda.xyz"
5253
testnetCertVerifierAddress = "0xd305aeBcdEc21D00fDF8796CE37d0e74836a6B6e"
5354
testnetSvcManagerAddress = "0xD4A7E1Bd8015057293f0D0A557088c286942e84b"
5455
testnetBLSOperatorStateRetrieverAddress = "0x003497Dd77E5B73C40e8aCbB562C8bb0410320E7"
56+
testnetEigenDADirectory = "0x90776Ea0E99E4c38aA1Efe575a61B3E40160A2FE"
5557

5658
disperserSepoliaHostname = "disperser-testnet-sepolia.eigenda.xyz"
5759
sepoliaCertVerifierAddress = "0x58D2B844a894f00b7E6F9F492b9F43aD54Cd4429"
5860
sepoliaSvcManagerAddress = "0x3a5acf46ba6890B8536420F4900AC9BC45Df4764"
5961
sepoliaBLSOperatorStateRetrieverAddress = "0x22478d082E9edaDc2baE8443E4aC9473F6E047Ff"
62+
sepoliaEigenDADirectory = "0x9620dC4B3564198554e4D2b06dEFB7A369D90257"
6063
)
6164

6265
var (
@@ -263,6 +266,7 @@ func BuildTestSuiteConfig(testCfg TestConfig) config.AppConfig {
263266
var certVerifierAddress string
264267
var svcManagerAddress string
265268
var blsOperatorStateRetrieverAddress string
269+
var eigenDADirectory string
266270
switch testCfg.Backend {
267271
case MemstoreBackend:
268272
break // no need to set these fields for local tests
@@ -271,16 +275,19 @@ func BuildTestSuiteConfig(testCfg TestConfig) config.AppConfig {
271275
certVerifierAddress = preprodCertVerifierAddress
272276
svcManagerAddress = preprodSvcManagerAddress
273277
blsOperatorStateRetrieverAddress = preprodBLSOperatorStateRetrieverAddress
278+
eigenDADirectory = preprodEigenDADirectory
274279
case TestnetBackend:
275280
disperserHostname = disperserTestnetHostname
276281
certVerifierAddress = testnetCertVerifierAddress
277282
svcManagerAddress = testnetSvcManagerAddress
278283
blsOperatorStateRetrieverAddress = testnetBLSOperatorStateRetrieverAddress
284+
eigenDADirectory = testnetEigenDADirectory
279285
case SepoliaBackend:
280286
disperserHostname = disperserSepoliaHostname
281287
certVerifierAddress = sepoliaCertVerifierAddress
282288
svcManagerAddress = sepoliaSvcManagerAddress
283289
blsOperatorStateRetrieverAddress = sepoliaBLSOperatorStateRetrieverAddress
290+
eigenDADirectory = sepoliaEigenDADirectory
284291
default:
285292
panic("Unsupported backend")
286293
}
@@ -353,6 +360,7 @@ func BuildTestSuiteConfig(testCfg TestConfig) config.AppConfig {
353360
EigenDACertVerifierOrRouterAddress: certVerifierAddress,
354361
BLSOperatorStateRetrieverAddr: blsOperatorStateRetrieverAddress,
355362
EigenDAServiceManagerAddr: svcManagerAddress,
363+
EigenDADirectory: eigenDADirectory,
356364
RetrieversToEnable: testCfg.Retrievers,
357365
},
358366
}

0 commit comments

Comments
 (0)