Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions simulators/ethereum/engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ Verification is made that Client 1 Re-orgs to chain G -> B -> C.
Block A reaches TTD, but Client 2 has a higher TTD and accepts block B (simulating a client not complying with the merge).
Verification is made that Client 1 does not follow Client 2 chain to block B.

- Long PoW Chain Sync:
Client 1 starts with chain G -> PoW1, Client 2 starts with chain G -> PoW1 -> ... -> PoW1024.
Block PoW1024 reaches TTD, and the CL Mock continues the PoS chain on top of this block.
Verification is made that Client 1 syncs the remaining PoW blocks and also the PoS chain built on top of PoW1024.

## JWT Authentication Tests:
- No time drift, correct secret:
Engine API call where the `iat` claim contains no time drift, and the secret to calculate the token is correct.
Expand Down
Binary file not shown.
Binary file not shown.
41 changes: 35 additions & 6 deletions simulators/ethereum/engine/mergetests.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ type MergeTestSpec struct {
// to secondary clients happen.
SkipMainClientFcU bool

// Whether or not to wait for TTD to be reached by the main client
SkipMainClientTTDWait bool

// All secondary clients to be started during the tests with their respective chain files
SecondaryClientSpecs SecondaryClientSpecs
}
Expand All @@ -83,6 +86,15 @@ type MergeTestSpec struct {
Block 2, ee5dbba4ccfdc75800bf98804be90d2ffe7fa9b2dce37b6fe31c891ca5fb87b8, difficulty: 196800
Chain Total Difficulty 393504

- blocks_1024_td_135112316.rlp
Block 1, 2a9b7a5a209a58f672fa23a3ad9c831958d37dd74a960f69c0075b5c92be457e, difficulty: 196416
* Details of every block use `hivechain print`
Chain Total Difficulty 135112316

- blocks_1_td_196416.rlp
Block 1, 2a9b7a5a209a58f672fa23a3ad9c831958d37dd74a960f69c0075b5c92be457e, difficulty: 196416
Chain Total Difficulty 196416

Chains were generated using the following command:
`hivechain generate -genesis ./init/genesis.json -mine -length 2|1`.
*/
Expand Down Expand Up @@ -175,6 +187,21 @@ var mergeTestSpecs = []MergeTestSpec{
},
},
},
{
Name: "Long PoW Chain Sync",
TTD: 135112316,
MainChainFile: "blocks_1_td_196416.rlp",
SkipMainClientFcU: true,
SkipMainClientTTDWait: true,
TimeoutSeconds: 300,
SecondaryClientSpecs: []SecondaryClientSpec{
{
ChainFile: "blocks_1024_td_135112316.rlp",
BuildPoSChainOnTop: true,
MainClientShallSync: true,
},
},
},

/* TODOs:
- reorg to a block with uncles
Expand Down Expand Up @@ -213,13 +240,15 @@ func (clients SecondaryClientSpecs) AnyPoSChainOnTop() bool {
func GenerateMergeTestSpec(mergeTestSpec MergeTestSpec) TestSpec {
runFunc := func(t *TestEnv) {
// The first client waits for TTD, which ideally should be reached immediately using loaded chain
if !t.Engine.waitForTTDWithTimeout(t.Timeout) {
t.Fatalf("FAIL (%s): Timeout waiting for EngineClient (%s) to reach TTD", t.TestName, t.Engine.Container)
}
if !mergeTestSpec.SkipMainClientTTDWait {
if !t.Engine.waitForTTDWithTimeout(t.Timeout) {
t.Fatalf("FAIL (%s): Timeout waiting for EngineClient (%s) to reach TTD", t.TestName, t.Engine.Container)
}

if !mergeTestSpec.SkipMainClientFcU {
// Set the head of the CLMocker to the head of the main client
t.CLMock.setTTDBlockClient(t.Engine)
if !mergeTestSpec.SkipMainClientFcU {
// Set the head of the CLMocker to the head of the main client
t.CLMock.setTTDBlockClient(t.Engine)
}
}

// At this point, Head must be main client's HeadBlockHash, but this can change depending on the
Expand Down