Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
ref impl: Address PR Comments
Browse files Browse the repository at this point in the history
- var -> const (+ removing som extra copies)
- Rename BlockPreparer interface to Engine
- Remove out of date comment and update safe block
  • Loading branch information
trianglesphere committed Mar 21, 2022
1 parent 6b988c3 commit 22ccfed
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
5 changes: 1 addition & 4 deletions opnode/l1/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
)

var WrongChainErr = errors.New("wrong chain")
var TooDeepReorgErr = errors.New("reorg is too deep")
var MaxReorgDepth = 500
var MaxBlocksInL1Range = uint64(100)
const MaxBlocksInL1Range = uint64(100)

type Source struct {
client *ethclient.Client
Expand Down
2 changes: 1 addition & 1 deletion opnode/rollup/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Downloader interface {
FetchTransactions(ctx context.Context, window []eth.BlockID) ([]*types.Transaction, error)
}

type BlockPreparer interface {
type Engine interface {
GetPayload(ctx context.Context, payloadId l2.PayloadID) (*l2.ExecutionPayload, error)
ForkchoiceUpdate(ctx context.Context, state *l2.ForkchoiceState, attr *l2.PayloadAttributes) (*l2.ForkchoiceUpdatedResult, error)
ExecutePayload(ctx context.Context, payload *l2.ExecutionPayload) error
Expand Down
6 changes: 4 additions & 2 deletions opnode/rollup/driver/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

type outputImpl struct {
dl Downloader
l2 BlockPreparer
l2 Engine
log log.Logger
Config rollup.Config
}
Expand Down Expand Up @@ -176,7 +176,9 @@ func (d *outputImpl) step(ctx context.Context, l2Head eth.BlockID, l2Finalized e
return last, fmt.Errorf("failed to extend L2 chain at block %d/%d of epoch %d: %w", i, len(batches), epoch, err)
}
last = payload.ID()
fc.HeadBlockHash = last.Hash // should be safe block, but geth is broken
// TODO(Joshua): Update this to handle verifiers + sequencers
fc.HeadBlockHash = last.Hash
fc.SafeBlockHash = last.Hash
}

return last, nil
Expand Down
3 changes: 2 additions & 1 deletion opnode/rollup/sync/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ type L2Chain interface {

var WrongChainErr = errors.New("wrong chain")
var TooDeepReorgErr = errors.New("reorg is too deep")
var MaxReorgDepth = 500

const MaxReorgDepth = 500

// FindSafeL2Head takes the supplied L2 start block and walks the L2 chain until it finds the first L2 block reachable from the supplied
// block that is also canonical.
Expand Down

0 comments on commit 22ccfed

Please sign in to comment.