Commit Graph

5129 Commits

Author SHA1 Message Date
Jonathan Rainville 9e69a7257e review comments 2018-11-29 11:16:39 -05:00
Jonathan Rainville c64c093a48 fix(ens/embarkjs): fix using await with embarkjs functions 2018-11-29 11:16:39 -05:00
Jonathan Rainville ca212e3ffb fix(ENS): register subdomain when not registered
was introduced when we did para deploy
We didn't register on error, but the error is the queue to register
2018-11-29 11:16:39 -05:00
Michael Bradley, Jr 801932b726 refactor(@embark/blockchain_process): improve the blockchain proxy
Use proper stream parsing to consistently track JSON-RPC messages.

For HTTP POST requests use the `stream-json` package to assemble request and
response message objects.

For WebSocket requests continue to use `simples/lib/parsers/ws` to process
stream frames into messages. For Websocket responses use the Receiver class of
the `ws` package to process stream data into messages. In both cases, make use
of the `cloneable-readable` and `stream-chain` packages to avoid leaks.

This mishmash of stream parsing approaches is the result of much
experimentation to find a working solution. For example,
`simples/lib/parsers/ws` does't work for processing WebSocket responses and
`ws.Receiver` doesn't work for processing requests. Additional revisions may be
necessary.

Revise `blockchain_process/dev_funds.js` to use web3's HTTP provider if a DApp
disables the WebSocket proxy.
2018-11-28 16:01:52 -06:00
Anthony Laibe 160015311e fix(ui): click on debug button start the debugger
Remove fake line
2018-11-28 09:21:45 +00:00
Michael Bradley, Jr a3392e8279 hotfix: remove yarn cache clean for CI 2018-11-27 15:21:52 -06:00
Michael Bradley, Jr 885d07483e hotfix: yarn cache clean for CI 2018-11-27 14:48:30 -06:00
Jonathan Rainville cb4f18c4c2 chore(plugins): remove second require as it always fails 2018-11-27 15:44:51 -05:00
Jonathan Rainville f9384733f8 fix(dependencies): lock remix-test and debug version
Caused an issue with ethereumjs-vm which introduced a breaking change
2018-11-27 15:44:51 -05:00
Jonathan Rainville 36da5a340e remove cache from yarn to fix malicious install 2018-11-27 10:48:08 -05:00
Jonathan Rainville 2b15388cd5 hotfix: fix tslint on the declare of debugtest 2018-11-27 10:03:29 -05:00
Anthony Laibe 6e784de507 fix: add missing external declaration 2018-11-27 09:48:59 -05:00
Michael Bradley, Jr 1d5e33e8a0 build: bump npm-run-all to the latest version 2018-11-26 19:51:50 +01:00
Anthony Laibe 92610ed70a fix: deploy hangs
The bug seems to be in web3 but we fix it
by avoiding extra tx
2018-11-26 12:59:42 -05:00
Pascal Precht ffb8f54939 feat(@embark/cli): introduce `eject-build-config` alias
As discussed in #1121, the `eject-webpack` command in Embark's CLI
exposes implementation details of the CLI's build process, namely webpack.

If we ever change our internal build tooling, commands like this
will become obsolete immediately. That's why this commit introduces
a new command `eject-build-config`, with `eject-webpack` being an alias for it.

So the following commands are the same:

```
$ embark eject-build-config
```
and
```
$ embark eject-webpack
```

The `eject-webpack` command can now be marked as deprecated and removed in future
versions of Embark.

Closes #1121
2018-11-26 12:33:19 -05:00
Anthony Laibe 7728c542e9 fix: open/close aside container 2018-11-26 15:38:35 +00:00
Anthony Laibe 5fb687c1d9 feat: expose dappPath 2018-11-25 18:38:44 -05:00
Anthony Laibe 8f59647f36 refactor: extract types that are shared 2018-11-25 18:38:44 -05:00
Anthony Laibe db35d7f573 feat: add new event before build 2018-11-25 18:38:44 -05:00
Pascal Precht 17cec1b787 feat(@embark/contracts_manager): allow ABI definition non-owned contracts
This commit allows dapp developers to specify an ABI for contracts that are
already deployed and which source they don't own.

Prior to this commit there were two options to use web3 contract instances of 3rd
party contracts in Embark:

1. Define an interface for the 3rd party contract and have Embark compile that
2. Define path to source file of 3rd party contract and have Embark compile that

Both options result in Embark getting hold of the contracts ABI so it can be used
by web3 to create instances.

Now there's a third option that doesn't require creating an interface, nor the
source of the 3rd party contract.

Example:

```
// config/contracts.js

...
contracts: {
  SimpleStorage: {
    address: '0x0bFb07f9144729EEF54A9057Af0Fcf87aC7Cbba9',
    abiDefinition: [...] // full ABI
  }
},
afterDeploy: async(deps) => {
  const simpleStorage = deps.contracts.SimpleStorage;
  const value = await simpleStorage.methods.get().call();
  console.log('value', value);
}
```
2018-11-23 16:34:12 -05:00
Jonathan Rainville d09d410021 refactor(ENS): adds a whitelist for ens
Enables only the use of domains in that white list
2018-11-23 16:32:57 -05:00
Anthony Laibe bae31165dd feat: handle missing directive
WhileStatement
UsingForDirective
EnumDefinition
2018-11-23 16:30:15 -05:00
Anthony Laibe 154a4f0284 feat(coverage): count node by line only 2018-11-23 16:30:15 -05:00
Anthony Laibe 4aa15fe869 docs: remove old logo 2018-11-23 16:29:56 -05:00
Pascal Precht 903e9d44f2 fix(@embark/core): expect `afterDeploy` hook on contracts config environment
In d3f6b43986 we ensured that Embark automatically
expands `0x0` address to full zero addresses in order to stay backward compatible
with existing projects that made use of `0x0`, even after we've upgraded web3,
which doesn't allow that syntax anymore.

Turns out however, that the address expansion for `afterDeploy` hook was
done in the wrong place. This was due to a bug in our documentation that has been
fixed in 66a5bec46d
2018-11-23 10:36:20 +01:00
Pascal Precht 191929832c chore: remove npm-shrinkwrap.json which had been accidently introduced
227decde0a re-added the npm-shrinkwrap which
we don't rely on anymore.
2018-11-22 15:46:43 +01:00
Iuri Matias 05ef36441f refactor(@embark/debugger): rename function to camelcase 2018-11-22 09:00:55 -05:00
Iuri Matias 7b5613a70f refactor(@embark/debugger): simplify code 2018-11-22 09:00:55 -05:00
Iuri Matias 6e5fe85695 refactor(@embark/debugger): remove unneded type definition 2018-11-22 09:00:55 -05:00
Iuri Matias e02d026499 refactor(@embark/debugger): add ts definition for async; use imports instead of requires 2018-11-22 09:00:55 -05:00
Iuri Matias d06ad53ece refactor(@embark/debugger): initialize default values in private variables instead of constructor 2018-11-22 09:00:55 -05:00
Iuri Matias e2efa4baa0 feature(@embark/debugger): limit steps; display possible actions & line info 2018-11-22 09:00:55 -05:00
Iuri Matias b86634886e refactor(@embark/debugger): move debugger index.js to typescript 2018-11-22 09:00:55 -05:00
Iuri Matias 227decde0a refactor(@embark/debugger): move debugger_manager.js to typescript 2018-11-22 09:00:55 -05:00
Pascal Precht 6526e83742 fix(@embark/ens): use local ZERO_ADDRESS in ENSFunctions
We've introduced a regression in 2dfaaa8201 where zero addresses
have been replaced with a constant, including the ones within ENSFunctions.

The problem is that this code is as well added to the EmbarkJS client, where importing
`../../utils/addressUtils` won't work as it isn't available.

This commit reverts back to have ENSFunctions having its own ZERO_ADDRESS constant.
2018-11-22 12:40:46 +01:00
Pascal Precht 2dfaaa8201 refactor(@embark/ens): use ZERO_ADDRESS constant 2018-11-21 16:28:44 -05:00
Pascal Precht 2ff119d2df fix(@embark/contracts_manager): set contract `deployedAddress` if address is set
This commit fixes a bug in a scenario where dapp developers choose to refer
to an already deployed Smart Contract (they don't own) and want to use its web3 instance
on the client-side, or in deployment hooks.

For example, Dapp developers might want to do something like this:

```
// config/contract.js
...
contracts: {
  SimpleStorage: {
    address: '0x1234...' // SimpleStorage is already deployed
  }
},
afterDeploy: async (deps) => {
  const simpleStorage = deps.contracts.SimpleStorage; // this is the web3 instance created from an ABI
  const value = await simpleStorage.methods.get().call();
  console.log(value);
}
...
```

In order for Embark to create ready-to-use web3 Smart Contract instances,
it needs the contract's ABI. At the moment there are two possible ways to
achieve this for contracts we don't own:

1. Set the `address` of the already deployed contract and create a Solidity
   interface with the same name of the existing Contract that matches that
   Contract's interface. Embark is then going to compile that interface
   which will output an ABI whic can be used for web3 instance creation.

2. If the source of the 3rd party Smart Contract is available, use the
   `file` option to specify the path to the source, which Embark then picks
   up for compilation. Again, this results in ABI code which is then used
   for web3 instance creation.

As of now option 1) doesn't actually work, at least web3 is going to throw
an error when trying to access Smart Contract instances that have been created
that way. The reason for that is that the instance doesn't have a `deployedAddress`.

This commit ensures that the `deployedAddress` is set when the Smart Contract
config comes with a preconfigured `address`.
2018-11-21 16:28:23 -05:00
Andre Medeiros 4dca72368b fix(@embark/cmd): output contract json
This fix ensures that `embark build --contracts` outputs the contracts
the same way a normal build would.
2018-11-21 16:13:54 -05:00
Richard Ramos 46e351ed36 feat(@embark/whister): Add signature and recipient public key to whisper envelope 2018-11-21 16:08:56 -05:00
Jonathan Rainville 0032569b50 fix(tests): enable coverage only when --coverage
Fixes #1091
Speeds up tests because coverage does stuff on each block
2018-11-21 15:57:42 -05:00
Filip Š 6522aaae24 Add Slovenian translation 2018-11-21 15:53:37 -05:00
Andre Medeiros 485b8ef558
fix: handle contracts being removed
Fixes #1077
2018-11-21 13:40:41 +01:00
Pascal Precht ab41860d9b chore: introduce release script
This commit automates our release process. It takes care of a couple of things:

- Bumps version number in package.json as needed, see below
- Generates changelog based on commit history
- Create release commit
- Tags release commit
- Pushes release commit including tags to upstream repository
- Publishes release on npm

There are a couple of options supported. The base command is run like this:

```
npm run release
```

This will do a minor bump and try to push to `origin` on `master`. However,
this can be altered with the following options.

```
npm run release -- --dry-run
```

Can be used to perform dry run and not actually committing, tagging, pushing,
publishing anything.

```
npm run release -- --release-as <something>
```

Something can be `minor`, `major`, `patch` or anything you want `foo`, `1.0.0` etc.

```
npm run release -- --prerelease alpha
```

Will create a prerelease version a la `4.0.0-alpha.x`.

```
npm run release -- --prerelease alpha --npm-dist-tag next
```

Publishes a dist tag on npm using dist tag `next`

```
npm run release -- --sign
```

Signs the release commit (you need to have PGP setup for that).

```
npm run release -- --repo-origin pascal --repo-branch foo/bar
```

Pushes the release commit into `pascal/foo/bar`.
2018-11-21 13:28:50 +01:00
Anthony Laibe 45afe83cb3 feat: update to solc 0.5.0 2018-11-21 08:50:43 +00:00
Anthony Laibe f32ddc9935 fix: coverage count
Instead of full match, start to count as soon
as there is 1 match
2018-11-21 08:50:01 +00:00
Pascal Precht c66fe695f0 refactor(@embark/deployment): make use of newly introduced ZERO_ADDRESS 2018-11-20 16:41:32 +01:00
Pascal Precht 8b68beca17 feat: introduce function support for deploy lifecycle hooks
Prior to this commits deployment lifecycle hooks had been defined as Array<string> due
to historical reasons (contracts.js) used to be a json file back in the days.

`deployIf`, `onDeploy` and `afterDeploy` can now be defined as (async)
function and have access to several dependencies such as contract instances and web3.
However, in order to have needed dependencies registered in the dependencies object,
all lifecycle hook dependencies need to be listed in the `deps` property
as shown below.

Also note that this is NOT a breaking change. Existing deployment lifecycle
hooks written in Array<string> style still work.

All three lifecycle hooks can now be defined as (async) functions and get an dependency
object with a shape like this:

```
interface DeploymentLifecycleHookDependencies {
  contracts: Map<string, ContractInstance>;
  web3: Web3Instance
}
```

`deployIf` lifecycle hook has to return a promise (or be defined using async/await and return
a value) like this:

```
contracts: {
  MyToken: {...},
  SimpleStorage: {
    deps: ['MyToken'], // this is needed to make `MyToken` available within `dependencies`
    deployIf: async (dependencies) => {
      return dependencies.contracts.MyToken_address;
    }
  },
}
```

Vanilla promises (instead of async/await) can be used as well:

```
contracts: {
  MyToken: {...},
  SimpleStorage: {
    deps: ['MyToken'],
    deployIf: (dependencies) => {
      return new Promise(resolve => resolve(dependencies.contracts.MyToken_address);
    }
  },
}
```

`onDeploy` as well, returns either a promise or is used using async/await:

```
contracts: {
  SimpleStorage: {
    onDeploy: async (dependencies) => {
      const simpleStorage = dependencies.contracts.SimpleStorage;
      const value = await simpleStorage.methods.get().call();
      console.log(value);
    }
  },
}
```

`afterDeploy` has automatically access to all configured and deployed contracts of the dapp:

```
contracts: {
  SimpleStorage: {...},
  MyToken: {...},
  afterDeploy: (dependencies) => {
    console.log('Done!');
  }
}
```

Closes #1029
2018-11-20 16:41:03 +01:00
Michael Bradley, Jr 53191447f5 build: use yarn for reproducible builds and CI
yarn.lock files are generated for embark and embark-ui, and their package.json
files and other npm related files are updated to support and require using yarn
for development of embark itself and for embark's CI.
2018-11-20 09:25:42 -06:00
Michael Bradley, Jr 9cd50c2031 build: remove and disable npm lock files, rely on pinned dev/deps
Buggy behavior related to npm lock files makes the goal of reproducible builds
and hassle-free automated releases nearly impossible to achieve at
present. With npm's lock files disabled we rely on pinned dependencies (exact
versions only in the package.json files of embark and embark-ui) for a
hopefully good result. This is an experiment while the project is in an alpha
release phase, and if problems are experienced we can return to using
npm-shrinkwrap.json / package-lock.json, or we can investigate a transition to
the yarn package manager, for ourselves and possibly for our users too.
2018-11-20 09:25:42 -06:00
Anthony Laibe 10caddd872 fix(ui): white screen on text editor
Only happens on Firefox
2018-11-20 13:31:50 +00:00