fix compilation error related to lib-secp256k1 changes

This commit is contained in:
jangko 2020-06-24 17:07:33 +07:00
parent 51f2017b03
commit 12ddfee675
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
5 changed files with 8 additions and 12 deletions

View File

@ -847,6 +847,7 @@ proc initConfiguration(): NimbusConfiguration =
result.net.ident = NimbusIdent
result.net.nat = NatAny
result.net.protocols = defaultProtocols
result.net.nodekey = PrivateKey.random().tryGet()
const dataDir = getDefaultDataDir()

View File

@ -58,10 +58,7 @@ proc start(nimbus: NimbusNode) =
setupCommonRpc(nimbus.rpcServer)
## Creating P2P Server
if not conf.net.nodekey.verify():
conf.net.nodekey = PrivateKey.random().tryGet()
let keypair = conf.net.nodekey.toKeyPair().tryGet()
let keypair = conf.net.nodekey.toKeyPair()
var address: Address
address.ip = parseIpAddress("0.0.0.0")

View File

@ -226,7 +226,7 @@ proc setupEthRpc*(node: EthereumNode, chain: BaseChainDB, rpcsrv: RpcServer) =
template sign(privateKey: PrivateKey, message: string): string =
# TODO: Is message length encoded as bytes or characters?
let msgData = "\x19Ethereum Signed Message:\n" & $message.len & message
$sign(privateKey, msgData.toBytes()).tryGet()
$sign(privateKey, msgData.toBytes())
rpcsrv.rpc("eth_sign") do(data: EthAddressStr, message: HexDataStr) -> HexDataStr:
## The sign method calculates an Ethereum specific signature with: sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))).

View File

@ -81,7 +81,7 @@ proc setupWhisperRPC*(node: EthereumNode, keys: KeyStorage, rpcsrv: RpcServer) =
## Returns key identifier on success and an error on failure.
result = generateRandomID().Identifier
keys.asymKeys.add(result.string, key.toKeyPair().tryGet())
keys.asymKeys.add(result.string, key.toKeyPair())
rpcsrv.rpc("shh_deleteKeyPair") do(id: Identifier) -> bool:
## Deletes the specifies key if it exists.

View File

@ -199,7 +199,7 @@ proc getFixtureTransaction*(j: JsonNode, dataIndex, gasIndex, valueIndex: int):
var secretKey = j["secretKey"].getStr
removePrefix(secretKey, "0x")
let privateKey = PrivateKey.fromHex(secretKey).tryGet()
let sig = sign(privateKey, result.rlpEncode).tryGet()
let sig = sign(privateKey, result.rlpEncode)
let raw = sig.toRaw()
result.R = fromBytesBE(Uint256, raw[0..31])
@ -210,11 +210,9 @@ proc hashLogEntries*(logs: seq[Log]): string =
toLowerAscii("0x" & $keccakHash(rlp.encode(logs)))
proc setupEthNode*(capabilities: varargs[ProtocolInfo, `protocolInfo`]): EthereumNode =
var
conf = getConfiguration()
if not conf.net.nodekey.verify():
conf.net.nodekey = PrivateKey.random().tryGet()
let keypair = conf.net.nodekey.toKeyPair().tryGet()
var conf = getConfiguration()
conf.net.nodekey = PrivateKey.random().tryGet()
let keypair = conf.net.nodekey.toKeyPair()
var srvAddress: Address
srvAddress.ip = parseIpAddress("0.0.0.0")