mirror of https://github.com/status-im/nim-eth.git
Move push raises to top and add/update license info where needed
This commit is contained in:
parent
b0474c0d40
commit
e10ef19f81
|
@ -1,9 +1,16 @@
|
|||
# nim-eth
|
||||
# Copyright (c) 2020-2021 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
import
|
||||
std/[tables, hashes],
|
||||
stew/results, stew/shims/net as stewNet, chronos, chronicles
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
type
|
||||
IpLimits* = object
|
||||
limit*: uint
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
#
|
||||
# Ethereum P2P
|
||||
# (c) Copyright 2018
|
||||
# Status Research & Development GmbH
|
||||
#
|
||||
# Licensed under either of
|
||||
# Apache License, version 2.0, (LICENSE-APACHEv2)
|
||||
# MIT license (LICENSE-MIT)
|
||||
#
|
||||
# nim-eth
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
import
|
||||
std/times,
|
||||
|
@ -18,8 +17,6 @@ import
|
|||
export
|
||||
Node, results
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
logScope:
|
||||
topics = "discovery"
|
||||
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
# nim-eth - Node Discovery Protocol v5
|
||||
# Copyright (c) 2020-2021 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
#
|
||||
## Discovery v5 packet encoding as specified at
|
||||
## https://github.com/ethereum/devp2p/blob/master/discv5/discv5-wire.md#packet-encoding
|
||||
## And handshake/sessions as specified at
|
||||
## https://github.com/ethereum/devp2p/blob/master/discv5/discv5-theory.md#sessions
|
||||
##
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
import
|
||||
std/[tables, options, hashes, net],
|
||||
nimcrypto, stint, chronicles, bearssl, stew/[results, byteutils],
|
||||
|
@ -13,8 +23,6 @@ from stew/objects import checkedEnumAssign
|
|||
|
||||
export keys
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
logScope:
|
||||
topics = "discv5"
|
||||
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
# ENR implementation according to specification in EIP-778:
|
||||
# https://github.com/ethereum/EIPs/blob/master/EIPS/eip-778.md
|
||||
# nim-eth - Node Discovery Protocol v5
|
||||
# Copyright (c) 2020-2021 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
#
|
||||
## ENR implementation according to specification in EIP-778:
|
||||
## https://github.com/ethereum/EIPs/blob/master/EIPS/eip-778.md
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
import
|
||||
std/[strutils, macros, algorithm, options],
|
||||
|
@ -8,8 +17,6 @@ import
|
|||
|
||||
export options
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
const
|
||||
maxEnrSize = 300 ## Maximum size of an encoded node record, in bytes.
|
||||
minRlpListLen = 4 ## Minimum node record RLP list has: signature, seqId,
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
# nim-eth - Node Discovery Protocol v5
|
||||
# Copyright (c) 2021 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, (LICENSE-APACHEv2)
|
||||
# * MIT license (LICENSE-MIT)
|
||||
# at your option.
|
||||
# This file may not be copied, modified, or distributed except
|
||||
# according to those terms.
|
||||
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
#
|
||||
## IP:port address votes implemented similarly as in
|
||||
## https://github.com/sigp/discv5
|
||||
##
|
||||
|
@ -17,6 +15,8 @@
|
|||
## To select the right address, a majority count is done. This is done over a
|
||||
## sort of moving window as votes expire after `IpVoteTimeout`.
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
import
|
||||
std/[tables, options],
|
||||
chronos,
|
||||
|
@ -24,8 +24,6 @@ import
|
|||
|
||||
export options
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
const IpVoteTimeout = 5.minutes ## Duration until a vote expires
|
||||
|
||||
type
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
# nim-eth - Node Discovery Protocol v5
|
||||
# Copyright (c) 2020-2021 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
#
|
||||
## Discovery v5 Protocol Messages as specified at
|
||||
## https://github.com/ethereum/devp2p/blob/master/discv5/discv5-wire.md#protocol-messages
|
||||
## These messages get RLP encoded.
|
||||
##
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
import
|
||||
std/[hashes, net],
|
||||
stew/arrayops,
|
||||
../../rlp, ./enr
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
type
|
||||
MessageKind* = enum
|
||||
# TODO This is needed only to make Nim 1.2.6 happy
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
# nim-eth - Node Discovery Protocol v5
|
||||
# Copyright (c) 2020-2021 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
import
|
||||
std/hashes,
|
||||
nimcrypto, stint, chronos, stew/shims/net, chronicles,
|
||||
|
@ -5,8 +14,6 @@ import
|
|||
|
||||
export stint
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
type
|
||||
NodeId* = UInt256
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
# nim-eth - Node Discovery Protocol v5
|
||||
# Copyright (c) 2020-2021 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, (LICENSE-APACHEv2)
|
||||
# * MIT license (LICENSE-MIT)
|
||||
# at your option. This file may not be copied, modified, or distributed except
|
||||
# according to those terms.
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
## Node Discovery Protocol v5
|
||||
##
|
||||
|
@ -72,6 +71,8 @@
|
|||
## more requests will be needed for a lookup (adding bandwidth and latency).
|
||||
## This might be a concern for mobile devices.
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
import
|
||||
std/[tables, sets, options, math, sequtils, algorithm],
|
||||
stew/shims/net as stewNet, json_serialization/std/net,
|
||||
|
@ -83,8 +84,6 @@ import nimcrypto except toHex
|
|||
|
||||
export options
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
declareCounter discovery_message_requests_outgoing,
|
||||
"Discovery protocol outgoing message requests", labels = ["response"]
|
||||
declareCounter discovery_message_requests_incoming,
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
# nim-eth - Node Discovery Protocol v5
|
||||
# Copyright (c) 2020-2021 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
import
|
||||
std/[algorithm, times, sequtils, bitops, sets, options],
|
||||
stint, chronicles, metrics, bearssl, chronos, stew/shims/net as stewNet,
|
||||
|
@ -6,8 +15,6 @@ import
|
|||
|
||||
export options
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
declarePublicGauge routing_table_nodes,
|
||||
"Discovery routing table nodes", labels = ["state"]
|
||||
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
# nim-eth - Node Discovery Protocol v5
|
||||
# Copyright (c) 2020-2021 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
#
|
||||
## Session cache as mentioned at
|
||||
## https://github.com/ethereum/devp2p/blob/master/discv5/discv5-theory.md#session-cache
|
||||
##
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
import
|
||||
std/options,
|
||||
stint, stew/endians2, stew/shims/net,
|
||||
|
@ -8,8 +18,6 @@ import
|
|||
|
||||
export lru
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
const
|
||||
aesKeySize* = 128 div 8
|
||||
keySize = sizeof(NodeId) +
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
#
|
||||
# Ethereum P2P
|
||||
# (c) Copyright 2018
|
||||
# Status Research & Development GmbH
|
||||
#
|
||||
# Licensed under either of
|
||||
# Apache License, version 2.0, (LICENSE-APACHEv2)
|
||||
# MIT license (LICENSE-MIT)
|
||||
#
|
||||
# nim-eth
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
import
|
||||
std/[tables, hashes, times, algorithm, sets, sequtils, random],
|
||||
|
@ -16,8 +15,6 @@ import
|
|||
|
||||
export sets # TODO: This should not be needed, but compilation fails otherwise
|
||||
|
||||
{.push raises: [Defect].}
|
||||
|
||||
logScope:
|
||||
topics = "kademlia"
|
||||
|
||||
|
|
Loading…
Reference in New Issue