Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 1 #8

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b40c109
params: begin v1.11.2 release cycle
holiman Feb 16, 2023
6428663
eth/catalyst: send INVALID instead of INVALID_BLOCK_HASH (#26696)
MariusVanDerWijden Feb 17, 2023
15e5e61
eth/catalyst: request too large error (#26722)
rkrasiuk Feb 17, 2023
7c749c9
core/trie: remove trie tracer (#26665)
holiman Feb 19, 2023
1db978c
rpc: fix unmarshaling of null result in CallContext (#26723)
fjl Feb 19, 2023
2166c86
build: ship bootstrapper Go along with builder for PPA (#26731)
karalabe Feb 20, 2023
e1e2781
build: fix setting env var, temp early exit
karalabe Feb 20, 2023
4ec4235
build: fix gobootstrap path for the PPA
karalabe Feb 20, 2023
a43efce
build: add some PPA debug logs, sigh
karalabe Feb 20, 2023
1652684
internal/build: revert raising the chunk size for PPA
karalabe Feb 20, 2023
c02334b
build: yet another weird PPA fix
karalabe Feb 20, 2023
4519054
build: fix (finaly?) the PPA env vars for Go bootstrapping
karalabe Feb 20, 2023
41dee26
build: fix Go 1.19.0 bootstrapper issues on 386 PPA
karalabe Feb 20, 2023
ba4267f
build: enable Lunar Lobster PPA builds
karalabe Feb 20, 2023
13ef21d
Revert "core/trie: remove trie tracer (#26665)" (#26732)
rjl493456442 Feb 20, 2023
7d4db69
cmd/geth: clarify dumpconfig options (#26729)
swkim101 Feb 21, 2023
90d2551
core, eth: merge snap-sync chain download progress logs (#26676)
karalabe Feb 21, 2023
6d2d126
core: fix accessor mismatch for genesis state (#26747)
holiman Feb 21, 2023
2f20fd3
core/rawdb: expose chain freezer constructor without internals (#26748)
karalabe Feb 21, 2023
fe01a2f
all: use unified emptyRootHash and emptyCodeHash (#26718)
rjl493456442 Feb 21, 2023
4034c67
eth/filters: fix a breaking change and return rpctransaction (#26757)
yierx Feb 22, 2023
f86f048
common/math: allow HexOrDecimal to accept unquoted decimals too (#26758)
karalabe Feb 22, 2023
73b01f4
params: release Geth v1.11.2
karalabe Feb 22, 2023
f5f4472
Merge branch 'stateful-v1.11' into patch-1
transmissions12 Feb 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
core: fix accessor mismatch for genesis state (ethereum#26747)
  • Loading branch information
holiman authored Feb 21, 2023
commit 6d2d12610093774828e2964661767321e1c9c254
14 changes: 7 additions & 7 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (ga *GenesisAlloc) deriveHash() (common.Hash, error) {
// flush is very similar with deriveHash, but the main difference is
// all the generated states will be persisted into the given database.
// Also, the genesis state specification will be flushed as well.
func (ga *GenesisAlloc) flush(db ethdb.Database, triedb *trie.Database) error {
func (ga *GenesisAlloc) flush(db ethdb.Database, triedb *trie.Database, blockhash common.Hash) error {
statedb, err := state.New(common.Hash{}, state.NewDatabaseWithNodeDB(db, triedb), nil)
if err != nil {
return err
Expand Down Expand Up @@ -166,15 +166,15 @@ func (ga *GenesisAlloc) flush(db ethdb.Database, triedb *trie.Database) error {
if err != nil {
return err
}
rawdb.WriteGenesisStateSpec(db, root, blob)
rawdb.WriteGenesisStateSpec(db, blockhash, blob)
return nil
}

// CommitGenesisState loads the stored genesis state with the given block
// hash and commits it into the provided trie database.
func CommitGenesisState(db ethdb.Database, triedb *trie.Database, hash common.Hash) error {
func CommitGenesisState(db ethdb.Database, triedb *trie.Database, blockhash common.Hash) error {
var alloc GenesisAlloc
blob := rawdb.ReadGenesisStateSpec(db, hash)
blob := rawdb.ReadGenesisStateSpec(db, blockhash)
if len(blob) != 0 {
if err := alloc.UnmarshalJSON(blob); err != nil {
return err
Expand All @@ -186,7 +186,7 @@ func CommitGenesisState(db ethdb.Database, triedb *trie.Database, hash common.Ha
// - supported networks(mainnet, testnets), recover with defined allocations
// - private network, can't recover
var genesis *Genesis
switch hash {
switch blockhash {
case params.MainnetGenesisHash:
genesis = DefaultGenesisBlock()
case params.RinkebyGenesisHash:
Expand All @@ -202,7 +202,7 @@ func CommitGenesisState(db ethdb.Database, triedb *trie.Database, hash common.Ha
return errors.New("not found")
}
}
return alloc.flush(db, triedb)
return alloc.flush(db, triedb, blockhash)
}

// GenesisAccount is an account in the state of the genesis block.
Expand Down Expand Up @@ -493,7 +493,7 @@ func (g *Genesis) Commit(db ethdb.Database, triedb *trie.Database) (*types.Block
// All the checks has passed, flush the states derived from the genesis
// specification as well as the specification itself into the provided
// database.
if err := g.Alloc.flush(db, triedb); err != nil {
if err := g.Alloc.flush(db, triedb, block.Hash()); err != nil {
return nil, err
}
rawdb.WriteTd(db, block.Hash(), block.NumberU64(), block.Difficulty())
Expand Down
10 changes: 5 additions & 5 deletions core/rawdb/accessors_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ func WriteChainConfig(db ethdb.KeyValueWriter, hash common.Hash, cfg *params.Cha
}

// ReadGenesisStateSpec retrieves the genesis state specification based on the
// given genesis hash.
func ReadGenesisStateSpec(db ethdb.KeyValueReader, hash common.Hash) []byte {
data, _ := db.Get(genesisStateSpecKey(hash))
// given genesis (block-)hash.
func ReadGenesisStateSpec(db ethdb.KeyValueReader, blockhash common.Hash) []byte {
data, _ := db.Get(genesisStateSpecKey(blockhash))
return data
}

// WriteGenesisStateSpec writes the genesis state specification into the disk.
func WriteGenesisStateSpec(db ethdb.KeyValueWriter, hash common.Hash, data []byte) {
if err := db.Put(genesisStateSpecKey(hash), data); err != nil {
func WriteGenesisStateSpec(db ethdb.KeyValueWriter, blockhash common.Hash, data []byte) {
if err := db.Put(genesisStateSpecKey(blockhash), data); err != nil {
log.Crit("Failed to store genesis state", "err", err)
}
}
Expand Down