Skip to content

Comments

feat(forge): fuzz & invariant config#2882

Merged
mattsse merged 13 commits intomasterfrom
rkrasiuk/feat-invariant-config
Aug 25, 2022
Merged

feat(forge): fuzz & invariant config#2882
mattsse merged 13 commits intomasterfrom
rkrasiuk/feat-invariant-config

Conversation

@rkrasiuk
Copy link
Collaborator

@rkrasiuk rkrasiuk commented Aug 22, 2022

create fuzz & invariant testing configuration discussed in #1572

@rkrasiuk rkrasiuk marked this pull request as draft August 22, 2022 15:49
@rkrasiuk rkrasiuk added A-testing Area: testing T-feature Type: feature labels Aug 22, 2022
@rkrasiuk rkrasiuk changed the title feat(forge): invariant config feat(forge): fuzz & invariant config Aug 22, 2022
@rkrasiuk rkrasiuk marked this pull request as ready for review August 25, 2022 10:51
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.

nice, this looks very good!

Comment on lines +157 to +178
[fuzz]
runs = 256
max_local_rejects = 1024
max_global_rejects = 65536
seed = '0x3e8'
dictionary_weight = 40
include_storage = true
include_push_bytes = true

[invariant]
runs = 256
depth = 15
fail_on_revert = false
call_override = false
dictionary_weight = 80
include_storage = true
include_push_bytes = true

[fmt]
line_length = 100
tab_width = 2
bracket_spacing = true
Copy link
Member

Choose a reason for hiding this comment

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

awesome

@joshieDo
Copy link
Collaborator

joshieDo commented Aug 25, 2022

I feel like maybe we need to extend dictionary_weight.

We do use weights for more stuff (wherever there is an Union basically). Either here, or on a not-so-late follow-up PR.

// Stores fuzz state for use with [fuzz_calldata_from_state].
let fuzz_state: EvmFuzzState = build_initial_state(self.executor.backend().mem_db());
let fuzz_state: EvmFuzzState =
build_initial_state(self.executor.backend().mem_db(), self.config.include_storage);
Copy link
Collaborator

Choose a reason for hiding this comment

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

just leaving a note, that if this gets merged #2929 , we should update build_initial_state to reflect that

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yup, i saw that, thanks. waiting for it to get merged to update

@rkrasiuk
Copy link
Collaborator Author

@joshieDo hmm, from UX standpoint, do u think we should just keep adding _weight suffixed entries?

@rkrasiuk
Copy link
Collaborator Author

@mattsse since this is a breaking change, do you think it's smth we should fix w/ forge config --fix?

@mattsse
Copy link
Member

mattsse commented Aug 25, 2022

given that invariant and fmt were just added and not part of a release yet, this should be fine imo

@mattsse mattsse merged commit 0f7e332 into master Aug 25, 2022
@mattsse mattsse deleted the rkrasiuk/feat-invariant-config branch August 25, 2022 14:58
iFrostizz pushed a commit to iFrostizz/foundry that referenced this pull request Nov 9, 2022
* invariant config

* separate fuzz & invariant configs

* misc fixes & value config flags

* dict weight

* fix it tests

* fix tests & add validation

* fix docs

* dapp compatibility

* newline

* fallback provider

* address comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-testing Area: testing T-feature Type: feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants