Skip to content

Commit 185db23

Browse files
author
Dmitry Voronov
committed
Merge branch 'develop' into feature/ETCM-129-scala-point-13
2 parents b9e10cc + c069d08 commit 185db23

File tree

15 files changed

+73
-22
lines changed

15 files changed

+73
-22
lines changed

build.sbt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,10 @@ lazy val node = {
195195
mappings in Universal ++= directory((resourceDirectory in Compile).value / "chains").map { case (f, name) =>
196196
f -> s"conf/$name"
197197
},
198-
jdkPackagerJVMArgs := Seq(
199-
"-Dconfig.file=." + sep + "conf" + sep + "app.conf",
200-
"-Dlogback.configurationFile=." + sep + "conf" + sep + "logback.xml",
201-
"-Xss10M"
202-
)
198+
bashScriptExtraDefines += """addJava "-Dconfig.file=${app_home}/../conf/app.conf"""",
199+
bashScriptExtraDefines += """addJava "-Dlogback.configurationFile=${app_home}/../conf/logback.xml"""",
200+
batScriptExtraDefines += """call :add_java "-Dconfig.file=%APP_HOME%\conf\app.conf"""",
201+
batScriptExtraDefines += """call :add_java "-Dlogback.configurationFile=%APP_HOME%\conf\logback.xml""""
203202
)
204203

205204
if (!nixBuild)

src/main/resources/application.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ mantis {
597597
}
598598

599599
async {
600-
ask-timeout = 100.millis
600+
ask-timeout = 1.second
601601

602602
dispatchers {
603603
block-forger {

src/main/scala/io/iohk/ethereum/App.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ object App extends Logger {
3535
case Some(`cli`) => CliLauncher.main(args.tail)
3636
case Some(unknown) =>
3737
log.error(
38-
s"Unrecognised launcher option, " +
38+
s"Unrecognised launcher option $unknown, " +
3939
s"first parameter must be $launchKeytool, $downloadBootstrap, $launchMantis, " +
4040
s"$faucet, $vmServer, $ecKeyGen, $sigValidator or $cli"
4141
)

src/main/scala/io/iohk/ethereum/consensus/Consensus.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,15 @@ trait Consensus {
6060
*/
6161
def stopProtocol(): Unit
6262

63+
/**
64+
* Sends msg to the internal miner and waits for the response
65+
*/
66+
def askMiner(msg: MinerProtocol): Task[MinerResponse]
67+
6368
/**
6469
* Sends msg to the internal miner
6570
*/
66-
def sendMiner(msg: MinerProtocol): Task[MinerResponse]
71+
def sendMiner(msg: MinerProtocol): Unit
6772
}
6873

6974
/**

src/main/scala/io/iohk/ethereum/consensus/ethash/EthashConsensus.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ class EthashConsensus private (
5252

5353
private implicit val timeout: Timeout = 5.seconds
5454

55-
override def sendMiner(msg: MinerProtocol): Task[MinerResponse] = {
55+
override def sendMiner(msg: MinerProtocol): Unit = {
56+
atomicMiner
57+
.get()
58+
.foreach(_ ! msg)
59+
}
60+
61+
override def askMiner(msg: MinerProtocol): Task[MinerResponse] = {
5662
atomicMiner
5763
.get()
5864
.map(_.askFor[MinerResponse](msg))
@@ -67,8 +73,6 @@ class EthashConsensus private (
6773
case MockedPow => MockedMiner(node)
6874
}
6975
atomicMiner.set(Some(miner))
70-
// Just create the Task which comes fromFuture (will start executing eagerly)
71-
// Should runAsyncAndForget to be more explicit, but don't want to add a Scheduler dependency
7276
sendMiner(MinerProtocol.StartMining)
7377

7478
case _ =>

src/main/scala/io/iohk/ethereum/jsonrpc/QAService.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class QAService(
3333
*/
3434
def mineBlocks(req: MineBlocksRequest): ServiceResponse[MineBlocksResponse] = {
3535
consensus
36-
.sendMiner(MineBlocks(req.numBlocks, req.withTransactions, req.parentBlock))
36+
.askMiner(MineBlocks(req.numBlocks, req.withTransactions, req.parentBlock))
3737
.map(_ |> (MineBlocksResponse(_)) |> (_.asRight))
3838
.onErrorHandle { throwable =>
3939
log.warn("Unable to mine requested blocks", throwable)

src/main/scala/io/iohk/ethereum/testmode/TestmodeConsensus.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,15 @@ class TestmodeConsensus(
8383
override def startProtocol(node: Node): Unit = {}
8484
override def stopProtocol(): Unit = {}
8585

86+
/**
87+
* Sends msg to the internal miner and waits for the response
88+
*/
89+
override def askMiner(msg: MinerProtocol): Task[MinerResponse] = Task.now(MinerNotExist)
90+
8691
/**
8792
* Sends msg to the internal miner
8893
*/
89-
override def sendMiner(msg: MinerProtocol): Task[MinerResponse] = Task.now(MinerNotExist)
94+
override def sendMiner(msg: MinerProtocol): Unit = {}
9095
}
9196

9297
trait TestmodeConsensusBuilder extends ConsensusBuilder {

src/test/scala/io/iohk/ethereum/jsonrpc/QAServiceSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class QAServiceSpec
2525

2626
"QAService" should "send msg to miner and return miner's response" in testCaseM { fixture =>
2727
import fixture._
28-
(testConsensus.sendMiner _)
28+
(testConsensus.askMiner _)
2929
.expects(mineBlocksMsg)
3030
.returning(Task.now(MiningOrdered))
3131
.atLeastOnce()
@@ -35,7 +35,7 @@ class QAServiceSpec
3535

3636
it should "send msg to miner and return InternalError in case of problems" in testCaseM { fixture =>
3737
import fixture._
38-
(testConsensus.sendMiner _)
38+
(testConsensus.askMiner _)
3939
.expects(mineBlocksMsg)
4040
.returning(Task.raiseError(new ClassCastException("error")))
4141
.atLeastOnce()

src/universal/bin/eckeygen.bat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@echo off
2+
3+
cd "%~dp0\.."
4+
5+
call bin\mantis.bat eckeygen %*

src/universal/bin/faucet-server.bat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@echo off
2+
3+
cd "%~dp0\.."
4+
5+
call bin\mantis.bat faucet %*

src/universal/bin/mantis-launcher

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
44
cd $DIR/..
55

6-
chain="$1"
7-
if [ -z "$chain" ]
8-
then
9-
echo "You need to choose chain"
10-
else
6+
CONFIG_FILE="./conf/$1.conf"
7+
if [ -f "$CONFIG_FILE" ]; then
118
shift
12-
./bin/mantis -Dconfig.file=./conf/"$chain".conf "$@"
9+
CHAIN_PARAM="-Dconfig.file=$CONFIG_FILE"
1310
fi
11+
12+
./bin/mantis ${CHAIN_PARAM:+"$CHAIN_PARAM"} "$@"

src/universal/bin/mantis-launcher.bat

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@echo off
2+
3+
cd "%~dp0\.."
4+
5+
set "CONFIG_FILE=conf\%1.conf"
6+
set "RESTVAR=%*"
7+
8+
if not exist %CONFIG_FILE% goto :skip
9+
set "CHAIN_PARAM=-Dconfig.file=%CONFIG_FILE%"
10+
set RESTVAR=
11+
shift
12+
:loop
13+
if "%1"=="" goto skip
14+
set RESTVAR=%RESTVAR% %1
15+
shift
16+
goto loop
17+
18+
:skip
19+
call bin\mantis.bat %CHAIN_PARAM% %RESTVAR%

src/universal/bin/mantis-vm.bat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@echo off
2+
3+
cd "%~dp0\.."
4+
5+
call bin\mantis.bat vm-server %*
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@echo off
2+
3+
cd "%~dp0\.."
4+
5+
call bin\mantis.bat signature-validator %*

src/universal/conf/application.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-Dconfig.file=./conf/app.conf -Dlogback.configurationFile=./conf/logback.xml -J-Xmx4g -J-Xss10M
1+
-J-Xmx4g -J-Xss10M

0 commit comments

Comments
 (0)