@stacks/rendezvous 0.6.2 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +1 -1
- package/dist/citizen.js +27 -13
- package/dist/heatstroke.js +3 -0
- package/dist/invariant.js +1 -1
- package/dist/package.json +4 -4
- package/dist/property.js +1 -1
- package/package.json +4 -4
package/dist/app.js
CHANGED
|
@@ -174,7 +174,7 @@ function main() {
|
|
|
174
174
|
/**
|
|
175
175
|
* The list of contract IDs for the SUT contract names, as per the simnet.
|
|
176
176
|
*/
|
|
177
|
-
const rendezvousList = Array.from((0, shared_1.getSimnetDeployerContractsInterfaces)(simnet).keys()).filter((deployedContract) =>
|
|
177
|
+
const rendezvousList = Array.from((0, shared_1.getSimnetDeployerContractsInterfaces)(simnet).keys()).filter((deployedContract) => (0, shared_1.getContractNameFromContractId)(deployedContract) === sutContractName);
|
|
178
178
|
const rendezvousAllFunctions = (0, shared_1.getFunctionsFromContractInterfaces)(new Map(Array.from((0, shared_1.getSimnetDeployerContractsInterfaces)(simnet)).filter(([contractId]) => rendezvousList.includes(contractId))));
|
|
179
179
|
// Select the testing routine based on `type`.
|
|
180
180
|
// If "invariant", call `checkInvariants` to verify contract invariants.
|
package/dist/citizen.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getTestContractSource = exports.buildRendezvousData = exports.getContractSource = exports.groupContractsByEpochFromSimnetPlan = exports.issueFirstClassCitizenship = void 0;
|
|
15
|
+
exports.getSbtcBalancesFromSimnet = exports.getTestContractSource = exports.buildRendezvousData = exports.getContractSource = exports.groupContractsByEpochFromSimnetPlan = exports.issueFirstClassCitizenship = void 0;
|
|
16
16
|
exports.scheduleRendezvous = scheduleRendezvous;
|
|
17
17
|
const fs_1 = require("fs");
|
|
18
18
|
const path_1 = require("path");
|
|
@@ -48,18 +48,7 @@ const issueFirstClassCitizenship = (manifestDir, manifestPath, remoteDataSetting
|
|
|
48
48
|
const balanceHex = simnet.runSnippet(`(stx-get-balance '${address})`);
|
|
49
49
|
return [address, (0, transactions_1.cvToValue)((0, transactions_1.hexToCV)(balanceHex))];
|
|
50
50
|
}));
|
|
51
|
-
const sbtcBalancesMap =
|
|
52
|
-
try {
|
|
53
|
-
const { result: getBalanceResult } = simnet.callReadOnlyFn("SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token", "get-balance", [transactions_1.Cl.principal(address)], address);
|
|
54
|
-
// If the previous read-only call works, the user is working with
|
|
55
|
-
// sBTC. This means we can proceed with restoring sBTC balances.
|
|
56
|
-
const sbtcBalance = (0, transactions_1.cvToJSON)(getBalanceResult).value.value;
|
|
57
|
-
return [address, sbtcBalance];
|
|
58
|
-
}
|
|
59
|
-
catch (e) {
|
|
60
|
-
return [address, 0];
|
|
61
|
-
}
|
|
62
|
-
}));
|
|
51
|
+
const sbtcBalancesMap = (0, exports.getSbtcBalancesFromSimnet)(simnet);
|
|
63
52
|
yield simnet.initEmptySession(remoteDataSettings);
|
|
64
53
|
simnetAddresses.forEach((address) => {
|
|
65
54
|
simnet.mintSTX(address, stxBalancesMap.get(address));
|
|
@@ -260,6 +249,31 @@ function scheduleRendezvous(targetContractSource, tests) {
|
|
|
260
249
|
(ok (map-set context function-name {called: called})))`;
|
|
261
250
|
return `${targetContractSource}\n\n${context}\n\n${tests}`;
|
|
262
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Maps the simnet accounts to their sBTC balances. The function tries to call
|
|
254
|
+
* the `get-balance` function of the `sbtc-token` contract for each address. If
|
|
255
|
+
* the call fails, it returns a balance of 0 for that address. The call fails
|
|
256
|
+
* if the user is not working with sBTC.
|
|
257
|
+
* @param simnet The simnet instance.
|
|
258
|
+
* @returns A map of addresses to their sBTC balances.
|
|
259
|
+
*/
|
|
260
|
+
const getSbtcBalancesFromSimnet = (simnet) => new Map([...simnet.getAccounts().values()].map((address) => {
|
|
261
|
+
try {
|
|
262
|
+
const { result: getBalanceResult } = simnet.callReadOnlyFn("SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token", "get-balance", [transactions_1.Cl.principal(address)], address);
|
|
263
|
+
// If the previous read-only call works, the user is working with
|
|
264
|
+
// sBTC. This means we can proceed with restoring sBTC balances.
|
|
265
|
+
const sbtcBalanceJSON = (0, transactions_1.cvToJSON)(getBalanceResult);
|
|
266
|
+
// The `get-balance` function returns a response containing the uint
|
|
267
|
+
// balance of the address. In the JSON representation, the balance is
|
|
268
|
+
// represented as a string. We need to parse it to an integer.
|
|
269
|
+
const sbtcBalance = parseInt(sbtcBalanceJSON.value.value, 10);
|
|
270
|
+
return [address, sbtcBalance];
|
|
271
|
+
}
|
|
272
|
+
catch (e) {
|
|
273
|
+
return [address, 0];
|
|
274
|
+
}
|
|
275
|
+
}));
|
|
276
|
+
exports.getSbtcBalancesFromSimnet = getSbtcBalancesFromSimnet;
|
|
263
277
|
/**
|
|
264
278
|
* Utility function that restores the test wallets' initial sBTC balances in
|
|
265
279
|
* the re-initialized first-class citizenship simnet.
|
package/dist/heatstroke.js
CHANGED
|
@@ -72,6 +72,9 @@ function reporter(runDetails, radio, type) {
|
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
// Set non-zero exit code to properly signal test failure to shells,
|
|
76
|
+
// scripts, CI systems, and other tools that check process exit status.
|
|
77
|
+
process.exitCode = 1;
|
|
75
78
|
}
|
|
76
79
|
else {
|
|
77
80
|
radio.emit("logMessage", (0, ansicolor_1.green)(`\nOK, ${type === "invariant" ? "invariants" : "properties"} passed after ${runDetails.numRuns} runs.\n`));
|
package/dist/invariant.js
CHANGED
|
@@ -346,7 +346,7 @@ const filterSutFunctions = (allFunctionsMap) => new Map(Array.from(allFunctionsM
|
|
|
346
346
|
]));
|
|
347
347
|
const filterInvariantFunctions = (allFunctionsMap) => new Map(Array.from(allFunctionsMap, ([contractId, functions]) => [
|
|
348
348
|
contractId,
|
|
349
|
-
functions.filter((
|
|
349
|
+
functions.filter(({ access, name }) => access === "read_only" && name.startsWith("invariant-")),
|
|
350
350
|
]));
|
|
351
351
|
class FalsifiedInvariantError extends Error {
|
|
352
352
|
constructor(message) {
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacks/rendezvous",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Meet your contract's vulnerabilities head-on.",
|
|
5
5
|
"main": "app.js",
|
|
6
6
|
"bin": {
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"url": "https://github.com/stacks-network/rendezvous.git"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@hirosystems/clarinet-sdk": "
|
|
34
|
-
"@stacks/transactions": "^
|
|
33
|
+
"@hirosystems/clarinet-sdk": "^3.0.1",
|
|
34
|
+
"@stacks/transactions": "^7.0.6",
|
|
35
35
|
"ansicolor": "^2.0.3",
|
|
36
36
|
"fast-check": "^3.20.0",
|
|
37
37
|
"toml": "^3.0.0",
|
|
38
38
|
"yaml": "^2.6.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@hirosystems/clarinet-sdk-wasm": "
|
|
41
|
+
"@hirosystems/clarinet-sdk-wasm": "^3.0.1",
|
|
42
42
|
"@types/jest": "^29.5.12",
|
|
43
43
|
"jest": "^29.7.0",
|
|
44
44
|
"ts-jest": "^29.2.5",
|
package/dist/property.js
CHANGED
|
@@ -50,7 +50,7 @@ const checkProperties = (simnet, targetContractName, rendezvousList, rendezvousA
|
|
|
50
50
|
// functions.
|
|
51
51
|
const testContractsDiscardFunctions = new Map(Array.from(rendezvousAllFunctions, ([contractId, functions]) => [
|
|
52
52
|
contractId,
|
|
53
|
-
functions.filter((
|
|
53
|
+
functions.filter(({ access, name }) => access === "read_only" && name.startsWith("can-")),
|
|
54
54
|
]));
|
|
55
55
|
// Pair each test function with its corresponding discard function. When a
|
|
56
56
|
// test function is selected, Rendezvous will first call its discard
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacks/rendezvous",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Meet your contract's vulnerabilities head-on.",
|
|
5
5
|
"main": "app.js",
|
|
6
6
|
"bin": {
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"url": "https://github.com/stacks-network/rendezvous.git"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@hirosystems/clarinet-sdk": "
|
|
34
|
-
"@stacks/transactions": "^
|
|
33
|
+
"@hirosystems/clarinet-sdk": "^3.0.1",
|
|
34
|
+
"@stacks/transactions": "^7.0.6",
|
|
35
35
|
"ansicolor": "^2.0.3",
|
|
36
36
|
"fast-check": "^3.20.0",
|
|
37
37
|
"toml": "^3.0.0",
|
|
38
38
|
"yaml": "^2.6.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@hirosystems/clarinet-sdk-wasm": "
|
|
41
|
+
"@hirosystems/clarinet-sdk-wasm": "^3.0.1",
|
|
42
42
|
"@types/jest": "^29.5.12",
|
|
43
43
|
"jest": "^29.7.0",
|
|
44
44
|
"ts-jest": "^29.2.5",
|