-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3932 from iron-fish/staging
STAGING -> MASTER
- Loading branch information
Showing
133 changed files
with
7,734 additions
and
4,122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,159 @@ | ||
use benchmarks::slow_config; | ||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
use benchmarks::{slow_config, very_slow_config}; | ||
use criterion::{criterion_group, criterion_main, BatchSize, Criterion}; | ||
use ironfish_rust::{ | ||
assets::{asset::Asset, asset_identifier::NATIVE_ASSET}, | ||
test_util::make_fake_witness, | ||
Note, ProposedTransaction, SaplingKey, | ||
transaction::batch_verify_transactions, | ||
Note, ProposedTransaction, SaplingKey, Transaction, | ||
}; | ||
|
||
pub fn simple(c: &mut Criterion) { | ||
let key = SaplingKey::generate_key(); | ||
let public_address = key.public_address(); | ||
c.bench_function("transaction::simple", |b| { | ||
b.iter_batched( | ||
// Setup | ||
|| { | ||
let key = SaplingKey::generate_key(); | ||
let public_address = key.public_address(); | ||
|
||
let spend_note = Note::new(public_address, 42, "", NATIVE_ASSET, public_address); | ||
let witness = make_fake_witness(&spend_note); | ||
let spend_note = Note::new(public_address, 42, "", NATIVE_ASSET, public_address); | ||
let witness = make_fake_witness(&spend_note); | ||
|
||
let out_note = Note::new(public_address, 41, "", NATIVE_ASSET, public_address); | ||
let out_note = Note::new(public_address, 41, "", NATIVE_ASSET, public_address); | ||
|
||
c.bench_function("transaction::simple", |b| { | ||
b.iter(|| { | ||
let mut proposed = ProposedTransaction::new(key.clone()); | ||
(key, spend_note, witness, out_note) | ||
}, | ||
// Benchmark | ||
|(key, spend_note, witness, out_note)| { | ||
let mut proposed = ProposedTransaction::new(key); | ||
|
||
proposed.add_spend(spend_note.clone(), &witness).unwrap(); | ||
proposed.add_output(out_note.clone()).unwrap(); | ||
proposed.add_spend(spend_note, &witness).unwrap(); | ||
proposed.add_output(out_note).unwrap(); | ||
|
||
let tx = proposed.post(None, 1).unwrap(); | ||
let tx = proposed.post(None, 1).unwrap(); | ||
|
||
assert_eq!(tx.spends().len(), 1); | ||
assert_eq!(tx.outputs().len(), 1); | ||
}) | ||
assert_eq!(tx.spends().len(), 1); | ||
assert_eq!(tx.outputs().len(), 1); | ||
}, | ||
BatchSize::LargeInput, | ||
); | ||
}); | ||
} | ||
|
||
pub fn all_descriptions(c: &mut Criterion) { | ||
let key = SaplingKey::generate_key(); | ||
let public_address = key.public_address(); | ||
c.bench_function("transaction::all_descriptions", |b| { | ||
b.iter_batched( | ||
// Setup | ||
|| { | ||
let key = SaplingKey::generate_key(); | ||
let public_address = key.public_address(); | ||
|
||
let spend_note = Note::new(public_address, 42, "", NATIVE_ASSET, public_address); | ||
let witness = make_fake_witness(&spend_note); | ||
let spend_note = Note::new(public_address, 42, "", NATIVE_ASSET, public_address); | ||
let witness = make_fake_witness(&spend_note); | ||
|
||
let out_note = Note::new(public_address, 41, "", NATIVE_ASSET, public_address); | ||
let out_note = Note::new(public_address, 41, "", NATIVE_ASSET, public_address); | ||
|
||
let asset = Asset::new(public_address, "Testcoin", "A really cool coin").unwrap(); | ||
let asset_value = 10; | ||
let asset = Asset::new(public_address, "Testcoin", "A really cool coin").unwrap(); | ||
|
||
c.bench_function("transaction::all_descriptions", |b| { | ||
b.iter(|| { | ||
let mut proposed = ProposedTransaction::new(key.clone()); | ||
(key, spend_note, witness, out_note, asset) | ||
}, | ||
// Benchmark | ||
|(key, spend_note, witness, out_note, asset)| { | ||
let asset_value = 10; | ||
|
||
let mut proposed = ProposedTransaction::new(key); | ||
|
||
proposed.add_spend(spend_note, &witness).unwrap(); | ||
proposed.add_output(out_note).unwrap(); | ||
proposed.add_mint(asset, asset_value).unwrap(); | ||
proposed.add_burn(*asset.id(), asset_value).unwrap(); | ||
|
||
let tx = proposed.post(None, 1).unwrap(); | ||
|
||
assert_eq!(tx.spends().len(), 1); | ||
assert_eq!(tx.outputs().len(), 1); | ||
assert_eq!(tx.mints().len(), 1); | ||
assert_eq!(tx.burns().len(), 1); | ||
}, | ||
BatchSize::LargeInput, | ||
); | ||
}); | ||
} | ||
|
||
pub fn verify(c: &mut Criterion) { | ||
c.bench_function("transaction::verify", |b| { | ||
b.iter_batched( | ||
// Setup | ||
|| { | ||
let key = SaplingKey::generate_key(); | ||
let public_address = key.public_address(); | ||
|
||
let spend_note = Note::new(public_address, 42, "", NATIVE_ASSET, public_address); | ||
let witness = make_fake_witness(&spend_note); | ||
|
||
let out_note = Note::new(public_address, 41, "", NATIVE_ASSET, public_address); | ||
|
||
proposed.add_spend(spend_note.clone(), &witness).unwrap(); | ||
proposed.add_output(out_note.clone()).unwrap(); | ||
proposed.add_mint(asset, asset_value).unwrap(); | ||
proposed.add_burn(*asset.id(), asset_value).unwrap(); | ||
let mut proposed = ProposedTransaction::new(key); | ||
|
||
let tx = proposed.post(None, 1).unwrap(); | ||
proposed.add_spend(spend_note, &witness).unwrap(); | ||
proposed.add_output(out_note).unwrap(); | ||
|
||
assert_eq!(tx.spends().len(), 1); | ||
assert_eq!(tx.outputs().len(), 1); | ||
assert_eq!(tx.mints().len(), 1); | ||
assert_eq!(tx.burns().len(), 1); | ||
}) | ||
proposed.post(None, 1).unwrap() | ||
}, | ||
// Benchmark | ||
|tx| { | ||
tx.verify().unwrap(); | ||
}, | ||
BatchSize::LargeInput, | ||
); | ||
}); | ||
} | ||
|
||
pub fn batch_verify(c: &mut Criterion) { | ||
c.bench_function("transaction::batch_verify", |b| { | ||
b.iter_batched( | ||
// Setup | ||
|| { | ||
const TRANSACTION_AMOUNT: usize = 5; | ||
|
||
let mut transactions: Vec<Transaction> = Vec::with_capacity(TRANSACTION_AMOUNT); | ||
|
||
for _ in 0..TRANSACTION_AMOUNT { | ||
let key = SaplingKey::generate_key(); | ||
let public_address = key.public_address(); | ||
|
||
let spend_note = | ||
Note::new(public_address, 42, "", NATIVE_ASSET, public_address); | ||
let witness = make_fake_witness(&spend_note); | ||
|
||
let out_note = Note::new(public_address, 41, "", NATIVE_ASSET, public_address); | ||
|
||
let mut proposed = ProposedTransaction::new(key); | ||
|
||
proposed.add_spend(spend_note, &witness).unwrap(); | ||
proposed.add_output(out_note).unwrap(); | ||
|
||
transactions.push(proposed.post(None, 1).unwrap()); | ||
} | ||
|
||
transactions | ||
}, | ||
// Benchmark | ||
|transactions| { | ||
batch_verify_transactions(transactions.iter()).unwrap(); | ||
}, | ||
BatchSize::LargeInput, | ||
); | ||
}); | ||
} | ||
|
||
criterion_group! { | ||
name = slow_benches; | ||
config = slow_config(); | ||
targets = simple, all_descriptions | ||
targets = simple, all_descriptions, verify | ||
} | ||
criterion_group! { | ||
name = very_slow_benches; | ||
config = very_slow_config(); | ||
targets = batch_verify, | ||
} | ||
criterion_main!(slow_benches); | ||
criterion_main!(slow_benches, very_slow_benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "ironfish", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "CLI for running and interacting with an Iron Fish node", | ||
"author": "Iron Fish <[email protected]> (https://ironfish.network)", | ||
"main": "build/src/index.js", | ||
|
@@ -60,8 +60,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": "1.1.0", | ||
"@ironfish/sdk": "1.2.0", | ||
"@ironfish/rust-nodejs": "1.2.0", | ||
"@ironfish/sdk": "1.3.0", | ||
"@oclif/core": "1.23.1", | ||
"@oclif/plugin-help": "5.1.12", | ||
"@oclif/plugin-not-found": "2.3.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@ironfish/rust-nodejs-darwin-arm64", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"os": [ | ||
"darwin" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@ironfish/rust-nodejs-darwin-x64", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"os": [ | ||
"darwin" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@ironfish/rust-nodejs-linux-arm64-gnu", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"os": [ | ||
"linux" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@ironfish/rust-nodejs-linux-arm64-musl", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"os": [ | ||
"linux" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@ironfish/rust-nodejs-linux-x64-gnu", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"os": [ | ||
"linux" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@ironfish/rust-nodejs-linux-x64-musl", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"os": [ | ||
"linux" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@ironfish/rust-nodejs-win32-x64-msvc", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"os": [ | ||
"win32" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.