Skip to content

Commit

Permalink
Merge pull request #3578 from iron-fish/staging
Browse files Browse the repository at this point in the history
STAGING -> MASTER
  • Loading branch information
dguenther authored Mar 8, 2023
2 parents 6fb75f4 + 577c06a commit ad99f52
Show file tree
Hide file tree
Showing 186 changed files with 14,976 additions and 9,718 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
*.js text
*.json text
*.png -text
*.params -text
*.params -text
mainnet-parameters/params -text
5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE/BUG-REPORT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
Thanks for taking the time to fill out this bug report!
If you are experiencing an issue after upgrading to a new version, please make sure you restart your Iron Fish node. You can check this by running `ironfish status` and `ironfish debug` and comparing the Iron Fish version. In both commands, the version should match.
- type: textarea
id: what-happened
attributes:
Expand All @@ -34,7 +35,7 @@ body:
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
description: Please copy and paste any relevant log output, like the command you entered and the logs leading up to the error. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: input
id: graffiti
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/ci-regenerate-fixtures.yml
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

![Node CI](https://github.com/iron-fish/ironfish/actions/workflows/ci.yml/badge.svg)
![Rust CI](https://github.com/iron-fish/ironfish/actions/workflows/rust_ci.yml/badge.svg)
![Node CI Regenerate Fixtures](https://github.com/iron-fish/ironfish/actions/workflows/ci-regenerate-fixtures.yml/badge.svg)
[![codecov](https://codecov.io/gh/iron-fish/ironfish/branch/master/graph/badge.svg?token=fOjPFN18xZ)](https://codecov.io/gh/iron-fish/ironfish)

Iron Fish is a Layer 1 blockchain that provides the strongest privacy guarantees on every single transaction. Leveraging zero-knowledge proofs (zk-SNARKs), and the highest industry standards for encryption.
Expand Down
23 changes: 13 additions & 10 deletions ironfish-cli/bin/run
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'))
11 changes: 4 additions & 7 deletions ironfish-cli/package.json
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",
Expand Down Expand Up @@ -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": "*",
Expand Down Expand Up @@ -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",
Expand All @@ -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": {
Expand Down
7 changes: 7 additions & 0 deletions ironfish-cli/src/commands/ceremony.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ export default class Ceremony extends IronfishCommand {
let refreshEtaInterval: NodeJS.Timeout | null = null
let etaDate: Date | null = null

// Trusted setup has ended but this command may still be needed in case of future
// setups / network upgrades. So for now, just exit the command with some information
this.log(
`The trusted setup ceremony was completed on Mar 3, 2023. For more information on the trusted setup process and its completion please read https://setup.ironfish.network.`,
)
this.exit(0)

// Prompt for randomness
let randomness: string | null = await CliUx.ux.prompt(
`If you'd like to contribute your own randomness to the ceremony, type it here, then press Enter. For more information on where this should come from and its importance, please read https://setup.ironfish.network. If you'd like the command to generate some randomness for you, just press Enter`,
Expand Down
72 changes: 72 additions & 0 deletions ironfish-cli/src/commands/mempool/status.ts
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}`
}
Loading

0 comments on commit ad99f52

Please sign in to comment.