Commit Graph

435 Commits

Author SHA1 Message Date
Michael Bradley, Jr cda40b93c4 chore(release): 4.1.0-beta.6 2019-08-09 17:50:05 -05:00
Michael Bradley, Jr 33eab74ebd refactor(@embark/blockchain): support --simple dapps
DApps generated with `new --simple` don't have a blockchain config so ensure
that the blockchain proxy and listener (dev_txs) use appropriate provider
settings when setting up web3.

Without these changes, in a fresh `embark new --simple` project the `embark
blockchain` command will encounter unhandled promise rejection with respect to
the proxy; `embark run` will encounter similar with respect to dev_txs.
2019-08-09 10:50:43 -05:00
Pascal Precht 1595e4b37f fix(@embark/embarkjs-ipfs): use `version()` API instead of `id()` to determine availability 2019-08-09 10:50:03 -05:00
Michael Bradley, Jr f7f54f299d refactor(@embark): template generator should use npm if downloaded template has `package-lock.json`
Previously, when using "development embark" (i.e. `embark` command in the
monorepo) the template generator would always use `yarn install` to install a
template's dependencies. However, if a template relies on `package-lock.json`,
as is the case for `embark-create-react-dapp-template`, that behvaior can cause
serious problems. So, have the choice of install command depend not only on
whether we're using "development embark" but also whether the template has a
`package-lock.json` file.

NOTE: this change can probably result in problems given that `yarn install` and
`npm install` behave differently re: symlinks in `node_modules`. However, such
problems would never show up with production installs of the `embark`
packaage. Moreover, after dropping `embarkjs-connector-web3` we don't presently
have a situation where a monorepo package would be `yarn link`ed into an
instantiated template's `node_modules`. So, in effect, the changes introduced
in this PR allow existing templates to work correctly whether using production
or monorepo embark. The impending embark v5 refactor should deprecate `embark
new` in favor of the yet unfinished `embark init`.
2019-08-09 10:48:38 -05:00
Michael Bradley, Jr 6dd0628a86 fix(@embark/library-manager): add a check/warning for `"1.0.0-beta"` web3 version in installAll
A check is already in place in `package/embark-web3` but `installAll` of the
library manager needs the same.
2019-08-09 10:39:00 -05:00
Michael Bradley, Jr beebbe6e58 fix(@embark/cli): properly forward cli options to ethereum simulator 2019-08-09 10:37:58 -05:00
Michael Bradley, Jr 9d81fc5b1c fix(@embark/pipeline): check if config arg of writeStats is falsy
When passing the name of a build pipeline that doesn't exist, e.g.
`embark run|build --pipeline foo`, `writeStats` would cause an unhandled
promise rejection because its config argument is falsy. Checking for that and
returning early from `writeStats` allows the `"no webpack config has the name
'foo'"` error to be reported correctly.
2019-08-09 10:37:20 -05:00
Michael Bradley, Jr e58c5528a6 fix(@embark/pipeline): adjust ignore paths
The ignore paths for the default webpack config and babel-loader-overrides
helper script weren't properly adjusted after the legacy pipeline was split-out
into its own package in the monorepo.
2019-08-09 10:37:20 -05:00
Michael Bradley, Jr ad30a98169 refactor: upgrade to web3 v1.2.1
Upgrade all dependencies on web3/web3-* v1.0.0-beta.37 to v1.2.1.

Make various adjustments related to the previous convention of
`"web3": "1.0.0-beta"` in `embark.json` signifying that embark's own web3
dependency should be used in dapp builds.

Fix bugs in library manager, including a switch from using the
live-plugin-manager package to using npm in a child process to install
`"versions"` dependencies specified in `embark.json` when a specified version
doesn't match up with embark's own version for that package.

Avoid race conditions when installing `"versions"` by completing all installs
prior to starting other services. If an install fails, then after all the
installs have completed or failed the embark command will exit with error.

Change various comments and update docs to reflect the new default of web3
v1.2.1.
2019-08-07 11:01:23 -05:00
Michael Bradley, Jr 0c12097c17 refactor(@embark/blockchain): consistently merge config accounts and node accounts 2019-08-07 11:00:51 -05:00
Jonathan Rainville c2094dbc49 fix(@embark/test-runner): fix describe in describe tests 2019-08-07 11:00:25 -05:00
Jonathan Rainville b5c81bd41a feat(@embark/pipeline): enable choosing which fields to filter out 2019-08-01 13:53:47 -04:00
Jonathan Rainville b0cccaea05 feat(@embark/pipeline): add minimalContractSize to remove bytecode 2019-08-01 13:53:47 -04:00
Jonathan Rainville 9e74d32f5f feat(@embark/cmd): add a warning on build and upload if development 2019-07-30 08:48:16 -04:00
Jonathan Rainville 1491028665 use callbacks instead of exiting 2019-07-23 10:55:14 -04:00
Jonathan Rainville 6afa07f111 code review 2019-07-23 10:55:14 -04:00
Jonathan Rainville 78bb9bc34d fix(@embark/accountParser): exit on unsupported account configs 2019-07-23 10:55:14 -04:00
Jonathan Rainville 5ab4c225fa fix(@embark/ui): fix errorEntities not working at all 2019-07-23 08:49:41 -04:00
Jonathan Rainville 27bd574406 fix(@embark/ipfs): fix ipfs upload with wrong error message 2019-07-15 11:17:25 -04:00
Jonathan Rainville 810c3be9fc fix(@embark/pipeline): streamline contract index file creation 2019-07-15 09:16:35 +02:00
Michael Bradley, Jr 5930cce7dd chore(release): 4.1.0-beta.5 2019-07-10 16:21:47 -05:00
Michael Bradley, Jr 72baf5f6dd refactor(@embark/api-client): remove console.dir statements used during development 2019-07-10 16:06:27 -05:00
Michael Bradley, Jr 5828ae6cc5 fix(@embark/storage): revise timing for process:started and code eval to avoid race conditions 2019-07-10 16:06:27 -05:00
Pascal Precht 2531fc1d26 fix(@embark/test-runner): make `--tx-details` option work again
In https://github.com/embark-framework/embark/commit/87d92b6091 we've introduced a feature in our test runner
to report exact gas costs used when calling Smart Contract methods that
cause computation.

Embark keeps a list of deployed contracts in memory and for all transactions
happening during tests, it'll match them to the contracts that performed them
to produce the report logs.

Unfortunately, we've been [resetting that memory](https://github.com/embark-framework/embark/commit/87d92b6091#diff-92b4f79a0473160fe700440b1ced5204R140) of deployed contracts
after every test, making it practically impossible for Embark to find
matching contracts for any transactions, because contracts aren't necessarily
redeployed per spec, resulting in no additional transaction logs whatsoever.

This commit ensures that the memory is never erased and at the same time
ensures it's not leaking infinitely in case multiple contracts are
deployed multiple times in the same process over several specs.
2019-07-10 14:20:26 -05:00
Michael Bradley, Jr 3590197c55 fix(@cockpit/debugger): check if `debuggingContract` is undefined
Guard against redux-saga fetching races in `componentDidUpdate`.
2019-07-09 13:02:51 -05:00
Pascal Precht 3f77272e71 fix(@cockpit): don't send invalid value to Smart Contract methods
We've introduced a regression in 536a4029ba where the default
`value` sent to payable Smart Contract methods is `-1`, resulting in errors as it's not
a valid value.
2019-07-09 08:10:13 +02:00
Jonathan Rainville 9390673ef4 chore: update shelljs to 0.8.3 for all packages 2019-07-08 11:25:30 -05:00
Jonathan Rainville 1e59b58887 feat(@embark/solc): add embark-solc to monorepo 2019-07-08 11:25:30 -05:00
Jonathan Rainville c87d7da4cc fix(@embark/code-generator): use plugins for contract generation
`contractGeneration` plugins were only used in the Embark console
Now they are used to generate the Dapp artifacts too
2019-07-08 10:26:16 -05:00
emizzle 536a4029ba feat(@cockpit): Pass tx value as wei and add validation
For payable methods inside of the contract interatction section of cockpit, the value input has been updated to pass wei to the API. The input field now accepts value like `100 ether` or 25 szabo`. The value entered is automatically converted to wei and shown to the user in real time.

Additionally, the input is validated for a correct value, with an error shown to the user for incorrectly entered values.

A tooltip has been added to help the user enter correct values.

UI updates can be seen in video here: https://monosnap.com/file/642cHH2HxDeiFLzB2VLqHP9GuqoRfz
2019-07-08 10:00:34 -05:00
Pascal Precht 70ff3c1825 fix(@embark/contracts-manager): ensure ETH values sent through APIs are converted to string
This is due to a bug that has been introduced in d10c0b7951 where we end up
sending values as numbers to web3's `toWei()` utility. The `value` is always sent as number
and in fact always defined, so we just need to check for it's type and convert it to a string
according to `toWei()`'s API.
2019-07-08 10:00:34 -05:00
Michael Bradley, Jr bd602b45ee refactor(@embark/storage): wrap require.resolve in try/catch
Wrap `require.resolve` in try/catch instead of testing the path with
`embark.fs.access`.
2019-07-05 17:01:09 -05:00
Michael Bradley, Jr 13e926659f refactor(@embark/core): move CoreProcess into embark-core 2019-07-05 16:07:58 -05:00
Michael Bradley, Jr 04694edb0b refactor: move storage, ipfs and swarm modules into their own packages 2019-07-05 16:07:45 -05:00
Michael Bradley, Jr 158de04baf refactor(@embark/ens): remove caret range from async dependency 2019-07-05 16:05:21 -05:00
Pascal Precht d76a82a30a fix(@embark/deployment): don't over estimate gas when running tests against non-simulator nodes
When running tests against non-simulated blockchain nodes, even for simplex
Smart Contracts, deployment transactions would exceed the block gas limit.

E.g. running `embark blockchain` in one process and `embark test --node embark`
in another, inside our demo application, will throw an error when Embark attempts
to deploy its `SimpleStorage`:

```
Compiling contracts
Compilation done

[SimpleStorage]: error deploying =SimpleStorage= due to error: Returned error: exceeds block gas limit
Error deploying contracts. Please fix errors to continue.
Error deploying contracts. Please fix errors to continue.
terminating due to error
Error deploying contracts. Please fix errors to continue.
```

The reason for that is because in https://github.com/embark-framework/embark/pull/1650, we've introduced a static
gas estimation for Smart Contract deployment that is just right below Ganache's
maximum gas limit of `6721975`, since Ganache tends to underestimate gas for
complex Smart Contracts due to its [low base fee](8ad1ab29de/lib/utils/gasEstimation.js (L33-L39)).

The static gas estimation would apply any time we're in a test context, but we
didn't take into account the case where tests are executed against nodes
other than the simulated environment.

As mentioned in the comments in the linked PR:

> If this is not spec'ed at all, I wonder what complications it could cause when
> at some point we maybe switch to not using Ganache anymore for tests, or even
> the user itself (which I think is a reasonable thing to do).

This causes the error described above because we easily reach the block gas limit
with just two Smart Contracts and Embark already deploys a few Smart Contracts for
ENS.

So basically what we want is to use the static gas estimation when we know
the node we're connecting to is Ganache. In all other cases we can rely on the
standardized gas estimation offered by the node.
2019-07-05 14:15:12 +02:00
Jonathan Rainville 421c340613 fix(@embark/ipc): fix functions not being printed in console 2019-07-05 14:12:43 +02:00
Jonathan Rainville 0e9a4a136b feat(@embark/ui): sort contracts and functions alphabetically 2019-07-05 14:11:34 +02:00
Michael Bradley, Jr 52d54f0d87 fix(@cockpit/explorers): consistently display "Mined on" timestamps
Adjust the API endpoints to augment transaction objects with a timestamp
property from their corresponding blocks. This removes the necessity to copy
the timestamp property from a block to its transactions in the client.

Introduce a `formatTimestampForDisplay` util function in Cockpit for
consistently transforming timestamps into relative or absolute dates, depending
on whether a date is sometime during the last day.
2019-07-03 08:25:08 -05:00
Michael Bradley, Jr 7d27125eed fix(@embark/code-runner): restore EmbarkJS.environment property in the cli dashboard
The property is set/available on EmbarkJS in the artifacts, i.e. in a browser
build; but sometime since v3.2.4 it was no longer availble in the cli dashboard
environment.
2019-07-02 10:48:53 -05:00
Pascal Precht 93ca3ad97c fix(@embark/embarkjs-whisper): Messages.isAvailable() should always return a promise
`EmbarkJS.Messages.isAvailable()` in some cases return synchronously (when whisper isn't
set up), in other cases asynchronously. This actually breaks our demo application for
the following reason:

We check for Whisper's availability via:

```
EmbarkJS.Messages.Providers.whisper.getWhisperVersion((err, _version) => {
  if (err) {
    return console.log(err);
  }
  this.setState({whisperEnabled: true});
});
```

There's a couple of problems here:

- This code will break right away when whisper isn't available, resulting in an error:
  ```
  Cannot read property _requestManager of undefined
  ```

- The reason this error happens is because there's no `web3` object available inside
  our EmbarkJS.Messages code. Even though there **is** a web3 object, EmbarkJS.Messages
  doesn't know about this because it only sets it when its `setProvider()` API is called,
  which effectively doesn't happen at all when Whisper isn't enabled on the connected
  node

- While this could be fixed with a simple check on whether EmbarkJS.Messages' internal
  `web3` references is a thing, really what should be used in the demo is the `isAvailable()`
  API.

`isAvailable()` should always return a promise (similar to `EmbarkJS.Storage.isAvailable()`.

This commit ensures that `isAvailable()` always returns a promise and changes the demo
template to use `isAvailable()` over `getWhisperVersion()`.
2019-07-01 11:11:03 +02:00
Pascal Precht fc7eb0cca6 uiux(@cockpit/sign-and-verify): improve wording for verifying messages 2019-07-01 11:10:37 +02:00
Michael Bradley, Jr eecb48f5b6 chore(release): 4.1.0-beta.4 2019-06-27 14:23:32 -05:00
Jonathan Rainville f6d7a54195 fix(@embark/deploy-tracker): fix getting the block 0 with sim --fork 2019-06-27 14:12:29 -05:00
Jonathan Rainville 198a5dc3f4 fix(@embark/solidity): show a better error message in debug 2019-06-27 14:10:53 -05:00
Iuri Matias fc4faa8ba9 fix: alleviate races re: embarkjs by introducing Plugin#addGeneratedCode and related refactors 2019-06-27 14:10:12 -05:00
Michael Bradley, Jr d684b9af0f refactor(@embarkjs/web3): make web3 connector an internal plugin like the other embarkjs-* packages
Effectively deprecate the `embarkjs-connector-web3` package but don't introduce
a breaking change by simply not loading the plugin if it's specified in a
DApp's `embark.json`. If the deprecated plugin is specified, display a message
indicating the plugin was ignored and suggesting it be removed from the
project's `embark.json` and `package.json`.
2019-06-27 14:10:12 -05:00
emizzle 71cb161525 feat(@embark/blockchain-connector): Add command to get full account info
This PR adds a command to get full account details from the contradts config that includes info like private key.

The existing, and similar command, `blockchain:provider:contract:accounts:get` would only return account addresses if they existed, and not the full account info.
2019-06-27 08:42:58 -05:00
Michael Bradley, Jr 2ce9ca6bb0 fix(@embark/coverage): function types and single statement ifs 2019-06-27 08:40:24 -05:00
Pascal Precht 610d8f1baa fix(@cockpit/utils): Ensure whisper channels are at least 4 characters long
This check was already made when sending messages to whisper channel, however, we didn't
perform the same check when subscribing to channels within cockpit.
2019-06-27 08:36:25 -05:00