Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
ada137b0
Unverified
Commit
ada137b0
authored
Aug 08, 2023
by
mergify[bot]
Committed by
GitHub
Aug 08, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into ctb/standard-bridge-immutable
parents
93faee6f
c0044a7d
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
37 deletions
+28
-37
mips.go
op-bindings/bindings/mips.go
+4
-4
mips_more.go
op-bindings/bindings/mips_more.go
+1
-1
system_tob_test.go
op-e2e/system_tob_test.go
+12
-26
tx_helper.go
op-e2e/tx_helper.go
+2
-3
Deploy.s.sol
packages/contracts-bedrock/scripts/Deploy.s.sol
+2
-1
MIPS.sol
packages/contracts-bedrock/src/cannon/MIPS.sol
+6
-1
MIPS.t.sol
packages/contracts-bedrock/test/MIPS.t.sol
+1
-1
No files found.
op-bindings/bindings/mips.go
View file @
ada137b0
This diff is collapsed.
Click to expand it.
op-bindings/bindings/mips_more.go
View file @
ada137b0
This diff is collapsed.
Click to expand it.
op-e2e/system_tob_test.go
View file @
ada137b0
...
@@ -13,7 +13,6 @@ import (
...
@@ -13,7 +13,6 @@ 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"
"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/testutils/fuzzerutils"
"github.com/ethereum-optimism/optimism/op-node/testutils/fuzzerutils"
"github.com/ethereum-optimism/optimism/op-node/withdrawals"
"github.com/ethereum-optimism/optimism/op-node/withdrawals"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts"
...
@@ -246,10 +245,6 @@ func TestMixedDepositValidity(t *testing.T) {
...
@@ -246,10 +245,6 @@ func TestMixedDepositValidity(t *testing.T) {
// Define our L1 transaction timeout duration.
// Define our L1 transaction timeout duration.
txTimeoutDuration
:=
10
*
time
.
Duration
(
cfg
.
DeployConfig
.
L1BlockTime
)
*
time
.
Second
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.
// Create a struct used to track our transactors and their transactions sent.
type
TestAccountState
struct
{
type
TestAccountState
struct
{
Account
*
TestAccount
Account
*
TestAccount
...
@@ -320,27 +315,18 @@ func TestMixedDepositValidity(t *testing.T) {
...
@@ -320,27 +315,18 @@ func TestMixedDepositValidity(t *testing.T) {
}
else
{
}
else
{
transferValue
=
new
(
big
.
Int
)
.
Mul
(
common
.
Big2
,
transactor
.
ExpectedL2Balance
)
// trigger a revert by trying to transfer our current balance * 2
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
)
SendDepositTx
(
t
,
cfg
,
l1Client
,
l2Verif
,
transactor
.
Account
.
L1Opts
,
func
(
l2Opts
*
DepositTxOpts
)
{
require
.
Nil
(
t
,
err
,
"with deposit tx"
)
l2Opts
.
GasLimit
=
100
_000
l2Opts
.
IsCreation
=
false
// Wait for the deposit tx to appear in L1.
l2Opts
.
Data
=
nil
receipt
,
err
:=
waitForTransaction
(
tx
.
Hash
(),
l1Client
,
txTimeoutDuration
)
l2Opts
.
ToAddr
=
toAddr
require
.
Nil
(
t
,
err
,
"Waiting for deposit tx on L1"
)
l2Opts
.
Value
=
transferValue
require
.
Equal
(
t
,
receipt
.
Status
,
types
.
ReceiptStatusSuccessful
)
if
validTransfer
{
l2Opts
.
ExpectedStatus
=
types
.
ReceiptStatusSuccessful
// Reconstruct the L2 tx hash to wait for the deposit in L2.
}
else
{
reconstructedDep
,
err
:=
derive
.
UnmarshalDepositLogEvent
(
receipt
.
Logs
[
0
])
l2Opts
.
ExpectedStatus
=
types
.
ReceiptStatusFailed
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"
)
}
// Update our expected balances.
// Update our expected balances.
if
validTransfer
&&
transactor
!=
receiver
{
if
validTransfer
&&
transactor
!=
receiver
{
...
...
op-e2e/tx_helper.go
View file @
ada137b0
...
@@ -8,7 +8,6 @@ import (
...
@@ -8,7 +8,6 @@ import (
"time"
"time"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"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-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
...
@@ -26,7 +25,7 @@ func SendDepositTx(t *testing.T, cfg SystemConfig, l1Client *ethclient.Client, l
...
@@ -26,7 +25,7 @@ func SendDepositTx(t *testing.T, cfg SystemConfig, l1Client *ethclient.Client, l
applyL2Opts
(
l2Opts
)
applyL2Opts
(
l2Opts
)
// Find deposit contract
// Find deposit contract
depositContract
,
err
:=
bindings
.
NewOptimismPortal
(
c
onfi
g
.
L1Deployments
.
OptimismPortalProxy
,
l1Client
)
depositContract
,
err
:=
bindings
.
NewOptimismPortal
(
c
f
g
.
L1Deployments
.
OptimismPortalProxy
,
l1Client
)
require
.
Nil
(
t
,
err
)
require
.
Nil
(
t
,
err
)
// Finally send TX
// Finally send TX
...
@@ -54,7 +53,7 @@ func SendDepositTx(t *testing.T, cfg SystemConfig, l1Client *ethclient.Client, l
...
@@ -54,7 +53,7 @@ func SendDepositTx(t *testing.T, cfg SystemConfig, l1Client *ethclient.Client, l
tx
=
types
.
NewTx
(
reconstructedDep
)
tx
=
types
.
NewTx
(
reconstructedDep
)
receipt
,
err
=
waitForTransaction
(
tx
.
Hash
(),
l2Client
,
10
*
time
.
Duration
(
cfg
.
DeployConfig
.
L2BlockTime
)
*
time
.
Second
)
receipt
,
err
=
waitForTransaction
(
tx
.
Hash
(),
l2Client
,
10
*
time
.
Duration
(
cfg
.
DeployConfig
.
L2BlockTime
)
*
time
.
Second
)
require
.
NoError
(
t
,
err
)
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
)
type
DepositTxOptsFn
func
(
l2Opts
*
DepositTxOpts
)
...
...
packages/contracts-bedrock/scripts/Deploy.s.sol
View file @
ada137b0
...
@@ -32,6 +32,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
...
@@ -32,6 +32,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
import { Chains } from "./Chains.sol";
import { Chains } from "./Chains.sol";
import { IBigStepper } from "src/dispute/interfaces/IBigStepper.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 { AlphabetVM } from "../test/FaultDisputeGame.t.sol";
import "src/libraries/DisputeTypes.sol";
import "src/libraries/DisputeTypes.sol";
...
@@ -375,7 +376,7 @@ contract Deploy is Deployer {
...
@@ -375,7 +376,7 @@ contract Deploy is Deployer {
/// @notice Deploy Mips
/// @notice Deploy Mips
function deployMips() onlyDevnet broadcast() public returns (address) {
function deployMips() onlyDevnet broadcast() public returns (address) {
MIPS mips = new MIPS();
MIPS mips = new MIPS(
IPreimageOracle(mustGetAddress("PreimageOracle"))
);
save("Mips", address(mips));
save("Mips", address(mips));
console.log("MIPS deployed at %s", address(mips));
console.log("MIPS deployed at %s", address(mips));
...
...
packages/contracts-bedrock/src/cannon/MIPS.sol
View file @
ada137b0
...
@@ -53,9 +53,14 @@ contract MIPS {
...
@@ -53,9 +53,14 @@ contract MIPS {
uint32 constant EBADF = 0x9;
uint32 constant EBADF = 0x9;
uint32 constant EINVAL = 0x16;
uint32 constant EINVAL = 0x16;
/// @notice The pre
-image oracle
.
/// @notice The pre
image oracle contract
.
IPreimageOracle public oracle;
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).
/// @notice Extends the value leftwards with its most significant bit (sign extension).
function SE(uint32 _dat, uint32 _idx) internal pure returns (uint32) {
function SE(uint32 _dat, uint32 _idx) internal pure returns (uint32) {
unchecked {
unchecked {
...
...
packages/contracts-bedrock/test/MIPS.t.sol
View file @
ada137b0
...
@@ -11,7 +11,7 @@ contract MIPS_Test is Test {
...
@@ -11,7 +11,7 @@ contract MIPS_Test is Test {
function setUp() public {
function setUp() public {
oracle = new PreimageOracle();
oracle = new PreimageOracle();
mips = new MIPS();
mips = new MIPS(
oracle
);
vm.store(address(mips), 0x0, bytes32(abi.encode(address(oracle))));
vm.store(address(mips), 0x0, bytes32(abi.encode(address(oracle))));
vm.label(address(oracle), "PreimageOracle");
vm.label(address(oracle), "PreimageOracle");
vm.label(address(mips), "MIPS");
vm.label(address(mips), "MIPS");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment