Commit 11d46182 authored by Mark Tyneway's avatar Mark Tyneway

l2geth: make block hashes deterministic

The blockhashes can be non deterministic because there is not a global
consensus in the existing deployment of the optimism network, instead
each node runs with `--dev 0` meaning that it auto mines transactions
itself. Previously, block hashes were non deterministic due to a
different clique signing key being used but that was fixed so that
a deterministic key is used for all nodes.

This fixes the possibility of the block extradata being different which
would result in different block hashes. The extradata is hard coded
to be the same value as the release @eth-optimism/l2geth@0.4.6. In
version 0.4.7, the underlying Dockerfile pulled in a patch release of
the Go runtime which caused the extradata field to become different.
The extradata field by default is the version of the software (which
cannot change until the next regenesis), "geth", the go runtime version
and the operating system.

This will require a resync to make block hashes deterministic across the
network.
parent 33cb9025
---
'@eth-optimism/l2geth': patch
---
Make the extradata deterministic for deterministic block hashes
...@@ -241,6 +241,16 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { ...@@ -241,6 +241,16 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
} }
func makeExtraData(extra []byte) []byte { func makeExtraData(extra []byte) []byte {
if vm.UsingOVM {
// Make the extradata deterministic
extra, _ = rlp.EncodeToBytes([]interface{}{
uint(params.VersionMajor<<16 | params.VersionMinor<<8 | params.VersionPatch),
"geth",
"go1.15.13",
"linux",
})
return extra
}
if len(extra) == 0 { if len(extra) == 0 {
// create default extradata // create default extradata
extra, _ = rlp.EncodeToBytes([]interface{}{ extra, _ = rlp.EncodeToBytes([]interface{}{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment