Commit Graph

5306 Commits

Author SHA1 Message Date
emizzle 431d366652 fix(@embark/utils): Fix proxy crash with unknown function
If a transaction is sent and the proxy is enabled, but the function hash (identified in the data of the transaction) is not recognized as a function of the contract (ie does not match a function hash in the contract’s ABI), then embark would crash.

The fix was to introduce error handling in `transactionUtils.getTransactionParams` that defaults the contract name and params to `UNKNOWN`.

This can be replicated by
1. Clone https://github.com/mortimr/ethvtx_embark
2. `embark run` the dapp
3. Connect with Metamask
4. Ensure you have enough funds
5. In the “Tx calls” bubble, enter a new value, then click “Set Value”.
6. When the Metamask dialog appears, the error should have already happened. The console shows:
```
embark/src/lib/utils/transactionUtils.ts:58
  const functionName = func.functionName;
                            ^
TypeError: Cannot read property 'functionName' of undefined
    at functionName (/Users/mortimr/Horyus/ethvtx_embark/node_modules/embark/src/lib/utils/transactionUtils.ts:58:29)
    at ConsoleListener.getTransactionParams [as _onIpcLogRequest] (/Users/mortimr/Horyus/ethvtx_embark/node_modules/embark/src/lib/modules/console_listener/index.js:102:41)
    at _onIpcLogRequest (/Users/mortimr/Horyus/ethvtx_embark/node_modules/embark/src/lib/modules/console_listener/index.js:76:12)
    at Server._done (/Users/mortimr/Horyus/ethvtx_embark/node_modules/embark/src/lib/core/ipc.js:81:7)
    at Server.emit (/Users/mortimr/Horyus/ethvtx_embark/node_modules/event-pubsub/es5.js:74:21)
    at Server.gotData (/Users/mortimr/Horyus/ethvtx_embark/node_modules/node-ipc/dao/socketServer.js:194:14)
    at Socket.emit (events.js:189:13)
    at Socket.EventEmitter.emit (domain.js:441:20)
    at addChunk (_stream_readable.js:284:12)
    at readableAddChunk (_stream_readable.js:261:13)
    at Socket.Readable.push (_stream_readable.js:220:10)
    at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
```
2019-03-22 13:27:22 -04:00
Iulian Rotaru (mortimr) 4d4704ac6f feat(@embark/embarkjs): add bytecode to contract
Contract artifacts built by `new.EmbarkJS.Blockchain.Contract(config)` now save the bytecode and runtime bytecode from the config in the instance
2019-03-20 13:11:21 -04:00
Pascal Precht 30e5af5038
chore: ensure root CHANGELOG contains all previous releases 2019-03-19 21:03:46 +09:00
Michael Bradley, Jr 21e23313ba chore(release): 4.0.0 2019-03-18 18:26:56 -05:00
Michael Bradley, Jr 5161f54a39 fix(embark-ui): don't show debug button for txs of silent contracts 2019-03-18 17:53:51 -05:00
Michael Bradley, Jr fa89390ee0 chore(release): 4.0.0-beta.2 2019-03-18 17:04:40 -05:00
Iuri Matias b3b2b317c7 Fix linting 2019-03-18 17:49:00 -04:00
Iuri Matias 9c74da3a7b bugfix(@embark/code_generator): write blockchain config file before writing embarkjs artifact 2019-03-18 17:49:00 -04:00
Michael Bradley, Jr 832f16ae08 fix(embark-ui): detect fallback functions in the contracts explorer
When a fallback function is encountered give its signature as `function()`,
disable row expansion, and omit the interaction form. Also label with a
`fallback` badge.
2019-03-18 16:07:18 -04:00
Andre Medeiros 9d34355994 fix: typed commands in console 2019-03-18 12:23:18 -04:00
Michael Bradley, Jr 7f6c1be390 chore(release): 4.0.0-beta.1 2019-03-17 19:56:29 -05:00
Michael Bradley, Jr f4626f8fec fix(embark-ui): specify PUBLIC_URL=/ for production builds
Create React App automatically determines the base path for links within
production build artifacts based on the project's `"homepage"` field in
`package.json`.

An [alternative][alt-setting] is to set the `PUBLIC_URL` environment variable
in `.env.production`. Take that approach so embark-ui's `"homepage"` can
continue to point to its home in the monorepo on GitHub.

Generate source maps in the production build of embark-ui. Doing so increases
the size of the package's tarball by a few MB (it was already large because of
the editor component), but the benefits of being able to much more easily debug
a production build (e.g. when interacting with users experiencing problems)
outweigh the size cost.

[alt-setting]: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/config/paths.js#L36
2019-03-17 20:07:19 -04:00
Michael Bradley, Jr db40f03d68 fix(embark): specify "rxjs" as a dependency vs. "@reactivex/rxjs"
`"rxjs"` is [preferable][rxjs-pkg-name] in a CommonJS context,
e.g. node. Existing embark code is `require`-ing from the unscoped package
name, which worked in the monorepo because some other dependency specifies
`"rxjs"` and yarn hoists it to the root of the workspace. In a production
install of embark, though, `require('rxjs')` was failing.

[rxjs-pkg-name]: https://github.com/ReactiveX/rxjs/issues/2577
2019-03-17 20:07:12 -04:00
Michael Bradley, Jr e37598309f refactor(embark): restrict path for fs ops only in VM2 context
When testing production installs of embark 4.0.0-beta.1 (local registry), the
`restrictPath` mechanism of `core/fs` was too restrictive, interfering with
template generation (cause not completely determined). Also, it's known that
`restrictPath` causes problems when resolving plugins, etc. from "higher up"
`node_modules` paths, e.g. in the monorepo.

Introduce `codeRunner/fs` which uses `restrictPath` as before, and in `core/fs`
remove `restrictPath`. Revise the other `codeRunner` modules to use
`codeRunner/fs`.
2019-03-17 20:07:05 -04:00
Michael Bradley, Jr 6758a652eb build(embark-vyper): use a caret range for embark-async-wrapper
Member packages of the monorepo should use caret ranges when specifying other
packages in the monorepo as dependencies.
2019-03-17 20:06:57 -04:00
Michael Bradley, Jr 949015525c build(embark-compiler): use a caret range for embark-async-wrapper
Member packages of the monorepo should use caret ranges when specifying other
packages in the monorepo as dependencies.
2019-03-17 20:06:49 -04:00
Michael Bradley, Jr fd7909087d fix(embark-ui): AccountContainer should get txs for cold load case
Don't implicitly rely on explorer overview having been loaded to initially
populate `entities.transactions`. Also, that container should watch for new
blocks/transactions same as the other explorer containers.

Restore `fetchTransactions` and related to TransactionsContainer. It's no
longer the basis of pagination (it didn't work as desired), but when navigating
through the transaction pages that action will ensure more transactions are
fetched so that the account page will list more of an account's transactions
over time. That was a side effect of `getTransactions` before it was removed in
favor of `getBlocksFull`, which is still the basis of revised pagination logic
in the transactions explorer.
2019-03-15 15:25:56 -05:00
Michael Bradley, Jr fbeea47a6e fix(embark-ui): correctly calculate which transactions to display
Revise calculations related to transactions and pagination in the transactions
explorer and explorers overview.

Make the number of transactions to display per page configurable and set it to
3 in the explorers overview. Display a "No transactions..." message instead of
"0" when there are no transactions to display.

Introduce a `blocksFull` prop, action, api, etc. for calculating lists of
transactions relative to block objects that contain full transaction objects
instead of hash strings (the function backing the blocks endpoint already
supports that) and transaction receipts. In the future, the receipts can be
used to filter out constructor transactions for silent contracts.

Make pagination display conditional within the blocks explorer, same as in the
transactions explorer.
2019-03-15 15:25:56 -05:00
Jonathan Rainville b1881719e0 Fix tests (CI) and debug button (#1443)
* fix(embark/tests): fix tests by not tampering with the contract addr

* fix(cockpit/debugButtong): use deployedAddress instead address
2019-03-15 16:22:24 -04:00
Michael Bradley f60c979c75 refactor(embark-ui): filter silent contracts from contracts listings (#1444)
Filter silent contracts in the views that display contracts lists rather than
with `formatContractForDisplay` because the old approach prevents interaction
with a silent contract if a link to it is followed from the blocks or
transactions explorer, which is not desirable.
2019-03-15 16:22:15 -04:00
Michael Bradley, Jr 9afdbd9848 refactor(embark-ui): improve cockpit's contracts explorer
Rename contract "Transactions" tab to "Log". Display and allow filtering of all
contract methods. Disable debug button for pure/view functions and the
constructor.

Revise the filtering logic so that filters are combined together. Make the
status filter a drop down menu like the others.

Revise styling for consistent row height, alignment of text, and button sizes;
use a monospaced font in some cases to achieve the effect.

Handle enter/return correctly in forms within a contract's Interact tab.

Remove event rows from a contract's Interact tab.

Track pure/view calls in the blockchain proxy so they can be logged server-side
by console listener and reported in Cockpit within a contract's Log tab.

Eliminate double logging in the contracts manager. Ensure contracts deployed on
a fresh `embark run` have an `address` / `deployedAddress` property.
2019-03-15 12:03:52 -05:00
Andre Medeiros b15467f64a feature: decode raw transactions in tx decoder 2019-03-15 12:28:21 -04:00
Jonathan Rainville 5e4a80edec fix(embark/storage): fix hang when storage is disabled 2019-03-14 17:32:04 -04:00
Jonathan Rainville 4d424c06b9 fix(embark/solidity): fix getting the original filename of contracts 2019-03-14 14:15:45 -04:00
Andre Medeiros aba4e0e059 fix: track and debug last transaction correctly 2019-03-14 14:15:19 -04:00
Jonathan Rainville 9bb33e9274 fix(cockpit/suggestions): fix suggestions with slashes 2019-03-14 14:14:52 -04:00
Iuri Matias cfd06b5fe1 feature(@embark/ipfs) add other gateway urls for ipfs 2019-03-14 14:13:51 -04:00
Andre Medeiros 2cc0d305e6 fix: pressing enter on "Display additional results" does the expected thing 2019-03-14 14:13:35 -04:00
Jonathan Rainville 5816a79ae6 fix(cockpit/sidebar): fix closed sidebar in the dark-theme 2019-03-14 14:01:57 -04:00
Jonathan Rainville 22e771bbda fix(cockpit/console): fix cockpit's console outputting "console >" 2019-03-14 14:01:47 -04:00
Iuri Matias 785edf4c9d use e.key instead of e.which 2019-03-14 14:01:28 -04:00
emizzle 8b7a374313 fix(@embark/cockpit): Utils/Communications handle enter
Handle enter pressed when listening to channels and sending messages.
2019-03-14 14:01:28 -04:00
Michael Bradley, Jr cc8363a94b fix(embark-ui): correctly calculate which blocks to display
Revise calculations related to block numbers and pagination in the blocks
explorer and explorers overview.

Make the number of blocks to display per page configurable and set it to 5 in
the explorers overview.
2019-03-13 12:35:12 -04:00
Jonathan Rainville 618ceb6ff2 fix(embark/contracts): add the contracts back to the autocomplete 2019-03-13 12:34:54 -04:00
Jonathan Rainville dd1133d9cf fix(embark/dashboard): fix dashboard not printing repl errors 2019-03-13 12:20:25 -04:00
Jonathan Rainville dddc9d0cf6 fix(cockpit/firefox): fix bug with entities in firefox (ordering) 2019-03-13 12:13:52 -04:00
Jonathan Rainville 447f3eda06 fix(cockpit/transactions): enable filtering constructor 2019-03-13 11:08:20 -04:00
Jonathan Rainville a341a4f3b2 fix(cockpit/console): replace br with backslash n 2019-03-13 10:21:10 -04:00
Jonathan Rainville 71da423e4e fix(cockpit/console): increase number of suggestions 2019-03-13 10:21:01 -04:00
Jonathan Rainville 54698ccf53 fix(embark/dashboard): show command in the dashboard 2019-03-13 10:20:41 -04:00
emizzle 6f5efb16a6 fix(@embark/storage): Storage processes race conditions
Previously, storage providers in embarkjs were not waiting for their respective storage process (ipfs and swarm) to start before running `registerProvider` and `setProvider` in the console.

This PR forces the `registerProvider` and `setProviders` from running in the console until the storage processes have loaded. As a side effect, the code generation of `EmbarkJS` must wait for the storage module ot be fully initiated (ie once the processes have launched and the `registerProvider` and `setProviders` have been run) before generating the code.

This fixes errors pertaining to `Could not connect to a storage provider using any of the dappConnections in the storage config` as these errors were typically caused by `setProviders` being called before the storage processes had fully launched.
2019-03-13 10:15:52 -04:00
Jonathan Rainville be3817821d fix(cockpit/dashboard): fix logs not in cockpit with dashboard 2019-03-13 09:46:12 -04:00
Michael Bradley, Jr 5c2e30c26c fix: remove unneeded test_dapps/ directory in the monorepo root 2019-03-12 11:35:23 -05:00
Pascal Precht 20d3acb8b1 uiux(@embark/authenticator): Change web backend to Cockpit 2019-03-12 09:17:43 -04:00
Michael Bradley, Jr 5418f16082 feat: normalize README and package.json bugs, homepage, description
Make changes by running these commands in the root of the monorepo:

**bugs**
```shell
npx lerna exec --concurrency 1 --stream -- \
    'DIRPATH=$(realpath $PWD --relative-to=$LERNA_ROOT_PATH); \
    npx json -I -f package.json -e "this.bugs=\
        \"https://github.com/embark-framework/embark/issues\""'
```

**homepage**
```shell
npx lerna exec --concurrency 1 --stream -- \
    'DIRPATH=$(realpath $PWD --relative-to=$LERNA_ROOT_PATH); \
    npx json -I -f package.json -e "this.homepage=\
        \"https://github.com/embark-framework/embark/tree/master/${DIRPATH}#readme\""'
```

Don't commit changes to private packages, with the exceptions of embark-typings
and embark-reset because those may switch from private to public, and also
because the latter will be included in `node_modules` of embark even if it is
private since embark-reset is presently a bundled dependency of embark.

Don't include the homepage and bugs fields in dapps generated from the template
packages, except for the demo. Set those dapps' description field to an empty
string.

Ensure every package (inc. private packages) has a description.

Ensure every package (inc. private packages) has a README that begins with:

```markdown
`[pkgJson.name]`
================

> [pkgJson.description]

Visit [embark.status.im](https://embark.status.im/) to get started with
[Embark](https://github.com/embark-framework/embark).
```

Don't include the README in dapps generated from the template packages, except
for the demo.
2019-03-12 09:17:33 -04:00
emizzle 3aafde3335 fix(@embark/pipeline): Prevent crash when assets not specified
Prevent embark from crashing when app assets are not specified in `embark.json`.

Previously, if the `app` property of `embark.json` was missing, embark would crash with the error `TypeError: Cannot convert undefined or null to object`.

With this PR, the missing property is null-checked.
2019-03-12 07:55:01 -04:00
emizzle 5ea4807c90 feat(@embark/pipeline): Add `enabled` property to pipeline config
Add an `enabled` property to the pipeline config. This lets developers disable the pipeline using the config file.

Updates to the enabled property will be reflected while embark is running. For example if embark is running with the pipeline, setting `enabled: false` in the pipeline config will build/deploy the contracts but not run the pipeline. Conversely, if embark is running with the pipeline disabled, enabling the pipeline in the config will build/deploy the contracts then build the dapp.
2019-03-12 07:53:04 -04:00
Michael Bradley, Jr df0064f1a9 build: use package.json "files" instead of .npmignore
`package.json` allows for a [`"files"` whitelist][files] to be specified as an
alternative to a top-level `.npmignore` within a package root. Maintaining
whitelists is generally easier and less error-prone than maintaining
blacklists, so implement a `"files"` list for all non-private packages in the
monorepo and remove unneeded `.npmignore` files.

Switch `embark-reset` from being a private package to one that will be
published, adjust the workspace's `"nohoist"` setting accordingly, and no
longer specify `embark-reset` as a bundled dependency of `packages/embark`. I
originally thought there might be a good reason not to publish it, but I no
longer think so.

Remove unnecessary LICENSE files in `packages/{embark,embark-ui}` since Lerna
will automatically copy the root LICENSE into any packages lacking that file,
i.e. before tarballs are packed and published to the NPM registry.

Change the `"author"` field of `packages/embarkjs-connector-web3` to match the
other packages, i.e. such that it matches the copyright assignment in the root
LICENSE. If that's not a desirable thing to do, then instead that package can
have a separate LICENSE file that has a copyright assignment for `"Jonathan
Rainville"`.

Supply some missing `.npmrc` files in `packages/*`.

[files]: https://docs.npmjs.com/files/package.json#files
2019-03-12 07:50:25 -04:00
Andre Medeiros 0b530f308b fix: node_modules should be part of hidden files 2019-03-12 07:48:20 -04:00
Jonathan Rainville 88a41e7c28 fix(embark/logger): fix logs in the dashboard
they were displaying the color as text instead of as a color
2019-03-11 18:32:48 -04:00