Skip to content

Commit 686512e

Browse files
committed
Initial import of Buidler EVM and release 1.0.1
1 parent b3e6b22 commit 686512e

File tree

579 files changed

+21148
-2406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

579 files changed

+21148
-2406
lines changed

.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
package-lock=false
1+
package-lock=false

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ install:
1515
- scripts/install.sh
1616

1717
script:
18+
- npx tsc --version
1819
- npm run test
1920
- npm run lint
2021
- node scripts/check-dependencies.js

CONTRIBUTING.md

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ To install this project you have to run:
1818
## Building the projects
1919

2020
Plugins require buidler-core to be built or tested. Our recommendation is to run `npm run watch` from the root folder.
21-
This will keep everything compiled, and these problems will be avoided.
21+
This will keep everything compiled, and these problems will be avoided.
2222

2323
## Testing
2424

@@ -30,46 +30,73 @@ You can run a package's tests by executing `npm run test` inside its folder. Or
3030
## Code formatting
3131

3232
We use [Prettier](https://prettier.io/) to format all the code without any special configuration. Whatever Prettier does
33-
is considered The Right Thing. It's completely fine to commit non-prettied code and then reformat it in a later commit.
33+
is considered The Right Thing. It's completely fine to commit non-prettied code and then reformat it in a later commit.
3434

3535
We also have [tslint](https://palantir.github.io/tslint/) installed in all the projects. It checks that you have run
3636
Prettier and forbids some dangerous patterns.
3737

38-
The linter is always run in the CI, so make sure it passes before pushing code. You can use `npm run lint` and
38+
The linter is always run in the CI, so make sure it passes before pushing code. You can use `npm run lint` and
3939
`npm run lint:fix` inside the packages' folders.
4040

4141
## Dependencies
4242

43-
We keep our dependencies versions in sync between the different projects.
43+
We keep our dependencies versions in sync between the different projects.
4444

4545
Running `node scripts/check-dependencies.js` from the root folder checks that every project specifies the same versions
46-
of each dependency. It will print an error if the versions get out of sync.
46+
of each dependency. It will print an error if the versions get out of sync.
4747

4848
## Performance and dependencies loading
4949

50-
Buidler and its plugins are optimized for keeping startup time low.
50+
Buidler and its plugins are optimized for keeping startup time low.
5151

5252
This is done by selectively requiring dependencies when needed using `import` or `require` following this criteria:
5353

54-
1. If something is only imported for its type, and NOT its value, use a top-level `import ... from "mod"`
54+
1. If something is only imported for its type, and NOT its value, use a top-level `import ... from "mod"`
5555
1. If a module is in the least below, use a top-level `import ... from "mod""`.
56-
3. Otherwise, use `await import` or `require` locally in the functions that use it.
57-
3.1. If the function is sync, use node's `require`
58-
3.2. If the function is an async, use `await import`
56+
1. Otherwise, use `await import` or `require` locally in the functions that use it.
57+
3.1. If the function is sync, use node's `require`
58+
3.2. If the function is an async, use `await import`
5959

6060
Note that these rules don't apply to tests. You can always use top-level imports there.
6161

6262
### Essential modules
6363

6464
This is a list of the modules that always get loaded during startup:
6565

66-
* `fs`
67-
* `path`
68-
* `util`
69-
* `find-up`
70-
* `fs-extra`
71-
* `chalk`
72-
* `semver`
73-
* `deepmerge`
74-
* `source-map-support/register`
75-
66+
- `fs`
67+
- `path`
68+
- `util`
69+
- `find-up`
70+
- `fs-extra`
71+
- `chalk`
72+
- `semver`
73+
- `deepmerge`
74+
- `source-map-support/register`
75+
76+
## Common errors
77+
78+
### Monkey-patching dependencies multiple times
79+
80+
You should avoid monkey-patching whenever possible. But if it's necessary to do so, you should pay extra care when doing
81+
it in Buidler or your tests may fail in very hard to debug ways.
82+
83+
When tests are run, Buidler gets initialized multiple times. That may lead to monkey-patching the same multiple times.
84+
To avoid this, keep references to the original implementations. In order to do this, you need to get it just once:
85+
86+
```js
87+
let originalImpl; // May be a global
88+
89+
// ...
90+
91+
if (originalImpl === undefined) {
92+
originalImpl = lib.func;
93+
}
94+
95+
lib.func = function(...args) {
96+
// Do something;
97+
return originalImpl.apply(this, args);
98+
};
99+
```
100+
101+
This isn't normally a problem if you are monkey-patching an object's methods. But it is when monkey-patching a class
102+
or its prototype.

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SEE LICENSE IN EACH PACKAGE'S LICENSE FILE
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module "ethereumjs-abi";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module "ethereumjs-block";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module "ganache-core";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module "merkle-patricia-tree/secure";

docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
/api
33
/.vuepress/dist
44
.DS_Store
5+
/errors/README.md
6+
wget-readmes.sh

docs/.vuepress/components/Plugins.vue

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div class="plugin" v-for="plugin in plugins">
99
<div>
1010
<span class="name"><a :href="plugin.url">{{ plugin.name }}</a></span>
11-
<span class="version">{{ plugin.version }}</span>
11+
<!-- <span class="version">{{ plugin.version }}</span> -->
1212
</div>
1313
<p class="description">{{ plugin.description }}</p>
1414
<div class="tags">
@@ -21,75 +21,9 @@
2121

2222
<script>
2323
24-
25-
let plugins = [
26-
{
27-
name: "@nomiclabs/buidler-truffle4",
28-
version: "1.0.0-beta.9",
29-
url: "https://github.com/nomiclabs/buidler/tree/master/packages/buidler-truffle4",
30-
description: "Integration with TruffleContract from Truffle 4",
31-
tags: ["Truffle", "Testing"]
32-
}, {
33-
name: "@nomiclabs/buidler-truffle5",
34-
version: "1.0.0-beta.9",
35-
url: "https://github.com/nomiclabs/buidler/tree/master/packages/buidler-truffle5",
36-
description: "Integration with TruffleContract from Truffle 5",
37-
tags: ["Truffle", "Testing"],
38-
}, {
39-
name: "@nomiclabs/buidler-web3",
40-
version: "1.0.0-beta.9",
41-
url: "https://github.com/nomiclabs/buidler/tree/master/packages/buidler-web3",
42-
description: "Injects Web3 1.x into the Buidler Runtime Environment",
43-
tags: ["Web3.js", "Testing", "Tasks", "Scripts"],
44-
}, {
45-
name: "@nomiclabs/buidler-web3-legacy",
46-
version: "1.0.0-beta.9",
47-
url: "https://github.com/nomiclabs/buidler/tree/master/packages/buidler-web3-legacy",
48-
description: "Injects Web3 0.20.x into the Buidler Runtime Environment",
49-
tags: ["Web3.js", "Legacy", "Testing", "Tasks", "Scripts"],
50-
}, {
51-
name: "@nomiclabs/buidler-ethers",
52-
version: "1.0.0-beta.9",
53-
url: "https://github.com/nomiclabs/buidler/tree/master/packages/buidler-ethers",
54-
description: "Injects ethers.js into the Buidler Runtime Environment",
55-
tags: ["Ethers.js", "Testing", "Tasks", "Scripts"],
56-
}, {
57-
name: "@nomiclabs/buidler-etherscan",
58-
version: "1.0.0-beta.9",
59-
url: "https://github.com/nomiclabs/buidler/tree/master/packages/buidler-etherscan",
60-
description: "Automatically verify contracts on Etherscan",
61-
tags: ["Etherscan", "Verification"],
62-
}, {
63-
name: "@nomiclabs/buidler-solpp",
64-
version: "1.0.0-beta.9",
65-
url: "https://github.com/nomiclabs/buidler/tree/master/packages/buidler-solpp",
66-
description: "Automatically run the solpp preprocessor before each compilation",
67-
tags: ["Solpp", "Preprocessor"],
68-
}, {
69-
name: "@nomiclabs/buidler-solhint",
70-
version: "1.0.0-beta.9",
71-
url: "https://github.com/nomiclabs/buidler/tree/master/packages/buidler-solhint",
72-
description: "Easily run solhint to lint your Solidity code",
73-
tags: ["Solhint", "Linter"]
74-
}, {
75-
name: "@nomiclabs/buidler-vyper",
76-
version: "1.0.0-beta.9",
77-
url: "https://github.com/nomiclabs/buidler/tree/master/packages/buidler-vyper",
78-
description: "Adds support to compile Vyper smart contracts",
79-
tags: ["Vyper", "Compiler"]
80-
},
81-
{
82-
name: "buidler-gas-reporter",
83-
version: "0.1.2",
84-
url: "https://github.com/cgewecke/buidler-gas-reporter",
85-
description: "Gas usage per unit test. Average gas usage per method. A mocha reporter.",
86-
tags: ["Testing", "Gas"]
87-
}
88-
];
89-
9024
export default {
9125
data() {
92-
return {"plugins": plugins};
26+
return {"plugins": require("../plugins.js")};
9327
}
9428
}
9529

0 commit comments

Comments
 (0)