Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Optimism dependency to OP-Stack 1.9.2 #150

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devnet/devnetL1.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"disputeGameFinalityDelaySeconds": 6,
"respectedGameType": 254,
"useFaultProofs": true,
"usePlasma": true,
"useAltDA": true,
"daCommitmentType": "KeccakCommitment",
"daChallengeWindow": 16,
"daResolveWindow": 16,
Expand Down
6 changes: 2 additions & 4 deletions cmd/server/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/Layr-Labs/eigenda-proxy/server"
"github.com/urfave/cli/v2"

"github.com/ethereum-optimism/optimism/op-service/ctxinterrupt"
oplog "github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum-optimism/optimism/op-service/opio"
)

func StartProxySvr(cliCtx *cli.Context) error {
Expand Down Expand Up @@ -63,7 +63,5 @@ func StartProxySvr(cliCtx *cli.Context) error {
m.RecordUp()
}

opio.BlockOnInterrupts()

return nil
return ctxinterrupt.Wait(cliCtx.Context)
}
4 changes: 2 additions & 2 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"github.com/Layr-Labs/eigenda-proxy/metrics"
"github.com/Layr-Labs/eigenda-proxy/server"
"github.com/ethereum-optimism/optimism/op-service/cliapp"
"github.com/ethereum-optimism/optimism/op-service/ctxinterrupt"
oplog "github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum-optimism/optimism/op-service/metrics/doc"
"github.com/ethereum-optimism/optimism/op-service/opio"
)

var (
Expand Down Expand Up @@ -46,7 +46,7 @@ func main() {
}
}

ctx := opio.WithInterruptBlocker(context.Background())
ctx := ctxinterrupt.WithSignalWaiterMain(context.Background())
err := app.RunContext(ctx, os.Args)
if err != nil {
log.Crit("Application failed", "message", err)
Expand Down
50 changes: 25 additions & 25 deletions e2e/optimism_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"testing"

"github.com/Layr-Labs/eigenda-proxy/e2e"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-e2e/actions"
"github.com/ethereum-optimism/optimism/op-e2e/config"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/sources"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum/go-ethereum/common"
Expand All @@ -17,12 +17,12 @@ import (

var defaultAlloc = &e2eutils.AllocParams{PrefundTestUsers: true}

// L2PlasmaDA is a test harness for manipulating plasma DA state.
type L2PlasmaDA struct {
// L2AltDA is a test harness for manipulating altda DA state.
type L2AltDA struct {
log log.Logger
storage *plasma.DAClient
daMgr *plasma.DA
plasmaCfg plasma.Config
storage *altda.DAClient
daMgr *altda.DA
altdaCfg altda.Config
batcher *actions.L2Batcher
sequencer *actions.L2Sequencer
engine *actions.L2Engine
Expand All @@ -32,30 +32,30 @@ type L2PlasmaDA struct {
miner *actions.L1Miner
}

func (a *L2PlasmaDA) ActL1Blocks(t actions.Testing, n uint64) {
func (a *L2AltDA) ActL1Blocks(t actions.Testing, n uint64) {
for i := uint64(0); i < n; i++ {
a.miner.ActL1StartBlock(12)(t)
a.miner.ActL1EndBlock(t)
}
}

func NewL2PlasmaDA(t actions.Testing, daHost string, altDA bool) *L2PlasmaDA {
func NewL2AltDA(t actions.Testing, daHost string, altDA bool) *L2AltDA {
p := &e2eutils.TestParams{
MaxSequencerDrift: 40,
SequencerWindowSize: 120,
ChannelTimeout: 120,
L1BlockTime: 12,
UsePlasma: true,
UseAltDA: true,
}

log := testlog.Logger(t, log.LvlDebug)

config.DeployConfig.DACommitmentType = plasma.GenericCommitmentString
config.DeployConfig.DACommitmentType = altda.GenericCommitmentString
dp := e2eutils.MakeDeployParams(t, p)
dp.DeployConfig.DAChallengeProxy = common.Address{0x42}
sd := e2eutils.Setup(t, dp, defaultAlloc)

require.True(t, sd.RollupCfg.PlasmaEnabled())
require.True(t, sd.RollupCfg.AltDAEnabled())

miner := actions.NewL1Miner(t, log, sd.L1Cfg)
l1Client := miner.EthClient()
Expand All @@ -64,41 +64,41 @@ func NewL2PlasmaDA(t actions.Testing, daHost string, altDA bool) *L2PlasmaDA {
engine := actions.NewL2Engine(t, log, sd.L2Cfg, sd.RollupCfg.Genesis.L1, jwtPath)
engCl := engine.EngineClient(t, sd.RollupCfg)

var storage *plasma.DAClient
var storage *altda.DAClient
if !altDA {
storage = plasma.NewDAClient(daHost, true, true)
storage = altda.NewDAClient(daHost, true, true)
} else {
storage = plasma.NewDAClient(daHost, false, false)
storage = altda.NewDAClient(daHost, false, false)
}

l1F, err := sources.NewL1Client(miner.RPCClient(), log, nil, sources.L1ClientDefaultConfig(sd.RollupCfg, false, sources.RPCKindBasic))
require.NoError(t, err)

plasmaCfg, err := sd.RollupCfg.GetOPPlasmaConfig()
altdaCfg, err := sd.RollupCfg.GetOPAltDAConfig()
require.NoError(t, err)

if altDA {
plasmaCfg.CommitmentType = plasma.GenericCommitmentType
altdaCfg.CommitmentType = altda.GenericCommitmentType
} else {
plasmaCfg.CommitmentType = plasma.Keccak256CommitmentType
altdaCfg.CommitmentType = altda.Keccak256CommitmentType
}

daMgr := plasma.NewPlasmaDAWithStorage(log, plasmaCfg, storage, &plasma.NoopMetrics{})
daMgr := altda.NewAltDAWithStorage(log, altdaCfg, storage, &altda.NoopMetrics{})

enabled := sd.RollupCfg.PlasmaEnabled()
enabled := sd.RollupCfg.AltDAEnabled()
require.True(t, enabled)

sequencer := actions.NewL2Sequencer(t, log, l1F, nil, daMgr, engCl, sd.RollupCfg, 0)
miner.ActL1SetFeeRecipient(common.Address{'A'})
sequencer.ActL2PipelineFull(t)

batcher := actions.NewL2Batcher(log, sd.RollupCfg, actions.PlasmaBatcherCfg(dp, storage), sequencer.RollupClient(), l1Client, engine.EthClient(), engCl)
batcher := actions.NewL2Batcher(log, sd.RollupCfg, actions.AltDABatcherCfg(dp, storage), sequencer.RollupClient(), l1Client, engine.EthClient(), engCl)

return &L2PlasmaDA{
return &L2AltDA{
log: log,
storage: storage,
daMgr: daMgr,
plasmaCfg: plasmaCfg,
altdaCfg: altdaCfg,
batcher: batcher,
sequencer: sequencer,
engine: engine,
Expand All @@ -109,7 +109,7 @@ func NewL2PlasmaDA(t actions.Testing, daHost string, altDA bool) *L2PlasmaDA {
}
}

func (a *L2PlasmaDA) ActL1Finalized(t actions.Testing) {
func (a *L2AltDA) ActL1Finalized(t actions.Testing) {
latest := uint64(2)
a.miner.ActL1Safe(t, latest)
a.miner.ActL1Finalize(t, latest)
Expand All @@ -130,7 +130,7 @@ func TestOptimismKeccak256Commitment(gt *testing.T) {

t := actions.NewDefaultTesting(gt)

optimism := NewL2PlasmaDA(t, proxyTS.Address(), false)
optimism := NewL2AltDA(t, proxyTS.Address(), false)

// build L1 block #1
optimism.ActL1Blocks(t, 1)
Expand Down Expand Up @@ -184,7 +184,7 @@ func TestOptimismGenericCommitment(gt *testing.T) {

t := actions.NewDefaultTesting(gt)

optimism := NewL2PlasmaDA(t, proxyTS.Address(), true)
optimism := NewL2AltDA(t, proxyTS.Address(), true)

// build L1 block #1
optimism.ActL1Blocks(t, 1)
Expand Down
18 changes: 9 additions & 9 deletions e2e/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/Layr-Labs/eigenda-proxy/e2e"
"github.com/Layr-Labs/eigenda-proxy/store"
op_plasma "github.com/ethereum-optimism/optimism/op-plasma"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand All @@ -25,7 +25,7 @@ func isNilPtrDerefPanic(err string) bool {
strings.Contains(err, "nil pointer dereference")
}

// TestOpClientKeccak256MalformedInputs tests the NewDAClient from op_plasma by setting and getting against []byte("")
// TestOpClientKeccak256MalformedInputs tests the NewDAClient from altda by setting and getting against []byte("")
// preimage. It sets the precompute option to false on the NewDAClient.
func TestOpClientKeccak256MalformedInputs(t *testing.T) {
if !runIntegrationTests || runTestnetIntegrationTests {
Expand All @@ -41,15 +41,15 @@ func TestOpClientKeccak256MalformedInputs(t *testing.T) {

// nil commitment. Should return an error but currently is not. This needs to be fixed by OP
// Ref: https://github.com/ethereum-optimism/optimism/issues/11987
// daClient := op_plasma.NewDAClient(ts.Address(), false, true)
// daClient := altda.NewDAClient(ts.Address(), false, true)
// t.Run("nil commitment case", func(t *testing.T) {
// var commit op_plasma.CommitmentData
// var commit altda.CommitmentData
// _, err := daClient.GetInput(ts.Ctx, commit)
// require.Error(t, err)
// assert.True(t, !isPanic(err.Error()))
// })

daClientPcFalse := op_plasma.NewDAClient(ts.Address(), false, false)
daClientPcFalse := altda.NewDAClient(ts.Address(), false, false)

t.Run("input bad data to SetInput & GetInput", func(t *testing.T) {
testPreimage := []byte("") // Empty preimage
Expand All @@ -60,7 +60,7 @@ func TestOpClientKeccak256MalformedInputs(t *testing.T) {
assert.True(t, strings.Contains(err.Error(), "invalid input") && !isNilPtrDerefPanic(err.Error()))

// The below test panics silently.
input := op_plasma.NewGenericCommitment([]byte(""))
input := altda.NewGenericCommitment([]byte(""))
_, err = daClientPcFalse.GetInput(ts.Ctx, input)
require.Error(t, err)

Expand All @@ -85,7 +85,7 @@ func TestOptimismClientWithKeccak256Commitment(t *testing.T) {
ts, kill := e2e.CreateTestSuite(t, tsConfig)
defer kill()

daClient := op_plasma.NewDAClient(ts.Address(), false, true)
daClient := altda.NewDAClient(ts.Address(), false, true)

t.Run("normal case", func(t *testing.T) {
testPreimage := []byte(e2e.RandString(100))
Expand Down Expand Up @@ -114,7 +114,7 @@ func TestKeccak256CommitmentRequestErrorsWhenS3NotSet(t *testing.T) {
ts, kill := e2e.CreateTestSuite(t, tsConfig)
defer kill()

daClient := op_plasma.NewDAClient(ts.Address(), false, true)
daClient := altda.NewDAClient(ts.Address(), false, true)

testPreimage := []byte(e2e.RandString(100))

Expand All @@ -139,7 +139,7 @@ func TestOptimismClientWithGenericCommitment(t *testing.T) {
ts, kill := e2e.CreateTestSuite(t, tsConfig)
defer kill()

daClient := op_plasma.NewDAClient(ts.Address(), false, false)
daClient := altda.NewDAClient(ts.Address(), false, false)

testPreimage := []byte(e2e.RandString(100))

Expand Down
Loading
Loading