ethereum-optimism / ethereum-optimism/optimism

Question on op-deployer: Why is ID a hash in ChainState

Open
#16,586 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

Hey team,

At the time of writing this, in `op-deployer`, it would seem that `ChainState.ID` is of type `common.Hash`. found [here](https://github.com/ethereum-optimism/optimism/blob/b6a82c2de9c9372d3012e73e702e9671579425b7/op-deployer/pkg/deployer/state/state.go#L94)

additionally, that gets compared via `==` in the `Chain` function [here](https://github.com/ethereum-optimism/optimism/blob/b6a82c2de9c9372d3012e73e702e9671579425b7/op-deployer/pkg/deployer/state/state.go#L78)

so, a few questions arise:
* is that supposed to be the chain id? wouldn't it be more appropriate to have it as an integer type (such as `uint64` or `big.Int`)? or am I missing something? 🤔
* if the id should be a hash, should that comparison be using [Hash.Cmp](https://pkg.go.dev/github.com/ethereum/go-ethereum/common#Hash.Cmp) ?

Thanks for your help in advance.

Contributor guide

Open the contributing guide

Research direction

Start with op-deployer/pkg/deployer/state/state.go, especially ChainState.ID and the Chain function, then trace where the ID is populated and used. Determine whether it represents a chain ID or a hash and document the intended comparison or required change; done means the semantics and any follow-up are clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.