Merge pull request #517 from status-im/bump_modules

bump submodules
This commit is contained in:
andri lim 2020-06-24 23:11:55 +07:00 committed by GitHub
commit 069e125f98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 37 additions and 35 deletions

7
.gitmodules vendored
View File

@ -166,3 +166,10 @@
[submodule "vendor/nim-sqlite3-abi"] [submodule "vendor/nim-sqlite3-abi"]
path = vendor/nim-sqlite3-abi path = vendor/nim-sqlite3-abi
url = https://github.com/arnetheduck/nim-sqlite3-abi.git url = https://github.com/arnetheduck/nim-sqlite3-abi.git
ignore = dirty
branch = master
[submodule "vendor/nim-bearssl"]
path = vendor/nim-bearssl
url = https://github.com/status-im/nim-bearssl
ignore = dirty
branch = master

View File

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

View File

@ -58,10 +58,7 @@ proc start(nimbus: NimbusNode) =
setupCommonRpc(nimbus.rpcServer) setupCommonRpc(nimbus.rpcServer)
## Creating P2P Server ## Creating P2P Server
if not conf.net.nodekey.verify(): let keypair = conf.net.nodekey.toKeyPair()
conf.net.nodekey = PrivateKey.random().tryGet()
let keypair = conf.net.nodekey.toKeyPair().tryGet()
var address: Address var address: Address
address.ip = parseIpAddress("0.0.0.0") 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 = template sign(privateKey: PrivateKey, message: string): string =
# TODO: Is message length encoded as bytes or characters? # TODO: Is message length encoded as bytes or characters?
let msgData = "\x19Ethereum Signed Message:\n" & $message.len & message 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: 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))). ## 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. ## Returns key identifier on success and an error on failure.
result = generateRandomID().Identifier 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: rpcsrv.rpc("shh_deleteKeyPair") do(id: Identifier) -> bool:
## Deletes the specifies key if it exists. ## 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 var secretKey = j["secretKey"].getStr
removePrefix(secretKey, "0x") removePrefix(secretKey, "0x")
let privateKey = PrivateKey.fromHex(secretKey).tryGet() let privateKey = PrivateKey.fromHex(secretKey).tryGet()
let sig = sign(privateKey, result.rlpEncode).tryGet() let sig = sign(privateKey, result.rlpEncode)
let raw = sig.toRaw() let raw = sig.toRaw()
result.R = fromBytesBE(Uint256, raw[0..31]) result.R = fromBytesBE(Uint256, raw[0..31])
@ -210,11 +210,9 @@ proc hashLogEntries*(logs: seq[Log]): string =
toLowerAscii("0x" & $keccakHash(rlp.encode(logs))) toLowerAscii("0x" & $keccakHash(rlp.encode(logs)))
proc setupEthNode*(capabilities: varargs[ProtocolInfo, `protocolInfo`]): EthereumNode = proc setupEthNode*(capabilities: varargs[ProtocolInfo, `protocolInfo`]): EthereumNode =
var var conf = getConfiguration()
conf = getConfiguration() conf.net.nodekey = PrivateKey.random().tryGet()
if not conf.net.nodekey.verify(): let keypair = conf.net.nodekey.toKeyPair()
conf.net.nodekey = PrivateKey.random().tryGet()
let keypair = conf.net.nodekey.toKeyPair().tryGet()
var srvAddress: Address var srvAddress: Address
srvAddress.ip = parseIpAddress("0.0.0.0") srvAddress.ip = parseIpAddress("0.0.0.0")

2
vendor/news vendored

@ -1 +1 @@
Subproject commit 0c44ff9cd31e0f644f10d9adfbfc8e0c181ea724 Subproject commit 1caa232d63f4607f90d5a9eb428fbe772e010d21

1
vendor/nim-bearssl vendored Submodule

@ -0,0 +1 @@
Subproject commit 68c6d27304245c948526487b37e10951acf7dbc8

@ -1 +1 @@
Subproject commit fc3f2d3755e035387ebcf20d87a45eb9dcefadbb Subproject commit 3d7619b1f559c86b2ef026f386d6d872b9331c82

2
vendor/nim-chronos vendored

@ -1 +1 @@
Subproject commit 357baa52a0ea3da699c8229d97230c7f4340da92 Subproject commit bedd1ded5edc3bfb6877f7025ca4b21f62492ffe

@ -1 +1 @@
Subproject commit 6e5d570490989c753d4645ba9173ef9358d302bb Subproject commit a76faa5eec2454309753bbe99a68fb3cc25782f1

2
vendor/nim-eth vendored

@ -1 +1 @@
Subproject commit 53166fd1ff28693d12044a7143d0508805c7ae8a Subproject commit 61feae0f21d49f102e1e0252f3559b600ff54a69

@ -1 +1 @@
Subproject commit dd63bbfd1cea26e9ca830a3a8fd70e5d3a0d1306 Subproject commit 5df69fc6961e58205189cd92ae2477769fa8c4c0

2
vendor/nim-json-rpc vendored

@ -1 +1 @@
Subproject commit 5c0d0961114bcaaf3da52d5918bf0b85ef0e4ce9 Subproject commit 244254632b15c745b6e15537aafd401f360d9928

@ -1 +1 @@
Subproject commit 2f5e71b25f5fefd71766c0eacfb1d69a8183b188 Subproject commit 463a0cf1b79f5e586b537c0ce7518e2d1ee85984

@ -1 +1 @@
Subproject commit e8fa92a0c6217103eecce2a9e6f274c7eedac13b Subproject commit be989635994377e0e421e4a039230098ba5ccd28

@ -1 +1 @@
Subproject commit 7ff764ca1f921ee709f05219aa740ab6c42872fc Subproject commit a49e001f9ec27c666e600ae000ece5999262cc44

2
vendor/nim-snappy vendored

@ -1 +1 @@
Subproject commit b4cd68e27a56dbda2a56d7b90e666b644cfd5be6 Subproject commit 676fa656d3a6f4e24691f3f48829c979b1b1bcdd

2
vendor/nim-stew vendored

@ -1 +1 @@
Subproject commit d0f5be4971ad34d115b9749d9fb69bdd2aecf525 Subproject commit 11aeb996ab31b5b537fc0c8631c96cbd7976eeb5

@ -1 +1 @@
Subproject commit b3b7074e395bdbc6820860955ebbc2556a9386a0 Subproject commit c449d909a638fca2c3adf141fb93710d882ed988

@ -1 +1 @@
Subproject commit 767c8e0fb433da5276c4ac3e61b3360e003536a7 Subproject commit ae49e03af6f36393eb7e0fc02c1c47df42efd2de

View File

@ -101,12 +101,11 @@ proc nimbus_start(port: uint16, startListening: bool, enableDiscovery: bool,
else: else:
let let
privKey = PrivateKey.fromRaw(makeOpenArray(privateKey, 32)) privKey = PrivateKey.fromRaw(makeOpenArray(privateKey, 32))
kp = privKey and privKey[].toKeyPair() if privKey.isErr:
if kp.isErr:
error "Passed an invalid private key." error "Passed an invalid private key."
return false return false
keypair = kp[] keypair = privKey[].toKeyPair()
node = newEthereumNode(keypair, address, 1, nil, addAllCapabilities = false) node = newEthereumNode(keypair, address, 1, nil, addAllCapabilities = false)
node.addCapability Whisper node.addCapability Whisper
@ -174,7 +173,7 @@ proc nimbus_new_keypair(id: var Identifier): bool
discard discard
proc nimbus_add_keypair(privateKey: ptr byte, id: var Identifier): proc nimbus_add_keypair(privateKey: ptr byte, id: var Identifier):
bool {.exportc, dynlib, raises: [Defect].} = bool {.exportc, dynlib, raises: [Defect, Exception].} =
## Caller needs to provide as id a pointer to 32 bytes allocation. ## Caller needs to provide as id a pointer to 32 bytes allocation.
doAssert(not (unsafeAddr id).isNil, "Key id cannot be nil.") doAssert(not (unsafeAddr id).isNil, "Key id cannot be nil.")
doAssert(not privateKey.isNil, "Private key cannot be nil.") doAssert(not privateKey.isNil, "Private key cannot be nil.")
@ -189,12 +188,11 @@ proc nimbus_add_keypair(privateKey: ptr byte, id: var Identifier):
else: else:
let let
privKey = PrivateKey.fromRaw(makeOpenArray(privateKey, 32)) privKey = PrivateKey.fromRaw(makeOpenArray(privateKey, 32))
kp = privKey and privKey[].toKeyPair() if privKey.isErr:
if kp.isErr:
error "Passed an invalid private key." error "Passed an invalid private key."
return false return false
keypair = kp[] keypair = privKey[].toKeyPair()
result = true result = true
id = generateRandomID() id = generateRandomID()
@ -208,7 +206,7 @@ proc nimbus_delete_keypair(id: Identifier): bool
result = whisperKeys.asymKeys.take(id.toHex(), unneeded) result = whisperKeys.asymKeys.take(id.toHex(), unneeded)
proc nimbus_get_private_key(id: Identifier, privateKey: var PrivateKey): proc nimbus_get_private_key(id: Identifier, privateKey: var PrivateKey):
bool {.exportc, dynlib, raises: [OSError, IOError, ValueError].} = bool {.exportc, dynlib, raises: [OSError, IOError, ValueError, Exception].} =
doAssert(not (unsafeAddr id).isNil, "Key id cannot be nil.") doAssert(not (unsafeAddr id).isNil, "Key id cannot be nil.")
doAssert(not (unsafeAddr privateKey).isNil, "Private key cannot be nil.") doAssert(not (unsafeAddr privateKey).isNil, "Private key cannot be nil.")
@ -256,7 +254,7 @@ proc nimbus_delete_symkey(id: Identifier): bool
result = whisperKeys.symKeys.take(id.toHex(), unneeded) result = whisperKeys.symKeys.take(id.toHex(), unneeded)
proc nimbus_get_symkey(id: Identifier, symKey: var SymKey): proc nimbus_get_symkey(id: Identifier, symKey: var SymKey):
bool {.exportc, dynlib, raises: [Defect].} = bool {.exportc, dynlib, raises: [Defect, Exception].} =
doAssert(not (unsafeAddr id).isNil, "Key id cannot be nil.") doAssert(not (unsafeAddr id).isNil, "Key id cannot be nil.")
doAssert(not (unsafeAddr symKey).isNil, "Symmetric key cannot be nil.") doAssert(not (unsafeAddr symKey).isNil, "Symmetric key cannot be nil.")