Skip to content

Commit 365b829

Browse files
yiweichiranchalpjonastheisThegaram
authored
feat: add system config consensus to deprecate clique (#1102)
* feat: add system config consensus to deprecate poa * fix: check extra field lens * Finish implementation with one signer only * Implement unit tests * Only check signature if block not requested * Remove Extra from rlp encoding (and hashing) * Implement UpgradableEngine as middleware for Clique/SystemContract * Use isEuclid, add json tag to Requested, make go idiomatic * Changes post integration test * Remove comment * Address comments * Merge * New field BlockSignature (not used in hashing/JSON) * Enforce .Extra to be an empty slice * replace header.Requested for header.IsNewBlock * mark new block as IsNewBlock * Make new RLP optional fields always default for legacy/reth compatibility * Placing new fields as last non-zero rlp:optional values used by Scroll * Penalize nodes that send non-zero Euclid V2 header field values * Bring back .Requested to downloader instead of .IsNewBlock * Replace IsNewBlock for Requested * Address comments * merge * prevent timing issues in tests * fix ci * chore: auto version bump [bot] * Update consensus/system_contract/consensus.go Co-authored-by: Morty <[email protected]> * chore: auto version bump [bot] * Update consensus/system_contract/consensus.go Co-authored-by: Jonas Theis <[email protected]> * Remove whitespaces and merge version number * chore: auto version bump [bot] * validate that the read address from L1 is not empty and improved error handling when fetching address * Fix indentation issue * Fix test * goimports fix * goimports --------- Co-authored-by: Alejandro Ranchal-Pedrosa <[email protected]> Co-authored-by: jonastheis <[email protected]> Co-authored-by: jonastheis <[email protected]> Co-authored-by: ranchalp <[email protected]> Co-authored-by: Péter Garamvölgyi <[email protected]>
1 parent bcfdb48 commit 365b829

File tree

30 files changed

+1240
-72
lines changed

30 files changed

+1240
-72
lines changed

cmd/faucet/faucet.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ func newFaucet(genesis *core.Genesis, port int, enodes []*enode.Node, network ui
254254
cfg.Genesis = genesis
255255
utils.SetDNSDiscoveryDefaults(&cfg, genesis.ToBlock(nil).Hash())
256256

257-
lesBackend, err := les.New(stack, &cfg)
257+
lesBackend, err := les.New(stack, &cfg, nil)
258258
if err != nil {
259259
return nil, fmt.Errorf("Failed to register the Ethereum service: %w", err)
260260
}

cmd/utils/flags.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -2048,16 +2048,6 @@ func SetDNSDiscoveryDefaults(cfg *ethconfig.Config, genesis common.Hash) {
20482048
// The second return value is the full node instance, which may be nil if the
20492049
// node is running as a light client.
20502050
func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (ethapi.Backend, *eth.Ethereum) {
2051-
if cfg.SyncMode == downloader.LightSync {
2052-
backend, err := les.New(stack, cfg)
2053-
if err != nil {
2054-
Fatalf("Failed to register the Ethereum service: %v", err)
2055-
}
2056-
scrollTracerWrapper := tracing.NewTracerWrapper()
2057-
stack.RegisterAPIs(tracers.APIs(backend.ApiBackend, scrollTracerWrapper))
2058-
return backend.ApiBackend, nil
2059-
}
2060-
20612051
// initialize L1 client for sync service
20622052
// note: we need to do this here to avoid circular dependency
20632053
l1EndpointUrl := stack.Config().L1Endpoint
@@ -2073,6 +2063,16 @@ func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (ethapi.Backend
20732063
log.Info("Initialized L1 client", "endpoint", l1EndpointUrl)
20742064
}
20752065

2066+
if cfg.SyncMode == downloader.LightSync {
2067+
backend, err := les.New(stack, cfg, l1Client)
2068+
if err != nil {
2069+
Fatalf("Failed to register the Ethereum service: %v", err)
2070+
}
2071+
scrollTracerWrapper := tracing.NewTracerWrapper()
2072+
stack.RegisterAPIs(tracers.APIs(backend.ApiBackend, scrollTracerWrapper))
2073+
return backend.ApiBackend, nil
2074+
}
2075+
20762076
backend, err := eth.New(stack, cfg, l1Client)
20772077
if err != nil {
20782078
Fatalf("Failed to register the Ethereum service: %v", err)

consensus/system_contract/api.go

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package system_contract
2+
3+
import (
4+
"github.com/scroll-tech/go-ethereum/common"
5+
"github.com/scroll-tech/go-ethereum/consensus"
6+
"github.com/scroll-tech/go-ethereum/rpc"
7+
)
8+
9+
// API is a user facing RPC API to allow controlling the signer and voting
10+
// mechanisms of the proof-of-authority scheme.
11+
type API struct {
12+
chain consensus.ChainHeaderReader
13+
}
14+
15+
// GetSigners retrieves the list of authorized signers at the specified block.
16+
func (api *API) GetSigners(number *rpc.BlockNumber) ([]common.Address, error) {
17+
return nil, nil
18+
}

0 commit comments

Comments
 (0)