Truffle: Error message when exceeding block gas limit presents comparable numbers in different bases

Created on 28 Jan 2020  路  2Comments  路  Source: trufflesuite/truffle

Issue

When sending more gas than the network's current block limit, the error message that comes back is confusing and can/should be clarified.

Steps to Reproduce

In truffle-config, specify a "gas" value which is higher than the block gas limit for the network you are connected to. Attempt to do a basic migration or any other Truffle transaction.

Expected Behavior

The "Block limit" and "Gas sent" values are both in the same base, probably decimal. Then the user can easily see that the "gas sent" number is larger than the "block limit" and possibly do something about it.

Actual Results

As shown in this issue:

"Migrations" exceeded the block limit (with a gas value you set).

  • Block limit: 0x20175c8
  • Gas sent: 6721975
    ...

The inequality between these two going the wrong way is the core issue, but using different bases obscures that comparison and makes the error harder to understand.

Environment

  • Truffle version (truffle version): 5.1.0
Migrations good first issue help wanted priority4 馃搵

Most helpful comment

On further reflection, I think it would actually be better to show both numbers in both bases e.g.

"Migrations" exceeded the block limit (with a gas value you set).

  • Block limit: 33650120 (0x20175c8)
  • Gas sent: 6721975 (0x6691b7)

ideally with at least the decimal values right-aligned between rows (hard to show that in markdown outside source).

In the example copied in, the clearer message format doesn't seem consistent with the error message given, which may be a separate issue, but having comparable bases will at least help in cases where the gas sent is actually greater than the block gas limit.

Relevant comment by @cgewecke here.

All 2 comments

On further reflection, I think it would actually be better to show both numbers in both bases e.g.

"Migrations" exceeded the block limit (with a gas value you set).

  • Block limit: 33650120 (0x20175c8)
  • Gas sent: 6721975 (0x6691b7)

ideally with at least the decimal values right-aligned between rows (hard to show that in markdown outside source).

In the example copied in, the clearer message format doesn't seem consistent with the error message given, which may be a separate issue, but having comparable bases will at least help in cases where the gas sent is actually greater than the block gas limit.

Relevant comment by @cgewecke here.

Yeah totally we should have both bases there.

(You don't like subtracting decimal from hex numbers?? ;)

Was this page helpful?
0 / 5 - 0 ratings