Skip to content

Commit cd934f8

Browse files
committed
feat(@embark/blockchain): make GanacheCLI the default dev blockchain
Set Ganache as a blockchain client that doesn't need to be started. Set it as the default client, at least for development. Move all blockchain related stuff in the blockchain component Includes a fix by @emmizle to fix the WS connection in the proxy
1 parent b2f670b commit cd934f8

File tree

28 files changed

+218
-426
lines changed

28 files changed

+218
-426
lines changed

dapps/templates/boilerplate/config/blockchain.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ module.exports = {
44
// default applies to all environments
55
default: {
66
enabled: true,
7-
client: "geth" // Can be geth or parity (default:geth)
7+
client: "geth" // Can be ganache-cli, geth or parity (default: geth)
88
},
99

1010
development: {
11+
client: 'ganache-cli',
1112
clientConfig: {
1213
miningMode: 'dev' // Mode in which the node mines. Options: dev, auto, always, off
1314
}

dapps/templates/demo/config/blockchain.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ module.exports = {
44
// default applies to all environments
55
default: {
66
enabled: true,
7-
client: "geth" // Can be geth or parity (default:geth)
7+
client: "geth" // Can be ganache-cli, geth or parity (default: geth)
88
},
99

1010
development: {
11+
client: 'ganache-cli',
1112
clientConfig: {
1213
miningMode: 'dev' // Mode in which the node mines. Options: dev, auto, always, off
1314
}

dapps/tests/app/config/blockchain.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ module.exports = {
44
// default applies to all environments
55
default: {
66
enabled: true,
7-
client: "geth" // Can be geth or parity (default:geth)
7+
client: "geth" // Can be ganache-cli, geth or parity (default: geth)
88
},
99

1010
development: {
11+
client: 'ganache-cli',
1112
clientConfig: {
1213
miningMode: 'dev' // Mode in which the node mines. Options: dev, auto, always, off
1314
},

dapps/tests/app/test/another_storage_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ config({
1212
{
1313
"mnemonic": "example exile argue silk regular smile grass bomb merge arm assist farm",
1414
balance: "5ether",
15+
hdpath: "m/44'/1'/0'/0/",
1516
numAddresses: 10
1617
}
1718
]
@@ -49,7 +50,6 @@ contract("AnotherStorage", function() {
4950

5051
for (let i = 1; i < numAddresses - 3; i++) {
5152
balance = await web3.eth.getBalance(accounts[i]);
52-
console.log('Account', i , balance);
5353
assert.strictEqual(parseInt(balance, 10), 5000000000000000000, `Account ${i} doesn't have the balance set`);
5454
}
5555
});

packages/core/core/constants.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@
4040
"call": "eth_call",
4141
"clients": {
4242
"geth": "geth",
43-
"parity": "parity"
43+
"parity": "parity",
44+
"ganache": "ganache-cli"
4445
},
46+
"defaultMnemonic": "example exile argue silk regular smile grass bomb merge arm assist farm",
4547
"blockchainReady": "blockchainReady",
4648
"blockchainExit": "blockchainExit",
4749
"defaults": {

packages/core/core/src/configDefaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function getBlockchainDefaults(env) {
2626
miningMode: 'dev' // Mode in which the node mines. Options: dev, auto, always, off
2727
},
2828
enabled: true,
29-
client: constants.blockchain.clients.geth,
29+
client: constants.blockchain.clients.ganache,
3030
proxy: true,
3131
datadir: `.embark/${env}/datadir`,
3232
rpcHost: "localhost",

packages/core/engine/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
"embark-authenticator": "^5.2.0-nightly.3",
5252
"embark-basic-pipeline": "^5.2.0-nightly.3",
5353
"embark-blockchain": "^5.2.0-nightly.3",
54-
"embark-blockchain-client": "^5.1.1",
5554
"embark-code-runner": "^5.2.0-nightly.3",
5655
"embark-communication": "^5.2.0-nightly.3",
5756
"embark-compiler": "^5.2.0-nightly.3",

packages/core/engine/src/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ export class Engine {
246246

247247
blockchainStackComponents() {
248248
this.registerModulePackage('embark-blockchain', { plugins: this.plugins, ipc: this.ipc });
249-
this.registerModulePackage('embark-blockchain-client');
250249
this.registerModulePackage('embark-process-logs-api-manager');
251250
}
252251

@@ -259,7 +258,6 @@ export class Engine {
259258
this.registerModulePackage('embark-compiler', { plugins: this.plugins, isCoverage: options.isCoverage });
260259
this.registerModulePackage('embark-contracts-manager', { plugins: this.plugins, compileOnceOnly: options.compileOnceOnly });
261260
this.registerModulePackage('embark-deployment', { plugins: this.plugins, onlyCompile: options.onlyCompile });
262-
this.registerModulePackage('embark-blockchain-client');
263261
this.registerModulePackage('embark-storage');
264262
this.registerModulePackage('embark-communication');
265263
this.registerModulePackage('embark-namesystem');
@@ -269,6 +267,7 @@ export class Engine {
269267

270268
blockchainComponents() {
271269
// plugins
270+
this.registerModulePackage('embark-ganache');
272271
this.registerModulePackage('embark-geth');
273272
this.registerModulePackage('embark-parity');
274273
}
@@ -287,7 +286,6 @@ export class Engine {
287286
}
288287

289288
contractsComponents(_options) {
290-
this.registerModulePackage('embark-ganache');
291289
this.registerModulePackage('embark-ethereum-blockchain-client');
292290
this.registerModulePackage('embark-web3');
293291
this.registerModulePackage('embark-accounts-manager');

packages/core/engine/tsconfig.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@
9494
{
9595
"path": "../../stack/blockchain"
9696
},
97-
{
98-
"path": "../../stack/blockchain-client"
99-
},
10097
{
10198
"path": "../../stack/communication"
10299
},

packages/embark/src/test/config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('embark.Config', function () {
1717
config.loadBlockchainConfigFile();
1818
let expectedConfig = {
1919
"enabled": true,
20-
"client": "geth",
20+
"client": "ganache-cli",
2121
"proxy": true,
2222
"clientConfig": {
2323
"miningMode": "dev"
@@ -54,7 +54,7 @@ describe('embark.Config', function () {
5454
it('should convert Ether units', function () {
5555
let expectedConfig = {
5656
"enabled": true,
57-
"client": "geth",
57+
"client": "ganache-cli",
5858
"proxy": true,
5959
"clientConfig": {
6060
"miningMode": "dev"
@@ -107,7 +107,7 @@ describe('embark.Config', function () {
107107
it('should accept unitless gas values', function () {
108108
let expectedConfig = {
109109
"enabled": true,
110-
"client": "geth",
110+
"client": "ganache-cli",
111111
"proxy": true,
112112
"clientConfig": {
113113
"miningMode": "dev"
@@ -160,7 +160,7 @@ describe('embark.Config', function () {
160160
it('should use the specified endpoint', () => {
161161
let expectedConfig = {
162162
"enabled": true,
163-
"client": "geth",
163+
"client": "ganache-cli",
164164
"proxy": true,
165165
"clientConfig": {
166166
"miningMode": "dev"

0 commit comments

Comments
 (0)