Use SSZ code from nim-ssz-serialization module (#875)
This commit is contained in:
parent
02e8b2eb12
commit
0ba3c682e4
|
@ -193,3 +193,8 @@
|
||||||
url = https://github.com/status-im/nim-websock
|
url = https://github.com/status-im/nim-websock
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
branch = master
|
branch = master
|
||||||
|
[submodule "vendor/nim-ssz-serialization"]
|
||||||
|
path = vendor/nim-ssz-serialization
|
||||||
|
url = https://github.com/status-im/nim-ssz-serialization.git
|
||||||
|
ignore = untracked
|
||||||
|
branch = master
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{.push raises: [Defect].}
|
{.push raises: [Defect].}
|
||||||
|
|
||||||
import
|
import
|
||||||
eth/ssz/ssz_serialization
|
ssz_serialization/types
|
||||||
|
|
||||||
type
|
type
|
||||||
ByteList* = List[byte, 2048]
|
ByteList* = List[byte, 2048]
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
import
|
import
|
||||||
std/options,
|
std/options,
|
||||||
nimcrypto/[sha2, hash], stew/objects, stint,
|
nimcrypto/[sha2, hash], stew/objects, stint,
|
||||||
eth/ssz/ssz_serialization,
|
ssz_serialization,
|
||||||
../../common/common_types
|
../../common/common_types
|
||||||
|
|
||||||
export ssz_serialization, common_types
|
export ssz_serialization, common_types
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
import
|
import
|
||||||
std/options,
|
std/options,
|
||||||
nimcrypto/[sha2, hash], stew/objects, stint,
|
nimcrypto/[sha2, hash], stew/objects, stint,
|
||||||
eth/ssz/ssz_serialization,
|
ssz_serialization,
|
||||||
../../common/common_types
|
../../common/common_types
|
||||||
|
|
||||||
export ssz_serialization, common_types
|
export ssz_serialization, common_types
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
import
|
import
|
||||||
std/options,
|
std/options,
|
||||||
stint, stew/[results, objects],
|
stint, stew/[results, objects],
|
||||||
eth/ssz/ssz_serialization,
|
ssz_serialization,
|
||||||
../../common/common_types
|
../../common/common_types
|
||||||
|
|
||||||
export ssz_serialization, stint, common_types
|
export ssz_serialization, stint, common_types
|
||||||
|
@ -114,9 +114,6 @@ template messageKind*(T: typedesc[SomeMessage]): MessageKind =
|
||||||
template toSszType*(x: UInt256): array[32, byte] =
|
template toSszType*(x: UInt256): array[32, byte] =
|
||||||
toBytesLE(x)
|
toBytesLE(x)
|
||||||
|
|
||||||
template toSszType*(x: auto): auto =
|
|
||||||
x
|
|
||||||
|
|
||||||
func fromSszBytes*(T: type UInt256, data: openArray[byte]):
|
func fromSszBytes*(T: type UInt256, data: openArray[byte]):
|
||||||
T {.raises: [MalformedSszError, Defect].} =
|
T {.raises: [MalformedSszError, Defect].} =
|
||||||
if data.len != sizeof(result):
|
if data.len != sizeof(result):
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
import
|
import
|
||||||
std/[sequtils, sets, algorithm],
|
std/[sequtils, sets, algorithm],
|
||||||
stew/results, chronicles, chronos, nimcrypto/hash,
|
stew/results, chronicles, chronos, nimcrypto/hash,
|
||||||
|
ssz_serialization,
|
||||||
eth/rlp, eth/p2p/discoveryv5/[protocol, node, enr, routing_table, random2, nodes_verification],
|
eth/rlp, eth/p2p/discoveryv5/[protocol, node, enr, routing_table, random2, nodes_verification],
|
||||||
eth/ssz/ssz_serialization,
|
|
||||||
./messages
|
./messages
|
||||||
|
|
||||||
export messages, routing_table
|
export messages, routing_table
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import
|
import
|
||||||
std/os,
|
std/os,
|
||||||
testutils/unittests,
|
testutils/unittests,
|
||||||
eth/[keys, trie/db, trie/hexary, ssz/ssz_serialization],
|
eth/[keys, trie/db, trie/hexary],
|
||||||
eth/p2p/discoveryv5/protocol as discv5_protocol, eth/p2p/discoveryv5/routing_table,
|
eth/p2p/discoveryv5/protocol as discv5_protocol, eth/p2p/discoveryv5/routing_table,
|
||||||
../../nimbus/[genesis, chain_config, config, db/db_chain],
|
../../nimbus/[genesis, chain_config, config, db/db_chain],
|
||||||
../network/wire/portal_protocol,
|
../network/wire/portal_protocol,
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 5d65b20d6b56265902e5c9b6a2be4d1c2fd6427e
|
Loading…
Reference in New Issue