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

Generate all types of addresses when fuzzing. #1122

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

brson
Copy link
Contributor

@brson brson commented Oct 24, 2023

What

Generate both ScAddress::Contract and ScAddress::Account when fuzzing.

Why

Currently only ScAddress::Contract is generated.

Closes #1096

Known limitations

I don't really understand the consequences for fuzz testers of making this change. Maybe there aren't any. I have tested that the fuzzer in soroban-examples continues to work.

Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

I wonder, there could be cases where someone specifically wants arbitrary contract addresses, but I think they can probably produce that themselves using the Address::random fn that just happens to only provide C addresses.

It's important the arbitrary on Address does both because contracts need to be able to handle both and this could be a good thing to catch.

@leighmcculloch leighmcculloch added this pull request to the merge queue Oct 24, 2023
Merged via the queue into stellar:main with commit 6b04bfc Oct 24, 2023
13 of 14 checks passed
brson added a commit to brson/rs-soroban-sdk that referenced this pull request Mar 4, 2024
github-merge-queue bot pushed a commit that referenced this pull request Mar 5, 2024
This reverts commit 6b04bfc.

Closes #1221

### What

In #1122, I changed the
impl of `Arbitrary` for `Address` to generate all types of addresses
instead of only contract addresses. I no longer think that was the
correct thing to do, so this changes the impl back to only generate
contract addresses.

### Why

Described in the issue
#1221

In short, native addresses are difficult to test with, particularly in
conjunction with the native token contract, because they require set up
of storage and trustlines. Doing this setup is possible, but is not
obvious, and users running into such errors during testing are likely to
get stuck.

### Known limitations

This is arguably a breaking change, though only to the testing
environment, and only to fuzzers. I think it is likely there are so few
fuzzing users that nobody will notice; better to do it sooner than
later.
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.

impl SorobanArbitrary for Address always generates contract addresses
2 participants