diff --git a/hive_integration/nodocker/engine/engine_client.nim b/hive_integration/nodocker/engine/engine_client.nim index 1314f0826..ccb8efd05 100644 --- a/hive_integration/nodocker/engine/engine_client.nim +++ b/hive_integration/nodocker/engine/engine_client.nim @@ -7,7 +7,8 @@ import ../../../tests/rpcclient/eth_api, ../../../premix/parser, ../../../nimbus/rpc/hexstrings, - ../../../nimbus/beacon/execution_types + ../../../nimbus/beacon/execution_types, + ../../../nimbus/beacon/web3_eth_conv import web3/engine_api as web3_engine_api @@ -142,14 +143,32 @@ proc newPayloadV3*(client: RpcClient, wrapTrySimpleRes: client.engine_newPayloadV3(payload, versionedHashes, parentBeaconBlockRoot) +#proc newPayload*(client: RpcClient, +# payload: ExecutionPayload, +# version: Version): +# Result[PayloadStatusV1, string] = +# if version == Version.V1: +# client.newPayloadV1(payload.V1) +# else: +# client.newPayloadV2(payload.V2) + +proc collectBlobHashes(list: openArray[Web3Tx]): seq[Web3Hash] = + for w3tx in list: + let tx = ethTx(w3Tx) + for h in tx.versionedHashes: + result.add w3Hash(h) + proc newPayload*(client: RpcClient, payload: ExecutionPayload, - version: Version): - Result[PayloadStatusV1, string] = - if version == Version.V1: - client.newPayloadV1(payload.V1) - else: - client.newPayloadV2(payload.V2) + beaconRoot = none(common.Hash256)): Result[PayloadStatusV1, string] = + case payload.version + of Version.V1: return client.newPayloadV1(payload.V1) + of Version.V2: return client.newPayloadV2(payload.V2) + of Version.V3: + let versionedHashes = collectBlobHashes(payload.transactions) + return client.newPayloadV3(payload.V3, + versionedHashes, + w3Hash beaconRoot.get) proc exchangeCapabilities*(client: RpcClient, methods: seq[string]): diff --git a/hive_integration/nodocker/engine/withdrawals/wd_reorg_spec.nim b/hive_integration/nodocker/engine/withdrawals/wd_reorg_spec.nim index e643b1a0a..fc3e708ca 100644 --- a/hive_integration/nodocker/engine/withdrawals/wd_reorg_spec.nim +++ b/hive_integration/nodocker/engine/withdrawals/wd_reorg_spec.nim @@ -193,7 +193,7 @@ proc execute*(ws: ReorgSpec, env: TestEnv): bool = # This block is part of both chains, simply forward it to the secondary client payload = env.clMock.latestPayloadBuilt - let r = sec.client.newPayload(payload, payload.version) + let r = sec.client.newPayload(payload) r.expectStatus(valid) let fcState = ForkchoiceStateV1( @@ -304,7 +304,7 @@ proc execute*(ws: ReorgSpec, env: TestEnv): bool = hash=payload.blockHash.short, parentHash=payload.parentHash.short - let r = env.client.newPayload(payload, version) + let r = env.client.newPayload(payload) r.expectStatusEither(valid, accepted) let fcState = ForkchoiceStateV1(headBlockHash: payload.blockHash) diff --git a/hive_integration/nodocker/pyspec/pyspec_sim.nim b/hive_integration/nodocker/pyspec/pyspec_sim.nim index edb5e441f..caa5ede38 100644 --- a/hive_integration/nodocker/pyspec/pyspec_sim.nim +++ b/hive_integration/nodocker/pyspec/pyspec_sim.nim @@ -109,32 +109,6 @@ proc validatePostState(node: JsonNode, t: TestEnv): bool = return true -proc collectBlobHashes(list: openArray[Web3Tx]): seq[Web3Hash] = - for w3tx in list: - let tx = ethTx(w3Tx) - for h in tx.versionedHashes: - result.add w3Hash(h) - -proc newPayload(client: RpcClient, - payload: ExecutionPayload, - beaconRoot: Option[common.Hash256]): Result[PayloadStatusV1, string] = - case payload.version - of Version.V1: return client.newPayloadV1(payload.V1) - of Version.V2: return client.newPayloadV2(payload.V2) - of Version.V3: - let versionedHashes = collectBlobHashes(payload.transactions) - return client.newPayloadV3(payload.V3, - versionedHashes, - w3Hash beaconRoot.get) - -proc forkchoiceUpdated(client: RpcClient, version: Version, - update: ForkchoiceStateV1): - Result[ForkchoiceUpdatedResponse, string] = - case version - of Version.V1: client.forkchoiceUpdatedV1(update) - of Version.V2: client.forkchoiceUpdatedV2(update) - of Version.V3: client.forkchoiceUpdatedV3(update) - proc runTest(node: JsonNode, network: string): TestStatus = let conf = getChainConfig(network) var t = TestEnv(conf: makeTestConfig()) diff --git a/hive_integration/nodocker/pyspec/test_env.nim b/hive_integration/nodocker/pyspec/test_env.nim index 7c2d832a2..8aefe8327 100644 --- a/hive_integration/nodocker/pyspec/test_env.nim +++ b/hive_integration/nodocker/pyspec/test_env.nim @@ -9,7 +9,6 @@ import constants, transaction, db/accounts_cache, - core/sealer, core/chain, core/tx_pool, rpc, @@ -28,7 +27,6 @@ type com: CommonRef chainRef: ChainRef rpcServer: RpcHttpServer - sealingEngine: SealingEngineRef rpcClient*: RpcHttpClient const @@ -63,10 +61,6 @@ proc setupELClient*(t: TestEnv, conf: ChainConfig, node: JsonNode) = let txPool = TxPoolRef.new(t.com, engineSigner) t.rpcServer = newRpcHttpServer(["127.0.0.1:8545"]) - t.sealingEngine = SealingEngineRef.new( - t.chainRef, t.ctx, engineSigner, - txPool, EngineStopped - ) let beaconEngine = BeaconEngineRef.new(txPool, t.chainRef) setupEthRpc(t.ethNode, t.ctx, t.com, txPool, t.rpcServer) @@ -79,5 +73,4 @@ proc setupELClient*(t: TestEnv, conf: ChainConfig, node: JsonNode) = proc stopELClient*(t: TestEnv) = waitFor t.rpcClient.close() - waitFor t.sealingEngine.stop() waitFor t.rpcServer.closeWait() diff --git a/hive_integration/nodocker/sim_utils.nim b/hive_integration/nodocker/sim_utils.nim index 971651850..7d77f8cc2 100644 --- a/hive_integration/nodocker/sim_utils.nim +++ b/hive_integration/nodocker/sim_utils.nim @@ -38,14 +38,14 @@ proc `$`*(stat: SimStat): string = for c in stat.failingCases: result.add " - $1 \n" % [c] - result.add "ok: $1, skipped: $2, failed: $3" % [$stat.ok, $stat.skipped, $stat.failed] + result.add " - ok: $1, skipped: $2, failed: $3" % [$stat.ok, $stat.skipped, $stat.failed] proc print*(stat: SimStat, dur: Duration, name: string) = var f = open(name & ".md", fmWrite) f.write("* " & name) f.write("\n") - f.write(" - " & $stat) + f.write($stat) f.write("\n") - f.write(" - " & dur.short) + f.write(" - Elapsed: " & dur.short) f.write("\n") f.close()