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
6062bb6c
Commit
6062bb6c
authored
Nov 22, 2023
by
EvanJRichard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Squash full eip4844-e2e-history into a single commit.
parent
eef315e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
2 deletions
+96
-2
fakepos.go
op-e2e/e2eutils/geth/fakepos.go
+2
-2
blobs.go
op-e2e/e2eutils/transactions/blobs.go
+42
-0
system_test.go
op-e2e/system_test.go
+52
-0
No files found.
op-e2e/e2eutils/geth/fakepos.go
View file @
6062bb6c
...
...
@@ -138,7 +138,7 @@ func (f *fakePoS) Start() error {
tim
.
Stop
()
return
nil
}
envelope
,
err
:=
f
.
engineAPI
.
GetPayloadV
2
(
*
res
.
PayloadID
)
envelope
,
err
:=
f
.
engineAPI
.
GetPayloadV
3
(
*
res
.
PayloadID
)
if
err
!=
nil
{
f
.
log
.
Error
(
"failed to finish building L1 block"
,
"err"
,
err
)
continue
...
...
@@ -178,7 +178,7 @@ func (f *fakePoS) Start() error {
continue
}
}
if
_
,
err
:=
f
.
engineAPI
.
ForkchoiceUpdatedV
2
(
engine
.
ForkchoiceStateV1
{
if
_
,
err
:=
f
.
engineAPI
.
ForkchoiceUpdatedV
3
(
engine
.
ForkchoiceStateV1
{
HeadBlockHash
:
envelope
.
ExecutionPayload
.
BlockHash
,
SafeBlockHash
:
safe
.
Hash
(),
FinalizedBlockHash
:
finalized
.
Hash
(),
...
...
op-e2e/e2eutils/transactions/blobs.go
0 → 100644
View file @
6062bb6c
package
transactions
import
(
"crypto/ecdsa"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto/kzg4844"
"github.com/holiman/uint256"
)
var
(
emptyBlob
=
kzg4844
.
Blob
{}
emptyBlobCommit
,
_
=
kzg4844
.
BlobToCommitment
(
emptyBlob
)
emptyBlobProof
,
_
=
kzg4844
.
ComputeBlobProof
(
emptyBlob
,
emptyBlobCommit
)
)
// with thanks to fjl
// https://github.com/ethereum/go-ethereum/commit/2a6beb6a39d7cb3c5906dd4465d65da6efcc73cd
func
CreateEmptyBlobTx
(
key
*
ecdsa
.
PrivateKey
,
withSidecar
bool
,
chainID
uint64
)
*
types
.
BlobTx
{
sidecar
:=
&
types
.
BlobTxSidecar
{
Blobs
:
[]
kzg4844
.
Blob
{
emptyBlob
},
Commitments
:
[]
kzg4844
.
Commitment
{
emptyBlobCommit
},
Proofs
:
[]
kzg4844
.
Proof
{
emptyBlobProof
},
}
blobTx
:=
&
types
.
BlobTx
{
ChainID
:
uint256
.
NewInt
(
chainID
),
Nonce
:
0
,
GasTipCap
:
uint256
.
NewInt
(
2200000000000
),
GasFeeCap
:
uint256
.
NewInt
(
5000000000000
),
Gas
:
25000
,
To
:
common
.
Address
{
0x03
,
0x04
,
0x05
},
Value
:
uint256
.
NewInt
(
99
),
Data
:
make
([]
byte
,
50
),
BlobFeeCap
:
uint256
.
NewInt
(
150000000000
),
BlobHashes
:
sidecar
.
BlobHashes
(),
}
if
withSidecar
{
blobTx
.
Sidecar
=
sidecar
}
return
blobTx
}
op-e2e/system_test.go
View file @
6062bb6c
...
...
@@ -31,6 +31,8 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-e2e/config"
gethutils
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/geth"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/transactions"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/wait"
"github.com/ethereum-optimism/optimism/op-node/metrics"
rollupNode
"github.com/ethereum-optimism/optimism/op-node/node"
...
...
@@ -171,6 +173,56 @@ func TestSystemE2EDencunAtGenesis(t *testing.T) {
require
.
NotNil
(
t
,
head
.
ExcessBlobGas
(),
"L1 is building dencun blocks since genesis"
)
}
// TestSystemE2EDencunAtGenesis tests if L2 finalizes when blobs are present on L1
func
TestSystemE2EDencunAtGenesisWithBlobs
(
t
*
testing
.
T
)
{
InitParallel
(
t
)
cfg
:=
DefaultSystemConfig
(
t
)
//cancun is on from genesis:
genesisActivation
:=
uint64
(
0
)
cfg
.
DeployConfig
.
L1CancunTimeOffset
=
&
genesisActivation
// i.e. turn cancun on at genesis time + 0
sys
,
err
:=
cfg
.
Start
(
t
)
require
.
Nil
(
t
,
err
,
"Error starting up system"
)
defer
sys
.
Close
()
// send a blob-containing txn on l1
ethPrivKey
:=
sys
.
cfg
.
Secrets
.
Alice
txData
:=
transactions
.
CreateEmptyBlobTx
(
ethPrivKey
,
true
,
sys
.
cfg
.
L1ChainIDBig
()
.
Uint64
())
tx
:=
types
.
MustSignNewTx
(
ethPrivKey
,
types
.
LatestSignerForChainID
(
cfg
.
L1ChainIDBig
()),
txData
)
// send blob-containing txn
sendCtx
,
sendCancel
:=
context
.
WithTimeout
(
context
.
Background
(),
15
*
time
.
Second
)
defer
sendCancel
()
l1Client
:=
sys
.
Clients
[
"l1"
]
err
=
l1Client
.
SendTransaction
(
sendCtx
,
tx
)
require
.
NoError
(
t
,
err
,
"Sending L1 empty blob tx"
)
// Wait for transaction on L1
_
,
err
=
geth
.
WaitForTransaction
(
tx
.
Hash
(),
l1Client
,
30
*
time
.
Duration
(
cfg
.
DeployConfig
.
L1BlockTime
)
*
time
.
Second
)
require
.
Nil
(
t
,
err
,
"Waiting for blob tx on L1"
)
// end sending blob-contraining txns on l1
l2Seq
:=
sys
.
Clients
[
"sequencer"
]
head
,
err
:=
l1Client
.
BlockByNumber
(
context
.
Background
(),
big
.
NewInt
(
0
))
require
.
Nil
(
t
,
err
,
"Getting current head on L1"
)
// Wait enough time for L1 to finalize and L2 to confirm its data in finalized L1 blocks: about 14 blocks
const
finalizedDistance
=
14
finalizedBlockNumber
:=
head
.
NumberU64
()
+
finalizedDistance
finalizedBlockBigInt
:=
new
(
big
.
Int
)
.
SetUint64
(
finalizedBlockNumber
)
finalizationTimeout
:=
30
*
time
.
Duration
(
cfg
.
DeployConfig
.
L1BlockTime
)
*
time
.
Second
_
,
err
=
gethutils
.
WaitForBlockToBeFinalized
(
finalizedBlockBigInt
,
l1Client
,
finalizationTimeout
)
require
.
Nil
(
t
,
err
,
"Waiting for finalized L1 block"
)
// fetch the finalized head of geth
finalizeCtx
,
finalizeCancel
:=
context
.
WithTimeout
(
context
.
Background
(),
1
*
time
.
Second
)
defer
finalizeCancel
()
l2Finalized
,
err
:=
l2Seq
.
BlockByNumber
(
finalizeCtx
,
big
.
NewInt
(
int64
(
rpc
.
FinalizedBlockNumber
)))
require
.
NoError
(
t
,
err
)
require
.
NotZerof
(
t
,
l2Finalized
.
NumberU64
(),
"must have finalized L2 block"
)
}
// TestSystemE2E sets up a L1 Geth node, a rollup node, and a L2 geth node and then confirms that L1 deposits are reflected on L2.
// All nodes are run in process (but are the full nodes, not mocked or stubbed).
func
TestSystemE2E
(
t
*
testing
.
T
)
{
...
...
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