Skip to content

Commit 810db6e

Browse files
committed
wip
1 parent 6c9acdc commit 810db6e

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

research/fakeee.nim

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import
1717
chronicles
1818

1919
proc setupEngineAPI*(server: RpcServer) =
20-
server.rpcContext(EthJson):
20+
server.rpc(EthJson):
2121
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/paris.md#engine_newpayloadv1
2222
# cannot use `params` as param name. see https:#github.com/status-im/nim-json-rpc/issues/128
23-
rpc("engine_newPayloadV1") do(payload: ExecutionPayloadV1) -> PayloadStatusV1:
23+
proc engine_newPayloadV1(payload: ExecutionPayloadV1): PayloadStatusV1 =
2424
info "engine_newPayloadV1",
2525
number = $(distinctBase payload.blockNumber), hash = payload.blockHash
2626

@@ -29,15 +29,15 @@ proc setupEngineAPI*(server: RpcServer) =
2929
)
3030

3131
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#engine_newpayloadv2
32-
rpc("engine_newPayloadV2") do(payload: ExecutionPayloadV2) -> PayloadStatusV1:
32+
proc engine_newPayloadV2(payload: ExecutionPayloadV2): PayloadStatusV1 =
3333
info "engine_newPayloadV2", payload
3434

3535
return PayloadStatusV1(
3636
status: PayloadExecutionStatus.syncing,
3737
)
3838

3939
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/paris.md#engine_getpayloadv1
40-
rpc("engine_getPayloadV1") do(payloadId: Bytes8) -> ExecutionPayloadV1:
40+
proc engine_getPayloadV1(payloadId: Bytes8): ExecutionPayloadV1 =
4141
info "engine_getPayloadV1",
4242
id = payloadId.toHex
4343

@@ -47,9 +47,9 @@ proc setupEngineAPI*(server: RpcServer) =
4747
)
4848

4949
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/paris.md#engine_forkchoiceupdatedv1
50-
rpc("engine_forkchoiceUpdatedV1") do(
50+
proc engine_forkchoiceUpdatedV1(
5151
update: ForkchoiceStateV1,
52-
payloadAttributes: Opt[PayloadAttributesV1]) -> ForkchoiceUpdatedResponse:
52+
payloadAttributes: Opt[PayloadAttributesV1]): ForkchoiceUpdatedResponse =
5353
info "engine_forkchoiceUpdatedV1",
5454
update,
5555
payloadAttributes
@@ -59,31 +59,31 @@ proc setupEngineAPI*(server: RpcServer) =
5959
status: PayloadExecutionStatus.syncing))
6060

6161
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#engine_forkchoiceupdatedv2
62-
rpc("engine_forkchoiceUpdatedV2") do(
63-
forkchoiceState: ForkchoiceStateV1, payloadAttributes: Opt[PayloadAttributesV2]) -> ForkchoiceUpdatedResponse:
62+
proc engine_forkchoiceUpdatedV2(
63+
forkchoiceState: ForkchoiceStateV1, payloadAttributes: Opt[PayloadAttributesV2]): ForkchoiceUpdatedResponse =
6464
info "engine_forkchoiceUpdatedV2",
6565
forkchoiceState, payloadAttributes
6666

6767
return ForkchoiceUpdatedResponse(
6868
payloadStatus: PayloadStatusV1(
6969
status: PayloadExecutionStatus.syncing))
7070

71-
rpc("eth_getBlockByNumber") do(
72-
quantityTag: string, fullTransactions: bool) -> JsonString:
71+
proc eth_getBlockByNumber(
72+
quantityTag: string, fullTransactions: bool): JsonString =
7373
info "eth_getBlockByNumber", quantityTag, fullTransactions
7474

7575
return if quantityTag == "latest":
7676
EthJson.encode(BlockObject(number: 1000.Quantity)).JsonString
7777
else:
7878
"{}".JsonString
7979

80-
rpc("eth_getBlockByHash") do(
81-
data: string, fullTransactions: bool) -> BlockObject:
80+
proc eth_getBlockByHash(
81+
data: string, fullTransactions: bool): BlockObject =
8282
info "eth_getBlockByHash", data = toHex(data), fullTransactions
8383

8484
return BlockObject(number: 1000.Quantity)
8585

86-
rpc("eth_chainId") do() -> UInt256:
86+
proc eth_chainId(): UInt256 =
8787
info "eth_chainId"
8888

8989
return 1.u256

0 commit comments

Comments
 (0)