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

Investigate/peering #582

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 5 additions & 3 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -2251,14 +2251,16 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {

// SetDNSDiscoveryDefaults2 configures DNS discovery with the given URL if no URLs are set.
func SetDNSDiscoveryDefaults2(cfg *ethconfig.Config, url string) {
var ethURL = url
if cfg.EthDiscoveryURLs != nil {
log.Warn("Short circuiting DNS discovery defaults (should be manually configured)")
return
}
if cfg.SyncMode == downloader.LightSync {
url = strings.Replace(url, "@all.", "@les.", 1)
ethURL = strings.Replace(url, "@all.", "@les.", 1)
}
cfg.EthDiscoveryURLs = []string{url}
cfg.SnapDiscoveryURLs = cfg.EthDiscoveryURLs
cfg.EthDiscoveryURLs = []string{ethURL}
cfg.SnapDiscoveryURLs = []string{strings.Replace(url, "@all.", "@snap.", 1)}
}

// SetDNSDiscoveryDefaults configures DNS discovery with the given URL if
Expand Down
1 change: 1 addition & 0 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {

// Setup DNS discovery iterators.
dnsclient := dnsdisc.NewClient(dnsdisc.Config{})
log.Info("DNS client configuring discovery", "eth.urls", config.EthDiscoveryURLs, "snap.urls", eth.config.SnapDiscoveryURLs)
eth.ethDialCandidates, err = dnsclient.NewIterator(eth.config.EthDiscoveryURLs...)
if err != nil {
return nil, err
Expand Down
3 changes: 3 additions & 0 deletions eth/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,9 @@ func (d *Downloader) fetchHead(p *peerConnection) (head *types.Header, pivot *ty
if (mode == SnapSync || mode == LightSync) && head.Number.Uint64() < d.checkpoint {
return nil, nil, fmt.Errorf("%w: remote head %d below checkpoint %d", errUnsyncedPeer, head.Number, d.checkpoint)
}
if (mode == SnapSync || mode == LightSync) && head.Number.Uint64() <= uint64(fsMinFullBlocks) {
return nil, nil, fmt.Errorf("%w: remote head %d below min-full-blocks height %d", errUnsyncedPeer, head.Number, fsMinFullBlocks)
}
if len(headers) == 1 {
if mode == SnapSync && head.Number.Uint64() > uint64(fsMinFullBlocks) {
return nil, nil, fmt.Errorf("%w: no pivot included along head header", errBadPeer)
Expand Down
52 changes: 52 additions & 0 deletions params/config_classic.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,58 @@ var (
1920000: common.HexToHash("0x94365e3a8c0b35089c1d1195081fe7489b528a84b22199c916180db8b28ade7f"),
2500000: common.HexToHash("0xca12c63534f565899681965528d536c52cb05b7c48e269c2a6cb77ad864d878a"),
},

TrustedCheckpoint: &ctypes.TrustedCheckpoint{
/*
eth/handler.go:

// If we have trusted checkpoints, enforce them on the chain
if config.Checkpoint != nil {
h.checkpointNumber = (config.Checkpoint.SectionIndex+1)*vars.CHTFrequency - 1
h.checkpointHash = config.Checkpoint.SectionHead
}

---

vars.CHTFrequency = 32768
SectionIndex = 554
SectionHead = ?

h.checkpointNumber = (config.Checkpoint.SectionIndex+1)*vars.CHTFrequency - 1
(554 + 1)*32768 - 1 = 18186239

tohex 18186239
0x1157fff

ethrpc --http-addr 'https://c5939282f04343249b36574c0eb41851.etc.rpc.rivet.cloud' eth_getBlockByNumber 0x1157fff false
{
"difficulty": "0x6a6bbe665e6ae",
"extraData": "0xe4b883e5bda9e7a59ee4bb99e9b1bc020621",
"gasLimit": "0x790003",
"gasUsed": "0x0",
"hash": "0xdc8f5a9e2193473e0f3a8591e12992163e61e1bda1ff62165d0596f774c6d968",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0x0239da7f7d5af4cff574c507bb6ce18ddc73b875",
"mixHash": "0xd3fbca722640d62c4c351ef4d594c0a0925859428bde707396e55c73052f3b08",
"nonce": "0x0e061fa013f2ca55",
"number": "0x1157fff",
"parentHash": "0x2b1ab0d1f439ba7a66d8d59cc14675689365d9ce8de8a9603a8fd3adbe2b1f9c",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x219",
"stateRoot": "0xa45491c784422a2109c6e54224888c1b708c5c1d5a64b08bab16bdee8b1b857d",
"timestamp": "0x64e77466",
"totalDifficulty": "0x14e449af4fc8b238926",
"transactions": [],
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"uncles": []
}
*/
SectionIndex: 554, // (18186239 of current 18_666_111)
SectionHead: common.HexToHash("0xdc8f5a9e2193473e0f3a8591e12992163e61e1bda1ff62165d0596f774c6d968"), // hash
CHTRoot: common.HexToHash("0xa45491c784422a2109c6e54224888c1b708c5c1d5a64b08bab16bdee8b1b857d"), // stateRoot
BloomRoot: common.Hash{}, // unnecessary and tough to derive (without les client or server)
},
}

DisinflationRateQuotient = big.NewInt(4) // Disinflation rate quotient for ECIP1017
Expand Down
Loading