diff --git a/beacon_chain/deposit_contract.nim b/beacon_chain/deposit_contract.nim index 24a977f0a..e9a265b26 100644 --- a/beacon_chain/deposit_contract.nim +++ b/beacon_chain/deposit_contract.nim @@ -67,7 +67,7 @@ proc main() {.async.} = let cfg = CliConfig.load() let web3 = await newWeb3(cfg.web3Url) if cfg.privateKey.len != 0: - web3.privateKey = PrivateKey.fromHex(cfg.privateKey)[] + web3.privateKey = some(PrivateKey.fromHex(cfg.privateKey)[]) else: let accounts = await web3.provider.eth_accounts() doAssert(accounts.len > 0) diff --git a/beacon_chain/eth2_discovery.nim b/beacon_chain/eth2_discovery.nim index 2c0dd5e42..e8e3db413 100644 --- a/beacon_chain/eth2_discovery.nim +++ b/beacon_chain/eth2_discovery.nim @@ -75,7 +75,7 @@ proc loadBootstrapFile*(bootstrapFile: string, proc new*(T: type Eth2DiscoveryProtocol, conf: BeaconNodeConf, ip: Option[ValidIpAddress], tcpPort, udpPort: Port, - rawPrivKeyBytes: openarray[byte], + pk: PrivateKey, enrFields: openarray[(string, seq[byte])]): T {.raises: [Exception, Defect].} = # TODO @@ -83,8 +83,7 @@ proc new*(T: type Eth2DiscoveryProtocol, # * for setting up a specific key # * for using a persistent database let - pk = PrivateKey.fromRaw(rawPrivKeyBytes).expect("Valid private key") - ourPubKey = pk.toPublicKey().expect("Public key from valid private key") + ourPubKey = pk.toPublicKey() # TODO: `newMemoryDB()` causes raises: [Exception] db = DiscoveryDB.init(newMemoryDB()) diff --git a/beacon_chain/eth2_network.nim b/beacon_chain/eth2_network.nim index e6442e6d3..89a96509c 100644 --- a/beacon_chain/eth2_network.nim +++ b/beacon_chain/eth2_network.nim @@ -809,7 +809,7 @@ proc init*(T: type Eth2Node, conf: BeaconNodeConf, enrForkId: ENRForkID, result.metadata = getPersistentNetMetadata(conf) result.forkId = enrForkId result.discovery = Eth2DiscoveryProtocol.new( - conf, ip, tcpPort, udpPort, privKey.toRaw, + conf, ip, tcpPort, udpPort, privKey, {"eth2": SSZ.encode(result.forkId), "attnets": SSZ.encode(result.metadata.attnets)}) newSeq result.protocolStates, allProtocols.len @@ -822,7 +822,7 @@ proc init*(T: type Eth2Node, conf: BeaconNodeConf, enrForkId: ENRForkID, msg.protocolMounter result template publicKey*(node: Eth2Node): keys.PublicKey = - node.discovery.privKey.toPublicKey.tryGet() + node.discovery.privKey.toPublicKey template addKnownPeer*(node: Eth2Node, peer: enr.Record) = node.discovery.addNode peer diff --git a/beacon_chain/keystore_management.nim b/beacon_chain/keystore_management.nim index f860e270e..ef1a7d0df 100644 --- a/beacon_chain/keystore_management.nim +++ b/beacon_chain/keystore_management.nim @@ -164,7 +164,7 @@ proc sendDeposits*(deposits: seq[Deposit], delayGenerator: DelayGenerator = nil) {.async.} = var web3 = await newWeb3(web3Url) if privateKey.len != 0: - web3.privateKey = PrivateKey.fromHex(privateKey).tryGet + web3.privateKey = some(PrivateKey.fromHex(privateKey).tryGet) else: let accounts = await web3.provider.eth_accounts() if accounts.len == 0: diff --git a/vendor/nim-eth b/vendor/nim-eth index 5c6d8ccb3..61feae0f2 160000 --- a/vendor/nim-eth +++ b/vendor/nim-eth @@ -1 +1 @@ -Subproject commit 5c6d8ccb3624ebbdb5f277677850879e21a88d9a +Subproject commit 61feae0f21d49f102e1e0252f3559b600ff54a69 diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p index b99fd88de..6331b04cb 160000 --- a/vendor/nim-libp2p +++ b/vendor/nim-libp2p @@ -1 +1 @@ -Subproject commit b99fd88deb18c6e4c2b06b1faa3c5d5729be52a0 +Subproject commit 6331b04cb494d4140ea1b96c84ad23cec96910ef diff --git a/vendor/nim-secp256k1 b/vendor/nim-secp256k1 index e8fa92a0c..be9896359 160000 --- a/vendor/nim-secp256k1 +++ b/vendor/nim-secp256k1 @@ -1 +1 @@ -Subproject commit e8fa92a0c6217103eecce2a9e6f274c7eedac13b +Subproject commit be989635994377e0e421e4a039230098ba5ccd28 diff --git a/vendor/nim-web3 b/vendor/nim-web3 index 05f2a17ba..4889e41a1 160000 --- a/vendor/nim-web3 +++ b/vendor/nim-web3 @@ -1 +1 @@ -Subproject commit 05f2a17ba444433d615c5b3d0e1a1de0b0beae65 +Subproject commit 4889e41a1ca74dba5a85622e5dbf50547bec08f2