Skip to content

Commit

Permalink
chore: upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
friedger committed Feb 13, 2024
1 parent 7a6a050 commit 68ccf8d
Show file tree
Hide file tree
Showing 8 changed files with 1,649 additions and 1,346 deletions.
45 changes: 0 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,51 +27,6 @@ When running multiple tests, you'll want to limit it to one test at a time becau
yarn vitest --run tests/integration/pox/stacking/ --threads false
```

#### Using 2.4 `stacks-node`

To run tests using the 2.2 node (the tests in the _pox-disabled/_ directory), you'll need to use a currently unpublished version of the `stacks-devnet-js` package which has support for the new settings. To build this locally:

```
git clone https://github.com/hirosystems/clarinet.git
cd clarinet
git checkout feat/devnet-epoch-2.2
cd components/stacks-devnet-js
npm install
```

Then you'll want to run one of the following commands, depending on your platform:

```
npm run build-linux-x64-glibc
npm run build-linux-x64-musl
npm run build-windows-x64
npm run build-darwin-x64 # Mac with Intel
npm run build-darwin-arm64 # Mac with Apple Silicon
```

Finally, you'll use `npm link` to utilize this version in this testing repo. First, in the `stacks-devnet-js` directory, run:

```
npm link
```

This will create a symbolic link from the local package directory to the global node_modules directory.

Then back in this testing directory, run:

```
npm link @hirosystems/stacks-devnet-js
```

Now, you can run the tests expecting this 2.2 node, i.e. those in the _pox-disabled/_ directory.

To switch back to the default version, run:

```
npm unlink @hirosystems/stacks-devnet-js --no-save
yarn install
```

#### 2.4 `stacks-node` Image

To run with the latest node, you'll need to specify the docker image URL to use via an environment variable:
Expand Down
48 changes: 24 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stacks-2-1-integration-tests",
"version": "1.0.0",
"name": "stacks-integration-tests",
"version": "3.0.0",
"description": "",
"scripts": {
"build": "tsc --build",
Expand All @@ -10,32 +10,32 @@
"fmt": "./node_modules/.bin/prettier --write ."
},
"dependencies": {
"@hirosystems/stacks-devnet-js": "^1.3.0",
"@noble/hashes": "^1.1.5",
"@noble/secp256k1": "^1.7.0",
"@scure/base": "^1.1.1",
"@scure/bip32": "^1.1.1",
"@scure/bip39": "^1.1.0",
"@stacks/common": "^6.0.0",
"@stacks/network": "^6.3.0",
"@stacks/stacking": "^6.0.2",
"@stacks/transactions": "^6.5.0",
"@types/node": "^16.7.13",
"micro-btc-signer": "^0.2.0",
"node-fetch": "^2.6.7",
"typescript": "^4.9.0"
"@hirosystems/stacks-devnet-js": "^2.2.1",
"@noble/hashes": "^1.3.3",
"@noble/secp256k1": "^2.0.0",
"@scure/base": "^1.1.5",
"@scure/bip32": "^1.3.3",
"@scure/bip39": "^1.2.2",
"@stacks/common": "^6.10.0",
"@stacks/network": "^6.11.3",
"@stacks/stacking": "^6.11.3",
"@stacks/transactions": "^6.11.3",
"@types/node": "^20.11.17",
"micro-btc-signer": "^0.4.2",
"node-fetch": "^3.3.2",
"typescript": "^5.3.3"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/jest": "^27.0.3",
"@vitest/ui": "^0.25.8",
"jest": "^27.4.5",
"@types/jest": "^29.5.12",
"@vitest/ui": "^1.2.2",
"jest": "^29.7.0",
"jest-github-actions-reporter": "^1.0.3",
"prettier": "2.8.1",
"ts-jest": "^27.1.2",
"vite": "^4.0.1",
"vitest": "^0.25.8",
"vitest-github-actions-reporter": "^0.9.0"
"prettier": "3.2.5",
"ts-jest": "^29.1.2",
"vite": "^5.1.1",
"vitest": "^1.2.2",
"vitest-github-actions-reporter": "^0.11.1"
}
}
5 changes: 5 additions & 0 deletions tests/integration/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ export namespace Constants {
export const DEVNET_DEFAULT_EPOCH_2_2 = 122;
export const DEVNET_DEFAULT_EPOCH_2_3 = 128;
export const DEVNET_DEFAULT_EPOCH_2_4 = 134;
export const DEVNET_DEFAULT_POX_3_ACTIVATION = 136;
export const DEVNET_DEFAULT_EPOCH_2_5 = 140;
export const DEVNET_DEFAULT_POX_4_ACTIVATION = 142;
export const DEVNET_DEFAULT_EPOCH_3_0 = 144;

export const BITCOIN_BLOCK_TIME = 10_000;
}

Expand Down
6 changes: 5 additions & 1 deletion tests/integration/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
makeContractDeploy,
makeSTXTokenTransfer,
} from "@stacks/transactions";
const fetch = require("node-fetch");
import fetch from "node-fetch";

interface EpochTimeline {
epoch_2_0?: number;
Expand All @@ -24,7 +24,11 @@ interface EpochTimeline {
pox_2_activation?: number;
epoch_2_2?: number;
epoch_2_3?: number;
pox_3_activation?: number;
epoch_2_4?: number;
epoch_2_5?: number;
pox_4_activation?: number;
epoch_3_0?: number;
}

export const DEFAULT_EPOCH_TIMELINE = {
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/pox/helpers-direct-stacking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import {
} from "@stacks/transactions";
import { Contracts } from "../constants";

import { toBytes } from "@stacks/common";
import { decodeBtcAddress } from "@stacks/stacking";
import { BroadcastOptionsPox } from "./helpers";
const fetch = require("node-fetch");

export const broadcastStackSTX = async (
{ poxVersion, network, account, fee, nonce }: BroadcastOptionsPox,
Expand All @@ -25,7 +23,7 @@ export const broadcastStackSTX = async (
): Promise<TxBroadcastResult> => {
const { version, data } = decodeBtcAddress(account.btcAddress);
const address = {
version: bufferCV(toBytes(new Uint8Array([version.valueOf()]))),
version: bufferCV(new Uint8Array([version.valueOf()])),
hashbytes: bufferCV(data),
};

Expand Down Expand Up @@ -82,7 +80,7 @@ export const broadcastStackExtend = async (
): Promise<TxBroadcastResult> => {
const { version, data } = decodeBtcAddress(account.btcAddress);
const address = {
version: bufferCV(toBytes(new Uint8Array([version.valueOf()]))),
version: bufferCV(new Uint8Array([version.valueOf()])),
hashbytes: bufferCV(data),
};

Expand Down
15 changes: 6 additions & 9 deletions tests/integration/pox/helpers-pooled-stacking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ import {
} from "@stacks/transactions";
import { Contracts } from "../constants";

import { toBytes } from "@stacks/common";
import { decodeBtcAddress } from "@stacks/stacking";
import { Account, BroadcastOptionsPox } from "./helpers";
import { BroadcastOptions } from "../helpers";
const fetch = require("node-fetch");

export const broadcastDelegateSTX = async (
{ poxVersion, network, account, fee, nonce }: BroadcastOptionsPox,
Expand All @@ -37,7 +34,7 @@ export const broadcastDelegateSTX = async (
if (poolRewardAccount) {
const { version, data } = decodeBtcAddress(poolRewardAccount.btcAddress);
const poxAddress = {
version: bufferCV(toBytes(new Uint8Array([version.valueOf()]))),
version: bufferCV(new Uint8Array([version.valueOf()])),
hashbytes: bufferCV(data),
};
poxAddressCV = someCV(tupleCV(poxAddress));
Expand Down Expand Up @@ -117,7 +114,7 @@ export const broadcastDelegateStackSTX = async (
): Promise<TxBroadcastResult> => {
const { version, data } = decodeBtcAddress(poolRewardAccount.btcAddress);
const poxAddress = {
version: bufferCV(toBytes(new Uint8Array([version.valueOf()]))),
version: bufferCV(new Uint8Array([version.valueOf()])),
hashbytes: bufferCV(data),
};
let poxContract = Contracts.POX[poxVersion] || Contracts.DEFAULT;
Expand Down Expand Up @@ -156,7 +153,7 @@ export const broadcastDelegateStackExtend = async (
): Promise<TxBroadcastResult> => {
const { version, data } = decodeBtcAddress(poolRewardAccount.btcAddress);
const poxAddress = {
version: bufferCV(toBytes(new Uint8Array([version.valueOf()]))),
version: bufferCV(new Uint8Array([version.valueOf()])),
hashbytes: bufferCV(data),
};
let poxContract = Contracts.POX[poxVersion] || Contracts.DEFAULT;
Expand Down Expand Up @@ -197,7 +194,7 @@ export const broadcastDelegateStackIncrease = async (
): Promise<TxBroadcastResult> => {
const { version, data } = decodeBtcAddress(poolRewardAccount.btcAddress);
const poxAddress = {
version: bufferCV(toBytes(new Uint8Array([version.valueOf()]))),
version: bufferCV(new Uint8Array([version.valueOf()])),
hashbytes: bufferCV(data),
};
let poxContract = Contracts.POX[poxVersion] || Contracts.DEFAULT;
Expand Down Expand Up @@ -245,7 +242,7 @@ export const broadcastStackAggregationCommitIndexed = async (
): Promise<TxBroadcastResult> => {
const { version, data } = decodeBtcAddress(poolRewardAccount.btcAddress);
const poxAddress = {
version: bufferCV(toBytes(new Uint8Array([version.valueOf()]))),
version: bufferCV(new Uint8Array([version.valueOf()])),
hashbytes: bufferCV(data),
};
let poxContract = Contracts.POX[poxVersion] || Contracts.DEFAULT;
Expand Down Expand Up @@ -282,7 +279,7 @@ export const broadcastStackAggregationIncrease = async (
let poxContract = Contracts.POX[poxVersion] || Contracts.DEFAULT;
const { version, data } = decodeBtcAddress(poolRewardAccount.btcAddress);
const poxAddress = {
version: bufferCV(toBytes(new Uint8Array([version.valueOf()]))),
version: bufferCV(new Uint8Array([version.valueOf()])),
hashbytes: bufferCV(data),
};

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/pox/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
import { expect } from "vitest";
import { Contracts } from "../constants";
import { BroadcastOptions } from "../helpers";
const fetch = require("node-fetch");
import fetch from "node-fetch";

export interface Account {
stxAddress: string;
Expand Down
Loading

0 comments on commit 68ccf8d

Please sign in to comment.