IoBuilders / truffle-contract-size

Displays the size of a truffle contracts in kilobytes
Apache License 2.0
22 stars 6 forks source link

Program displays empty output boxes #12

Open MathiusEire opened 3 years ago

MathiusEire commented 3 years ago

as stated the output of the program after it runs is just 2 empty output boxes with their corresponding contract and size labels

daniel-iobuilders commented 3 years ago

Hi @MathiusEire this happens when the plugin does not find any contracts. Is the project where this happens open source? It would help a lot to see the configuration of the project to narrow down the bug.

MathiusEire commented 3 years ago

The project I’m working off of is the github “optimism-box” , first result in google most likely

On Thu 8 Jul 2021 at 08:55, Daniel Lehrner @.***> wrote:

Hi @MathiusEire https://github.com/MathiusEire this happens when the plugin does not find any contracts. Is the project where this happens open source? It would help a lot to see the configuration of the project to narrow down the bug.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/IoBuilders/truffle-contract-size/issues/12#issuecomment-876218063, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIUFNGQ4KFNVD4QF5ZDHPLLTWVKVHANCNFSM477N45RQ .

daniel-iobuilders commented 3 years ago

I executed the following commands:

mkdir optimism-box
cd optimism-box
truffle unbox optimism-box
npm install truffle-contract-size
# add plugin to truffle-config.js
npx truffle compile
npx truffle run contract-size

Then I got the following result:

│ Contract                                                             │ Size     │
│ SimpleStorage                                                   │ 0.19 KiB │

So it seems to work. Have you maybe not compiled the contracts before executing truffle run contract-size? The contracts need to be compiled first in order to calculate the contract size. If not an empty table is shown.

MathiusEire commented 3 years ago

If I was to take a guess I’d imagine it’s because the program only checks the contracts compiled with the evm rather then the ovm I’m currently exploring

On Thu 8 Jul 2021 at 11:08, Daniel Lehrner @.***> wrote:

I executed the following commands:

mkdir optimism-box

cd optimism-box

truffle unbox optimism-box

npm install truffle-contract-size

add plugin to truffle-config.js

npx truffle compile

npx truffle run contract-size

Then I got the following result:

│ Contract │ Size │

│ SimpleStorage │ 0.19 KiB │

So it seems to work. Have you maybe not compiled the contracts before executing truffle run contract-size? The contracts need to be compiled first in order to calculate the contract size. If not an empty table is shown.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/IoBuilders/truffle-contract-size/issues/12#issuecomment-876310918, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIUFNGVJVUVNEVSS3I4GGP3TWV2IPANCNFSM477N45RQ .

daniel-iobuilders commented 3 years ago

I did not realize that there is another truffle configuration file in the project for the ovm. You have to specify it when running any truffle command if not it will always use the default configuration, which points to the EVM contracts. With the following commands it works:

npm install truffle-contract-size
# add plugin configuration to truffle-config.ovm.js
npm run compile:ovm
npx truffle run contract-size --config truffle-config.ovm.js

Then I get:

Contract                                                         │ Size      │
SimpleStorage                                               │ 0.45 KiB |
MathiusEire commented 3 years ago

Yeah that makes more sense , that I really a contract won’t have enough gas on the ovm/evm due to the 24kb limit right ?

On Thu 8 Jul 2021 at 23:14, Daniel Lehrner @.***> wrote:

I did not realize that there is another truffle configuration file in the project for the ovm. You have to specify it when running any truffle command if not it will always use the default configuration, which points to the EVM contracts. With the following commands it works:

npm install truffle-contract-size

add plugin configuration to truffle-config.ovm.js

npm run compile:ovm

npx truffle run contract-size --config truffle-config.ovm.js

Then I get:

Contract │ Size │

SimpleStorage │ 0.45 KiB |

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/IoBuilders/truffle-contract-size/issues/12#issuecomment-876779815, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIUFNGT2OLIY7GPAHIAHV7TTWYPMRANCNFSM477N45RQ .