Skip to content

core: initializing a clique network with invalid genesis extradata is not rejected, crashes later #20710

@adamschmideg

Description

@adamschmideg

Hi there,

Please note that this is an issue tracker reserved for bug reports and feature requests.

For general questions please use the gitter channel or the Ethereum stack exchange at https://ethereum.stackexchange.com.

System information

Geth version: 1.9.11-unstable
OS & Version: OSX

Expected behaviour

Complain gracefully

Actual behaviour

panic: runtime error: makeslice: len out of range

Steps to reproduce the behaviour

geth --datadir /tmp/reproduce init genesis.json 
geth  --networkid=42  --datadir /tmp/reproduce  --unlock 0xda19f35c667420aa4A468710D6542Fd88714e73E

where genesis.json is

{
  "version": "1",
  "genesis": {
    "author": "0x0000000000000000000000000000000000000000",
    "difficulty": "0x1",
    "extraData": "0xdeadbeef",
    "gasLimit": "0x900000",
    "nonce": "0x00000000deadbeef",
    "timestamp": "0x0"
  },
  "config": {
    "chainId": 42,
    "clique": {
      "period": 5,
      "epoch": 3000
    }
  },
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x8888f1f195afa192cfee860698584c030f4c9db1",
  "difficulty": "0x020000",
  "gasLimit": "0x2fefd8",
  "timestamp": "0x54c98c81",
  "extraData": "0x42",
  "mixHash": "0x2c85bcbce56429100b2108254bb56906257582aeafcbd682bc9af67a9f5aee46",
  "nonce": "0x78cc16f7b4f65485",
  "alloc": {
    "a94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
      "balance": "0x09184e72a000"
    }
  }
}

Backtrace

goroutine 89 [running]:
github.com/ethereum/go-ethereum/consensus/clique.(*Clique).snapshot(0xc0000c0620, 0x502dc20, 0xc00021c000, 0x0, 0x26d63f58213f0f8, 0xeb6f9a67ff7faced, 0xaada95a3372d577a, 0x7f21feb6fe3879b7, 0x0, 0x0, ...)
	/private/tmp/ethereum-20200204-95299-bttoer/consensus/clique/clique.go:377 +0x539
github.com/ethereum/go-ethereum/consensus/clique.(*Clique).Prepare(0xc0000c0620, 0x502dc20, 0xc00021c000, 0xc00028e480, 0x7f21feb6fe3879b7, 0x0)
	/private/tmp/ethereum-20200204-95299-bttoer/consensus/clique/clique.go:497 +0xec
github.com/ethereum/go-ethereum/miner.(*worker).commitNewWork(0xc00028e240, 0xc00019afb0, 0x0, 0x5e53bb4d)
	/private/tmp/ethereum-20200204-95299-bttoer/miner/worker.go:859 +0x39e
github.com/ethereum/go-ethereum/miner.(*worker).mainLoop(0xc00028e240)
	/private/tmp/ethereum-20200204-95299-bttoer/miner/worker.go:412 +0xcc8
created by github.com/ethereum/go-ethereum/miner.newWorker
	/private/tmp/ethereum-20200204-95299-bttoer/miner/worker.go:219 +0x525

Log

INFO [02-24|13:02:21.475] Maximum peer count                       ETH=50 LES=0 total=50
INFO [02-24|13:02:21.491] Allocated cache and file handles         database=/tmp/reproduce/geth/chaindata cache=16.00MiB handles=16
INFO [02-24|13:02:21.532] Writing custom genesis block
INFO [02-24|13:02:21.532] Persisted trie from memory database      nodes=1 size=145.00B time=409.581µs gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [02-24|13:02:21.533] Successfully wrote genesis state         database=chaindata               hash=f8f013…fe217f
INFO [02-24|13:02:21.533] Allocated cache and file handles         database=/tmp/reproduce/geth/lightchaindata cache=16.00MiB handles=16
INFO [02-24|13:02:21.556] Writing custom genesis block
INFO [02-24|13:02:21.557] Persisted trie from memory database      nodes=1 size=145.00B time=452.95µs  gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [02-24|13:02:21.558] Successfully wrote genesis state         database=lightchaindata               hash=f8f013…fe217f
INFO [02-24|13:02:21.610] Maximum peer count                       ETH=50 LES=0 total=50
INFO [02-24|13:02:21.632] Starting peer-to-peer node               instance=Geth/v1.9.11-unstable-33791dbe-20200204/darwin-amd64/go1.13.4
INFO [02-24|13:02:21.632] Allocated trie memory caches             clean=256.00MiB dirty=256.00MiB
INFO [02-24|13:02:21.632] Allocated cache and file handles         database=/tmp/reproduce/geth/chaindata cache=512.00MiB handles=5120
INFO [02-24|13:02:21.726] Opened ancient database                  database=/tmp/reproduce/geth/chaindata/ancient
INFO [02-24|13:02:21.727] Initialised chain configuration          config="{ChainID: 42 Homestead: <nil> DAO: <nil> DAOSupport: false EIP150: <nil> EIP155: <nil> EIP158: <nil> Byzantium: <nil> Constantinople: <nil> Petersburg: <nil> Istanbul: <nil>, Muir Glacier: <nil>, Engine: clique}"
INFO [02-24|13:02:21.727] Initialising Ethereum protocol           versions="[64 63]" network=42 dbversion=<nil>
WARN [02-24|13:02:21.727] Upgrade blockchain database version      from=<nil> to=7
INFO [02-24|13:02:21.729] Loaded most recent local header          number=0 hash=f8f013…fe217f td=131072 age=5y1mo3w
INFO [02-24|13:02:21.729] Loaded most recent local full block      number=0 hash=f8f013…fe217f td=131072 age=5y1mo3w
INFO [02-24|13:02:21.729] Loaded most recent local fast block      number=0 hash=f8f013…fe217f td=131072 age=5y1mo3w
INFO [02-24|13:02:21.729] Regenerated local transaction journal    transactions=0 accounts=0
INFO [02-24|13:02:21.738] Allocated fast sync bloom                size=512.00MiB

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions