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
3891726b
Unverified
Commit
3891726b
authored
Jul 25, 2023
by
OptimismBot
Committed by
GitHub
Jul 25, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6431 from ethereum-optimism/op-e2e/shanghai-l1
op-e2e: enable shanghai on L1
parents
4ca169c0
807f237d
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
63 deletions
+34
-63
deployer.go
op-chain-ops/deployer/deployer.go
+19
-3
genesis.go
op-chain-ops/genesis/genesis.go
+5
-0
layer_one.go
op-chain-ops/genesis/layer_one.go
+2
-1
immutables.go
op-chain-ops/immutables/immutables.go
+1
-1
fork_test.go
op-e2e/actions/fork_test.go
+0
-53
fakepos.go
op-e2e/fakepos.go
+7
-5
No files found.
op-chain-ops/deployer/deployer.go
View file @
3891726b
...
@@ -40,11 +40,19 @@ type Deployment struct {
...
@@ -40,11 +40,19 @@ type Deployment struct {
type
Deployer
func
(
*
backends
.
SimulatedBackend
,
*
bind
.
TransactOpts
,
Constructor
)
(
*
types
.
Transaction
,
error
)
type
Deployer
func
(
*
backends
.
SimulatedBackend
,
*
bind
.
TransactOpts
,
Constructor
)
(
*
types
.
Transaction
,
error
)
func
NewBackend
()
*
backends
.
SimulatedBackend
{
// NewL1Backend returns a SimulatedBackend suitable for L1. It has
return
NewBackendWithGenesisTimestamp
(
0
)
// the latest L1 hardforks enabled.
func
NewL1Backend
()
*
backends
.
SimulatedBackend
{
return
NewBackendWithGenesisTimestamp
(
0
,
true
)
}
}
func
NewBackendWithGenesisTimestamp
(
ts
uint64
)
*
backends
.
SimulatedBackend
{
// NewL2Backend returns a SimulatedBackend suitable for L2.
// It has the latest L2 hardforks enabled.
func
NewL2Backend
()
*
backends
.
SimulatedBackend
{
return
NewBackendWithGenesisTimestamp
(
0
,
false
)
}
func
NewBackendWithGenesisTimestamp
(
ts
uint64
,
shanghai
bool
)
*
backends
.
SimulatedBackend
{
chainConfig
:=
params
.
ChainConfig
{
chainConfig
:=
params
.
ChainConfig
{
ChainID
:
ChainID
,
ChainID
:
ChainID
,
HomesteadBlock
:
big
.
NewInt
(
0
),
HomesteadBlock
:
big
.
NewInt
(
0
),
...
@@ -70,6 +78,10 @@ func NewBackendWithGenesisTimestamp(ts uint64) *backends.SimulatedBackend {
...
@@ -70,6 +78,10 @@ func NewBackendWithGenesisTimestamp(ts uint64) *backends.SimulatedBackend {
TerminalTotalDifficultyPassed
:
true
,
TerminalTotalDifficultyPassed
:
true
,
}
}
if
shanghai
{
chainConfig
.
ShanghaiTime
=
u64ptr
(
0
)
}
return
backends
.
NewSimulatedBackendWithOpts
(
return
backends
.
NewSimulatedBackendWithOpts
(
backends
.
WithCacheConfig
(
&
core
.
CacheConfig
{
backends
.
WithCacheConfig
(
&
core
.
CacheConfig
{
Preimages
:
true
,
Preimages
:
true
,
...
@@ -132,3 +144,7 @@ func Deploy(backend *backends.SimulatedBackend, constructors []Constructor, cb D
...
@@ -132,3 +144,7 @@ func Deploy(backend *backends.SimulatedBackend, constructors []Constructor, cb D
return
results
,
nil
return
results
,
nil
}
}
func
u64ptr
(
n
uint64
)
*
uint64
{
return
&
n
}
op-chain-ops/genesis/genesis.go
View file @
3891726b
...
@@ -127,6 +127,7 @@ func NewL1Genesis(config *DeployConfig) (*core.Genesis, error) {
...
@@ -127,6 +127,7 @@ func NewL1Genesis(config *DeployConfig) (*core.Genesis, error) {
LondonBlock
:
big
.
NewInt
(
0
),
LondonBlock
:
big
.
NewInt
(
0
),
ArrowGlacierBlock
:
big
.
NewInt
(
0
),
ArrowGlacierBlock
:
big
.
NewInt
(
0
),
GrayGlacierBlock
:
big
.
NewInt
(
0
),
GrayGlacierBlock
:
big
.
NewInt
(
0
),
ShanghaiTime
:
u64ptr
(
0
),
}
}
if
config
.
CliqueSignerAddress
!=
(
common
.
Address
{})
{
if
config
.
CliqueSignerAddress
!=
(
common
.
Address
{})
{
...
@@ -180,3 +181,7 @@ func NewL1Genesis(config *DeployConfig) (*core.Genesis, error) {
...
@@ -180,3 +181,7 @@ func NewL1Genesis(config *DeployConfig) (*core.Genesis, error) {
Alloc
:
map
[
common
.
Address
]
core
.
GenesisAccount
{},
Alloc
:
map
[
common
.
Address
]
core
.
GenesisAccount
{},
},
nil
},
nil
}
}
func
u64ptr
(
n
uint64
)
*
uint64
{
return
&
n
}
op-chain-ops/genesis/layer_one.go
View file @
3891726b
...
@@ -76,7 +76,8 @@ func BuildL1DeveloperGenesis(config *DeployConfig) (*core.Genesis, error) {
...
@@ -76,7 +76,8 @@ func BuildL1DeveloperGenesis(config *DeployConfig) (*core.Genesis, error) {
return
nil
,
err
return
nil
,
err
}
}
backend
:=
deployer
.
NewBackendWithGenesisTimestamp
(
uint64
(
config
.
L1GenesisBlockTimestamp
))
// Enable shanghai
backend
:=
deployer
.
NewBackendWithGenesisTimestamp
(
uint64
(
config
.
L1GenesisBlockTimestamp
),
true
)
deployments
,
err
:=
deployL1Contracts
(
config
,
backend
)
deployments
,
err
:=
deployL1Contracts
(
config
,
backend
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
op-chain-ops/immutables/immutables.go
View file @
3891726b
...
@@ -158,7 +158,7 @@ func BuildOptimism(immutable ImmutableConfig) (DeploymentResults, error) {
...
@@ -158,7 +158,7 @@ func BuildOptimism(immutable ImmutableConfig) (DeploymentResults, error) {
// can be properly set. The bytecode returned in the results is suitable to be
// can be properly set. The bytecode returned in the results is suitable to be
// inserted into the state via state surgery.
// inserted into the state via state surgery.
func
BuildL2
(
constructors
[]
deployer
.
Constructor
)
(
DeploymentResults
,
error
)
{
func
BuildL2
(
constructors
[]
deployer
.
Constructor
)
(
DeploymentResults
,
error
)
{
deployments
,
err
:=
deployer
.
Deploy
(
deployer
.
NewBackend
(),
constructors
,
l2Deployer
)
deployments
,
err
:=
deployer
.
Deploy
(
deployer
.
New
L2
Backend
(),
constructors
,
l2Deployer
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
op-e2e/actions/fork_test.go
deleted
100644 → 0
View file @
4ca169c0
package
actions
import
(
"testing"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-node/testlog"
)
func
TestShapellaL1Fork
(
gt
*
testing
.
T
)
{
t
:=
NewDefaultTesting
(
gt
)
dp
:=
e2eutils
.
MakeDeployParams
(
t
,
defaultRollupTestParams
)
sd
:=
e2eutils
.
Setup
(
t
,
dp
,
defaultAlloc
)
activation
:=
sd
.
L1Cfg
.
Timestamp
+
24
sd
.
L1Cfg
.
Config
.
ShanghaiTime
=
&
activation
log
:=
testlog
.
Logger
(
t
,
log
.
LvlDebug
)
_
,
_
,
miner
,
sequencer
,
_
,
verifier
,
_
,
batcher
:=
setupReorgTestActors
(
t
,
dp
,
sd
,
log
)
require
.
False
(
t
,
sd
.
L1Cfg
.
Config
.
IsShanghai
(
miner
.
l1Chain
.
CurrentBlock
()
.
Time
),
"not active yet"
)
// start op-nodes
sequencer
.
ActL2PipelineFull
(
t
)
verifier
.
ActL2PipelineFull
(
t
)
// build empty L1 blocks, crossing the fork boundary
miner
.
ActEmptyBlock
(
t
)
miner
.
ActEmptyBlock
(
t
)
miner
.
ActEmptyBlock
(
t
)
// verify Shanghai is active
l1Head
:=
miner
.
l1Chain
.
CurrentBlock
()
require
.
True
(
t
,
sd
.
L1Cfg
.
Config
.
IsShanghai
(
l1Head
.
Time
))
// build L2 chain up to and including L2 blocks referencing shanghai L1 blocks
sequencer
.
ActL1HeadSignal
(
t
)
sequencer
.
ActBuildToL1Head
(
t
)
miner
.
ActL1StartBlock
(
12
)(
t
)
batcher
.
ActSubmitAll
(
t
)
miner
.
ActL1IncludeTx
(
batcher
.
batcherAddr
)(
t
)
miner
.
ActL1EndBlock
(
t
)
// sync verifier
verifier
.
ActL1HeadSignal
(
t
)
verifier
.
ActL2PipelineFull
(
t
)
// verify verifier accepted shanghai L1 inputs
require
.
Equal
(
t
,
l1Head
.
Hash
(),
verifier
.
SyncStatus
()
.
SafeL2
.
L1Origin
.
Hash
,
"verifier synced L1 chain that includes shanghai headers"
)
require
.
Equal
(
t
,
sequencer
.
SyncStatus
()
.
UnsafeL2
,
verifier
.
SyncStatus
()
.
UnsafeL2
,
"verifier and sequencer agree"
)
}
op-e2e/fakepos.go
View file @
3891726b
...
@@ -7,6 +7,7 @@ import (
...
@@ -7,6 +7,7 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/beacon/engine"
"github.com/ethereum/go-ethereum/beacon/engine"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth/catalyst"
"github.com/ethereum/go-ethereum/eth/catalyst"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/event"
...
@@ -63,7 +64,7 @@ func (f *fakePoS) Start() error {
...
@@ -63,7 +64,7 @@ func (f *fakePoS) Start() error {
// We're a long way behind, let's skip some blocks...
// We're a long way behind, let's skip some blocks...
newBlockTime
=
uint64
(
f
.
clock
.
Now
()
.
Unix
())
newBlockTime
=
uint64
(
f
.
clock
.
Now
()
.
Unix
())
}
}
res
,
err
:=
f
.
engineAPI
.
ForkchoiceUpdatedV
1
(
engine
.
ForkchoiceStateV1
{
res
,
err
:=
f
.
engineAPI
.
ForkchoiceUpdatedV
2
(
engine
.
ForkchoiceStateV1
{
HeadBlockHash
:
head
.
Hash
(),
HeadBlockHash
:
head
.
Hash
(),
SafeBlockHash
:
safe
.
Hash
(),
SafeBlockHash
:
safe
.
Hash
(),
FinalizedBlockHash
:
finalized
.
Hash
(),
FinalizedBlockHash
:
finalized
.
Hash
(),
...
@@ -71,6 +72,7 @@ func (f *fakePoS) Start() error {
...
@@ -71,6 +72,7 @@ func (f *fakePoS) Start() error {
Timestamp
:
newBlockTime
,
Timestamp
:
newBlockTime
,
Random
:
common
.
Hash
{},
Random
:
common
.
Hash
{},
SuggestedFeeRecipient
:
head
.
Coinbase
,
SuggestedFeeRecipient
:
head
.
Coinbase
,
Withdrawals
:
make
([]
*
types
.
Withdrawal
,
0
),
})
})
if
err
!=
nil
{
if
err
!=
nil
{
f
.
log
.
Error
(
"failed to start building L1 block"
,
"err"
,
err
)
f
.
log
.
Error
(
"failed to start building L1 block"
,
"err"
,
err
)
...
@@ -90,17 +92,17 @@ func (f *fakePoS) Start() error {
...
@@ -90,17 +92,17 @@ func (f *fakePoS) Start() error {
tim
.
Stop
()
tim
.
Stop
()
return
nil
return
nil
}
}
payload
,
err
:=
f
.
engineAPI
.
GetPayloadV1
(
*
res
.
PayloadID
)
envelope
,
err
:=
f
.
engineAPI
.
GetPayloadV2
(
*
res
.
PayloadID
)
if
err
!=
nil
{
if
err
!=
nil
{
f
.
log
.
Error
(
"failed to finish building L1 block"
,
"err"
,
err
)
f
.
log
.
Error
(
"failed to finish building L1 block"
,
"err"
,
err
)
continue
continue
}
}
if
_
,
err
:=
f
.
engineAPI
.
NewPayloadV
1
(
*
p
ayload
);
err
!=
nil
{
if
_
,
err
:=
f
.
engineAPI
.
NewPayloadV
2
(
*
envelope
.
ExecutionP
ayload
);
err
!=
nil
{
f
.
log
.
Error
(
"failed to insert built L1 block"
,
"err"
,
err
)
f
.
log
.
Error
(
"failed to insert built L1 block"
,
"err"
,
err
)
continue
continue
}
}
if
_
,
err
:=
f
.
engineAPI
.
ForkchoiceUpdatedV
1
(
engine
.
ForkchoiceStateV1
{
if
_
,
err
:=
f
.
engineAPI
.
ForkchoiceUpdatedV
2
(
engine
.
ForkchoiceStateV1
{
HeadBlockHash
:
p
ayload
.
BlockHash
,
HeadBlockHash
:
envelope
.
ExecutionP
ayload
.
BlockHash
,
SafeBlockHash
:
safe
.
Hash
(),
SafeBlockHash
:
safe
.
Hash
(),
FinalizedBlockHash
:
finalized
.
Hash
(),
FinalizedBlockHash
:
finalized
.
Hash
(),
},
nil
);
err
!=
nil
{
},
nil
);
err
!=
nil
{
...
...
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