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

[DRAFT] Stateful testing setup #67

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
823cefc
Add fast-check dependency to package.json for stateful testing
moodmosaic Jul 14, 2024
e807d2b
Add types.ts for defining the Model type, and an ice-breaker invariant
moodmosaic Jul 14, 2024
a290542
Add initial stateful test for BNS-V2 state interactions
moodmosaic Jul 14, 2024
54c1071
Add GetOwnerNone invariant
BowTiedRadone Jul 16, 2024
919de04
Add GetBnsFromIdNone invariant
BowTiedRadone Jul 16, 2024
58cb131
Add GetPrimaryNameNone invariant
BowTiedRadone Jul 16, 2024
1690083
Add GetNamespacePropertiesErr invariant
BowTiedRadone Jul 16, 2024
1643b1a
Add GetNamespacePrice invariant
BowTiedRadone Jul 16, 2024
452f704
Add CanNamespaceBeRegisteredTrue invariant
BowTiedRadone Jul 17, 2024
2ae47bb
Add NamespacePreorder invariant
BowTiedRadone Jul 17, 2024
3f63649
Add NamespaceReveal invariant
BowTiedRadone Jul 19, 2024
bf96e57
Add GetTokenUri invariant
BowTiedRadone Jul 24, 2024
c4ddb64
Add GetIdFromBnsNone
BowTiedRadone Jul 24, 2024
c0f3ee9
Add GetBnsInfoNone invariant
BowTiedRadone Jul 24, 2024
3c44adf
Add checks for burned uSTX and TTLs
BowTiedRadone Jul 24, 2024
ea102b0
Add MngNamePreorder invariant
BowTiedRadone Jul 25, 2024
487be2d
Add name to namePreorders key creation
BowTiedRadone Jul 26, 2024
a8106d8
Use ST27PT00YS01KBAEEETAH45C1H46C3FMJR31SN2S3.TESTNET-BNS-V2 in tests…
moodmosaic Jul 26, 2024
13fe63d
Implement weighted invariants logic
BowTiedRadone Jul 26, 2024
c091c86
Update `numRuns` and `size` to fit vitest timeout
BowTiedRadone Jul 26, 2024
cb28312
Update logging function to log live
BowTiedRadone Jul 31, 2024
a79383f
Fix NamespaceReveal check condition
BowTiedRadone Jul 31, 2024
61935de
Add NamespaceLaunch invariant
BowTiedRadone Jul 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions tests/BNS-V2.stateful.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,18 @@ it("executes BNS-V2 state interactions", async () => {
GetBnsInfoNone(filteredAccounts),
CanNamespaceBeRegisteredTrue(filteredAccounts),
NamespacePreorder(filteredAccounts),
MngNamePreorder(filteredAccounts),
{ arbitrary: MngNamePreorder(filteredAccounts), weight: 3 },
NamespaceReveal(filteredAccounts, model),
];

fc.assert(
fc.property(fc.commands(invariants, { size: "+1" }), (cmds) => {
const state = () => ({ model, real: simnet });
fc.modelRun(state, cmds);
}),
{ numRuns: 10000, verbose: fc.VerbosityLevel.VeryVerbose }
fc.property(
fc.array(fc.oneof(...invariants), { size: "+1" }),
Copy link
Author

Choose a reason for hiding this comment

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

Nice 👍 We should always use fc.array/fc.oneof instead of fc.commands. Explicit is better than implicit.

(cmds) => {
const state = () => ({ model, real: simnet });
fc.modelRun(state, cmds);
},
),
{ numRuns: 10000, verbose: fc.VerbosityLevel.VeryVerbose },
);
});