nomicfoundation / hardhat Goto Github PK
View Code? Open in Web Editor NEWHardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
Home Page: https://hardhat.org
License: Other
Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
Home Page: https://hardhat.org
License: Other
A github pages site should work for now
Hi! I was impressed with buidler while working on a side project, so I'm experimenting with switching OpenZeppelin.
Here's my in-progress branch: https://github.com/shrugs/openzeppelin-solidity/tree/feat/buidler
I'm running our test suite (which uses a custom test script scripts/test.sh
to set account balances very high) and running into a large suite of out of gas
errors. I expect it's due to the change in how buidler dynamically calculates gas usage, where truffle just does the dumb "max gas" thing).
You can see a minimally reproducible case by running
npm run test -- test/Bounty.test.js
1) Bounty
against secure contract
with reward
"before each" hook for "cannot claim reward":
RuntimeError: VM Exception while processing transaction: out of gas
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:74:13)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ganache-core/lib/blockchain_double.js:539:26
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/async-eventemitter/node_modules/async/internal/once.js:12:16
at replenish (node_modules/async-eventemitter/node_modules/async/internal/eachOfLimit.js:61:25)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/async-eventemitter/node_modules/async/internal/eachOfLimit.js:71:9
at eachLimit (node_modules/async-eventemitter/node_modules/async/eachLimit.js:43:36)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/async-eventemitter/node_modules/async/internal/doLimit.js:9:16
at VM.AsyncEventEmitter.emit (node_modules/async-eventemitter/lib/AsyncEventEmitter.js:42:3)
at afterBlock (node_modules/ethereumjs-vm/dist/runBlock.js:52:10)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/dist/runBlock.js:174:9
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/dist/cache.js:110:7
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/node_modules/async/dist/async.js:473:16
at replenish (node_modules/ethereumjs-vm/node_modules/async/dist/async.js:1006:25)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/node_modules/async/dist/async.js:1016:9
at eachLimit$1 (node_modules/ethereumjs-vm/node_modules/async/dist/async.js:3196:24)
at Object.<anonymous> (node_modules/ethereumjs-vm/node_modules/async/dist/async.js:1046:16)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/dist/cache.js:106:11
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/node_modules/async/dist/async.js:969:16
at next (node_modules/ethereumjs-vm/node_modules/async/dist/async.js:5225:18)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/dist/cache.js:103:7
at next (node_modules/ethereumjs-vm/node_modules/async/dist/async.js:5223:28)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/dist/cache.js:103:7
2) Bounty
against broken contract
"before each" hook for "can claim reward":
RuntimeError: VM Exception while processing transaction: out of gas
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:74:13)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ganache-core/lib/blockchain_double.js:539:26
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/async-eventemitter/node_modules/async/internal/once.js:12:16
at replenish (node_modules/async-eventemitter/node_modules/async/internal/eachOfLimit.js:61:25)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/async-eventemitter/node_modules/async/internal/eachOfLimit.js:71:9
at eachLimit (node_modules/async-eventemitter/node_modules/async/eachLimit.js:43:36)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/async-eventemitter/node_modules/async/internal/doLimit.js:9:16
at VM.AsyncEventEmitter.emit (node_modules/async-eventemitter/lib/AsyncEventEmitter.js:42:3)
at afterBlock (node_modules/ethereumjs-vm/dist/runBlock.js:52:10)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/dist/runBlock.js:174:9
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/dist/cache.js:110:7
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/node_modules/async/dist/async.js:473:16
at replenish (node_modules/ethereumjs-vm/node_modules/async/dist/async.js:1006:25)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/node_modules/async/dist/async.js:1016:9
at eachLimit$1 (node_modules/ethereumjs-vm/node_modules/async/dist/async.js:3196:24)
at Object.<anonymous> (node_modules/ethereumjs-vm/node_modules/async/dist/async.js:1046:16)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/dist/cache.js:106:11
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/node_modules/async/dist/async.js:969:16
at next (node_modules/ethereumjs-vm/node_modules/async/dist/async.js:5225:18)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/dist/cache.js:103:7
at next (node_modules/ethereumjs-vm/node_modules/async/dist/async.js:5223:28)
at /Users/matt/Projects/crypto/openzeppelin-solidity/node_modules/ethereumjs-vm/dist/cache.js:103:7
manually setting the gas for the failing transactions (namely https://github.com/Shrugs/zeppelin-solidity/blob/feat%2Fbuidler/test/Bounty.test.js#L34) makes that specific transaction succeed.
Cheers, this is a great project.
I am sorry but this is the worst name you could have chosen.
How do you think google will be able to find help sites, you would probably always end up on some construction sites or builder related stuff.
Horrible horrible choice.
Sorry for the lack of helpful code related content but I had to say it.
I'v encountered this twice when trying to produce bytecode for certain contracts.
pragma solidity ^0.4.24;
import "zos-lib/contracts/upgradeability/AdminUpgradeabilityProxy.sol";
contract CustomAdminUpgradeabilityProxy is AdminUpgradeabilityProxy {
bytes32 private constant ADMIN_SLOT = keccak256("org.zeppelinos.proxy.admin.custom");
}
this produces an artifact with valid abi, but an empty string bytecode
property.
bytecode should be produced
There are some breaking changes in solc-js
so it doesn't work. ethereum/solidity#5422 Has more info.
We are currently generating a slightly modified subset of Truffle's artifacts. This is implemented this was because we are Truffle Contracts, but we will remove it asap.
We should choose another artifacts format if there's a good one, or design our own.
This issue is specially important, and we want to have as much feedback as possible.
At the very least artifacts should allow linking, deploying and using already-deployed contracts. But we may also want to provide some extra functionality.
Most of buidler's instability comes from using web3, and in particular web3-provider-engine.
We should consider using ethers.js instead. We could create an ethers-powered web3 shim if necessary.
I haven't had enough time to experiment on this yet, but I think it's a promising idea. Still, it would be a big change, so I'll like to get some feedback about it.
I'm creating this issue to document a known problem.
HDWalletProvider uses Web3ProviderEngine, which needs to be manually stopped. As a workaround you can call process.exit()
at the end of your tasks/scripts.
If #5 is implemented Web3ProviderEngine won't be used anymore, avoiding this issue.
$ buidler console --network xyz
Error BDLR0003: Network "%s" not defined
It’s fully dependent on Truffle and web3. We'll reimplement it once the project is more stable.
Some parts of the codebase expect to run inside a Buidler project. Some testing infra for them is needed.
Arrow functions are discouraged in Mocha tests, because Mocha binds this
to an object that is useful to share data from hooks to test cases.
We should decide which parts of buidler will be compatible with truffle, and why.
My current idea is that buidler should only be compatible enough to make migration from Truffle very easy. I think this is specially important for contracts' tests, which nobody will want to rewrite just to use another tool.
buidler test
now runs truffle-compatible tests, but that ties us to Truffle-contracts, or at least to its APIs. We should consider making explicit what's truffle-compatibility and whats native in buidler, like making those tests runnable with buidler truffle-test
, or even create a buidler-truffle
plugin.
We also implemented their networks configuration system, which is very focused on web3. Specially the provider
field is normally used along web3-provider-engine
, which we want to avoid and may block #5.
This should expose:
It should have two features:
It may make more sense to have two separate providers.
We only support node 8+, so we can use this: https://nodejs.org/dist/latest-v8.x/docs/api/modules.html#modules_require
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.