Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staging -> Master #4583

Merged
merged 38 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ce4b7e7
refactor posting of proposed/unsigned transaction (#4539)
jowparks Jan 16, 2024
7ec915b
adds optional multiSigKeys to AccountValue (#4538)
hughy Jan 16, 2024
b4efbc0
Rahul/ifl 2105 add note selection to walletsend (#4545)
patnir Jan 17, 2024
d39655f
Update @typescript-eslint to 6.19.0, eslint to 8.56.0 (#4544)
dguenther Jan 17, 2024
6da4748
Fix typescript eslint in perf tests (#4550)
dguenther Jan 17, 2024
d309975
adds build method in napi bindings for ProposedTransaction.build() (#…
jowparks Jan 17, 2024
6677083
setting route test isready and synced to true (#4552)
patnir Jan 17, 2024
0ed026d
adds optional multiSigKeys to Account type (#4547)
hughy Jan 17, 2024
06a9f03
Rahul/ifl 2044 1 add rust method to split a sapling key into shares f…
patnir Jan 17, 2024
fc8855d
stores multiSigKeys as hex instead of utf8 (#4553)
hughy Jan 17, 2024
76819fb
ironfish round one wrapper for core frost (#4554)
jowparks Jan 18, 2024
96bf135
Add FishHash to node verification (#4536)
danield9tqh Jan 18, 2024
df29d10
Rahul/move split secret (#4557)
patnir Jan 18, 2024
dbbab1b
napi binding for round one of frost signing (#4556)
jowparks Jan 18, 2024
44422d2
round_two signing that produces signature share after cooridnator ass…
jowparks Jan 18, 2024
79c62d4
adds round_two napi binding for frost signing (#4559)
jowparks Jan 18, 2024
a759728
Load or generate networkIdentity if none is passed (#4540)
dguenther Jan 18, 2024
6a757a0
adds multiSigKeys to account imports, exports (#4560)
hughy Jan 18, 2024
1497f22
Add missing consensus params to chain/getConsensusParameters (#4566)
danield9tqh Jan 18, 2024
0b5c60f
Add config value for building the full FishHash context (#4561)
danield9tqh Jan 19, 2024
4f44aae
chore: Ironfish rust proof generation key trait (#4565)
jowparks Jan 19, 2024
8583028
creates method for taking commitments from participants and creating …
jowparks Jan 19, 2024
b879e8b
outputs hex string for proof generation key in napi bindings (#4564)
jowparks Jan 19, 2024
aefb818
Use createdAt as head of imported account (#4549)
hairtail Jan 19, 2024
07ca7b8
Refactor isActive function on Consensus (#4567)
danield9tqh Jan 19, 2024
8e718b2
Renamed many RPC types for consistency (#4573)
NullSoldier Jan 20, 2024
acfec3f
Move auth token into if statement (#4574)
NullSoldier Jan 20, 2024
b23d9f3
Default timeout to null (#4575)
NullSoldier Jan 20, 2024
1b010cf
Move weird await usage (#4577)
NullSoldier Jan 20, 2024
54db84e
Rahul/ifl 2044 split spender key (#4555)
patnir Jan 22, 2024
cd02987
moves change notes construction inside of `build` function of `Propos…
jowparks Jan 22, 2024
cd199d5
Query the full consensus parameters in the pool and solo miners (#4576)
danield9tqh Jan 22, 2024
0031b28
Rename ERROR_CODES TO RPC_ERROR_CODES (#4578)
NullSoldier Jan 22, 2024
7447f38
Fixed typo of delimiter (#4579)
NullSoldier Jan 22, 2024
426ccc7
Add RpcHttpClient (#4571)
NullSoldier Jan 22, 2024
3969373
remove get unspent notes (#4580)
patnir Jan 22, 2024
aa762f8
Unsigned transaction napi (#4563)
jowparks Jan 23, 2024
5222867
Version bump to CLI version 1.17.0 (#4584)
danield9tqh Jan 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ testdbs
.env.production.local
*/**/yarn.lock
.idea
.vscode

# logs
npm-debug.log*
Expand Down
1 change: 1 addition & 0 deletions config/eslint-config-ironfish/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module.exports = {
// the matchers to unknown, or defining a custom matcher, which seems
// like too much friction for test-writing.
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
// It's common to want to mock unbound methods.
'@typescript-eslint/unbound-method': 'off',
// Using try catch with expect.assertions(n) is the recommended way to
Expand Down
6 changes: 3 additions & 3 deletions config/eslint-config-ironfish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
".prettierrc"
],
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "4.28.1",
"@typescript-eslint/parser": "4.28.1",
"eslint": "7.29.0",
"@typescript-eslint/eslint-plugin": "6.19.0",
"@typescript-eslint/parser": "6.19.0",
"eslint": "8.56.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-ironfish": "*",
"eslint-plugin-jest": "27.1.6",
Expand Down
2 changes: 1 addition & 1 deletion config/eslint-plugin-ironfish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"index.js"
],
"peerDependencies": {
"eslint": "7.29.0"
"eslint": "8.56.0"
},
"scripts": {
"test": "node index.test.js"
Expand Down
4 changes: 2 additions & 2 deletions ironfish-cli/src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export abstract class IronfishCommand extends Command {
async init(): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
const commandClass = this.constructor as any
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const { flags } = await this.parse(commandClass)

// Get the flags from the flag object which is unknown
Expand Down Expand Up @@ -218,7 +218,7 @@ export abstract class IronfishCommand extends Command {
}
}

function getFlag(flags: unknown, flag: FLAGS): unknown | null {
function getFlag(flags: unknown, flag: FLAGS): unknown {
return typeof flags === 'object' && flags !== null && flag in flags
? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
(flags as any)[flag]
Expand Down
2 changes: 1 addition & 1 deletion ironfish-cli/src/commands/chain/genesisadd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default class GenesisAddCommand extends IronfishCommand {
}

CliUx.ux.table(allocations, columns, {
printLine: (line) => this.log(line),
printLine: this.log.bind(this),
})

// Display duplicates if they exist
Expand Down
2 changes: 1 addition & 1 deletion ironfish-cli/src/commands/chain/genesisblock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default class GenesisBlockCommand extends IronfishCommand {
}

CliUx.ux.table(info.allocations, columns, {
printLine: (line) => this.log(line),
printLine: this.log.bind(this),
})

// Display duplicates if they exist
Expand Down
8 changes: 1 addition & 7 deletions ironfish-cli/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default class Start extends IronfishCommand {
await this.sdk.internal.save()
}

const node = await this.sdk.node({ privateIdentity: this.sdk.getPrivateIdentity() })
const node = await this.sdk.node()

const nodeName = this.sdk.config.get('nodeName').trim() || null
const blockGraffiti = this.sdk.config.get('blockGraffiti').trim() || null
Expand Down Expand Up @@ -254,12 +254,6 @@ export default class Start extends IronfishCommand {
this.exit(1)
}

const newSecretKey = Buffer.from(
node.peerNetwork.localPeer.privateIdentity.secretKey,
).toString('hex')
node.internal.set('networkIdentity', newSecretKey)
await node.internal.save()

if (node.internal.get('isFirstRun')) {
await this.firstRun(node)
}
Expand Down
2 changes: 1 addition & 1 deletion ironfish-cli/src/typedefs/blru.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ declare module 'blru' {
constructor(
capacity: number,
getSize?: GetSizeFunction<TKey, TValue> | null,
CustomMap?: typeof Map | unknown | null,
CustomMap?: unknown,
)

map: Map<TKey, LRUItem<TKey, TValue>>
Expand Down
7 changes: 5 additions & 2 deletions ironfish-cli/src/utils/fees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {
Assert,
CreateTransactionRequest,
CurrencyUtils,
ERROR_CODES,
Logger,
RawTransaction,
RawTransactionSerde,
RPC_ERROR_CODES,
RpcClient,
RpcRequestError,
} from '@ironfish/sdk'
Expand Down Expand Up @@ -109,7 +109,10 @@ async function getTxWithFee(
})

const response = await promise.catch((e) => {
if (e instanceof RpcRequestError && e.code === ERROR_CODES.INSUFFICIENT_BALANCE) {
if (
e instanceof RpcRequestError &&
e.code === RPC_ERROR_CODES.INSUFFICIENT_BALANCE.valueOf()
) {
return null
} else {
throw e
Expand Down
2 changes: 1 addition & 1 deletion ironfish-cli/src/utils/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const MAX_MULTIPART_NUM = 10000

class UploadToBucketError extends Error {
name = this.constructor.name
error: unknown | undefined
error: unknown

constructor(message?: string, error?: unknown) {
super(message)
Expand Down
3 changes: 2 additions & 1 deletion ironfish-cli/src/utils/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export async function watchTransaction(options: {

const startTime = lastTime

let prevStatus = last?.content.transaction?.status ?? 'not found'
let prevStatus: TransactionStatus | 'not found' =
last?.content.transaction?.status ?? 'not found'
let currentStatus = prevStatus

// If the transaction is already in the desired state, return
Expand Down
14 changes: 14 additions & 0 deletions ironfish-rust-nodejs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

/* auto-generated by NAPI-RS */

export interface RoundOneSigningData {
nonceHiding: string
nonceBinding: string
commitmentHiding: string
commitmentBinding: string
}
export function roundOne(keyPackage: string, seed: number): RoundOneSigningData
export function contribute(inputPath: string, outputPath: string, seed?: string | undefined | null): Promise<string>
export function verifyTransform(paramsPath: string, newParamsPath: string): Promise<string>
export const KEY_LENGTH: number
Expand Down Expand Up @@ -75,6 +82,7 @@ export interface Key {
incomingViewKey: string
outgoingViewKey: string
publicAddress: string
proofGenerationKey: string
}
export function generateKey(): Key
export function spendingKeyToWords(privateKey: string, languageCode: LanguageCode): string
Expand Down Expand Up @@ -215,8 +223,14 @@ export class Transaction {
* aka: self.value_balance - intended_transaction_fee - change = 0
*/
post(spenderHexKey: string, changeGoesTo: string | undefined | null, intendedTransactionFee: bigint): Buffer
build(proofGenerationKeyStr: string, viewKeyStr: string, outgoingViewKeyStr: string, publicAddressStr: string, intendedTransactionFee: bigint, changeGoesTo?: string | undefined | null): Buffer
setExpiration(sequence: number): void
}
export type NativeUnsignedTransaction = UnsignedTransaction
export class UnsignedTransaction {
constructor(jsBytes: Buffer)
serialize(): Buffer
}
export class FoundBlockResult {
randomness: string
miningRequestId: number
Expand Down
4 changes: 3 additions & 1 deletion ironfish-rust-nodejs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,10 @@ if (!nativeBinding) {
throw new Error(`Failed to load native binding`)
}

const { FishHashContext, contribute, verifyTransform, KEY_LENGTH, NONCE_LENGTH, BoxKeyPair, randomBytes, boxMessage, unboxMessage, RollingFilter, initSignalHandler, triggerSegfault, ASSET_ID_LENGTH, ASSET_METADATA_LENGTH, ASSET_NAME_LENGTH, ASSET_LENGTH, Asset, NOTE_ENCRYPTION_KEY_LENGTH, MAC_LENGTH, ENCRYPTED_NOTE_PLAINTEXT_LENGTH, ENCRYPTED_NOTE_LENGTH, NoteEncrypted, PUBLIC_ADDRESS_LENGTH, RANDOMNESS_LENGTH, MEMO_LENGTH, AMOUNT_VALUE_LENGTH, DECRYPTED_NOTE_LENGTH, Note, PROOF_LENGTH, TRANSACTION_SIGNATURE_LENGTH, TRANSACTION_PUBLIC_KEY_RANDOMNESS_LENGTH, TRANSACTION_EXPIRATION_LENGTH, TRANSACTION_FEE_LENGTH, LATEST_TRANSACTION_VERSION, TransactionPosted, Transaction, verifyTransactions, LanguageCode, generateKey, spendingKeyToWords, wordsToSpendingKey, generateKeyFromPrivateKey, initializeSapling, FoundBlockResult, ThreadPoolHandler, isValidPublicAddress } = nativeBinding
const { FishHashContext, roundOne, contribute, verifyTransform, KEY_LENGTH, NONCE_LENGTH, BoxKeyPair, randomBytes, boxMessage, unboxMessage, RollingFilter, initSignalHandler, triggerSegfault, ASSET_ID_LENGTH, ASSET_METADATA_LENGTH, ASSET_NAME_LENGTH, ASSET_LENGTH, Asset, NOTE_ENCRYPTION_KEY_LENGTH, MAC_LENGTH, ENCRYPTED_NOTE_PLAINTEXT_LENGTH, ENCRYPTED_NOTE_LENGTH, NoteEncrypted, PUBLIC_ADDRESS_LENGTH, RANDOMNESS_LENGTH, MEMO_LENGTH, AMOUNT_VALUE_LENGTH, DECRYPTED_NOTE_LENGTH, Note, PROOF_LENGTH, TRANSACTION_SIGNATURE_LENGTH, TRANSACTION_PUBLIC_KEY_RANDOMNESS_LENGTH, TRANSACTION_EXPIRATION_LENGTH, TRANSACTION_FEE_LENGTH, LATEST_TRANSACTION_VERSION, TransactionPosted, Transaction, verifyTransactions, UnsignedTransaction, LanguageCode, generateKey, spendingKeyToWords, wordsToSpendingKey, generateKeyFromPrivateKey, initializeSapling, FoundBlockResult, ThreadPoolHandler, isValidPublicAddress } = nativeBinding

module.exports.FishHashContext = FishHashContext
module.exports.roundOne = roundOne
module.exports.contribute = contribute
module.exports.verifyTransform = verifyTransform
module.exports.KEY_LENGTH = KEY_LENGTH
Expand Down Expand Up @@ -291,6 +292,7 @@ module.exports.LATEST_TRANSACTION_VERSION = LATEST_TRANSACTION_VERSION
module.exports.TransactionPosted = TransactionPosted
module.exports.Transaction = Transaction
module.exports.verifyTransactions = verifyTransactions
module.exports.UnsignedTransaction = UnsignedTransaction
module.exports.LanguageCode = LanguageCode
module.exports.generateKey = generateKey
module.exports.spendingKeyToWords = spendingKeyToWords
Expand Down
57 changes: 57 additions & 0 deletions ironfish-rust-nodejs/src/frost.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* 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/. */

use ironfish::{
frost::{
keys::KeyPackage,
round2::{Randomizer, SignatureShare},
SigningPackage,
},
frost_utils::{round_one::round_one as round_one_rust, round_two::round_two as round_two_rust},
serializing::{bytes_to_hex, hex_to_bytes, hex_to_vec_bytes},
};
use napi::bindgen_prelude::*;
use napi_derive::napi;

use crate::to_napi_err;

#[napi(object)]
pub struct RoundOneSigningData {
pub nonce_hiding: String,
pub nonce_binding: String,
pub commitment_hiding: String,
pub commitment_binding: String,
}

#[napi]
pub fn round_one(key_package: String, seed: u32) -> Result<RoundOneSigningData> {
let key_package =
KeyPackage::deserialize(&hex_to_vec_bytes(&key_package).map_err(to_napi_err)?)
.map_err(to_napi_err)?;
let (nonce, commitment) = round_one_rust(&key_package, seed as u64);
Ok(RoundOneSigningData {
nonce_hiding: bytes_to_hex(&nonce.hiding().serialize()),
nonce_binding: bytes_to_hex(&nonce.binding().serialize()),
commitment_hiding: bytes_to_hex(&commitment.hiding().serialize()),
commitment_binding: bytes_to_hex(&commitment.binding().serialize()),
})
}

pub fn round_two(
signing_package: String,
key_package: String,
public_key_randomness: String,
seed: u64,
) -> Result<SignatureShare> {
let key_package =
KeyPackage::deserialize(&hex_to_vec_bytes(&key_package).map_err(to_napi_err)?[..])
.map_err(to_napi_err)?;
let signing_package =
SigningPackage::deserialize(&hex_to_vec_bytes(&signing_package).map_err(to_napi_err)?[..])
.map_err(to_napi_err)?;
let randomizer =
Randomizer::deserialize(&hex_to_bytes(&public_key_randomness).map_err(to_napi_err)?)
.map_err(to_napi_err)?;
round_two_rust(signing_package, key_package, randomizer, seed).map_err(to_napi_err)
}
6 changes: 6 additions & 0 deletions ironfish-rust-nodejs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
use std::fmt::Display;

use ironfish::keys::Language;
use ironfish::keys::ProofGenerationKeySerializable;
use ironfish::PublicAddress;
use ironfish::SaplingKey;

use napi::bindgen_prelude::*;
use napi_derive::napi;

use ironfish::mining;
use ironfish::sapling_bls12;

pub mod fish_hash;
pub mod frost;
pub mod mpc;
pub mod nacl;
pub mod rolling_filter;
Expand Down Expand Up @@ -62,6 +65,7 @@ pub struct Key {
pub incoming_view_key: String,
pub outgoing_view_key: String,
pub public_address: String,
pub proof_generation_key: String,
}

#[napi]
Expand All @@ -74,6 +78,7 @@ pub fn generate_key() -> Key {
incoming_view_key: sapling_key.incoming_view_key().hex_key(),
outgoing_view_key: sapling_key.outgoing_view_key().hex_key(),
public_address: sapling_key.public_address().hex_public_address(),
proof_generation_key: sapling_key.sapling_proof_generation_key().hex_key(),
}
}

Expand All @@ -100,6 +105,7 @@ pub fn generate_key_from_private_key(private_key: String) -> Result<Key> {
incoming_view_key: sapling_key.incoming_view_key().hex_key(),
outgoing_view_key: sapling_key.outgoing_view_key().hex_key(),
public_address: sapling_key.public_address().hex_public_address(),
proof_generation_key: sapling_key.sapling_proof_generation_key().hex_key(),
})
}

Expand Down
Loading