Commit 0bb2ff57 authored by Sam Stokes's avatar Sam Stokes Committed by GitHub

repo: rename plasma --> altDA (#11370)

* update superchain-registry import

* replace all plasma with altda

* replace plasma with altda in filenames

* contracts: update snapshots

* go: update superchain import

* go: update superchain import after rebase

* go: run mod tidy

* op-batcher: fix altda env vars passed in devnet docker-compose

* go: update superchain import

* go: use main commit for superchain import
parent eaed52d1
......@@ -207,17 +207,17 @@ jobs:
name: Copy L2OO allocs to .devnet-l2oo
command: cp -r .devnet/ .devnet-l2oo/
- run:
name: Generate Plasma allocs
command: DEVNET_PLASMA="true" make devnet-allocs
name: Generate AltDA allocs
command: DEVNET_ALTDA="true" make devnet-allocs
- run:
name: Copy Plasma allocs to .devnet-plasma
command: cp -r .devnet/ .devnet-plasma/
name: Copy AltDA allocs to .devnet-altda
command: cp -r .devnet/ .devnet-altda/
- run:
name: Generate Generic Plasma allocs
command: DEVNET_PLASMA="true" GENERIC_PLASMA="true" make devnet-allocs
name: Generate Generic AltDA allocs
command: DEVNET_ALTDA="true" GENERIC_ALTDA="true" make devnet-allocs
- run:
name: Copy Plasma allocs to .devnet-plasma
command: cp -r .devnet/ .devnet-plasma-generic/
name: Copy AltDA allocs to .devnet-altda
command: cp -r .devnet/ .devnet-altda-generic/
- run:
name: Generate default allocs
command: make devnet-allocs
......@@ -239,18 +239,18 @@ jobs:
- ".devnet-l2oo/allocs-l2-ecotone.json"
- ".devnet-l2oo/allocs-l2-fjord.json"
- ".devnet-l2oo/allocs-l2-granite.json"
- ".devnet-plasma/allocs-l1.json"
- ".devnet-plasma/addresses.json"
- ".devnet-plasma/allocs-l2-delta.json"
- ".devnet-plasma/allocs-l2-ecotone.json"
- ".devnet-plasma/allocs-l2-fjord.json"
- ".devnet-plasma/allocs-l2-granite.json"
- ".devnet-plasma-generic/allocs-l1.json"
- ".devnet-plasma-generic/addresses.json"
- ".devnet-plasma-generic/allocs-l2-delta.json"
- ".devnet-plasma-generic/allocs-l2-ecotone.json"
- ".devnet-plasma-generic/allocs-l2-fjord.json"
- ".devnet-plasma-generic/allocs-l2-granite.json"
- ".devnet-altda/allocs-l1.json"
- ".devnet-altda/addresses.json"
- ".devnet-altda/allocs-l2-delta.json"
- ".devnet-altda/allocs-l2-ecotone.json"
- ".devnet-altda/allocs-l2-fjord.json"
- ".devnet-altda/allocs-l2-granite.json"
- ".devnet-altda-generic/allocs-l1.json"
- ".devnet-altda-generic/addresses.json"
- ".devnet-altda-generic/allocs-l2-delta.json"
- ".devnet-altda-generic/allocs-l2-ecotone.json"
- ".devnet-altda-generic/allocs-l2-fjord.json"
- ".devnet-altda-generic/allocs-l2-granite.json"
- "packages/contracts-bedrock/deploy-config/devnetL1.json"
- "packages/contracts-bedrock/deployments/devnetL1"
- notify-failures-on-develop
......@@ -838,11 +838,11 @@ jobs:
command: echo 'export OP_E2E_USE_L2OO=true' >> $BASH_ENV
- when:
condition:
equal: ['-plasma', <<parameters.variant>>]
equal: ['-altda', <<parameters.variant>>]
steps:
- run:
name: Set OP_E2E_USE_PLASMA = true
command: echo 'export OP_E2E_USE_PLASMA=true' >> $BASH_ENV
name: Set OP_E2E_USE_ALTDA = true
command: echo 'export OP_E2E_USE_ALTDA=true' >> $BASH_ENV
- check-changed:
patterns: op-(.+),cannon,contracts-bedrock
- run:
......@@ -1067,26 +1067,26 @@ jobs:
DEVNET_NO_BUILD: 'true'
# Default value; Can be overridden.
DEVNET_L2OO: 'false'
DEVNET_PLASMA: 'false'
DEVNET_ALTDA: 'false'
steps:
- checkout
- when:
condition:
equal: ['plasma', <<parameters.variant>>]
equal: ['altda', <<parameters.variant>>]
steps:
- run:
name: Set DEVNET_PLASMA = true
command: echo 'export DEVNET_PLASMA=true' >> $BASH_ENV
name: Set DEVNET_ALTDA = true
command: echo 'export DEVNET_ALTDA=true' >> $BASH_ENV
- when:
condition:
equal: ['plasma-generic', <<parameters.variant>>]
equal: ['altda-generic', <<parameters.variant>>]
steps:
- run:
name: Set DEVNET_PLASMA = true
command: echo 'export DEVNET_PLASMA=true' >> $BASH_ENV
name: Set DEVNET_ALTDA = true
command: echo 'export DEVNET_ALTDA=true' >> $BASH_ENV
- run:
name: Set GENERIC_PLASMA = true
command: echo 'export GENERIC_PLASMA=true' >> $BASH_ENV
name: Set GENERIC_ALTDA = true
command: echo 'export GENERIC_ALTDA=true' >> $BASH_ENV
- check-changed:
patterns: op-(.+),packages,ops-bedrock,bedrock-devnet
- run:
......@@ -1576,7 +1576,7 @@ workflows:
name: op-e2e-action-tests<< matrix.variant >>
matrix:
parameters:
variant: ["", "-l2oo", "-plasma"]
variant: ["", "-l2oo", "-altda"]
module: op-e2e
target: test-actions
parallelism: 1
......@@ -1621,7 +1621,7 @@ workflows:
- op-e2e-HTTP-tests
- op-e2e-fault-proof-tests
- op-e2e-action-tests
- op-e2e-action-tests-plasma
- op-e2e-action-tests-altda
- docker-build:
name: op-node-docker-build
docker_name: op-node
......@@ -1678,7 +1678,7 @@ workflows:
- devnet:
matrix:
parameters:
variant: ["default", "plasma", "plasma-generic"]
variant: ["default", "altda", "altda-generic"]
requires:
- pnpm-monorepo
- op-batcher-docker-build
......
......@@ -14,7 +14,7 @@
/op-heartbeat @ethereum-optimism/go-reviewers
/op-node @ethereum-optimism/go-reviewers
/op-node/rollup @protolambda @ajsutton
/op-plasma @ethereum-optimism/go-reviewers
/op-alt-da @ethereum-optimism/go-reviewers
/op-preimage @ethereum-optimism/go-reviewers
/op-program @ethereum-optimism/go-reviewers
/op-proposer @ethereum-optimism/go-reviewers
......
......@@ -27,8 +27,8 @@ FORKS = ["delta", "ecotone", "fjord", "granite"]
# Global environment variables
DEVNET_NO_BUILD = os.getenv('DEVNET_NO_BUILD') == "true"
DEVNET_L2OO = os.getenv('DEVNET_L2OO') == "true"
DEVNET_PLASMA = os.getenv('DEVNET_PLASMA') == "true"
GENERIC_PLASMA = os.getenv('GENERIC_PLASMA') == "true"
DEVNET_ALTDA = os.getenv('DEVNET_ALTDA') == "true"
GENERIC_ALTDA = os.getenv('GENERIC_ALTDA') == "true"
class Bunch:
def __init__(self, **kwds):
......@@ -123,9 +123,9 @@ def init_devnet_l1_deploy_config(paths, update_timestamp=False):
deploy_config['l1GenesisBlockTimestamp'] = '{:#x}'.format(int(time.time()))
if DEVNET_L2OO:
deploy_config['useFaultProofs'] = False
if DEVNET_PLASMA:
deploy_config['usePlasma'] = True
if GENERIC_PLASMA:
if DEVNET_ALTDA:
deploy_config['useAltDA'] = True
if GENERIC_ALTDA:
deploy_config['daCommitmentType'] = "GenericCommitment"
write_json(paths.devnet_config_path, deploy_config)
......@@ -175,7 +175,7 @@ def devnet_deploy(paths):
log.info('L1 genesis already generated.')
else:
log.info('Generating L1 genesis.')
if not os.path.exists(paths.allocs_l1_path) or DEVNET_L2OO or DEVNET_PLASMA:
if not os.path.exists(paths.allocs_l1_path) or DEVNET_L2OO or DEVNET_ALTDA:
# If this is a devnet variant then we need to generate the allocs
# file here always. This is because CI will run devnet-allocs
# without setting the appropriate env var which means the allocs will be wrong.
......@@ -267,19 +267,19 @@ def devnet_deploy(paths):
docker_env['DG_TYPE'] = '254'
docker_env['PROPOSAL_INTERVAL'] = '12s'
if DEVNET_PLASMA:
docker_env['PLASMA_ENABLED'] = 'true'
if DEVNET_ALTDA:
docker_env['ALTDA_ENABLED'] = 'true'
docker_env['DA_TYPE'] = 'calldata'
else:
docker_env['PLASMA_ENABLED'] = 'false'
docker_env['ALTDA_ENABLED'] = 'false'
docker_env['DA_TYPE'] = 'blobs'
if GENERIC_PLASMA:
docker_env['PLASMA_GENERIC_DA'] = 'true'
docker_env['PLASMA_DA_SERVICE'] = 'true'
if GENERIC_ALTDA:
docker_env['ALTDA_GENERIC_DA'] = 'true'
docker_env['ALTDA_SERVICE'] = 'true'
else:
docker_env['PLASMA_GENERIC_DA'] = 'false'
docker_env['PLASMA_DA_SERVICE'] = 'false'
docker_env['ALTDA_GENERIC_DA'] = 'false'
docker_env['ALTDA_SERVICE'] = 'false'
# Bring up the rest of the services.
log.info('Bringing up `op-node`, `op-proposer` and `op-batcher`.')
......@@ -291,7 +291,7 @@ def devnet_deploy(paths):
run_command(['docker', 'compose', 'up', '-d', 'op-challenger'], cwd=paths.ops_bedrock_dir, env=docker_env)
# Optionally bring up Alt-DA Mode components.
if DEVNET_PLASMA:
if DEVNET_ALTDA:
log.info('Bringing up `da-server`, `sentinel`.') # TODO(10141): We don't have public sentinel images yet
run_command(['docker', 'compose', 'up', '-d', 'da-server'], cwd=paths.ops_bedrock_dir, env=docker_env)
......
......@@ -11,7 +11,7 @@ require (
github.com/crate-crypto/go-kzg-4844 v1.0.0
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240813170044-d5be5587e58f
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240814192743-ea7e768a02a6
github.com/ethereum/go-ethereum v1.14.7
github.com/fsnotify/fsnotify v1.7.0
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb
......
......@@ -176,8 +176,8 @@ github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 h1:RWHKLhCrQThMfch+QJ1Z
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3/go.mod h1:QziizLAiF0KqyLdNJYD7O5cpDlaFMNZzlxYNcWsJUxs=
github.com/ethereum-optimism/op-geth v1.101407.0-rc.1.0.20240812224053-8d99ca68bb1a h1:OK3wB7HbdhCneSowC1XZusHaLIVdXoRLuCWgXp5Tjuc=
github.com/ethereum-optimism/op-geth v1.101407.0-rc.1.0.20240812224053-8d99ca68bb1a/go.mod h1:9pT+bF20XwCBE7WkjfRSsCg6RN6Njdbr924DtQ3+geY=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240813170044-d5be5587e58f h1:JTnVOiaYVQcXc+zgsSjnTQ18k3uOLOpch8SiPjO1eTo=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240813170044-d5be5587e58f/go.mod h1:zy9f3TNPS7pwW4msMitF83fp0Wf452tZ6+Fg6d4JyXM=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240814192743-ea7e768a02a6 h1:s51nSnpwPJRRU/F6mob/fnOebFmuPz3Ab1J/HCtC40U=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240814192743-ea7e768a02a6/go.mod h1:zy9f3TNPS7pwW4msMitF83fp0Wf452tZ6+Fg6d4JyXM=
github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA=
github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 h1:KrE8I4reeVvf7C1tm8elRjj4BdscTYzz/WAbYyf/JI4=
......
package plasma
package altda
import (
"fmt"
......@@ -8,29 +8,25 @@ import (
)
var (
EnabledFlagName, EnabledFlagAlias = altDAFlags("enabled")
DaServerAddressFlagName, DaServerAddressFlagAlias = altDAFlags("da-server")
VerifyOnReadFlagName, VerifyOnReadFlagAlias = altDAFlags("verify-on-read")
DaServiceFlag, DaServiceFlagAlias = altDAFlags("da-service")
EnabledFlagName = altDAFlags("enabled")
DaServerAddressFlagName = altDAFlags("da-server")
VerifyOnReadFlagName = altDAFlags("verify-on-read")
DaServiceFlag = altDAFlags("da-service")
)
// altDAFlags returns the flag names for altDA, with an Alias for plasma
func altDAFlags(v string) (string, string) {
return "altda." + v,
"plasma." + v
// altDAFlags returns the flag names for altDA
func altDAFlags(v string) string {
return "altda." + v
}
func altDAEnvs(envprefix, v string) []string {
return []string{
envprefix + "_ALTDA_" + v,
envprefix + "_PLASMA_" + v}
return []string{envprefix + "_ALTDA_" + v}
}
func CLIFlags(envPrefix string, category string) []cli.Flag {
return []cli.Flag{
&cli.BoolFlag{
Name: EnabledFlagName,
Aliases: []string{EnabledFlagAlias},
Usage: "Enable Alt-DA mode\nAlt-DA Mode is a Beta feature of the MIT licensed OP Stack. While it has received initial review from core contributors, it is still undergoing testing, and may have bugs or other issues.",
Value: false,
EnvVars: altDAEnvs(envPrefix, "ENABLED"),
......@@ -38,14 +34,12 @@ func CLIFlags(envPrefix string, category string) []cli.Flag {
},
&cli.StringFlag{
Name: DaServerAddressFlagName,
Aliases: []string{DaServerAddressFlagAlias},
Usage: "HTTP address of a DA Server",
EnvVars: altDAEnvs(envPrefix, "DA_SERVER"),
Category: category,
},
&cli.BoolFlag{
Name: VerifyOnReadFlagName,
Aliases: []string{VerifyOnReadFlagAlias},
Usage: "Verify input data matches the commitments from the DA storage service",
Value: true,
EnvVars: altDAEnvs(envPrefix, "VERIFY_ON_READ"),
......@@ -53,7 +47,6 @@ func CLIFlags(envPrefix string, category string) []cli.Flag {
},
&cli.BoolFlag{
Name: DaServiceFlag,
Aliases: []string{DaServiceFlagAlias},
Usage: "Use DA service type where commitments are generated by Alt-DA server",
Value: false,
EnvVars: altDAEnvs(envPrefix, "DA_SERVICE"),
......@@ -72,7 +65,7 @@ type CLIConfig struct {
func (c CLIConfig) Check() error {
if c.Enabled {
if c.DAServerURL == "" {
return fmt.Errorf("DA server URL is required when plasma da is enabled")
return fmt.Errorf("DA server URL is required when altDA is enabled")
}
if _, err := url.Parse(c.DAServerURL); err != nil {
return fmt.Errorf("DA server URL is invalid: %w", err)
......
......@@ -5,7 +5,7 @@ import (
"github.com/urfave/cli/v2"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
oplog "github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum-optimism/optimism/op-service/opio"
)
......@@ -25,9 +25,9 @@ func StartDAServer(cliCtx *cli.Context) error {
l := oplog.NewLogger(oplog.AppOut(cliCtx), logCfg)
oplog.SetGlobalLogHandler(l.Handler())
l.Info("Initializing Plasma DA server...")
l.Info("Initializing AltDA server...")
var store plasma.KVStore
var store altda.KVStore
if cfg.FileStoreEnabled() {
l.Info("Using file storage", "path", cfg.FileStoreDirPath)
......@@ -41,7 +41,7 @@ func StartDAServer(cliCtx *cli.Context) error {
store = s3
}
server := plasma.NewDAServer(cliCtx.String(ListenAddrFlagName), cliCtx.Int(PortFlagName), store, l, cfg.UseGenericComm)
server := altda.NewDAServer(cliCtx.String(ListenAddrFlagName), cliCtx.Int(PortFlagName), store, l, cfg.UseGenericComm)
if err := server.Start(); err != nil {
return fmt.Errorf("failed to start the DA server")
......
......@@ -6,7 +6,7 @@ import (
"os"
"path"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
)
type FileStore struct {
......@@ -23,7 +23,7 @@ func (s *FileStore) Get(ctx context.Context, key []byte) ([]byte, error) {
data, err := os.ReadFile(s.fileName(key))
if err != nil {
if os.IsNotExist(err) {
return nil, plasma.ErrNotFound
return nil, altda.ErrNotFound
}
return nil, err
}
......
......@@ -21,7 +21,7 @@ const (
GenericCommFlagName = "generic-commitment"
)
const EnvVarPrefix = "OP_PLASMA_DA_SERVER"
const EnvVarPrefix = "OP_ALTDA_SERVER"
func prefixEnvVars(name string) []string {
return opservice.PrefixEnvVar(EnvVarPrefix, name)
......
......@@ -22,8 +22,8 @@ func main() {
app.Flags = cliapp.ProtectFlags(Flags)
app.Version = opservice.FormatVersion(Version, "", "", "")
app.Name = "da-server"
app.Usage = "Plasma DA Storage Service"
app.Description = "Service for storing plasma DA inputs"
app.Usage = "AltDA Storage Service"
app.Description = "Service for storing AltDA inputs"
app.Action = StartDAServer
ctx := opio.WithInterruptBlocker(context.Background())
......
......@@ -9,7 +9,7 @@ import (
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
)
type S3Config struct {
......@@ -43,7 +43,7 @@ func (s *S3Store) Get(ctx context.Context, key []byte) ([]byte, error) {
if err != nil {
errResponse := minio.ToErrorResponse(err)
if errResponse.Code == "NoSuchKey" {
return nil, plasma.ErrNotFound
return nil, altda.ErrNotFound
}
return nil, err
}
......
package plasma
package altda
import (
"bytes"
......
package plasma
package altda
import (
"bytes"
......
package plasma
package altda
import (
"context"
......
package plasma
package altda
import (
"context"
......@@ -12,7 +12,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-plasma/bindings"
"github.com/ethereum-optimism/optimism/op-alt-da/bindings"
"github.com/ethereum-optimism/optimism/op-service/eth"
)
......@@ -47,7 +47,7 @@ type DAStorage interface {
// HeadSignalFn is the callback function to accept head-signals without a context.
type HeadSignalFn func(eth.L1BlockRef)
// Config is the relevant subset of rollup config for plasma DA.
// Config is the relevant subset of rollup config for AltDA.
type Config struct {
// Required for filtering contract events
DAChallengeContractAddress common.Address
......@@ -77,13 +77,13 @@ type DA struct {
finalizedHeadSignalHandler HeadSignalFn
}
// NewPlasmaDA creates a new PlasmaDA instance with the given log and CLIConfig.
func NewPlasmaDA(log log.Logger, cli CLIConfig, cfg Config, metrics Metricer) *DA {
return NewPlasmaDAWithStorage(log, cfg, cli.NewDAClient(), metrics)
// NewAltDA creates a new AltDA instance with the given log and CLIConfig.
func NewAltDA(log log.Logger, cli CLIConfig, cfg Config, metrics Metricer) *DA {
return NewAltDAWithStorage(log, cfg, cli.NewDAClient(), metrics)
}
// NewPlasmaDAWithStorage creates a new PlasmaDA instance with the given log and DAStorage interface.
func NewPlasmaDAWithStorage(log log.Logger, cfg Config, storage DAStorage, metrics Metricer) *DA {
// NewAltDAWithStorage creates a new AltDA instance with the given log and DAStorage interface.
func NewAltDAWithStorage(log log.Logger, cfg Config, storage DAStorage, metrics Metricer) *DA {
return &DA{
log: log,
cfg: cfg,
......@@ -93,9 +93,9 @@ func NewPlasmaDAWithStorage(log log.Logger, cfg Config, storage DAStorage, metri
}
}
// NewPlasmaDAWithState creates a plasma storage from initial state used for testing in isolation.
// NewAltDAWithState creates an AltDA storage from initial state used for testing in isolation.
// We pass the L1Fetcher to each method so it is kept in sync with the conf depth of the pipeline.
func NewPlasmaDAWithState(log log.Logger, cfg Config, storage DAStorage, metrics Metricer, state *State) *DA {
func NewAltDAWithState(log log.Logger, cfg Config, storage DAStorage, metrics Metricer, state *State) *DA {
return &DA{
log: log,
cfg: cfg,
......@@ -143,12 +143,12 @@ func (d *DA) Finalize(l1Finalized eth.L1BlockRef) {
d.metrics.RecordChallengesHead("finalized", d.finalizedHead.Number)
// Record and Log the latest L1 finalized head
d.log.Info("received l1 finalized signal, forwarding plasma finalization to finalizedHeadSignalHandler",
d.log.Info("received l1 finalized signal, forwarding altDA finalization to finalizedHeadSignalHandler",
"l1", l1Finalized,
"plasma", d.finalizedHead)
"altDA", d.finalizedHead)
// execute the handler function if set
// the handler function is called with the plasma finalized head
// the handler function is called with the altDA finalized head
if d.finalizedHeadSignalHandler == nil {
d.log.Warn("finalized head signal handler not set")
return
......@@ -277,7 +277,7 @@ func (d *DA) AdvanceChallengeOrigin(ctx context.Context, l1 L1Fetcher, block eth
// set and record the new challenge origin
d.challengeOrigin = block
d.metrics.RecordChallengesHead("latest", d.challengeOrigin.Number)
d.log.Info("processed plasma challenge origin", "origin", block)
d.log.Info("processed altDA challenge origin", "origin", block)
return nil
}
......@@ -299,7 +299,7 @@ func (d *DA) AdvanceCommitmentOrigin(ctx context.Context, l1 L1Fetcher, block et
// set and record the new commitment origin
d.commitmentOrigin = block
d.metrics.RecordChallengesHead("latest", d.challengeOrigin.Number)
d.log.Info("processed plasma l1 origin", "origin", block, "finalized", d.finalizedHead.ID(), "l1-finalize", d.l1FinalizedHead.ID())
d.log.Info("processed altDA l1 origin", "origin", block, "finalized", d.finalizedHead.ID(), "l1-finalize", d.l1FinalizedHead.ID())
return nil
}
......
package plasma
package altda
import (
"context"
......@@ -248,7 +248,7 @@ func TestAdvanceChallengeOrigin(t *testing.T) {
state := NewState(logger, &NoopMetrics{}, pcfg)
da := NewPlasmaDAWithState(logger, pcfg, storage, &NoopMetrics{}, state)
da := NewAltDAWithState(logger, pcfg, storage, &NoopMetrics{}, state)
receipts := types.Receipts{&types.Receipt{
Type: 2,
......
package plasma
package altda
import (
"context"
......@@ -75,27 +75,27 @@ func (f *DAErrFaker) ActSetPreImageFail() {
f.setInputErr = errors.New("set input failed")
}
var Disabled = &PlasmaDisabled{}
var Disabled = &AltDADisabled{}
var ErrNotEnabled = errors.New("plasma not enabled")
var ErrNotEnabled = errors.New("altDA not enabled")
// PlasmaDisabled is a noop plasma DA implementation for stubbing.
type PlasmaDisabled struct{}
// AltDADisabled is a noop AltDA implementation for stubbing.
type AltDADisabled struct{}
func (d *PlasmaDisabled) GetInput(ctx context.Context, l1 L1Fetcher, commitment CommitmentData, blockId eth.L1BlockRef) (eth.Data, error) {
func (d *AltDADisabled) GetInput(ctx context.Context, l1 L1Fetcher, commitment CommitmentData, blockId eth.L1BlockRef) (eth.Data, error) {
return nil, ErrNotEnabled
}
func (d *PlasmaDisabled) Reset(ctx context.Context, base eth.L1BlockRef, baseCfg eth.SystemConfig) error {
func (d *AltDADisabled) Reset(ctx context.Context, base eth.L1BlockRef, baseCfg eth.SystemConfig) error {
return io.EOF
}
func (d *PlasmaDisabled) Finalize(ref eth.L1BlockRef) {
func (d *AltDADisabled) Finalize(ref eth.L1BlockRef) {
}
func (d *PlasmaDisabled) OnFinalizedHeadSignal(f HeadSignalFn) {
func (d *AltDADisabled) OnFinalizedHeadSignal(f HeadSignalFn) {
}
func (d *PlasmaDisabled) AdvanceL1Origin(ctx context.Context, l1 L1Fetcher, blockId eth.BlockID) error {
func (d *AltDADisabled) AdvanceL1Origin(ctx context.Context, l1 L1Fetcher, blockId eth.BlockID) error {
return ErrNotEnabled
}
package plasma
package altda
import (
"context"
......
package plasma
package altda
import (
"errors"
......@@ -50,7 +50,7 @@ func challengeKey(comm CommitmentData, inclusionBlockNumber uint64) string {
// When commitments are moved to Expired, if there is an active challenge, the DA Manager is informed that a commitment became invalid.
// Challenges and Commitments can be pruned when they are beyond a certain block number (e.g. when they are finalized).
// In the special case of a L2 reorg, challenges are still tracked but commitments are removed.
// This will allow the plasma fetcher to find the expired challenge.
// This will allow the altDA fetcher to find the expired challenge.
type State struct {
commitments []Commitment // commitments where the challenge/resolve period has not expired yet
expiredCommitments []Commitment // commitments where the challenge/resolve period has expired but not finalized
......
package plasma
package altda
import (
"github.com/ethereum-optimism/optimism/op-service/metrics"
......
package plasma
package altda
// MaxInputSize ensures the canonical chain cannot include input batches too large to
// challenge in the Data Availability Challenge contract. Value in number of bytes.
......@@ -6,6 +6,6 @@ package plasma
const MaxInputSize = 130672
// TxDataVersion1 is the version number for batcher transactions containing
// plasma commitments. It should not collide with DerivationVersion which is still
// altDA commitments. It should not collide with DerivationVersion which is still
// used downstream when parsing the frames.
const TxDataVersion1 = 1
......@@ -8,10 +8,10 @@ import (
"github.com/urfave/cli/v2"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-batcher/compressor"
"github.com/ethereum-optimism/optimism/op-batcher/flags"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
oplog "github.com/ethereum-optimism/optimism/op-service/log"
opmetrics "github.com/ethereum-optimism/optimism/op-service/metrics"
"github.com/ethereum-optimism/optimism/op-service/oppprof"
......@@ -104,7 +104,7 @@ type CLIConfig struct {
MetricsConfig opmetrics.CLIConfig
PprofConfig oppprof.CLIConfig
RPC oprpc.CLIConfig
PlasmaDA plasma.CLIConfig
AltDA altda.CLIConfig
}
func (c *CLIConfig) Check() error {
......@@ -192,6 +192,6 @@ func NewConfig(ctx *cli.Context) *CLIConfig {
MetricsConfig: opmetrics.ReadCLIConfig(ctx),
PprofConfig: oppprof.ReadCLIConfig(ctx),
RPC: oprpc.ReadCLIConfig(ctx),
PlasmaDA: plasma.ReadCLIConfig(ctx),
AltDA: altda.ReadCLIConfig(ctx),
}
}
......@@ -11,10 +11,10 @@ import (
"sync/atomic"
"time"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-batcher/metrics"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/dial"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
......@@ -65,7 +65,7 @@ type DriverSetup struct {
L1Client L1Client
EndpointProvider dial.L2EndpointProvider
ChannelConfig ChannelConfigProvider
PlasmaDA *plasma.DAClient
AltDA *altda.DAClient
}
// BatchSubmitter encapsulates a service responsible for submitting L2 tx
......@@ -569,17 +569,17 @@ func (l *BatchSubmitter) sendTransaction(ctx context.Context, txdata txData, que
l.Log.Crit("Unexpected number of frames in calldata tx", "num_frames", nf)
}
data := txdata.CallData()
// if plasma DA is enabled we post the txdata to the DA Provider and replace it with the commitment.
if l.Config.UsePlasma {
comm, err := l.PlasmaDA.SetInput(ctx, data)
// if AltDA is enabled we post the txdata to the DA Provider and replace it with the commitment.
if l.Config.UseAltDA {
comm, err := l.AltDA.SetInput(ctx, data)
if err != nil {
l.Log.Error("Failed to post input to Plasma DA", "error", err)
l.Log.Error("Failed to post input to Alt DA", "error", err)
// requeue frame if we fail to post to the DA Provider so it can be retried
l.recordFailedTx(txdata.ID(), err)
return nil
}
l.Log.Info("Set plasma input", "commitment", comm, "tx", txdata.ID())
// signal plasma commitment tx with TxDataVersion1
l.Log.Info("Set AltDA input", "commitment", comm, "tx", txdata.ID())
// signal AltDA commitment tx with TxDataVersion1
data = comm.TxData()
}
candidate = l.calldataTxCandidate(data)
......
......@@ -12,12 +12,12 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-batcher/flags"
"github.com/ethereum-optimism/optimism/op-batcher/metrics"
"github.com/ethereum-optimism/optimism/op-batcher/rpc"
"github.com/ethereum-optimism/optimism/op-node/chaincfg"
"github.com/ethereum-optimism/optimism/op-node/rollup"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/cliapp"
"github.com/ethereum-optimism/optimism/op-service/dial"
"github.com/ethereum-optimism/optimism/op-service/eth"
......@@ -35,9 +35,9 @@ type BatcherConfig struct {
PollInterval time.Duration
MaxPendingTransactions uint64
// UsePlasma is true if the rollup config has a DA challenge address so the batcher
// will post inputs to the Plasma DA server and post commitments to blobs or calldata.
UsePlasma bool
// UseAltDA is true if the rollup config has a DA challenge address so the batcher
// will post inputs to the DA server and post commitments to blobs or calldata.
UseAltDA bool
WaitNodeSync bool
CheckRecentTxsDepth int
......@@ -51,7 +51,7 @@ type BatcherService struct {
L1Client *ethclient.Client
EndpointProvider dial.L2EndpointProvider
TxManager *txmgr.SimpleTxManager
PlasmaDA *plasma.DAClient
AltDA *altda.DAClient
BatcherConfig
......@@ -115,8 +115,8 @@ func (bs *BatcherService) initFromCLIConfig(ctx context.Context, version string,
return fmt.Errorf("failed to init profiling: %w", err)
}
// init before driver
if err := bs.initPlasmaDA(cfg); err != nil {
return fmt.Errorf("failed to init plasma DA: %w", err)
if err := bs.initAltDA(cfg); err != nil {
return fmt.Errorf("failed to init AltDA: %w", err)
}
bs.initDriver()
if err := bs.initRPCServer(cfg); err != nil {
......@@ -214,8 +214,8 @@ func (bs *BatcherService) initChannelConfig(cfg *CLIConfig) error {
return fmt.Errorf("unknown data availability type: %v", cfg.DataAvailabilityType)
}
if bs.UsePlasma && cc.MaxFrameSize > plasma.MaxInputSize {
return fmt.Errorf("max frame size %d exceeds plasma max input size %d", cc.MaxFrameSize, plasma.MaxInputSize)
if bs.UseAltDA && cc.MaxFrameSize > altda.MaxInputSize {
return fmt.Errorf("max frame size %d exceeds altDA max input size %d", cc.MaxFrameSize, altda.MaxInputSize)
}
cc.InitCompressorConfig(cfg.ApproxComprRatio, cfg.Compressor, cfg.CompressionAlgo)
......@@ -237,7 +237,7 @@ func (bs *BatcherService) initChannelConfig(cfg *CLIConfig) error {
}
bs.Log.Info("Initialized channel-config",
"da_type", cfg.DataAvailabilityType,
"use_plasma", bs.UsePlasma,
"use_alt_da", bs.UseAltDA,
"max_frame_size", cc.MaxFrameSize,
"target_num_frames", cc.TargetNumFrames,
"compressor", cc.CompressorConfig.Kind,
......@@ -246,7 +246,7 @@ func (bs *BatcherService) initChannelConfig(cfg *CLIConfig) error {
"max_channel_duration", cc.MaxChannelDuration,
"channel_timeout", cc.ChannelTimeout,
"sub_safety_margin", cc.SubSafetyMargin)
if bs.UsePlasma {
if bs.UseAltDA {
bs.Log.Warn("Alt-DA Mode is a Beta feature of the MIT licensed OP Stack. While it has received initial review from core contributors, it is still undergoing testing, and may have bugs or other issues.")
}
......@@ -321,7 +321,7 @@ func (bs *BatcherService) initDriver() {
L1Client: bs.L1Client,
EndpointProvider: bs.EndpointProvider,
ChannelConfig: bs.ChannelConfig,
PlasmaDA: bs.PlasmaDA,
AltDA: bs.AltDA,
})
}
......@@ -346,13 +346,13 @@ func (bs *BatcherService) initRPCServer(cfg *CLIConfig) error {
return nil
}
func (bs *BatcherService) initPlasmaDA(cfg *CLIConfig) error {
config := cfg.PlasmaDA
func (bs *BatcherService) initAltDA(cfg *CLIConfig) error {
config := cfg.AltDA
if err := config.Check(); err != nil {
return err
}
bs.PlasmaDA = config.NewDAClient()
bs.UsePlasma = config.Enabled
bs.AltDA = config.NewDAClient()
bs.UseAltDA = config.Enabled
return nil
}
......
......@@ -8,9 +8,9 @@ import (
"github.com/urfave/cli/v2"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-batcher/compressor"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
opservice "github.com/ethereum-optimism/optimism/op-service"
openum "github.com/ethereum-optimism/optimism/op-service/enum"
oplog "github.com/ethereum-optimism/optimism/op-service/log"
......@@ -192,7 +192,7 @@ func init() {
optionalFlags = append(optionalFlags, opmetrics.CLIFlags(EnvVarPrefix)...)
optionalFlags = append(optionalFlags, oppprof.CLIFlags(EnvVarPrefix)...)
optionalFlags = append(optionalFlags, txmgr.CLIFlags(EnvVarPrefix)...)
optionalFlags = append(optionalFlags, plasma.CLIFlags(EnvVarPrefix, "")...)
optionalFlags = append(optionalFlags, altda.CLIFlags(EnvVarPrefix, "")...)
Flags = append(requiredFlags, optionalFlags...)
}
......
......@@ -5,7 +5,6 @@ import (
"strings"
"testing"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
opservice "github.com/ethereum-optimism/optimism/op-service"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
......@@ -58,14 +57,6 @@ func TestBetaFlags(t *testing.T) {
}
func TestHasEnvVar(t *testing.T) {
// known exceptions to the number of env vars
expEnvVars := map[string]int{
plasma.EnabledFlagName: 2,
plasma.DaServerAddressFlagName: 2,
plasma.VerifyOnReadFlagName: 2,
plasma.DaServiceFlag: 2,
}
for _, flag := range Flags {
flag := flag
flagName := flag.Names()[0]
......@@ -76,11 +67,7 @@ func TestHasEnvVar(t *testing.T) {
})
require.True(t, ok, "must be able to cast the flag to an EnvVar interface")
envFlags := envFlagGetter.GetEnvVars()
if numEnvVars, ok := expEnvVars[flagName]; ok {
require.Equalf(t, numEnvVars, len(envFlags), "flags should have %d env vars", numEnvVars)
} else {
require.Equal(t, 1, len(envFlags), "flags should have exactly one env var")
}
require.Equal(t, 1, len(envFlags), "flags should have exactly one env var")
})
}
}
......
......@@ -17,8 +17,8 @@ import (
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-node/rollup"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/eth"
)
......@@ -491,10 +491,10 @@ func (d *L2CoreDeployConfig) Check(log log.Logger) error {
return nil
}
// PlasmaDeployConfig configures optional Alt-DA and Plasma functionality.
type PlasmaDeployConfig struct {
// UsePlasma is a flag that indicates if the system is using op-plasma
UsePlasma bool `json:"usePlasma"`
// AltDADeployConfig configures optional AltDA functionality.
type AltDADeployConfig struct {
// UseAltDA is a flag that indicates if the system is using op-alt-da
UseAltDA bool `json:"useAltDA"`
// DACommitmentType specifies the allowed commitment
DACommitmentType string `json:"daCommitmentType"`
// DAChallengeWindow represents the block interval during which the availability of a data commitment can be challenged.
......@@ -508,15 +508,15 @@ type PlasmaDeployConfig struct {
DAResolverRefundPercentage uint64 `json:"daResolverRefundPercentage"`
}
var _ ConfigChecker = (*PlasmaDeployConfig)(nil)
var _ ConfigChecker = (*AltDADeployConfig)(nil)
func (d *PlasmaDeployConfig) Check(log log.Logger) error {
if d.UsePlasma {
if !(d.DACommitmentType == plasma.KeccakCommitmentString || d.DACommitmentType == plasma.GenericCommitmentString) {
func (d *AltDADeployConfig) Check(log log.Logger) error {
if d.UseAltDA {
if !(d.DACommitmentType == altda.KeccakCommitmentString || d.DACommitmentType == altda.GenericCommitmentString) {
return fmt.Errorf("%w: DACommitmentType must be either KeccakCommitment or GenericCommitment", ErrInvalidDeployConfig)
}
// only enforce challenge and resolve window if using alt-da mode with Keccak Commitments
if d.DACommitmentType != plasma.GenericCommitmentString {
if d.DACommitmentType != altda.GenericCommitmentString {
if d.DAChallengeWindow == 0 {
return fmt.Errorf("%w: DAChallengeWindow cannot be 0 when using alt-da mode with Keccak Commitments", ErrInvalidDeployConfig)
}
......@@ -542,7 +542,7 @@ type L2InitializationConfig struct {
EIP1559DeployConfig
UpgradeScheduleDeployConfig
L2CoreDeployConfig
PlasmaDeployConfig
AltDADeployConfig
}
func (d *L2InitializationConfig) Check(log log.Logger) error {
......@@ -719,7 +719,7 @@ type L1DependenciesConfig struct {
// DependencyContext is the contextual configuration needed to verify the L1 dependencies,
// used by DeployConfig.CheckAddresses.
type DependencyContext struct {
UsePlasma bool
UseAltDA bool
DACommitmentType string
}
......@@ -740,9 +740,9 @@ func (d *L1DependenciesConfig) CheckAddresses(dependencyContext DependencyContex
return fmt.Errorf("%w: OptimismPortalProxy cannot be address(0)", ErrInvalidDeployConfig)
}
if dependencyContext.UsePlasma && dependencyContext.DACommitmentType == plasma.KeccakCommitmentString && d.DAChallengeProxy == (common.Address{}) {
if dependencyContext.UseAltDA && dependencyContext.DACommitmentType == altda.KeccakCommitmentString && d.DAChallengeProxy == (common.Address{}) {
return fmt.Errorf("%w: DAChallengeContract cannot be address(0) when using alt-da mode", ErrInvalidDeployConfig)
} else if dependencyContext.UsePlasma && dependencyContext.DACommitmentType == plasma.GenericCommitmentString && d.DAChallengeProxy != (common.Address{}) {
} else if dependencyContext.UseAltDA && dependencyContext.DACommitmentType == altda.GenericCommitmentString && d.DAChallengeProxy != (common.Address{}) {
return fmt.Errorf("%w: DAChallengeContract must be address(0) when using generic commitments in alt-da mode", ErrInvalidDeployConfig)
}
return nil
......@@ -834,7 +834,7 @@ func (d *DeployConfig) Check(log log.Logger) error {
// circular dependency that should be resolved in the future.
func (d *DeployConfig) CheckAddresses() error {
return d.L1DependenciesConfig.CheckAddresses(DependencyContext{
UsePlasma: d.UsePlasma,
UseAltDA: d.UseAltDA,
DACommitmentType: d.DACommitmentType,
})
}
......@@ -858,9 +858,9 @@ func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHas
if d.SystemConfigProxy == (common.Address{}) {
return nil, errors.New("SystemConfigProxy cannot be address(0)")
}
var plasma *rollup.PlasmaConfig
if d.UsePlasma {
plasma = &rollup.PlasmaConfig{
var altDA *rollup.AltDAConfig
if d.UseAltDA {
altDA = &rollup.AltDAConfig{
CommitmentType: d.DACommitmentType,
DAChallengeAddress: d.DAChallengeProxy,
DAChallengeWindow: d.DAChallengeWindow,
......@@ -903,7 +903,7 @@ func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHas
FjordTime: d.FjordTime(l1StartBlock.Time()),
GraniteTime: d.GraniteTime(l1StartBlock.Time()),
InteropTime: d.InteropTime(l1StartBlock.Time()),
PlasmaConfig: plasma,
AltDAConfig: altDA,
}, nil
}
......@@ -987,7 +987,7 @@ func (d *L1Deployments) Check(deployConfig *DeployConfig) error {
name == "DisputeGameFactoryProxy") {
continue
}
if !deployConfig.UsePlasma &&
if !deployConfig.UseAltDA &&
(name == "DataAvailabilityChallenge" ||
name == "DataAvailabilityChallengeProxy") {
continue
......
......@@ -86,7 +86,7 @@
"respectedGameType": 0,
"useCustomGasToken": false,
"useFaultProofs": false,
"usePlasma": false,
"useAltDA": false,
"daBondSize": 0,
"daCommitmentType": "KeccakCommitment",
"daChallengeProxy": "0x0000000000000000000000000000000000000000",
......
......@@ -19,13 +19,13 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-batcher/batcher"
"github.com/ethereum-optimism/optimism/op-batcher/compressor"
batcherFlags "github.com/ethereum-optimism/optimism/op-batcher/flags"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
)
......@@ -44,8 +44,8 @@ type L1TxAPI interface {
SendTransaction(ctx context.Context, tx *types.Transaction) error
}
type PlasmaInputSetter interface {
SetInput(ctx context.Context, img []byte) (plasma.CommitmentData, error)
type AltDAInputSetter interface {
SetInput(ctx context.Context, img []byte) (altda.CommitmentData, error)
}
type BatcherCfg struct {
......@@ -59,10 +59,10 @@ type BatcherCfg struct {
ForceSubmitSingularBatch bool
ForceSubmitSpanBatch bool
UsePlasma bool
UseAltDA bool
DataAvailabilityType batcherFlags.DataAvailabilityType
PlasmaDA PlasmaInputSetter
AltDA AltDAInputSetter
}
func DefaultBatcherCfg(dp *e2eutils.DeployParams) *BatcherCfg {
......@@ -74,14 +74,14 @@ func DefaultBatcherCfg(dp *e2eutils.DeployParams) *BatcherCfg {
}
}
func PlasmaBatcherCfg(dp *e2eutils.DeployParams, plasmaDa PlasmaInputSetter) *BatcherCfg {
func AltDABatcherCfg(dp *e2eutils.DeployParams, altDA AltDAInputSetter) *BatcherCfg {
return &BatcherCfg{
MinL1TxSize: 0,
MaxL1TxSize: 128_000,
BatcherKey: dp.Secrets.Batcher,
DataAvailabilityType: batcherFlags.CalldataType,
PlasmaDA: plasmaDa,
UsePlasma: true,
AltDA: altDA,
UseAltDA: true,
}
}
......@@ -250,9 +250,9 @@ func (s *L2Batcher) ActL2BatchSubmit(t Testing, txOpts ...func(tx *types.Dynamic
}
payload := data.Bytes()
if s.l2BatcherCfg.UsePlasma {
comm, err := s.l2BatcherCfg.PlasmaDA.SetInput(t.Ctx(), payload)
require.NoError(t, err, "failed to set input for plasma")
if s.l2BatcherCfg.UseAltDA {
comm, err := s.l2BatcherCfg.AltDA.SetInput(t.Ctx(), payload)
require.NoError(t, err, "failed to set input for altda")
payload = comm.TxData()
}
......
......@@ -50,8 +50,8 @@ type L2Sequencer struct {
}
func NewL2Sequencer(t Testing, log log.Logger, l1 derive.L1Fetcher, blobSrc derive.L1BlobsFetcher,
plasmaSrc driver.PlasmaIface, eng L2API, cfg *rollup.Config, seqConfDepth uint64) *L2Sequencer {
ver := NewL2Verifier(t, log, l1, blobSrc, plasmaSrc, eng, cfg, &sync.Config{}, safedb.Disabled)
altDASrc driver.AltDAIface, eng L2API, cfg *rollup.Config, seqConfDepth uint64) *L2Sequencer {
ver := NewL2Verifier(t, log, l1, blobSrc, altDASrc, eng, cfg, &sync.Config{}, safedb.Disabled)
attrBuilder := derive.NewFetchingAttributesBuilder(cfg, l1, eng)
seqConfDepthL1 := confdepth.NewConfDepth(seqConfDepth, ver.syncStatus.L1Head, l1)
l1OriginSelector := &MockL1OriginSelector{
......
......@@ -15,8 +15,8 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"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"
)
......@@ -48,7 +48,7 @@ func setupSequencerTest(t Testing, sd *e2eutils.SetupData, log log.Logger) (*L1M
l2Cl, err := sources.NewEngineClient(engine.RPCClient(), log, nil, sources.EngineClientDefaultConfig(sd.RollupCfg))
require.NoError(t, err)
sequencer := NewL2Sequencer(t, log.New("role", "sequencer"), l1F, miner.BlobStore(), plasma.Disabled, l2Cl, sd.RollupCfg, 0)
sequencer := NewL2Sequencer(t, log.New("role", "sequencer"), l1F, miner.BlobStore(), altda.Disabled, l2Cl, sd.RollupCfg, 0)
return miner, engine, sequencer
}
......
......@@ -84,7 +84,7 @@ type safeDB interface {
node.SafeDBReader
}
func NewL2Verifier(t Testing, log log.Logger, l1 derive.L1Fetcher, blobsSrc derive.L1BlobsFetcher, plasmaSrc driver.PlasmaIface, eng L2API, cfg *rollup.Config, syncCfg *sync.Config, safeHeadListener safeDB) *L2Verifier {
func NewL2Verifier(t Testing, log log.Logger, l1 derive.L1Fetcher, blobsSrc derive.L1BlobsFetcher, altDASrc driver.AltDAIface, eng L2API, cfg *rollup.Config, syncCfg *sync.Config, safeHeadListener safeDB) *L2Verifier {
ctx, cancel := context.WithCancel(context.Background())
t.Cleanup(cancel)
......@@ -115,8 +115,8 @@ func NewL2Verifier(t Testing, log log.Logger, l1 derive.L1Fetcher, blobsSrc deri
sys.Register("cl-sync", clSync, opts)
var finalizer driver.Finalizer
if cfg.PlasmaEnabled() {
finalizer = finality.NewPlasmaFinalizer(ctx, log, cfg, l1, plasmaSrc)
if cfg.AltDAEnabled() {
finalizer = finality.NewAltDAFinalizer(ctx, log, cfg, l1, altDASrc)
} else {
finalizer = finality.NewFinalizer(ctx, log, cfg, l1)
}
......@@ -125,7 +125,7 @@ func NewL2Verifier(t Testing, log log.Logger, l1 derive.L1Fetcher, blobsSrc deri
sys.Register("attributes-handler",
attributes.NewAttributesHandler(log, cfg, ctx, eng), opts)
pipeline := derive.NewDerivationPipeline(log, cfg, l1, blobsSrc, plasmaSrc, eng, metrics)
pipeline := derive.NewDerivationPipeline(log, cfg, l1, blobsSrc, altDASrc, eng, metrics)
sys.Register("pipeline", derive.NewPipelineDeriver(ctx, pipeline), opts)
testActionEmitter := sys.Register("test-action", nil, opts)
......
......@@ -3,8 +3,8 @@ package actions
import (
"testing"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-node/node/safedb"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
......@@ -41,7 +41,7 @@ func setupVerifier(t Testing, sd *e2eutils.SetupData, log log.Logger, l1F derive
jwtPath := e2eutils.WriteDefaultJWT(t)
engine := NewL2Engine(t, log.New("role", "verifier-engine"), sd.L2Cfg, sd.RollupCfg.Genesis.L1, jwtPath, EngineWithP2P())
engCl := engine.EngineClient(t, sd.RollupCfg)
verifier := NewL2Verifier(t, log.New("role", "verifier"), l1F, blobSrc, plasma.Disabled, engCl, sd.RollupCfg, syncCfg, cfg.safeHeadListener)
verifier := NewL2Verifier(t, log.New("role", "verifier"), l1F, blobSrc, altda.Disabled, engCl, sd.RollupCfg, syncCfg, cfg.safeHeadListener)
return engine, verifier
}
......
......@@ -14,9 +14,9 @@ import (
"github.com/ethereum/go-ethereum/node"
"github.com/stretchr/testify/require"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-node/rollup/sync"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/client"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/sources"
......@@ -613,7 +613,7 @@ func RestartOpGeth(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
engRpc := &rpcWrapper{seqEng.RPCClient()}
l2Cl, err := sources.NewEngineClient(engRpc, log, nil, sources.EngineClientDefaultConfig(sd.RollupCfg))
require.NoError(t, err)
sequencer := NewL2Sequencer(t, log, l1F, miner.BlobStore(), plasma.Disabled, l2Cl, sd.RollupCfg, 0)
sequencer := NewL2Sequencer(t, log, l1F, miner.BlobStore(), altda.Disabled, l2Cl, sd.RollupCfg, 0)
batcher := NewL2Batcher(log, sd.RollupCfg, DefaultBatcherCfg(dp),
sequencer.RollupClient(), miner.EthClient(), seqEng.EthClient(), seqEng.EngineClient(t, sd.RollupCfg))
......@@ -701,7 +701,7 @@ func ConflictingL2Blocks(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
require.NoError(t, err)
l1F, err := sources.NewL1Client(miner.RPCClient(), log, nil, sources.L1ClientDefaultConfig(sd.RollupCfg, false, sources.RPCKindStandard))
require.NoError(t, err)
altSequencer := NewL2Sequencer(t, log, l1F, miner.BlobStore(), plasma.Disabled, altSeqEngCl, sd.RollupCfg, 0)
altSequencer := NewL2Sequencer(t, log, l1F, miner.BlobStore(), altda.Disabled, altSeqEngCl, sd.RollupCfg, 0)
altBatcher := NewL2Batcher(log, sd.RollupCfg, DefaultBatcherCfg(dp),
altSequencer.RollupClient(), miner.EthClient(), altSeqEng.EthClient(), altSeqEng.EngineClient(t, sd.RollupCfg))
......
......@@ -19,13 +19,13 @@ import (
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
engine2 "github.com/ethereum-optimism/optimism/op-node/rollup/engine"
"github.com/ethereum-optimism/optimism/op-node/rollup/event"
"github.com/ethereum-optimism/optimism/op-node/rollup/sync"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/sources"
"github.com/ethereum-optimism/optimism/op-service/testlog"
......@@ -819,7 +819,7 @@ func TestELSyncTransitionsToCLSyncAfterNodeRestart(gt *testing.T) {
PrepareELSyncedNode(t, miner, sequencer, seqEng, verifier, verEng, seqEngCl, batcher, dp)
// Create a new verifier which is essentially a new op-node with the sync mode of ELSync and default geth engine kind.
verifier = NewL2Verifier(t, captureLog, miner.L1Client(t, sd.RollupCfg), miner.BlobStore(), plasma.Disabled, verifier.eng, sd.RollupCfg, &sync.Config{SyncMode: sync.ELSync}, defaultVerifierCfg().safeHeadListener)
verifier = NewL2Verifier(t, captureLog, miner.L1Client(t, sd.RollupCfg), miner.BlobStore(), altda.Disabled, verifier.eng, sd.RollupCfg, &sync.Config{SyncMode: sync.ELSync}, defaultVerifierCfg().safeHeadListener)
// Build another 10 L1 blocks on the sequencer
for i := 0; i < 10; i++ {
......@@ -861,7 +861,7 @@ func TestForcedELSyncCLAfterNodeRestart(gt *testing.T) {
PrepareELSyncedNode(t, miner, sequencer, seqEng, verifier, verEng, seqEngCl, batcher, dp)
// Create a new verifier which is essentially a new op-node with the sync mode of ELSync and erigon engine kind.
verifier2 := NewL2Verifier(t, captureLog, miner.L1Client(t, sd.RollupCfg), miner.BlobStore(), plasma.Disabled, verifier.eng, sd.RollupCfg, &sync.Config{SyncMode: sync.ELSync, SupportsPostFinalizationELSync: true}, defaultVerifierCfg().safeHeadListener)
verifier2 := NewL2Verifier(t, captureLog, miner.L1Client(t, sd.RollupCfg), miner.BlobStore(), altda.Disabled, verifier.eng, sd.RollupCfg, &sync.Config{SyncMode: sync.ELSync, SupportsPostFinalizationELSync: true}, defaultVerifierCfg().safeHeadListener)
// Build another 10 L1 blocks on the sequencer
for i := 0; i < 10; i++ {
......
......@@ -14,10 +14,10 @@ import (
"github.com/stretchr/testify/require"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-e2e/config"
"github.com/ethereum-optimism/optimism/op-node/rollup"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/eth"
)
......@@ -47,7 +47,7 @@ type TestParams struct {
SequencerWindowSize uint64
ChannelTimeout uint64
L1BlockTime uint64
UsePlasma bool
UseAltDA bool
}
func MakeDeployParams(t require.TestingT, tp *TestParams) *DeployParams {
......@@ -62,7 +62,7 @@ func MakeDeployParams(t require.TestingT, tp *TestParams) *DeployParams {
deployConfig.ChannelTimeoutBedrock = tp.ChannelTimeout
deployConfig.ChannelTimeoutGranite = tp.ChannelTimeout
deployConfig.L1BlockTime = tp.L1BlockTime
deployConfig.UsePlasma = tp.UsePlasma
deployConfig.UseAltDA = tp.UseAltDA
ApplyDeployConfigForks(deployConfig)
logger := log.NewLogger(log.DiscardHandler())
......@@ -148,13 +148,13 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) *
l2Genesis.Alloc[addr] = val
}
var pcfg *rollup.PlasmaConfig
if deployConf.UsePlasma {
pcfg = &rollup.PlasmaConfig{
var pcfg *rollup.AltDAConfig
if deployConf.UseAltDA {
pcfg = &rollup.AltDAConfig{
DAChallengeAddress: l1Deployments.DataAvailabilityChallengeProxy,
DAChallengeWindow: deployConf.DAChallengeWindow,
DAResolveWindow: deployConf.DAResolveWindow,
CommitmentType: plasma.KeccakCommitmentString,
CommitmentType: altda.KeccakCommitmentString,
}
}
......@@ -188,7 +188,7 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) *
FjordTime: deployConf.FjordTime(uint64(deployConf.L1GenesisBlockTimestamp)),
GraniteTime: deployConf.GraniteTime(uint64(deployConf.L1GenesisBlockTimestamp)),
InteropTime: deployConf.InteropTime(uint64(deployConf.L1GenesisBlockTimestamp)),
PlasmaConfig: pcfg,
AltDAConfig: pcfg,
}
require.NoError(t, rollupCfg.Check())
......@@ -247,7 +247,7 @@ func UseL2OO() bool {
os.Getenv("DEVNET_L2OO") == "true")
}
func UsePlasma() bool {
return (os.Getenv("OP_E2E_USE_PLASMA") == "true" ||
os.Getenv("DEVNET_PLASMA") == "true")
func UseAltDA() bool {
return (os.Getenv("OP_E2E_USE_ALTDA") == "true" ||
os.Getenv("DEVNET_ALTDA") == "true")
}
......@@ -6,9 +6,9 @@ import (
"github.com/urfave/cli/v2"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-node/rollup/engine"
"github.com/ethereum-optimism/optimism/op-node/rollup/sync"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
openum "github.com/ethereum-optimism/optimism/op-service/enum"
opflags "github.com/ethereum-optimism/optimism/op-service/flags"
oplog "github.com/ethereum-optimism/optimism/op-service/log"
......@@ -438,7 +438,7 @@ func init() {
optionalFlags = append(optionalFlags, oppprof.CLIFlagsWithCategory(EnvVarPrefix, OperationsCategory)...)
optionalFlags = append(optionalFlags, DeprecatedFlags...)
optionalFlags = append(optionalFlags, opflags.CLIFlags(EnvVarPrefix, RollupCategory)...)
optionalFlags = append(optionalFlags, plasma.CLIFlags(EnvVarPrefix, AltDACategory)...)
optionalFlags = append(optionalFlags, altda.CLIFlags(EnvVarPrefix, AltDACategory)...)
Flags = append(requiredFlags, optionalFlags...)
}
......
......@@ -5,7 +5,6 @@ import (
"strings"
"testing"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
opservice "github.com/ethereum-optimism/optimism/op-service"
"github.com/stretchr/testify/require"
......@@ -74,11 +73,7 @@ func TestDeprecatedFlagsAreHidden(t *testing.T) {
func TestHasEnvVar(t *testing.T) {
// known exceptions to the number of env vars
expEnvVars := map[string]int{
BeaconFallbackAddrs.Name: 2,
plasma.EnabledFlagName: 2,
plasma.DaServerAddressFlagName: 2,
plasma.VerifyOnReadFlagName: 2,
plasma.DaServiceFlag: 2,
BeaconFallbackAddrs.Name: 2,
}
for _, flag := range Flags {
......
......@@ -9,8 +9,8 @@ import (
"github.com/ethereum/go-ethereum/params"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-node/p2p/store"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
ophttp "github.com/ethereum-optimism/optimism/op-service/httputil"
"github.com/ethereum-optimism/optimism/op-service/metrics"
......@@ -135,7 +135,7 @@ type Metrics struct {
TransactionsSequencedTotal prometheus.Counter
PlasmaMetrics plasma.Metricer
AltDAMetrics altda.Metricer
// Channel Bank Metrics
headChannelOpenedEvent *metrics.Event
......@@ -425,7 +425,7 @@ func NewMetrics(procName string) *Metrics {
"required",
}),
PlasmaMetrics: plasma.MakeMetrics(ns, factory),
AltDAMetrics: altda.MakeMetrics(ns, factory),
registry: registry,
factory: factory,
......
......@@ -7,12 +7,12 @@ import (
"math"
"time"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-node/flags"
"github.com/ethereum-optimism/optimism/op-node/p2p"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/driver"
"github.com/ethereum-optimism/optimism/op-node/rollup/sync"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/oppprof"
"github.com/ethereum/go-ethereum/log"
)
......@@ -74,8 +74,8 @@ type Config struct {
ConductorRpc string
ConductorRpcTimeout time.Duration
// Plasma DA config
Plasma plasma.CLIConfig
// AltDA config
AltDA altda.CLIConfig
}
type RPCConfig struct {
......@@ -171,10 +171,10 @@ func (cfg *Config) Check() error {
return fmt.Errorf("sequencer must be enabled when conductor is enabled")
}
}
if err := cfg.Plasma.Check(); err != nil {
return fmt.Errorf("plasma config error: %w", err)
if err := cfg.AltDA.Check(); err != nil {
return fmt.Errorf("altDA config error: %w", err)
}
if cfg.Plasma.Enabled {
if cfg.AltDA.Enabled {
log.Warn("Alt-DA Mode is a Beta feature of the MIT licensed OP Stack. While it has received initial review from core contributors, it is still undergoing testing, and may have bugs or other issues.")
}
return nil
......
......@@ -15,6 +15,7 @@ import (
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-node/heartbeat"
"github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum-optimism/optimism/op-node/node/safedb"
......@@ -24,7 +25,6 @@ import (
"github.com/ethereum-optimism/optimism/op-node/rollup/driver"
"github.com/ethereum-optimism/optimism/op-node/rollup/sync"
"github.com/ethereum-optimism/optimism/op-node/version"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/client"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/httputil"
......@@ -385,12 +385,12 @@ func (n *OpNode) initL2(ctx context.Context, cfg *Config) error {
sequencerConductor = NewConductorClient(cfg, n.log, n.metrics)
}
// if plasma is not explicitly activated in the node CLI, the config + any error will be ignored.
rpCfg, err := cfg.Rollup.GetOPPlasmaConfig()
if cfg.Plasma.Enabled && err != nil {
return fmt.Errorf("failed to get plasma config: %w", err)
// if altDA is not explicitly activated in the node CLI, the config + any error will be ignored.
rpCfg, err := cfg.Rollup.GetOPAltDAConfig()
if cfg.AltDA.Enabled && err != nil {
return fmt.Errorf("failed to get altDA config: %w", err)
}
plasmaDA := plasma.NewPlasmaDA(n.log, cfg.Plasma, rpCfg, n.metrics.PlasmaMetrics)
altDA := altda.NewAltDA(n.log, cfg.AltDA, rpCfg, n.metrics.AltDAMetrics)
if cfg.SafeDBPath != "" {
n.log.Info("Safe head database enabled", "path", cfg.SafeDBPath)
safeDB, err := safedb.NewSafeDB(n.log, cfg.SafeDBPath)
......@@ -401,7 +401,7 @@ func (n *OpNode) initL2(ctx context.Context, cfg *Config) error {
} else {
n.safeDB = safedb.Disabled
}
n.l2Driver = driver.NewDriver(&cfg.Driver, &cfg.Rollup, n.l2Source, n.l1Source, n.beacon, n, n, n.log, n.metrics, cfg.ConfigPersistence, n.safeDB, &cfg.Sync, sequencerConductor, plasmaDA)
n.l2Driver = driver.NewDriver(&cfg.Driver, &cfg.Rollup, n.l2Source, n.l1Source, n.beacon, n, n, n.log, n.metrics, cfg.ConfigPersistence, n.safeDB, &cfg.Sync, sequencerConductor, altDA)
return nil
}
......
......@@ -51,7 +51,7 @@ var testConfig = Config{
DepositContractAddress: common.HexToAddress("0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"),
L1SystemConfigAddress: common.HexToAddress("0x229047fed2591dbec1eF1118d64F7aF3dB9EB290"),
ProtocolVersionsAddress: common.HexToAddress("0x8062AbC286f5e7D9428a0Ccb9AbD71e50d93b935"),
PlasmaConfig: nil,
AltDAConfig: nil,
}
func TestChainSpec_CanyonForkActivation(t *testing.T) {
......
......@@ -5,25 +5,25 @@ import (
"errors"
"fmt"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum/go-ethereum/log"
)
// PlasmaDataSource is a data source that fetches inputs from a plasma DA provider given
// AltDADataSource is a data source that fetches inputs from a AltDA provider given
// their onchain commitments. Same as CalldataSource it will keep attempting to fetch.
type PlasmaDataSource struct {
type AltDADataSource struct {
log log.Logger
src DataIter
fetcher PlasmaInputFetcher
fetcher AltDAInputFetcher
l1 L1Fetcher
id eth.L1BlockRef
// keep track of a pending commitment so we can keep trying to fetch the input.
comm plasma.CommitmentData
comm altda.CommitmentData
}
func NewPlasmaDataSource(log log.Logger, src DataIter, l1 L1Fetcher, fetcher PlasmaInputFetcher, id eth.L1BlockRef) *PlasmaDataSource {
return &PlasmaDataSource{
func NewAltDADataSource(log log.Logger, src DataIter, l1 L1Fetcher, fetcher AltDAInputFetcher, id eth.L1BlockRef) *AltDADataSource {
return &AltDADataSource{
log: log,
src: src,
fetcher: fetcher,
......@@ -32,16 +32,16 @@ func NewPlasmaDataSource(log log.Logger, src DataIter, l1 L1Fetcher, fetcher Pla
}
}
func (s *PlasmaDataSource) Next(ctx context.Context) (eth.Data, error) {
func (s *AltDADataSource) Next(ctx context.Context) (eth.Data, error) {
// Process origin syncs the challenge contract events and updates the local challenge states
// before we can proceed to fetch the input data. This function can be called multiple times
// for the same origin and noop if the origin was already processed. It is also called if
// there is not commitment in the current origin.
if err := s.fetcher.AdvanceL1Origin(ctx, s.l1, s.id.ID()); err != nil {
if errors.Is(err, plasma.ErrReorgRequired) {
if errors.Is(err, altda.ErrReorgRequired) {
return nil, NewResetError(errors.New("new expired challenge"))
}
return nil, NewTemporaryError(fmt.Errorf("failed to advance plasma L1 origin: %w", err))
return nil, NewTemporaryError(fmt.Errorf("failed to advance altDA L1 origin: %w", err))
}
if s.comm == nil {
......@@ -54,37 +54,37 @@ func (s *PlasmaDataSource) Next(ctx context.Context) (eth.Data, error) {
if len(data) == 0 {
return nil, NotEnoughData
}
// If the tx data type is not plasma, we forward it downstream to let the next
// If the tx data type is not altDA, we forward it downstream to let the next
// steps validate and potentially parse it as L1 DA inputs.
if data[0] != plasma.TxDataVersion1 {
if data[0] != altda.TxDataVersion1 {
return data, nil
}
// validate batcher inbox data is a commitment.
// strip the transaction data version byte from the data before decoding.
comm, err := plasma.DecodeCommitmentData(data[1:])
comm, err := altda.DecodeCommitmentData(data[1:])
if err != nil {
s.log.Warn("invalid commitment", "commitment", data, "err", err)
return nil, NotEnoughData
}
s.comm = comm
}
// use the commitment to fetch the input from the plasma DA provider.
// use the commitment to fetch the input from the AltDA provider.
data, err := s.fetcher.GetInput(ctx, s.l1, s.comm, s.id)
// GetInput may call for a reorg if the pipeline is stalled and the plasma DA manager
// GetInput may call for a reorg if the pipeline is stalled and the AltDA manager
// continued syncing origins detached from the pipeline origin.
if errors.Is(err, plasma.ErrReorgRequired) {
if errors.Is(err, altda.ErrReorgRequired) {
// challenge for a new previously derived commitment expired.
return nil, NewResetError(err)
} else if errors.Is(err, plasma.ErrExpiredChallenge) {
} else if errors.Is(err, altda.ErrExpiredChallenge) {
// this commitment was challenged and the challenge expired.
s.log.Warn("challenge expired, skipping batch", "comm", s.comm)
s.comm = nil
// skip the input
return s.Next(ctx)
} else if errors.Is(err, plasma.ErrMissingPastWindow) {
} else if errors.Is(err, altda.ErrMissingPastWindow) {
return nil, NewCriticalError(fmt.Errorf("data for comm %s not available: %w", s.comm, err))
} else if errors.Is(err, plasma.ErrPendingChallenge) {
} else if errors.Is(err, altda.ErrPendingChallenge) {
// continue stepping without slowing down.
return nil, NotEnoughData
} else if err != nil {
......@@ -92,8 +92,8 @@ func (s *PlasmaDataSource) Next(ctx context.Context) (eth.Data, error) {
return nil, NewTemporaryError(fmt.Errorf("failed to fetch input data with comm %s from da service: %w", s.comm, err))
}
// inputs are limited to a max size to ensure they can be challenged in the DA contract.
if s.comm.CommitmentType() == plasma.Keccak256CommitmentType && len(data) > plasma.MaxInputSize {
s.log.Warn("input data exceeds max size", "size", len(data), "max", plasma.MaxInputSize)
if s.comm.CommitmentType() == altda.Keccak256CommitmentType && len(data) > altda.MaxInputSize {
s.log.Warn("input data exceeds max size", "size", len(data), "max", altda.MaxInputSize)
s.comm = nil
return s.Next(ctx)
}
......
......@@ -7,8 +7,8 @@ import (
"math/rand"
"testing"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-node/rollup"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum-optimism/optimism/op-service/testutils"
......@@ -35,13 +35,13 @@ func (m *MockFinalitySignal) ExpectFinalized(blockRef eth.L1BlockRef) {
m.On("OnFinalized", blockRef).Once()
}
// TestPlasmaDataSource verifies that commitments are correctly read from l1 and then
// forwarded to the Plasma DA to return the correct inputs in the iterator.
// TestAltDADataSource verifies that commitments are correctly read from l1 and then
// forwarded to the AltDA to return the correct inputs in the iterator.
// First it generates some L1 refs containing a random number of commitments, challenges
// the first 4 commitments then generates enough blocks to expire the challenge.
// Then it simulates rederiving while verifying it does skip the expired input until the next
// challenge expires.
func TestPlasmaDataSource(t *testing.T) {
func TestAltDADataSource(t *testing.T) {
logger := testlog.Logger(t, log.LevelDebug)
ctx := context.Background()
......@@ -49,16 +49,16 @@ func TestPlasmaDataSource(t *testing.T) {
l1F := &testutils.MockL1Source{}
storage := plasma.NewMockDAClient(logger)
storage := altda.NewMockDAClient(logger)
pcfg := plasma.Config{
pcfg := altda.Config{
ChallengeWindow: 90, ResolveWindow: 90,
}
metrics := &plasma.NoopMetrics{}
metrics := &altda.NoopMetrics{}
daState := plasma.NewState(logger, metrics, pcfg)
daState := altda.NewState(logger, metrics, pcfg)
da := plasma.NewPlasmaDAWithState(logger, pcfg, storage, metrics, daState)
da := altda.NewAltDAWithState(logger, pcfg, storage, metrics, daState)
finalitySignal := &MockFinalitySignal{}
da.OnFinalizedHeadSignal(finalitySignal.OnFinalized)
......@@ -88,15 +88,15 @@ func TestPlasmaDataSource(t *testing.T) {
BlockTime: 1,
SeqWindowSize: 20,
BatchInboxAddress: batcherInbox,
PlasmaConfig: &rollup.PlasmaConfig{
AltDAConfig: &rollup.AltDAConfig{
DAChallengeWindow: pcfg.ChallengeWindow,
DAResolveWindow: pcfg.ResolveWindow,
CommitmentType: plasma.KeccakCommitmentString,
CommitmentType: altda.KeccakCommitmentString,
},
}
// keep track of random input data to validate against
var inputs [][]byte
var comms []plasma.CommitmentData
var comms []altda.CommitmentData
var inclusionBlocks []eth.L1BlockRef
signer := cfg.L1Signer()
......@@ -128,8 +128,8 @@ func TestPlasmaDataSource(t *testing.T) {
// mock input commitments in l1 transactions
input := testutils.RandomData(rng, 2000)
comm, _ := storage.SetInput(ctx, input)
// plasma da tests are designed for keccak256 commitments, so we type assert here
kComm := comm.(plasma.Keccak256Commitment)
// altDA tests are designed for keccak256 commitments, so we type assert here
kComm := comm.(altda.Keccak256Commitment)
inputs = append(inputs, input)
comms = append(comms, kComm)
inclusionBlocks = append(inclusionBlocks, ref)
......@@ -231,8 +231,8 @@ func TestPlasmaDataSource(t *testing.T) {
// mock input commitments in l1 transactions
input := testutils.RandomData(rng, 2000)
comm, _ := storage.SetInput(ctx, input)
// plasma da tests are designed for keccak256 commitments, so we type assert here
kComm := comm.(plasma.Keccak256Commitment)
// altDA tests are designed for keccak256 commitments, so we type assert here
kComm := comm.(altda.Keccak256Commitment)
inputs = append(inputs, input)
comms = append(comms, kComm)
......@@ -283,7 +283,7 @@ func TestPlasmaDataSource(t *testing.T) {
}
// This tests makes sure the pipeline returns a temporary error if data is not found.
func TestPlasmaDataSourceStall(t *testing.T) {
func TestAltDADataSourceStall(t *testing.T) {
logger := testlog.Logger(t, log.LevelDebug)
ctx := context.Background()
......@@ -291,17 +291,17 @@ func TestPlasmaDataSourceStall(t *testing.T) {
l1F := &testutils.MockL1Source{}
storage := plasma.NewMockDAClient(logger)
storage := altda.NewMockDAClient(logger)
pcfg := plasma.Config{
pcfg := altda.Config{
ChallengeWindow: 90, ResolveWindow: 90,
}
metrics := &plasma.NoopMetrics{}
metrics := &altda.NoopMetrics{}
daState := plasma.NewState(logger, metrics, pcfg)
daState := altda.NewState(logger, metrics, pcfg)
da := plasma.NewPlasmaDAWithState(logger, pcfg, storage, metrics, daState)
da := altda.NewAltDAWithState(logger, pcfg, storage, metrics, daState)
finalitySignal := &MockFinalitySignal{}
da.OnFinalizedHeadSignal(finalitySignal.OnFinalized)
......@@ -331,10 +331,10 @@ func TestPlasmaDataSourceStall(t *testing.T) {
BlockTime: 1,
SeqWindowSize: 20,
BatchInboxAddress: batcherInbox,
PlasmaConfig: &rollup.PlasmaConfig{
AltDAConfig: &rollup.AltDAConfig{
DAChallengeWindow: pcfg.ChallengeWindow,
DAResolveWindow: pcfg.ResolveWindow,
CommitmentType: plasma.KeccakCommitmentString,
CommitmentType: altda.KeccakCommitmentString,
},
}
......@@ -410,9 +410,9 @@ func TestPlasmaDataSourceStall(t *testing.T) {
l1F.AssertExpectations(t)
}
// TestPlasmaDataSourceInvalidData tests that the pipeline skips invalid data and continues
// TestAltDADataSourceInvalidData tests that the pipeline skips invalid data and continues
// this includes invalid commitments and oversized inputs.
func TestPlasmaDataSourceInvalidData(t *testing.T) {
func TestAltDADataSourceInvalidData(t *testing.T) {
logger := testlog.Logger(t, log.LevelDebug)
ctx := context.Background()
......@@ -420,13 +420,13 @@ func TestPlasmaDataSourceInvalidData(t *testing.T) {
l1F := &testutils.MockL1Source{}
storage := plasma.NewMockDAClient(logger)
storage := altda.NewMockDAClient(logger)
pcfg := plasma.Config{
pcfg := altda.Config{
ChallengeWindow: 90, ResolveWindow: 90,
}
da := plasma.NewPlasmaDAWithStorage(logger, pcfg, storage, &plasma.NoopMetrics{})
da := altda.NewAltDAWithStorage(logger, pcfg, storage, &altda.NoopMetrics{})
// Create rollup genesis and config
l1Time := uint64(2)
......@@ -453,10 +453,10 @@ func TestPlasmaDataSourceInvalidData(t *testing.T) {
BlockTime: 1,
SeqWindowSize: 20,
BatchInboxAddress: batcherInbox,
PlasmaConfig: &rollup.PlasmaConfig{
AltDAConfig: &rollup.AltDAConfig{
DAChallengeWindow: pcfg.ChallengeWindow,
DAResolveWindow: pcfg.ResolveWindow,
CommitmentType: plasma.KeccakCommitmentString,
CommitmentType: altda.KeccakCommitmentString,
},
}
......@@ -474,7 +474,7 @@ func TestPlasmaDataSourceInvalidData(t *testing.T) {
}
l1F.ExpectFetchReceipts(ref.Hash, nil, types.Receipts{}, nil)
// mock input commitments in l1 transactions with an oversized input
input := testutils.RandomData(rng, plasma.MaxInputSize+1)
input := testutils.RandomData(rng, altda.MaxInputSize+1)
comm, _ := storage.SetInput(ctx, input)
tx1, err := types.SignNewTx(batcherPriv, signer, &types.DynamicFeeTx{
......
......@@ -8,8 +8,8 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-node/rollup"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/eth"
)
......@@ -26,11 +26,11 @@ type L1BlobsFetcher interface {
GetBlobs(ctx context.Context, ref eth.L1BlockRef, hashes []eth.IndexedBlobHash) ([]*eth.Blob, error)
}
type PlasmaInputFetcher interface {
type AltDAInputFetcher interface {
// GetInput fetches the input for the given commitment at the given block number from the DA storage service.
GetInput(ctx context.Context, l1 plasma.L1Fetcher, c plasma.CommitmentData, blockId eth.L1BlockRef) (eth.Data, error)
GetInput(ctx context.Context, l1 altda.L1Fetcher, c altda.CommitmentData, blockId eth.L1BlockRef) (eth.Data, error)
// AdvanceL1Origin advances the L1 origin to the given block number, syncing the DA challenge events.
AdvanceL1Origin(ctx context.Context, l1 plasma.L1Fetcher, blockId eth.BlockID) error
AdvanceL1Origin(ctx context.Context, l1 altda.L1Fetcher, blockId eth.BlockID) error
// Reset the challenge origin in case of L1 reorg
Reset(ctx context.Context, base eth.L1BlockRef, baseCfg eth.SystemConfig) error
}
......@@ -39,33 +39,33 @@ type PlasmaInputFetcher interface {
// batch submitter transactions.
// This is not a stage in the pipeline, but a wrapper for another stage in the pipeline
type DataSourceFactory struct {
log log.Logger
dsCfg DataSourceConfig
fetcher L1Fetcher
blobsFetcher L1BlobsFetcher
plasmaFetcher PlasmaInputFetcher
ecotoneTime *uint64
log log.Logger
dsCfg DataSourceConfig
fetcher L1Fetcher
blobsFetcher L1BlobsFetcher
altDAFetcher AltDAInputFetcher
ecotoneTime *uint64
}
func NewDataSourceFactory(log log.Logger, cfg *rollup.Config, fetcher L1Fetcher, blobsFetcher L1BlobsFetcher, plasmaFetcher PlasmaInputFetcher) *DataSourceFactory {
func NewDataSourceFactory(log log.Logger, cfg *rollup.Config, fetcher L1Fetcher, blobsFetcher L1BlobsFetcher, altDAFetcher AltDAInputFetcher) *DataSourceFactory {
config := DataSourceConfig{
l1Signer: cfg.L1Signer(),
batchInboxAddress: cfg.BatchInboxAddress,
plasmaEnabled: cfg.PlasmaEnabled(),
altDAEnabled: cfg.AltDAEnabled(),
}
return &DataSourceFactory{
log: log,
dsCfg: config,
fetcher: fetcher,
blobsFetcher: blobsFetcher,
plasmaFetcher: plasmaFetcher,
ecotoneTime: cfg.EcotoneTime,
log: log,
dsCfg: config,
fetcher: fetcher,
blobsFetcher: blobsFetcher,
altDAFetcher: altDAFetcher,
ecotoneTime: cfg.EcotoneTime,
}
}
// OpenData returns the appropriate data source for the L1 block `ref`.
func (ds *DataSourceFactory) OpenData(ctx context.Context, ref eth.L1BlockRef, batcherAddr common.Address) (DataIter, error) {
// Creates a data iterator from blob or calldata source so we can forward it to the plasma source
// Creates a data iterator from blob or calldata source so we can forward it to the altDA source
// if enabled as it still requires an L1 data source for fetching input commmitments.
var src DataIter
if ds.ecotoneTime != nil && ref.Time >= *ds.ecotoneTime {
......@@ -76,9 +76,9 @@ func (ds *DataSourceFactory) OpenData(ctx context.Context, ref eth.L1BlockRef, b
} else {
src = NewCalldataSource(ctx, ds.log, ds.dsCfg, ds.fetcher, ref, batcherAddr)
}
if ds.dsCfg.plasmaEnabled {
// plasma([calldata | blobdata](l1Ref)) -> data
return NewPlasmaDataSource(ds.log, src, ds.fetcher, ds.plasmaFetcher, ref), nil
if ds.dsCfg.altDAEnabled {
// altDA([calldata | blobdata](l1Ref)) -> data
return NewAltDADataSource(ds.log, src, ds.fetcher, ds.altDAFetcher, ref), nil
}
return src, nil
}
......@@ -87,7 +87,7 @@ func (ds *DataSourceFactory) OpenData(ctx context.Context, ref eth.L1BlockRef, b
type DataSourceConfig struct {
l1Signer types.Signer
batchInboxAddress common.Address
plasmaEnabled bool
altDAEnabled bool
}
// isValidBatchTx returns true if:
......
......@@ -5,7 +5,7 @@ import (
"errors"
"fmt"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
)
// count the tagging info as 200 in terms of buffer size.
......@@ -21,8 +21,8 @@ func frameSize(frame Frame) uint64 {
const DerivationVersion0 = 0
// DerivationVersion1 is reserved for batcher transactions containing plasma commitments.
const DerivationVersion1 = plasma.TxDataVersion1
// DerivationVersion1 is reserved for batcher transactions containing altDA commitments.
const DerivationVersion1 = altda.TxDataVersion1
// MaxSpanBatchElementCount is the maximum number of blocks, transactions in total,
// or transaction per block allowed in a span batch.
......
......@@ -52,7 +52,7 @@ type DerivationPipeline struct {
log log.Logger
rollupCfg *rollup.Config
l1Fetcher L1Fetcher
plasma PlasmaInputFetcher
altDA AltDAInputFetcher
l2 L2Source
......@@ -77,11 +77,11 @@ type DerivationPipeline struct {
// NewDerivationPipeline creates a DerivationPipeline, to turn L1 data into L2 block-inputs.
func NewDerivationPipeline(log log.Logger, rollupCfg *rollup.Config, l1Fetcher L1Fetcher, l1Blobs L1BlobsFetcher,
plasma PlasmaInputFetcher, l2Source L2Source, metrics Metrics) *DerivationPipeline {
altDA AltDAInputFetcher, l2Source L2Source, metrics Metrics) *DerivationPipeline {
// Pull stages
l1Traversal := NewL1Traversal(log, rollupCfg, l1Fetcher)
dataSrc := NewDataSourceFactory(log, rollupCfg, l1Fetcher, l1Blobs, plasma) // auxiliary stage for L1Retrieval
dataSrc := NewDataSourceFactory(log, rollupCfg, l1Fetcher, l1Blobs, altDA) // auxiliary stage for L1Retrieval
l1Src := NewL1Retrieval(log, dataSrc, l1Traversal)
frameQueue := NewFrameQueue(log, l1Src)
bank := NewChannelBank(log, rollupCfg, frameQueue, l1Fetcher, metrics)
......@@ -93,13 +93,13 @@ func NewDerivationPipeline(log log.Logger, rollupCfg *rollup.Config, l1Fetcher L
// Reset from ResetEngine then up from L1 Traversal. The stages do not talk to each other during
// the ResetEngine, but after the ResetEngine, this is the order in which the stages could talk to each other.
// Note: The ResetEngine is the only reset that can fail.
stages := []ResettableStage{l1Traversal, l1Src, plasma, frameQueue, bank, chInReader, batchQueue, attributesQueue}
stages := []ResettableStage{l1Traversal, l1Src, altDA, frameQueue, bank, chInReader, batchQueue, attributesQueue}
return &DerivationPipeline{
log: log,
rollupCfg: rollupCfg,
l1Fetcher: l1Fetcher,
plasma: plasma,
altDA: altDA,
resetting: 0,
stages: stages,
metrics: metrics,
......
......@@ -6,6 +6,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/async"
"github.com/ethereum-optimism/optimism/op-node/rollup/attributes"
......@@ -19,7 +20,6 @@ import (
"github.com/ethereum-optimism/optimism/op-node/rollup/sequencing"
"github.com/ethereum-optimism/optimism/op-node/rollup/status"
"github.com/ethereum-optimism/optimism/op-node/rollup/sync"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/eth"
)
......@@ -105,13 +105,13 @@ type Finalizer interface {
event.Deriver
}
type PlasmaIface interface {
// Notify L1 finalized head so plasma finality is always behind L1
type AltDAIface interface {
// Notify L1 finalized head so AltDA finality is always behind L1
Finalize(ref eth.L1BlockRef)
// Set the engine finalization signal callback
OnFinalizedHeadSignal(f plasma.HeadSignalFn)
OnFinalizedHeadSignal(f altda.HeadSignalFn)
derive.PlasmaInputFetcher
derive.AltDAInputFetcher
}
type SyncStatusTracker interface {
......@@ -164,7 +164,7 @@ func NewDriver(
safeHeadListener rollup.SafeHeadListener,
syncCfg *sync.Config,
sequencerConductor conductor.SequencerConductor,
plasma PlasmaIface,
altDA AltDAIface,
) *Driver {
driverCtx, driverCancel := context.WithCancel(context.Background())
......@@ -200,8 +200,8 @@ func NewDriver(
sys.Register("cl-sync", clSync, opts)
var finalizer Finalizer
if cfg.PlasmaEnabled() {
finalizer = finality.NewPlasmaFinalizer(driverCtx, log, cfg, l1, plasma)
if cfg.AltDAEnabled() {
finalizer = finality.NewAltDAFinalizer(driverCtx, log, cfg, l1, altDA)
} else {
finalizer = finality.NewFinalizer(driverCtx, log, cfg, l1)
}
......@@ -210,7 +210,7 @@ func NewDriver(
sys.Register("attributes-handler",
attributes.NewAttributesHandler(log, cfg, driverCtx, l2), opts)
derivationPipeline := derive.NewDerivationPipeline(log, cfg, verifConfDepth, l1Blobs, plasma, l2, metrics)
derivationPipeline := derive.NewDerivationPipeline(log, cfg, verifConfDepth, l1Blobs, altDA, l2, metrics)
sys.Register("pipeline",
derive.NewPipelineDeriver(driverCtx, derivationPipeline), opts)
......
......@@ -5,48 +5,48 @@ import (
"github.com/ethereum/go-ethereum/log"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/event"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/eth"
)
type PlasmaBackend interface {
// Finalize notifies the L1 finalized head so plasma finality is always behind L1.
type AltDABackend interface {
// Finalize notifies the L1 finalized head so AltDA finality is always behind L1.
Finalize(ref eth.L1BlockRef)
// OnFinalizedHeadSignal sets the engine finalization signal callback.
OnFinalizedHeadSignal(f plasma.HeadSignalFn)
OnFinalizedHeadSignal(f altda.HeadSignalFn)
}
// PlasmaFinalizer is a special type of Finalizer, wrapping a regular Finalizer,
// AltDAFinalizer is a special type of Finalizer, wrapping a regular Finalizer,
// but overriding the finality signal handling:
// it proxies L1 finality signals to the plasma backend,
// it proxies L1 finality signals to the AltDA backend,
// and relies on the backend to then signal when finality is really applicable.
type PlasmaFinalizer struct {
type AltDAFinalizer struct {
*Finalizer
backend PlasmaBackend
backend AltDABackend
}
func NewPlasmaFinalizer(ctx context.Context, log log.Logger, cfg *rollup.Config,
func NewAltDAFinalizer(ctx context.Context, log log.Logger, cfg *rollup.Config,
l1Fetcher FinalizerL1Interface,
backend PlasmaBackend) *PlasmaFinalizer {
backend AltDABackend) *AltDAFinalizer {
inner := NewFinalizer(ctx, log, cfg, l1Fetcher)
// In alt-da mode, the finalization signal is proxied through the plasma manager.
// In alt-da mode, the finalization signal is proxied through the AltDA manager.
// Finality signal will come from the DA contract or L1 finality whichever is last.
// The plasma module will then call the inner.Finalize function when applicable.
// The AltDA module will then call the inner.Finalize function when applicable.
backend.OnFinalizedHeadSignal(func(ref eth.L1BlockRef) {
inner.OnEvent(FinalizeL1Event{FinalizedL1: ref})
})
return &PlasmaFinalizer{
return &AltDAFinalizer{
Finalizer: inner,
backend: backend,
}
}
func (fi *PlasmaFinalizer) OnEvent(ev event.Event) bool {
func (fi *AltDAFinalizer) OnEvent(ev event.Event) bool {
switch x := ev.(type) {
case FinalizeL1Event:
fi.backend.Finalize(x.FinalizedL1)
......
......@@ -10,32 +10,32 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-node/rollup/engine"
"github.com/ethereum-optimism/optimism/op-node/rollup/event"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum-optimism/optimism/op-service/testutils"
)
type fakePlasmaBackend struct {
plasmaFn plasma.HeadSignalFn
forwardTo plasma.HeadSignalFn
type fakeAltDABackend struct {
altDAFn altda.HeadSignalFn
forwardTo altda.HeadSignalFn
}
func (b *fakePlasmaBackend) Finalize(ref eth.L1BlockRef) {
b.plasmaFn(ref)
func (b *fakeAltDABackend) Finalize(ref eth.L1BlockRef) {
b.altDAFn(ref)
}
func (b *fakePlasmaBackend) OnFinalizedHeadSignal(f plasma.HeadSignalFn) {
func (b *fakeAltDABackend) OnFinalizedHeadSignal(f altda.HeadSignalFn) {
b.forwardTo = f
}
var _ PlasmaBackend = (*fakePlasmaBackend)(nil)
var _ AltDABackend = (*fakeAltDABackend)(nil)
func TestPlasmaFinalityData(t *testing.T) {
func TestAltDAFinalityData(t *testing.T) {
logger := testlog.Logger(t, log.LevelInfo)
l1F := &testutils.MockL1Source{}
......@@ -66,14 +66,14 @@ func TestPlasmaFinalityData(t *testing.T) {
BlockTime: 1,
SeqWindowSize: 2,
}
plasmaCfg := &rollup.PlasmaConfig{
altDACfg := &rollup.AltDAConfig{
DAChallengeWindow: 90,
DAResolveWindow: 90,
}
// shoud return l1 finality if plasma is not enabled
// shoud return l1 finality if altda is not enabled
require.Equal(t, uint64(defaultFinalityLookback), calcFinalityLookback(cfg))
cfg.PlasmaConfig = plasmaCfg
cfg.AltDAConfig = altDACfg
expFinalityLookback := 181
require.Equal(t, uint64(expFinalityLookback), calcFinalityLookback(cfg))
......@@ -86,20 +86,20 @@ func TestPlasmaFinalityData(t *testing.T) {
SequenceNumber: 1,
}
// Simulate plasma finality by waiting for the finalized-inclusion
// Simulate altda finality by waiting for the finalized-inclusion
// of a commitment to turn into undisputed finalized data.
commitmentInclusionFinalized := eth.L1BlockRef{}
plasmaBackend := &fakePlasmaBackend{
plasmaFn: func(ref eth.L1BlockRef) {
altDABackend := &fakeAltDABackend{
altDAFn: func(ref eth.L1BlockRef) {
commitmentInclusionFinalized = ref
},
forwardTo: nil,
}
emitter := &testutils.MockEmitter{}
fi := NewPlasmaFinalizer(context.Background(), logger, cfg, l1F, plasmaBackend)
fi := NewAltDAFinalizer(context.Background(), logger, cfg, l1F, altDABackend)
fi.AttachEmitter(emitter)
require.NotNil(t, plasmaBackend.forwardTo, "plasma backend must have access to underlying standard finalizer")
require.NotNil(t, altDABackend.forwardTo, "altda backend must have access to underlying standard finalizer")
require.Equal(t, expFinalityLookback, cap(fi.finalityData))
......@@ -112,7 +112,7 @@ func TestPlasmaFinalityData(t *testing.T) {
if i == 10 { // finalize a L1 commitment
fi.OnEvent(FinalizeL1Event{FinalizedL1: l1parent})
emitter.AssertExpectations(t) // no events emitted upon L1 finality
require.Equal(t, l1parent, commitmentInclusionFinalized, "plasma backend received L1 signal")
require.Equal(t, l1parent, commitmentInclusionFinalized, "altda backend received L1 signal")
}
previous := l1parent
......@@ -144,23 +144,23 @@ func TestPlasmaFinalityData(t *testing.T) {
// clear expectations
emitter.Mock.ExpectedCalls = nil
// no L2 finalize event, as no L1 finality signal has been forwarded by plasma backend yet
// no L2 finalize event, as no L1 finality signal has been forwarded by altda backend yet
fi.OnEvent(TryFinalizeEvent{})
emitter.AssertExpectations(t)
// Pretend to be the plasma backend,
// Pretend to be the altda backend,
// send the original finalization signal to the underlying finalizer,
// now that we are sure the commitment itself is not just finalized,
// but the referenced data cannot be disputed anymore.
plasmaFinalization := commitmentInclusionFinalized.Number + cfg.PlasmaConfig.DAChallengeWindow
if commitmentInclusionFinalized != (eth.L1BlockRef{}) && l1parent.Number == plasmaFinalization {
altdaFinalization := commitmentInclusionFinalized.Number + cfg.AltDAConfig.DAChallengeWindow
if commitmentInclusionFinalized != (eth.L1BlockRef{}) && l1parent.Number == altdaFinalization {
// When the signal is forwarded, a finalization attempt will be scheduled
emitter.ExpectOnce(TryFinalizeEvent{})
plasmaBackend.forwardTo(commitmentInclusionFinalized)
altDABackend.forwardTo(commitmentInclusionFinalized)
emitter.AssertExpectations(t)
require.Equal(t, commitmentInclusionFinalized, fi.finalizedL1, "finality signal now made its way in regular finalizer")
// As soon as a finalization attempt is made, after the finality signal was triggered by plasma backend,
// As soon as a finalization attempt is made, after the finality signal was triggered by altda backend,
// we should get an attempt to get a finalized L2 block.
// In this test the L1 origin of the simulated L2 blocks lags 1 behind the block the L2 block is included in on L1.
// So to check the L2 finality progress, we check if the next L1 block after the L1 origin
......
......@@ -34,14 +34,14 @@ const defaultFinalityLookback = 4*32 + 1
// We do not want to do this too often, since it requires fetching a L1 block by number, so no cache data.
const finalityDelay = 64
// calcFinalityLookback calculates the default finality lookback based on DA challenge window if plasma
// calcFinalityLookback calculates the default finality lookback based on DA challenge window if altDA
// mode is activated or L1 finality lookback.
func calcFinalityLookback(cfg *rollup.Config) uint64 {
// in alt-da mode the longest finality lookback is a commitment is challenged on the last block of
// the challenge window in which case it will be both challenge + resolve window.
if cfg.PlasmaEnabled() {
lkb := cfg.PlasmaConfig.DAChallengeWindow + cfg.PlasmaConfig.DAResolveWindow + 1
// in the case only if the plasma windows are longer than the default finality lookback
if cfg.AltDAEnabled() {
lkb := cfg.AltDAConfig.DAChallengeWindow + cfg.AltDAConfig.DAResolveWindow + 1
// in the case only if the altDA windows are longer than the default finality lookback
if lkb > defaultFinalityLookback {
return lkb
}
......
......@@ -44,12 +44,12 @@ func LoadOPStackRollupConfig(chainID uint64) (*Config, error) {
return nil, fmt.Errorf("unable to retrieve deposit contract address")
}
var plasma *PlasmaConfig
if chConfig.Plasma != nil {
plasma = &PlasmaConfig{
DAChallengeAddress: common.Address(*chConfig.Plasma.DAChallengeAddress),
DAChallengeWindow: *chConfig.Plasma.DAChallengeWindow,
DAResolveWindow: *chConfig.Plasma.DAResolveWindow,
var altDA *AltDAConfig
if chConfig.AltDA != nil {
altDA = &AltDAConfig{
DAChallengeAddress: common.Address(*chConfig.AltDA.DAChallengeAddress),
DAChallengeWindow: *chConfig.AltDA.DAChallengeWindow,
DAResolveWindow: *chConfig.AltDA.DAResolveWindow,
}
}
......@@ -87,7 +87,7 @@ func LoadOPStackRollupConfig(chainID uint64) (*Config, error) {
BatchInboxAddress: common.Address(chConfig.BatchInboxAddr),
DepositContractAddress: common.Address(addrs.OptimismPortalProxy),
L1SystemConfigAddress: common.Address(addrs.SystemConfigProxy),
PlasmaConfig: plasma,
AltDAConfig: altDA,
}
if superChain.Config.ProtocolVersionsAddr != nil { // Set optional protocol versions address
......
......@@ -12,7 +12,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-service/eth"
)
......@@ -51,7 +51,7 @@ type Genesis struct {
SystemConfig eth.SystemConfig `json:"system_config"`
}
type PlasmaConfig struct {
type AltDAConfig struct {
// L1 DataAvailabilityChallenge contract proxy address
DAChallengeAddress common.Address `json:"da_challenge_contract_address,omitempty"`
// CommitmentType specifies which commitment type can be used. Defaults to Keccak (type 0) if not present
......@@ -137,22 +137,8 @@ type Config struct {
// L1 address that declares the protocol versions, optional (Beta feature)
ProtocolVersionsAddress common.Address `json:"protocol_versions_address,omitempty"`
// Plasma Config. We are in the process of migrating to the PlasmaConfig from these legacy top level values
PlasmaConfig *PlasmaConfig `json:"plasma_config,omitempty"`
// L1 DataAvailabilityChallenge contract proxy address
LegacyDAChallengeAddress common.Address `json:"da_challenge_contract_address,omitempty"`
// DA challenge window value set on the DAC contract. Used in alt-da mode
// to compute when a commitment can no longer be challenged.
LegacyDAChallengeWindow uint64 `json:"da_challenge_window,omitempty"`
// DA resolve window value set on the DAC contract. Used in alt-da mode
// to compute when a challenge expires and trigger a reorg if needed.
LegacyDAResolveWindow uint64 `json:"da_resolve_window,omitempty"`
// LegacyUsePlasma is activated when the chain is in alt-da mode.
LegacyUsePlasma bool `json:"use_plasma,omitempty"`
// AltDAConfig. We are in the process of migrating to the AltDAConfig from these legacy top level values
AltDAConfig *AltDAConfig `json:"alt_da,omitempty"`
}
// ValidateL1Config checks L1 config variables for errors.
......@@ -328,7 +314,7 @@ func (cfg *Config) Check() error {
if cfg.L2ChainID.Sign() < 1 {
return ErrL2ChainIDNotPositive
}
if err := validatePlasmaConfig(cfg); err != nil {
if err := validateAltDAConfig(cfg); err != nil {
return err
}
......@@ -354,38 +340,16 @@ func (cfg *Config) Check() error {
return nil
}
// validatePlasmaConfig checks the two approaches to configuring alt-da mode.
// validateAltDAConfig checks the two approaches to configuring alt-da mode.
// If the legacy values are set, they are copied to the new location. If both are set, they are check for consistency.
func validatePlasmaConfig(cfg *Config) error {
if cfg.LegacyUsePlasma && cfg.PlasmaConfig == nil {
// copy from top level to plasma config
cfg.PlasmaConfig = &PlasmaConfig{
DAChallengeAddress: cfg.LegacyDAChallengeAddress,
DAChallengeWindow: cfg.LegacyDAChallengeWindow,
DAResolveWindow: cfg.LegacyDAResolveWindow,
CommitmentType: plasma.KeccakCommitmentString,
}
} else if cfg.LegacyUsePlasma && cfg.PlasmaConfig != nil {
// validate that both are the same
if cfg.LegacyDAChallengeAddress != cfg.PlasmaConfig.DAChallengeAddress {
return fmt.Errorf("LegacyDAChallengeAddress (%v) != PlasmaConfig.DAChallengeAddress (%v)", cfg.LegacyDAChallengeAddress, cfg.PlasmaConfig.DAChallengeAddress)
}
if cfg.LegacyDAChallengeWindow != cfg.PlasmaConfig.DAChallengeWindow {
return fmt.Errorf("LegacyDAChallengeWindow (%v) != PlasmaConfig.DAChallengeWindow (%v)", cfg.LegacyDAChallengeWindow, cfg.PlasmaConfig.DAChallengeWindow)
}
if cfg.LegacyDAResolveWindow != cfg.PlasmaConfig.DAResolveWindow {
return fmt.Errorf("LegacyDAResolveWindow (%v) != PlasmaConfig.DAResolveWindow (%v)", cfg.LegacyDAResolveWindow, cfg.PlasmaConfig.DAResolveWindow)
}
if cfg.PlasmaConfig.CommitmentType != plasma.KeccakCommitmentString {
return errors.New("Cannot set CommitmentType with the legacy config")
}
} else if cfg.PlasmaConfig != nil {
if !(cfg.PlasmaConfig.CommitmentType == plasma.KeccakCommitmentString || cfg.PlasmaConfig.CommitmentType == plasma.GenericCommitmentString) {
return fmt.Errorf("invalid commitment type: %v", cfg.PlasmaConfig.CommitmentType)
func validateAltDAConfig(cfg *Config) error {
if cfg.AltDAConfig != nil {
if !(cfg.AltDAConfig.CommitmentType == altda.KeccakCommitmentString || cfg.AltDAConfig.CommitmentType == altda.GenericCommitmentString) {
return fmt.Errorf("invalid commitment type: %v", cfg.AltDAConfig.CommitmentType)
}
if cfg.PlasmaConfig.CommitmentType == plasma.KeccakCommitmentString && cfg.PlasmaConfig.DAChallengeAddress == (common.Address{}) {
if cfg.AltDAConfig.CommitmentType == altda.KeccakCommitmentString && cfg.AltDAConfig.DAChallengeAddress == (common.Address{}) {
return errors.New("Must set da_challenge_contract_address for keccak commitments")
} else if cfg.PlasmaConfig.CommitmentType == plasma.GenericCommitmentString && cfg.PlasmaConfig.DAChallengeAddress != (common.Address{}) {
} else if cfg.AltDAConfig.CommitmentType == altda.GenericCommitmentString && cfg.AltDAConfig.DAChallengeAddress != (common.Address{}) {
return errors.New("Must set empty da_challenge_contract_address for generic commitments")
}
}
......@@ -549,38 +513,38 @@ func (c *Config) GetPayloadVersion(timestamp uint64) eth.EngineAPIMethod {
}
}
// GetOPPlasmaConfig validates and returns the plasma config from the rollup config.
func (c *Config) GetOPPlasmaConfig() (plasma.Config, error) {
if c.PlasmaConfig == nil {
return plasma.Config{}, errors.New("no plasma config")
// GetOPAltDAConfig validates and returns the altDA config from the rollup config.
func (c *Config) GetOPAltDAConfig() (altda.Config, error) {
if c.AltDAConfig == nil {
return altda.Config{}, errors.New("no altDA config")
}
if c.PlasmaConfig.DAChallengeWindow == uint64(0) {
return plasma.Config{}, errors.New("missing DAChallengeWindow")
if c.AltDAConfig.DAChallengeWindow == uint64(0) {
return altda.Config{}, errors.New("missing DAChallengeWindow")
}
if c.PlasmaConfig.DAResolveWindow == uint64(0) {
return plasma.Config{}, errors.New("missing DAResolveWindow")
if c.AltDAConfig.DAResolveWindow == uint64(0) {
return altda.Config{}, errors.New("missing DAResolveWindow")
}
t, err := plasma.CommitmentTypeFromString(c.PlasmaConfig.CommitmentType)
t, err := altda.CommitmentTypeFromString(c.AltDAConfig.CommitmentType)
if err != nil {
return plasma.Config{}, err
return altda.Config{}, err
}
return plasma.Config{
DAChallengeContractAddress: c.PlasmaConfig.DAChallengeAddress,
ChallengeWindow: c.PlasmaConfig.DAChallengeWindow,
ResolveWindow: c.PlasmaConfig.DAResolveWindow,
return altda.Config{
DAChallengeContractAddress: c.AltDAConfig.DAChallengeAddress,
ChallengeWindow: c.AltDAConfig.DAChallengeWindow,
ResolveWindow: c.AltDAConfig.DAResolveWindow,
CommitmentType: t,
}, nil
}
func (c *Config) PlasmaEnabled() bool {
return c.PlasmaConfig != nil
func (c *Config) AltDAEnabled() bool {
return c.AltDAConfig != nil
}
// SyncLookback computes the number of blocks to walk back in order to find the correct L1 origin.
// In alt-da mode longest possible window is challenge + resolve windows.
func (c *Config) SyncLookback() uint64 {
if c.PlasmaEnabled() {
if win := (c.PlasmaConfig.DAChallengeWindow + c.PlasmaConfig.DAResolveWindow); win > c.SeqWindowSize {
if c.AltDAEnabled() {
if win := (c.AltDAConfig.DAChallengeWindow + c.AltDAConfig.DAResolveWindow); win > c.SeqWindowSize {
return win
}
}
......@@ -623,8 +587,8 @@ func (c *Config) Description(l2Chains map[string]string) string {
banner += fmt.Sprintf(" - Interop: %s\n", fmtForkTimeOrUnset(c.InteropTime))
// Report the protocol version
banner += fmt.Sprintf("Node supports up to OP-Stack Protocol Version: %s\n", OPStackSupport)
if c.PlasmaConfig != nil {
banner += fmt.Sprintf("Node supports Alt-DA Mode with CommitmentType %v\n", c.PlasmaConfig.CommitmentType)
if c.AltDAConfig != nil {
banner += fmt.Sprintf("Node supports Alt-DA Mode with CommitmentType %v\n", c.AltDAConfig.CommitmentType)
}
return banner
}
......@@ -657,7 +621,7 @@ func (c *Config) LogDescription(log log.Logger, l2Chains map[string]string) {
"granite_time", fmtForkTimeOrUnset(c.GraniteTime),
"holocene_time", fmtForkTimeOrUnset(c.HoloceneTime),
"interop_time", fmtForkTimeOrUnset(c.InteropTime),
"plasma_mode", c.PlasmaConfig != nil,
"alt_da", c.AltDAConfig != nil,
)
}
......
......@@ -9,8 +9,8 @@ import (
"os"
"strings"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-node/chaincfg"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
"github.com/ethereum-optimism/optimism/op-service/oppprof"
"github.com/ethereum-optimism/optimism/op-service/sources"
"github.com/ethereum/go-ethereum/common"
......@@ -111,7 +111,7 @@ func NewConfig(ctx *cli.Context, log log.Logger) (*node.Config, error) {
ConductorRpc: ctx.String(flags.ConductorRpcFlag.Name),
ConductorRpcTimeout: ctx.Duration(flags.ConductorRpcTimeoutFlag.Name),
Plasma: plasma.ReadCLIConfig(ctx),
AltDA: altda.ReadCLIConfig(ctx),
}
if err := cfg.LoadPersisted(log); err != nil {
......
......@@ -6,13 +6,13 @@ import (
"github.com/ethereum/go-ethereum/log"
altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-node/rollup/engine"
"github.com/ethereum-optimism/optimism/op-node/rollup/event"
"github.com/ethereum-optimism/optimism/op-node/rollup/sync"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
)
type EndCondition interface {
......@@ -36,7 +36,7 @@ func NewDriver(logger log.Logger, cfg *rollup.Config, l1Source derive.L1Fetcher,
logger: logger,
}
pipeline := derive.NewDerivationPipeline(logger, cfg, l1Source, l1BlobsSource, plasma.Disabled, l2Source, metrics.NoopMetrics)
pipeline := derive.NewDerivationPipeline(logger, cfg, l1Source, l1BlobsSource, altda.Disabled, l2Source, metrics.NoopMetrics)
pipelineDeriver := derive.NewPipelineDeriver(context.Background(), pipeline)
pipelineDeriver.AttachEmitter(d)
......
......@@ -126,9 +126,9 @@ services:
--pprof.enabled
--rpc.enable-admin
--safedb.path=/db
--plasma.enabled=${PLASMA_ENABLED}
--plasma.da-service=${PLASMA_DA_SERVICE}
--plasma.da-server=http://da-server:3100
--altda.enabled=${ALTDA_ENABLED}
--altda.da-service=${ALTDA_SERVICE}
--altda.da-server=http://da-server:3100
ports:
- "7545:8545"
- "9003:9003"
......@@ -200,9 +200,9 @@ services:
OP_BATCHER_METRICS_ENABLED: "true"
OP_BATCHER_RPC_ENABLE_ADMIN: "true"
OP_BATCHER_BATCH_TYPE: 1
OP_BATCHER_PLASMA_ENABLED: "${PLASMA_ENABLED}"
OP_BATCHER_PLASMA_DA_SERVICE: "${PLASMA_DA_SERVICE}"
OP_BATCHER_PLASMA_DA_SERVER: "http://da-server:3100"
OP_BATCHER_ALTDA_ENABLED: "${ALTDA_ENABLED}"
OP_BATCHER_ALTDA_DA_SERVICE: "${ALTDA_SERVICE}"
OP_BATCHER_ALTDA_DA_SERVER: "http://da-server:3100"
OP_BATCHER_DATA_AVAILABILITY_TYPE: "${DA_TYPE}"
op-challenger:
......@@ -251,7 +251,7 @@ services:
--addr=0.0.0.0
--port=3100
--log.level=debug
--generic-commitment="${PLASMA_GENERIC_DA}"
--generic-commitment="${ALTDA_GENERIC_DA}"
ports:
- "3100:3100"
volumes:
......
......@@ -98,7 +98,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build cd op-conductor && make op-c
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_CONDUCTOR_VERSION"
FROM --platform=$BUILDPLATFORM builder AS da-server-builder
RUN --mount=type=cache,target=/root/.cache/go-build cd op-plasma && make da-server \
RUN --mount=type=cache,target=/root/.cache/go-build cd op-alt-da && make da-server \
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE
FROM --platform=$BUILDPLATFORM builder AS op-supervisor-builder
......@@ -153,7 +153,7 @@ COPY --from=op-conductor-builder /app/op-conductor/bin/op-conductor /usr/local/b
CMD ["op-conductor"]
FROM --platform=$TARGETPLATFORM $TARGET_BASE_IMAGE AS da-server-target
COPY --from=da-server-builder /app/op-plasma/bin/da-server /usr/local/bin/
COPY --from=da-server-builder /app/op-alt-da/bin/da-server /usr/local/bin/
CMD ["da-server"]
FROM --platform=$TARGETPLATFORM $TARGET_BASE_IMAGE AS op-supervisor-target
......
......@@ -18,6 +18,6 @@
!/op-service
!/op-supervisor
!/op-wheel
!/op-plasma
!/op-alt-da
!/go.mod
!/go.sum
......@@ -66,7 +66,7 @@
"disputeGameFinalityDelaySeconds": 6,
"respectedGameType": 254,
"useFaultProofs": true,
"usePlasma": false,
"useAltDA": false,
"daCommitmentType": "KeccakCommitment",
"daChallengeWindow": 16,
"daResolveWindow": 16,
......
......@@ -58,7 +58,7 @@
"respectedGameType": 0,
"useFaultProofs": false,
"fundDevAccounts": true,
"usePlasma": false,
"useAltDA": false,
"daChallengeWindow": 100,
"daResolveWindow": 100,
"daBondSize": 1000,
......
......@@ -289,11 +289,11 @@ contract Deploy is Deployer {
console.log("deployed Safe!");
setupSuperchain();
console.log("set up superchain!");
if (cfg.usePlasma()) {
if (cfg.useAltDA()) {
bytes32 typeHash = keccak256(bytes(cfg.daCommitmentType()));
bytes32 keccakHash = keccak256(bytes("KeccakCommitment"));
if (typeHash == keccakHash) {
setupOpPlasma();
setupOpAltDA();
}
}
setupOpChain();
......@@ -416,9 +416,9 @@ contract Deploy is Deployer {
initializeAnchorStateRegistry();
}
/// @notice Add Plasma setup to the OP chain
function setupOpPlasma() public {
console.log("Deploying OP Plasma");
/// @notice Add AltDA setup to the OP chain
function setupOpAltDA() public {
console.log("Deploying OP AltDA");
deployDataAvailabilityChallengeProxy();
deployDataAvailabilityChallenge();
initializeDataAvailabilityChallenge();
......
......@@ -80,7 +80,7 @@ contract DeployConfig is Script {
uint256 public disputeGameFinalityDelaySeconds;
uint256 public respectedGameType;
bool public useFaultProofs;
bool public usePlasma;
bool public useAltDA;
string public daCommitmentType;
uint256 public daChallengeWindow;
uint256 public daResolveWindow;
......@@ -165,7 +165,7 @@ contract DeployConfig is Script {
preimageOracleMinProposalSize = stdJson.readUint(_json, "$.preimageOracleMinProposalSize");
preimageOracleChallengePeriod = stdJson.readUint(_json, "$.preimageOracleChallengePeriod");
usePlasma = _readOr(_json, "$.usePlasma", false);
useAltDA = _readOr(_json, "$.useAltDA", false);
daCommitmentType = _readOr(_json, "$.daCommitmentType", "KeccakCommitment");
daChallengeWindow = _readOr(_json, "$.daChallengeWindow", 1000);
daResolveWindow = _readOr(_json, "$.daResolveWindow", 1000);
......@@ -218,9 +218,9 @@ contract DeployConfig is Script {
return uint256(_l2OutputOracleStartingTimestamp);
}
/// @notice Allow the `usePlasma` config to be overridden in testing environments
function setUsePlasma(bool _usePlasma) public {
usePlasma = _usePlasma;
/// @notice Allow the `useAltDA` config to be overridden in testing environments
function setUseAltDA(bool _useAltDA) public {
useAltDA = _useAltDA;
}
/// @notice Allow the `useFaultProofs` config to be overridden in testing environments
......
......@@ -2617,7 +2617,7 @@
"chainId": 31337,
"forkId": 0
},
"data": "0x7277e7c9",
"data": "0x08e0e2bb",
"deployedCode": "0x",
"initialized": true,
"kind": "StaticCall",
......@@ -13,7 +13,7 @@ import { CommonTest } from "test/setup/CommonTest.sol";
contract DataAvailabilityChallengeTest is CommonTest {
function setUp() public virtual override {
super.enablePlasma();
super.enableAltDA();
super.setUp();
}
......
......@@ -18,7 +18,7 @@ contract CommonTest is Test, Setup, Events {
FFIInterface constant ffi = FFIInterface(address(uint160(uint256(keccak256(abi.encode("optimism.ffi"))))));
bool usePlasmaOverride;
bool useAltDAOverride;
bool useFaultProofs;
address customGasToken;
bool useInteropOverride;
......@@ -32,8 +32,8 @@ contract CommonTest is Test, Setup, Events {
Setup.setUp();
// Override the config after the deploy script initialized the config
if (usePlasmaOverride) {
deploy.cfg().setUsePlasma(true);
if (useAltDAOverride) {
deploy.cfg().setUseAltDA(true);
}
if (useFaultProofs) {
deploy.cfg().setUseFaultProofs(true);
......@@ -119,14 +119,14 @@ contract CommonTest is Test, Setup, Events {
useFaultProofs = true;
}
function enablePlasma() public {
function enableAltDA() public {
// Check if the system has already been deployed, based off of the heuristic that alice and bob have not been
// set by the `setUp` function yet.
if (!(alice == address(0) && bob == address(0))) {
revert("CommonTest: Cannot enable plasma after deployment. Consider overriding `setUp`.");
revert("CommonTest: Cannot enable altda after deployment. Consider overriding `setUp`.");
}
usePlasmaOverride = true;
useAltDAOverride = true;
}
function enableCustomGasToken(address _token) public {
......
......@@ -172,7 +172,7 @@ contract Setup {
vm.label(deploy.mustGetAddress("SuperchainConfigProxy"), "SuperchainConfigProxy");
vm.label(AddressAliasHelper.applyL1ToL2Alias(address(l1CrossDomainMessenger)), "L1CrossDomainMessenger_aliased");
if (deploy.cfg().usePlasma()) {
if (deploy.cfg().useAltDA()) {
dataAvailabilityChallenge =
DataAvailabilityChallenge(deploy.mustGetAddress("DataAvailabilityChallengeProxy"));
vm.label(address(dataAvailabilityChallenge), "DataAvailabilityChallengeProxy");
......
......@@ -34,7 +34,7 @@ contract Initializer_Test is Bridge_Initializer {
InitializeableContract[] contracts;
function setUp() public override {
super.enablePlasma();
super.enableAltDA();
// Run the `Bridge_Initializer`'s `setUp()` function.
super.setUp();
......
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