Skip to content

Commit

Permalink
chore(simple_client): Add explicit ServiceUnavailable error type - ad…
Browse files Browse the repository at this point in the history
…dress PR comment and add unit test
  • Loading branch information
ethenotethan committed Dec 3, 2024
1 parent 16ad49c commit 68a6979
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ 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 {
if cfg.MemstoreEnabled || !cfg.VerifierConfig.VerifyCerts {
cfg.EdaClientConfig.SvcManagerAddr = "0x0000000000000000000000000000000000000000"
cfg.EdaClientConfig.EthRpcUrl = "http://0.0.0.0:666"
}
Expand Down
26 changes: 26 additions & 0 deletions server/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,32 @@ func TestConfigVerification(t *testing.T) {
err := cfg.Check()
require.Error(t, err)
})

t.Run("EigenDAClientFieldsAreDefaultSetWhenCertVerifierDisabled", func(t *testing.T) {
// 1 - memstore
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)

// 2 - cert verification disabled
cfg = validCfg()
cfg.MemstoreEnabled = false
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)
})
})

}

0 comments on commit 68a6979

Please sign in to comment.