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

Merge branch 'develop' into ctb/standard-bridge-immutable

parents 93faee6f c0044a7d
This diff is collapsed.
This diff is collapsed.
......@@ -13,7 +13,6 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-node/testutils/fuzzerutils"
"github.com/ethereum-optimism/optimism/op-node/withdrawals"
"github.com/ethereum/go-ethereum/accounts"
......@@ -246,10 +245,6 @@ func TestMixedDepositValidity(t *testing.T) {
// Define our L1 transaction timeout duration.
txTimeoutDuration := 10 * time.Duration(cfg.DeployConfig.L1BlockTime) * time.Second
// Bind to the deposit contract
depositContract, err := bindings.NewOptimismPortal(cfg.L1Deployments.OptimismPortalProxy, l1Client)
require.NoError(t, err)
// Create a struct used to track our transactors and their transactions sent.
type TestAccountState struct {
Account *TestAccount
......@@ -320,27 +315,18 @@ func TestMixedDepositValidity(t *testing.T) {
} else {
transferValue = new(big.Int).Mul(common.Big2, transactor.ExpectedL2Balance) // trigger a revert by trying to transfer our current balance * 2
}
tx, err := depositContract.DepositTransaction(transactor.Account.L1Opts, toAddr, transferValue, 100_000, false, nil)
require.Nil(t, err, "with deposit tx")
// Wait for the deposit tx to appear in L1.
receipt, err := waitForTransaction(tx.Hash(), l1Client, txTimeoutDuration)
require.Nil(t, err, "Waiting for deposit tx on L1")
require.Equal(t, receipt.Status, types.ReceiptStatusSuccessful)
// Reconstruct the L2 tx hash to wait for the deposit in L2.
reconstructedDep, err := derive.UnmarshalDepositLogEvent(receipt.Logs[0])
require.NoError(t, err, "Could not reconstruct L2 Deposit")
tx = types.NewTx(reconstructedDep)
receipt, err = waitForTransaction(tx.Hash(), l2Verif, txTimeoutDuration)
require.NoError(t, err)
// Verify the result of the L2 tx receipt. Based on how much we transferred it should be successful/failed.
if validTransfer {
require.Equal(t, types.ReceiptStatusSuccessful, receipt.Status, "Transaction should have succeeded")
} else {
require.Equal(t, types.ReceiptStatusFailed, receipt.Status, "Transaction should have failed")
}
SendDepositTx(t, cfg, l1Client, l2Verif, transactor.Account.L1Opts, func(l2Opts *DepositTxOpts) {
l2Opts.GasLimit = 100_000
l2Opts.IsCreation = false
l2Opts.Data = nil
l2Opts.ToAddr = toAddr
l2Opts.Value = transferValue
if validTransfer {
l2Opts.ExpectedStatus = types.ReceiptStatusSuccessful
} else {
l2Opts.ExpectedStatus = types.ReceiptStatusFailed
}
})
// Update our expected balances.
if validTransfer && transactor != receiver {
......
......@@ -8,7 +8,6 @@ import (
"time"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-e2e/config"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
......@@ -26,7 +25,7 @@ func SendDepositTx(t *testing.T, cfg SystemConfig, l1Client *ethclient.Client, l
applyL2Opts(l2Opts)
// Find deposit contract
depositContract, err := bindings.NewOptimismPortal(config.L1Deployments.OptimismPortalProxy, l1Client)
depositContract, err := bindings.NewOptimismPortal(cfg.L1Deployments.OptimismPortalProxy, l1Client)
require.Nil(t, err)
// Finally send TX
......@@ -54,7 +53,7 @@ func SendDepositTx(t *testing.T, cfg SystemConfig, l1Client *ethclient.Client, l
tx = types.NewTx(reconstructedDep)
receipt, err = waitForTransaction(tx.Hash(), l2Client, 10*time.Duration(cfg.DeployConfig.L2BlockTime)*time.Second)
require.NoError(t, err)
require.Equal(t, l2Opts.ExpectedStatus, receipt.Status)
require.Equal(t, l2Opts.ExpectedStatus, receipt.Status, "l2 transaction status")
}
type DepositTxOptsFn func(l2Opts *DepositTxOpts)
......
......@@ -32,6 +32,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
import { Chains } from "./Chains.sol";
import { IBigStepper } from "src/dispute/interfaces/IBigStepper.sol";
import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol";
import { AlphabetVM } from "../test/FaultDisputeGame.t.sol";
import "src/libraries/DisputeTypes.sol";
......@@ -375,7 +376,7 @@ contract Deploy is Deployer {
/// @notice Deploy Mips
function deployMips() onlyDevnet broadcast() public returns (address) {
MIPS mips = new MIPS();
MIPS mips = new MIPS(IPreimageOracle(mustGetAddress("PreimageOracle")));
save("Mips", address(mips));
console.log("MIPS deployed at %s", address(mips));
......
......@@ -53,9 +53,14 @@ contract MIPS {
uint32 constant EBADF = 0x9;
uint32 constant EINVAL = 0x16;
/// @notice The pre-image oracle.
/// @notice The preimage oracle contract.
IPreimageOracle public oracle;
/// @param _oracle The address of the preimage oracle contract.
constructor(IPreimageOracle _oracle) {
oracle = _oracle;
}
/// @notice Extends the value leftwards with its most significant bit (sign extension).
function SE(uint32 _dat, uint32 _idx) internal pure returns (uint32) {
unchecked {
......
......@@ -11,7 +11,7 @@ contract MIPS_Test is Test {
function setUp() public {
oracle = new PreimageOracle();
mips = new MIPS();
mips = new MIPS(oracle);
vm.store(address(mips), 0x0, bytes32(abi.encode(address(oracle))));
vm.label(address(oracle), "PreimageOracle");
vm.label(address(mips), "MIPS");
......
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