Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(forge): Add errors field to forge inspect #5228

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

Sabnock01
Copy link
Contributor

Motivation

Currently it is possible to get the selectors for functions (methodIdentifiers) and events (events) but not errors.

Solution

This PR adds a errorsfield to the forge inspectcommand.

Comment on lines +171 to +179
for er in abi.errors.iter().flat_map(|(_, errors)| errors) {
let types =
er.inputs.iter().map(|p| p.kind.to_string()).collect::<Vec<_>>();
let sig = format!("{:x}", er.signature());
let sig_trimmed = &sig[0..8];
out.insert(
format!("{}({})", er.name, types.join(",")),
sig_trimmed.to_string().into(),
);
Copy link
Member

Choose a reason for hiding this comment

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

this seems fine,
no strong opinion on the format here tbh,

defer to @Evalir

Copy link
Member

Choose a reason for hiding this comment

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

I like this! Tested and format is the same as when printing events—looks good IMHO.

Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

nice, thank you!

Comment on lines +171 to +179
for er in abi.errors.iter().flat_map(|(_, errors)| errors) {
let types =
er.inputs.iter().map(|p| p.kind.to_string()).collect::<Vec<_>>();
let sig = format!("{:x}", er.signature());
let sig_trimmed = &sig[0..8];
out.insert(
format!("{}({})", er.name, types.join(",")),
sig_trimmed.to_string().into(),
);
Copy link
Member

Choose a reason for hiding this comment

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

I like this! Tested and format is the same as when printing events—looks good IMHO.

@Evalir Evalir merged commit a14e682 into foundry-rs:master Jun 27, 2023
@Sabnock01 Sabnock01 deleted the feat/forge-inspect-errors branch June 27, 2023 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants