Commit 3210a8c6 authored by Disco's avatar Disco Committed by GitHub

chore: rename isthmus to interop on golang files (#12133)

parent c65c1f88
...@@ -195,7 +195,7 @@ func TestPreparePayloadAttributes(t *testing.T) { ...@@ -195,7 +195,7 @@ func TestPreparePayloadAttributes(t *testing.T) {
require.Equal(t, l1InfoTx, []byte(attrs.Transactions[0])) require.Equal(t, l1InfoTx, []byte(attrs.Transactions[0]))
require.True(t, attrs.NoTxPool) require.True(t, attrs.NoTxPool)
}) })
t.Run("new origin with deposits on post-Isthmus", func(t *testing.T) { t.Run("new origin with deposits on post-Interop", func(t *testing.T) {
rng := rand.New(rand.NewSource(1234)) rng := rand.New(rand.NewSource(1234))
l1Fetcher := &testutils.MockL1Source{} l1Fetcher := &testutils.MockL1Source{}
defer l1Fetcher.AssertExpectations(t) defer l1Fetcher.AssertExpectations(t)
...@@ -247,7 +247,7 @@ func TestPreparePayloadAttributes(t *testing.T) { ...@@ -247,7 +247,7 @@ func TestPreparePayloadAttributes(t *testing.T) {
require.True(t, attrs.NoTxPool) require.True(t, attrs.NoTxPool)
}) })
t.Run("same origin without deposits on post-Isthmus", func(t *testing.T) { t.Run("same origin without deposits on post-Interop", func(t *testing.T) {
rng := rand.New(rand.NewSource(1234)) rng := rand.New(rand.NewSource(1234))
l1Fetcher := &testutils.MockL1Source{} l1Fetcher := &testutils.MockL1Source{}
defer l1Fetcher.AssertExpectations(t) defer l1Fetcher.AssertExpectations(t)
......
...@@ -93,16 +93,16 @@ func FuzzL1InfoEcotoneRoundTrip(f *testing.F) { ...@@ -93,16 +93,16 @@ func FuzzL1InfoEcotoneRoundTrip(f *testing.F) {
if !cmp.Equal(in, out, cmp.Comparer(testutils.BigEqual)) { if !cmp.Equal(in, out, cmp.Comparer(testutils.BigEqual)) {
t.Fatalf("The Ecotone data did not round trip correctly. in: %v. out: %v", in, out) t.Fatalf("The Ecotone data did not round trip correctly. in: %v. out: %v", in, out)
} }
enc, err = in.marshalBinaryIsthmus() enc, err = in.marshalBinaryInterop()
if err != nil { if err != nil {
t.Fatalf("Failed to marshal Isthmus binary: %v", err) t.Fatalf("Failed to marshal Interop binary: %v", err)
} }
err = out.unmarshalBinaryIsthmus(enc) err = out.unmarshalBinaryInterop(enc)
if err != nil { if err != nil {
t.Fatalf("Failed to unmarshal Isthmus binary: %v", err) t.Fatalf("Failed to unmarshal Interop binary: %v", err)
} }
if !cmp.Equal(in, out, cmp.Comparer(testutils.BigEqual)) { if !cmp.Equal(in, out, cmp.Comparer(testutils.BigEqual)) {
t.Fatalf("The Isthmus data did not round trip correctly. in: %v. out: %v", in, out) t.Fatalf("The Interop data did not round trip correctly. in: %v. out: %v", in, out)
} }
}) })
......
...@@ -20,7 +20,7 @@ import ( ...@@ -20,7 +20,7 @@ import (
const ( const (
L1InfoFuncBedrockSignature = "setL1BlockValues(uint64,uint64,uint256,bytes32,uint64,bytes32,uint256,uint256)" L1InfoFuncBedrockSignature = "setL1BlockValues(uint64,uint64,uint256,bytes32,uint64,bytes32,uint256,uint256)"
L1InfoFuncEcotoneSignature = "setL1BlockValuesEcotone()" L1InfoFuncEcotoneSignature = "setL1BlockValuesEcotone()"
L1InfoFuncIsthmusSignature = "setL1BlockValuesIsthmus()" L1InfoFuncInteropSignature = "setL1BlockValuesInterop()"
DepositsCompleteSignature = "depositsComplete()" DepositsCompleteSignature = "depositsComplete()"
L1InfoArguments = 8 L1InfoArguments = 8
L1InfoBedrockLen = 4 + 32*L1InfoArguments L1InfoBedrockLen = 4 + 32*L1InfoArguments
...@@ -28,8 +28,8 @@ const ( ...@@ -28,8 +28,8 @@ const (
DepositsCompleteLen = 4 // only the selector DepositsCompleteLen = 4 // only the selector
// DepositsCompleteGas allocates 21k gas for intrinsic tx costs, and // DepositsCompleteGas allocates 21k gas for intrinsic tx costs, and
// an additional 15k to ensure that the DepositsComplete call does not run out of gas. // an additional 15k to ensure that the DepositsComplete call does not run out of gas.
// GasBenchMark_L1BlockIsthmus_DepositsComplete:test_depositsComplete_benchmark() (gas: 7768) // GasBenchMark_L1BlockInterop_DepositsComplete:test_depositsComplete_benchmark() (gas: 7768)
// GasBenchMark_L1BlockIsthmus_DepositsComplete_Warm:test_depositsComplete_benchmark() (gas: 5768) // GasBenchMark_L1BlockInterop_DepositsComplete_Warm:test_depositsComplete_benchmark() (gas: 5768)
// see `test_depositsComplete_benchmark` at: `/packages/contracts-bedrock/test/BenchmarkTest.t.sol` // see `test_depositsComplete_benchmark` at: `/packages/contracts-bedrock/test/BenchmarkTest.t.sol`
DepositsCompleteGas = uint64(21_000 + 15_000) DepositsCompleteGas = uint64(21_000 + 15_000)
) )
...@@ -37,7 +37,7 @@ const ( ...@@ -37,7 +37,7 @@ const (
var ( var (
L1InfoFuncBedrockBytes4 = crypto.Keccak256([]byte(L1InfoFuncBedrockSignature))[:4] L1InfoFuncBedrockBytes4 = crypto.Keccak256([]byte(L1InfoFuncBedrockSignature))[:4]
L1InfoFuncEcotoneBytes4 = crypto.Keccak256([]byte(L1InfoFuncEcotoneSignature))[:4] L1InfoFuncEcotoneBytes4 = crypto.Keccak256([]byte(L1InfoFuncEcotoneSignature))[:4]
L1InfoFuncIsthmusBytes4 = crypto.Keccak256([]byte(L1InfoFuncIsthmusSignature))[:4] L1InfoFuncInteropBytes4 = crypto.Keccak256([]byte(L1InfoFuncInteropSignature))[:4]
DepositsCompleteBytes4 = crypto.Keccak256([]byte(DepositsCompleteSignature))[:4] DepositsCompleteBytes4 = crypto.Keccak256([]byte(DepositsCompleteSignature))[:4]
L1InfoDepositerAddress = common.HexToAddress("0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001") L1InfoDepositerAddress = common.HexToAddress("0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001")
L1BlockAddress = predeploys.L1BlockAddr L1BlockAddress = predeploys.L1BlockAddr
...@@ -155,7 +155,7 @@ func (info *L1BlockInfo) unmarshalBinaryBedrock(data []byte) error { ...@@ -155,7 +155,7 @@ func (info *L1BlockInfo) unmarshalBinaryBedrock(data []byte) error {
return nil return nil
} }
// Isthmus & Ecotone Binary Format // Interop & Ecotone Binary Format
// +---------+--------------------------+ // +---------+--------------------------+
// | Bytes | Field | // | Bytes | Field |
// +---------+--------------------------+ // +---------+--------------------------+
...@@ -179,16 +179,16 @@ func (info *L1BlockInfo) marshalBinaryEcotone() ([]byte, error) { ...@@ -179,16 +179,16 @@ func (info *L1BlockInfo) marshalBinaryEcotone() ([]byte, error) {
return out, nil return out, nil
} }
func (info *L1BlockInfo) marshalBinaryIsthmus() ([]byte, error) { func (info *L1BlockInfo) marshalBinaryInterop() ([]byte, error) {
out, err := marshalBinaryWithSignature(info, L1InfoFuncIsthmusBytes4) out, err := marshalBinaryWithSignature(info, L1InfoFuncInteropBytes4)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to marshal Isthmus l1 block info: %w", err) return nil, fmt.Errorf("failed to marshal Interop l1 block info: %w", err)
} }
return out, nil return out, nil
} }
func marshalBinaryWithSignature(info *L1BlockInfo, signature []byte) ([]byte, error) { func marshalBinaryWithSignature(info *L1BlockInfo, signature []byte) ([]byte, error) {
w := bytes.NewBuffer(make([]byte, 0, L1InfoEcotoneLen)) // Ecotone and Isthmus have the same length w := bytes.NewBuffer(make([]byte, 0, L1InfoEcotoneLen)) // Ecotone and Interop have the same length
if err := solabi.WriteSignature(w, signature); err != nil { if err := solabi.WriteSignature(w, signature); err != nil {
return nil, err return nil, err
} }
...@@ -231,8 +231,8 @@ func (info *L1BlockInfo) unmarshalBinaryEcotone(data []byte) error { ...@@ -231,8 +231,8 @@ func (info *L1BlockInfo) unmarshalBinaryEcotone(data []byte) error {
return unmarshalBinaryWithSignatureAndData(info, L1InfoFuncEcotoneBytes4, data) return unmarshalBinaryWithSignatureAndData(info, L1InfoFuncEcotoneBytes4, data)
} }
func (info *L1BlockInfo) unmarshalBinaryIsthmus(data []byte) error { func (info *L1BlockInfo) unmarshalBinaryInterop(data []byte) error {
return unmarshalBinaryWithSignatureAndData(info, L1InfoFuncIsthmusBytes4, data) return unmarshalBinaryWithSignatureAndData(info, L1InfoFuncInteropBytes4, data)
} }
func unmarshalBinaryWithSignatureAndData(info *L1BlockInfo, signature []byte, data []byte) error { func unmarshalBinaryWithSignatureAndData(info *L1BlockInfo, signature []byte, data []byte) error {
...@@ -285,7 +285,7 @@ func isEcotoneButNotFirstBlock(rollupCfg *rollup.Config, l2Timestamp uint64) boo ...@@ -285,7 +285,7 @@ func isEcotoneButNotFirstBlock(rollupCfg *rollup.Config, l2Timestamp uint64) boo
return rollupCfg.IsEcotone(l2Timestamp) && !rollupCfg.IsEcotoneActivationBlock(l2Timestamp) return rollupCfg.IsEcotone(l2Timestamp) && !rollupCfg.IsEcotoneActivationBlock(l2Timestamp)
} }
// isInteropButNotFirstBlock returns whether the specified block is subject to the Isthmus upgrade, // isInteropButNotFirstBlock returns whether the specified block is subject to the Interop upgrade,
// but is not the activation block itself. // but is not the activation block itself.
func isInteropButNotFirstBlock(rollupCfg *rollup.Config, l2Timestamp uint64) bool { func isInteropButNotFirstBlock(rollupCfg *rollup.Config, l2Timestamp uint64) bool {
// Since we use the pre-interop L1 tx one last time during the upgrade block, // Since we use the pre-interop L1 tx one last time during the upgrade block,
...@@ -300,7 +300,7 @@ func L1BlockInfoFromBytes(rollupCfg *rollup.Config, l2BlockTime uint64, data []b ...@@ -300,7 +300,7 @@ func L1BlockInfoFromBytes(rollupCfg *rollup.Config, l2BlockTime uint64, data []b
var info L1BlockInfo var info L1BlockInfo
// Important, this should be ordered from most recent to oldest // Important, this should be ordered from most recent to oldest
if isInteropButNotFirstBlock(rollupCfg, l2BlockTime) { if isInteropButNotFirstBlock(rollupCfg, l2BlockTime) {
return &info, info.unmarshalBinaryIsthmus(data) return &info, info.unmarshalBinaryInterop(data)
} }
if isEcotoneButNotFirstBlock(rollupCfg, l2BlockTime) { if isEcotoneButNotFirstBlock(rollupCfg, l2BlockTime) {
return &info, info.unmarshalBinaryEcotone(data) return &info, info.unmarshalBinaryEcotone(data)
...@@ -333,9 +333,9 @@ func L1InfoDeposit(rollupCfg *rollup.Config, sysCfg eth.SystemConfig, seqNumber ...@@ -333,9 +333,9 @@ func L1InfoDeposit(rollupCfg *rollup.Config, sysCfg eth.SystemConfig, seqNumber
l1BlockInfo.BlobBaseFeeScalar = scalars.BlobBaseFeeScalar l1BlockInfo.BlobBaseFeeScalar = scalars.BlobBaseFeeScalar
l1BlockInfo.BaseFeeScalar = scalars.BaseFeeScalar l1BlockInfo.BaseFeeScalar = scalars.BaseFeeScalar
if isInteropButNotFirstBlock(rollupCfg, l2Timestamp) { if isInteropButNotFirstBlock(rollupCfg, l2Timestamp) {
out, err := l1BlockInfo.marshalBinaryIsthmus() out, err := l1BlockInfo.marshalBinaryInterop()
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to marshal Isthmus l1 block info: %w", err) return nil, fmt.Errorf("failed to marshal Interop l1 block info: %w", err)
} }
data = out data = out
} else { } else {
......
...@@ -154,7 +154,7 @@ func TestParseL1InfoDepositTxData(t *testing.T) { ...@@ -154,7 +154,7 @@ func TestParseL1InfoDepositTxData(t *testing.T) {
require.Equal(t, depTx.Gas, uint64(RegolithSystemTxGas)) require.Equal(t, depTx.Gas, uint64(RegolithSystemTxGas))
require.Equal(t, L1InfoEcotoneLen, len(depTx.Data)) require.Equal(t, L1InfoEcotoneLen, len(depTx.Data))
}) })
t.Run("isthmus", func(t *testing.T) { t.Run("interop", func(t *testing.T) {
rng := rand.New(rand.NewSource(1234)) rng := rand.New(rand.NewSource(1234))
info := testutils.MakeBlockInfo(nil)(rng) info := testutils.MakeBlockInfo(nil)(rng)
rollupCfg := rollup.Config{BlockTime: 2, Genesis: rollup.Genesis{L2Time: 1000}} rollupCfg := rollup.Config{BlockTime: 2, Genesis: rollup.Genesis{L2Time: 1000}}
...@@ -165,25 +165,25 @@ func TestParseL1InfoDepositTxData(t *testing.T) { ...@@ -165,25 +165,25 @@ func TestParseL1InfoDepositTxData(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.False(t, depTx.IsSystemTransaction) require.False(t, depTx.IsSystemTransaction)
require.Equal(t, depTx.Gas, uint64(RegolithSystemTxGas)) require.Equal(t, depTx.Gas, uint64(RegolithSystemTxGas))
require.Equal(t, L1InfoEcotoneLen, len(depTx.Data), "the length is same in isthmus") require.Equal(t, L1InfoEcotoneLen, len(depTx.Data), "the length is same in interop")
require.Equal(t, L1InfoFuncIsthmusBytes4, depTx.Data[:4], "upgrade is active, need isthmus signature") require.Equal(t, L1InfoFuncInteropBytes4, depTx.Data[:4], "upgrade is active, need interop signature")
}) })
t.Run("activation-block isthmus", func(t *testing.T) { t.Run("activation-block interop", func(t *testing.T) {
rng := rand.New(rand.NewSource(1234)) rng := rand.New(rand.NewSource(1234))
info := testutils.MakeBlockInfo(nil)(rng) info := testutils.MakeBlockInfo(nil)(rng)
rollupCfg := rollup.Config{BlockTime: 2, Genesis: rollup.Genesis{L2Time: 1000}} rollupCfg := rollup.Config{BlockTime: 2, Genesis: rollup.Genesis{L2Time: 1000}}
rollupCfg.ActivateAtGenesis(rollup.Fjord) rollupCfg.ActivateAtGenesis(rollup.Fjord)
isthmusTime := rollupCfg.Genesis.L2Time + rollupCfg.BlockTime // activate isthmus just after genesis interopTime := rollupCfg.Genesis.L2Time + rollupCfg.BlockTime // activate interop just after genesis
rollupCfg.InteropTime = &isthmusTime rollupCfg.InteropTime = &interopTime
depTx, err := L1InfoDeposit(&rollupCfg, randomL1Cfg(rng, info), randomSeqNr(rng), info, isthmusTime) depTx, err := L1InfoDeposit(&rollupCfg, randomL1Cfg(rng, info), randomSeqNr(rng), info, interopTime)
require.NoError(t, err) require.NoError(t, err)
require.False(t, depTx.IsSystemTransaction) require.False(t, depTx.IsSystemTransaction)
require.Equal(t, depTx.Gas, uint64(RegolithSystemTxGas)) require.Equal(t, depTx.Gas, uint64(RegolithSystemTxGas))
// Isthmus activates, but ecotone L1 info is still used at this upgrade block // Interop activates, but ecotone L1 info is still used at this upgrade block
require.Equal(t, L1InfoEcotoneLen, len(depTx.Data)) require.Equal(t, L1InfoEcotoneLen, len(depTx.Data))
require.Equal(t, L1InfoFuncEcotoneBytes4, depTx.Data[:4]) require.Equal(t, L1InfoFuncEcotoneBytes4, depTx.Data[:4])
}) })
t.Run("genesis-block isthmus", func(t *testing.T) { t.Run("genesis-block interop", func(t *testing.T) {
rng := rand.New(rand.NewSource(1234)) rng := rand.New(rand.NewSource(1234))
info := testutils.MakeBlockInfo(nil)(rng) info := testutils.MakeBlockInfo(nil)(rng)
rollupCfg := rollup.Config{BlockTime: 2, Genesis: rollup.Genesis{L2Time: 1000}} rollupCfg := rollup.Config{BlockTime: 2, Genesis: rollup.Genesis{L2Time: 1000}}
......
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