-
Notifications
You must be signed in to change notification settings - Fork 1
/
UpdateWasm
executable file
·98 lines (89 loc) · 5.69 KB
/
UpdateWasm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env zsh
set -eu -o pipefail
cd "$(dirname "$0")"
rm -rf nimbus-eth2
git clone -b "feat/eip-6493" "https://github.com/status-im/nimbus-eth2"
ulimit -n 1024
USE_SYSTEM_NIM='' make -C nimbus-eth2 -j update
git -C nimbus-eth2/vendor/nimbus-build-system/vendor/Nim apply <<'EOF'
diff --git a/lib/system/threadids.nim b/lib/system/threadids.nim
index 3a6eadcbb..6b7416ddc 100644
--- a/lib/system/threadids.nim
+++ b/lib/system/threadids.nim
@@ -20,6 +20,13 @@ when defined(windows):
threadId = int(getCurrentThreadId())
result = threadId
+elif defined(emscripten):
+ proc getThreadId*(): int =
+ ## Gets the ID of the currently running thread.
+ if threadId == 0:
+ threadId = cast[int](addr threadId)
+ result = threadId
+
elif defined(linux):
proc syscall(arg: clong): clong {.varargs, importc: "syscall", header: "<unistd.h>".}
when defined(amd64):
EOF
git -C nimbus-eth2 apply <<'EOF'
diff --git a/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim b/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim
index 17fae6cc..bbf71983 100644
--- a/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim
+++ b/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim
@@ -3357,9 +3357,10 @@ proc decodeBytes*[T: DecodeTypes](
if mediaType == ApplicationJsonMediaType:
try:
- ok RestJson.decode(value, T,
- requireAllFields = true,
- allowUnknownFields = true)
+ let r = RestJson.decode(value, T,
+ requireAllFields = true,
+ allowUnknownFields = true)
+ ok r
except SerializationError as exc:
debug "Failed to deserialize REST JSON data",
err = exc.formatMsg("<data>"),
EOF
USE_SYSTEM_NIM='' NIM_COMMIT='' BASH_VERSION='' NBS_ONLY_LOAD_ENV_VARS='' . nimbus-eth2/env.sh
nim --version
rm -rf libnimbus_lc.js libnimbus_lc.wasm libnimbus_lc.worker.js nimcache
nim c \
-d:disable_libbacktrace \
-d:disableMarchNative \
-d:disableLTO \
-d:emscripten \
-d:release \
-d:useGcAssert \
-d:useSysAssert \
--debuginfo:off \
--nimcache:nimcache \
--os:linux \
--cpu:wasm32 \
--cc:clang \
--clang.exe:emcc \
--clang.linkerexe:emcc \
--mm:arc \
--exceptions:goto \
--define:noSignalHandler \
--define:danger \
--panics:on \
--passC:-fpic \
--passL:-Os \
--passL:-fpic \
--passC:'-pthread' \
--passL:'-pthread' \
--passC:'-sASSERTIONS' \
--passL:'-sASSERTIONS' \
--passC:'-sINITIAL_MEMORY=256MB' \
--passL:'-sINITIAL_MEMORY=256MB' \
--passC:'-sSTACK_SIZE=128MB' \
--passL:'-sSTACK_SIZE=128MB' \
--passC:'-sUSE_PTHREADS=1' \
--passL:'-sUSE_PTHREADS=1' \
--passC:'-sPTHREAD_POOL_SIZE_STRICT=0' \
--passL:'-sPTHREAD_POOL_SIZE_STRICT=0' \
--passL:'-sEXPORTED_FUNCTIONS="[_free, _malloc, _NimMain, _ETHRandomNumberCreate, _ETHConsensusConfigCreateFromYaml, _ETHConsensusConfigGetConsensusVersionAtEpoch, _ETHBeaconStateCreateFromSsz, _ETHBeaconStateDestroy, _ETHBeaconStateCopyGenesisValidatorsRoot, _ETHRootDestroy, _ETHForkDigestsCreateFromState, _ETHBeaconClockCreateFromState, _ETHBeaconClockGetSlot, _ETHLightClientStoreCreateFromBootstrap, _ETHLightClientStoreDestroy, _kETHLcSyncKind_UpdatesByRange, _kETHLcSyncKind_FinalityUpdate, _kETHLcSyncKind_OptimisticUpdate, _ETHLightClientStoreGetNextSyncTask, _ETHLightClientStoreGetMillisecondsToNextSyncTask, _ETHLightClientStoreProcessUpdatesByRange, _ETHLightClientStoreProcessFinalityUpdate, _ETHLightClientStoreProcessOptimisticUpdate, _ETHLightClientStoreGetFinalizedHeader, _ETHLightClientStoreIsNextSyncCommitteeKnown, _ETHLightClientStoreGetOptimisticHeader, _ETHLightClientStoreGetSafetyThreshold, _ETHLightClientHeaderCreateCopy, _ETHLightClientHeaderDestroy, _ETHLightClientHeaderCopyBeaconRoot, _ETHLightClientHeaderGetBeacon, _ETHBeaconBlockHeaderGetSlot, _ETHBeaconBlockHeaderGetProposerIndex, _ETHBeaconBlockHeaderGetParentRoot, _ETHBeaconBlockHeaderGetStateRoot, _ETHBeaconBlockHeaderGetBodyRoot, _ETHLightClientHeaderCopyExecutionHash, _ETHLightClientHeaderGetExecution, _ETHExecutionPayloadHeaderGetParentHash, _ETHExecutionPayloadHeaderGetFeeRecipient, _ETHExecutionPayloadHeaderGetStateRoot, _ETHExecutionPayloadHeaderGetReceiptsRoot, _ETHExecutionPayloadHeaderGetLogsBloom, _ETHExecutionPayloadHeaderGetPrevRandao, _ETHExecutionPayloadHeaderGetBlockNumber, _ETHExecutionPayloadHeaderGetGasLimit, _ETHExecutionPayloadHeaderGetGasUsed, _ETHExecutionPayloadHeaderGetTimestamp, _ETHExecutionPayloadHeaderGetExtraDataBytes, _ETHExecutionPayloadHeaderGetBaseFeePerGas, _ETHExecutionPayloadHeaderGetBlobGasUsed, _ETHExecutionPayloadHeaderGetExcessBlobGas, _ETHExecutionBlockHeaderCreateFromJson, _ETHExecutionBlockHeaderDestroy, _ETHExecutionBlockHeaderGetTransactionsRoot, _ETHExecutionBlockHeaderGetWithdrawalsRoot, _ETHTransactionsCreateFromJson, _ETHTransactionsDestroy, _ETHTransactionsGetCount, _ETHTransactionsGet, _ETHTransactionGetHash, _ETHTransactionGetFrom, _ETHTransactionGetNonce, _ETHTransactionGetMaxPriorityFeePerGas, _ETHTransactionGetMaxFeePerGas, _ETHTransactionGetGas, _ETHTransactionIsCreatingContract, _ETHTransactionGetTo, _ETHTransactionGetValue, _ETHTransactionGetInputBytes, _ETHTransactionGetBytes, _ETHTransactionGetEip6404Root, _ETHTransactionGetEip6404Bytes, _ETHTransactionGetNumEip6404SnappyBytes, _ETHReceiptsCreateFromJson, _ETHReceiptsDestroy, _ETHReceiptsGet, _ETHReceiptHasStatus, _ETHReceiptGetBytes, _ETHReceiptGetEip6466Bytes, _ETHReceiptGetNumEip6466SnappyBytes]"' \
--passL:'-sEXPORTED_RUNTIME_METHODS="[lengthBytesUTF8, stringToNewUTF8]"' \
--passL:'-Wl,--no-entry' \
--noMain:on \
--passL:'-o libnimbus_lc.js' \
nimbus-eth2/beacon_chain/libnimbus_lc/libnimbus_lc.nim