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

panic: runtime error: makeslice: len out of range #23522

Closed
1lu29e opened this issue Sep 2, 2021 · 1 comment · Fixed by #23538
Closed

panic: runtime error: makeslice: len out of range #23522

1lu29e opened this issue Sep 2, 2021 · 1 comment · Fixed by #23538
Labels

Comments

@1lu29e
Copy link

1lu29e commented Sep 2, 2021

System information

[root@VM-16-3-centos ~]# geth version
Geth
Version: 1.10.6-stable
Architecture: amd64
Go Version: go1.16.7
Operating System: linux
GOPATH=/root/go-work
GOROOT=/root/go/go
Geth version: geth version
OS & Version: Windows/Linux/OSX
Commit hash : (if develop)

Expected behaviour

Geth console run

Actual behaviour

Geth Crash

Steps to reproduce the behaviour

geth --nodiscover --datadir ./data --identity "gethPriv" --networkid 12345 --port 30305 console

LOG

INFO [09-02|22:58:38.845] Maximum peer count ETH=50 LES=0 total=50
INFO [09-02|22:58:38.845] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [09-02|22:58:38.846] Set global gas cap cap=50,000,000
INFO [09-02|22:58:38.846] Allocated trie memory caches clean=154.00MiB dirty=256.00MiB
INFO [09-02|22:58:38.846] Allocated cache and file handles database=/data/sde/geth_priv/data/geth/chaindata cache=512.00MiB handles=50001
INFO [09-02|22:58:38.870] Opened ancient database database=/data/sde/geth_priv/data/geth/chaindata/ancient readonly=false
INFO [09-02|22:58:38.870] Initialised chain configuration config="{ChainID: 15 Homestead: 0 DAO: DAOSupport: false EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: 0 Constantinople: 0 Petersburg: 0 Istanbul: , Muir Glacier: , Berlin: , London: , Engine: clique}"
INFO [09-02|22:58:38.871] Initialising Ethereum protocol network=12345 dbversion=8
INFO [09-02|22:58:38.871] Loaded most recent local header number=0 hash=895515..ed20ca td=65536 age=52y5mo2d
INFO [09-02|22:58:38.871] Loaded most recent local full block number=0 hash=895515..ed20ca td=65536 age=52y5mo2d
INFO [09-02|22:58:38.871] Loaded most recent local fast block number=0 hash=895515..ed20ca td=65536 age=52y5mo2d
WARN [09-02|22:58:38.872] Loaded snapshot journal diskroot=cce9b3..480599 diffs=missing
INFO [09-02|22:58:38.872] Loaded local transaction journal transactions=0 dropped=0
INFO [09-02|22:58:38.872] Regenerated local transaction journal transactions=0 accounts=0
INFO [09-02|22:58:38.873] Gasprice oracle is ignoring threshold set threshold=2
panic: runtime error: makeslice: len out of range

goroutine 47 [running]:
github.com/ethereum/go-ethereum/consensus/clique.(*Clique).snapshot(0xc000526700, 0x158e4d8, 0xc0001c4000, 0x0, 0x9a5e47a1c155589, 0x88b2b1e66c797971, 0xb2db3fb834c69c2, 0xca20edb157ac52d8, 0x0, 0x0, ...)
github.com/ethereum/go-ethereum/consensus/clique/clique.go:399 +0x505
github.com/ethereum/go-ethereum/consensus/clique.(*Clique).Prepare(0xc000526700, 0x158e4d8, 0xc0001c4000, 0xc000158000, 0xca20edb157ac52d8, 0x0)
github.com/ethereum/go-ethereum/consensus/clique/clique.go:513 +0xef
github.com/ethereum/go-ethereum/miner.(*worker).commitNewWork(0xc000093680, 0xc0002b0350, 0x0, 0x6130e69e)
github.com/ethereum/go-ethereum/miner/worker.go:922 +0x3d6
github.com/ethereum/go-ethereum/miner.(*worker).mainLoop(0xc000093680)
github.com/ethereum/go-ethereum/miner/worker.go:456 +0x7ce
created by github.com/ethereum/go-ethereum/miner.newWorker
github.com/ethereum/go-ethereum/miner/worker.go:228 +0x532

[backtrace]

When submitting logs: please submit them as text and not screenshots.
And my config of genesis.json is
{
"config": {
"chainId": 12345,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0
},
"alloc": {
"32d6a98018C98a0afe9d9AbE89326F564e3dc1e7": { "balance": "300000" },
"8898a7CAD4174e0291e89d2b7A9dFb91E6C8F592": { "balance": "400000" }
},
"coinbase": "0x0000000000000000000000000000000000000000",
"difficulty": "0x10000",
"extraData": "",
"gasLimit": "0x2fefd8",
"nonce": "0x0000000000000042",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "0x00"
}

@1lu29e 1lu29e added the type:bug label Sep 2, 2021
@MariusVanDerWijden
Copy link
Member

Hmm looks like you need to specify some extradata in the genesis block, otherwise the snapshot() function will panic , because make([]byte, len(header.extradata) - 32 - 65 / 20) is make([]byte, -3)
So just adding some extraData to the genesis should fix the issue. But we should probably add some check to prevent this from panicing

fjl pushed a commit that referenced this issue Sep 21, 2021
yongjun925 pushed a commit to DODOEX/go-ethereum that referenced this issue Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants