Commit 531e3d9f authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

op-deployer: Block deploying tags to chains without OPCM (#13231)

* op-deployer: Block deploying tags to chains without OPCM

* fix test
parent da85e698
......@@ -152,12 +152,10 @@ func TestEndToEndApply(t *testing.T) {
t.Run("chain with tagged artifacts", func(t *testing.T) {
intent, st := newIntent(t, l1ChainID, dk, l2ChainID1, loc, loc)
cg := ethClientCodeGetter(ctx, l1Client)
intent.L1ContractsLocator = artifacts.DefaultL1ContractsLocator
intent.L2ContractsLocator = artifacts.DefaultL2ContractsLocator
require.NoError(t, deployer.ApplyPipeline(
require.ErrorIs(t, deployer.ApplyPipeline(
ctx,
deployer.ApplyPipelineOpts{
L1RPCUrl: rpcURL,
......@@ -167,10 +165,7 @@ func TestEndToEndApply(t *testing.T) {
Logger: lgr,
StateWriter: pipeline.NoopStateWriter(),
},
))
validateSuperchainDeployment(t, st, cg)
validateOPChainDeployment(t, cg, st, intent)
), pipeline.ErrRefusingToDeployTaggedReleaseWithoutOPCM)
})
}
......
package pipeline
import (
"bufio"
"context"
"crypto/rand"
"errors"
"fmt"
"os"
"strings"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/standard"
"github.com/mattn/go-isatty"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state"
"github.com/ethereum-optimism/optimism/op-chain-ops/script"
......@@ -18,6 +16,8 @@ import (
"github.com/ethereum/go-ethereum/common"
)
var ErrRefusingToDeployTaggedReleaseWithoutOPCM = errors.New("refusing to deploy tagged release without OPCM")
func IsSupportedStateVersion(version int) bool {
return version == 1
}
......@@ -141,32 +141,17 @@ func displayWarning() error {
####################### WARNING! WARNING WARNING! #######################
You are deploying a tagged release to a chain with no pre-deployed OPCM.
The contracts you are deploying may not be audited, or match a governance
approved release.
Due to a quirk of our contract version system, this can lead to deploying
contracts containing unaudited or untested code. As a result, this
functionality is currently disabled.
We will fix this in an upcoming release.
USE OF THIS DEPLOYMENT IS NOT RECOMMENDED FOR PRODUCTION. USE AT YOUR OWN
RISK. BUGS OR LOSS OF FUNDS MAY OCCUR. WE HOPE YOU KNOW WHAT YOU ARE
DOING.
This process will now exit.
####################### WARNING! WARNING WARNING! #######################
`, "\n")
_, _ = fmt.Fprint(os.Stderr, warning)
if isatty.IsTerminal(os.Stdout.Fd()) {
_, _ = fmt.Fprintf(os.Stderr, "Please confirm that you have read and understood the warning above [y/n]: ")
reader := bufio.NewReader(os.Stdin)
input, err := reader.ReadString('\n')
if err != nil {
return fmt.Errorf("failed to read input: %w", err)
}
input = strings.ToLower(strings.TrimSpace(input))
if input != "y" && input != "yes" {
return fmt.Errorf("aborted")
}
}
return nil
return ErrRefusingToDeployTaggedReleaseWithoutOPCM
}
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