Compile Nimbus with Nim 1.2

This commit is contained in:
Zahary Karadjov 2020-03-25 20:00:04 +02:00
parent 7a721c58af
commit 3fc3ba925e
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
8 changed files with 27 additions and 29 deletions

View File

@ -32,28 +32,15 @@ type
NimbusState = enum
Starting, Running, Stopping, Stopped
NimbusObject = ref object
NimbusNode = ref object
rpcServer*: RpcHttpServer
ethNode*: EthereumNode
state*: NimbusState
var nimbus: NimbusObject
proc start() =
proc start(nimbus: NimbusNode) =
var conf = getConfiguration()
nimbus = NimbusObject()
nimbus.state = Starting
## Ctrl+C handling
proc controlCHandler() {.noconv.} =
when defined(windows):
# workaround for https://github.com/nim-lang/Nim/issues/4057
setupForeignThreadGc()
nimbus.state = Stopping
echo "\nCtrl+C pressed. Waiting for a graceful shutdown."
setControlCHook(controlCHandler)
## logging
setLogLevel(conf.debug.logLevel)
if len(conf.debug.logFile) != 0:
@ -113,7 +100,7 @@ proc start() =
if canonicalHeadHashKey().toOpenArray notin trieDB:
initializeEmptyDb(chainDb)
doAssert(canonicalHeadHashKey().toOpenArray in trieDB)
nimbus.ethNode = newEthereumNode(keypair, address, conf.net.networkId,
nil, nimbusClientId,
addAllCapabilities = false,
@ -145,7 +132,7 @@ proc start() =
nimbus.state = Stopping
result = "EXITING"
nimbus.rpcServer.start()
# metrics server
when defined(insecure):
if conf.net.metricsServer:
@ -171,13 +158,13 @@ proc start() =
# it might have been set to "Stopping" with Ctrl+C
nimbus.state = Running
proc stop*() {.async.} =
proc stop*(nimbus: NimbusNode) {.async, gcsafe.} =
trace "Graceful shutdown"
var conf = getConfiguration()
if RpcFlags.Enabled in conf.rpc.flags:
nimbus.rpcServer.stop()
proc process*() =
proc process*(nimbus: NimbusNode) =
if nimbus.state == Running:
# Main loop
while nimbus.state == Running:
@ -187,9 +174,20 @@ proc process*() =
debug "Exception in poll()", exc = e.name, err = e.msg
# Stop loop
waitFor stop()
waitFor nimbus.stop()
when isMainModule:
var nimbus = NimbusNode()
## Ctrl+C handling
proc controlCHandler() {.noconv.} =
when defined(windows):
# workaround for https://github.com/nim-lang/Nim/issues/4057
setupForeignThreadGc()
nimbus.state = Stopping
echo "\nCtrl+C pressed. Waiting for a graceful shutdown."
setControlCHook(controlCHandler)
var message: string
## Print Nimbus header
@ -207,6 +205,6 @@ when isMainModule:
echo message
quit(QuitSuccess)
start()
process()
nimbus.start()
nimbus.process()

@ -1 +1 @@
Subproject commit 81aebe6a8955b9c6c598aaf36d2c3ff8edc0e5fa
Subproject commit 8da0e30c526ab1c6c825e16546fc5db972c5408d

2
vendor/nim-chronos vendored

@ -1 +1 @@
Subproject commit c39c0696806a0ef09bc90e477ea6b177d2824699
Subproject commit f3827a13d12f27e20874df81dc99b55e5dc78244

2
vendor/nim-eth vendored

@ -1 +1 @@
Subproject commit 9c442bf65b52a4c857cc6e51efe901352e8b6ebf
Subproject commit c3f23e5912efff98fc6c8181db579037e5a19a2c

2
vendor/nim-json-rpc vendored

@ -1 +1 @@
Subproject commit 09f6fd63556a22312af7c5a7e3fa105b26897316
Subproject commit 5c0d0961114bcaaf3da52d5918bf0b85ef0e4ce9

@ -1 +1 @@
Subproject commit 88b79e230005d8301c3ae950abdbf8ad55e37f19
Subproject commit c108ba90e6b304515f08fdcff62f428f3f8fbe53

@ -1 +1 @@
Subproject commit ae60eef4e8413e49fb0dbcae9a343fb479509fa0
Subproject commit 0eab8cfeee55cfa3bb893ec31137d3c25b83a1ae

@ -1 +1 @@
Subproject commit 2c4faa5372d2d8b0c2d16710fe5f93beab1c86af
Subproject commit 53c12ddae315731f5cd4d1d71fff57b4836a9c2d