MCPcopy Create free account
hub / github.com/ethstorage/es-node / NewL1EndpointConfig

Function NewL1EndpointConfig

cmd/es-node/config.go:246–267  ·  view source on GitHub ↗
(ctx *cli.Context, lg log.Logger)

Source from the content-addressed store, hash-verified

244}
245
246func NewL1EndpointConfig(ctx *cli.Context, lg log.Logger) (*eth.L1EndpointConfig, *ethclient.Client, error) {
247 l1NodeAddr := ctx.GlobalString(flags.L1NodeAddr.Name)
248 client, err := ethclient.DialContext(context.Background(), l1NodeAddr)
249 if err != nil {
250 lg.Error("Failed to connect to the L1 RPC", "error", err, "l1Rpc", l1NodeAddr)
251 return nil, nil, err
252 }
253 chainid, err := client.ChainID(context.Background())
254 if err != nil {
255 lg.Error("Failed to fetch chain id from the L1 RPC", "error", err, "l1Rpc", l1NodeAddr)
256 return nil, nil, err
257 }
258 return &eth.L1EndpointConfig{
259 L1ChainID: chainid.Uint64(),
260 L1NodeAddr: l1NodeAddr,
261 L1BlockTime: ctx.GlobalUint64(flags.L1BlockTime.Name),
262 L1BeaconURL: ctx.GlobalString(flags.L1BeaconAddr.Name),
263 L1BeaconSlotTime: ctx.GlobalUint64(flags.L1BeaconSlotTime.Name),
264 DAURL: ctx.GlobalString(flags.DAURL.Name),
265 L1MinDurationForBlobsRequest: ctx.GlobalUint64(flags.L1MinDurationForBlobsRequest.Name),
266 }, client, nil
267}
268
269func NewDownloaderConfig(ctx *cli.Context) *downloader.Config {
270 return &downloader.Config{

Callers 1

NewConfigFunction · 0.85

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected