Skip to content

Commit 66e9119

Browse files
authored
Run all EEST engine tests, not just ones in static folder (#3846)
* Run all EEST engine tests, not just ones in static folder. * Try deleting unneeded tests to save disk space. * Updates to support running all tests, including tests using older new payload/fcu versions.
1 parent 929d5ba commit 66e9119

File tree

6 files changed

+104
-21
lines changed

6 files changed

+104
-21
lines changed

hive_integration/engine_client.nim

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ proc forkchoiceUpdatedV1*(client: RpcClient,
5959

6060
proc forkchoiceUpdatedV2*(client: RpcClient,
6161
update: ForkchoiceStateV1,
62-
payloadAttributes = Opt.none(PayloadAttributes)):
62+
payloadAttributes = Opt.none(PayloadAttributesV2)):
6363
Result[ForkchoiceUpdatedResponse, string] =
6464
wrapTrySimpleRes:
6565
client.engine_forkchoiceUpdatedV2(update, payloadAttributes)
6666

6767
proc forkchoiceUpdatedV3*(client: RpcClient,
6868
update: ForkchoiceStateV1,
69-
payloadAttributes = Opt.none(PayloadAttributes)):
69+
payloadAttributes = Opt.none(PayloadAttributesV3)):
7070
Result[ForkchoiceUpdatedResponse, string] =
7171
wrapTrySimpleRes:
7272
client.engine_forkchoiceUpdatedV3(update, payloadAttributes)
@@ -78,8 +78,8 @@ proc forkchoiceUpdated*(client: RpcClient,
7878
Result[ForkchoiceUpdatedResponse, string] =
7979
case version
8080
of Version.V1: return client.forkchoiceUpdatedV1(update, attr.V1)
81-
of Version.V2: return client.forkchoiceUpdatedV2(update, attr)
82-
of Version.V3: return client.forkchoiceUpdatedV3(update, attr)
81+
of Version.V2: return client.forkchoiceUpdatedV2(update, attr.V2)
82+
of Version.V3: return client.forkchoiceUpdatedV3(update, attr.V3)
8383
of Version.V4, Version.V5, Version.V6: discard
8484

8585
proc getPayloadV1*(client: RpcClient, payloadId: Bytes8): Result[ExecutionPayloadV1, string] =
@@ -98,10 +98,38 @@ proc getPayloadV4*(client: RpcClient, payloadId: Bytes8): Result[GetPayloadV4Res
9898
wrapTrySimpleRes:
9999
client.engine_getPayloadV4(payloadId)
100100

101+
proc getPayloadV5*(client: RpcClient, payloadId: Bytes8): Result[GetPayloadV5Response, string] =
102+
wrapTrySimpleRes:
103+
client.engine_getPayloadV5(payloadId)
104+
105+
proc getPayloadV6*(client: RpcClient, payloadId: Bytes8): Result[GetPayloadV6Response, string] =
106+
wrapTrySimpleRes:
107+
client.engine_getPayloadV6(payloadId)
108+
101109
proc getPayload*(client: RpcClient,
102110
version: Version,
103111
payloadId: Bytes8): Result[GetPayloadResponse, string] =
104-
if version == Version.V4:
112+
if version == Version.V6:
113+
let x = client.getPayloadV6(payloadId).valueOr:
114+
return err(error)
115+
ok(GetPayloadResponse(
116+
executionPayload: executionPayload(x.executionPayload),
117+
blockValue: Opt.some(x.blockValue),
118+
blobsBundleV2: Opt.some(x.blobsBundle),
119+
shouldOverrideBuilder: Opt.some(x.shouldOverrideBuilder),
120+
executionRequests: Opt.some(x.executionRequests),
121+
))
122+
elif version == Version.V5:
123+
let x = client.getPayloadV5(payloadId).valueOr:
124+
return err(error)
125+
ok(GetPayloadResponse(
126+
executionPayload: executionPayload(x.executionPayload),
127+
blockValue: Opt.some(x.blockValue),
128+
blobsBundleV2: Opt.some(x.blobsBundle),
129+
shouldOverrideBuilder: Opt.some(x.shouldOverrideBuilder),
130+
executionRequests: Opt.some(x.executionRequests),
131+
))
132+
elif version == Version.V4:
105133
let x = client.getPayloadV4(payloadId).valueOr:
106134
return err(error)
107135
ok(GetPayloadResponse(
@@ -171,6 +199,16 @@ proc newPayloadV4*(client: RpcClient,
171199
client.engine_newPayloadV4(payload, versionedHashes,
172200
parentBeaconBlockRoot, executionRequests)
173201

202+
proc newPayloadV5*(client: RpcClient,
203+
payload: ExecutionPayloadV4,
204+
versionedHashes: seq[VersionedHash],
205+
parentBeaconBlockRoot: Hash32,
206+
executionRequests: seq[seq[byte]]):
207+
Result[PayloadStatusV1, string] =
208+
wrapTrySimpleRes:
209+
client.engine_newPayloadV5(payload, versionedHashes,
210+
parentBeaconBlockRoot, executionRequests)
211+
174212
proc newPayloadV1*(client: RpcClient,
175213
payload: ExecutionPayload):
176214
Result[PayloadStatusV1, string] =
@@ -202,21 +240,38 @@ proc newPayloadV4*(client: RpcClient,
202240
client.engine_newPayloadV4(payload, versionedHashes,
203241
parentBeaconBlockRoot, executionRequests)
204242

243+
proc newPayloadV5*(client: RpcClient,
244+
payload: ExecutionPayload,
245+
versionedHashes: Opt[seq[VersionedHash]],
246+
parentBeaconBlockRoot: Opt[Hash32],
247+
executionRequests: Opt[seq[seq[byte]]]):
248+
Result[PayloadStatusV1, string] =
249+
wrapTrySimpleRes:
250+
client.engine_newPayloadV5(payload, versionedHashes,
251+
parentBeaconBlockRoot, executionRequests)
252+
205253
proc newPayload*(client: RpcClient,
206254
version: Version,
207255
payload: ExecutableData): Result[PayloadStatusV1, string] =
208256
case version
209-
of Version.V1: return client.newPayloadV1(payload.basePayload)
210-
of Version.V2: return client.newPayloadV2(payload.basePayload)
257+
of Version.V1:
258+
return client.newPayloadV1(payload.basePayload)
259+
of Version.V2:
260+
return client.newPayloadV2(payload.basePayload)
211261
of Version.V3:
212262
return client.newPayloadV3(payload.basePayload,
213263
payload.versionedHashes,
214264
payload.beaconRoot)
215-
of Version.V4, Version.V5: # Osaka doesn't define any new newPayloadV5
265+
of Version.V4:
216266
return client.newPayloadV4(payload.basePayload,
217267
payload.versionedHashes,
218268
payload.beaconRoot,
219269
payload.executionRequests)
270+
of Version.V5:
271+
return client.newPayloadV5(payload.basePayload,
272+
payload.versionedHashes,
273+
payload.beaconRoot,
274+
payload.executionRequests)
220275
of Version.V6: discard
221276

222277
proc exchangeCapabilities*(client: RpcClient,

scripts/eest_ci_cache.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,21 @@ download_and_extract() {
6363
tar -xzf "${archive}" -C "${dest_dir}" --strip-components=1
6464

6565
rm -rf "${dest_dir}/.meta"
66+
6667
mv "${dest_dir}/blockchain_tests/static/state_tests/"* "${dest_dir}/blockchain_tests" 2>/dev/null || true
6768
rm -rf "${dest_dir}/blockchain_tests/static"
6869

69-
mkdir -p "${dest_dir}/engine_tests"
70-
mv "${dest_dir}/blockchain_tests_engine/static/state_tests/"* "${dest_dir}/engine_tests" 2>/dev/null || true
71-
rm -rf "${dest_dir}/blockchain_tests_engine"
70+
mv "${dest_dir}/blockchain_tests_engine/static/state_tests/"* "${dest_dir}/blockchain_tests_engine" 2>/dev/null || true
71+
rm -rf "${dest_dir}/blockchain_tests_engine/static"
7272

7373
mv "${dest_dir}/state_tests/static/state_tests/"* "${dest_dir}/state_tests" 2>/dev/null || true
7474
rm -rf "${dest_dir}/state_tests/static"
7575

76+
# Remove unused tests
77+
rm -rf "${dest_dir}/blockchain_tests_engine_x"
78+
rm -rf "${dest_dir}/blockchain_tests_sync"
79+
rm -rf "${dest_dir}/transaction_tests"
80+
7681
rm -f "${archive}"
7782

7883
echo "${version}" > "${dest_dir}/version.txt"

tests/eest/eest_engine.nim

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ proc sendNewPayload(env: TestEnv, version: uint64, param: PayloadParam): Result[
3030
if not env.client.isSome:
3131
return err("Client is not initialized")
3232

33-
if version == 3:
33+
if version == 1:
34+
env.client.get().newPayloadV1(
35+
param.payload)
36+
elif version == 2:
37+
env.client.get().newPayloadV2(
38+
param.payload)
39+
elif version == 3:
3440
env.client.get().newPayloadV3(
3541
param.payload,
3642
param.versionedHashes,
@@ -40,17 +46,30 @@ proc sendNewPayload(env: TestEnv, version: uint64, param: PayloadParam): Result[
4046
param.payload,
4147
param.versionedHashes,
4248
param.parentBeaconBlockRoot,
43-
param.excutionRequests)
49+
param.executionRequests)
50+
elif version == 5:
51+
env.client.get().newPayloadV5(
52+
param.payload,
53+
param.versionedHashes,
54+
param.parentBeaconBlockRoot,
55+
param.executionRequests)
4456
else:
4557
err("Unsupported NewPayload version: " & $version)
4658

4759
proc sendFCU(env: TestEnv, version: uint64, param: PayloadParam): Result[ForkchoiceUpdatedResponse, string] =
60+
if not env.client.isSome:
61+
return err("Client is not initialized")
62+
4863
let update = ForkchoiceStateV1(
4964
headblockHash: param.payload.blockHash,
5065
finalizedblockHash: param.payload.blockHash
5166
)
5267

53-
if version == 3 and env.client.isSome:
68+
if version == 1:
69+
env.client.get().forkchoiceUpdatedV1(update)
70+
elif version == 2:
71+
env.client.get().forkchoiceUpdatedV2(update)
72+
elif version == 3:
5473
env.client.get().forkchoiceUpdatedV3(update)
5574
else:
5675
err("Unsupported FCU version: " & $version)
@@ -60,8 +79,12 @@ proc runTest(env: TestEnv, unit: EngineUnitEnv): Result[void, string] =
6079
return err("Client is not initialized")
6180

6281
for enp in unit.engineNewPayloads:
82+
6383
var status = env.sendNewPayload(enp.newPayloadVersion.uint64, enp.params).valueOr:
64-
return err(error)
84+
if enp.validationError.isSome():
85+
continue
86+
else:
87+
return err(error)
6588

6689
discard status
6790
when false:
@@ -80,8 +103,7 @@ proc runTest(env: TestEnv, unit: EngineUnitEnv): Result[void, string] =
80103
if status.validationError.isSome:
81104
return err(status.validationError.value)
82105

83-
let header = env.client.get().latestHeader().valueOr:
84-
return err(error)
106+
let header = env.chain.latestHeader()
85107

86108
if unit.lastblockhash != header.computeRlpHash:
87109
return err("last block hash mismatch")

tests/eest/eest_engine_test.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import
1717

1818
const
1919
baseFolder = "tests/fixtures"
20-
eestType = "engine_tests"
20+
eestType = "blockchain_tests_engine"
2121
eestReleases = [
2222
"eest_develop",
2323
"eest_devnet"

tests/eest/eest_helpers.nim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,13 @@ type
6969
payload*: ExecutionPayload
7070
versionedHashes*: Opt[seq[Hash32]]
7171
parentBeaconBlockRoot*: Opt[Hash32]
72-
excutionRequests*: Opt[seq[seq[byte]]]
72+
executionRequests*: Opt[seq[seq[byte]]]
7373

7474
PayloadItem* = object
7575
params*: PayloadParam
7676
newPayloadVersion*: Numero
7777
forkchoiceUpdatedVersion*: Numero
78+
validationError*: Opt[string]
7879

7980
EnvConfig* = object
8081
network*: string
@@ -156,7 +157,7 @@ proc readValue*(
156157
of 2:
157158
r.readValue(val.parentBeaconBlockRoot)
158159
of 3:
159-
r.readValue(val.excutionRequests)
160+
r.readValue(val.executionRequests)
160161
else:
161162
r.raiseUnexpectedValue("Unexpected element")
162163

vendor/nim-web3

0 commit comments

Comments
 (0)