vendor: bump nim-eth + fallout (#861)

This commit is contained in:
Jacek Sieka 2020-04-05 11:50:31 +02:00 committed by GitHub
parent 60df05a420
commit 04cf6d30eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 16 deletions

View File

@ -1,6 +1,6 @@
import
# Standard library
os, tables, random, strutils, times, sequtils,
os, tables, random, strutils, times,
# Nimble packages
stew/[objects, bitseqs, byteutils], stew/shims/macros,
@ -12,7 +12,7 @@ import
# Local modules
spec/[datatypes, digest, crypto, beaconstate, helpers, validator, network,
state_transition_block], spec/presets/custom,
conf, time, state_transition, beacon_chain_db, validator_pool, extras,
conf, time, beacon_chain_db, validator_pool, extras,
attestation_pool, block_pool, eth2_network, eth2_discovery,
beacon_node_types, mainchain_monitor, version, ssz, ssz/dynamic_navigator,
sync_protocol, request_manager, validator_keygen, interop, statusbar,
@ -133,7 +133,6 @@ proc getStateFromSnapshot(conf: BeaconNodeConf, state: var BeaconState): bool =
proc init*(T: type BeaconNode, conf: BeaconNodeConf): Future[BeaconNode] {.async.} =
let
netKeys = getPersistentNetKeys(conf)
ourPubKey = netKeys.pubkey.skkey
nickname = if conf.nodeName == "auto": shortForm(netKeys)
else: conf.nodeName
db = BeaconChainDB.init(kvStore SqliteStoreRef.init(conf.databaseDir))

View File

@ -67,7 +67,7 @@ proc main() {.async.} =
let cfg = CliConfig.load()
let web3 = await newWeb3(cfg.depositWeb3Url)
if cfg.privateKey.len != 0:
web3.privateKey = initPrivateKey(cfg.privateKey)
web3.privateKey = PrivateKey.fromHex(cfg.privateKey)[]
else:
let accounts = await web3.provider.eth_accounts()
doAssert(accounts.len > 0)

View File

@ -72,7 +72,7 @@ proc toENode*(enrRec: enr.Record): Result[ENode, cstring] =
address_v4: toArray(4, ipBytes))
tcpPort = Port enrRec.get("tcp", uint16)
udpPort = Port enrRec.get("udp", uint16)
var pubKey: keys.PublicKey
var pubKey: PublicKey
if not enrRec.get(pubKey):
return err "Failed to read public key from ENR record"
return ok ENode(pubkey: pubkey,
@ -161,8 +161,8 @@ proc new*(T: type Eth2DiscoveryProtocol,
# * for setting up a specific key
# * for using a persistent database
var
pk = initPrivateKey(rawPrivKeyBytes)
ourPubKey = pk.getPublicKey()
pk = PrivateKey.fromRaw(rawPrivKeyBytes).tryGet()
ourPubKey = pk.toPublicKey().tryGet()
db = DiscoveryDB.init(newMemoryDB())
var bootNodes: seq[ENode]

View File

@ -606,12 +606,12 @@ proc handleIncomingPeer*(peer: Peer) =
proc toPeerInfo*(r: enr.TypedRecord): PeerInfo =
if r.secp256k1.isSome:
var pubKey: keys.PublicKey
if recoverPublicKey(r.secp256k1.get, pubKey) != EthKeysStatus.Success:
var pubKey = keys.PublicKey.fromRaw(r.secp256k1.get)
if pubkey.isErr:
return # TODO
let peerId = PeerID.init crypto.PublicKey(
scheme: Secp256k1, skkey: SkPublicKey(pubKey))
scheme: Secp256k1, skkey: SkPublicKey(pubKey[]))
var addresses = newSeq[MultiAddress]()
if r.ip.isSome and r.tcp.isSome:
@ -683,7 +683,8 @@ proc init*(T: type Eth2Node, conf: BeaconNodeConf,
privKey: keys.PrivateKey): T =
new result
result.switch = switch
result.discovery = Eth2DiscoveryProtocol.new(conf, ip, tcpPort, udpPort, privKey.data)
result.discovery = Eth2DiscoveryProtocol.new(
conf, ip, tcpPort, udpPort, privKey.toRaw)
result.wantedPeers = conf.maxPeers
result.peerPool = newPeerPool[Peer, PeerID](maxPeers = conf.maxPeers)
@ -697,7 +698,7 @@ proc init*(T: type Eth2Node, conf: BeaconNodeConf,
msg.protocolMounter result
template publicKey*(node: Eth2Node): keys.PublicKey =
node.discovery.privKey.getPublicKey
node.discovery.privKey.toPublicKey.tryGet()
template addKnownPeer*(node: Eth2Node, peer: ENode|enr.Record) =
node.discovery.addNode peer

View File

@ -60,7 +60,7 @@ proc sendDeposits*(
var web3 = await newWeb3(depositWeb3Url)
if privateKey.len != 0:
web3.privateKey = initPrivateKey(privateKey)
web3.privateKey = PrivateKey.fromHex(privateKey).tryGet()
else:
let accounts = await web3.provider.eth_accounts()
if accounts.len == 0:

2
vendor/nim-eth vendored

@ -1 +1 @@
Subproject commit c827c37329541a2f3d7d8057fa577f14537bb832
Subproject commit ac5bbe4d3d04ca1baf455f5a7e22a04692bcc73a

2
vendor/nim-stew vendored

@ -1 +1 @@
Subproject commit 86739f99c4efc1246d45164ef81c1e8f72970b65
Subproject commit 9414202d53fac99a0b1af33acac816ff9236e6d0

2
vendor/nim-web3 vendored

@ -1 +1 @@
Subproject commit da74eabaa00e2a8f7c58e8d84a02b701041dfc2d
Subproject commit 969adf2f1ef42753ba26d5ab7eca01617c846792