-
Notifications
You must be signed in to change notification settings - Fork 70
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
Remove use of rand from generated addresses, nonces, salts, and issuer pks #1135
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
leighmcculloch
commented
Nov 7, 2023
dmkozh
approved these changes
Nov 7, 2023
6 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 11, 2023
### What Autosave a test snapshot file on every test exit. ### Why To encourage the over-time consistency testing of contracts. To provide a mechanism where any developer who commits the generated files can see changes in observable behavior that arises unexpectedly over time. Close #1082 ### Merging To be merged to `main` after: - [x] Adding events to the `Snapshot`. - [ ] ~Adding budget to the `Snapshot`. _(Maybe, seems less clear if should be included.)_~ - [x] Support multiple Envs in a single test writing multiple files. - [x] #1142 - [x] stellar/rs-soroban-env#1182 - [x] #1135
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Remove use of rand from generated addresses, nonces, salts, and issuer pks, replace with sequential values instead.
Why
The SDK generates random addresses, nonces, salts, and issuer pks. This randomness makes it near impossible to write any test that produces predictable and consistent total system state.
The SDK doesn't need to be using random values for these things. It just needs to produce values that don't matter and that are unique.
Predictable and consistent values make it easier to write tests that can be used over time to assess the consistency of a contract. This is an important attribute of tests so that folks can evaluate if their contract is consistent even with dependency upgrades, SDK upgrades, and protocol upgrades.
This change also introduces the concept of a
Snapshot
, which is a superset of the existingLedgerSnapshot
. TheLedgerSnapshot
contains everything needed to load in a ledger from a network or other source.Snapshot
contains everything needed to rehydrate the state of an SDK testutils backed Env.Related discussion in Discord: https://discord.com/channels/897514728459468821/1171226885171191949
For #1082