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

cmd/geth: add support for sepolia testnet #23730

Merged
merged 9 commits into from
Nov 8, 2021
Merged

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Oct 13, 2021

This PR adds suppor for 'Sepolia', a new testnet to replace ropsten. It differs a bit from what's already running, since I noticed that the existing one has a genesis difficult of 0x200, which is below the minimum of 0x2000. When the difficulty is below that value, the YP difficulty calculation is ambiguous.
Also, the existing one had empty extradata, which might cause issues, so I added some data there.

@holiman
Copy link
Contributor Author

holiman commented Oct 13, 2021

Something is wrong with this PR, it doesn't actually populate the allocs.

@holiman
Copy link
Contributor Author

holiman commented Oct 13, 2021

Genesis block hash: 0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9
Genesis stateroot: 0x5eb6e371a698b8d68f665192350ffcecbbbf322916f4b51bd79bb6887da3f494

Full json:

{
   "config":{
      "chainId":11155111,
      "homesteadBlock":0,
      "eip150Block":0,
      "eip155Block":0,
      "eip158Block":0,
      "byzantiumBlock":0,
      "constantinopleBlock":0,
      "petersburgBlock":0,
      "istanbulBlock":0,
      "berlinBlock":0,
      "londonBlock":0
   },
   "alloc":{
      "0xa2A6d93439144FFE4D27c9E088dCD8b783946263": {"balance": "0xD3C21BCECCEDA1000000"},
      "0xBc11295936Aa79d594139de1B2e12629414F3BDB": {"balance": "0xD3C21BCECCEDA1000000"},
      "0x7cF5b79bfe291A67AB02b393E456cCc4c266F753": {"balance": "0xD3C21BCECCEDA1000000"},
      "0xaaec86394441f915bce3e6ab399977e9906f3b69": {"balance": "0xD3C21BCECCEDA1000000"},
      "0xF47CaE1CF79ca6758Bfc787dbD21E6bdBe7112B8": {"balance": "0xD3C21BCECCEDA1000000"},
      "0xd7eDDB78ED295B3C9629240E8924fb8D8874ddD8": {"balance": "0xD3C21BCECCEDA1000000"},
      "0x8b7F0977Bb4f0fBE7076FA22bC24acA043583F5e": {"balance": "0xD3C21BCECCEDA1000000"},
      "0xe2e2659028143784d557bcec6ff3a0721048880a": {"balance": "0xD3C21BCECCEDA1000000"},
      "0xd9a5179f091d85051d3c982785efd1455cec8699": {"balance": "0xD3C21BCECCEDA1000000"},
      "0xbeef32ca5b9a198d27B4e02F4c70439fE60356Cf": {"balance": "0xD3C21BCECCEDA1000000"},
      "0x0000006916a87b82333f4245046623b23794c65c": {"balance": "0x84595161401484A000000"},
      "0xb21c33de1fab3fa15499c62b59fe0cc3250020d1": {"balance": "0x52B7D2DCC80CD2E4000000"},
      "0x10F5d45854e038071485AC9e402308cF80D2d2fE": {"balance": "0x52B7D2DCC80CD2E4000000"},
      "0xd7d76c58b3a519e9fA6Cc4D22dC017259BC49F1E": {"balance": "0x52B7D2DCC80CD2E4000000"},
      "0x799D329e5f583419167cD722962485926E338F4a": {"balance": "0xDE0B6B3A7640000"}
   },
   "coinbase":"0x0000000000000000000000000000000000000000",
   "difficulty":"0x20000",
   "extraData":"0x5365706f6c69612c20417468656e732c204174746963612c2047726565636521",
   "gasLimit":"0x1c9c380",
   "nonce":"0x000000000000000",
   "mixhash":"0x0000000000000000000000000000000000000000000000000000000000000000",
   "parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
   "timestamp":"0x6159af19"
}

@holiman holiman marked this pull request as ready for review October 13, 2021 19:27
@holiman
Copy link
Contributor Author

holiman commented Oct 13, 2021

cc @parithosh we may need to reboot sepolia with these changes.

@holiman
Copy link
Contributor Author

holiman commented Oct 14, 2021

Sorry, cc:ed the wrong person, should be @shivamagl95

@shivamagl95
Copy link

Sorry, cc:ed the wrong person, should be @shivamagl95

@holiman done.

params/bootnodes.go Outdated Show resolved Hide resolved
@karalabe karalabe added this to the 1.10.11 milestone Oct 19, 2021
@holiman
Copy link
Contributor Author

holiman commented Oct 19, 2021

Hm, tried a sync geth --sepolia now

INFO [10-19|10:44:46.288] Imported new block receipts              count=192  elapsed="528.402µs" number=33216 hash=270651..ef02a1 age=9h33m9s   size=768.00B
INFO [10-19|10:44:46.322] Imported new block headers               count=192  elapsed=6.158ms     number=33408 hash=39bf28..0b7c14 age=8h52m19s
INFO [10-19|10:44:46.324] Imported new block receipts              count=192  elapsed="541.848µs" number=33408 hash=39bf28..0b7c14 age=8h52m19s  size=768.00B
WARN [10-19|10:44:46.353] Header broke chain ancestry              peer=cbab44f2a73775a3 number=33468 hash=899fb6..a5022c
WARN [10-19|10:44:48.873] Rewinding blockchain                     target=31359
INFO [10-19|10:44:48.949] Loaded most recent local header          number=31359 hash=a24137..7fbb81 td=24,962,328,572 age=15h52m25s
INFO [10-19|10:44:48.949] Loaded most recent local full block      number=0     hash=25a5cc..3e6dd9 td=131,072        age=2w1d19h
INFO [10-19|10:44:48.949] Loaded most recent local fast block      number=31359 hash=a24137..7fbb81 td=24,962,328,572 age=15h52m25s
INFO [10-19|10:44:48.949] Loaded last fast-sync pivot marker       number=45641
WARN [10-19|10:44:48.949] Rolled back chain segment                header=33408->31359 fast=33408->31359 block=0->0 reason="syncing canceled (requested)"
WARN [10-19|10:44:48.949] Synchronisation failed, dropping peer    peer=cbab44f2a73775a31eef8c7fdcd74ca78c4e59f43971e287b55c89bf90851ba0 err="retrieved hash chain is invalid: no peers available or all tried for download"
INFO [10-19|10:44:50.960] Looking for peers                        peercount=0 tried=199 static=0

@holiman
Copy link
Contributor Author

holiman commented Oct 19, 2021

The miner seems a bit 'toast':

> num="33467"; b=eth.getBlock(num); console.log(num, "hash", b.hash); console.log("", "parent",  b.parentHash)
33467 hash 0x2cc34962cf103d2ce50d7a8488d10eaa99d1b5446b4a550d5083bc9846d6444d
 parent 0x1ceeb421a8b6a4ecfa3d0355842f2031f4b03a860b8a11f6bbb3b4609773ca02
null
> num="33468"; b=eth.getBlock(num); console.log(num, "hash", b.hash); console.log("", "parent",  b.parentHash)
33468 hash 0x899fb6b74fe446fd01542fef4c4e2e77b0c02706d7b7a7bf51236b2193a5022c
 parent 0x7e6c23628202f033bbe97466cd0ee1f570990c9981cdd168f38481faed2f9b35

It's a non-contiguous chain. It was mining fine, but somehow started syncing with another node:

INFO [10-18|23:57:52.892] Looking for peers                        peercount=2 tried=116 static=0
ERROR[10-18|23:57:53.007] Snapshot extension registration failed   peer=e58ffd93 err="peer connected on snap without compatible eth support"
ERROR[10-18|23:57:57.195] Snapshot extension registration failed   peer=35ba3061 err="peer connected on snap without compatible eth support"
ERROR[10-18|23:57:57.360] Snapshot extension registration failed   peer=3af25a30 err="peer connected on snap without compatible eth support"
WARN [10-18|23:58:01.290] Fast syncing, discarded propagated block number=33434 hash=9f1052..c6436a
INFO [10-18|23:58:01.656] Block synchronisation started 
WARN [10-18|23:58:01.656] Enabling snapshot sync prototype 
INFO [10-18|23:58:01.656] Mining aborted due to sync 
INFO [10-18|23:58:02.025] Imported new block headers               count=2 elapsed=24.302ms    number=33435 hash=3676f0..9f1cb7 ignored=64
INFO [10-18|23:58:02.025] Downloader queue stats                   receiptTasks=0 blockTasks=0 itemSize=575.70B throttle=8192
INFO [10-18|23:58:02.090] Imported new block headers               count=1 elapsed=3.771ms     number=33436 hash=c9d99b..73a83e
INFO [10-18|23:58:03.102] Looking for peers                        peercount=2 tried=177 static=0
INFO [10-18|23:58:05.263] Imported new block headers               count=8 elapsed=5.881ms     number=33444 hash=87ba03..8e9189
WARN [10-18|23:58:08.689] Failed to update snapshot tree           from=2417bd..7f60de to=0cf918..596aa1 err="parent [0x2417bd9d1ebc24f164ff6faa7af48cc9722ed7432ea7324b8da75217537f60de] snapshot missing"
WARN [10-18|23:58:08.689] Failed to cap snapshot tree              root=0cf918..596aa1 layers=128 err="snapshot [0x0cf9185d491276b74cf1a03d5a2a3fc3f509aedda9143a0157246acebe596aa1] missing"
INFO [10-18|23:58:08.689] Successfully sealed new block            number=33434 sealhash=ff0472..5517f8 hash=8439e1..4bc93f elapsed=24.954s
INFO [10-18|23:58:08.689] 🔗 block reached canonical chain          number=33427 hash=d1d0a3..15969d
INFO [10-18|23:58:08.689] 🔨 mined potential block                  number=33434 hash=8439e1..4bc93f
INFO [10-18|23:58:13.188] Looking for peers                        peercount=2 tried=73  static=0
ERROR[10-18|23:58:13.860] Snapshot extension registration failed   peer=9634124a err="peer connected on snap without compatible eth support"
ERROR[10-18|23:58:20.508] Snapshot extension registration failed   peer=480e0cf6 err="peer connected on snap without compatible eth support"
...
INFO [10-19|00:00:18.208] Imported new block headers               count=1 elapsed=3.827ms     number=33456 hash=019f93..b7742a
INFO [10-19|00:00:20.257] Looking for peers                        peercount=1 tried=143 static=0
INFO [10-19|00:00:21.379] Imported new block headers               count=8 elapsed=3.738ms     number=33464 hash=e8d4af..bfb899
ERROR[10-19|00:00:22.695] Snapshot extension registration failed   peer=3c31c99d err="peer connected on snap without compatible eth support"
INFO [10-19|00:00:24.550] Imported new block headers               count=8 elapsed=3.772ms     number=33472 hash=03740b..af6bb9
...

And somehow wound up with a non-contiguous chain.

@holiman
Copy link
Contributor Author

holiman commented Oct 19, 2021

@garyschulte started a besu-node mining, which is probably the one our miner started syncing from. This is their blocks, where our is non-continuuous;

        "number": "0x82bb",
        "hash": "0x7e6c23628202f033bbe97466cd0ee1f570990c9981cdd168f38481faed2f9b35",
        "mixHash": "0xf4a5cf17912fd320c671ebed7d49e972d399b2589bea2f85327322c4d6dc81cb",
        "parentHash": "0x940f9fc318492c0cf9ae005de92cb24b91b7b31af9c59b897e3ebab6e54b0c28",
        "nonce": "0x62cf4323b89da529",

...

        "number": "0x82bc",
        "hash": "0x899fb6b74fe446fd01542fef4c4e2e77b0c02706d7b7a7bf51236b2193a5022c",
        "mixHash": "0xd5c063cb485336897f27bbe14f9c82567f36e4b66a043b5dae77bc0272bb0c4e",
        "parentHash": "0x7e6c23628202f033bbe97466cd0ee1f570990c9981cdd168f38481faed2f9b35",
        "nonce": "0x62cf4323b8c16f92",

Theirs is continuous.
I'm guessing our miner-direct-write-block has some flaw, when combined with sync suddenly kicking in.

@karalabe
Copy link
Member

karalabe commented Oct 19, 2021 via email

@garyschulte
Copy link

garyschulte commented Oct 19, 2021

Geth has a bug if it's mining on initial empty db and then syncs. Same happens on Clique signers too btw, there they just mess up block 1. I think I opened an issue a year or two ago about it. Miners need to sync first, then mine as a workaround.

FWIW, at the time I started the miner the geth node had 33k blocks in its db already.

@holiman
Copy link
Contributor Author

holiman commented Oct 20, 2021

I guess we should just wipe the miner, let it resync, and then start mining again later on

@holiman holiman modified the milestones: 1.10.11, 1.10.12 Oct 20, 2021
Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

@karalabe karalabe merged commit e1c000b into ethereum:master Nov 8, 2021
sidhujag pushed a commit to syscoin/go-ethereum that referenced this pull request Nov 8, 2021
@holiman holiman deleted the sepolia branch November 10, 2021 18:32
yongjun925 pushed a commit to DODOEX/go-ethereum that referenced this pull request Dec 3, 2022
* cmd/geth: add support for sepolia testnet

* core: last details on sepolia genesis

* params: fix sepolia hash + reduce testing code

* Update params/bootnodes.go

* cmd/geth: fix attach path for sepolia

* params: update bootnodes

* params: fix

* core: fix docstring

* params: add sepolia CHT
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Belki de çalışmak zorunda kaldık

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants