ethereum-optimism / ethereum-optimism/optimism

Handle incorrect descriptors better in devnet-sdk/system/chain.go

Open
#16,522 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
6.5k
Forks
4k
Avg merge
2d 15h
Merged PRs (30d)
145

Description

# Handle incorrect descriptors better in devnet-sdk/system/chain.go

## Problem

The code in `devnet-sdk/system/chain.go` has TODO comments indicating potential panic situations:

```go
// TODO: handle incorrect descriptors better. We could panic here.
```

These TODOs exist in:
- `newChainFromDescriptor()` function (line 198)
- `newL2ChainFromDescriptor()` function (line 223)

## Impact

- Code can panic at runtime if descriptors are malformed
- No validation for required fields like chain ID, nodes, services, endpoints
- Poor developer experience with cryptic error messages

## Expected Solution

- Add proper validation for chain descriptors
- Replace TODO comments with error handling
- Prevent runtime panics with clear error messages
- Maintain backward compatibility

## Files Affected

- `devnet-sdk/system/chain.go`
- `devnet-sdk/system/chain_test.go` (for tests)

Contributor guide

Open the contributing guide

Research direction

Start in devnet-sdk/system/chain.go by reading newChainFromDescriptor() and newL2ChainFromDescriptor(), including the TODO locations. Then inspect devnet-sdk/system/chain_test.go and run its tests. Done means malformed descriptors return clear errors instead of causing panics, while valid descriptors continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.