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
409fbfe5
Commit
409fbfe5
authored
Mar 10, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stash system test peer scoring changes for merge
parent
40fc43c6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
27 deletions
+27
-27
system_test.go
op-e2e/system_test.go
+27
-27
No files found.
op-e2e/system_test.go
View file @
409fbfe5
...
@@ -684,23 +684,23 @@ func TestSystemMockPeerScoring(t *testing.T) {
...
@@ -684,23 +684,23 @@ func TestSystemMockPeerScoring(t *testing.T) {
// Construct a new sequencer with an invalid privkey to produce invalid gossip
// Construct a new sequencer with an invalid privkey to produce invalid gossip
// We can then test that the peer scoring system will ban the node
// We can then test that the peer scoring system will ban the node
//
sequencer2PrivateKey := cfg.Secrets.Mallory
sequencer2PrivateKey
:=
cfg
.
Secrets
.
Mallory
//
cfg.Nodes["sequencer2"] = &rollupNode.Config{
cfg
.
Nodes
[
"sequencer2"
]
=
&
rollupNode
.
Config
{
//
Driver: driver.Config{
Driver
:
driver
.
Config
{
//
VerifierConfDepth: 0,
VerifierConfDepth
:
0
,
//
SequencerConfDepth: 0,
SequencerConfDepth
:
0
,
//
SequencerEnabled: true,
SequencerEnabled
:
true
,
//
},
},
//
// Submitter PrivKey is set in system start for rollup nodes where sequencer = true
// Submitter PrivKey is set in system start for rollup nodes where sequencer = true
//
RPC: rollupNode.RPCConfig{
RPC
:
rollupNode
.
RPCConfig
{
//
ListenAddr: "127.0.0.1",
ListenAddr
:
"127.0.0.1"
,
//
ListenPort: 0,
ListenPort
:
0
,
//
EnableAdmin: true,
EnableAdmin
:
true
,
//
},
},
//
L1EpochPollInterval: time.Second * 4,
L1EpochPollInterval
:
time
.
Second
*
4
,
//
P2PSigner: &p2p.PreparedSigner{Signer: p2p.NewLocalSigner(sequencer2PrivateKey)},
P2PSigner
:
&
p2p
.
PreparedSigner
{
Signer
:
p2p
.
NewLocalSigner
(
sequencer2PrivateKey
)},
//
}
}
//
cfg.Loggers["sequencer2"] = testlog.Logger(t, log.LvlInfo).New("role", "sequencer")
cfg
.
Loggers
[
"sequencer2"
]
=
testlog
.
Logger
(
t
,
log
.
LvlInfo
)
.
New
(
"role"
,
"sequencer"
)
// connect the nodes
// connect the nodes
cfg
.
P2PTopology
=
map
[
string
][]
string
{
cfg
.
P2PTopology
=
map
[
string
][]
string
{
...
@@ -719,15 +719,15 @@ func TestSystemMockPeerScoring(t *testing.T) {
...
@@ -719,15 +719,15 @@ func TestSystemMockPeerScoring(t *testing.T) {
}
}
}
}
var
published
,
received1
,
received2
,
received3
[]
common
.
Hash
var
published
,
published2
,
received1
,
received2
,
received3
[]
common
.
Hash
seqTracer
,
verifTracer
,
verifTracer2
,
verifTracer3
:=
new
(
FnTracer
),
new
(
FnTracer
),
new
(
FnTracer
),
new
(
FnTracer
)
seqTracer
,
verifTracer
,
verifTracer2
,
verifTracer3
:=
new
(
FnTracer
),
new
(
FnTracer
),
new
(
FnTracer
),
new
(
FnTracer
)
//
seq2Tracer := new(FnTracer)
seq2Tracer
:=
new
(
FnTracer
)
seqTracer
.
OnPublishL2PayloadFn
=
func
(
ctx
context
.
Context
,
payload
*
eth
.
ExecutionPayload
)
{
seqTracer
.
OnPublishL2PayloadFn
=
func
(
ctx
context
.
Context
,
payload
*
eth
.
ExecutionPayload
)
{
published
=
append
(
published
,
payload
.
BlockHash
)
published
=
append
(
published
,
payload
.
BlockHash
)
}
}
//
seq2Tracer.OnPublishL2PayloadFn = func(ctx context.Context, payload *eth.ExecutionPayload) {
seq2Tracer
.
OnPublishL2PayloadFn
=
func
(
ctx
context
.
Context
,
payload
*
eth
.
ExecutionPayload
)
{
//
published2 = append(published2, payload.BlockHash)
published2
=
append
(
published2
,
payload
.
BlockHash
)
//
}
}
verifTracer
.
OnUnsafeL2PayloadFn
=
func
(
ctx
context
.
Context
,
from
peer
.
ID
,
payload
*
eth
.
ExecutionPayload
)
{
verifTracer
.
OnUnsafeL2PayloadFn
=
func
(
ctx
context
.
Context
,
from
peer
.
ID
,
payload
*
eth
.
ExecutionPayload
)
{
received1
=
append
(
received1
,
payload
.
BlockHash
)
received1
=
append
(
received1
,
payload
.
BlockHash
)
}
}
...
@@ -738,7 +738,7 @@ func TestSystemMockPeerScoring(t *testing.T) {
...
@@ -738,7 +738,7 @@ func TestSystemMockPeerScoring(t *testing.T) {
received3
=
append
(
received3
,
payload
.
BlockHash
)
received3
=
append
(
received3
,
payload
.
BlockHash
)
}
}
cfg
.
Nodes
[
"sequencer"
]
.
Tracer
=
seqTracer
cfg
.
Nodes
[
"sequencer"
]
.
Tracer
=
seqTracer
//
cfg.Nodes["sequencer2"].Tracer = seq2Tracer
cfg
.
Nodes
[
"sequencer2"
]
.
Tracer
=
seq2Tracer
cfg
.
Nodes
[
"verifier"
]
.
Tracer
=
verifTracer
cfg
.
Nodes
[
"verifier"
]
.
Tracer
=
verifTracer
cfg
.
Nodes
[
"verifier2"
]
.
Tracer
=
verifTracer2
cfg
.
Nodes
[
"verifier2"
]
.
Tracer
=
verifTracer2
cfg
.
Nodes
[
"verifier3"
]
.
Tracer
=
verifTracer3
cfg
.
Nodes
[
"verifier3"
]
.
Tracer
=
verifTracer3
...
@@ -760,7 +760,7 @@ func TestSystemMockPeerScoring(t *testing.T) {
...
@@ -760,7 +760,7 @@ func TestSystemMockPeerScoring(t *testing.T) {
toAddr
:=
common
.
Address
{
0xff
,
0xff
}
toAddr
:=
common
.
Address
{
0xff
,
0xff
}
tx
:=
types
.
MustSignNewTx
(
ethPrivKey
,
types
.
LatestSignerForChainID
(
cfg
.
L2ChainIDBig
()),
&
types
.
DynamicFeeTx
{
tx
:=
types
.
MustSignNewTx
(
ethPrivKey
,
types
.
LatestSignerForChainID
(
cfg
.
L2ChainIDBig
()),
&
types
.
DynamicFeeTx
{
ChainID
:
cfg
.
L2ChainIDBig
(),
ChainID
:
cfg
.
L2ChainIDBig
(),
Nonce
:
1
,
Nonce
:
0
,
To
:
&
toAddr
,
To
:
&
toAddr
,
Value
:
big
.
NewInt
(
1
_000_000_000
),
Value
:
big
.
NewInt
(
1
_000_000_000
),
GasTipCap
:
big
.
NewInt
(
10
),
GasTipCap
:
big
.
NewInt
(
10
),
...
@@ -804,7 +804,7 @@ func TestSystemMockPeerScoring(t *testing.T) {
...
@@ -804,7 +804,7 @@ func TestSystemMockPeerScoring(t *testing.T) {
// toAddr = common.Address{0xff, 0xff}
// toAddr = common.Address{0xff, 0xff}
// maliciousTx := types.MustSignNewTx(ethPrivKey, types.LatestSignerForChainID(cfg.L2ChainIDBig()), &types.DynamicFeeTx{
// maliciousTx := types.MustSignNewTx(ethPrivKey, types.LatestSignerForChainID(cfg.L2ChainIDBig()), &types.DynamicFeeTx{
// ChainID: cfg.L2ChainIDBig(),
// ChainID: cfg.L2ChainIDBig(),
// Nonce:
0
,
// Nonce:
1
,
// To: &toAddr,
// To: &toAddr,
// Value: big.NewInt(1_000_000_000),
// Value: big.NewInt(1_000_000_000),
// GasTipCap: big.NewInt(10),
// GasTipCap: big.NewInt(10),
...
@@ -814,11 +814,11 @@ func TestSystemMockPeerScoring(t *testing.T) {
...
@@ -814,11 +814,11 @@ func TestSystemMockPeerScoring(t *testing.T) {
// err = l2Seq2.SendTransaction(context.Background(), maliciousTx)
// err = l2Seq2.SendTransaction(context.Background(), maliciousTx)
// require.Nil(t, err, "Sending L2 tx to sequencer")
// require.Nil(t, err, "Sending L2 tx to sequencer")
//
//
Wait for tx to be mined on the L2 sequencer chain
// Wait for tx to be mined on the L2 sequencer chain
// receiptSeq, err = waitForTransaction(maliciousTx.Hash(), l2Seq2, 6*time.Duration(sys.RollupConfig.BlockTime)*time.Second)
// receiptSeq, err = waitForTransaction(maliciousTx.Hash(), l2Seq2, 6*time.Duration(sys.RollupConfig.BlockTime)*time.Second)
// require.Nil(t, err, "Waiting for L2 tx on sequencer")
// require.Nil(t, err, "Waiting for L2 tx on sequencer")
//
//
Wait until the block it was first included in shows up in the safe chain on the verifier
// Wait until the block it was first included in shows up in the safe chain on the verifier
// receiptVerif, err = waitForTransaction(maliciousTx.Hash(), l2Verif, 6*time.Duration(sys.RollupConfig.BlockTime)*time.Second)
// receiptVerif, err = waitForTransaction(maliciousTx.Hash(), l2Verif, 6*time.Duration(sys.RollupConfig.BlockTime)*time.Second)
// require.Nil(t, err, "Waiting for L2 tx on verifier")
// require.Nil(t, err, "Waiting for L2 tx on verifier")
// require.Equal(t, receiptSeq, receiptVerif)
// require.Equal(t, receiptSeq, receiptVerif)
...
...
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