Skip to content

Commit 14de108

Browse files
authored
Merge pull request #5752 from iron-fish/staging
STAGING -> MASTER
2 parents 03b5180 + ec50882 commit 14de108

File tree

223 files changed

+19623
-33718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+19623
-33718
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy NPM Ironfish Rust Wasm
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dry-run:
7+
description: 'Run the publish command in dry-run mode'
8+
required: false
9+
default: 'false'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Use Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
registry-url: 'https://registry.npmjs.org'
24+
cache: yarn
25+
26+
- name: Cache Rust
27+
uses: Swatinem/rust-cache@v2
28+
with:
29+
shared-key: wasm
30+
31+
- name: Install wasm-pack
32+
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
33+
34+
- name: Generate package
35+
working-directory: ./ironfish-rust-wasm
36+
run: wasm-pack build --release --target=web --scope=ironfish
37+
38+
- name: Test in Firefox
39+
working-directory: ./ironfish-rust-wasm
40+
run: wasm-pack test --headless --firefox
41+
42+
- name: Test in Chrome
43+
working-directory: ./ironfish-rust-wasm
44+
run: wasm-pack test --headless --chrome
45+
46+
- name: Publish
47+
working-directory: ./ironfish-rust-wasm/pkg
48+
run: |
49+
if [ ${{ github.event.inputs.dry-run }} = "true" ]; then
50+
npm publish --access public --dry-run
51+
else
52+
npm publish --access public
53+
fi
54+
env:
55+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Cargo.lock

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,13 @@ If you want to contribute code, you must first read [our contributing guidelines
8686

8787
## Other Repositories
8888

89-
- [iron-fish/homebrew-brew](https://github.com/iron-fish/homebrew-brew): Contains brew formula for installing via the [Brew](https://brew.sh) package manager
9089
- [iron-fish/website](https://github.com/iron-fish/website): The repo that powers [ironfish.network](https://ironfish.network)
91-
- [iron-fish/website-testnet](https://github.com/iron-fish/website-testnet): The repo that powers [testnet.ironfish.network](https://testnet.ironfish.network)
9290
- [iron-fish/ironfish-api](https://github.com/iron-fish/ironfish-api): The repository that powers most Iron Fish API services.
91+
- [iron-fish/ironfish-node-app](https://github.com/iron-fish/ironfish-node-app): Desktop app to run and manage an Iron Fish node
92+
- [iron-fish/mobile-wallet](https://github.com/iron-fish/mobile-wallet): Mobile app Iron Fish wallet
93+
- [iron-fish/homebrew-brew](https://github.com/iron-fish/homebrew-brew): Contains brew formula for installing via the [Brew](https://brew.sh) package manager
9394
- [iron-fish/chain-explorer](https://github.com/iron-fish/chain-explorer): A visual tool to explore the block chain and all of its forks.
95+
- [iron-fish/website-testnet](https://github.com/iron-fish/website-testnet): The repo that powered testnet.ironfish.network
9496

9597
## Audit
9698

ironfish-cli/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RUN \
66
apt-get update && \
77
apt-get install jq rsync -y
88

9-
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
9+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=1.76.0
1010

1111
COPY ./ /usr/src/ironfish
1212

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": "2.10.0",
3+
"version": "2.11.0",
44
"description": "CLI for running and interacting with an Iron Fish node",
55
"author": "Iron Fish <contact@ironfish.network> (https://ironfish.network)",
66
"main": "build/src/index.js",
@@ -62,8 +62,8 @@
6262
},
6363
"dependencies": {
6464
"@ironfish/multisig-broker": "0.3.0",
65-
"@ironfish/rust-nodejs": "2.9.0",
66-
"@ironfish/sdk": "2.10.0",
65+
"@ironfish/rust-nodejs": "2.10.0",
66+
"@ironfish/sdk": "2.11.0",
6767
"@ledgerhq/errors": "6.19.1",
6868
"@ledgerhq/hw-transport-node-hid": "6.29.5",
6969
"@oclif/core": "4.0.11",

ironfish-cli/src/commands/wallet/multisig/commitment/create.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
44
import { multisig } from '@ironfish/rust-nodejs'
5-
import { RpcClient, UnsignedTransaction } from '@ironfish/sdk'
5+
import { UnsignedTransaction } from '@ironfish/sdk'
66
import { Flags } from '@oclif/core'
77
import { IronfishCommand } from '../../../../command'
88
import { RemoteFlags } from '../../../../flags'
@@ -53,9 +53,9 @@ export class CreateSigningCommitmentCommand extends IronfishCommand {
5353
const client = await this.connectRpc()
5454
await ui.checkWalletUnlocked(client)
5555

56-
let participantName = flags.account
57-
if (!participantName) {
58-
participantName = await ui.multisigSecretPrompt(client)
56+
let accountName = flags.account
57+
if (!accountName) {
58+
accountName = await ui.multisigAccountPrompt(client)
5959
}
6060

6161
let identities = options.identity
@@ -88,24 +88,19 @@ export class CreateSigningCommitmentCommand extends IronfishCommand {
8888
await renderUnsignedTransactionDetails(
8989
client,
9090
unsignedTransaction,
91-
participantName,
91+
accountName,
9292
this.logger,
9393
)
9494

9595
await ui.confirmOrQuit('Confirm signing commitment creation', flags.confirm)
9696

9797
if (flags.ledger) {
98-
await this.createSigningCommitmentWithLedger(
99-
client,
100-
participantName,
101-
unsignedTransaction,
102-
identities,
103-
)
98+
await this.createSigningCommitmentWithLedger(unsignedTransaction, identities)
10499
return
105100
}
106101

107102
const response = await client.wallet.multisig.createSigningCommitment({
108-
account: participantName,
103+
account: accountName,
109104
unsignedTransaction: unsignedTransactionInput,
110105
signers: identities.map((identity) => ({ identity })),
111106
})
@@ -119,15 +114,18 @@ export class CreateSigningCommitmentCommand extends IronfishCommand {
119114
}
120115

121116
async createSigningCommitmentWithLedger(
122-
client: RpcClient,
123-
participantName: string,
124117
unsignedTransaction: UnsignedTransaction,
125118
signers: string[],
126119
): Promise<void> {
127120
const ledger = new LedgerMultiSigner()
128121

129-
const identityResponse = await client.wallet.multisig.getIdentity({ name: participantName })
130-
const identity = identityResponse.content.identity
122+
const identity = (
123+
await ui.ledger({
124+
ledger,
125+
message: 'Getting Ledger Identity',
126+
action: () => ledger.dkgGetIdentity(0),
127+
})
128+
).toString('hex')
131129

132130
const rawCommitments = await ui.ledger({
133131
ledger,

ironfish-cli/src/commands/wallet/multisig/dealer/create.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export class MultisigCreateDealer extends IronfishCommand {
9898
multisigKeys: {
9999
publicKeyPackage: response.content.publicKeyPackage,
100100
},
101+
ledger: false,
101102
}
102103

103104
await client.wallet.importAccount({

ironfish-cli/src/commands/wallet/multisig/dkg/create.ts

Lines changed: 26 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -235,38 +235,20 @@ export class DkgCreateCommand extends IronfishCommand {
235235
identity: string
236236
name: string
237237
}> {
238-
const identities = await client.wallet.multisig.getIdentities()
239-
240238
if (ledger) {
241-
const ledgerIdentity = await ui.ledger({
242-
ledger,
243-
message: 'Getting Ledger Identity',
244-
action: () => ledger.dkgGetIdentity(0),
245-
})
246-
247-
const foundIdentity = identities.content.identities.find(
248-
(i) => i.identity === ledgerIdentity.toString('hex'),
249-
)
250-
251-
if (foundIdentity) {
252-
this.debug('Identity from ledger already exists')
253-
return foundIdentity
254-
}
255-
256-
// We must use the ledger's identity
257-
while (identities.content.identities.find((i) => i.name === name)) {
258-
this.log('An identity with the same name already exists')
259-
name = await ui.inputPrompt('Enter a new name for the identity', true)
260-
}
261-
262-
const created = await client.wallet.multisig.importParticipant({
263-
name,
264-
identity: ledgerIdentity.toString('hex'),
265-
})
239+
const ledgerIdentity = (
240+
await ui.ledger({
241+
ledger,
242+
message: 'Getting Ledger Identity',
243+
action: () => ledger.dkgGetIdentity(0),
244+
})
245+
).toString('hex')
266246

267-
return { name, identity: created.content.identity }
247+
return { name, identity: ledgerIdentity }
268248
}
269249

250+
const identities = await client.wallet.multisig.getIdentities()
251+
270252
const foundIdentity = identities.content.identities.find((i) => i.name === name)
271253

272254
if (foundIdentity) {
@@ -301,15 +283,18 @@ export class DkgCreateCommand extends IronfishCommand {
301283

302284
async performRound1WithLedger(
303285
ledger: LedgerMultiSigner,
304-
client: RpcClient,
305-
participantName: string,
306286
identities: string[],
307287
minSigners: number,
308288
): Promise<{
309289
round1: { secretPackage: string; publicPackage: string }
310290
}> {
311-
const identityResponse = await client.wallet.multisig.getIdentity({ name: participantName })
312-
const identity = identityResponse.content.identity
291+
const identity = (
292+
await ui.ledger({
293+
ledger,
294+
message: 'Getting Ledger Identity',
295+
action: () => ledger.dkgGetIdentity(0),
296+
})
297+
).toString('hex')
313298

314299
if (!identities.includes(identity)) {
315300
identities.push(identity)
@@ -351,13 +336,7 @@ export class DkgCreateCommand extends IronfishCommand {
351336
})
352337

353338
if (ledger) {
354-
return await this.performRound1WithLedger(
355-
ledger,
356-
client,
357-
participantName,
358-
identities,
359-
minSigners,
360-
)
339+
return await this.performRound1WithLedger(ledger, identities, minSigners)
361340
}
362341

363342
this.log('\nPerforming DKG Round 1...')
@@ -450,14 +429,18 @@ export class DkgCreateCommand extends IronfishCommand {
450429
ledger: LedgerMultiSigner,
451430
client: RpcClient,
452431
accountName: string,
453-
participantName: string,
454432
round1PublicPackagesStr: string[],
455433
round2PublicPackagesStr: string[],
456434
round2SecretPackage: string,
457435
accountCreatedAt?: number,
458436
): Promise<void> {
459-
const identityResponse = await client.wallet.multisig.getIdentity({ name: participantName })
460-
const identity = identityResponse.content.identity
437+
const identity = (
438+
await ui.ledger({
439+
ledger,
440+
message: 'Getting Ledger Identity',
441+
action: () => ledger.dkgGetIdentity(0),
442+
})
443+
).toString('hex')
461444

462445
// Sort packages by identity
463446
const round1PublicPackages = round1PublicPackagesStr
@@ -529,6 +512,7 @@ export class DkgCreateCommand extends IronfishCommand {
529512
name: accountName,
530513
createdAt: null,
531514
spendingKey: null,
515+
ledger: true,
532516
}
533517

534518
// Import multisig account
@@ -566,7 +550,6 @@ export class DkgCreateCommand extends IronfishCommand {
566550
ledger,
567551
client,
568552
accountName,
569-
participantName,
570553
round1PublicPackages,
571554
round2PublicPackages,
572555
round2Result.secretPackage,

ironfish-cli/src/commands/wallet/multisig/dkg/round1.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* This Source Code Form is subject to the terms of the Mozilla Public
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4-
import { RpcClient } from '@ironfish/sdk'
54
import { Flags } from '@oclif/core'
65
import { IronfishCommand } from '../../../../command'
76
import { RemoteFlags } from '../../../../flags'
@@ -31,7 +30,7 @@ export class DkgRound1Command extends IronfishCommand {
3130
ledger: Flags.boolean({
3231
default: false,
3332
description: 'Perform operation with a ledger device',
34-
hidden: true,
33+
exclusive: ['participantName'],
3534
}),
3635
}
3736

@@ -41,11 +40,6 @@ export class DkgRound1Command extends IronfishCommand {
4140
const client = await this.connectRpc()
4241
await ui.checkWalletUnlocked(client)
4342

44-
let participantName = flags.participantName
45-
if (!participantName) {
46-
participantName = await ui.multisigSecretPrompt(client)
47-
}
48-
4943
let identities = flags.identity
5044
if (!identities || identities.length < 2) {
5145
const input = await ui.longPrompt(
@@ -72,10 +66,15 @@ export class DkgRound1Command extends IronfishCommand {
7266
}
7367

7468
if (flags.ledger) {
75-
await this.performRound1WithLedger(client, participantName, identities, minSigners)
69+
await this.performRound1WithLedger(identities, minSigners)
7670
return
7771
}
7872

73+
let participantName = flags.participantName
74+
if (!participantName) {
75+
participantName = await ui.multisigSecretPrompt(client)
76+
}
77+
7978
const response = await client.wallet.multisig.dkg.round1({
8079
participantName,
8180
participants: identities.map((identity) => ({ identity })),
@@ -94,16 +93,16 @@ export class DkgRound1Command extends IronfishCommand {
9493
this.log('Send the round 1 public package to each participant')
9594
}
9695

97-
async performRound1WithLedger(
98-
client: RpcClient,
99-
participantName: string,
100-
identities: string[],
101-
minSigners: number,
102-
): Promise<void> {
96+
async performRound1WithLedger(identities: string[], minSigners: number): Promise<void> {
10397
const ledger = new LedgerMultiSigner()
10498

105-
const identityResponse = await client.wallet.multisig.getIdentity({ name: participantName })
106-
const identity = identityResponse.content.identity
99+
const identity = (
100+
await ui.ledger({
101+
ledger,
102+
message: 'Getting Ledger Identity',
103+
action: () => ledger.dkgGetIdentity(0),
104+
})
105+
).toString('hex')
107106

108107
if (!identities.includes(identity)) {
109108
identities.push(identity)

0 commit comments

Comments
 (0)