Skip to content

Commit

Permalink
simulators/ethereum/engine: update test names for distinction (#914)
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-tb authored Oct 25, 2023
1 parent 9099fd0 commit aa37003
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 73 deletions.
6 changes: 3 additions & 3 deletions simulators/ethereum/engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Send a NewPayload directive to the client including an incorrect BlockHash, shou
- NewPayload while syncing, on canonical chain
- NewPayload while syncing, on side chain

- ParentHash==BlockHash on NewPayload:
- ParentHash equals BlockHash on NewPayload:
Send a NewPayload directive to the client including ParentHash that is equal to the BlockHash (Incorrect hash).

- Invalid Transition Payload:
Expand Down Expand Up @@ -176,10 +176,10 @@ Test that performing a re-org back into a previous block of the canonical chain
Build an alternative chain of 10 payloads.
Perform `newPayload(P10')` + `fcU(P10')`, which should result in client `SYNCING`. Verify that the client can re-org back to the canonical chain after sending `newPayload(P11)` + `fcU(P11)`.

- Import and re-org to previously validated payload on a side chain:
- Re-org to Previously Validated Sidechain Payload:
Attempt to re-org to one of the sidechain (previously validated) payloads, but not the leaf, and also build a new payload from this sidechain.

- Safe Re-Org to Side Chain
- Safe Re-Org to Side Chain:
Perform a re-org of the safe block (and head block) to a valid sidechain.

### Suggested Fee Recipient in Payload creation
Expand Down
44 changes: 22 additions & 22 deletions simulators/ethereum/engine/suites/cancun/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ var Tests = []test.Spec{
&CancunBaseSpec{

BaseSpec: test.BaseSpec{
Name: "Blob Transaction Ordering, Single Account",
Name: "Blob Transaction Ordering, Single Account, Single Blob",
About: `
Send N blob transactions with cancun.MAX_BLOBS_PER_BLOCK-1 blobs each,
using account A.
Expand Down Expand Up @@ -203,7 +203,7 @@ var Tests = []test.Spec{
&CancunBaseSpec{

BaseSpec: test.BaseSpec{
Name: "Blob Transaction Ordering, Single Account 2",
Name: "Blob Transaction Ordering, Single Account, Dual Blob",
About: `
Send N blob transactions with cancun.MAX_BLOBS_PER_BLOCK-1 blobs each,
using account A.
Expand Down Expand Up @@ -1085,7 +1085,7 @@ var Tests = []test.Spec{
&CancunBaseSpec{

BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Missing Hash",
Name: "NewPayloadV3 Versioned Hashes, Missing Hash, Syncing=False",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
is missing one of the hashes.
Expand Down Expand Up @@ -1117,7 +1117,7 @@ var Tests = []test.Spec{
&CancunBaseSpec{

BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Extra Hash",
Name: "NewPayloadV3 Versioned Hashes, Extra Hash, Syncing=False",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
is has an extra hash for a blob that is not in the payload.
Expand Down Expand Up @@ -1151,7 +1151,7 @@ var Tests = []test.Spec{

&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Out of Order",
Name: "NewPayloadV3 Versioned Hashes, Out of Order, Syncing=False",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
is out of order.
Expand Down Expand Up @@ -1183,7 +1183,7 @@ var Tests = []test.Spec{

&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Repeated Hash",
Name: "NewPayloadV3 Versioned Hashes, Repeated Hash, Syncing=False",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
has a blob that is repeated in the array.
Expand Down Expand Up @@ -1215,7 +1215,7 @@ var Tests = []test.Spec{

&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Incorrect Hash",
Name: "NewPayloadV3 Versioned Hashes, Incorrect Hash, Syncing=False",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
has a blob hash that does not belong to any blob contained in the payload.
Expand Down Expand Up @@ -1246,7 +1246,7 @@ var Tests = []test.Spec{
},
&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Incorrect Version",
Name: "NewPayloadV3 Versioned Hashes, Incorrect Version, Syncing=False",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
has a single blob that has an incorrect version.
Expand Down Expand Up @@ -1279,7 +1279,7 @@ var Tests = []test.Spec{

&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Nil Hashes",
Name: "NewPayloadV3 Versioned Hashes, Nil Hashes, Syncing=False",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
is nil, even though the fork has already happened.
Expand Down Expand Up @@ -1311,7 +1311,7 @@ var Tests = []test.Spec{

&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Empty Hashes",
Name: "NewPayloadV3 Versioned Hashes, Empty Hashes, Syncing=False",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
is empty, even though there are blobs in the payload.
Expand Down Expand Up @@ -1343,7 +1343,7 @@ var Tests = []test.Spec{

&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Non-Empty Hashes",
Name: "NewPayloadV3 Versioned Hashes, Non-Empty Hashes, Syncing=False",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
is contains hashes, even though there are no blobs in the payload.
Expand Down Expand Up @@ -1372,7 +1372,7 @@ var Tests = []test.Spec{
&CancunBaseSpec{

BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Missing Hash (Syncing)",
Name: "NewPayloadV3 Versioned Hashes, Missing Hash, Syncing=True",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
is missing one of the hashes.
Expand Down Expand Up @@ -1411,7 +1411,7 @@ var Tests = []test.Spec{
&CancunBaseSpec{

BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Extra Hash (Syncing)",
Name: "NewPayloadV3 Versioned Hashes, Extra Hash, Syncing=True",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
is has an extra hash for a blob that is not in the payload.
Expand Down Expand Up @@ -1452,7 +1452,7 @@ var Tests = []test.Spec{

&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Out of Order (Syncing)",
Name: "NewPayloadV3 Versioned Hashes, Out of Order, Syncing=True",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
is out of order.
Expand Down Expand Up @@ -1490,7 +1490,7 @@ var Tests = []test.Spec{

&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Repeated Hash (Syncing)",
Name: "NewPayloadV3 Versioned Hashes, Repeated Hash, Syncing=True",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
has a blob that is repeated in the array.
Expand Down Expand Up @@ -1529,7 +1529,7 @@ var Tests = []test.Spec{

&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Incorrect Hash (Syncing)",
Name: "NewPayloadV3 Versioned Hashes, Incorrect Hash, Syncing=True",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
has a blob that is repeated in the array.
Expand Down Expand Up @@ -1567,7 +1567,7 @@ var Tests = []test.Spec{
},
&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Incorrect Version (Syncing)",
Name: "NewPayloadV3 Versioned Hashes, Incorrect Version, Syncing=True",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
has a single blob that has an incorrect version.
Expand Down Expand Up @@ -1607,7 +1607,7 @@ var Tests = []test.Spec{

&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Nil Hashes (Syncing)",
Name: "NewPayloadV3 Versioned Hashes, Nil Hashes, Syncing=True",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
is nil, even though the fork has already happened.
Expand Down Expand Up @@ -1646,7 +1646,7 @@ var Tests = []test.Spec{

&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Empty Hashes (Syncing)",
Name: "NewPayloadV3 Versioned Hashes, Empty Hashes, Syncing=True",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
is empty, even though there are blobs in the payload.
Expand Down Expand Up @@ -1685,7 +1685,7 @@ var Tests = []test.Spec{

&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "NewPayloadV3 Versioned Hashes, Non-Empty Hashes (Syncing)",
Name: "NewPayloadV3 Versioned Hashes, Non-Empty Hashes, Syncing=True",
About: `
Tests VersionedHashes in Engine API NewPayloadV3 where the array
is contains hashes, even though there are no blobs in the payload.
Expand Down Expand Up @@ -1722,7 +1722,7 @@ var Tests = []test.Spec{
// and can be executed using `pyspec` simulator.
&CancunBaseSpec{
BaseSpec: test.BaseSpec{
Name: "Incorrect BlobGasUsed: Non-Zero on Zero Blobs",
Name: "Incorrect BlobGasUsed, Non-Zero on Zero Blobs",
About: `
Send a payload with zero blobs, but non-zero BlobGasUsed.
`,
Expand All @@ -1742,7 +1742,7 @@ var Tests = []test.Spec{
&CancunBaseSpec{

BaseSpec: test.BaseSpec{
Name: "Incorrect BlobGasUsed: GAS_PER_BLOB on Zero Blobs",
Name: "Incorrect BlobGasUsed, GAS_PER_BLOB on Zero Blobs",
About: `
Send a payload with zero blobs, but non-zero BlobGasUsed.
`,
Expand Down
6 changes: 4 additions & 2 deletions simulators/ethereum/engine/suites/engine/bad_hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,11 @@ func (s ParentHashOnNewPayload) WithMainFork(fork config.Fork) test.Spec {
}

func (p ParentHashOnNewPayload) GetName() string {
name := "ParentHash==BlockHash on NewPayload"
name := "ParentHash equals BlockHash on NewPayload,"
if p.Syncing {
name += " (Syncing)"
name += " Syncing=True"
} else {
name += " Syncing=False"
}
return name
}
Expand Down
10 changes: 6 additions & 4 deletions simulators/ethereum/engine/suites/engine/fork_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package suite_engine

import (
"fmt"
"strings"
"time"

"github.com/ethereum/hive/simulators/ethereum/engine/clmock"
Expand All @@ -22,14 +23,15 @@ func (s ForkIDSpec) WithMainFork(fork config.Fork) test.Spec {
}

func (ft ForkIDSpec) GetName() string {
name := fmt.Sprintf("Fork ID: Genesis at %d, %s at %d", ft.GetGenesisTimestamp(), ft.MainFork, ft.ForkTime)
var name []string
name = append(name, fmt.Sprintf("Fork ID: Genesis=%d, %s=%d", ft.GetGenesisTimestamp(), ft.MainFork, ft.ForkTime))
if ft.PreviousForkTime != 0 {
name += fmt.Sprintf(", %s at %d", ft.MainFork.PreviousFork(), ft.PreviousForkTime)
name = append(name, fmt.Sprintf("%s=%d", ft.MainFork.PreviousFork(), ft.PreviousForkTime))
}
if ft.ProduceBlocksBeforePeering > 0 {
name += fmt.Sprintf(", Produce %d blocks before peering", ft.ProduceBlocksBeforePeering)
name = append(name, fmt.Sprintf("BlocksBeforePeering=%d", ft.ProduceBlocksBeforePeering))
}
return name
return strings.Join(name, ", ")
}

func (ft ForkIDSpec) Execute(t *test.Env) {
Expand Down
39 changes: 19 additions & 20 deletions simulators/ethereum/engine/suites/engine/invalid_ancestor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"math/big"
"strings"
"time"

api "github.com/ethereum/go-ethereum/beacon/engine"
Expand Down Expand Up @@ -40,16 +39,16 @@ func (s InvalidMissingAncestorReOrgTest) WithMainFork(fork config.Fork) test.Spe
}

func (tc InvalidMissingAncestorReOrgTest) GetName() string {
name := []string{
"Invalid Missing Ancestor ReOrg",
fmt.Sprintf("Invalid %s", tc.InvalidField),
}
emptyTxsStatus := "False"
if tc.EmptyTransactions {
name = append(name, "Empty Txs")
emptyTxsStatus = "True"
}
name = append(name, fmt.Sprintf("Invalid P%d'", tc.InvalidIndex))

return strings.Join(name, ", ")
return fmt.Sprintf(
"Invalid Missing Ancestor ReOrg, %s, EmptyTxs=%s, Invalid P%d",
tc.InvalidField,
emptyTxsStatus,
tc.InvalidIndex,
)
}

func (tc InvalidMissingAncestorReOrgTest) Execute(t *test.Env) {
Expand Down Expand Up @@ -207,21 +206,21 @@ func (s InvalidMissingAncestorReOrgSyncTest) WithMainFork(fork config.Fork) test
}

func (tc InvalidMissingAncestorReOrgSyncTest) GetName() string {
name := []string{
"Invalid Missing Ancestor ReOrg",
fmt.Sprintf("Invalid %s", tc.InvalidField),
}
emptyTxsStatus := "False"
if tc.EmptyTransactions {
name = append(name, "Empty Txs")
emptyTxsStatus = "True"
}
name = append(name,
fmt.Sprintf("Invalid P%d'", tc.InvalidIndex),
"Reveal using sync",
)
canonicalReOrgStatus := "False"
if tc.ReOrgFromCanonical {
name = append(name, "ReOrg from Canonical")
canonicalReOrgStatus = "True"
}
return strings.Join(name, ", ")
return fmt.Sprintf(
"Invalid Missing Ancestor Syncing ReOrg, %s, EmptyTxs=%s, CanonicalReOrg=%s, Invalid P%d",
tc.InvalidField,
emptyTxsStatus,
canonicalReOrgStatus,
tc.InvalidIndex,
)
}

func (tc InvalidMissingAncestorReOrgSyncTest) Execute(t *test.Env) {
Expand Down
20 changes: 14 additions & 6 deletions simulators/ethereum/engine/suites/engine/invalid_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,25 @@ func (s InvalidPayloadTestCase) WithMainFork(fork config.Fork) test.Spec {
}

func (i InvalidPayloadTestCase) GetName() string {
name := fmt.Sprintf("Invalid %s NewPayload", i.InvalidField)
syncStatus := "False"
if i.Syncing {
name += " - Syncing"
syncStatus = "True"
}
emptyTxsStatus := "False"
if i.EmptyTransactions {
name += " - Empty Transactions"
emptyTxsStatus = "True"
}
dynFeeTxsStatus := "False"
if i.BaseSpec.TestTransactionType == helper.DynamicFeeTxOnly {
name += fmt.Sprintf(" - %s", i.BaseSpec.TestTransactionType)
dynFeeTxsStatus = "True"
}
return name
return fmt.Sprintf(
"Invalid NewPayload, %s, Syncing=%s, EmptyTxs=%s, DynFeeTxs=%s",
i.InvalidField,
syncStatus,
emptyTxsStatus,
dynFeeTxsStatus,
)
}

func (tc InvalidPayloadTestCase) Execute(t *test.Env) {
Expand Down Expand Up @@ -400,7 +408,7 @@ func (s InvalidTxChainIDTest) WithMainFork(fork config.Fork) test.Spec {
}

func (s InvalidTxChainIDTest) GetName() string {
name := fmt.Sprintf("Build Payload with Invalid ChainID Transaction (%s)", s.TestTransactionType)
name := fmt.Sprintf("Build Payload with Invalid ChainID Transaction, %s", s.TestTransactionType)
return name
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ func (s InvalidPayloadAttributesTest) WithMainFork(fork config.Fork) test.Spec {
}

func (tc InvalidPayloadAttributesTest) GetName() string {
name := fmt.Sprintf("Invalid PayloadAttributes: %s", tc.Description)
name := fmt.Sprintf("Invalid PayloadAttributes, %s,", tc.Description)
if tc.Syncing {
name += " (Syncing)"
name += " Syncing=True"
} else {
name += " Syncing=False"
}
return name
}
Expand Down
6 changes: 4 additions & 2 deletions simulators/ethereum/engine/suites/engine/payload_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,11 @@ func (s MultiplePayloadsExtendingCanonicalChainTest) WithMainFork(fork config.Fo
}

func (s MultiplePayloadsExtendingCanonicalChainTest) GetName() string {
name := "Multiple New Payloads Extending Canonical Chain"
name := "Multiple New Payloads Extending Canonical Chain,"
if s.SetHeadToFirstPayloadReceived {
name += " (FcU to first payload received)"
name += " Set Head to First Payload Received"
} else {
name += " Wait for Canonical Payload"
}
return name
}
Expand Down
Loading

0 comments on commit aa37003

Please sign in to comment.