Contract artifacts were not being generated nor run through the VM if the contracts/interfaces were not deployed. These features were executed as actions on the `deployment:contract:deployed` event.
This PR runs executes the same actions for `deployment:contract:undeployed` event as the `deployment:contract:deployed` event, which occurs when a contract is not deployed.
* add web3 connection
* add TODO
* refactor(@embark/embark-swarm): Re-add swarm storage plugin
Swarm added back in to the refactored code.
Prevent Embark from hanging when Swarm/IPFS crashes.
Use swarm config as per below
To take this PR for a spin, update `dapps/templates/demo/config/storage.js` with the following:
```
module.exports = {
// default applies to all environments
default: {
enabled: true,
ipfs_bin: "ipfs",
available_providers: ["ipfs", "swarm"],
upload: {
provider: "swarm",
host: "localhost",
port: 8500
},
dappConnection: [
{
provider: "swarm",
host: "localhost",
port: 8500,
getUrl: "http://localhost:8500/bzz:/"
}
]
// Configuration to start Swarm in the same terminal as `embark run`
, account: {
address: "SWAM_ACCOUNT_ADDRESS", // Address of account accessing Swarm
password: "config/development/password" // File containing the password of the account
},
/*swarmPath: "PATH/TO/SWARM/EXECUTABLE" // Path to swarm executable (default: swarm)*/
}
};
```
NOTE: `account.address` needs to be a node account. Please make sure `embark run2` has been run first, then create a new node account and update the config, then re-run embark.
1. `embark run2`
2. `geth account new --datadir=.embark/development/datadir --password=config/development/password`
3. Copy output from #2 to `account.address` in config
4. Re-run `embark run2`
Add unit tests for the contract tracking `embark-deploy-tracker` package.
`trackingFunctions` was refactored in a way to make it more testable and now performs tracker file IO on demand, as opposed to being executed for each contract deploy. Additionally, removed any synchronous file IO in favour of their asynchronous counterparts.
Added special case for config contract-level tracking:
when `contract.track === false` in contracts config, contracts are deployed, then the config is changed `contract.track` is truthy, a special use case is presented, and the chains.json file is updated accordingly.
Prior to this PR (including with v4), Embark would hang on a deployment error.
After this PR, Embark continues it’s run routine despite a contract deployment error, and reports the error to the user in the console appropriately.
NOTE: this branch is based on `refactor/add-contract-tracking` (which would land in https://github.com/embark-framework/embark/pull/1743). If #1743 lands (will be merged in to `refactor_5_0_0`), I will rebase this branch on top of `refactor_5_0_0`.
Add back contract tracking to the refactored code. Deployment checks are added as plugins to the `embark-deployment` module.
Adds ability to track if a contract has already been deployed, and skips deployment if so.
Updates error handling flow for deployment process.
Adds a contract class to the `embark-contracts-manager`, to add a `log` function for the contract. This `log` function can be called from any module that has the contract instance.
Adds TS interfaces for contracts configuration.
Handles the following cases:
1. Contract already deployed
2. Contract not deployed
3. Contract is configured with `{track: false}` (deploy if not deployed, and don't track)
5. Contract is configured with an `address` in the config
6. `trackContracts` set to `false` from `engine` (always deploy but don't track contracts). Currently used for the tests.
7. Contract deployment produces an error
8. Interface deployment shows warning.
PR with unit tests and documenation to follow.
# Conflicts:
# packages/embark/src/lib/modules/ethereum-blockchain-client/index.js
Add back contract tracking to the refactored code. Deployment checks are added as plugins to the `embark-deployment` module.
Adds ability to track if a contract has already been deployed, and skips deployment if so.
Updates error handling flow for deployment process.
Adds a contract class to the `embark-contracts-manager`, to add a `log` function for the contract. This `log` function can be called from any module that has the contract instance.
Adds TS interfaces for contracts configuration.
Handles the following cases:
1. Contract already deployed
2. Contract not deployed
3. Contract is configured with `{track: false}` (deploy if not deployed, and don't track)
5. Contract is configured with an `address` in the config
6. `trackContracts` set to `false` from `engine` (always deploy but don't track contracts). Currently used for the tests.
7. Contract deployment produces an error
8. Interface deployment shows warning.
PR with unit tests and documenation to follow.