Commit c2e9747f authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into eltociear-patch-1

parents d8b44fe9 05f9659a
...@@ -72,7 +72,6 @@ def main(): ...@@ -72,7 +72,6 @@ def main():
def deploy_contracts(paths): def deploy_contracts(paths):
def internal():
wait_up(8545) wait_up(8545)
wait_for_rpc_server('127.0.0.1:8545') wait_for_rpc_server('127.0.0.1:8545')
res = eth_accounts('127.0.0.1:8545') res = eth_accounts('127.0.0.1:8545')
...@@ -95,7 +94,6 @@ def deploy_contracts(paths): ...@@ -95,7 +94,6 @@ def deploy_contracts(paths):
'--rpc-url', 'http://127.0.0.1:8545' '--rpc-url', 'http://127.0.0.1:8545'
], env={}, cwd=paths.contracts_bedrock_dir) ], env={}, cwd=paths.contracts_bedrock_dir)
return internal
def devnet_l1_genesis(paths): def devnet_l1_genesis(paths):
...@@ -105,7 +103,7 @@ def devnet_l1_genesis(paths): ...@@ -105,7 +103,7 @@ def devnet_l1_genesis(paths):
'--verbosity', '4', '--gcmode', 'archive', '--dev.gaslimit', '30000000' '--verbosity', '4', '--gcmode', 'archive', '--dev.gaslimit', '30000000'
]) ])
forge = multiprocessing.Process(target=deploy_contracts(paths)) forge = multiprocessing.Process(target=deploy_contracts, args=(paths,))
forge.start() forge.start()
forge.join() forge.join()
......
...@@ -22,6 +22,7 @@ import ( ...@@ -22,6 +22,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/bindings" "github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys" "github.com/ethereum-optimism/optimism/op-bindings/predeploys"
op_e2e "github.com/ethereum-optimism/optimism/op-e2e" op_e2e "github.com/ethereum-optimism/optimism/op-e2e"
"github.com/ethereum-optimism/optimism/op-e2e/config"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils" "github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive" "github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-node/withdrawals" "github.com/ethereum-optimism/optimism/op-node/withdrawals"
...@@ -208,7 +209,7 @@ func TestBedrockIndexer(t *testing.T) { ...@@ -208,7 +209,7 @@ func TestBedrockIndexer(t *testing.T) {
require.Nil(t, wd.BedrockFinalizedTxHash) require.Nil(t, wd.BedrockFinalizedTxHash)
// Finalize withdrawal // Finalize withdrawal
err = withdrawals.WaitForFinalizationPeriod(e2eutils.TimeoutCtx(t, 30*time.Second), l1Client, cfg.L1Deployments.OptimismPortalProxy, proveReceipt.BlockNumber) err = withdrawals.WaitForFinalizationPeriod(e2eutils.TimeoutCtx(t, 30*time.Second), l1Client, proveReceipt.BlockNumber, config.L1Deployments.L2OutputOracleProxy)
require.Nil(t, err) require.Nil(t, err)
finReceipt := op_e2e.FinalizeWithdrawal(t, cfg, l1Client, cfg.Secrets.Alice, wdReceipt, wdParams) finReceipt := op_e2e.FinalizeWithdrawal(t, cfg, l1Client, cfg.Secrets.Alice, wdReceipt, wdParams)
......
...@@ -676,7 +676,7 @@ func TestMixedWithdrawalValidity(t *testing.T) { ...@@ -676,7 +676,7 @@ func TestMixedWithdrawalValidity(t *testing.T) {
// Wait for finalization and then create the Finalized Withdrawal Transaction // Wait for finalization and then create the Finalized Withdrawal Transaction
ctx, cancel = context.WithTimeout(context.Background(), 45*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second) ctx, cancel = context.WithTimeout(context.Background(), 45*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second)
defer cancel() defer cancel()
err = withdrawals.WaitForFinalizationPeriod(ctx, l1Client, cfg.L1Deployments.OptimismPortalProxy, header.Number) err = withdrawals.WaitForFinalizationPeriod(ctx, l1Client, header.Number, cfg.L1Deployments.L2OutputOracleProxy)
require.Nil(t, err) require.Nil(t, err)
// Finalize withdrawal // Finalize withdrawal
......
...@@ -145,7 +145,7 @@ func FinalizeWithdrawal(t *testing.T, cfg SystemConfig, l1Client *ethclient.Clie ...@@ -145,7 +145,7 @@ func FinalizeWithdrawal(t *testing.T, cfg SystemConfig, l1Client *ethclient.Clie
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 30*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second)
defer cancel() defer cancel()
err := withdrawals.WaitForFinalizationPeriod(ctx, l1Client, config.L1Deployments.OptimismPortalProxy, withdrawalProofReceipt.BlockNumber) err := withdrawals.WaitForFinalizationPeriod(ctx, l1Client, withdrawalProofReceipt.BlockNumber, config.L1Deployments.L2OutputOracleProxy)
require.Nil(t, err) require.Nil(t, err)
opts, err := bind.NewKeyedTransactorWithChainID(privKey, cfg.L1ChainIDBig()) opts, err := bind.NewKeyedTransactorWithChainID(privKey, cfg.L1ChainIDBig())
......
...@@ -36,7 +36,7 @@ func WaitForOutputRootPublished(ctx context.Context, client *ethclient.Client, l ...@@ -36,7 +36,7 @@ func WaitForOutputRootPublished(ctx context.Context, client *ethclient.Client, l
} }
getL2BlockFromLatestOutput := func() (*big.Int, error) { return l2OO.LatestBlockNumber(opts) } getL2BlockFromLatestOutput := func() (*big.Int, error) { return l2OO.LatestBlockNumber(opts) }
outputBlockNum, err := utils.WaitAndGet[*big.Int](ctx, time.Second, getL2BlockFromLatestOutput, func(latest *big.Int) bool { outputBlockNum, err := utils.WaitAndGet(ctx, time.Second, getL2BlockFromLatestOutput, func(latest *big.Int) bool {
return latest.Cmp(l2BlockNumber) >= 0 return latest.Cmp(l2BlockNumber) >= 0
}) })
if err != nil { if err != nil {
...@@ -48,12 +48,12 @@ func WaitForOutputRootPublished(ctx context.Context, client *ethclient.Client, l ...@@ -48,12 +48,12 @@ func WaitForOutputRootPublished(ctx context.Context, client *ethclient.Client, l
// WaitForFinalizationPeriod waits until the L1 chain has progressed far enough that l1ProvingBlockNum has completed // WaitForFinalizationPeriod waits until the L1 chain has progressed far enough that l1ProvingBlockNum has completed
// the finalization period. // the finalization period.
// This functions polls and can block for a very long time if used on mainnet. // This functions polls and can block for a very long time if used on mainnet.
func WaitForFinalizationPeriod(ctx context.Context, client *ethclient.Client, portalAddr common.Address, l1ProvingBlockNum *big.Int) error { func WaitForFinalizationPeriod(ctx context.Context, client *ethclient.Client, l1ProvingBlockNum *big.Int, l2OutputOracleAddr common.Address) error {
l1ProvingBlockNum = new(big.Int).Set(l1ProvingBlockNum) // Don't clobber caller owned l1ProvingBlockNum l1ProvingBlockNum = new(big.Int).Set(l1ProvingBlockNum) // Don't clobber caller owned l1ProvingBlockNum
opts := &bind.CallOpts{Context: ctx} opts := &bind.CallOpts{Context: ctx}
// Load finalization period // Load finalization period
l2OO, err := createL2OOCaller(ctx, client, portalAddr) l2OO, err := bindings.NewL2OutputOracleCaller(l2OutputOracleAddr, client)
if err != nil { if err != nil {
return fmt.Errorf("create L2OOCaller: %w", err) return fmt.Errorf("create L2OOCaller: %w", err)
} }
...@@ -81,18 +81,6 @@ func WaitForFinalizationPeriod(ctx context.Context, client *ethclient.Client, po ...@@ -81,18 +81,6 @@ func WaitForFinalizationPeriod(ctx context.Context, client *ethclient.Client, po
}) })
} }
func createL2OOCaller(ctx context.Context, client *ethclient.Client, portalAddr common.Address) (*bindings.L2OutputOracleCaller, error) {
portal, err := bindings.NewOptimismPortalCaller(portalAddr, client)
if err != nil {
return nil, fmt.Errorf("create OptimismPortalCaller: %w", err)
}
l2OOAddress, err := portal.L2ORACLE(&bind.CallOpts{Context: ctx})
if err != nil {
return nil, fmt.Errorf("create L2ORACLE: %w", err)
}
return bindings.NewL2OutputOracleCaller(l2OOAddress, client)
}
type ProofClient interface { type ProofClient interface {
GetProof(context.Context, common.Address, []string, *big.Int) (*gethclient.AccountResult, error) GetProof(context.Context, common.Address, []string, *big.Int) (*gethclient.AccountResult, error)
} }
......
...@@ -109,6 +109,14 @@ contract Deploy is Deployer { ...@@ -109,6 +109,14 @@ contract Deploy is Deployer {
vm.stopBroadcast(); vm.stopBroadcast();
} }
/// @notice Modifier that will only allow a function to be called on devnet.
modifier onlyDevnet() {
uint256 chainid = block.chainid;
if (chainid == Chains.LocalDevnet || chainid == Chains.GethDevnet) {
_;
}
}
/// @notice Deploy the AddressManager /// @notice Deploy the AddressManager
function deployAddressManager() broadcast() public returns (address) { function deployAddressManager() broadcast() public returns (address) {
AddressManager manager = new AddressManager(); AddressManager manager = new AddressManager();
...@@ -250,8 +258,7 @@ contract Deploy is Deployer { ...@@ -250,8 +258,7 @@ contract Deploy is Deployer {
} }
/// @notice Deploy the DisputeGameFactoryProxy /// @notice Deploy the DisputeGameFactoryProxy
function deployDisputeGameFactoryProxy() broadcast() public returns (address) { function deployDisputeGameFactoryProxy() onlyDevnet broadcast() public returns (address) {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
address proxyAdmin = mustGetAddress("ProxyAdmin"); address proxyAdmin = mustGetAddress("ProxyAdmin");
Proxy proxy = new Proxy({ Proxy proxy = new Proxy({
_admin: proxyAdmin _admin: proxyAdmin
...@@ -265,8 +272,6 @@ contract Deploy is Deployer { ...@@ -265,8 +272,6 @@ contract Deploy is Deployer {
return address(proxy); return address(proxy);
} }
return address(0);
}
/// @notice Deploy the L1CrossDomainMessenger /// @notice Deploy the L1CrossDomainMessenger
function deployL1CrossDomainMessenger() broadcast() public returns (address) { function deployL1CrossDomainMessenger() broadcast() public returns (address) {
...@@ -351,40 +356,31 @@ contract Deploy is Deployer { ...@@ -351,40 +356,31 @@ contract Deploy is Deployer {
} }
/// @notice Deploy the DisputeGameFactory /// @notice Deploy the DisputeGameFactory
function deployDisputeGameFactory() broadcast() public returns (address) { function deployDisputeGameFactory() onlyDevnet broadcast() public returns (address) {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
DisputeGameFactory factory = new DisputeGameFactory(); DisputeGameFactory factory = new DisputeGameFactory();
save("DisputeGameFactory", address(factory)); save("DisputeGameFactory", address(factory));
console.log("DisputeGameFactory deployed at %s", address(factory)); console.log("DisputeGameFactory deployed at %s", address(factory));
return address(factory); return address(factory);
} }
return address(0);
}
/// @notice Deploy the PreimageOracle /// @notice Deploy the PreimageOracle
function deployPreimageOracle() broadcast() public returns (address) { function deployPreimageOracle() onlyDevnet broadcast() public returns (address) {
if (block.chainid == 900) {
PreimageOracle preimageOracle = new PreimageOracle(); PreimageOracle preimageOracle = new PreimageOracle();
save("PreimageOracle", address(preimageOracle)); save("PreimageOracle", address(preimageOracle));
console.log("PreimageOracle deployed at %s", address(preimageOracle)); console.log("PreimageOracle deployed at %s", address(preimageOracle));
return address(preimageOracle); return address(preimageOracle);
} }
return address(0);
}
/// @notice Deploy Mips /// @notice Deploy Mips
function deployMips() broadcast() public returns (address) { function deployMips() onlyDevnet broadcast() public returns (address) {
if (block.chainid == 900) {
MIPS mips = new MIPS(); MIPS mips = new MIPS();
save("Mips", address(mips)); save("Mips", address(mips));
console.log("Mips deployed at %s", address(mips)); console.log("MIPS deployed at %s", address(mips));
return address(mips); return address(mips);
} }
return address(0);
}
/// @notice Deploy the SystemConfig /// @notice Deploy the SystemConfig
function deploySystemConfig() broadcast() public returns (address) { function deploySystemConfig() broadcast() public returns (address) {
...@@ -470,8 +466,7 @@ contract Deploy is Deployer { ...@@ -470,8 +466,7 @@ contract Deploy is Deployer {
} }
/// @notice Initialize the DisputeGameFactory /// @notice Initialize the DisputeGameFactory
function initializeDisputeGameFactory() broadcast() public { function initializeDisputeGameFactory() onlyDevnet broadcast() public {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin")); ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
address disputeGameFactoryProxy = mustGetAddress("DisputeGameFactoryProxy"); address disputeGameFactoryProxy = mustGetAddress("DisputeGameFactoryProxy");
address disputeGameFactory = mustGetAddress("DisputeGameFactory"); address disputeGameFactory = mustGetAddress("DisputeGameFactory");
...@@ -488,7 +483,6 @@ contract Deploy is Deployer { ...@@ -488,7 +483,6 @@ contract Deploy is Deployer {
string memory version = DisputeGameFactory(disputeGameFactoryProxy).version(); string memory version = DisputeGameFactory(disputeGameFactoryProxy).version();
console.log("DisputeGameFactory version: %s", version); console.log("DisputeGameFactory version: %s", version);
} }
}
/// @notice Initialize the SystemConfig /// @notice Initialize the SystemConfig
function initializeSystemConfig() broadcast() public { function initializeSystemConfig() broadcast() public {
...@@ -704,8 +698,7 @@ contract Deploy is Deployer { ...@@ -704,8 +698,7 @@ contract Deploy is Deployer {
} }
/// @notice Transfer ownership of the DisputeGameFactory contract to the final system owner /// @notice Transfer ownership of the DisputeGameFactory contract to the final system owner
function transferDisputeGameFactoryOwnership() broadcast() public { function transferDisputeGameFactoryOwnership() onlyDevnet broadcast() public {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
DisputeGameFactory disputeGameFactory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy")); DisputeGameFactory disputeGameFactory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
address owner = disputeGameFactory.owner(); address owner = disputeGameFactory.owner();
address finalSystemOwner = cfg.finalSystemOwner(); address finalSystemOwner = cfg.finalSystemOwner();
...@@ -714,11 +707,9 @@ contract Deploy is Deployer { ...@@ -714,11 +707,9 @@ contract Deploy is Deployer {
console.log("DisputeGameFactory ownership transferred to: %s", finalSystemOwner); console.log("DisputeGameFactory ownership transferred to: %s", finalSystemOwner);
} }
} }
}
/// @notice Sets the implementation for the `FAULT` game type in the `DisputeGameFactory` /// @notice Sets the implementation for the `FAULT` game type in the `DisputeGameFactory`
function setFaultGameImplementation() broadcast() public { function setFaultGameImplementation() onlyDevnet broadcast() public {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
DisputeGameFactory factory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy")); DisputeGameFactory factory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
Claim absolutePrestate = Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate())); Claim absolutePrestate = Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate()));
IBigStepper faultVm = IBigStepper(new AlphabetVM(absolutePrestate)); IBigStepper faultVm = IBigStepper(new AlphabetVM(absolutePrestate));
...@@ -733,6 +724,5 @@ contract Deploy is Deployer { ...@@ -733,6 +724,5 @@ contract Deploy is Deployer {
console.log("DisputeGameFactory: set `FaultDisputeGame` implementation"); console.log("DisputeGameFactory: set `FaultDisputeGame` implementation");
} }
} }
}
} }
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