Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Gracelessly shove Hardhat support into truffle debug #5410

Closed
wants to merge 1 commit into from

Conversation

gnidan
Copy link
Contributor

@gnidan gnidan commented Aug 8, 2022

wip... this is a hack and a half

network_id: "*"
};

require(`${config.working_directory}/node_modules/hardhat/register`);
Copy link

@alcuadrado alcuadrado Aug 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed if you import hardhat below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it without this and this line was necessary... I think I'm going to go with the approach of shelling out to node -r hardhat/register instead of this.

artifacts
} = require(`${config.working_directory}/node_modules/hardhat`);
const buildInfoPaths = await artifacts.getBuildInfoPaths();
const buildInfos = await Promise.all(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will lead to an OOM. I'd read one build info at the time, as they can be huge. They have the entire solc output, so they can take 100mb+ in some large projects.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call!

const { _format } = buildInfo;

if (!supportedFormats.has(_format)) {
throw new Error(`Unsupported build info format: ${_format}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3

It's great that you are validating this!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course :D

@gnidan
Copy link
Contributor Author

gnidan commented Aug 13, 2022

I want this branch name back.

@gnidan gnidan closed this Aug 13, 2022
@gnidan gnidan deleted the debug/hardhat branch August 13, 2022 03:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants