Regular transactions (aka “dev funds”) exist in embark as a workaround to a known bug in geth when using metamask. The workaround is to send a transaction at a regular interval (1.5s), which pushes through any transactions that were stuck. The problem is that the transaction logs and trace logs become cluttered and difficult to parse visually.
This PR disables regular transactions until the following conditions are met:
1. Embark is running geth
2. The user is running metamask in their browser
3. The user authenticates to the cockpit with `enableRegularTxs=1|true` in the query string.
A console warning is show in large letters in the browser with a link to the cockpit URL that includes the special query string to enable regular txs.
This could be extended later to have a button in the cockpit that start/stops regular txs. Or at least extended to allow disabling of regular txs once started.
Support standalone blockchain process.
Specifying large ether values in the configs was causing embark to crash as javascript could not handle the large integer after the value was converted to wei.
The fix involves converting all values to BigNumbers and then comparing and adding/subtracting BigNumbers from that point forward.
There are two specific components that this affected: `config/contracts > accounts > balance` and `config/blockchain > account > balance`. The contracts config is used to fund accounts for contract deployment while the blockchain config is used for dev_funds accounts.
JSON.stringify unknown log messages
Add a unit test in the test app that sets a large ether value in the config before contract deployment and ensures the account balance is the value specified in the config.
Prior to this commit, if subsequent unit tests contained different account configurations, the blockchain VM was essentially reset, however EmbarkJS was hanging on to the old providers it used from the previous configuation.
In addition, there is a limitation with `embark.registerActionForEvent` in that the action will be persisted across configuration changes. In our case, once the configuration was updated in a subsequent unit test, the directive subdomains would be attempted to be registered in ENS using the old configuration.
This commit does two things:
1) It resets the EmbarkJS.Blockchain and EmbarkJS.Names providers to the new chain configuration
2) Update to the ENS directives that prevents attempts at registered configured subdomains for previous configurations.
Send a message over IPC when a command is executed from the REPL so that
command history is immediately unified across `embark run` and one/more `embark
console`. Previously, for `embark console` to pick up a command entered in the
REPL of an `embark run` of which it was an IPC client it would have to be
restarted, and vice versa.
I had to eject the webpack config and add this to get any project at all to run on Windows/Git Bash without this error:
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. ││ - configuration.context: The provided value "C:/Users/xxx/GitHub/xxxxxx" is not an absolute path! ││ -> The base directory (absolute path!) for resolving the `entry` option. If `output.pathinfo` is set, the included pathinfo is shortened to this directory.
Not sure if this is the best place, but should work on any platform.
Context (Environment)
OS: Windows 10, Git Bash v2.20.0 64bit
Embark Version: 3.2.7
Node Version: 10.14.2
NPM Version: 6.4.1
Parse legacy version of Parity. Pre-version 2 of Parity outputs “Parity <version>” instead of the post-version 2 “Parity-Ethereum”. Embark was emitting an error when the version of an older Parity client could not be parsed, and no warning messages regarding the version were shown.
This PR modifies the regex that parses the version so that older versions of Parity can be detected and the appropriate warning message can appear.
This PR replaces #1202.
When embark is running on Linux and macOS, unix socket files are used for
geth's and embark's IPC files. A problem can arise if a DApp is in a deeply
nested directory structure such that character-length of the path to a socket
file exceeds the maximum supported length. See #450.
Also, if the DApp context is a Linux container running on a Windows Docker
host, and if the DApp is mounted from the host's file system, there is a
problem: unix socket files are incompatible with the Windows file system.
Solve both problems at once by storing a DApp's `.ipc` files in a directory
within `os.tmpdir()`. Introduce `ipcPath()` in `core/fs.js` and use a truncated
SHA-512 hash of the DApp's path in the name of the temporary directory created
for that purpose so that DApps won't collide (with an acceptably low
probability of collision).
Start the `embark run` dashboard after services have been started so the REPL
instantiated by the dashboard can successfully request the `console:history`
event.
Delete `cmd/dashboard/command_history.js` since it's no longer in use.
Changes in c64c093a48 resulted in a regression
that ENS functions within console/dashboard didn't work properly anymore.
This commit ensures that both APIs, `EmbarkJS.Names.resolve()` as well as
`EmbarkJS.Names.lookup()` can be either used using `async/await` or promised
based syntax within the console/dashboard.
Example:
```
await EmbarkJS.Names.resolve('me.eth.eth');
EmbarkJS.Names.resolve('me.eth.eth').then(val => ..., err => ...)
EmbarkJS.Names.resolve('me.eth.eth', (err, val) => ...)
```
Same with:
```
await EmbarkJS.Names.lookup('0x...');
EmbarkJS.Names.lookup('0x...').then(val => ..., err => ...)
EmbarkJS.Names.lookup('0x...', (err, val) => ...)
```
Contract logs were not occuring in the test_app for reasons unknown, except that it seemed to be pinned to the fact that accounts were being defined using a mnemonic. Turns out this caused transactions to be signed, and therefore sent using `eth_sendRawTransaction`.
Add ability to decode raw transactions in the proxy so that those transactions are also logged.
Refactor Proxy in to a class and add a Proxy unit test test.
Remove RLP package, as there is another way to decode a tx without needed an additional package.
Replace eth transaction methods with constants throughout the codebase.
Add unit tests for Console Listener.
Support for all template URL syntax as spec’d in https://our.status.im/embark-3-2-much-more-than-a-moonshot/ (Everyone Gets A Template section).
Unit tests were added for all missing cases.
| Test case | Command | Successful? | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 1a. Normal React template, no URL | `embark new 1-normal-template-react --template react` | No | see below |
```
Installing template from https://github.com/embark-framework/embark-react-template/tree/4.0
Downloading template...
Download failed, response code 404
Retrying with the default branch...
It may not be compatible with your Embark version 4.0.0-alpha.2
Installing template from https://github.com/embark-framework/embark-react-template
Downloading template...
Download failed, response code 404
Does the template really exist?
Embark's supported templates: https://embark.status.im/templates/
```
**Failure reason**: https://github.com/embark-framework/embark-react-template repo doesn't exist
| Test case | Command | Successful? | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 1b. Normal TypeScript template, no URL | `embark new 1-normal-template-typescript --template typescript` | Yes | see below |
```
Installing template from https://github.com/embark-framework/embark-typescript-template/tree/4.0
Downloading template...
Download failed, response code 404
Retrying with the default branch...
It may not be compatible with your Embark version 4.0.0-alpha.2
Installing template from https://github.com/embark-framework/embark-typescript-template
Downloading template...
Installing packages...
Init complete
App ready at 1-normal-template-typescript
```
| Test case | Command | Successful? | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 1c. Normal Vyper template, no URL | `embark new 1-normal-template-vyper --template vyper` | Yes |see below |
```
Installing template from https://github.com/embark-framework/embark-vyper-template/tree/4.0
Downloading template...
Download failed, response code 404
Retrying with the default branch...
It may not be compatible with your Embark version 4.0.0-alpha.2
Installing template from https://github.com/embark-framework/embark-vyper-template
Downloading template...
Installing packages...
Init complete
App ready at 1-normal-template-vyper
```
| Test case | Command | Successful? | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 1d. Normal Vue.js template, no URL | `embark new 1-normal-template-vue --template vue` | Yes |see below|
```
Installing template from https://github.com/embark-framework/embark-vue-template/tree/4.0
Downloading template...
Download failed, response code 404
Retrying with the default branch...
It may not be compatible with your Embark version 4.0.0-alpha.2
Installing template from https://github.com/embark-framework/embark-vue-template
Downloading template...
Installing packages...
Init complete
App ready at 1-normal-template-vue
```
| Test case | Command | Successful? | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 1e. Normal Bamboo template, no URL | `embark new 1-normal-template-bamboo --template bamboo` | Yes |see below|
```
Installing template from https://github.com/embark-framework/embark-bamboo-template/tree/4.0
Downloading template...
Download failed, response code 404
Retrying with the default branch...
It may not be compatible with your Embark version 4.0.0-alpha.2
Installing template from https://github.com/embark-framework/embark-bamboo-template
Downloading template...
Installing packages...
Init complete
App ready at 1-normal-template-bamboo
```
| Test case | Command | Successful? | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 2. Github repo download | `embark new 2-github-repo --template status-im/dreddit-devcon` | Yes |see below|
```
Installing template from https://github.com/status-im/dreddit-devcon
Downloading template...
Installing packages...
Init complete
App ready at 2-github-repo
```
| Test case | Command | Successful? | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 3a. Github template with non-existant branch | `embark new 3-github-branch --template status-im/dreddit-devcon#start-here` | Yes |
```
Installing template from https://github.com/status-im/dreddit-devcon/tree/start-here
Downloading template...
Download failed, response code 404
Does the template really exist?
```
| Test case | Command | Successful? | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 3b. Github template with other branch | `embark new 3-github-branch --template status-im/dreddit-devcon#start` | Yes |see below|
```
Installing template from https://github.com/status-im/dreddit-devcon/tree/start
Downloading template...
Installing packages...
Init complete
App ready at 3-github-branch
```
| Test case | Command | Successful? | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 4. Github download with git url | `embark new 4-github-git-url --template git@github.com/status-im/dreddit-devcon` | No |see below|
```
Unsupported template name or git host URL
```
**Failure reason:** Incorrect syntax. Repo owner need to postfix the host, ie `git@github.com:status-im/dreddit-devcon`. Fixed in this PR.
| Test case | Command | Successful? | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 5. Github download with https url | `embark new 5-github-https-url --template https://github.com/status-im/dappcon-workshop-dapp` | Yes |see below|
```
Installing template from https://github.com/status-im/dappcon-workshop-dapp
Downloading template...
Installing packages...
Init complete
App ready at 5-github-https-url
```
| Test case | Command | Successful? | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 6. Github download with no protocol | `embark new 6-github-url-no-protocol --template github.com/status-im/dappcon-workshop-dapp` | No |see below|
```
Unsupported template name or git host URL
```
**Failure reason:** Incorrect syntax. Can remove the github host, ie `status-im/dappcon-workshop-dapp`. Fixed in this PR.
| Test case | Command | Successful? | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 7. Github repo with no branch, and a default branch that is not `master` | `embark new 7-github-default-branch-not-master --template status-im/dreddit-devcon` | Yes |see below|
```
Installing template from https://github.com/status-im/dreddit-devcon
Downloading template...
Installing packages...
Init complete
App ready at 7-github-default-branch-not-master
```
Update replacements for less variance
Update URL replacements for less result variance if the `hosted-git-info` library were to change it’s functionality.
Move replacements to a constant.
Add unit test for additional `bitbucket.org/gitlab.com` URL shortcuts.
The demo scripts in `src/test/cli_shim`, while very useful when developing the
shim, were never fully completed and are not part of embark's CI, so remove
them. A future cross-platform test suite of the shim should be written in the
usual way (with TS/JS) instead of using bash scripts running in a Docker
container.
`waitForWeb3Ready` was never making it to the point it sets
`this.web3Ready = true` and invokes its callback because once the provider's
connection's `readyState` is `3` ("closed or couldn't be opened") there is no
possibility it will change to `1` ("open and ready").
Call the `connectToProvider` method before setting up a retry with `setTimeout`
so that a new instance of `Web3.providers.WebsocketProvider` is used on each
retry.