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

fix: Disable SERVICE_MANAGER_ADDR & ETH_RPC as mandatory #205

Merged
Merged
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
2 changes: 1 addition & 1 deletion client/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Config struct {

// SimpleCommitmentClient implements a simple client for the eigenda-proxy
// that can put/get simple commitment data and query the health endpoint.
// It is meant to be used by arbitrum nitro integrations.
// Currently it is meant to be used by Arbitrum nitro integrations but can be extended to others in the future.
// Optimism has its own client: https://github.com/ethereum-optimism/optimism/blob/develop/op-alt-da/daclient.go
// so clients wanting to send op commitment mode data should use that client.
type SimpleCommitmentClient struct {
Expand Down
4 changes: 2 additions & 2 deletions flags/eigendaflags/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ func CLIFlags(envPrefix, category string) []cli.Flag {
Usage: "URL of the Ethereum RPC endpoint. Needed to confirm blobs landed onchain.",
EnvVars: []string{withEnvPrefix(envPrefix, "ETH_RPC")},
Category: category,
Required: true,
Required: false,
samlaf marked this conversation as resolved.
Show resolved Hide resolved
},
&cli.StringFlag{
Name: SvcManagerAddrFlagName,
Usage: "Address of the EigenDAServiceManager contract. Required to confirm blobs landed onchain. See https://github.com/Layr-Labs/eigenlayer-middleware/?tab=readme-ov-file#current-mainnet-deployment",
EnvVars: []string{withEnvPrefix(envPrefix, "SERVICE_MANAGER_ADDR")},
Category: category,
Required: true,
Required: false,
samlaf marked this conversation as resolved.
Show resolved Hide resolved
},
// Flags that are proxy specific, and not used by the eigenda-client
// TODO: should we move this to a more specific category, like EIGENDA_STORE?
Expand Down
16 changes: 16 additions & 0 deletions server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ func (cfg *Config) Check() error {
}
}

// provide dummy values to eigenda client config. Since the client won't be called in this
// mode it doesn't matter.
if cfg.MemstoreEnabled {
cfg.EdaClientConfig.SvcManagerAddr = "0x0000000000000000000000000000000000000000"
cfg.EdaClientConfig.EthRpcUrl = "http://0.0.0.0:666"
}
ethenotethan marked this conversation as resolved.
Show resolved Hide resolved

if !cfg.MemstoreEnabled {
if cfg.EdaClientConfig.SvcManagerAddr == "" {
return fmt.Errorf("service manager address is required for communication with EigenDA")
}
if cfg.EdaClientConfig.EthRpcUrl == "" {
return fmt.Errorf("eth prc url is required for communication with EigenDA")
}
}

// cert verification is enabled
// TODO: move this verification logic to verify/cli.go
if cfg.VerifierConfig.VerifyCerts {
Expand Down
23 changes: 23 additions & 0 deletions server/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,29 @@ func TestConfigVerification(t *testing.T) {
err := cfg.Check()
require.Error(t, err)
})

t.Run("EigenDAClientFieldsAreDefaultSetWhenMemStoreEnabled", func(t *testing.T) {
cfg := validCfg()
cfg.MemstoreEnabled = true
cfg.VerifierConfig.VerifyCerts = false
cfg.VerifierConfig.RPCURL = ""
cfg.VerifierConfig.SvcManagerAddr = ""

err := cfg.Check()
require.NoError(t, err)
require.True(t, len(cfg.EdaClientConfig.EthRpcUrl) > 1)
require.True(t, len(cfg.EdaClientConfig.SvcManagerAddr) > 1)
})

t.Run("FailWhenEigenDAClientFieldsAreUnsetAndMemStoreDisabled", func(t *testing.T) {
cfg := validCfg()
cfg.MemstoreEnabled = false
cfg.VerifierConfig.RPCURL = ""
cfg.VerifierConfig.SvcManagerAddr = ""

err := cfg.Check()
require.Error(t, err)
})
})

}
Loading