-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3578 from iron-fish/staging
STAGING -> MASTER
- Loading branch information
Showing
186 changed files
with
14,976 additions
and
9,718 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ | |
*.js text | ||
*.json text | ||
*.png -text | ||
*.params -text | ||
*.params -text | ||
mainnet-parameters/params -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Node.js CI Regenerate Fixtures | ||
|
||
on: | ||
schedule: | ||
- cron: '0 15 * * 2' # Every Tuesday 7AM PST | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: staging | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.12.1' | ||
cache: 'yarn' | ||
|
||
- name: Cache Rust | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
shared-key: nodejs | ||
|
||
- name: Install packages | ||
run: yarn --non-interactive --frozen-lockfile | ||
|
||
- name: Delete fixture files | ||
run: node ./tools/delete-fixtures.js | ||
|
||
- name: Run tests | ||
run: JEST_TIMEOUT=1000000000 yarn test:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB | ||
|
||
- name: Run slow tests | ||
run: JEST_TIMEOUT=1000000000 yarn test:slow:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
#!/usr/bin/env node | ||
|
||
// segfault-handler causes crashes in node-webrtc on Windows because | ||
// it catches all exceptions rather than only exceptions that would | ||
// crash the process | ||
// the signal handler does not support windows yet | ||
if (process.platform !== 'win32') { | ||
require('segfault-handler').registerHandler('segfault.log') | ||
require('@ironfish/rust-nodejs').initSignalHandler() | ||
} | ||
|
||
if(process.versions.node.split('.')[0] !== '18') { | ||
console.log('NodeJS version ' + process.versions.node + ' is not compatible. Must have Node v18 installed: https://nodejs.org/en/download/') | ||
console.log('After v18 is installed, MAKE SURE TO run `npm install -g ironfish` again to install ironfish with the correct Node version') | ||
if (process.versions.node.split('.')[0] !== '18') { | ||
console.log( | ||
`NodeJS version ${process.versions.node} is not compatible. Must have Node v18 installed: https://nodejs.org/en/download/`, | ||
) | ||
console.log( | ||
'After v18 is installed, MAKE SURE TO run `npm install -g ironfish` again to install ironfish with the correct Node version', | ||
) | ||
process.exit(1) | ||
} | ||
|
||
require('@oclif/core').run() | ||
.then(require('@oclif/core/flush')) | ||
.catch(require('@oclif/core/handle')) | ||
require('@oclif/core') | ||
.run() | ||
.then(require('@oclif/core/flush')) | ||
.catch(require('@oclif/core/handle')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "ironfish", | ||
"version": "0.1.70", | ||
"version": "0.1.71", | ||
"description": "CLI for running and interacting with an Iron Fish node", | ||
"author": "Iron Fish <[email protected]> (https://ironfish.network)", | ||
"main": "build/src/index.js", | ||
|
@@ -28,7 +28,6 @@ | |
"@types/inquirer": "8.2.5", | ||
"@types/node": "18.11.16", | ||
"@types/tar": "6.1.1", | ||
"@types/ws": "7.4.5", | ||
"chai": "4.2.0", | ||
"cross-env": "7.0.3", | ||
"eslint-config-ironfish": "*", | ||
|
@@ -60,8 +59,8 @@ | |
"@aws-sdk/client-s3": "3.127.0", | ||
"@aws-sdk/client-secrets-manager": "3.276.0", | ||
"@aws-sdk/s3-request-presigner": "3.127.0", | ||
"@ironfish/rust-nodejs": "0.1.27", | ||
"@ironfish/sdk": "0.0.47", | ||
"@ironfish/rust-nodejs": "0.1.28", | ||
"@ironfish/sdk": "0.0.48", | ||
"@oclif/core": "1.23.1", | ||
"@oclif/plugin-help": "5.1.12", | ||
"@oclif/plugin-not-found": "2.3.1", | ||
|
@@ -74,11 +73,9 @@ | |
"chalk": "4.1.2", | ||
"inquirer": "8.2.5", | ||
"json-colorizer": "2.2.2", | ||
"segfault-handler": "1.3.0", | ||
"supports-hyperlinks": "2.2.0", | ||
"tar": "6.1.11", | ||
"uuid": "8.3.2", | ||
"ws": "7.5.1" | ||
"uuid": "8.3.2" | ||
}, | ||
"oclif": { | ||
"macos": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* 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 { FileUtils, PromiseUtils } from '@ironfish/sdk' | ||
import { GetMempoolStatusResponse } from '@ironfish/sdk' | ||
import { Flags } from '@oclif/core' | ||
import blessed from 'blessed' | ||
import { IronfishCommand } from '../../command' | ||
import { RemoteFlags } from '../../flags' | ||
|
||
export default class Status extends IronfishCommand { | ||
static description = 'Show the status of the Mempool' | ||
|
||
static flags = { | ||
...RemoteFlags, | ||
follow: Flags.boolean({ | ||
char: 'f', | ||
default: false, | ||
description: 'Follow the status of the mempool live', | ||
}), | ||
} | ||
|
||
async start(): Promise<void> { | ||
const { flags } = await this.parse(Status) | ||
|
||
if (!flags.follow) { | ||
const client = await this.sdk.connectRpc() | ||
const response = await client.getMempoolStatus() | ||
this.log(renderStatus(response.content)) | ||
this.exit(0) | ||
} | ||
|
||
// Console log will create display issues with Blessed | ||
this.logger.pauseLogs() | ||
|
||
const screen = blessed.screen({ smartCSR: true }) | ||
const statusText = blessed.text() | ||
screen.append(statusText) | ||
|
||
// eslint-disable-next-line no-constant-condition | ||
while (true) { | ||
const connected = await this.sdk.client.tryConnect() | ||
|
||
if (!connected) { | ||
statusText.clearBaseLine(0) | ||
statusText.setContent('Node: STOPPED') | ||
screen.render() | ||
await PromiseUtils.sleep(1000) | ||
continue | ||
} | ||
|
||
const response = this.sdk.client.getMempoolStatusStream() | ||
for await (const value of response.contentStream()) { | ||
statusText.setContent(renderStatus(value)) | ||
screen.render() | ||
} | ||
} | ||
} | ||
} | ||
|
||
function renderStatus(content: GetMempoolStatusResponse): string { | ||
const storage = FileUtils.formatMemorySize(content.sizeBytes) | ||
const maxStorage = FileUtils.formatMemorySize(content.maxSizeBytes) | ||
const saturationPercentage = ((content.sizeBytes / content.maxSizeBytes) * 100).toFixed(2) | ||
|
||
return `\ | ||
Tx Count ${content.size} | ||
Memory ${storage} / ${maxStorage} (${saturationPercentage}%) | ||
Eviction Cache ${content.recentlyEvictedCache.size} / ${content.recentlyEvictedCache.maxSize} | ||
Evictions ${content.evictions} | ||
Head Sequence ${content.headSequence}` | ||
} |
Oops, something went wrong.