Skip to content

Commit 79e7e05

Browse files
authored
Merge pull request #3806 from iron-fish/staging
STAGING -> MASTER
2 parents 6e6508d + c252c84 commit 79e7e05

File tree

26 files changed

+237
-51
lines changed

26 files changed

+237
-51
lines changed

.github/workflows/deploy-node-docker-image.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ jobs:
7272
docker push ghcr.io/iron-fish/ironfish:latest
7373
7474
# Used if we are deploying a new version (e.g. v1.1)
75-
# This is only executed when deploying a new release to mainnet
7675
- name: Deploy Node Image to GitHub:${{ github.ref_name }}
77-
if: ${{ inputs.github_tag_mainnet && github.event.ref_type == 'tag'}}
76+
if: ${{ github.ref_type == 'tag'}}
7877
run: |
7978
docker tag ironfish ghcr.io/iron-fish/ironfish:${{ github.ref_name }}
8079
docker push ghcr.io/iron-fish/ironfish:${{ github.ref_name }}

.github/workflows/push-version-to-api.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
name: Push new version number to API
2-
on: workflow_dispatch
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
push_mainnet:
6+
description: "mainnet"
7+
type: boolean
8+
default: false
9+
push_testnet:
10+
description: "testnet"
11+
type: boolean
12+
default: false
313

414
jobs:
515
Push:
@@ -10,8 +20,16 @@ jobs:
1020
- name: Check out Git repository
1121
uses: actions/checkout@v3
1222

13-
- name: Push version string to API
23+
- name: Push version string to mainnet API
24+
if: ${{ inputs.push_mainnet }}
1425
run: ./ironfish-cli/scripts/push-version.sh
1526
env:
1627
IRON_FISH_API_KEY: ${{ secrets.IRON_FISH_API_KEY }}
1728
IRON_FISH_API_URL: ${{ secrets.IRON_FISH_API_URL }}
29+
30+
- name: Push version string to testnet API
31+
if: ${{ inputs.push_testnet }}
32+
run: ./ironfish-cli/scripts/push-version.sh
33+
env:
34+
IRON_FISH_API_KEY: ${{ secrets.IRON_FISH_API_KEY_TESTNET }}
35+
IRON_FISH_API_URL: ${{ secrets.IRON_FISH_API_URL_TESTNET }}

ironfish-cli/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ironfish",
3-
"version": "0.1.76",
3+
"version": "1.0.0",
44
"description": "CLI for running and interacting with an Iron Fish node",
55
"author": "Iron Fish <[email protected]> (https://ironfish.network)",
66
"main": "build/src/index.js",
@@ -60,8 +60,8 @@
6060
"@aws-sdk/client-s3": "3.127.0",
6161
"@aws-sdk/client-secrets-manager": "3.276.0",
6262
"@aws-sdk/s3-request-presigner": "3.127.0",
63-
"@ironfish/rust-nodejs": "0.1.31",
64-
"@ironfish/sdk": "0.0.53",
63+
"@ironfish/rust-nodejs": "1.0.0",
64+
"@ironfish/sdk": "1.0.0",
6565
"@oclif/core": "1.23.1",
6666
"@oclif/plugin-help": "5.1.12",
6767
"@oclif/plugin-not-found": "2.3.1",

ironfish-cli/src/commands/mainnet.ts

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4+
import { ErrorUtils, HOST_FILE_NAME } from '@ironfish/sdk'
5+
import { CliUx, Flags } from '@oclif/core'
6+
import fsAsync from 'fs/promises'
7+
import { IronfishCommand } from '../command'
8+
import {
9+
ConfigFlag,
10+
ConfigFlagKey,
11+
DataDirFlag,
12+
DataDirFlagKey,
13+
VerboseFlag,
14+
VerboseFlagKey,
15+
} from '../flags'
16+
17+
export default class Mainnet extends IronfishCommand {
18+
static description = 'Migrate Iron Fish testnet data to mainnet'
19+
20+
static flags = {
21+
[VerboseFlagKey]: VerboseFlag,
22+
[ConfigFlagKey]: ConfigFlag,
23+
[DataDirFlagKey]: DataDirFlag,
24+
confirm: Flags.boolean({
25+
default: false,
26+
description: 'Confirm without asking',
27+
}),
28+
}
29+
30+
async start(): Promise<void> {
31+
const { flags } = await this.parse(Mainnet)
32+
33+
const currentNetworkId = this.sdk.internal.get('networkId')
34+
if (currentNetworkId === 1) {
35+
this.log(`Data directory is already set up for mainnet.`)
36+
this.exit(0)
37+
}
38+
39+
const chainDatabasePath = this.sdk.config.chainDatabasePath
40+
const hostFilePath: string = this.sdk.config.files.join(
41+
this.sdk.config.dataDir,
42+
HOST_FILE_NAME,
43+
)
44+
45+
const message =
46+
'\nYou are about to migrate your Iron Fish data to mainnet.' +
47+
'\nYour wallet, accounts, and node configuration will be saved.' +
48+
`\n\nThis data directory will be migrated: ${this.sdk.config.dataDir}` +
49+
`\n\nAre you sure? (Y)es / (N)o`
50+
51+
const confirmed = flags.confirm || (await CliUx.ux.confirm(message))
52+
53+
if (!confirmed) {
54+
this.log('Migration aborted.')
55+
this.exit(0)
56+
}
57+
58+
CliUx.ux.action.start('Migrating data...')
59+
60+
try {
61+
await Promise.all([
62+
fsAsync.rm(chainDatabasePath, { recursive: true, force: true }),
63+
fsAsync.rm(hostFilePath, { recursive: true, force: true }),
64+
])
65+
} catch (error: unknown) {
66+
CliUx.ux.action.stop('error')
67+
this.log(
68+
'\nAn error occurred while migrating to mainnet. Please stop all running Iron Fish nodes and try again.',
69+
)
70+
this.logger.debug(ErrorUtils.renderError(error, true))
71+
this.exit(1)
72+
}
73+
74+
// Reset the telemetry config to allow people to re-opt in
75+
if (this.sdk.config.isSet('enableTelemetry') && this.sdk.config.get('enableTelemetry')) {
76+
this.sdk.config.clear('enableTelemetry')
77+
await this.sdk.config.save()
78+
}
79+
80+
this.sdk.internal.set('networkId', 1)
81+
this.sdk.internal.set('isFirstRun', true)
82+
this.sdk.internal.clear('telemetryNodeId')
83+
await this.sdk.internal.save()
84+
85+
// Reset walletDb stores containing chain data
86+
const node = await this.sdk.node()
87+
const walletDb = node.wallet.walletDb
88+
89+
await walletDb.db.open()
90+
91+
for (const store of walletDb.cacheStores) {
92+
await store.clear()
93+
}
94+
95+
CliUx.ux.action.stop('Data migrated successfully.')
96+
}
97+
}

ironfish-cli/src/commands/reset.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ export default class Reset extends IronfishCommand {
8080
this.sdk.internal.set('isFirstRun', true)
8181
await this.sdk.internal.save()
8282

83+
const node = await this.sdk.node()
84+
const walletDb = node.wallet.walletDb
85+
86+
await walletDb.db.open()
87+
88+
for (const store of walletDb.cacheStores) {
89+
await store.clear()
90+
}
91+
8392
CliUx.ux.action.stop('Databases deleted successfully')
8493
}
8594
}

ironfish-cli/src/commands/wallet/transactions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ export class TransactionsCommand extends IronfishCommand {
120120
}
121121

122122
// exclude the native asset in cli output if no amount was sent/received
123-
if (format === Format.cli && amount === 0n) {
123+
// and it was not the only asset exchanged
124+
if (format === Format.cli && amount === 0n && assetCount > 1) {
124125
assetCount -= 1
125126
continue
126127
}

ironfish-rust-nodejs/npm/darwin-arm64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ironfish/rust-nodejs-darwin-arm64",
3-
"version": "0.1.31",
3+
"version": "1.0.0",
44
"os": [
55
"darwin"
66
],

ironfish-rust-nodejs/npm/darwin-x64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ironfish/rust-nodejs-darwin-x64",
3-
"version": "0.1.31",
3+
"version": "1.0.0",
44
"os": [
55
"darwin"
66
],

ironfish-rust-nodejs/npm/linux-arm64-gnu/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ironfish/rust-nodejs-linux-arm64-gnu",
3-
"version": "0.1.31",
3+
"version": "1.0.0",
44
"os": [
55
"linux"
66
],

ironfish-rust-nodejs/npm/linux-arm64-musl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ironfish/rust-nodejs-linux-arm64-musl",
3-
"version": "0.1.31",
3+
"version": "1.0.0",
44
"os": [
55
"linux"
66
],

0 commit comments

Comments
 (0)