Skip to content

Commit

Permalink
feat: add system config consensus to deprecate poa
Browse files Browse the repository at this point in the history
  • Loading branch information
yiweichi committed Dec 15, 2024
1 parent bdf64cf commit ef0fef8
Show file tree
Hide file tree
Showing 13 changed files with 543 additions and 19 deletions.
2 changes: 1 addition & 1 deletion cmd/faucet/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func newFaucet(genesis *core.Genesis, port int, enodes []*enode.Node, network ui
cfg.Genesis = genesis
utils.SetDNSDiscoveryDefaults(&cfg, genesis.ToBlock(nil).Hash())

lesBackend, err := les.New(stack, &cfg)
lesBackend, err := les.New(stack, &cfg, nil)
if err != nil {
return nil, fmt.Errorf("Failed to register the Ethereum service: %w", err)
}
Expand Down
20 changes: 10 additions & 10 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1943,16 +1943,6 @@ func SetDNSDiscoveryDefaults(cfg *ethconfig.Config, genesis common.Hash) {
// 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) {
if cfg.SyncMode == downloader.LightSync {
backend, err := les.New(stack, cfg)
if err != nil {
Fatalf("Failed to register the Ethereum service: %v", err)
}
scrollTracerWrapper := tracing.NewTracerWrapper()
stack.RegisterAPIs(tracers.APIs(backend.ApiBackend, scrollTracerWrapper))
return backend.ApiBackend, nil
}

// initialize L1 client for sync service
// note: we need to do this here to avoid circular dependency
l1EndpointUrl := stack.Config().L1Endpoint
Expand All @@ -1968,6 +1958,16 @@ func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (ethapi.Backend
log.Info("Initialized L1 client", "endpoint", l1EndpointUrl)
}

if cfg.SyncMode == downloader.LightSync {
backend, err := les.New(stack, cfg, l1Client)
if err != nil {
Fatalf("Failed to register the Ethereum service: %v", err)
}
scrollTracerWrapper := tracing.NewTracerWrapper()
stack.RegisterAPIs(tracers.APIs(backend.ApiBackend, scrollTracerWrapper))
return backend.ApiBackend, nil
}

backend, err := eth.New(stack, cfg, l1Client)
if err != nil {
Fatalf("Failed to register the Ethereum service: %v", err)
Expand Down
18 changes: 18 additions & 0 deletions consensus/system_contract/api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package system_contract

import (
"github.com/scroll-tech/go-ethereum/common"
"github.com/scroll-tech/go-ethereum/consensus"
"github.com/scroll-tech/go-ethereum/rpc"
)

// API is a user facing RPC API to allow controlling the signer and voting
// mechanisms of the proof-of-authority scheme.
type API struct {
chain consensus.ChainHeaderReader
}

// GetSigners retrieves the list of authorized signers at the specified block.
func (api *API) GetSigners(number *rpc.BlockNumber) ([]common.Address, error) {
return nil, nil
}
Loading

0 comments on commit ef0fef8

Please sign in to comment.