Skip to content

Commit d99280a

Browse files
committed
Merge remote-tracking branch 'origin/develop' into etcm-260/tweak-network-configs
2 parents 45f1278 + 69932a3 commit d99280a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1408
-232
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,23 @@ Example:
2929

3030
Possible networks: `etc`, `eth`, `mordor`, `testnet-internal`
3131

32+
### Command Line Interface
33+
34+
`cli` is a tool that can be used to:
35+
36+
- generate a new private key
37+
```
38+
./bin/mantis cli generate-private-key
39+
```
40+
- derive an address from private key
41+
```
42+
./bin/mantis cli derive-address 00b11c32957057651d56cd83085ef3b259319057e0e887bd0fdaee657e6f75d0
43+
```
44+
- generate genesis allocs (using private keys and/or addresses)
45+
```
46+
`./bin/mantis cli generate-alloc --balance=42 --address=8b196738d90cf3d9fc299e0ec28e15ebdcbb0bdcb281d9d5084182c9c66d5d12 --key=00b11c32957057651d56cd83085ef3b259319057e0e887bd0fdaee657e6f75d1`
47+
```
48+
3249
### Building the client
3350

3451
#### SBT
@@ -86,7 +103,7 @@ This patch will update the lock files for you.
86103

87104
- `repo.nix` : generated by the `sbtix-gen` command and includes only the build dependencies for the project.
88105
- `project/repo.nix` : generated by the `sbtix-gen-all` command and includes only the plugin dependencies. Also generates `repo.nix`.
89-
- `project/project/repo.nix` : generated by the `sbtix-gen-all2` command and includes only the pluginplugin dependencies. Also generates `repo.nix` and `project/repo.nix`.
106+
- `project/project/repo.nix` : generated by the `sbtix-gen-all2` command and includes only the plugin dependencies. Also generates `repo.nix` and `project/repo.nix`.
90107

91108
##### error: unsupported argument 'submodules' to 'fetchGit'
92109

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ val dep = {
4242
Dependencies.apacheCommons,
4343
Dependencies.micrometer,
4444
Dependencies.prometheus,
45+
Dependencies.cli,
4546
Dependencies.dependencies
4647
).flatten ++ malletDeps
4748
}

insomnia_workspace.json

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,102 @@
139139
"metaSortKey": -1600249374160,
140140
"_type": "request_group"
141141
},
142+
{
143+
"_id": "req_3ae9151dec5b4046b06fdb3408e9ab1f",
144+
"authentication": {},
145+
"body": {
146+
"mimeType": "application/json",
147+
"text": "{\n\t\"jsonrpc\": \"2.0\",\n\t\"id\": 1,\n\t\"method\": \"qa_generateCheckpoint\",\n\t\"params\": [\t\t[\"0x926db397ed35bedee660fe5bf6879679fa71f1fe8c27823f7f6a1e5d96a49b94\"], \"0xe160bdd7664e1b921612a4ed225321bdf3b8f70beb6b968c7a423d6022e39e16\"\n\t]\n}"
148+
},
149+
"created": 1572007151716,
150+
"description": "",
151+
"headers": [
152+
{
153+
"id": "pair_6f2ea2de85ee4eabbbd25bde888e9dc1",
154+
"name": "Content-Type",
155+
"value": "application/json"
156+
}
157+
],
158+
"isPrivate": false,
159+
"metaSortKey": -1566535778023.25,
160+
"method": "POST",
161+
"modified": 1572263390995,
162+
"name": "qa_generateCheckpoint",
163+
"parameters": [],
164+
"parentId": "fld_2b54cbb84e244284b3ef752c5f805376",
165+
"settingDisableRenderRequestBody": false,
166+
"settingEncodeUrl": true,
167+
"settingFollowRedirects": "global",
168+
"settingRebuildPath": true,
169+
"settingSendCookies": true,
170+
"settingStoreCookies": true,
171+
"url": "{{ node_url }}",
172+
"_type": "request"
173+
},
174+
{
175+
"_id": "req_e1287e4fcba348eea9d326bb208092c3",
176+
"authentication": {},
177+
"body": {
178+
"mimeType": "application/json",
179+
"text": "{\n\t\"jsonrpc\": \"2.0\",\n\t\"id\": 1,\n\t\"method\": \"qa_generateCheckpoint\",\n\t\"params\": [\t\t[\"0x926db397ed35bedee660fe5bf6879679fa71f1fe8c27823f7f6a1e5d96a49b94\"]\n\t]\n}"
180+
},
181+
"created": 1573216065706,
182+
"description": "",
183+
"headers": [
184+
{
185+
"id": "pair_6f2ea2de85ee4eabbbd25bde888e9dc1",
186+
"name": "Content-Type",
187+
"value": "application/json"
188+
}
189+
],
190+
"isPrivate": false,
191+
"metaSortKey": -1566394039140.875,
192+
"method": "POST",
193+
"modified": 1573216279799,
194+
"name": "qa_generateCheckpoint (for latest block)",
195+
"parameters": [],
196+
"parentId": "fld_2b54cbb84e244284b3ef752c5f805376",
197+
"settingDisableRenderRequestBody": false,
198+
"settingEncodeUrl": true,
199+
"settingFollowRedirects": "global",
200+
"settingRebuildPath": true,
201+
"settingSendCookies": true,
202+
"settingStoreCookies": true,
203+
"url": "{{ node_url }}",
204+
"_type": "request"
205+
},
206+
{
207+
"_id": "req_f2986c964bf74360878144213ca342a7",
208+
"authentication": {},
209+
"body": {
210+
"mimeType": "application/json",
211+
"text": "{\n\t\"jsonrpc\": \"2.0\",\n\t\"id\": 1,\n\t\"method\": \"qa_getFederationMembersInfo\",\n\t\"params\": []\n}"
212+
},
213+
"created": 1573042743181,
214+
"description": "",
215+
"headers": [
216+
{
217+
"id": "pair_ba5a5914f02a4b27b86a330054582828",
218+
"name": "Content-Type",
219+
"value": "application/json"
220+
}
221+
],
222+
"isPrivate": false,
223+
"metaSortKey": -1568046037126,
224+
"method": "POST",
225+
"modified": 1573042783130,
226+
"name": "qa_getFederationMembersInfo",
227+
"parameters": [],
228+
"parentId": "fld_2b54cbb84e244284b3ef752c5f805376",
229+
"settingDisableRenderRequestBody": false,
230+
"settingEncodeUrl": true,
231+
"settingFollowRedirects": "global",
232+
"settingRebuildPath": true,
233+
"settingSendCookies": true,
234+
"settingStoreCookies": true,
235+
"url": "{{ node_url }}",
236+
"_type": "request"
237+
},
142238
{
143239
"_id": "req_dd6e5c718f974407bb79fe3c953b7106",
144240
"parentId": "fld_72829b866f0441e184e0d1a2030f8220",
@@ -1124,4 +1220,4 @@
11241220
"_type": "environment"
11251221
}
11261222
]
1127-
}
1223+
}

project/Dependencies.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ object Dependencies {
8383

8484
val scopt = Seq("com.github.scopt" % "scopt_2.12" % "3.7.1")
8585

86+
val cli = Seq("com.monovore" %% "decline" % "1.3.0")
87+
8688
val apacheCommons = Seq(
8789
"commons-io" % "commons-io" % "2.8.0"
8890
)

repo.nix

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,22 @@
784784
url = "https://repo1.maven.org/maven2/com/miguno/akka/akka-mock-scheduler_2.12/0.5.5/akka-mock-scheduler_2.12-0.5.5.pom";
785785
sha256 = "00641F962CB8D1BED3C64FFA635CB0562DFD6D52A9B5DD614536EAC864CBD948";
786786
};
787+
"nix-public/com/monovore/decline_2.12/1.3.0/decline_2.12-1.3.0-javadoc.jar" = {
788+
url = "https://repo1.maven.org/maven2/com/monovore/decline_2.12/1.3.0/decline_2.12-1.3.0-javadoc.jar";
789+
sha256 = "9D0962E8AAB7D02EB20B50C428C9D7044B6886E8436FABFC2571DE22E5BD909E";
790+
};
791+
"nix-public/com/monovore/decline_2.12/1.3.0/decline_2.12-1.3.0-sources.jar" = {
792+
url = "https://repo1.maven.org/maven2/com/monovore/decline_2.12/1.3.0/decline_2.12-1.3.0-sources.jar";
793+
sha256 = "1554EA9939430010D27F9EAF22BFA770402F14C33CFAEF6DB52FCD79FA176EA2";
794+
};
795+
"nix-public/com/monovore/decline_2.12/1.3.0/decline_2.12-1.3.0.jar" = {
796+
url = "https://repo1.maven.org/maven2/com/monovore/decline_2.12/1.3.0/decline_2.12-1.3.0.jar";
797+
sha256 = "F2854BF74AE59AB7E19745CA312181DF3EFA2A1A3DA796E8FEC41E2B9C870FB4";
798+
};
799+
"nix-public/com/monovore/decline_2.12/1.3.0/decline_2.12-1.3.0.pom" = {
800+
url = "https://repo1.maven.org/maven2/com/monovore/decline_2.12/1.3.0/decline_2.12-1.3.0.pom";
801+
sha256 = "8806217334913555CE9E8F844EA4561767CD850457945E552838F1B2F85A9C86";
802+
};
787803
"nix-public/com/squareup/okhttp3/logging-interceptor/4.3.1/logging-interceptor-4.3.1-javadoc.jar" = {
788804
url = "https://repo1.maven.org/maven2/com/squareup/okhttp3/logging-interceptor/4.3.1/logging-interceptor-4.3.1-javadoc.jar";
789805
sha256 = "1FDD287ADDB6301F3D16274ADBDF55C7129E2C675DA61EF087A62740EAB49EAF";

src/ets/scala/io/iohk/ethereum/ets/blockchain/ScenarioSetup.scala

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ import scala.util.{Failure, Success, Try}
2323
object ScenarioSetup {
2424
val testContext = ExecutionContext.fromExecutor(Executors.newFixedThreadPool(4))
2525
val specificConfig = ethash.EthashConfig(Config.config)
26-
val fullConfig = FullConsensusConfig(ConsensusConfig(Config.config)(null), specificConfig)
27-
28-
def loadEthashConsensus(vm: VMImpl, blockchain: BlockchainImpl, blockchainConfig: BlockchainConfig, validators: ValidatorsExecutor): ethash.EthashConsensus = {
26+
val fullConfig = FullConsensusConfig(ConsensusConfig(Config.config), specificConfig)
27+
28+
def loadEthashConsensus(
29+
vm: VMImpl,
30+
blockchain: BlockchainImpl,
31+
blockchainConfig: BlockchainConfig,
32+
validators: ValidatorsExecutor
33+
): ethash.EthashConsensus = {
2934
val consensus = EthashConsensus(vm, blockchain, blockchainConfig, fullConfig, validators)
3035
consensus
3136
}
@@ -34,7 +39,6 @@ object ScenarioSetup {
3439
override val pruningMode: PruningMode = ArchivePruning
3540
}
3641

37-
3842
def getBlockchain: BlockchainImpl = {
3943
val storagesInstance = new EphemDataSourceComponent with Pruning with Storages.DefaultStorages
4044
BlockchainImpl(storagesInstance.storages)
@@ -61,21 +65,28 @@ abstract class ScenarioSetup(_vm: VMImpl, scenario: BlockchainScenario) {
6165
val ledger =
6266
new LedgerImpl(
6367
blockchain,
64-
new BlockQueue(blockchain, 50, 50), blockchainConfig, consensus, ScenarioSetup.testContext)
68+
new BlockQueue(blockchain, 50, 50),
69+
blockchainConfig,
70+
consensus,
71+
ScenarioSetup.testContext
72+
)
6573

6674
def loadGenesis(): Block = {
6775
val genesisBlock = scenario.genesisRLP match {
6876
case Some(rlp) =>
6977
val block = rlp.toArray.toBlock
70-
assert(block.header == scenario.genesisBlockHeader.toBlockHeader,
71-
"decoded genesis block header did not match the expectation")
78+
assert(
79+
block.header == scenario.genesisBlockHeader.toBlockHeader,
80+
"decoded genesis block header did not match the expectation"
81+
)
7282
block
7383

7484
case None =>
7585
Block(scenario.genesisBlockHeader.toBlockHeader, BlockBody(Nil, Nil))
7686
}
7787

78-
blockchain.storeBlock(genesisBlock)
88+
blockchain
89+
.storeBlock(genesisBlock)
7990
.and(blockchain.storeReceipts(genesisBlock.header.hash, Nil))
8091
.and(blockchain.storeTotalDifficulty(genesisBlock.header.hash, genesisBlock.header.difficulty))
8192
.commit()
@@ -85,7 +96,8 @@ abstract class ScenarioSetup(_vm: VMImpl, scenario: BlockchainScenario) {
8596

8697
val initialWorld: InMemoryWorldStateProxy = InMemoryWorldStateProxy.persistState(getWorldState(scenario.pre))
8798

88-
val finalWorld: Option[InMemoryWorldStateProxy] = scenario.postState.map(postState => InMemoryWorldStateProxy.persistState(getWorldState(postState)))
99+
val finalWorld: Option[InMemoryWorldStateProxy] =
100+
scenario.postState.map(postState => InMemoryWorldStateProxy.persistState(getWorldState(postState)))
89101

90102
def getBestBlock: Option[Block] = {
91103
val bestBlockNumber = blockchain.getBestBlockNumber()
@@ -123,23 +135,25 @@ abstract class ScenarioSetup(_vm: VMImpl, scenario: BlockchainScenario) {
123135
case _ => (FrontierConfig, Validators.frontierValidators)
124136
}
125137

126-
private def withSkippedPoWValidationBlockchainConfig(network: String): (BlockchainConfig, ValidatorsExecutor) = network match {
127-
case "EIP150" => (Eip150Config, ValidatorsWithSkippedPoW.eip150Validators)
128-
case "Frontier" => (FrontierConfig, ValidatorsWithSkippedPoW.frontierValidators)
129-
case "Homestead" => (HomesteadConfig, ValidatorsWithSkippedPoW.homesteadValidators)
130-
case "FrontierToHomesteadAt5" => (FrontierToHomesteadAt5, ValidatorsWithSkippedPoW.frontierToHomesteadValidators)
131-
case "HomesteadToEIP150At5" => (HomesteadToEIP150At5, ValidatorsWithSkippedPoW.homesteadToEipValidators)
132-
case "EIP158" => (Eip158Config, ValidatorsWithSkippedPoW.eip158Validators)
133-
case "HomesteadToDaoAt5" => (HomesteadToDaoAt5, ValidatorsWithSkippedPoW.homesteadToDaoValidators)
134-
case "Byzantium" => (ByzantiumConfig, ValidatorsWithSkippedPoW.byzantiumValidators)
135-
case "Constantinople" => (ConstantinopleConfig, ValidatorsWithSkippedPoW.constantinopleValidators)
136-
case "EIP158ToByzantiumAt5" => (Eip158ToByzantiumAt5Config, ValidatorsWithSkippedPoW.eip158ToByzantiumValidators)
137-
case "ByzantiumToConstantinopleFixAt5" => (ByzantiumToConstantinopleAt5, ValidatorsWithSkippedPoW.byzantiumToConstantinopleAt5)
138-
case "ConstantinopleFix" => (ConstantinopleFixConfig, ValidatorsWithSkippedPoW.constantinopleFixValidators)
139-
case "Istanbul" => (IstanbulConfig, ValidatorsWithSkippedPoW.istanbulValidators)
140-
// Some default config, test will fail or be canceled
141-
case _ => (FrontierConfig, ValidatorsWithSkippedPoW.frontierValidators)
142-
}
138+
private def withSkippedPoWValidationBlockchainConfig(network: String): (BlockchainConfig, ValidatorsExecutor) =
139+
network match {
140+
case "EIP150" => (Eip150Config, ValidatorsWithSkippedPoW.eip150Validators)
141+
case "Frontier" => (FrontierConfig, ValidatorsWithSkippedPoW.frontierValidators)
142+
case "Homestead" => (HomesteadConfig, ValidatorsWithSkippedPoW.homesteadValidators)
143+
case "FrontierToHomesteadAt5" => (FrontierToHomesteadAt5, ValidatorsWithSkippedPoW.frontierToHomesteadValidators)
144+
case "HomesteadToEIP150At5" => (HomesteadToEIP150At5, ValidatorsWithSkippedPoW.homesteadToEipValidators)
145+
case "EIP158" => (Eip158Config, ValidatorsWithSkippedPoW.eip158Validators)
146+
case "HomesteadToDaoAt5" => (HomesteadToDaoAt5, ValidatorsWithSkippedPoW.homesteadToDaoValidators)
147+
case "Byzantium" => (ByzantiumConfig, ValidatorsWithSkippedPoW.byzantiumValidators)
148+
case "Constantinople" => (ConstantinopleConfig, ValidatorsWithSkippedPoW.constantinopleValidators)
149+
case "EIP158ToByzantiumAt5" => (Eip158ToByzantiumAt5Config, ValidatorsWithSkippedPoW.eip158ToByzantiumValidators)
150+
case "ByzantiumToConstantinopleFixAt5" =>
151+
(ByzantiumToConstantinopleAt5, ValidatorsWithSkippedPoW.byzantiumToConstantinopleAt5)
152+
case "ConstantinopleFix" => (ConstantinopleFixConfig, ValidatorsWithSkippedPoW.constantinopleFixValidators)
153+
case "Istanbul" => (IstanbulConfig, ValidatorsWithSkippedPoW.istanbulValidators)
154+
// Some default config, test will fail or be canceled
155+
case _ => (FrontierConfig, ValidatorsWithSkippedPoW.frontierValidators)
156+
}
143157

144158
private def decode(s: String): Array[Byte] = {
145159
val stripped = s.replaceFirst("^0x", "")
@@ -152,7 +166,7 @@ abstract class ScenarioSetup(_vm: VMImpl, scenario: BlockchainScenario) {
152166
case Success(block) =>
153167
Some(block)
154168

155-
case Failure(ex) =>
169+
case Failure(ex) =>
156170
ex.printStackTrace()
157171
None
158172
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.iohk.ethereum
22

3+
import io.iohk.ethereum.cli.CliLauncher
34
import io.iohk.ethereum.crypto.EcKeyGen
45
import io.iohk.ethereum.extvm.VmServerApp
56
import io.iohk.ethereum.faucet.Faucet
@@ -17,6 +18,7 @@ object App extends Logger {
1718
val mallet = "mallet"
1819
val faucet = "faucet"
1920
val ecKeyGen = "eckeygen"
21+
val cli = "cli"
2022

2123
args.headOption match {
2224
case None => Mantis.main(args)
@@ -31,11 +33,12 @@ object App extends Logger {
3133
case Some(`mallet`) => Mallet.main(args.tail)
3234
case Some(`faucet`) => Faucet.main(args.tail)
3335
case Some(`ecKeyGen`) => EcKeyGen.main(args.tail)
36+
case Some(`cli`) => CliLauncher.main(args.tail)
3437
case Some(unknown) =>
3538
log.error(
3639
s"Unrecognised launcher option, " +
3740
s"first parameter must be $launchKeytool, $downloadBootstrap, $launchMantis, " +
38-
s"$mallet, $faucet, $vmServer or $ecKeyGen"
41+
s"$mallet, $faucet, $vmServer, $ecKeyGen or $cli"
3942
)
4043
}
4144

src/main/scala/io/iohk/ethereum/blockchain/sync/SyncController.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package io.iohk.ethereum.blockchain.sync
22

33
import akka.actor.{Actor, ActorLogging, ActorRef, PoisonPill, Props, Scheduler}
44
import io.iohk.ethereum.blockchain.sync.regular.RegularSync
5+
import io.iohk.ethereum.consensus.blocks.CheckpointBlockGenerator
56
import io.iohk.ethereum.consensus.validators.Validators
67
import io.iohk.ethereum.db.storage.{AppStateStorage, FastSyncStateStorage}
78
import io.iohk.ethereum.domain.Blockchain
@@ -16,6 +17,7 @@ class SyncController(
1617
validators: Validators,
1718
peerEventBus: ActorRef,
1819
pendingTransactionsManager: ActorRef,
20+
checkpointBlockGenerator: CheckpointBlockGenerator,
1921
ommersPool: ActorRef,
2022
etcPeerManager: ActorRef,
2123
syncConfig: SyncConfig,
@@ -102,6 +104,7 @@ class SyncController(
102104
syncConfig,
103105
ommersPool,
104106
pendingTransactionsManager,
107+
checkpointBlockGenerator,
105108
scheduler
106109
),
107110
"regular-sync"
@@ -122,6 +125,7 @@ object SyncController {
122125
validators: Validators,
123126
peerEventBus: ActorRef,
124127
pendingTransactionsManager: ActorRef,
128+
checkpointBlockGenerator: CheckpointBlockGenerator,
125129
ommersPool: ActorRef,
126130
etcPeerManager: ActorRef,
127131
syncConfig: SyncConfig
@@ -135,6 +139,7 @@ object SyncController {
135139
validators,
136140
peerEventBus,
137141
pendingTransactionsManager,
142+
checkpointBlockGenerator,
138143
ommersPool,
139144
etcPeerManager,
140145
syncConfig

0 commit comments

Comments
 (0)