Use SSZ code from nim-ssz-serialization module (#875)

This commit is contained in:
Kim De Mey 2021-10-23 14:28:12 +02:00 committed by GitHub
parent 02e8b2eb12
commit 0ba3c682e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 12 additions and 9 deletions

5
.gitmodules vendored
View File

@ -193,3 +193,8 @@
url = https://github.com/status-im/nim-websock
ignore = dirty
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

View File

@ -8,7 +8,7 @@
{.push raises: [Defect].}
import
eth/ssz/ssz_serialization
ssz_serialization/types
type
ByteList* = List[byte, 2048]

View File

@ -12,7 +12,7 @@
import
std/options,
nimcrypto/[sha2, hash], stew/objects, stint,
eth/ssz/ssz_serialization,
ssz_serialization,
../../common/common_types
export ssz_serialization, common_types

View File

@ -12,7 +12,7 @@
import
std/options,
nimcrypto/[sha2, hash], stew/objects, stint,
eth/ssz/ssz_serialization,
ssz_serialization,
../../common/common_types
export ssz_serialization, common_types

View File

@ -13,7 +13,7 @@
import
std/options,
stint, stew/[results, objects],
eth/ssz/ssz_serialization,
ssz_serialization,
../../common/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] =
toBytesLE(x)
template toSszType*(x: auto): auto =
x
func fromSszBytes*(T: type UInt256, data: openArray[byte]):
T {.raises: [MalformedSszError, Defect].} =
if data.len != sizeof(result):

View File

@ -13,8 +13,8 @@
import
std/[sequtils, sets, algorithm],
stew/results, chronicles, chronos, nimcrypto/hash,
ssz_serialization,
eth/rlp, eth/p2p/discoveryv5/[protocol, node, enr, routing_table, random2, nodes_verification],
eth/ssz/ssz_serialization,
./messages
export messages, routing_table

View File

@ -8,7 +8,7 @@
import
std/os,
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,
../../nimbus/[genesis, chain_config, config, db/db_chain],
../network/wire/portal_protocol,

1
vendor/nim-ssz-serialization vendored Submodule

@ -0,0 +1 @@
Subproject commit 5d65b20d6b56265902e5c9b6a2be4d1c2fd6427e