Open fvictorio opened 3 years ago
I think I'll validate it for now. As accepting a string is a breaking change.
Why accepting a type that was previously rejected is a breaking change?
This is intended behavior from ethers so, yeah, we should validate it. I guess we should just try/catch
the BigNumber.from
and report the number as invalid if it fails.
We only accept numbers as values for
blockGasLimit
. There are two issues here.The first one is related to big values. Setting the block gas limit to
0x2fffffffffffff
throws this error when starting the node:We should either show a better error or, better still, validate that the number is safe. Besides, we should consider accepting string values for this setting.
The second error is a small one related to
hardhat-ethers
. Setting the block gas limit to0x1fffffffffffff
(which is the value ofNumber.MAX_SAFE_INTEGER
) works and the node starts, but when you try to send a transaction,hardhat-ethers
throws an error caused by this line:https://github.com/nomiclabs/hardhat/blob/1691b92a20506f0fbbdd0097bee1d843b63c0d6e/packages/hardhat-ethers/src/internal/helpers.ts#L325
The problem is that
BigNumber.from
throws for that specific value. I don't know if this is intended or an off-by-one error (see discussion: https://github.com/ethers-io/ethers.js/discussions/1582).