Commit b30efa44 authored by pcw109550's avatar pcw109550

Rename span batch hardfork to delta hard fork

parent 0c62c8e7
...@@ -112,9 +112,9 @@ type DeployConfig struct { ...@@ -112,9 +112,9 @@ type DeployConfig struct {
// L2GenesisCanyonTimeOffset is the number of seconds after genesis block that Canyon hard fork activates. // L2GenesisCanyonTimeOffset is the number of seconds after genesis block that Canyon hard fork activates.
// Set it to 0 to activate at genesis. Nil to disable Canyon. // Set it to 0 to activate at genesis. Nil to disable Canyon.
L2GenesisCanyonTimeOffset *hexutil.Uint64 `json:"l2GenesisCanyonTimeOffset,omitempty"` L2GenesisCanyonTimeOffset *hexutil.Uint64 `json:"l2GenesisCanyonTimeOffset,omitempty"`
// L2GenesisSpanBatchTimeOffset is the number of seconds after genesis block that Span Batch hard fork activates. // L2GenesisDeltaTimeOffset is the number of seconds after genesis block that Delta hard fork activates.
// Set it to 0 to activate at genesis. Nil to disable SpanBatch. // Set it to 0 to activate at genesis. Nil to disable Delta.
L2GenesisSpanBatchTimeOffset *hexutil.Uint64 `json:"l2GenesisSpanBatchTimeOffset,omitempty"` L2GenesisDeltaTimeOffset *hexutil.Uint64 `json:"l2GenesisDeltaTimeOffset,omitempty"`
// L2GenesisBlockExtraData is configurable extradata. Will default to []byte("BEDROCK") if left unspecified. // L2GenesisBlockExtraData is configurable extradata. Will default to []byte("BEDROCK") if left unspecified.
L2GenesisBlockExtraData []byte `json:"l2GenesisBlockExtraData"` L2GenesisBlockExtraData []byte `json:"l2GenesisBlockExtraData"`
// ProxyAdminOwner represents the owner of the ProxyAdmin predeploy on L2. // ProxyAdminOwner represents the owner of the ProxyAdmin predeploy on L2.
...@@ -459,12 +459,12 @@ func (d *DeployConfig) CanyonTime(genesisTime uint64) *uint64 { ...@@ -459,12 +459,12 @@ func (d *DeployConfig) CanyonTime(genesisTime uint64) *uint64 {
return &v return &v
} }
func (d *DeployConfig) SpanBatchTime(genesisTime uint64) *uint64 { func (d *DeployConfig) DeltaTime(genesisTime uint64) *uint64 {
if d.L2GenesisSpanBatchTimeOffset == nil { if d.L2GenesisDeltaTimeOffset == nil {
return nil return nil
} }
v := uint64(0) v := uint64(0)
if offset := *d.L2GenesisSpanBatchTimeOffset; offset > 0 { if offset := *d.L2GenesisDeltaTimeOffset; offset > 0 {
v = genesisTime + uint64(offset) v = genesisTime + uint64(offset)
} }
return &v return &v
...@@ -508,7 +508,7 @@ func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHas ...@@ -508,7 +508,7 @@ func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHas
L1SystemConfigAddress: d.SystemConfigProxy, L1SystemConfigAddress: d.SystemConfigProxy,
RegolithTime: d.RegolithTime(l1StartBlock.Time()), RegolithTime: d.RegolithTime(l1StartBlock.Time()),
CanyonTime: d.CanyonTime(l1StartBlock.Time()), CanyonTime: d.CanyonTime(l1StartBlock.Time()),
SpanBatchTime: d.SpanBatchTime(l1StartBlock.Time()), DeltaTime: d.DeltaTime(l1StartBlock.Time()),
}, nil }, nil
} }
......
...@@ -17,7 +17,7 @@ import ( ...@@ -17,7 +17,7 @@ import (
func TestBlockTimeBatchType(t *testing.T) { func TestBlockTimeBatchType(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
f func(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) f func(gt *testing.T, deltaTimeOffset *hexutil.Uint64)
}{ }{
{"BatchInLastPossibleBlocks", BatchInLastPossibleBlocks}, {"BatchInLastPossibleBlocks", BatchInLastPossibleBlocks},
{"LargeL1Gaps", LargeL1Gaps}, {"LargeL1Gaps", LargeL1Gaps},
...@@ -29,11 +29,11 @@ func TestBlockTimeBatchType(t *testing.T) { ...@@ -29,11 +29,11 @@ func TestBlockTimeBatchType(t *testing.T) {
}) })
} }
spanBatchTimeOffset := hexutil.Uint64(0) deltaTimeOffset := hexutil.Uint64(0)
for _, test := range tests { for _, test := range tests {
test := test test := test
t.Run(test.name+"_SpanBatch", func(t *testing.T) { t.Run(test.name+"_SpanBatch", func(t *testing.T) {
test.f(t, &spanBatchTimeOffset) test.f(t, &deltaTimeOffset)
}) })
} }
} }
...@@ -43,10 +43,10 @@ func TestBlockTimeBatchType(t *testing.T) { ...@@ -43,10 +43,10 @@ func TestBlockTimeBatchType(t *testing.T) {
// where there are also no other batches included in the sequence // where there are also no other batches included in the sequence
// window. // window.
// This is a regression test against the bug fixed in PR #4566 // This is a regression test against the bug fixed in PR #4566
func BatchInLastPossibleBlocks(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func BatchInLastPossibleBlocks(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
dp.DeployConfig.SequencerWindowSize = 4 dp.DeployConfig.SequencerWindowSize = 4
dp.DeployConfig.L2BlockTime = 2 dp.DeployConfig.L2BlockTime = 2
...@@ -154,14 +154,14 @@ func BatchInLastPossibleBlocks(gt *testing.T, spanBatchTimeOffset *hexutil.Uint6 ...@@ -154,14 +154,14 @@ func BatchInLastPossibleBlocks(gt *testing.T, spanBatchTimeOffset *hexutil.Uint6
// Then it generates 3 more L1 blocks. // Then it generates 3 more L1 blocks.
// At this point it can verify that the batches where properly generated. // At this point it can verify that the batches where properly generated.
// Note: It batches submits when possible. // Note: It batches submits when possible.
func LargeL1Gaps(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func LargeL1Gaps(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
dp.DeployConfig.L1BlockTime = 4 dp.DeployConfig.L1BlockTime = 4
dp.DeployConfig.L2BlockTime = 2 dp.DeployConfig.L2BlockTime = 2
dp.DeployConfig.SequencerWindowSize = 4 dp.DeployConfig.SequencerWindowSize = 4
dp.DeployConfig.MaxSequencerDrift = 32 dp.DeployConfig.MaxSequencerDrift = 32
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlDebug) log := testlog.Logger(t, log.LvlDebug)
......
...@@ -157,7 +157,7 @@ func (s *L2Batcher) Buffer(t Testing) error { ...@@ -157,7 +157,7 @@ func (s *L2Batcher) Buffer(t Testing) error {
var batchType uint = derive.SingularBatchType var batchType uint = derive.SingularBatchType
var spanBatchBuilder *derive.SpanBatchBuilder = nil var spanBatchBuilder *derive.SpanBatchBuilder = nil
if s.rollupCfg.IsSpanBatch(block.Time()) { if s.rollupCfg.IsDelta(block.Time()) {
batchType = derive.SpanBatchType batchType = derive.SpanBatchType
spanBatchBuilder = derive.NewSpanBatchBuilder(s.rollupCfg.Genesis.L2Time, s.rollupCfg.L2ChainID) spanBatchBuilder = derive.NewSpanBatchBuilder(s.rollupCfg.Genesis.L2Time, s.rollupCfg.L2ChainID)
} }
......
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,7 @@ import (
func TestL2BatcherBatchType(t *testing.T) { func TestL2BatcherBatchType(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
f func(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) f func(gt *testing.T, deltaTimeOffset *hexutil.Uint64)
}{ }{
{"NormalBatcher", NormalBatcher}, {"NormalBatcher", NormalBatcher},
{"L2Finalization", L2Finalization}, {"L2Finalization", L2Finalization},
...@@ -41,16 +41,16 @@ func TestL2BatcherBatchType(t *testing.T) { ...@@ -41,16 +41,16 @@ func TestL2BatcherBatchType(t *testing.T) {
}) })
} }
spanBatchTimeOffset := hexutil.Uint64(0) deltaTimeOffset := hexutil.Uint64(0)
for _, test := range tests { for _, test := range tests {
test := test test := test
t.Run(test.name+"_SpanBatch", func(t *testing.T) { t.Run(test.name+"_SpanBatch", func(t *testing.T) {
test.f(t, &spanBatchTimeOffset) test.f(t, &deltaTimeOffset)
}) })
} }
} }
func NormalBatcher(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func NormalBatcher(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
p := &e2eutils.TestParams{ p := &e2eutils.TestParams{
MaxSequencerDrift: 20, // larger than L1 block time we simulate in this test (12) MaxSequencerDrift: 20, // larger than L1 block time we simulate in this test (12)
...@@ -59,7 +59,7 @@ func NormalBatcher(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -59,7 +59,7 @@ func NormalBatcher(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
L1BlockTime: 12, L1BlockTime: 12,
} }
dp := e2eutils.MakeDeployParams(t, p) dp := e2eutils.MakeDeployParams(t, p)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlDebug) log := testlog.Logger(t, log.LvlDebug)
miner, seqEngine, sequencer := setupSequencerTest(t, sd, log) miner, seqEngine, sequencer := setupSequencerTest(t, sd, log)
...@@ -128,10 +128,10 @@ func NormalBatcher(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -128,10 +128,10 @@ func NormalBatcher(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
require.NotNil(t, vTx) require.NotNil(t, vTx)
} }
func L2Finalization(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func L2Finalization(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlDebug) log := testlog.Logger(t, log.LvlDebug)
miner, engine, sequencer := setupSequencerTest(t, sd, log) miner, engine, sequencer := setupSequencerTest(t, sd, log)
...@@ -235,10 +235,10 @@ func L2Finalization(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -235,10 +235,10 @@ func L2Finalization(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
} }
// L2FinalizationWithSparseL1 tests that safe L2 blocks can be finalized even if we do not regularly get a L1 finalization signal // L2FinalizationWithSparseL1 tests that safe L2 blocks can be finalized even if we do not regularly get a L1 finalization signal
func L2FinalizationWithSparseL1(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func L2FinalizationWithSparseL1(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlDebug) log := testlog.Logger(t, log.LvlDebug)
miner, engine, sequencer := setupSequencerTest(t, sd, log) miner, engine, sequencer := setupSequencerTest(t, sd, log)
...@@ -294,11 +294,11 @@ func L2FinalizationWithSparseL1(gt *testing.T, spanBatchTimeOffset *hexutil.Uint ...@@ -294,11 +294,11 @@ func L2FinalizationWithSparseL1(gt *testing.T, spanBatchTimeOffset *hexutil.Uint
// GarbageBatch tests the behavior of an invalid/malformed output channel frame containing // GarbageBatch tests the behavior of an invalid/malformed output channel frame containing
// valid batches being submitted to the batch inbox. These batches should always be rejected // valid batches being submitted to the batch inbox. These batches should always be rejected
// and the safe L2 head should remain unaltered. // and the safe L2 head should remain unaltered.
func GarbageBatch(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func GarbageBatch(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
p := defaultRollupTestParams p := defaultRollupTestParams
dp := e2eutils.MakeDeployParams(t, p) dp := e2eutils.MakeDeployParams(t, p)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
for _, garbageKind := range GarbageKinds { for _, garbageKind := range GarbageKinds {
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlError) log := testlog.Logger(t, log.LvlError)
...@@ -374,7 +374,7 @@ func GarbageBatch(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -374,7 +374,7 @@ func GarbageBatch(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
} }
} }
func ExtendedTimeWithoutL1Batches(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func ExtendedTimeWithoutL1Batches(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
p := &e2eutils.TestParams{ p := &e2eutils.TestParams{
MaxSequencerDrift: 20, // larger than L1 block time we simulate in this test (12) MaxSequencerDrift: 20, // larger than L1 block time we simulate in this test (12)
...@@ -383,7 +383,7 @@ func ExtendedTimeWithoutL1Batches(gt *testing.T, spanBatchTimeOffset *hexutil.Ui ...@@ -383,7 +383,7 @@ func ExtendedTimeWithoutL1Batches(gt *testing.T, spanBatchTimeOffset *hexutil.Ui
L1BlockTime: 12, L1BlockTime: 12,
} }
dp := e2eutils.MakeDeployParams(t, p) dp := e2eutils.MakeDeployParams(t, p)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlError) log := testlog.Logger(t, log.LvlError)
miner, engine, sequencer := setupSequencerTest(t, sd, log) miner, engine, sequencer := setupSequencerTest(t, sd, log)
...@@ -433,7 +433,7 @@ func ExtendedTimeWithoutL1Batches(gt *testing.T, spanBatchTimeOffset *hexutil.Ui ...@@ -433,7 +433,7 @@ func ExtendedTimeWithoutL1Batches(gt *testing.T, spanBatchTimeOffset *hexutil.Ui
// The goal of this test is to quickly run through an otherwise very slow process of submitting and including lots of data. // The goal of this test is to quickly run through an otherwise very slow process of submitting and including lots of data.
// This does not test the batcher code, but is really focused at testing the batcher utils // This does not test the batcher code, but is really focused at testing the batcher utils
// and channel-decoding verifier code in the derive package. // and channel-decoding verifier code in the derive package.
func BigL2Txs(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func BigL2Txs(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
p := &e2eutils.TestParams{ p := &e2eutils.TestParams{
MaxSequencerDrift: 100, MaxSequencerDrift: 100,
...@@ -442,7 +442,7 @@ func BigL2Txs(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -442,7 +442,7 @@ func BigL2Txs(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
L1BlockTime: 12, L1BlockTime: 12,
} }
dp := e2eutils.MakeDeployParams(t, p) dp := e2eutils.MakeDeployParams(t, p)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlInfo) log := testlog.Logger(t, log.LvlInfo)
miner, engine, sequencer := setupSequencerTest(t, sd, log) miner, engine, sequencer := setupSequencerTest(t, sd, log)
......
...@@ -19,7 +19,7 @@ import ( ...@@ -19,7 +19,7 @@ import (
func TestProposerBatchType(t *testing.T) { func TestProposerBatchType(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
f func(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) f func(gt *testing.T, deltaTimeOffset *hexutil.Uint64)
}{ }{
{"RunProposerTest", RunProposerTest}, {"RunProposerTest", RunProposerTest},
} }
...@@ -30,19 +30,19 @@ func TestProposerBatchType(t *testing.T) { ...@@ -30,19 +30,19 @@ func TestProposerBatchType(t *testing.T) {
}) })
} }
spanBatchTimeOffset := hexutil.Uint64(0) deltaTimeOffset := hexutil.Uint64(0)
for _, test := range tests { for _, test := range tests {
test := test test := test
t.Run(test.name+"_SpanBatch", func(t *testing.T) { t.Run(test.name+"_SpanBatch", func(t *testing.T) {
test.f(t, &spanBatchTimeOffset) test.f(t, &deltaTimeOffset)
}) })
} }
} }
func RunProposerTest(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func RunProposerTest(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlDebug) log := testlog.Logger(t, log.LvlDebug)
miner, seqEngine, sequencer := setupSequencerTest(t, sd, log) miner, seqEngine, sequencer := setupSequencerTest(t, sd, log)
......
...@@ -22,9 +22,9 @@ import ( ...@@ -22,9 +22,9 @@ import (
"github.com/ethereum-optimism/optimism/op-service/testlog" "github.com/ethereum-optimism/optimism/op-service/testlog"
) )
func setupReorgTest(t Testing, config *e2eutils.TestParams, spanBatchTimeOffset *hexutil.Uint64) (*e2eutils.SetupData, *e2eutils.DeployParams, *L1Miner, *L2Sequencer, *L2Engine, *L2Verifier, *L2Engine, *L2Batcher) { func setupReorgTest(t Testing, config *e2eutils.TestParams, deltaTimeOffset *hexutil.Uint64) (*e2eutils.SetupData, *e2eutils.DeployParams, *L1Miner, *L2Sequencer, *L2Engine, *L2Verifier, *L2Engine, *L2Batcher) {
dp := e2eutils.MakeDeployParams(t, config) dp := e2eutils.MakeDeployParams(t, config)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlDebug) log := testlog.Logger(t, log.LvlDebug)
...@@ -50,7 +50,7 @@ func setupReorgTestActors(t Testing, dp *e2eutils.DeployParams, sd *e2eutils.Set ...@@ -50,7 +50,7 @@ func setupReorgTestActors(t Testing, dp *e2eutils.DeployParams, sd *e2eutils.Set
func TestReorgBatchType(t *testing.T) { func TestReorgBatchType(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
f func(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) f func(gt *testing.T, deltaTimeOffset *hexutil.Uint64)
}{ }{
{"ReorgOrphanBlock", ReorgOrphanBlock}, {"ReorgOrphanBlock", ReorgOrphanBlock},
{"ReorgFlipFlop", ReorgFlipFlop}, {"ReorgFlipFlop", ReorgFlipFlop},
...@@ -66,18 +66,18 @@ func TestReorgBatchType(t *testing.T) { ...@@ -66,18 +66,18 @@ func TestReorgBatchType(t *testing.T) {
}) })
} }
spanBatchTimeOffset := hexutil.Uint64(0) deltaTimeOffset := hexutil.Uint64(0)
for _, test := range tests { for _, test := range tests {
test := test test := test
t.Run(test.name+"_SpanBatch", func(t *testing.T) { t.Run(test.name+"_SpanBatch", func(t *testing.T) {
test.f(t, &spanBatchTimeOffset) test.f(t, &deltaTimeOffset)
}) })
} }
} }
func ReorgOrphanBlock(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func ReorgOrphanBlock(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
sd, _, miner, sequencer, _, verifier, verifierEng, batcher := setupReorgTest(t, defaultRollupTestParams, spanBatchTimeOffset) sd, _, miner, sequencer, _, verifier, verifierEng, batcher := setupReorgTest(t, defaultRollupTestParams, deltaTimeOffset)
verifEngClient := verifierEng.EngineClient(t, sd.RollupCfg) verifEngClient := verifierEng.EngineClient(t, sd.RollupCfg)
sequencer.ActL2PipelineFull(t) sequencer.ActL2PipelineFull(t)
...@@ -143,9 +143,9 @@ func ReorgOrphanBlock(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -143,9 +143,9 @@ func ReorgOrphanBlock(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
require.Equal(t, verifier.L2Safe(), sequencer.L2Safe(), "verifier and sequencer see same safe L2 block, while only verifier dealt with the orphan and replay") require.Equal(t, verifier.L2Safe(), sequencer.L2Safe(), "verifier and sequencer see same safe L2 block, while only verifier dealt with the orphan and replay")
} }
func ReorgFlipFlop(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func ReorgFlipFlop(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
sd, _, miner, sequencer, _, verifier, verifierEng, batcher := setupReorgTest(t, defaultRollupTestParams, spanBatchTimeOffset) sd, _, miner, sequencer, _, verifier, verifierEng, batcher := setupReorgTest(t, defaultRollupTestParams, deltaTimeOffset)
minerCl := miner.L1Client(t, sd.RollupCfg) minerCl := miner.L1Client(t, sd.RollupCfg)
verifEngClient := verifierEng.EngineClient(t, sd.RollupCfg) verifEngClient := verifierEng.EngineClient(t, sd.RollupCfg)
checkVerifEngine := func() { checkVerifEngine := func() {
...@@ -220,12 +220,12 @@ func ReorgFlipFlop(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -220,12 +220,12 @@ func ReorgFlipFlop(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
verifier.ActL2PipelineFull(t) verifier.ActL2PipelineFull(t)
require.Equal(t, sd.RollupCfg.Genesis.L1, verifier.L2Safe().L1Origin, "expected to be back at genesis origin after losing A0 and A1") require.Equal(t, sd.RollupCfg.Genesis.L1, verifier.L2Safe().L1Origin, "expected to be back at genesis origin after losing A0 and A1")
if sd.RollupCfg.SpanBatchTime == nil { if sd.RollupCfg.DeltaTime == nil {
// before span batch hard fork // before delta hard fork
require.NotZero(t, verifier.L2Safe().Number, "still preserving old L2 blocks that did not reference reorged L1 chain (assuming more than one L2 block per L1 block)") require.NotZero(t, verifier.L2Safe().Number, "still preserving old L2 blocks that did not reference reorged L1 chain (assuming more than one L2 block per L1 block)")
require.Equal(t, verifier.L2Safe(), verifier.L2Unsafe(), "head is at safe block after L1 reorg") require.Equal(t, verifier.L2Safe(), verifier.L2Unsafe(), "head is at safe block after L1 reorg")
} else { } else {
// after span batch hard fork // after delta hard fork
require.Zero(t, verifier.L2Safe().Number, "safe head is at genesis block because span batch referenced reorged L1 chain is not accepted") require.Zero(t, verifier.L2Safe().Number, "safe head is at genesis block because span batch referenced reorged L1 chain is not accepted")
require.Equal(t, verifier.L2Unsafe().ID(), sequencer.L2Unsafe().ParentID(), "head is at the highest unsafe block that references canonical L1 chain(genesis block)") require.Equal(t, verifier.L2Unsafe().ID(), sequencer.L2Unsafe().ParentID(), "head is at the highest unsafe block that references canonical L1 chain(genesis block)")
batcher.l2BufferedBlock = eth.L2BlockRef{} // must reset batcher to resubmit blocks included in the last batch batcher.l2BufferedBlock = eth.L2BlockRef{} // must reset batcher to resubmit blocks included in the last batch
...@@ -364,7 +364,7 @@ func ReorgFlipFlop(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -364,7 +364,7 @@ func ReorgFlipFlop(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
// Verifier // Verifier
// - Unsafe head is 62 // - Unsafe head is 62
// - Safe head is 42 // - Safe head is 42
func DeepReorg(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func DeepReorg(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
// Create actor and verification engine client // Create actor and verification engine client
...@@ -373,7 +373,7 @@ func DeepReorg(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -373,7 +373,7 @@ func DeepReorg(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
SequencerWindowSize: 20, SequencerWindowSize: 20,
ChannelTimeout: 120, ChannelTimeout: 120,
L1BlockTime: 4, L1BlockTime: 4,
}, spanBatchTimeOffset) }, deltaTimeOffset)
minerCl := miner.L1Client(t, sd.RollupCfg) minerCl := miner.L1Client(t, sd.RollupCfg)
l2Client := seqEngine.EthClient() l2Client := seqEngine.EthClient()
verifEngClient := verifierEng.EngineClient(t, sd.RollupCfg) verifEngClient := verifierEng.EngineClient(t, sd.RollupCfg)
...@@ -599,7 +599,7 @@ type rpcWrapper struct { ...@@ -599,7 +599,7 @@ type rpcWrapper struct {
// RestartOpGeth tests that the sequencer can restart its execution engine without rollup-node restart, // RestartOpGeth tests that the sequencer can restart its execution engine without rollup-node restart,
// including recovering the finalized/safe state of L2 chain without reorging. // including recovering the finalized/safe state of L2 chain without reorging.
func RestartOpGeth(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func RestartOpGeth(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dbPath := path.Join(t.TempDir(), "testdb") dbPath := path.Join(t.TempDir(), "testdb")
dbOption := func(_ *ethconfig.Config, nodeCfg *node.Config) error { dbOption := func(_ *ethconfig.Config, nodeCfg *node.Config) error {
...@@ -607,7 +607,7 @@ func RestartOpGeth(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -607,7 +607,7 @@ func RestartOpGeth(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
return nil return nil
} }
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlDebug) log := testlog.Logger(t, log.LvlDebug)
jwtPath := e2eutils.WriteDefaultJWT(t) jwtPath := e2eutils.WriteDefaultJWT(t)
...@@ -695,10 +695,10 @@ func RestartOpGeth(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -695,10 +695,10 @@ func RestartOpGeth(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
// ConflictingL2Blocks tests that a second copy of the sequencer stack cannot introduce an alternative // ConflictingL2Blocks tests that a second copy of the sequencer stack cannot introduce an alternative
// L2 block (compared to something already secured by the first sequencer): // L2 block (compared to something already secured by the first sequencer):
// the alt block is not synced by the verifier, in unsafe and safe sync modes. // the alt block is not synced by the verifier, in unsafe and safe sync modes.
func ConflictingL2Blocks(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func ConflictingL2Blocks(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlDebug) log := testlog.Logger(t, log.LvlDebug)
...@@ -805,7 +805,7 @@ func ConflictingL2Blocks(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -805,7 +805,7 @@ func ConflictingL2Blocks(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
require.Equal(t, sequencer.L2Unsafe(), altSequencer.L2Unsafe(), "and gets back in harmony with original sequencer") require.Equal(t, sequencer.L2Unsafe(), altSequencer.L2Unsafe(), "and gets back in harmony with original sequencer")
} }
func SyncAfterReorg(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func SyncAfterReorg(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
testingParams := e2eutils.TestParams{ testingParams := e2eutils.TestParams{
MaxSequencerDrift: 60, MaxSequencerDrift: 60,
...@@ -813,7 +813,7 @@ func SyncAfterReorg(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -813,7 +813,7 @@ func SyncAfterReorg(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
ChannelTimeout: 2, ChannelTimeout: 2,
L1BlockTime: 12, L1BlockTime: 12,
} }
sd, dp, miner, sequencer, seqEngine, verifier, _, batcher := setupReorgTest(t, &testingParams, spanBatchTimeOffset) sd, dp, miner, sequencer, seqEngine, verifier, _, batcher := setupReorgTest(t, &testingParams, deltaTimeOffset)
l2Client := seqEngine.EthClient() l2Client := seqEngine.EthClient()
log := testlog.Logger(t, log.LvlDebug) log := testlog.Logger(t, log.LvlDebug)
addresses := e2eutils.CollectAddresses(sd, dp) addresses := e2eutils.CollectAddresses(sd, dp)
......
...@@ -23,8 +23,8 @@ import ( ...@@ -23,8 +23,8 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
// TestDropSpanBatchBeforeHardfork tests behavior of op-node before SpanBatch hardfork. // TestDropSpanBatchBeforeHardfork tests behavior of op-node before Delta hardfork.
// op-node must drop SpanBatch before SpanBatch hardfork. // op-node must drop SpanBatch before Delta hardfork.
func TestDropSpanBatchBeforeHardfork(gt *testing.T) { func TestDropSpanBatchBeforeHardfork(gt *testing.T) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
p := &e2eutils.TestParams{ p := &e2eutils.TestParams{
...@@ -34,8 +34,8 @@ func TestDropSpanBatchBeforeHardfork(gt *testing.T) { ...@@ -34,8 +34,8 @@ func TestDropSpanBatchBeforeHardfork(gt *testing.T) {
L1BlockTime: 12, L1BlockTime: 12,
} }
dp := e2eutils.MakeDeployParams(t, p) dp := e2eutils.MakeDeployParams(t, p)
// do not activate SpanBatch hardfork for verifier // do not activate Delta hardfork for verifier
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = nil dp.DeployConfig.L2GenesisDeltaTimeOffset = nil
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlError) log := testlog.Logger(t, log.LvlError)
miner, seqEngine, sequencer := setupSequencerTest(t, sd, log) miner, seqEngine, sequencer := setupSequencerTest(t, sd, log)
...@@ -44,8 +44,8 @@ func TestDropSpanBatchBeforeHardfork(gt *testing.T) { ...@@ -44,8 +44,8 @@ func TestDropSpanBatchBeforeHardfork(gt *testing.T) {
rollupSeqCl := sequencer.RollupClient() rollupSeqCl := sequencer.RollupClient()
dp2 := e2eutils.MakeDeployParams(t, p) dp2 := e2eutils.MakeDeployParams(t, p)
minTs := hexutil.Uint64(0) minTs := hexutil.Uint64(0)
// activate SpanBatch hardfork for batcher. so batcher will submit SpanBatches to L1. // activate Delta hardfork for batcher. so batcher will submit SpanBatches to L1.
dp2.DeployConfig.L2GenesisSpanBatchTimeOffset = &minTs dp2.DeployConfig.L2GenesisDeltaTimeOffset = &minTs
sd2 := e2eutils.Setup(t, dp2, defaultAlloc) sd2 := e2eutils.Setup(t, dp2, defaultAlloc)
batcher := NewL2Batcher(log, sd2.RollupCfg, &BatcherCfg{ batcher := NewL2Batcher(log, sd2.RollupCfg, &BatcherCfg{
MinL1TxSize: 0, MinL1TxSize: 0,
...@@ -114,8 +114,8 @@ func TestDropSpanBatchBeforeHardfork(gt *testing.T) { ...@@ -114,8 +114,8 @@ func TestDropSpanBatchBeforeHardfork(gt *testing.T) {
require.ErrorIs(t, err, ethereum.NotFound) require.ErrorIs(t, err, ethereum.NotFound)
} }
// TestAcceptSingularBatchAfterHardfork tests behavior of op-node after SpanBatch hardfork. // TestAcceptSingularBatchAfterHardfork tests behavior of op-node after Delta hardfork.
// op-node must accept SingularBatch after SpanBatch hardfork. // op-node must accept SingularBatch after Delta hardfork.
func TestAcceptSingularBatchAfterHardfork(gt *testing.T) { func TestAcceptSingularBatchAfterHardfork(gt *testing.T) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
p := &e2eutils.TestParams{ p := &e2eutils.TestParams{
...@@ -127,8 +127,8 @@ func TestAcceptSingularBatchAfterHardfork(gt *testing.T) { ...@@ -127,8 +127,8 @@ func TestAcceptSingularBatchAfterHardfork(gt *testing.T) {
minTs := hexutil.Uint64(0) minTs := hexutil.Uint64(0)
dp := e2eutils.MakeDeployParams(t, p) dp := e2eutils.MakeDeployParams(t, p)
// activate SpanBatch hardfork for verifier. // activate Delta hardfork for verifier.
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = &minTs dp.DeployConfig.L2GenesisDeltaTimeOffset = &minTs
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlError) log := testlog.Logger(t, log.LvlError)
miner, seqEngine, sequencer := setupSequencerTest(t, sd, log) miner, seqEngine, sequencer := setupSequencerTest(t, sd, log)
...@@ -137,8 +137,8 @@ func TestAcceptSingularBatchAfterHardfork(gt *testing.T) { ...@@ -137,8 +137,8 @@ func TestAcceptSingularBatchAfterHardfork(gt *testing.T) {
rollupSeqCl := sequencer.RollupClient() rollupSeqCl := sequencer.RollupClient()
dp2 := e2eutils.MakeDeployParams(t, p) dp2 := e2eutils.MakeDeployParams(t, p)
// not activate SpanBatch hardfork for batcher // not activate Delta hardfork for batcher
dp2.DeployConfig.L2GenesisSpanBatchTimeOffset = nil dp2.DeployConfig.L2GenesisDeltaTimeOffset = nil
sd2 := e2eutils.Setup(t, dp2, defaultAlloc) sd2 := e2eutils.Setup(t, dp2, defaultAlloc)
batcher := NewL2Batcher(log, sd2.RollupCfg, &BatcherCfg{ batcher := NewL2Batcher(log, sd2.RollupCfg, &BatcherCfg{
MinL1TxSize: 0, MinL1TxSize: 0,
...@@ -213,8 +213,8 @@ func TestSpanBatchEmptyChain(gt *testing.T) { ...@@ -213,8 +213,8 @@ func TestSpanBatchEmptyChain(gt *testing.T) {
} }
dp := e2eutils.MakeDeployParams(t, p) dp := e2eutils.MakeDeployParams(t, p)
minTs := hexutil.Uint64(0) minTs := hexutil.Uint64(0)
// Activate SpanBatch hardfork // Activate Delta hardfork
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = &minTs dp.DeployConfig.L2GenesisDeltaTimeOffset = &minTs
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlError) log := testlog.Logger(t, log.LvlError)
miner, seqEngine, sequencer := setupSequencerTest(t, sd, log) miner, seqEngine, sequencer := setupSequencerTest(t, sd, log)
...@@ -270,8 +270,8 @@ func TestSpanBatchLowThroughputChain(gt *testing.T) { ...@@ -270,8 +270,8 @@ func TestSpanBatchLowThroughputChain(gt *testing.T) {
} }
dp := e2eutils.MakeDeployParams(t, p) dp := e2eutils.MakeDeployParams(t, p)
minTs := hexutil.Uint64(0) minTs := hexutil.Uint64(0)
// Activate SpanBatch hardfork // Activate Delta hardfork
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = &minTs dp.DeployConfig.L2GenesisDeltaTimeOffset = &minTs
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlError) log := testlog.Logger(t, log.LvlError)
miner, seqEngine, sequencer := setupSequencerTest(t, sd, log) miner, seqEngine, sequencer := setupSequencerTest(t, sd, log)
......
...@@ -27,7 +27,7 @@ import ( ...@@ -27,7 +27,7 @@ import (
func TestSyncBatchType(t *testing.T) { func TestSyncBatchType(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
f func(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) f func(gt *testing.T, deltaTimeOffset *hexutil.Uint64)
}{ }{
{"DerivationWithFlakyL1RPC", DerivationWithFlakyL1RPC}, {"DerivationWithFlakyL1RPC", DerivationWithFlakyL1RPC},
{"FinalizeWhileSyncing", FinalizeWhileSyncing}, {"FinalizeWhileSyncing", FinalizeWhileSyncing},
...@@ -39,19 +39,19 @@ func TestSyncBatchType(t *testing.T) { ...@@ -39,19 +39,19 @@ func TestSyncBatchType(t *testing.T) {
}) })
} }
spanBatchTimeOffset := hexutil.Uint64(0) deltaTimeOffset := hexutil.Uint64(0)
for _, test := range tests { for _, test := range tests {
test := test test := test
t.Run(test.name+"_SpanBatch", func(t *testing.T) { t.Run(test.name+"_SpanBatch", func(t *testing.T) {
test.f(t, &spanBatchTimeOffset) test.f(t, &deltaTimeOffset)
}) })
} }
} }
func DerivationWithFlakyL1RPC(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func DerivationWithFlakyL1RPC(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlError) // mute all the temporary derivation errors that we forcefully create log := testlog.Logger(t, log.LvlError) // mute all the temporary derivation errors that we forcefully create
_, _, miner, sequencer, _, verifier, _, batcher := setupReorgTestActors(t, dp, sd, log) _, _, miner, sequencer, _, verifier, _, batcher := setupReorgTestActors(t, dp, sd, log)
...@@ -88,10 +88,10 @@ func DerivationWithFlakyL1RPC(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64 ...@@ -88,10 +88,10 @@ func DerivationWithFlakyL1RPC(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64
require.Equal(t, sequencer.L2Unsafe(), verifier.L2Safe(), "verifier is synced") require.Equal(t, sequencer.L2Unsafe(), verifier.L2Safe(), "verifier is synced")
} }
func FinalizeWhileSyncing(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func FinalizeWhileSyncing(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlError) // mute all the temporary derivation errors that we forcefully create log := testlog.Logger(t, log.LvlError) // mute all the temporary derivation errors that we forcefully create
_, _, miner, sequencer, _, verifier, _, batcher := setupReorgTestActors(t, dp, sd, log) _, _, miner, sequencer, _, verifier, _, batcher := setupReorgTestActors(t, dp, sd, log)
...@@ -207,8 +207,8 @@ func TestInvalidPayloadInSpanBatch(gt *testing.T) { ...@@ -207,8 +207,8 @@ func TestInvalidPayloadInSpanBatch(gt *testing.T) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
minTs := hexutil.Uint64(0) minTs := hexutil.Uint64(0)
// Activate SpanBatch hardfork // Activate Delta hardfork
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = &minTs dp.DeployConfig.L2GenesisDeltaTimeOffset = &minTs
dp.DeployConfig.L2BlockTime = 2 dp.DeployConfig.L2BlockTime = 2
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlInfo) log := testlog.Logger(t, log.LvlInfo)
...@@ -330,8 +330,8 @@ func TestSpanBatchAtomicity_Consolidation(gt *testing.T) { ...@@ -330,8 +330,8 @@ func TestSpanBatchAtomicity_Consolidation(gt *testing.T) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
minTs := hexutil.Uint64(0) minTs := hexutil.Uint64(0)
// Activate SpanBatch hardfork // Activate Delta hardfork
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = &minTs dp.DeployConfig.L2GenesisDeltaTimeOffset = &minTs
dp.DeployConfig.L2BlockTime = 2 dp.DeployConfig.L2BlockTime = 2
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlInfo) log := testlog.Logger(t, log.LvlInfo)
...@@ -389,8 +389,8 @@ func TestSpanBatchAtomicity_ForceAdvance(gt *testing.T) { ...@@ -389,8 +389,8 @@ func TestSpanBatchAtomicity_ForceAdvance(gt *testing.T) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
minTs := hexutil.Uint64(0) minTs := hexutil.Uint64(0)
// Activate SpanBatch hardfork // Activate Delta hardfork
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = &minTs dp.DeployConfig.L2GenesisDeltaTimeOffset = &minTs
dp.DeployConfig.L2BlockTime = 2 dp.DeployConfig.L2BlockTime = 2
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlInfo) log := testlog.Logger(t, log.LvlInfo)
......
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,7 @@ import (
func TestSystemConfigBatchType(t *testing.T) { func TestSystemConfigBatchType(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
f func(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) f func(gt *testing.T, deltaTimeOffset *hexutil.Uint64)
}{ }{
{"BatcherKeyRotation", BatcherKeyRotation}, {"BatcherKeyRotation", BatcherKeyRotation},
{"GPOParamsChange", GPOParamsChange}, {"GPOParamsChange", GPOParamsChange},
...@@ -37,23 +37,23 @@ func TestSystemConfigBatchType(t *testing.T) { ...@@ -37,23 +37,23 @@ func TestSystemConfigBatchType(t *testing.T) {
}) })
} }
spanBatchTimeOffset := hexutil.Uint64(0) deltaTimeOffset := hexutil.Uint64(0)
for _, test := range tests { for _, test := range tests {
test := test test := test
t.Run(test.name+"_SpanBatch", func(t *testing.T) { t.Run(test.name+"_SpanBatch", func(t *testing.T) {
test.f(t, &spanBatchTimeOffset) test.f(t, &deltaTimeOffset)
}) })
} }
} }
// BatcherKeyRotation tests that batcher A can operate, then be replaced with batcher B, then ignore old batcher A, // BatcherKeyRotation tests that batcher A can operate, then be replaced with batcher B, then ignore old batcher A,
// and that the change to batcher B is reverted properly upon reorg of L1. // and that the change to batcher B is reverted properly upon reorg of L1.
func BatcherKeyRotation(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func BatcherKeyRotation(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
dp.DeployConfig.L2BlockTime = 2 dp.DeployConfig.L2BlockTime = 2
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlDebug) log := testlog.Logger(t, log.LvlDebug)
miner, seqEngine, sequencer := setupSequencerTest(t, sd, log) miner, seqEngine, sequencer := setupSequencerTest(t, sd, log)
...@@ -228,10 +228,10 @@ func BatcherKeyRotation(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -228,10 +228,10 @@ func BatcherKeyRotation(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
// GPOParamsChange tests that the GPO params can be updated to adjust fees of L2 transactions, // GPOParamsChange tests that the GPO params can be updated to adjust fees of L2 transactions,
// and that the L1 data fees to the L2 transaction are applied correctly before, during and after the GPO update in L2. // and that the L1 data fees to the L2 transaction are applied correctly before, during and after the GPO update in L2.
func GPOParamsChange(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func GPOParamsChange(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlDebug) log := testlog.Logger(t, log.LvlDebug)
miner, seqEngine, sequencer := setupSequencerTest(t, sd, log) miner, seqEngine, sequencer := setupSequencerTest(t, sd, log)
...@@ -358,10 +358,10 @@ func GPOParamsChange(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { ...@@ -358,10 +358,10 @@ func GPOParamsChange(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) {
// GasLimitChange tests that the gas limit can be configured to L1, // GasLimitChange tests that the gas limit can be configured to L1,
// and that the L2 changes the gas limit instantly at the exact block that adopts the L1 origin with // and that the L2 changes the gas limit instantly at the exact block that adopts the L1 origin with
// the gas limit change event. And checks if a verifier node can reproduce the same gas limit change. // the gas limit change event. And checks if a verifier node can reproduce the same gas limit change.
func GasLimitChange(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func GasLimitChange(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset dp.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlDebug) log := testlog.Logger(t, log.LvlDebug)
miner, seqEngine, sequencer := setupSequencerTest(t, sd, log) miner, seqEngine, sequencer := setupSequencerTest(t, sd, log)
......
...@@ -14,11 +14,11 @@ import ( ...@@ -14,11 +14,11 @@ import (
) )
type hardforkScheduledTest struct { type hardforkScheduledTest struct {
name string name string
regolithTime *hexutil.Uint64 regolithTime *hexutil.Uint64
spanBatchTime *hexutil.Uint64 deltaTime *hexutil.Uint64
activateRegolith bool activateRegolith bool
activateSpanBatch bool activateDelta bool
} }
// TestCrossLayerUser tests that common actions of the CrossLayerUser actor work in various regolith configurations: // TestCrossLayerUser tests that common actions of the CrossLayerUser actor work in various regolith configurations:
...@@ -34,17 +34,17 @@ func TestCrossLayerUser(t *testing.T) { ...@@ -34,17 +34,17 @@ func TestCrossLayerUser(t *testing.T) {
futureTime := hexutil.Uint64(20) futureTime := hexutil.Uint64(20)
farFutureTime := hexutil.Uint64(2000) farFutureTime := hexutil.Uint64(2000)
tests := []hardforkScheduledTest{ tests := []hardforkScheduledTest{
{name: "NoRegolith", regolithTime: nil, activateRegolith: false, spanBatchTime: nil, activateSpanBatch: false}, {name: "NoRegolith", regolithTime: nil, activateRegolith: false, deltaTime: nil, activateDelta: false},
{name: "NotYetRegolith", regolithTime: &farFutureTime, activateRegolith: false, spanBatchTime: nil, activateSpanBatch: false}, {name: "NotYetRegolith", regolithTime: &farFutureTime, activateRegolith: false, deltaTime: nil, activateDelta: false},
{name: "RegolithAtGenesis", regolithTime: &zeroTime, activateRegolith: true, spanBatchTime: nil, activateSpanBatch: false}, {name: "RegolithAtGenesis", regolithTime: &zeroTime, activateRegolith: true, deltaTime: nil, activateDelta: false},
{name: "RegolithAfterGenesis", regolithTime: &futureTime, activateRegolith: true, spanBatchTime: nil, activateSpanBatch: false}, {name: "RegolithAfterGenesis", regolithTime: &futureTime, activateRegolith: true, deltaTime: nil, activateDelta: false},
{name: "NoSpanBatch", regolithTime: &zeroTime, activateRegolith: true, spanBatchTime: nil, activateSpanBatch: false}, {name: "NoDelta", regolithTime: &zeroTime, activateRegolith: true, deltaTime: nil, activateDelta: false},
{name: "NotYetSpanBatch", regolithTime: &zeroTime, activateRegolith: true, {name: "NotYetDelta", regolithTime: &zeroTime, activateRegolith: true,
spanBatchTime: &farFutureTime, activateSpanBatch: false}, deltaTime: &farFutureTime, activateDelta: false},
{name: "SpanBatchAtGenesis", regolithTime: &zeroTime, activateRegolith: true, {name: "DeltaAtGenesis", regolithTime: &zeroTime, activateRegolith: true,
spanBatchTime: &zeroTime, activateSpanBatch: true}, deltaTime: &zeroTime, activateDelta: true},
{name: "SpanBatchAfterGenesis", regolithTime: &zeroTime, activateRegolith: true, {name: "DeltaAfterGenesis", regolithTime: &zeroTime, activateRegolith: true,
spanBatchTime: &futureTime, activateSpanBatch: true}, deltaTime: &futureTime, activateDelta: true},
} }
for _, test := range tests { for _, test := range tests {
test := test // Use a fixed reference as the tests run in parallel test := test // Use a fixed reference as the tests run in parallel
...@@ -58,7 +58,7 @@ func runCrossLayerUserTest(gt *testing.T, test hardforkScheduledTest) { ...@@ -58,7 +58,7 @@ func runCrossLayerUserTest(gt *testing.T, test hardforkScheduledTest) {
t := NewDefaultTesting(gt) t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams) dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
dp.DeployConfig.L2GenesisRegolithTimeOffset = test.regolithTime dp.DeployConfig.L2GenesisRegolithTimeOffset = test.regolithTime
dp.DeployConfig.L2GenesisSpanBatchTimeOffset = test.spanBatchTime dp.DeployConfig.L2GenesisDeltaTimeOffset = test.deltaTime
sd := e2eutils.Setup(t, dp, defaultAlloc) sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlDebug) log := testlog.Logger(t, log.LvlDebug)
......
...@@ -158,7 +158,7 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) * ...@@ -158,7 +158,7 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) *
L1SystemConfigAddress: deployConf.SystemConfigProxy, L1SystemConfigAddress: deployConf.SystemConfigProxy,
RegolithTime: deployConf.RegolithTime(uint64(deployConf.L1GenesisBlockTimestamp)), RegolithTime: deployConf.RegolithTime(uint64(deployConf.L1GenesisBlockTimestamp)),
CanyonTime: deployConf.CanyonTime(uint64(deployConf.L1GenesisBlockTimestamp)), CanyonTime: deployConf.CanyonTime(uint64(deployConf.L1GenesisBlockTimestamp)),
SpanBatchTime: deployConf.SpanBatchTime(uint64(deployConf.L1GenesisBlockTimestamp)), DeltaTime: deployConf.DeltaTime(uint64(deployConf.L1GenesisBlockTimestamp)),
} }
require.NoError(t, rollupCfg.Check()) require.NoError(t, rollupCfg.Check())
......
...@@ -433,7 +433,7 @@ func (cfg SystemConfig) Start(t *testing.T, _opts ...SystemConfigOption) (*Syste ...@@ -433,7 +433,7 @@ func (cfg SystemConfig) Start(t *testing.T, _opts ...SystemConfigOption) (*Syste
L1SystemConfigAddress: cfg.DeployConfig.SystemConfigProxy, L1SystemConfigAddress: cfg.DeployConfig.SystemConfigProxy,
RegolithTime: cfg.DeployConfig.RegolithTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)), RegolithTime: cfg.DeployConfig.RegolithTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
CanyonTime: cfg.DeployConfig.CanyonTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)), CanyonTime: cfg.DeployConfig.CanyonTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
SpanBatchTime: cfg.DeployConfig.SpanBatchTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)), DeltaTime: cfg.DeployConfig.DeltaTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
ProtocolVersionsAddress: cfg.L1Deployments.ProtocolVersionsProxy, ProtocolVersionsAddress: cfg.L1Deployments.ProtocolVersionsProxy,
} }
} }
...@@ -700,7 +700,7 @@ func (cfg SystemConfig) Start(t *testing.T, _opts ...SystemConfigOption) (*Syste ...@@ -700,7 +700,7 @@ func (cfg SystemConfig) Start(t *testing.T, _opts ...SystemConfigOption) (*Syste
sys.L2OutputSubmitter = proposer sys.L2OutputSubmitter = proposer
var batchType uint = derive.SingularBatchType var batchType uint = derive.SingularBatchType
if cfg.DeployConfig.L2GenesisSpanBatchTimeOffset != nil && *cfg.DeployConfig.L2GenesisSpanBatchTimeOffset == hexutil.Uint64(0) { if cfg.DeployConfig.L2GenesisDeltaTimeOffset != nil && *cfg.DeployConfig.L2GenesisDeltaTimeOffset == hexutil.Uint64(0) {
batchType = derive.SpanBatchType batchType = derive.SpanBatchType
} }
batcherMaxL1TxSizeBytes := cfg.BatcherMaxL1TxSizeBytes batcherMaxL1TxSizeBytes := cfg.BatcherMaxL1TxSizeBytes
......
...@@ -74,11 +74,11 @@ func testVerifyL2OutputRootEmptyBlock(t *testing.T, detached bool, spanBatchActi ...@@ -74,11 +74,11 @@ func testVerifyL2OutputRootEmptyBlock(t *testing.T, detached bool, spanBatchActi
// But not too small to ensure that our claim and subsequent state change is published // But not too small to ensure that our claim and subsequent state change is published
cfg.DeployConfig.SequencerWindowSize = 16 cfg.DeployConfig.SequencerWindowSize = 16
if spanBatchActivated { if spanBatchActivated {
// Activate span batch hard fork // Activate delta hard fork
minTs := hexutil.Uint64(0) minTs := hexutil.Uint64(0)
cfg.DeployConfig.L2GenesisSpanBatchTimeOffset = &minTs cfg.DeployConfig.L2GenesisDeltaTimeOffset = &minTs
} else { } else {
cfg.DeployConfig.L2GenesisSpanBatchTimeOffset = nil cfg.DeployConfig.L2GenesisDeltaTimeOffset = nil
} }
sys, err := cfg.Start(t) sys, err := cfg.Start(t)
...@@ -179,11 +179,11 @@ func testVerifyL2OutputRoot(t *testing.T, detached bool, spanBatchActivated bool ...@@ -179,11 +179,11 @@ func testVerifyL2OutputRoot(t *testing.T, detached bool, spanBatchActivated bool
// We don't need a verifier - just the sequencer is enough // We don't need a verifier - just the sequencer is enough
delete(cfg.Nodes, "verifier") delete(cfg.Nodes, "verifier")
if spanBatchActivated { if spanBatchActivated {
// Activate span batch hard fork // Activate delta hard fork
minTs := hexutil.Uint64(0) minTs := hexutil.Uint64(0)
cfg.DeployConfig.L2GenesisSpanBatchTimeOffset = &minTs cfg.DeployConfig.L2GenesisDeltaTimeOffset = &minTs
} else { } else {
cfg.DeployConfig.L2GenesisSpanBatchTimeOffset = nil cfg.DeployConfig.L2GenesisDeltaTimeOffset = nil
} }
sys, err := cfg.Start(t) sys, err := cfg.Start(t)
......
...@@ -50,7 +50,7 @@ import ( ...@@ -50,7 +50,7 @@ import (
func TestSystemBatchType(t *testing.T) { func TestSystemBatchType(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
f func(gt *testing.T, spanBatchTimeOffset *hexutil.Uint64) f func(gt *testing.T, deltaTimeOffset *hexutil.Uint64)
}{ }{
{"StopStartBatcher", StopStartBatcher}, {"StopStartBatcher", StopStartBatcher},
} }
...@@ -61,11 +61,11 @@ func TestSystemBatchType(t *testing.T) { ...@@ -61,11 +61,11 @@ func TestSystemBatchType(t *testing.T) {
}) })
} }
spanBatchTimeOffset := hexutil.Uint64(0) deltaTimeOffset := hexutil.Uint64(0)
for _, test := range tests { for _, test := range tests {
test := test test := test
t.Run(test.name+"_SpanBatch", func(t *testing.T) { t.Run(test.name+"_SpanBatch", func(t *testing.T) {
test.f(t, &spanBatchTimeOffset) test.f(t, &deltaTimeOffset)
}) })
} }
} }
...@@ -1256,11 +1256,11 @@ func TestFees(t *testing.T) { ...@@ -1256,11 +1256,11 @@ func TestFees(t *testing.T) {
require.Equal(t, balanceDiff, totalFee, "balances should add up") require.Equal(t, balanceDiff, totalFee, "balances should add up")
} }
func StopStartBatcher(t *testing.T, spanBatchTimeOffset *hexutil.Uint64) { func StopStartBatcher(t *testing.T, deltaTimeOffset *hexutil.Uint64) {
InitParallel(t) InitParallel(t)
cfg := DefaultSystemConfig(t) cfg := DefaultSystemConfig(t)
cfg.DeployConfig.L2GenesisSpanBatchTimeOffset = spanBatchTimeOffset cfg.DeployConfig.L2GenesisDeltaTimeOffset = deltaTimeOffset
sys, err := cfg.Start(t) sys, err := cfg.Start(t)
require.Nil(t, err, "Error starting up system") require.Nil(t, err, "Error starting up system")
defer sys.Close() defer sys.Close()
......
...@@ -26,7 +26,7 @@ var encodeBufferPool = sync.Pool{ ...@@ -26,7 +26,7 @@ var encodeBufferPool = sync.Pool{
const ( const (
// SingularBatchType is the first version of Batch format, representing a single L2 block. // SingularBatchType is the first version of Batch format, representing a single L2 block.
SingularBatchType = 0 SingularBatchType = 0
// SpanBatchType is the Batch version used after SpanBatch hard fork, representing a span of L2 blocks. // SpanBatchType is the Batch version used after Delta hard fork, representing a span of L2 blocks.
SpanBatchType = 1 SpanBatchType = 1
) )
......
...@@ -73,7 +73,7 @@ func buildSpanBatches(t *testing.T, parent *eth.L2BlockRef, singularBatches []*S ...@@ -73,7 +73,7 @@ func buildSpanBatches(t *testing.T, parent *eth.L2BlockRef, singularBatches []*S
return spanBatches return spanBatches
} }
func getSpanBatchTime(batchType int) *uint64 { func getDeltaTime(batchType int) *uint64 {
minTs := uint64(0) minTs := uint64(0)
if batchType == SpanBatchType { if batchType == SpanBatchType {
return &minTs return &minTs
...@@ -182,7 +182,7 @@ func BatchQueueNewOrigin(t *testing.T, batchType int) { ...@@ -182,7 +182,7 @@ func BatchQueueNewOrigin(t *testing.T, batchType int) {
BlockTime: 2, BlockTime: 2,
MaxSequencerDrift: 600, MaxSequencerDrift: 600,
SeqWindowSize: 2, SeqWindowSize: 2,
SpanBatchTime: getSpanBatchTime(batchType), DeltaTime: getDeltaTime(batchType),
} }
input := &fakeBatchQueueInput{ input := &fakeBatchQueueInput{
...@@ -243,7 +243,7 @@ func BatchQueueEager(t *testing.T, batchType int) { ...@@ -243,7 +243,7 @@ func BatchQueueEager(t *testing.T, batchType int) {
BlockTime: 2, BlockTime: 2,
MaxSequencerDrift: 600, MaxSequencerDrift: 600,
SeqWindowSize: 30, SeqWindowSize: 30,
SpanBatchTime: getSpanBatchTime(batchType), DeltaTime: getDeltaTime(batchType),
L2ChainID: chainId, L2ChainID: chainId,
} }
...@@ -321,7 +321,7 @@ func BatchQueueInvalidInternalAdvance(t *testing.T, batchType int) { ...@@ -321,7 +321,7 @@ func BatchQueueInvalidInternalAdvance(t *testing.T, batchType int) {
BlockTime: 2, BlockTime: 2,
MaxSequencerDrift: 600, MaxSequencerDrift: 600,
SeqWindowSize: 2, SeqWindowSize: 2,
SpanBatchTime: getSpanBatchTime(batchType), DeltaTime: getDeltaTime(batchType),
L2ChainID: chainId, L2ChainID: chainId,
} }
...@@ -440,7 +440,7 @@ func BatchQueueMissing(t *testing.T, batchType int) { ...@@ -440,7 +440,7 @@ func BatchQueueMissing(t *testing.T, batchType int) {
BlockTime: 2, BlockTime: 2,
MaxSequencerDrift: 600, MaxSequencerDrift: 600,
SeqWindowSize: 2, SeqWindowSize: 2,
SpanBatchTime: getSpanBatchTime(batchType), DeltaTime: getDeltaTime(batchType),
L2ChainID: chainId, L2ChainID: chainId,
} }
...@@ -557,7 +557,7 @@ func BatchQueueAdvancedEpoch(t *testing.T, batchType int) { ...@@ -557,7 +557,7 @@ func BatchQueueAdvancedEpoch(t *testing.T, batchType int) {
BlockTime: 2, BlockTime: 2,
MaxSequencerDrift: 600, MaxSequencerDrift: 600,
SeqWindowSize: 30, SeqWindowSize: 30,
SpanBatchTime: getSpanBatchTime(batchType), DeltaTime: getDeltaTime(batchType),
L2ChainID: chainId, L2ChainID: chainId,
} }
...@@ -644,7 +644,7 @@ func BatchQueueShuffle(t *testing.T, batchType int) { ...@@ -644,7 +644,7 @@ func BatchQueueShuffle(t *testing.T, batchType int) {
BlockTime: 2, BlockTime: 2,
MaxSequencerDrift: 600, MaxSequencerDrift: 600,
SeqWindowSize: 30, SeqWindowSize: 30,
SpanBatchTime: getSpanBatchTime(batchType), DeltaTime: getDeltaTime(batchType),
L2ChainID: chainId, L2ChainID: chainId,
} }
...@@ -742,7 +742,7 @@ func TestBatchQueueOverlappingSpanBatch(t *testing.T) { ...@@ -742,7 +742,7 @@ func TestBatchQueueOverlappingSpanBatch(t *testing.T) {
BlockTime: 2, BlockTime: 2,
MaxSequencerDrift: 600, MaxSequencerDrift: 600,
SeqWindowSize: 30, SeqWindowSize: 30,
SpanBatchTime: getSpanBatchTime(SpanBatchType), DeltaTime: getDeltaTime(SpanBatchType),
L2ChainID: chainId, L2ChainID: chainId,
} }
...@@ -847,7 +847,7 @@ func TestBatchQueueComplex(t *testing.T) { ...@@ -847,7 +847,7 @@ func TestBatchQueueComplex(t *testing.T) {
BlockTime: 2, BlockTime: 2,
MaxSequencerDrift: 600, MaxSequencerDrift: 600,
SeqWindowSize: 30, SeqWindowSize: 30,
SpanBatchTime: getSpanBatchTime(SpanBatchType), DeltaTime: getDeltaTime(SpanBatchType),
L2ChainID: chainId, L2ChainID: chainId,
} }
...@@ -965,7 +965,7 @@ func TestBatchQueueResetSpan(t *testing.T) { ...@@ -965,7 +965,7 @@ func TestBatchQueueResetSpan(t *testing.T) {
BlockTime: 2, BlockTime: 2,
MaxSequencerDrift: 600, MaxSequencerDrift: 600,
SeqWindowSize: 30, SeqWindowSize: 30,
SpanBatchTime: getSpanBatchTime(SpanBatchType), DeltaTime: getDeltaTime(SpanBatchType),
L2ChainID: chainId, L2ChainID: chainId,
} }
......
...@@ -186,8 +186,8 @@ func checkSpanBatch(ctx context.Context, cfg *rollup.Config, log log.Logger, l1B ...@@ -186,8 +186,8 @@ func checkSpanBatch(ctx context.Context, cfg *rollup.Config, log log.Logger, l1B
} }
batchOrigin = l1Blocks[1] batchOrigin = l1Blocks[1]
} }
if !cfg.IsSpanBatch(batchOrigin.Time) { if !cfg.IsDelta(batchOrigin.Time) {
log.Warn("received SpanBatch with L1 origin before SpanBatch hard fork") log.Warn("received SpanBatch with L1 origin before Delta hard fork")
return BatchDrop return BatchDrop
} }
......
This diff is collapsed.
...@@ -98,7 +98,7 @@ func (cr *ChannelInReader) NextBatch(ctx context.Context) (Batch, error) { ...@@ -98,7 +98,7 @@ func (cr *ChannelInReader) NextBatch(ctx context.Context) (Batch, error) {
} }
return singularBatch, nil return singularBatch, nil
case SpanBatchType: case SpanBatchType:
if origin := cr.Origin(); !cr.cfg.IsSpanBatch(origin.Time) { if origin := cr.Origin(); !cr.cfg.IsDelta(origin.Time) {
// Check hard fork activation with the L1 inclusion block time instead of the L1 origin block time. // Check hard fork activation with the L1 inclusion block time instead of the L1 origin block time.
// Therefore, even if the batch passed this rule, it can be dropped in the batch queue. // Therefore, even if the batch passed this rule, it can be dropped in the batch queue.
// This is just for early dropping invalid batches as soon as possible. // This is just for early dropping invalid batches as soon as possible.
......
...@@ -75,11 +75,13 @@ type Config struct { ...@@ -75,11 +75,13 @@ type Config struct {
// Active if RegolithTime != nil && L2 block timestamp >= *RegolithTime, inactive otherwise. // Active if RegolithTime != nil && L2 block timestamp >= *RegolithTime, inactive otherwise.
RegolithTime *uint64 `json:"regolith_time,omitempty"` RegolithTime *uint64 `json:"regolith_time,omitempty"`
// CanyonTime sets the activation time of the next network upgrade. // CanyonTime sets the activation time of the next network upgrade.
// Active if CanyonTime != nil && L2 block timestamp >= *CanyonTime, inactive otherwise. // Active if CanyonTime != nil && L2 block timestamp >= *CanyonTime, inactive otherwise.
CanyonTime *uint64 `json:"canyon_time,omitempty"` CanyonTime *uint64 `json:"canyon_time,omitempty"`
SpanBatchTime *uint64 `json:"span_batch_time,omitempty"` // DeltaTime sets the activation time of the next network upgrade.
// Active if DeltaTime != nil && L2 block timestamp >= *DeltaTime, inactive otherwise.
DeltaTime *uint64 `json:"delta_time,omitempty"`
// Note: below addresses are part of the block-derivation process, // Note: below addresses are part of the block-derivation process,
// and required to be the same network-wide to stay in consensus. // and required to be the same network-wide to stay in consensus.
...@@ -274,8 +276,9 @@ func (c *Config) IsCanyon(timestamp uint64) bool { ...@@ -274,8 +276,9 @@ func (c *Config) IsCanyon(timestamp uint64) bool {
return c.CanyonTime != nil && timestamp >= *c.CanyonTime return c.CanyonTime != nil && timestamp >= *c.CanyonTime
} }
func (c *Config) IsSpanBatch(timestamp uint64) bool { // IsDelta returns true if the Delta hardfork is active at or past the given timestamp.
return c.SpanBatchTime != nil && timestamp >= *c.SpanBatchTime func (c *Config) IsDelta(timestamp uint64) bool {
return c.DeltaTime != nil && timestamp >= *c.DeltaTime
} }
// Description outputs a banner describing the important parts of rollup configuration in a human-readable form. // Description outputs a banner describing the important parts of rollup configuration in a human-readable form.
...@@ -306,7 +309,7 @@ func (c *Config) Description(l2Chains map[string]string) string { ...@@ -306,7 +309,7 @@ func (c *Config) Description(l2Chains map[string]string) string {
banner += "Post-Bedrock Network Upgrades (timestamp based):\n" banner += "Post-Bedrock Network Upgrades (timestamp based):\n"
banner += fmt.Sprintf(" - Regolith: %s\n", fmtForkTimeOrUnset(c.RegolithTime)) banner += fmt.Sprintf(" - Regolith: %s\n", fmtForkTimeOrUnset(c.RegolithTime))
banner += fmt.Sprintf(" - Canyon: %s\n", fmtForkTimeOrUnset(c.CanyonTime)) banner += fmt.Sprintf(" - Canyon: %s\n", fmtForkTimeOrUnset(c.CanyonTime))
banner += fmt.Sprintf(" - SpanBatch: %s\n", fmtForkTimeOrUnset(c.SpanBatchTime)) banner += fmt.Sprintf(" - Delta: %s\n", fmtForkTimeOrUnset(c.DeltaTime))
// Report the protocol version // Report the protocol version
banner += fmt.Sprintf("Node supports up to OP-Stack Protocol Version: %s\n", OPStackSupport) banner += fmt.Sprintf("Node supports up to OP-Stack Protocol Version: %s\n", OPStackSupport)
return banner return banner
...@@ -333,7 +336,7 @@ func (c *Config) LogDescription(log log.Logger, l2Chains map[string]string) { ...@@ -333,7 +336,7 @@ func (c *Config) LogDescription(log log.Logger, l2Chains map[string]string) {
"l2_block_number", c.Genesis.L2.Number, "l1_block_hash", c.Genesis.L1.Hash.String(), "l2_block_number", c.Genesis.L2.Number, "l1_block_hash", c.Genesis.L1.Hash.String(),
"l1_block_number", c.Genesis.L1.Number, "regolith_time", fmtForkTimeOrUnset(c.RegolithTime), "l1_block_number", c.Genesis.L1.Number, "regolith_time", fmtForkTimeOrUnset(c.RegolithTime),
"canyon_time", fmtForkTimeOrUnset(c.CanyonTime), "canyon_time", fmtForkTimeOrUnset(c.CanyonTime),
"span_batch_time", fmtForkTimeOrUnset(c.SpanBatchTime), "delta_time", fmtForkTimeOrUnset(c.DeltaTime),
) )
} }
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
"eip1559Elasticity": 6, "eip1559Elasticity": 6,
"l1GenesisBlockTimestamp": "0x64c811bf", "l1GenesisBlockTimestamp": "0x64c811bf",
"l2GenesisRegolithTimeOffset": "0x0", "l2GenesisRegolithTimeOffset": "0x0",
"l2GenesisSpanBatchTimeOffset": "0x0", "l2GenesisDeltaTimeOffset": "0x0",
"l2GenesisCanyonTimeOffset": "0x40", "l2GenesisCanyonTimeOffset": "0x40",
"faultGameAbsolutePrestate": "0x03c7ae758795765c6664a5d39bf63841c71ff191e9189522bad8ebff5d4eca98", "faultGameAbsolutePrestate": "0x03c7ae758795765c6664a5d39bf63841c71ff191e9189522bad8ebff5d4eca98",
"faultGameMaxDepth": 30, "faultGameMaxDepth": 30,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment