Module language_e2e_tests::account_universe
source · Expand description
A model to test properties of common Diem transactions.
The structs and functions in this module together form a simplified model of how common Diem transactions should behave. This model is then used as an oracle for property-based tests – the results of executing transactions through the VM should match the results computed using this model.
For examples of property-based tests written against this model, see the
tests/account_universe
directory.
Structs
- Represents the current state of account in a universe, possibly after its state has been updated by running transactions against the universe.
- Mutable references to a pair of distinct accounts picked from a universe.
- Allows pairs of accounts to be uniformly randomly selected from an account universe.
- A set of accounts that has been set up and can now be used to conduct transactions on.
- A set of accounts which can be used to construct an initial state.
- Represents a create-account transaction performed in the account universe.
- Represents a create-account transaction in the account universe where the destination already exists.
- Represents a insufficient balance transaction
- Represents a authkey mismatch transaction
- Represents a peer-to-peer transaction performed in the account universe.
- Represents a rotate-key transaction performed in the account universe.
- Represents a sequence number mismatch transaction
Enums
- Determines the sampling algorithm used to pick accounts from the universe.
Traits
- Represents any sort of transaction that can be done in an account universe.
Functions
- A strategy that returns a random transaction.
- Verify that the account information in the universe matches the information in the executor.
- The number of accounts to run universe-based proptests with. Set with the
UNIVERSE_SIZE
environment variable. - The number of transactions to run universe-based proptests with. Set with the
UNIVERSE_SIZE
environment variable (this function will return twice that). - Returns a [
Strategy
] that provides a variety of balances (or transfer amounts) over a roughly logarithmic distribution. - Run these transactions and make sure that they all cost the same amount of gas.
- Run these transactions and verify the expected output.
- Computes the result for running a transfer out of one account. Also updates the account to reflect this transaction.