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

[WIP] Merge interop spec #23607

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
25b336d
consensus/clique: prevent 0 len extradata from panicing
MariusVanDerWijden Sep 6, 2021
50a145c
all: work for eth1/2 transtition
rjl493456442 Jul 19, 2021
49a4891
consensus/beacon, eth: change beacon difficulty to 0
rjl493456442 Jul 26, 2021
bc08e01
eth: updates
rjl493456442 Jul 30, 2021
a1645a4
all: add terminalBlockDifficulty config
rjl493456442 Jul 30, 2021
d460aa4
miner/stress/beacon: fix stress test
rjl493456442 Jul 30, 2021
150a1eb
core: rebased on master
MariusVanDerWijden Sep 20, 2021
cb89e26
eth: implemented merge interop spec
MariusVanDerWijden Sep 20, 2021
37ddc08
eth: fix tests, remove unused methods
MariusVanDerWijden Sep 22, 2021
881613d
eth: fix stress-test
MariusVanDerWijden Sep 22, 2021
bdb6070
eth/catalyst: regenerate api types
MariusVanDerWijden Sep 22, 2021
034da5a
eth, core: remove unusued code, fix typos
MariusVanDerWijden Sep 23, 2021
4e12000
eth: added api for exporting and importing blocks
MariusVanDerWijden Sep 23, 2021
6cde534
core: updated stale comment
MariusVanDerWijden Sep 23, 2021
dd773c7
eth/catalyst: better types, testing, first working protype
MariusVanDerWijden Sep 28, 2021
adb8626
eth/catalyst: added terminal difficulty check
MariusVanDerWijden Sep 28, 2021
4d4c298
eth/catalyst: use custom errors
MariusVanDerWijden Sep 28, 2021
b4aaa07
eth/catalyst: renamed api types, better adherence to spec
MariusVanDerWijden Sep 29, 2021
baf5760
eth/catalyst: fix random in payload, payloadid as hexutil
MariusVanDerWijden Sep 29, 2021
66130bc
eth/catalyst: forkChoiceUpdated -> forkchoiceUpdated
MariusVanDerWijden Sep 30, 2021
54313d1
internal/ethapi: update to v1.0.0.alpha.2
MariusVanDerWijden Oct 1, 2021
c77104b
eth/catalyst: properly set extradata
MariusVanDerWijden Oct 1, 2021
5f9101a
eth/catalyst: fix basefee setting
MariusVanDerWijden Oct 1, 2021
15ccb34
eth/catalyst: use *big.Int for basefee
MariusVanDerWijden Oct 2, 2021
84c734d
eth/catalyst: check that extradata is not longer than 32 bytes
MariusVanDerWijden Oct 2, 2021
299498d
consensus/beacon: verify extradata in header
MariusVanDerWijden Oct 2, 2021
3be59d3
eth/backend: correctly authorize inner engines
MariusVanDerWijden Oct 3, 2021
2e331a2
eth/catalyst: verify that totalDiff is reached when setting head
MariusVanDerWijden Oct 3, 2021
311635d
eth/catalyst: verify that totalDiff is reached when forkChoiceUpdated
MariusVanDerWijden Oct 3, 2021
4a8425d
eth/catalyst: verify that totalDiff is reached on executeBlock
MariusVanDerWijden Oct 3, 2021
ad5da55
eth/catalyst: prevent nil panic in checkTerminalTotalDifficulty
MariusVanDerWijden Oct 3, 2021
b798cbd
eth/catalyst: prevent nil panic in checkTerminalTotalDifficulty
MariusVanDerWijden Oct 3, 2021
54a5b2f
eth: reqid dispatcher, nuke fast sync, add beacon sync
karalabe Jul 5, 2021
00f3688
Merge pull request #21 from karalabe/merge-interop-spec-sync2
MariusVanDerWijden Oct 4, 2021
a094be5
miner: add totalDifficultyOverride flag
MariusVanDerWijden Oct 4, 2021
b1ff642
eth: minor sync polishes
karalabe Oct 4, 2021
716ff95
Merge pull request #22 from karalabe/merge-interop-spec-sync3
MariusVanDerWijden Oct 4, 2021
7834589
core, eth: various tiny fixups integrating sync
karalabe Oct 4, 2021
56bebd7
Merge pull request #23 from karalabe/merge-interop-spec-sync4
MariusVanDerWijden Oct 4, 2021
a0fe68b
eth/catalyst: fixed some tiny issues/nitpicks in api
MariusVanDerWijden Oct 4, 2021
deaa555
eth: disable legacy syncing on the merge interop pr for now
karalabe Oct 5, 2021
1216abb
Merge pull request #24 from karalabe/merge-interop-spec-sync5
MariusVanDerWijden Oct 5, 2021
9562d10
core: overwrite head header and fast block too on block sethead
karalabe Oct 5, 2021
1758b1a
Merge pull request #25 from karalabe/merge-interop-spec-sync6
MariusVanDerWijden Oct 5, 2021
0b0427d
miner: remove superflous log message
MariusVanDerWijden Oct 5, 2021
e90ede6
eth/downloader: restart the downloader after completion on new head
karalabe Oct 7, 2021
efad795
Merge pull request #27 from karalabe/merge-interop-spec-sync7
MariusVanDerWijden Oct 7, 2021
4b9ea81
eth: only sync with beers below the ttd
karalabe Oct 8, 2021
d28b16f
Merge pull request #28 from karalabe/merge-interop-spec-sync8
MariusVanDerWijden Oct 8, 2021
ac736f9
eth/catalyst: added GetHead endpoint for fuzzing
MariusVanDerWijden Oct 9, 2021
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
2 changes: 1 addition & 1 deletion accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ type SimulatedBackend struct {
func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
genesis := core.Genesis{Config: params.AllEthashProtocolChanges, GasLimit: gasLimit, Alloc: alloc}
genesis.MustCommit(database)
blockchain, _ := core.NewBlockChain(database, nil, genesis.Config, ethash.NewFaker(), vm.Config{}, nil, nil)
blockchain, _ := core.NewBlockChain(database, nil, genesis.Config, ethash.NewFaker(), vm.Config{}, nil, nil, core.NewMerger(database))

backend := &SimulatedBackend{
database: database,
Expand Down
14 changes: 3 additions & 11 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"github.com/ethereum/go-ethereum/accounts/scwallet"
"github.com/ethereum/go-ethereum/accounts/usbwallet"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/eth/catalyst"
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/log"
Expand Down Expand Up @@ -159,17 +158,10 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
if ctx.GlobalIsSet(utils.OverrideLondonFlag.Name) {
cfg.Eth.OverrideLondon = new(big.Int).SetUint64(ctx.GlobalUint64(utils.OverrideLondonFlag.Name))
}
backend, eth := utils.RegisterEthService(stack, &cfg.Eth)

// Configure catalyst.
if ctx.GlobalBool(utils.CatalystFlag.Name) {
if eth == nil {
utils.Fatalf("Catalyst does not work in light client mode.")
}
if err := catalyst.Register(stack, eth); err != nil {
utils.Fatalf("%v", err)
}
if ctx.GlobalIsSet(utils.OverrideTotalTerminalDifficulty.Name) {
cfg.Eth.Genesis.Config.TerminalTotalDifficulty = new(big.Int).SetUint64(ctx.GlobalUint64(utils.OverrideTotalTerminalDifficulty.Name))
}
backend, _ := utils.RegisterEthService(stack, &cfg.Eth, ctx.GlobalBool(utils.CatalystFlag.Name))

// Configure GraphQL if requested
if ctx.GlobalIsSet(utils.GraphQLEnabledFlag.Name) {
Expand Down
1 change: 1 addition & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ var (
utils.USBFlag,
utils.SmartCardDaemonPathFlag,
utils.OverrideLondonFlag,
utils.OverrideTotalTerminalDifficulty,
utils.EthashCacheDirFlag,
utils.EthashCachesInMemoryFlag,
utils.EthashCachesOnDiskFlag,
Expand Down
23 changes: 19 additions & 4 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth/catalyst"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/eth/gasprice"
Expand Down Expand Up @@ -205,7 +206,7 @@ var (
defaultSyncMode = ethconfig.Defaults.SyncMode
SyncModeFlag = TextMarshalerFlag{
Name: "syncmode",
Usage: `Blockchain sync mode ("fast", "full", "snap" or "light")`,
Usage: `Blockchain sync mode ("snap", "full" or "light")`,
Value: &defaultSyncMode,
}
GCModeFlag = cli.StringFlag{
Expand Down Expand Up @@ -239,6 +240,10 @@ var (
Name: "override.london",
Usage: "Manually specify London fork-block, overriding the bundled setting",
}
OverrideTotalTerminalDifficulty = cli.Uint64Flag{
Name: "override.totalterminaldifficulty",
Usage: "Manually specify TotalTerminalDifficulty, overriding the bundled setting",
}
// Light server and client settings
LightServeFlag = cli.IntFlag{
Name: "light.serve",
Expand Down Expand Up @@ -1177,7 +1182,7 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
cfg.NetRestrict = list
}

if ctx.GlobalBool(DeveloperFlag.Name) || ctx.GlobalBool(CatalystFlag.Name) {
if ctx.GlobalBool(DeveloperFlag.Name) {
// --dev mode can't use p2p networking.
cfg.MaxPeers = 0
cfg.ListenAddr = ""
Expand Down Expand Up @@ -1675,13 +1680,18 @@ func SetDNSDiscoveryDefaults(cfg *ethconfig.Config, genesis common.Hash) {
// RegisterEthService adds an Ethereum client to the stack.
// The second return value is the full node instance, which may be nil if the
// node is running as a light client.
func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (ethapi.Backend, *eth.Ethereum) {
func RegisterEthService(stack *node.Node, cfg *ethconfig.Config, isCatalyst bool) (ethapi.Backend, *eth.Ethereum) {
if cfg.SyncMode == downloader.LightSync {
backend, err := les.New(stack, cfg)
if err != nil {
Fatalf("Failed to register the Ethereum service: %v", err)
}
stack.RegisterAPIs(tracers.APIs(backend.ApiBackend))
if isCatalyst {
if err := catalyst.RegisterLight(stack, backend); err != nil {
Fatalf("Failed to register the catalyst service: %v", err)
}
}
return backend.ApiBackend, nil
}
backend, err := eth.New(stack, cfg)
Expand All @@ -1694,6 +1704,11 @@ func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (ethapi.Backend
Fatalf("Failed to create the LES server: %v", err)
}
}
if isCatalyst {
if err := catalyst.Register(stack, backend); err != nil {
Fatalf("Failed to register the catalyst service: %v", err)
}
}
stack.RegisterAPIs(tracers.APIs(backend.APIBackend))
return backend.APIBackend, backend
}
Expand Down Expand Up @@ -1883,7 +1898,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai

// TODO(rjl493456442) disable snapshot generation/wiping if the chain is read only.
// Disable transaction indexing/unindexing by default.
chain, err = core.NewBlockChain(chainDb, cache, config, engine, vmcfg, nil, nil)
chain, err = core.NewBlockChain(chainDb, cache, config, engine, vmcfg, nil, nil, core.NewMerger(chainDb))
if err != nil {
Fatalf("Can't create BlockChain: %v", err)
}
Expand Down
Loading