Skip to content

Conversation

@iFrostizz
Copy link
Contributor

Hotfix for #5753
Closes #5563

I have introduced a bug that didn't filtered the tests correctly using the construct.
Fixes and ~slight refactor so that won't repeat cause we don't depend on 2 instance of the same code.
Also we don't need to turn off debug traces, what I initially thought was a big performance penalty was just proptest shrinking while it wasn't ran in --release mode

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.

lgtm, are we sure this fixes filtering? is anything else broken right now?

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.

needs fixing on tests—let's make sure this works very well before merging

@iFrostizz
Copy link
Contributor Author

Yeah @Evalir , forge debug is broken with "Invalid hex calldata" but I'm wondering if we shouldn't just nuke it at this point, c.f. #4793 (comment)
tldr it serves the same purpose as forge script --debug and is just redundant
You can see that it's forge script with less stuff, it's even calling run_script soooo https://github.com/foundry-rs/foundry/blob/master/crates/forge/bin/cmd/debug.rs#L43-L56

@Evalir
Copy link
Member

Evalir commented Sep 12, 2023

@iFrostizz happy to jettison it but let's do it in another PR—don't wanna mix a hotfix with removing a feature :) one thing at a time

@iFrostizz
Copy link
Contributor Author

iFrostizz commented Sep 12, 2023

Yep @Evalir , that was a blunder introduced in #5692
We should probably write some tests at a later point that make sure that the debugger opens (no crash) with the right breakpoints so these would have been caught on CI

@iFrostizz
Copy link
Contributor Author

iFrostizz commented Sep 12, 2023

So just to make it clear is it okay if forge debug is currently broken ? Do we have a consensus to drop it ? (personally in favor of doing it)
If it's a yes, TODO: do lots of changes in the docs, where forge debug is mentioned and mostly replace by forge script --debug (it's almost a drop-in replacement, which is why is makes sense to drop it) as well as in the forge commands.

@iFrostizz iFrostizz requested a review from Evalir September 12, 2023 15:53
@Evalir
Copy link
Member

Evalir commented Sep 12, 2023

hmm, i think it requires a bit of discussion with the community as well as this is technically a breaking change—is it possible to fix up forge debug first? @iFrostizz

@mattsse
Copy link
Member

mattsse commented Sep 12, 2023

can you elaborate on what is broken and why dropping forge debug is a good idea from your pov? @iFrostizz

@iFrostizz
Copy link
Contributor Author

@Evalir good idea, let's fix this stuff first
@mattsse coming from #4793 (comment) . forge debug is basically a slimmed down version of forge script --debug because it has much less options and hardcode stuffs just to satisfy the "script" part. It a big footgun imo, just like the scenario of the guy linked before. Because people may think that their script cannot be debugged while they should just use forge script --debug.
For legacy reasons, we could just copy the behavior of forge script --debug over forge debug, not sure if clap can flatten structs and hide fields from the command line conditionally cause a new struct can be created by composition not inheritance in Rust. dunno

@iFrostizz
Copy link
Contributor Author

We can just flatten DebugArgs with [clap(flatten)] and make ScriptArgs composed from DebugArgs

@Evalir
Copy link
Member

Evalir commented Sep 12, 2023

@iFrostizz i believe that should be good enough—will we include this in this PR?

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.

Thanks for the fix! Can you confirm you've QA'd this and works?

Also, unrelated, but I'd recommend enabling git commit signing—it's more secure and a good practice.

@iFrostizz
Copy link
Contributor Author

@Evalir just dropped the stuff, let's see how you find it.
Sorry for the pgp stuff, just switched to a new DE, need to bring it back in a min

@iFrostizz iFrostizz requested a review from Evalir September 12, 2023 19:32
@iFrostizz
Copy link
Contributor Author

  • forge test
    • default
    • debugger
    • breakpoints
  • forge script
    • default
    • debugger
    • breakpoints
  • forge debug
    • default (debugger)
    • breakpoints

look good!

@iFrostizz
Copy link
Contributor Author

The last commit just makes ScriptArgs "inherits" (it's composed from) DebugArgs with the only diff that debug is hardcoded to true for DebugArgs. Keeping it for legacy purposes, but you can see how duplicated that command feels like. In short it's forge script without the --debug flag.

@Evalir
Copy link
Member

Evalir commented Sep 21, 2023

friendly ping @iFrostizz

@iFrostizz
Copy link
Contributor Author

Yep, sorry @Evalir !

@iFrostizz iFrostizz requested a review from Evalir September 21, 2023 16:12
@iFrostizz
Copy link
Contributor Author

So now, forge script --debug ARGS is always equivalent to forge debug ARGS

@iFrostizz
Copy link
Contributor Author

wait fuzzing is still broken for forge debugand forge script --debug

@iFrostizz
Copy link
Contributor Author

@Evalir I get it, script's --sig flag is not supposed to be ran against any argument-based function, so no fuzzing for scripts, makes sense yeah ?
LGTM otherwise

@Evalir
Copy link
Member

Evalir commented Sep 21, 2023

Yep, I think this makes sense—no reason why would you fuzz in a script!

thank you, will review soon!

@Evalir Evalir requested a review from mattsse September 21, 2023 20:26
@iFrostizz
Copy link
Contributor Author

@mattsse friendly ping
Making sure you saw that review request

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

I have introduced a bug that didn't filtered the tests correctly using the construct.

I want to do these always in two steps, fix first then refactor.

this is not really easy to review because unclear what the fix is and what refactor.

Comment on lines +37 to +62
/// Max priority fee per gas for EIP1559 transactions.
#[clap(
long,
env = "ETH_PRIORITY_GAS_PRICE",
value_parser = parse_ether_value,
value_name = "PRICE"
)]
pub priority_gas_price: Option<U256>,

/// Use legacy transactions instead of EIP1559 ones.
///
/// This is auto-enabled for common networks without EIP1559.
#[clap(long)]
pub debug: bool,
pub legacy: bool,

/// Broadcasts the transactions.
#[clap(long)]
pub broadcast: bool,

/// Skips on-chain simulation.
#[clap(long)]
pub skip_simulation: bool,

/// Relative percentage to multiply gas estimates by.
#[clap(long, short, default_value = "130")]
pub gas_estimate_multiplier: u64,
Copy link
Member

Choose a reason for hiding this comment

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

I'm having trouble understanding why changing all these fields is necessary in order to fix the referenced issue?

@mattsse
Copy link
Member

mattsse commented Sep 25, 2023

I have introduced a bug that didn't filtered the tests correctly using the construct.

this PR should then fix this bug,

could you please split this into two, because rn it looks like this pr does multiple things

@mattsse
Copy link
Member

mattsse commented Sep 25, 2023

but maybe @Evalir has already checked it, in which case I'm okay with merging, codewise this looks fine, but the impl figment macro is now no longer accurate

@Evalir
Copy link
Member

Evalir commented Sep 25, 2023

@mattsse im feeling uneasy about this PR due to the same reasons you mentioned—I'm in favor of splitting to make changes smaller and ideally also not screw up the figment macro

@Evalir
Copy link
Member

Evalir commented Nov 1, 2023

Closing, this was fixed recently in another PR.

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.

forge test --debug fails with Invalid hex calldata when invoked on tests that take fuzz arguments

3 participants