Skip to content

Commit

Permalink
STAGING -> MASTER (#1175)
Browse files Browse the repository at this point in the history
* Use tar.gz link instead of npm's github resolution (#1157)

Using the github resolution, npm treats the install as a dev dependency, so it doesn't grab dependencies as expected. This is apparently a known issue they seem uninterested in fixing. Using .tar.gz links directly accomplishes what we want while installing dependencies as expected.

* Fix pool payout discord message (#1170)

We are printing ore and saying it's iron, but this way it will say that
it's probably displayed in iron.

* Remove unnecessary TODO (#1164)

* Remove unused Note and Nullifier messages (#1163)

* Miner's self reported hashrate needs to take into account how many threads are running (#1174)

* Add allow dead code flags for napi struct methods (#1171)

* Upgrade oclif dev cli to 2.6.0 (#1158)

* Update @oclif/test to 2.1.0 (#1160)

* Update @oclif/test to 2.1.0

* Remove unused package.json scripts

Co-authored-by: Mat <[email protected]>

* Update oclif/core and plugins (#1159)

Co-authored-by: Mat <[email protected]>

* Upgrade node-datachannel to 0.2.4 (#1162)

Co-authored-by: Mat <[email protected]>

* Bump sdk and cli version for release 0.1.28 (#1176)

Co-authored-by: Jason Spafford <[email protected]>
Co-authored-by: Derek Guenther <[email protected]>
  • Loading branch information
3 people authored Mar 25, 2022
2 parents f40f586 + a9ed332 commit fe91206
Show file tree
Hide file tree
Showing 9 changed files with 992 additions and 1,905 deletions.
22 changes: 9 additions & 13 deletions ironfish-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ironfish",
"version": "0.1.27",
"version": "0.1.28",
"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 All @@ -23,16 +23,15 @@
"node": "16.x"
},
"devDependencies": {
"@oclif/dev-cli": "^1",
"@oclif/test": "^1",
"@oclif/test": "2.1.0",
"@types/blessed": "0.1.17",
"@types/node": "16.11.1",
"@types/ws": "7.4.5",
"chai": "4.2.0",
"cross-env": "7.0.3",
"eslint-config-ironfish": "*",
"jest": "26.6.3",
"oclif": "1.16.1",
"oclif": "2.6.0",
"rimraf": "^3.0.2",
"tsc-watch": "4.2.9",
"typescript": "4.3.4",
Expand All @@ -50,18 +49,15 @@
"test:watch": "tsc -b tsconfig.test.json && jest --watch --coverage false",
"postpack": "rimraf oclif.manifest.json",
"clean": "rimraf build",
"pack": "oclif-dev pack",
"prepack": "rimraf build && yarn build && oclif-dev manifest && oclif-dev readme",
"oclif:posttest": "eslint . --ext .ts --config .eslintrc",
"oclif:test": "echo NO TESTS",
"oclif:version": "oclif-dev readme && git add README.md"
"prepack": "rimraf build && yarn build && oclif manifest && oclif readme",
"oclif:version": "oclif readme && git add README.md"
},
"dependencies": {
"@ironfish/rust-nodejs": "0.1.2",
"@ironfish/sdk": "0.0.5",
"@oclif/core": "1.3.1",
"@oclif/plugin-help": "3.2.2",
"@oclif/plugin-not-found": "1.2.4",
"@ironfish/sdk": "0.0.6",
"@oclif/core": "1.6.1",
"@oclif/plugin-help": "5.1.12",
"@oclif/plugin-not-found": "2.3.1",
"axios": "0.21.4",
"blessed": "0.1.81",
"json-colorizer": "2.2.2",
Expand Down
7 changes: 7 additions & 0 deletions ironfish-rust-nodejs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,34 +58,40 @@ pub struct FoundBlockResult {

#[napi]
struct ThreadPoolHandler {
#[allow(dead_code)]
threadpool: mining::threadpool::ThreadPool,
}
#[napi]
impl ThreadPoolHandler {
#[napi(constructor)]
#[allow(dead_code)]
pub fn new(thread_count: u32, batch_size: u32) -> Self {
ThreadPoolHandler {
threadpool: mining::threadpool::ThreadPool::new(thread_count as usize, batch_size),
}
}

#[napi]
#[allow(dead_code)]
pub fn new_work(&mut self, header_bytes: Buffer, target: Buffer, mining_request_id: u32) {
self.threadpool
.new_work(&header_bytes, &target, mining_request_id)
}

#[napi]
#[allow(dead_code)]
pub fn stop(&self) {
self.threadpool.stop()
}

#[napi]
#[allow(dead_code)]
pub fn pause(&self) {
self.threadpool.pause()
}

#[napi]
#[allow(dead_code)]
pub fn get_found_block(&self) -> Option<FoundBlockResult> {
if let Some(result) = self.threadpool.get_found_block() {
return Some(FoundBlockResult {
Expand All @@ -97,6 +103,7 @@ impl ThreadPoolHandler {
}

#[napi]
#[allow(dead_code)]
pub fn get_hash_rate_submission(&self) -> u32 {
self.threadpool.get_hash_rate_submission()
}
Expand Down
4 changes: 3 additions & 1 deletion ironfish-rust/src/mining/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ fn process_commands(
Some(randomness) => randomness - batch_start,
None => batch_size,
};
hash_rate_channel.send(work_done as u32).unwrap();
hash_rate_channel
.send((work_done / step_size) as u32)
.unwrap();

// New command received, this work is now stale, stop working so we can start on new work
if let Ok(cmd) = work_receiver.try_recv() {
Expand Down
3 changes: 0 additions & 3 deletions ironfish-rust/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,6 @@ impl<J: JubjubEngine + pairing::MultiMillerLoop> Transaction<J> {
/// Calculate a hash of the transaction data. This hash was signed by the
/// private keys when the transaction was constructed, and will now be
/// reconstructed to verify the signature.
///
/// TODO: This is very likely not hashing the right values or enough
/// values.
pub fn transaction_signature_hash(&self) -> [u8; 32] {
let mut hasher = Blake2b::new()
.hash_length(32)
Expand Down
8 changes: 4 additions & 4 deletions ironfish/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ironfish/sdk",
"version": "0.0.5",
"version": "0.0.6",
"description": "SDK for running and interacting with an Iron Fish node",
"author": "Iron Fish <[email protected]> (https://ironfish.network)",
"main": "build/src/index.js",
Expand All @@ -20,7 +20,7 @@
"@ironfish/rust-nodejs": "0.1.2",
"@napi-rs/blake-hash": "1.3.1",
"axios": "0.21.4",
"bfilter": "bcoin-org/bfilter#70e42125f877191d340e8838a1a90fabb750e680",
"bfilter": "https://github.com/bcoin-org/bfilter/archive/70e42125f877191d340e8838a1a90fabb750e680.tar.gz",
"blru": "0.1.6",
"buffer": "6.0.3",
"buffer-json": "2.0.0",
Expand All @@ -36,11 +36,11 @@
"leveldown": "5.6.0",
"levelup": "4.4.0",
"lodash": "4.17.21",
"node-datachannel": "0.1.12",
"node-datachannel": "0.2.4",
"node-ipc": "9.1.3",
"parse-json": "5.1.0",
"sqlite": "4.0.23",
"sqlite3": "mapbox/node-sqlite3#918052b538b0effe6c4a44c74a16b2749c08a0d2",
"sqlite3": "https://github.com/mapbox/node-sqlite3/archive/918052b538b0effe6c4a44c74a16b2749c08a0d2.tar.gz",
"tweetnacl": "1.0.3",
"uuid": "8.3.2",
"ws": "7.5.1",
Expand Down
10 changes: 4 additions & 6 deletions ironfish/src/mining/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import Axios, { AxiosInstance } from 'axios'
import { createRootLogger, Logger } from '../logger'
import { displayIronAmountWithCurrency, ErrorUtils } from '../utils'
import { displayIronAmountWithCurrency, ErrorUtils, oreToIron } from '../utils'
import { FileUtils } from '../utils/file'

export class Discord {
Expand Down Expand Up @@ -55,12 +55,10 @@ export class Discord {
const total = receives.reduce((m, c) => BigInt(c.amount) + m, BigInt(0))

this.sendText(
`Successfully paid out ${
receives.length
} users for ${total} ${displayIronAmountWithCurrency(
Number(total.toString()),
`Successfully paid out ${receives.length} users for ${displayIronAmountWithCurrency(
Number(oreToIron(Number(total.toString()))),
false,
)} in transaction \`${transactionHashHex}\``,
)} in transaction \`${transactionHashHex}\` (${payoutId})`,
)
}

Expand Down
Loading

0 comments on commit fe91206

Please sign in to comment.