mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-01-12 08:34:43 +08:00
refactor(pox-4-tests): Move PoX-4 stateful property-based tests
- Relocate PoX-4 stateful property-based tests from ../core-contract-tests/tests/pox-4/ to boot-contracts-stateful-prop-tests/tests/pox-4. - Implement a minimalistic vitest and Clarinet project setup. - Adjust configurations for optimal test isolation. - Ensure Clarinet config is as minimalistic as possible. - For more details, see: https://github.com/stacks-network/stacks-core/pull/4725#issuecomment-2082701083
This commit is contained in:
8
contrib/boot-contracts-stateful-prop-tests/.gitignore
vendored
Normal file
8
contrib/boot-contracts-stateful-prop-tests/.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
coverage
|
||||
*.info
|
||||
costs-reports.json
|
||||
node_modules
|
||||
history.txt
|
||||
2
contrib/boot-contracts-stateful-prop-tests/Clarinet.toml
Normal file
2
contrib/boot-contracts-stateful-prop-tests/Clarinet.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
[project]
|
||||
name = "boot-contracts-stateful-prop-tests"
|
||||
@@ -0,0 +1,52 @@
|
||||
---
|
||||
id: 0
|
||||
name: "Simulated deployment, used as a default for `clarinet console`, `clarinet test` and `clarinet check`"
|
||||
network: simnet
|
||||
genesis:
|
||||
wallets:
|
||||
- name: deployer
|
||||
address: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
balance: "100000000000000"
|
||||
- name: wallet_1
|
||||
address: ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5
|
||||
balance: "100000000000000"
|
||||
- name: wallet_2
|
||||
address: ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG
|
||||
balance: "100000000000000"
|
||||
- name: wallet_3
|
||||
address: ST2JHG361ZXG51QTKY2NQCVBPPRRE2KZB1HR05NNC
|
||||
balance: "100000000000000"
|
||||
- name: wallet_4
|
||||
address: ST2NEB84ASENDXKYGJPQW86YXQCEFEX2ZQPG87ND
|
||||
balance: "100000000000000"
|
||||
- name: wallet_5
|
||||
address: ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB
|
||||
balance: "100000000000000"
|
||||
- name: wallet_6
|
||||
address: ST3AM1A56AK2C1XAFJ4115ZSV26EB49BVQ10MGCS0
|
||||
balance: "100000000000000"
|
||||
- name: wallet_7
|
||||
address: ST3PF13W7Z0RRM42A8VZRVFQ75SV1K26RXEP8YGKJ
|
||||
balance: "100000000000000"
|
||||
- name: wallet_8
|
||||
address: ST3NBRSFKX28FQ2ZJ1MAKX58HKHSDGNV5N7R21XCP
|
||||
balance: "100000000000000"
|
||||
- name: wallet_9
|
||||
address: STNHKEPYEPJ8ET55ZZ0M5A34J0R3N5FM2CMMMAZ6
|
||||
balance: "100000000000000"
|
||||
contracts:
|
||||
- costs
|
||||
- pox
|
||||
- pox-2
|
||||
- pox-3
|
||||
- pox-4
|
||||
- lockup
|
||||
- costs-2
|
||||
- costs-3
|
||||
- cost-voting
|
||||
- bns
|
||||
plan:
|
||||
batches:
|
||||
- id: 0
|
||||
transactions: []
|
||||
epoch: "2.4"
|
||||
2394
contrib/boot-contracts-stateful-prop-tests/package-lock.json
generated
Normal file
2394
contrib/boot-contracts-stateful-prop-tests/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
contrib/boot-contracts-stateful-prop-tests/package.json
Normal file
23
contrib/boot-contracts-stateful-prop-tests/package.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "boot-contracts-stateful-prop-tests",
|
||||
"version": "1.0.0",
|
||||
"description": "Run stateful property-based tests on this project.",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "vitest run"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@hirosystems/clarinet-sdk": "^2.6.0",
|
||||
"@stacks/stacking": "^6.14.0",
|
||||
"@stacks/transactions": "^6.13.1",
|
||||
"chokidar-cli": "^3.0.0",
|
||||
"fast-check": "^3.18.0",
|
||||
"typescript": "^5.4.5",
|
||||
"vite": "^5.2.10",
|
||||
"vitest": "^1.5.2",
|
||||
"vitest-environment-clarinet": "^2.1.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
[network]
|
||||
name = "devnet"
|
||||
|
||||
[accounts.deployer]
|
||||
mnemonic = "twice kind fence tip hidden tilt action fragile skin nothing glory cousin green tomorrow spring wrist shed math olympic multiply hip blue scout claw"
|
||||
balance = 100_000_000_000_000
|
||||
# secret_key: 753b7cc01a1a2e86221266a154af739463fce51219d97e4f856cd7200c3bd2a601
|
||||
# stx_address: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
# btc_address: mqVnk6NPRdhntvfm4hh9vvjiRkFDUuSYsH
|
||||
|
||||
[accounts.wallet_1]
|
||||
mnemonic = "sell invite acquire kitten bamboo drastic jelly vivid peace spawn twice guilt pave pen trash pretty park cube fragile unaware remain midnight betray rebuild"
|
||||
balance = 100_000_000_000_000
|
||||
# secret_key: 7287ba251d44a4d3fd9276c88ce34c5c52a038955511cccaf77e61068649c17801
|
||||
# stx_address: ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5
|
||||
# btc_address: mr1iPkD9N3RJZZxXRk7xF9d36gffa6exNC
|
||||
|
||||
[accounts.wallet_2]
|
||||
mnemonic = "hold excess usual excess ring elephant install account glad dry fragile donkey gaze humble truck breeze nation gasp vacuum limb head keep delay hospital"
|
||||
balance = 100_000_000_000_000
|
||||
# secret_key: 530d9f61984c888536871c6573073bdfc0058896dc1adfe9a6a10dfacadc209101
|
||||
# stx_address: ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG
|
||||
# btc_address: muYdXKmX9bByAueDe6KFfHd5Ff1gdN9ErG
|
||||
|
||||
[accounts.wallet_3]
|
||||
mnemonic = "cycle puppy glare enroll cost improve round trend wrist mushroom scorpion tower claim oppose clever elephant dinosaur eight problem before frozen dune wagon high"
|
||||
balance = 100_000_000_000_000
|
||||
# secret_key: d655b2523bcd65e34889725c73064feb17ceb796831c0e111ba1a552b0f31b3901
|
||||
# stx_address: ST2JHG361ZXG51QTKY2NQCVBPPRRE2KZB1HR05NNC
|
||||
# btc_address: mvZtbibDAAA3WLpY7zXXFqRa3T4XSknBX7
|
||||
|
||||
[accounts.wallet_4]
|
||||
mnemonic = "board list obtain sugar hour worth raven scout denial thunder horse logic fury scorpion fold genuine phrase wealth news aim below celery when cabin"
|
||||
balance = 100_000_000_000_000
|
||||
# secret_key: f9d7206a47f14d2870c163ebab4bf3e70d18f5d14ce1031f3902fbbc894fe4c701
|
||||
# stx_address: ST2NEB84ASENDXKYGJPQW86YXQCEFEX2ZQPG87ND
|
||||
# btc_address: mg1C76bNTutiCDV3t9nWhZs3Dc8LzUufj8
|
||||
|
||||
[accounts.wallet_5]
|
||||
mnemonic = "hurry aunt blame peanut heavy update captain human rice crime juice adult scale device promote vast project quiz unit note reform update climb purchase"
|
||||
balance = 100_000_000_000_000
|
||||
# secret_key: 3eccc5dac8056590432db6a35d52b9896876a3d5cbdea53b72400bc9c2099fe801
|
||||
# stx_address: ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB
|
||||
# btc_address: mweN5WVqadScHdA81aATSdcVr4B6dNokqx
|
||||
|
||||
[accounts.wallet_6]
|
||||
mnemonic = "area desk dutch sign gold cricket dawn toward giggle vibrant indoor bench warfare wagon number tiny universe sand talk dilemma pottery bone trap buddy"
|
||||
balance = 100_000_000_000_000
|
||||
# secret_key: 7036b29cb5e235e5fd9b09ae3e8eec4404e44906814d5d01cbca968a60ed4bfb01
|
||||
# stx_address: ST3AM1A56AK2C1XAFJ4115ZSV26EB49BVQ10MGCS0
|
||||
# btc_address: mzxXgV6e4BZSsz8zVHm3TmqbECt7mbuErt
|
||||
|
||||
[accounts.wallet_7]
|
||||
mnemonic = "prevent gallery kind limb income control noise together echo rival record wedding sense uncover school version force bleak nuclear include danger skirt enact arrow"
|
||||
balance = 100_000_000_000_000
|
||||
# secret_key: b463f0df6c05d2f156393eee73f8016c5372caa0e9e29a901bb7171d90dc4f1401
|
||||
# stx_address: ST3PF13W7Z0RRM42A8VZRVFQ75SV1K26RXEP8YGKJ
|
||||
# btc_address: n37mwmru2oaVosgfuvzBwgV2ysCQRrLko7
|
||||
|
||||
[accounts.wallet_8]
|
||||
mnemonic = "female adjust gallery certain visit token during great side clown fitness like hurt clip knife warm bench start reunion globe detail dream depend fortune"
|
||||
balance = 100_000_000_000_000
|
||||
# secret_key: 6a1a754ba863d7bab14adbbc3f8ebb090af9e871ace621d3e5ab634e1422885e01
|
||||
# stx_address: ST3NBRSFKX28FQ2ZJ1MAKX58HKHSDGNV5N7R21XCP
|
||||
# btc_address: n2v875jbJ4RjBnTjgbfikDfnwsDV5iUByw
|
||||
|
||||
[accounts.wallet_9]
|
||||
mnemonic = "shadow private easily thought say logic fault paddle word top book during ignore notable orange flight clock image wealth health outside kitten belt reform"
|
||||
balance = 100_000_000_000_000
|
||||
# secret_key: de433bdfa14ec43aa1098d5be594c8ffb20a31485ff9de2923b2689471c401b801
|
||||
# stx_address: STNHKEPYEPJ8ET55ZZ0M5A34J0R3N5FM2CMMMAZ6
|
||||
# btc_address: mjSrB3wS4xab3kYqFktwBzfTdPg367ZJ2d
|
||||
|
||||
25
contrib/boot-contracts-stateful-prop-tests/tsconfig.json
Normal file
25
contrib/boot-contracts-stateful-prop-tests/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"lib": ["ESNext"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": [
|
||||
"node_modules/@hirosystems/clarinet-sdk/vitest-helpers/src",
|
||||
"tests"
|
||||
]
|
||||
}
|
||||
43
contrib/boot-contracts-stateful-prop-tests/vitest.config.js
Normal file
43
contrib/boot-contracts-stateful-prop-tests/vitest.config.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/// <reference types="vitest" />
|
||||
|
||||
import { defineConfig } from "vite";
|
||||
import {
|
||||
vitestSetupFilePath,
|
||||
getClarinetVitestsArgv,
|
||||
} from "@hirosystems/clarinet-sdk/vitest";
|
||||
|
||||
/*
|
||||
In this file, Vitest is configured so that it works seamlessly with Clarinet and the Simnet.
|
||||
|
||||
The `vitest-environment-clarinet` will initialise the clarinet-sdk
|
||||
and make the `simnet` object available globally in the test files.
|
||||
|
||||
`vitestSetupFilePath` points to a file in the `@hirosystems/clarinet-sdk` package that does two things:
|
||||
- run `before` hooks to initialize the simnet and `after` hooks to collect costs and coverage reports.
|
||||
- load custom vitest matchers to work with Clarity values (such as `expect(...).toBeUint()`)
|
||||
|
||||
The `getClarinetVitestsArgv()` will parse options passed to the command `vitest run --`
|
||||
- vitest run -- --manifest ./Clarinet.toml # pass a custom path
|
||||
- vitest run -- --coverage --costs # collect coverage and cost reports
|
||||
*/
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
environment: "clarinet", // use vitest-environment-clarinet
|
||||
pool: "forks",
|
||||
poolOptions: {
|
||||
threads: { singleThread: true },
|
||||
forks: { singleFork: true },
|
||||
},
|
||||
setupFiles: [
|
||||
vitestSetupFilePath,
|
||||
// custom setup files can be added here
|
||||
],
|
||||
environmentOptions: {
|
||||
clarinet: {
|
||||
...getClarinetVitestsArgv(),
|
||||
// add or override options
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user