Commit 565e540e authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

op-e2e,ctb: Test fixes (#12529)

* op-e2e,ctb: Test fixes

- Prevents multiple invocations of the Anvil runner from causing port conflicts.
- Updates the DeployOPChain.s.sol gas limit to 60M

* update test

* fix interop test
parent c05aca35
......@@ -188,7 +188,7 @@ func InteropL2DevConfig(l1ChainID, l2ChainID uint64, addrs devkeys.Addresses) (*
FundDevAccounts: true,
},
L2GenesisBlockDeployConfig: genesis.L2GenesisBlockDeployConfig{
L2GenesisBlockGasLimit: 30_000_000,
L2GenesisBlockGasLimit: 60_000_000,
L2GenesisBlockBaseFeePerGas: (*hexutil.Big)(big.NewInt(params.InitialBaseFee)),
},
OwnershipDeployConfig: genesis.OwnershipDeployConfig{
......@@ -253,7 +253,7 @@ func InteropL2DevConfig(l1ChainID, l2ChainID uint64, addrs devkeys.Addresses) (*
},
Prefund: make(map[common.Address]*big.Int),
SaltMixer: "",
GasLimit: 30_000_000,
GasLimit: 60_000_000,
DisputeGameType: 1, // PERMISSIONED_CANNON Game Type
DisputeAbsolutePrestate: common.HexToHash("0x038512e02c4c3f7bdaec27d00edf55b7155e0905301e1a88083e4e0a6764d54c"),
DisputeMaxGameDepth: 73,
......
......@@ -10,6 +10,7 @@ import (
"strconv"
"strings"
"sync"
"sync/atomic"
"testing"
"github.com/ethereum/go-ethereum/log"
......@@ -21,8 +22,6 @@ func Test(t *testing.T) {
}
}
const AnvilPort = 31967
type Runner struct {
proc *exec.Cmd
stdout io.ReadCloser
......@@ -30,6 +29,7 @@ type Runner struct {
logger log.Logger
startedCh chan struct{}
wg sync.WaitGroup
port int32
}
func New(l1RPCURL string, logger log.Logger) (*Runner, error) {
......@@ -37,7 +37,7 @@ func New(l1RPCURL string, logger log.Logger) (*Runner, error) {
"anvil",
"--fork-url", l1RPCURL,
"--port",
strconv.Itoa(AnvilPort),
"0",
)
stdout, err := proc.StdoutPipe()
if err != nil {
......@@ -88,15 +88,20 @@ func (r *Runner) Stop() error {
func (r *Runner) outputStream(stream io.ReadCloser) {
defer r.wg.Done()
scanner := bufio.NewScanner(stream)
listenLine := fmt.Sprintf("Listening on 127.0.0.1:%d", AnvilPort)
started := sync.OnceFunc(func() {
r.startedCh <- struct{}{}
})
listenLine := "Listening on 127.0.0.1"
for scanner.Scan() {
line := scanner.Text()
if strings.Contains(line, listenLine) {
started()
if strings.Contains(line, listenLine) && atomic.LoadInt32(&r.port) == 0 {
split := strings.Split(line, ":")
port, err := strconv.Atoi(strings.TrimSpace(split[len(split)-1]))
if err == nil {
atomic.StoreInt32(&r.port, int32(port))
r.startedCh <- struct{}{}
} else {
r.logger.Error("failed to parse port from Anvil output", "err", err)
}
}
r.logger.Debug("[ANVIL] " + scanner.Text())
......@@ -104,5 +109,10 @@ func (r *Runner) outputStream(stream io.ReadCloser) {
}
func (r *Runner) RPCUrl() string {
return fmt.Sprintf("http://localhost:%d", AnvilPort)
port := atomic.LoadInt32(&r.port)
if port == 0 {
panic("anvil not started")
}
return fmt.Sprintf("http://localhost:%d", port)
}
......@@ -523,7 +523,7 @@ contract DeployOPChain is Script {
require(systemConfig.basefeeScalar() == _doi.basefeeScalar(), "SYSCON-20");
require(systemConfig.blobbasefeeScalar() == _doi.blobBaseFeeScalar(), "SYSCON-30");
require(systemConfig.batcherHash() == bytes32(uint256(uint160(_doi.batcher()))), "SYSCON-40");
require(systemConfig.gasLimit() == uint64(30_000_000), "SYSCON-50");
require(systemConfig.gasLimit() == uint64(60_000_000), "SYSCON-50");
require(systemConfig.unsafeBlockSigner() == _doi.unsafeBlockSigner(), "SYSCON-60");
require(systemConfig.scalar() >> 248 == 1, "SYSCON-70");
......
......@@ -338,7 +338,7 @@ contract DeployOPChain_TestBase is Test {
IAnchorStateRegistry.StartingAnchorRoot[] startingAnchorRoots;
OPContractsManager opcm = OPContractsManager(address(0));
string saltMixer = "defaultSaltMixer";
uint64 gasLimit = 30_000_000;
uint64 gasLimit = 60_000_000;
// Configurable dispute game parameters.
uint32 disputeGameType = GameType.unwrap(GameTypes.PERMISSIONED_CANNON);
bytes32 disputeAbsolutePrestate = hex"038512e02c4c3f7bdaec27d00edf55b7155e0905301e1a88083e4e0a6764d54c";
......
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