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
d48b4595
Unverified
Commit
d48b4595
authored
Jan 30, 2024
by
Adrian Sutton
Committed by
GitHub
Jan 30, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-e2e: Remove unused L2OOHelper (#9247)
parent
c0219d93
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
133 deletions
+0
-133
helper.go
op-e2e/e2eutils/disputegame/helper.go
+0
-3
helper.go
op-e2e/e2eutils/l2oo/helper.go
+0
-130
No files found.
op-e2e/e2eutils/disputegame/helper.go
View file @
d48b4595
...
@@ -15,7 +15,6 @@ import (
...
@@ -15,7 +15,6 @@ import (
faultTypes
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/types"
faultTypes
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/types"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/challenger"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/challenger"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/geth"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/geth"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/l2oo"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/transactions"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/transactions"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/wait"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/wait"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
...
@@ -76,7 +75,6 @@ type FactoryHelper struct {
...
@@ -76,7 +75,6 @@ type FactoryHelper struct {
opts
*
bind
.
TransactOpts
opts
*
bind
.
TransactOpts
factoryAddr
common
.
Address
factoryAddr
common
.
Address
factory
*
bindings
.
DisputeGameFactory
factory
*
bindings
.
DisputeGameFactory
l2ooHelper
*
l2oo
.
L2OOHelper
}
}
func
NewFactoryHelper
(
t
*
testing
.
T
,
ctx
context
.
Context
,
system
DisputeSystem
)
*
FactoryHelper
{
func
NewFactoryHelper
(
t
*
testing
.
T
,
ctx
context
.
Context
,
system
DisputeSystem
)
*
FactoryHelper
{
...
@@ -100,7 +98,6 @@ func NewFactoryHelper(t *testing.T, ctx context.Context, system DisputeSystem) *
...
@@ -100,7 +98,6 @@ func NewFactoryHelper(t *testing.T, ctx context.Context, system DisputeSystem) *
opts
:
opts
,
opts
:
opts
,
factory
:
factory
,
factory
:
factory
,
factoryAddr
:
factoryAddr
,
factoryAddr
:
factoryAddr
,
l2ooHelper
:
l2oo
.
NewL2OOHelperReadOnly
(
t
,
l1Deployments
,
client
),
}
}
}
}
...
...
op-e2e/e2eutils/l2oo/helper.go
deleted
100644 → 0
View file @
c0219d93
package
l2oo
import
(
"context"
"crypto/ecdsa"
"math/big"
"testing"
"time"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/wait"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/stretchr/testify/require"
)
type
L2OOHelper
struct
{
t
*
testing
.
T
require
*
require
.
Assertions
client
*
ethclient
.
Client
l2oo
*
bindings
.
L2OutputOracle
// Nil when read-only
transactOpts
*
bind
.
TransactOpts
rollupCfg
*
rollup
.
Config
}
func
NewL2OOHelperReadOnly
(
t
*
testing
.
T
,
deployments
*
genesis
.
L1Deployments
,
client
*
ethclient
.
Client
)
*
L2OOHelper
{
require
:=
require
.
New
(
t
)
l2oo
,
err
:=
bindings
.
NewL2OutputOracle
(
deployments
.
L2OutputOracleProxy
,
client
)
require
.
NoError
(
err
,
"Error creating l2oo bindings"
)
return
&
L2OOHelper
{
t
:
t
,
require
:
require
,
client
:
client
,
l2oo
:
l2oo
,
}
}
func
NewL2OOHelper
(
t
*
testing
.
T
,
deployments
*
genesis
.
L1Deployments
,
client
*
ethclient
.
Client
,
proposerKey
*
ecdsa
.
PrivateKey
,
rollupCfg
*
rollup
.
Config
)
*
L2OOHelper
{
h
:=
NewL2OOHelperReadOnly
(
t
,
deployments
,
client
)
chainID
,
err
:=
client
.
ChainID
(
context
.
Background
())
h
.
require
.
NoError
(
err
,
"Failed to get chain ID"
)
transactOpts
,
err
:=
bind
.
NewKeyedTransactorWithChainID
(
proposerKey
,
chainID
)
h
.
require
.
NoError
(
err
)
h
.
transactOpts
=
transactOpts
h
.
rollupCfg
=
rollupCfg
return
h
}
// WaitForProposals waits until there are at least the specified number of proposals in the output oracle
// Returns the index of the latest output proposal
func
(
h
*
L2OOHelper
)
WaitForProposals
(
ctx
context
.
Context
,
req
int64
)
uint64
{
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
2
*
time
.
Minute
)
defer
cancel
()
opts
:=
&
bind
.
CallOpts
{
Context
:
ctx
}
latestOutputIndex
,
err
:=
wait
.
AndGet
(
ctx
,
time
.
Second
,
func
()
(
*
big
.
Int
,
error
)
{
index
,
err
:=
h
.
l2oo
.
LatestOutputIndex
(
opts
)
if
err
!=
nil
{
h
.
t
.
Logf
(
"Could not get latest output index: %v"
,
err
.
Error
())
return
nil
,
nil
}
h
.
t
.
Logf
(
"Latest output index: %v"
,
index
)
return
index
,
nil
},
func
(
index
*
big
.
Int
)
bool
{
return
index
!=
nil
&&
index
.
Cmp
(
big
.
NewInt
(
req
-
1
))
>=
0
})
h
.
require
.
NoErrorf
(
err
,
"Did not get %v output roots"
,
req
)
return
latestOutputIndex
.
Uint64
()
}
func
(
h
*
L2OOHelper
)
GetL2Output
(
ctx
context
.
Context
,
idx
uint64
)
bindings
.
TypesOutputProposal
{
output
,
err
:=
h
.
l2oo
.
GetL2Output
(
&
bind
.
CallOpts
{
Context
:
ctx
},
new
(
big
.
Int
)
.
SetUint64
(
idx
))
h
.
require
.
NoErrorf
(
err
,
"Failed to get output root at index: %v"
,
idx
)
return
output
}
func
(
h
*
L2OOHelper
)
GetL2OutputAfter
(
ctx
context
.
Context
,
l2BlockNum
uint64
)
bindings
.
TypesOutputProposal
{
opts
:=
&
bind
.
CallOpts
{
Context
:
ctx
}
outputIdx
,
err
:=
h
.
l2oo
.
GetL2OutputIndexAfter
(
opts
,
new
(
big
.
Int
)
.
SetUint64
(
l2BlockNum
))
h
.
require
.
NoError
(
err
,
"Fetch challenged output index"
)
output
,
err
:=
h
.
l2oo
.
GetL2Output
(
opts
,
outputIdx
)
h
.
require
.
NoError
(
err
,
"Fetch challenged output"
)
return
output
}
func
(
h
*
L2OOHelper
)
GetL2OutputBefore
(
ctx
context
.
Context
,
l2BlockNum
uint64
)
bindings
.
TypesOutputProposal
{
opts
:=
&
bind
.
CallOpts
{
Context
:
ctx
}
latestBlockNum
,
err
:=
h
.
l2oo
.
LatestBlockNumber
(
opts
)
h
.
require
.
NoError
(
err
,
"Failed to get latest output root block number"
)
var
outputIdx
*
big
.
Int
if
latestBlockNum
.
Uint64
()
<
l2BlockNum
{
outputIdx
,
err
=
h
.
l2oo
.
LatestOutputIndex
(
opts
)
h
.
require
.
NoError
(
err
,
"Failed to get latest output index"
)
}
else
{
outputIdx
,
err
=
h
.
l2oo
.
GetL2OutputIndexAfter
(
opts
,
new
(
big
.
Int
)
.
SetUint64
(
l2BlockNum
))
h
.
require
.
NoErrorf
(
err
,
"Failed to get output index after block %v"
,
l2BlockNum
)
h
.
require
.
NotZerof
(
outputIdx
.
Uint64
(),
"No l2 output before block %v"
,
l2BlockNum
)
outputIdx
=
new
(
big
.
Int
)
.
Sub
(
outputIdx
,
common
.
Big1
)
}
return
h
.
GetL2Output
(
ctx
,
outputIdx
.
Uint64
())
}
func
(
h
*
L2OOHelper
)
PublishNextOutput
(
ctx
context
.
Context
,
outputRoot
common
.
Hash
)
{
h
.
require
.
NotNil
(
h
.
transactOpts
,
"Can't publish outputs from a read only L2OOHelper"
)
nextBlockNum
,
err
:=
h
.
l2oo
.
NextBlockNumber
(
&
bind
.
CallOpts
{
Context
:
ctx
})
h
.
require
.
NoError
(
err
,
"Should get next block number"
)
genesis
:=
h
.
rollupCfg
.
Genesis
targetTimestamp
:=
genesis
.
L2Time
+
((
nextBlockNum
.
Uint64
()
-
genesis
.
L2
.
Number
)
*
h
.
rollupCfg
.
BlockTime
)
timedCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
30
*
time
.
Second
)
defer
cancel
()
h
.
require
.
NoErrorf
(
wait
.
ForBlockWithTimestamp
(
timedCtx
,
h
.
client
,
targetTimestamp
),
"Wait for L1 block with timestamp >= %v"
,
targetTimestamp
)
tx
,
err
:=
h
.
l2oo
.
ProposeL2Output
(
h
.
transactOpts
,
outputRoot
,
nextBlockNum
,
[
32
]
byte
{},
common
.
Big0
)
h
.
require
.
NoErrorf
(
err
,
"Failed to propose output root for l2 block number %v"
,
nextBlockNum
)
_
,
err
=
wait
.
ForReceiptOK
(
ctx
,
h
.
client
,
tx
.
Hash
())
h
.
require
.
NoErrorf
(
err
,
"Proposal for l2 block %v failed"
,
nextBlockNum
)
}
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