Skip to content

Commit debaf41

Browse files
committed
simulators/eth2/dencun: add evil teku suite
1 parent f894b73 commit debaf41

File tree

5 files changed

+48
-0
lines changed

5 files changed

+48
-0
lines changed

simulators/eth2/dencun/helper/helper.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type TransactionSpammer struct {
3131
TransactionType helper.TestTransactionType
3232
TransactionsPerIteration int
3333
SecondsBetweenIterations int
34+
BlobCount *big.Int
3435
}
3536

3637
func (t *TransactionSpammer) Run(ctx context.Context) error {
@@ -42,6 +43,7 @@ func (t *TransactionSpammer) Run(ctx context.Context) error {
4243
GasLimit: 500000,
4344
Amount: common.Big1,
4445
TxType: t.TransactionType,
46+
BlobCount: t.BlobCount,
4547
}
4648
txsSent := 0
4749
iteration := 0

simulators/eth2/dencun/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"github.com/ethereum/hive/simulators/eth2/common/clients"
66
suite_base "github.com/ethereum/hive/simulators/eth2/dencun/suites/base"
77
suite_builder "github.com/ethereum/hive/simulators/eth2/dencun/suites/builder"
8+
suite_evil "github.com/ethereum/hive/simulators/eth2/dencun/suites/evil"
89
suite_reorg "github.com/ethereum/hive/simulators/eth2/dencun/suites/reorg"
910
suite_sync "github.com/ethereum/hive/simulators/eth2/dencun/suites/sync"
1011
)
@@ -30,4 +31,5 @@ func main() {
3031
hivesim.MustRunSuite(sim, suite_sync.Suite(clientsByRole))
3132
hivesim.MustRunSuite(sim, suite_builder.Suite(clientsByRole))
3233
hivesim.MustRunSuite(sim, suite_reorg.Suite(clientsByRole))
34+
hivesim.MustRunSuite(sim, suite_evil.Suite(clientsByRole))
3335
}

simulators/eth2/dencun/suites/base/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ type BaseTestSpec struct {
4141

4242
// Extra Gwei
4343
ExtraGwei beacon.Gwei
44+
45+
// Blob count of each blob tx
46+
BlobCount *big.Int
4447
}
4548

4649
var (

simulators/eth2/dencun/suites/base/execution.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ func (ts BaseTestSpec) ExecutePostFork(
9393
TransactionType: engine_helper.BlobTxOnly,
9494
TransactionsPerIteration: 2,
9595
SecondsBetweenIterations: int(testnet.Spec().SECONDS_PER_SLOT),
96+
BlobCount: ts.BlobCount,
9697
}
9798

9899
go blobTxSpammer.Run(ctx)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package suite_evil
2+
3+
import (
4+
"math/big"
5+
6+
"github.com/ethereum/hive/hivesim"
7+
"github.com/ethereum/hive/simulators/eth2/common/clients"
8+
"github.com/ethereum/hive/simulators/eth2/dencun/suites"
9+
suite_base "github.com/ethereum/hive/simulators/eth2/dencun/suites/base"
10+
"github.com/ethereum/hive/simulators/ethereum/engine/config/cancun"
11+
)
12+
13+
var testSuite = hivesim.Suite{
14+
Name: "eth2-deneb-evil",
15+
Description: `Test suite that uses a modified node that sends incorrect blobs on each proposal.`,
16+
}
17+
18+
var Tests = make([]suites.TestSpec, 0)
19+
20+
func init() {
21+
Tests = append(Tests,
22+
suite_base.BaseTestSpec{
23+
Name: "test-invalid-extra-blob",
24+
Description: `
25+
Spawns testnet with one validating node that first publishes a modified blobSidecar with a random KZGProof, after 500ms publishes block and all valid blobs, and a second importing node that imports the block and all blobs.
26+
`,
27+
DenebGenesis: true,
28+
NodeCount: 2,
29+
ValidatingNodeCount: 1,
30+
GenesisExecutionWithdrawalCredentialsShares: 1,
31+
WaitForFinality: true,
32+
BlobCount: new(big.Int).SetUint64(cancun.MAX_BLOBS_PER_BLOCK - 1), // Evil teku requires 1 less blob than the max
33+
},
34+
)
35+
}
36+
37+
func Suite(c *clients.ClientDefinitionsByRole) hivesim.Suite {
38+
suites.SuiteHydrate(&testSuite, c, Tests)
39+
return testSuite
40+
}

0 commit comments

Comments
 (0)