Skip to content

Commit

Permalink
Merge pull request #4466 from iron-fish/staging
Browse files Browse the repository at this point in the history
STAGING -> MASTER
  • Loading branch information
NullSoldier authored Nov 29, 2023
2 parents 3b61ff3 + 302e541 commit 8fa601f
Show file tree
Hide file tree
Showing 177 changed files with 1,596 additions and 3,415 deletions.
55 changes: 39 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,9 @@ jobs:
- name: Lint
run: yarn lint

test-matrix:
name: Test Matrix
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
test-type: ["test", "test:slow"]

steps:
- name: Check out Git repository
Expand All @@ -54,7 +50,8 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.version }}
# Tests will only run on Node v20 due to https://github.com/nodejs/node/issues/35889
node-version: 20
cache: 'yarn'

- name: Cache Rust
Expand All @@ -66,7 +63,7 @@ jobs:
run: yarn --non-interactive --frozen-lockfile

- name: Run tests
run: yarn ${{ matrix.test-type}}:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB
run: yarn test:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB

- name: Check for missing fixtures
run: |
Expand All @@ -79,13 +76,39 @@ jobs:
if: github.repository == 'iron-fish/ironfish'
run: CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} ROOT_PATH=$GITHUB_WORKSPACE/ yarn coverage:upload

# This is a workaround to have status checks on jobs that use a matrix.
# See: https://github.com/orgs/community/discussions/26822
test:
if: ${{ always() }}
testslow:
name: Slow Tests
runs-on: ubuntu-latest
name: Test
needs: [test-matrix]

steps:
- run: exit 1
if: ${{ !contains(needs.*.result, 'success')}}
- name: Check out Git repository
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
# Tests will only run on Node v20 due to https://github.com/nodejs/node/issues/35889
node-version: 20
cache: 'yarn'

- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
shared-key: nodejs

- name: Install packages
run: yarn --non-interactive --frozen-lockfile

- name: Run slow tests & coverage
run: yarn test:slow:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB

- name: Check for missing fixtures
run: |
if [[ $(git status | grep fixture) ]]; then
echo "New test fixtures have not been checked in, please check them in."
exit 1
fi
- name: Upload coverage
if: github.repository == 'iron-fish/ironfish'
run: CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} ROOT_PATH=$GITHUB_WORKSPACE/ yarn coverage:upload
8 changes: 4 additions & 4 deletions config/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["dom", "dom.iterable", "ES2020"],
"target": "es2020",
"lib": ["DOM", "es2020"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "commonjs",
"moduleResolution": "node",
"module": "Node16",
"moduleResolution": "Node16",
"sourceMap": true,
"resolveJsonModule": true,
"composite": true,
Expand Down
4 changes: 2 additions & 2 deletions ironfish-cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-bullseye as build
FROM node:20-bookworm as build
ENV PATH="/root/.cargo/bin:${PATH}"

RUN \
Expand All @@ -12,7 +12,7 @@ COPY ./ /usr/src/ironfish

RUN /usr/src/ironfish/ironfish-cli/scripts/build.sh

FROM node:18-bullseye-slim
FROM node:20-bookworm-slim

EXPOSE 8020:8020
EXPOSE 9033:9033
Expand Down
19 changes: 10 additions & 9 deletions ironfish-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ironfish",
"version": "1.12.0",
"version": "1.13.0",
"description": "CLI for running and interacting with an Iron Fish node",
"author": "Iron Fish <[email protected]> (https://ironfish.network)",
"main": "build/src/index.js",
Expand Down Expand Up @@ -32,12 +32,13 @@
"cross-env": "7.0.3",
"eslint-config-ironfish": "*",
"eslint-plugin-deprecation": "2.0.0",
"jest": "29.3.1",
"jest-jasmine2": "29.3.1",
"jest": "29.7.0",
"jest-jasmine2": "29.7.0",
"oclif": "2.6.0",
"rimraf": "^3.0.2",
"ts-jest": "29.1.1",
"tsc-watch": "4.2.9",
"typescript": "4.3.4",
"typescript": "5.0.4",
"yarn": "^1.22.10"
},
"scripts": {
Expand All @@ -48,9 +49,9 @@
"start:dev": "node start",
"start": "yarn build && yarn start:js",
"start:js": "cross-env OCLIF_TS_NODE=0 IRONFISH_DEBUG=1 node --expose-gc --inspect=:0 --inspect-publish-uid=http --enable-source-maps bin/run",
"test": "yarn clean && tsc -b && tsc -b tsconfig.test.json && jest --passWithNoTests",
"test:coverage:html": "tsc -b tsconfig.test.json && jest --passWithNoTests --testPathIgnorePatterns --coverage --coverage-reporters html",
"test:watch": "tsc -b tsconfig.test.json && jest --watch --coverage false",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
"test:coverage:html": "tsc -b tsconfig.test.json && cross-env NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns --coverage --coverage-reporters html",
"test:watch": "yarn clean && tsc -b && tsc -b tsconfig.test.json && cross-env NODE_OPTIONS=--experimental-vm-modules jest --watch --coverage false",
"postpack": "rimraf oclif.manifest.json",
"clean": "rimraf build",
"prepack": "rimraf build && yarn build && oclif manifest && oclif readme",
Expand All @@ -61,8 +62,8 @@
"@aws-sdk/client-s3": "3",
"@aws-sdk/client-secrets-manager": "3",
"@aws-sdk/s3-request-presigner": "3",
"@ironfish/rust-nodejs": "1.10.0",
"@ironfish/sdk": "1.12.0",
"@ironfish/rust-nodejs": "1.11.0",
"@ironfish/sdk": "1.13.0",
"@oclif/core": "1.23.1",
"@oclif/plugin-help": "5.1.12",
"@oclif/plugin-not-found": "2.3.1",
Expand Down
6 changes: 5 additions & 1 deletion ironfish-cli/src/commands/ceremony/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ export default class Ceremony extends IronfishCommand {
try {
response = await axios.get(downloadLink, {
responseType: 'stream',
onDownloadProgress: (p: ProgressEvent) => {
onDownloadProgress: (p: {
readonly lengthComputable: boolean
readonly loaded: number
readonly total: number
}) => {
this.log('loaded', p.loaded, 'total', p.total)
},
})
Expand Down
4 changes: 2 additions & 2 deletions ironfish-cli/src/commands/logs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import { ConsoleReporterInstance, IJSON, IronfishNode } from '@ironfish/sdk'
import { ConsoleReporterInstance, FullNode, IJSON } from '@ironfish/sdk'
import { logType } from 'consola'
import { IronfishCommand } from '../command'
import { RemoteFlags } from '../flags'
Expand All @@ -13,7 +13,7 @@ export default class LogsCommand extends IronfishCommand {
...RemoteFlags,
}

node: IronfishNode | null = null
node: FullNode | null = null

async start(): Promise<void> {
await this.parse(LogsCommand)
Expand Down
10 changes: 2 additions & 8 deletions ironfish-cli/src/commands/peers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@ import { CommandFlags } from '../../types'
type GetPeerResponsePeer = GetPeersResponse['peers'][0]

const STATE_COLUMN_HEADER = 'STATE'
const { sort, ...tableFlags } = CliUx.ux.table.flags()

export class ListCommand extends IronfishCommand {
static description = `List all connected peers`

static flags = {
...RemoteFlags,
...tableFlags,
sort: {
...sort,
exclusive: ['follow'],
},
...CliUx.ux.table.flags(),
follow: Flags.boolean({
char: 'f',
default: false,
Expand Down Expand Up @@ -58,10 +53,9 @@ export class ListCommand extends IronfishCommand {

async start(): Promise<void> {
const { flags } = await this.parse(ListCommand)
flags.sort = flags.sort ?? STATE_COLUMN_HEADER

if (!flags.follow) {
flags.sort = flags.sort ?? STATE_COLUMN_HEADER

await this.sdk.client.connect()
const response = await this.sdk.client.peer.getPeers()
this.log(renderTable(response.content, flags))
Expand Down
4 changes: 2 additions & 2 deletions ironfish-cli/src/commands/reset.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import { IronfishNode, PEER_STORE_FILE_NAME } from '@ironfish/sdk'
import { FullNode, PEER_STORE_FILE_NAME } from '@ironfish/sdk'
import { CliUx, Flags } from '@oclif/core'
import fsAsync from 'fs/promises'
import { IronfishCommand } from '../command'
Expand Down Expand Up @@ -32,7 +32,7 @@ export default class Reset extends IronfishCommand {
}),
}

node: IronfishNode | null = null
node: FullNode | null = null

async start(): Promise<void> {
const { flags } = await this.parse(Reset)
Expand Down
103 changes: 0 additions & 103 deletions ironfish-cli/src/commands/service/estimate-fee-rates.ts

This file was deleted.

Loading

0 comments on commit 8fa601f

Please sign in to comment.