Skip to content

Commit

Permalink
test: fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
janniks committed Apr 17, 2024
1 parent f6ec136 commit 2c1f823
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"fmt": "./node_modules/.bin/prettier --write ."
},
"dependencies": {
"@hirosystems/stacks-devnet-js": "^2.5.0",
"@hirosystems/stacks-devnet-js": "^2.5.1",
"@noble/hashes": "^1.4.0",
"@noble/secp256k1": "^2.1.0",
"@scure/base": "^1.1.6",
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clarity/natives/chain-id.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("chain-id", () => {
let orchestrator: DevnetNetworkOrchestrator;
let network: StacksNetwork;

let networkId: number;
let networkId: number; // todo: remove these

beforeAll(() => {
networkId = getNetworkIdFromEnv();
Expand Down
13 changes: 7 additions & 6 deletions tests/integration/clarity/natives/stx-account.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
getBitcoinBlockHeight,
waitForStacksTransaction,
getNetworkIdFromEnv,
getChainInfo,
EPOCH_TIMELINE_LONG_2_1,
} from "../../helpers";
import { principalCV } from "@stacks/transactions/dist/clarity/types/principalCV";
import { broadcastStackSTX } from "../../pox/helpers-direct-stacking";
Expand All @@ -34,9 +34,10 @@ describe("stx-account", () => {
beforeAll(() => {
networkId = getNetworkIdFromEnv();
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
epoch_2_2: 300,
});
orchestrator = buildDevnetNetworkOrchestrator(
networkId,
EPOCH_TIMELINE_LONG_2_1,
);
orchestrator.start();
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
Expand Down Expand Up @@ -332,11 +333,11 @@ describe("stx-account", () => {
});

it("returns expected results when stacking", async () => {
// Wait for block N-2 where N is the height of the next prepare phase
// Wait for block N-3 where N is the height of the next prepare phase
let chainUpdate = await waitForNextPreparePhase(
network,
orchestrator,
-2,
-3,
);
let blockHeight = getBitcoinBlockHeight(chainUpdate);

Expand Down
18 changes: 9 additions & 9 deletions tests/integration/clarity/traits/call-nested-1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
buildDevnetNetworkOrchestrator,
getNetworkIdFromEnv,
getChainInfo,
EPOCH_TIMELINE_LONG_2_05,
} from "../../helpers";
import { DevnetNetworkOrchestrator } from "@hirosystems/stacks-devnet-js";
import { contract_call, load_versioned } from "./helper";
Expand All @@ -13,19 +14,16 @@ import { contractPrincipalCV } from "@stacks/transactions/dist/clarity/types/pri
describe("call functions with nested traits", () => {
let orchestrator: DevnetNetworkOrchestrator;
let network: StacksNetwork;
const STACKS_2_1_EPOCH = 112;

let networkId: number;

beforeAll(() => {
networkId = getNetworkIdFromEnv();
console.log(`network #${networkId}`);
orchestrator = buildDevnetNetworkOrchestrator(networkId, {
epoch_2_0: 100,
epoch_2_05: 102,
epoch_2_1: STACKS_2_1_EPOCH,
pox_2_activation: 120,
});
orchestrator = buildDevnetNetworkOrchestrator(
networkId,
EPOCH_TIMELINE_LONG_2_05,
);
orchestrator.start();
network = new StacksTestnet({
url: orchestrator.getStacksNodeUrl().replace("localhost", "127.0.0.1"),
Expand Down Expand Up @@ -78,14 +76,16 @@ describe("call functions with nested traits", () => {

// Make sure this we stayed in 2.05
let chainInfo = await getChainInfo(network);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(STACKS_2_1_EPOCH);
expect(chainInfo.burn_block_height).toBeLessThanOrEqual(
EPOCH_TIMELINE_LONG_2_05.epoch_2_1,
);
});

describe("in 2.1", () => {
beforeAll(async () => {
// Wait for 2.1 to go live
await orchestrator.waitForStacksBlockAnchoredOnBitcoinBlockOfHeight(
STACKS_2_1_EPOCH + 1,
EPOCH_TIMELINE_LONG_2_05.epoch_2_1 + 1,
);
});

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,10 @@
resolved "https://registry.yarnpkg.com/@hirosystems/chainhook-types/-/chainhook-types-1.1.2.tgz#9e6788c6c74f3dc2bee64b7f97f1b5cd4c2db1cb"
integrity sha512-klQDKRyiPqF9fgDetMLTPMcB4A/+Vo7px74RbzzvmnCSDMPQua0DD5zhfuo12Ga3pexFFoIftIqnSjWvjncKNQ==

"@hirosystems/stacks-devnet-js@^2.5.0":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@hirosystems/stacks-devnet-js/-/stacks-devnet-js-2.5.0.tgz#7b64720ec5dadb1183c3df4471771b78c9eb2888"
integrity sha512-yMJELdpMhxBgIKpPQjbMCmDCXM+8Ytq5od0Mtx5gHKLbQ0R4TsFBJ6456MVQX4M8Hw9nA0rFtPVGVt4ddpMGDw==
"@hirosystems/stacks-devnet-js@^2.5.1":
version "2.5.1"
resolved "https://registry.yarnpkg.com/@hirosystems/stacks-devnet-js/-/stacks-devnet-js-2.5.1.tgz#be2b6d075da1bc0fdefa30d29e01b254e119f71b"
integrity sha512-DTICeqHr8mMLHaMEF9/LxkgNZShABH4miGYQ36HfxuhCKbAodyy4vmAvOMkmG4ruuPQeLa9DvfV/3WHWcqu3PQ==
dependencies:
"@hirosystems/chainhook-types" "^1.1.2"
"@mapbox/node-pre-gyp" "^1.0.8"
Expand Down

0 comments on commit 2c1f823

Please sign in to comment.