Skip to content

Commit

Permalink
Staging to Master. Version 1.10.0 (#4327)
Browse files Browse the repository at this point in the history
* Add creator field to transaction api calls (#4254)

* Explicitly set the asset `creator` field of mints in `RawTransaction`

Do not assume that a mint will be done by the same account that created
the asset, but rather get the creator as an input.

This is necessary to enable minting of assets that you own but you have
not created.

* fixes wallet.updateHead test to be independent of fixture generation (#4265)

the test of updateHead fails when fixtures are regenerated, but passes if they
already exist

this is because creating an account may update the wallet's chainProcessor head
state, but importing an account does not
(https://linear.app/if-labs/issue/IFL-1585/createaccount-and-importaccount-inconsistent)

fixes test to pass indpendently of fixture generation by always updating the
wallet head to the genesis block before adding more blocks

* When an unknown asset is seen in a wallet transaction, backfill its information from the chain db before processing the transaction

This commit is purely a refactor of the current wallet logic, and should
not alter the user-visible behavior of the wallet in any way. This
refactor is foundational work needed to support the transfer of asset
ownership (via `transferOwnershipTo`) in the future.

What this commit does, in a nutshell, is that it makes the backfilling
code run before the transaction gets processed:

    before this change: account.addPendingTransaction(...) -> backfill assets
     after this change: backfill assets -> account.addPendingTransaction(...)

This will greatly simplify the processing of mints with
`transferOwnershipTo` inside `addPendingTransaction`.

* Add more information to getBlockResponse (#4217)

* feat(cli,ironfish): Return native asset when streaming wallet assets (#4267)

* feat(cli,ironfish): Return native asset when streaming wallet assets

* test(ironfish): Fix account test

* test(ironfish): Fix account test

* Add a consensus parameter for asset ownership

Add logic for the miners fee transactions to create the correct version

mining manager only accepts transactions into blocks with the correct
version for the given sequence

add v2 support to RawTransaction (#4234)

* add v2 support to RawTransaction

* add error if transferOwnershipTo exists on a v1 transaction

check the transaction version when adding blocks

This no longer checks the version when transactions are broadcast. This
is because there isn't an easy way to verify any particular version is
correct. A transaction could become valid due to a re-org or a consensus
parameter activating at a specific block sequence.

set devnet activation to 1

fixtures

use an optimistic transaction version when creating transactions (#4237)

* use an optimistic transaction version when creating transactions

This allows for transactions created around the time that a transaction
version change to have an improved chance of being included in the
blockchain by choosing the version if its within a range near the
current head sequence instead of simply choosing the transaction version
based on head sequence + 1

* clarify `versionSequenceDelta`

- Now takes `number` instead of `number | undefined` for a parameter
- Adds an assert to ensure a non-negative integer
- Add more comments + clarify existing
- Updated tests
- Increased the min delta to 4, since 3 is probably too small to ensure
  transactions aren't dead on arrival

remove hardcoded transaction version const (#4240)

* remove hardcoded transaction version const

* add `TransactionVersion::latest()`

mempool removes transactions with versions that should no longer be valid (#4249)

* Update the blockchain db whenever a mint with `transferOwnershipTo` is seen

When a `MintDescription` with `transferOwnershipTo` is seen, the
relevant asset on the chain db is updated to reflect the new owner.

* Update the wallet db whenever a mint with `tranferOwnershipTo` is seen

This also fixes a bug where minting a brand new asset and using it to
send tokens to an account in the same wallet would throw an exception.

* Track originating peer for block gossip (#4270)

* Make activation flag nullable (#4277)

* Make activation block nullable

* Update unit test

* Use a new type

* Add (de)serialization for `Asset`

* Add transferOwnershipTo support to CLI/RPC (#4278)

* adding use account endpoint (#4280)

* Rahul/ifl 1625 renameaccount endpoint (#4279)

* adding renameAccount endpoint

* rename account endpoint fixture

* Rahul/ifl 1587 createaccount endpoint (#4268)

* Adding create account endpoint to the wallet namespace

* changing endpoint name in rpc client

* moving request and response to the correct file

* updating comments

* adding remove account endpoint (#4281)

* adding remove account endpoint

* updating comment for remove

* Rahul/ifl 1603 make asset response consistent across all endpoints (#4272)

* new burn asset response with asset object

* updating tests

* moving asset to a types file to be reused in mint and burn

* updating test

* adding two different construct rpc methods

* updating RcpAccountAssetBalanceDeltaSchema

* updating get account transactions

* deprecating asset variables in balance endpoints

* removing asset object when id doesn't guarantee asset object is found

* removing optional asset object

* removing unused variable

* removing construct functions

* removing optional asset object

* deprecating asset name fields in note, mint, and burn

* normalizing rpc asset object for all endpointS

* fixing tests

* using asset value object

* adding back GetAssetResponse

* reverting client ts changes

* show n/a if supply is not available

* chain get asset uses same asset model

* using Assert.isNotUndefined(accountAsset)

* deprecating the status field on the asset

* adding comment

* removing expect

* Resetti9ng fixture

* sequential-block-time -> staging (#4276)

* [BlockTime] Update block verification to only allow positive block mine time (#4113)

* Update block verification

* Update consensus

* Update unit test

* add comma

* Update fixture

* Set sequential block mine time to never for testnet and mainnet

* Patched Fix Inefficient Regular Expression Complexity Regular Expression Denial of Service (#4271)

Affected of this project are vulnerable to Regular Expression Denial of Service (ReDoS) due to the usage of an insecure regular expression within the result variable.

```js
const wrap = require("word-wrap"); for (let i = 0; i <= 10; i++) { const attack = "a" + "t".repeat(i * 10_00000); const start = performance.now(); wrap( attack, { trim: true }, ); console.log(`${attack.length} characters: ${performance.now() - start}ms`); }
```
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

CWE-1333
`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`

Co-authored-by: jowparks <[email protected]>
Co-authored-by: Rohan Jadvani <[email protected]>

* Rahul/ifl 1580 normalize encrypted note (#4285)

* new burn asset response with asset object

* updating tests

* moving asset to a types file to be reused in mint and burn

* updating test

* adding two different construct rpc methods

* updating RcpAccountAssetBalanceDeltaSchema

* updating get account transactions

* deprecating asset variables in balance endpoints

* removing asset object when id doesn't guarantee asset object is found

* removing optional asset object

* removing unused variable

* removing construct functions

* removing optional asset object

* deprecating asset name fields in note, mint, and burn

* updating note response types for chain endpoints

* fixing get block endpoint

* combining rpc note and wallet note

* Resetting gettransactionstream

* removing rpc note

* Resetting gettransactionstream

* favoring hash over noteHash

* resetting wallet types

* New fixture for multiple custom transactions (#4287)

* Rahul/ifl 1576 normalize block header (#4286)

* new burn asset response with asset object

* updating tests

* moving asset to a types file to be reused in mint and burn

* updating test

* adding two different construct rpc methods

* updating RcpAccountAssetBalanceDeltaSchema

* updating get account transactions

* deprecating asset variables in balance endpoints

* removing asset object when id doesn't guarantee asset object is found

* removing optional asset object

* removing unused variable

* removing construct functions

* removing optional asset object

* deprecating asset name fields in note, mint, and burn

* updating note response types for chain endpoints

* fixing get block endpoint

* combining rpc note and wallet note

* Resetting gettransactionstream

* removing rpc note

* Resetting gettransactionstream

* favoring hash over noteHash

* resetting wallet types

* adding rpc blockheader type

* setting up block header to be reused in chain

* consolidating block responses with transactions

* all tests pass

* removing hex

* changing the notesize back to null

* work was on the wrong endpoint, added back to follow chain stream

* removing work

* removing use of BigIntUtils.writeBigU256BE

* Rahul/ifl 1578 normalize transaction (#4288)

* new burn asset response with asset object

* updating tests

* moving asset to a types file to be reused in mint and burn

* updating test

* adding two different construct rpc methods

* updating RcpAccountAssetBalanceDeltaSchema

* updating get account transactions

* deprecating asset variables in balance endpoints

* removing asset object when id doesn't guarantee asset object is found

* removing optional asset object

* removing unused variable

* removing construct functions

* removing optional asset object

* deprecating asset name fields in note, mint, and burn

* updating note response types for chain endpoints

* fixing get block endpoint

* combining rpc note and wallet note

* Resetting gettransactionstream

* removing rpc note

* Resetting gettransactionstream

* favoring hash over noteHash

* resetting wallet types

* adding rpc blockheader type

* setting up block header to be reused in chain

* consolidating block responses with transactions

* all tests pass

* removing hex

* changing the notesize back to null

* work was on the wrong endpoint, added back to follow chain stream

* removing work

* normalizing rpc account transaction

* changing to wallet transaction

* removing extra transaction field

* renaming to account

* resetting chaintypes.ts

* resetting chaintypes.ts

* combining notes and spends

* adding comment about available notes and spends

* Making confirmations a deprecated field

* Use Decimal library to make feeRates deterministic (#4282)

* Rahul/ifl 266 mintasset and burnasset do not accept a feerate in requests (#4289)

* adding feerate to mintassets and burnassets

* changing to inline if

* making fee optional

* Rahul/ifl 1636 normalize block (#4295)

* adding block

* normalizing block

* removing dependency from deprecated field

* making burn create mint send account field optional (#4291)

* Rahul/ifl 1579 normalize transaction sub objects - mints and burns (#4293)

* creating and using rpc mint and burn everywhere

* compiling version

* Removing deprecated comment

* removing newline

* moving set fields up

* Rahul/ifl 1579 normalize transaction sub objects updating mint burn asset endpoints (#4294)

* creating and using rpc mint and burn everywhere

* compiling version

* using rpc mint for mint asset endpoint

* using rpc burn for burn asset endpoint

* asset mint and burn test

* merging staging and removing duplicate objects

* updating wallet types to staging file

* Add links to CI jobs on badges (#4296)

* Adding the Inversed Tech audit PDF report (#4184)

* resets account heads and birthdays in reset command (#4269)

* Increase the default difficulty when creating genesis and devnet difficulty (#4246)

* Increase the default difficulty when creating genesis

This is mostly useful for local devnet testing, as the default
difficulty is too easy for many systems, which results in transactions
not getting picked up from the mempool when testing locally due to the
pre-emptive empty block changes in the mining manager.

* fixtures

* Close streaming requests at the end of tests (#4090)

* Rahul/ifl 1651 add ability to show usage of deprecated fields in ironfish (#4298)

* adding ability to show usage of deprecated fields

* turning it off to pass lint check

* adding comment

* updated lockfile

* adding lint:deprecated

* feat: rust std::backtrace (#4274)

* feat: rust backtrace support for IronfishError

* pr review updates

* Export network definitions (#4302)

* marking counts fields as deprecated (#4301)

* Rahul/ifl 1641 add optional serialized field to transaction rpc (#4299)

* adding optional serialized field and required signature field

* adding serialized to endpoint input

* using options object instead of individual optional fields

* using question mark notation instead of question mark

* fixing merge issue

* Rahul/ifl 1665 normalize exportchainstream (#4304)

* adding optional serialized field and required signature field

* adding serialized to endpoint input

* reusing blockheader

* using options object instead of individual optional fields

* using question mark notation instead of question mark

* fixing merge issue

* creating single version of peer response (#4305)

* adding burns and mints to the account transaction (#4307)

* changing account transaction to wallet transaction (#4309)

* Notify Slack of fixture regeneration failure (#4164)

* Fix fixture regeneration failures for diable wallet test (#4310)

* Fix fixture regeneration failures for diable wallet test

* regnerate

* Rahul/ifl 1653 update gettransaction response to use the rpc transaction (#4300)

* adding optional serialized field and required signature field

* adding serialized to endpoint input

* updating getTransaction to use RpcTransaction

* passing test

* adding full transaction object to burn and mint asset response (#4311)

* formatting all rpc objects in the same order (#4313)

* formatting all rpc objects in the same order

* changing rcp to rpc

* removing id

* updating export chain stream

* standardizing array usage

* using [] instead of array

* Asset verification field in get balance

* rearranging get balances

* replacing array with []

* replacing array with []

* Rahul/ifl 1643 update cli to stop using the deprecated fields (#4315)

* updating balance command to use asset endpoint

* Returning asset id

* fetching asset for balance

* formatting fixes

* using sequence instead of seq

* updating wallet note deprecated comment

* removing deprecated field usage in wallet transactions and asset utils

* fixed deprecated usage in wallet transaction command

* reverting eslint to staging

* stylistic improvement to use destructing

* updating field name

* using forloop for more readable code

* cleaner lookup logic

* reverting to older balances version

* explicity type

* moving function in file

* removing new lines

* improving readability

* asset lookup helper function

* usign asset lookup helper function

* using helper in transactinos function

* using helper in transactinos function

* choice asset name

* Resume snapshot downloads if supported (#4308)

* Don't use streaming endpoint in status CLI (#4312)

* Rahul/ifl 1690 remove dependence on deprecated status field (#4320)

* Adding comment

* Removing use of deprecated status field

* Removing newline

* Removing unused variable

* removed status from asset wallet command

* Adding feerate to mint and burn (#4318)

* Handle socket read/write errors

* version bump 1.9.0 to 1.10.0 (#4326)

* running rust version bump

* removing new line

---------

Co-authored-by: mat-if <[email protected]>
Co-authored-by: Andrea Corbellini <[email protected]>
Co-authored-by: Hugh Cunningham <[email protected]>
Co-authored-by: lovedret <[email protected]>
Co-authored-by: Rohan Jadvani <[email protected]>
Co-authored-by: Mat <[email protected]>
Co-authored-by: Daniel Cogan <[email protected]>
Co-authored-by: ygao76 <[email protected]>
Co-authored-by: wica-sufatmawati <[email protected]>
Co-authored-by: jowparks <[email protected]>
Co-authored-by: Elena Nadolinski <[email protected]>
Co-authored-by: Derek Guenther <[email protected]>
  • Loading branch information
13 people authored Oct 2, 2023
1 parent fbf32a7 commit 7ef004d
Show file tree
Hide file tree
Showing 243 changed files with 22,801 additions and 27,632 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
*.png -text
*.params -text
mainnet-parameters/params -text

*.pdf binary
9 changes: 9 additions & 0 deletions .github/workflows/ci-regenerate-fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,12 @@ jobs:

- name: Run slow tests
run: JEST_TIMEOUT=1000000000 yarn test:slow:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB

- name: Report Status
if: always()
uses: ravsamhq/notify-slack-action@master
with:
status: ${{ job.status }}
notify_when: 'failure'
env:
SLACK_WEBHOOK_URL: ${{ secrets.GITHUB_ACTIONS_SLACK_WEBHOOK }}
9 changes: 8 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ repository = "https://github.com/iron-fish/ironfish"

[patch.crates-io]
bellman = { git = "https://github.com/iron-fish/bellman", rev = "1cc52ca33e6db14233f1cbc0c9c5b7c822b229ec" }

[profile.release]
debug = true
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

# Iron Fish

![Node CI](https://github.com/iron-fish/ironfish/actions/workflows/ci.yml/badge.svg)
![Rust CI](https://github.com/iron-fish/ironfish/actions/workflows/rust_ci.yml/badge.svg)
![Node CI Regenerate Fixtures](https://github.com/iron-fish/ironfish/actions/workflows/ci-regenerate-fixtures.yml/badge.svg)
[![Node CI](https://github.com/iron-fish/ironfish/actions/workflows/ci.yml/badge.svg)](https://github.com/iron-fish/ironfish/actions/workflows/ci.yml)
[![Rust CI](https://github.com/iron-fish/ironfish/actions/workflows/rust_ci.yml/badge.svg)](https://github.com/iron-fish/ironfish/actions/workflows/rust_ci.yml)
[![Node CI Regenerate Fixtures](https://github.com/iron-fish/ironfish/actions/workflows/ci-regenerate-fixtures.yml/badge.svg)](https://github.com/iron-fish/ironfish/actions/workflows/ci-regenerate-fixtures.yml)
[![codecov](https://codecov.io/gh/iron-fish/ironfish/branch/master/graph/badge.svg?token=fOjPFN18xZ)](https://codecov.io/gh/iron-fish/ironfish)

Iron Fish is a Layer 1 blockchain that provides the strongest privacy guarantees on every single transaction. Leveraging zero-knowledge proofs (zk-SNARKs), and the highest industry standards for encryption.
Expand Down
Binary file added audits/ironfish-audit-report-FINAL.pdf
Binary file not shown.
10 changes: 5 additions & 5 deletions benchmarks/benches/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use criterion::{criterion_group, criterion_main, BatchSize, Criterion};
use ironfish::{
assets::{asset::Asset, asset_identifier::NATIVE_ASSET},
test_util::make_fake_witness,
transaction::{batch_verify_transactions, verify_transaction},
transaction::{batch_verify_transactions, verify_transaction, TransactionVersion},
Note, ProposedTransaction, SaplingKey, Transaction,
};

Expand All @@ -24,7 +24,7 @@ pub fn simple(c: &mut Criterion) {
},
// Benchmark
|(key, spend_note, witness, out_note)| {
let mut proposed = ProposedTransaction::new(key);
let mut proposed = ProposedTransaction::new(key, TransactionVersion::latest());

proposed.add_spend(spend_note, &witness).unwrap();
proposed.add_output(out_note).unwrap();
Expand Down Expand Up @@ -60,7 +60,7 @@ pub fn all_descriptions(c: &mut Criterion) {
|(key, spend_note, witness, out_note, asset)| {
let asset_value = 10;

let mut proposed = ProposedTransaction::new(key);
let mut proposed = ProposedTransaction::new(key, TransactionVersion::latest());

proposed.add_spend(spend_note, &witness).unwrap();
proposed.add_output(out_note).unwrap();
Expand Down Expand Up @@ -92,7 +92,7 @@ pub fn verify(c: &mut Criterion) {

let out_note = Note::new(public_address, 41, "", NATIVE_ASSET, public_address);

let mut proposed = ProposedTransaction::new(key);
let mut proposed = ProposedTransaction::new(key, TransactionVersion::latest());

proposed.add_spend(spend_note, &witness).unwrap();
proposed.add_output(out_note).unwrap();
Expand Down Expand Up @@ -127,7 +127,7 @@ pub fn batch_verify(c: &mut Criterion) {

let out_note = Note::new(public_address, 41, "", NATIVE_ASSET, public_address);

let mut proposed = ProposedTransaction::new(key);
let mut proposed = ProposedTransaction::new(key, TransactionVersion::latest());

proposed.add_spend(spend_note, &witness).unwrap();
proposed.add_output(out_note).unwrap();
Expand Down
5 changes: 5 additions & 0 deletions ironfish-cli/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
/* 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/. */
module.exports = {
extends: ['ironfish'],
parserOptions: {
tsconfigRootDir: __dirname,
},
rules: {
'jest/no-standalone-expect': 'off',
'deprecation/deprecation': 'off', // enable this to warn or error to show deprecated code usage
},
plugins: ['deprecation'],
}
10 changes: 6 additions & 4 deletions ironfish-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ironfish",
"version": "1.9.0",
"version": "1.10.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",
Expand Down Expand Up @@ -31,6 +31,7 @@
"chai": "4.2.0",
"cross-env": "7.0.3",
"eslint-config-ironfish": "*",
"eslint-plugin-deprecation": "2.0.0",
"jest": "29.3.1",
"jest-jasmine2": "29.3.1",
"oclif": "2.6.0",
Expand All @@ -42,6 +43,7 @@
"scripts": {
"build": "tsc -b",
"lint": "tsc -b && eslint --ext .ts,.tsx,.js,.jsx src/",
"lint:deprecated": "yarn lint --rule \"deprecation/deprecation: warn\"",
"lint:fix": "tsc -b && eslint --ext .ts,.tsx,.js,.jsx src/ --fix",
"start:dev": "node start",
"start": "yarn build && yarn start:js",
Expand All @@ -59,8 +61,8 @@
"@aws-sdk/client-s3": "3",
"@aws-sdk/client-secrets-manager": "3",
"@aws-sdk/s3-request-presigner": "3",
"@ironfish/rust-nodejs": "1.8.0",
"@ironfish/sdk": "1.9.0",
"@ironfish/rust-nodejs": "1.9.0",
"@ironfish/sdk": "1.10.0",
"@oclif/core": "1.23.1",
"@oclif/plugin-help": "5.1.12",
"@oclif/plugin-not-found": "2.3.1",
Expand Down Expand Up @@ -101,4 +103,4 @@
"url": "https://github.com/iron-fish/ironfish/issues"
},
"homepage": "https://ironfish.network"
}
}
3 changes: 2 additions & 1 deletion ironfish-cli/src/commands/chain/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export default class Asset extends IronfishCommand {
this.log(`Name: ${BufferUtils.toHuman(Buffer.from(data.content.name, 'hex'))}`)
this.log(`Metadata: ${BufferUtils.toHuman(Buffer.from(data.content.metadata, 'hex'))}`)
this.log(`Creator: ${data.content.creator}`)
this.log(`Supply: ${data.content.supply}`)
this.log(`Owner: ${data.content.owner}`)
this.log(`Supply: ${data.content.supply ?? 'N/A'}`)
this.log(`Identifier: ${data.content.id}`)
this.log(`Transaction Created: ${data.content.createdTransactionHash}`)
}
Expand Down
Loading

0 comments on commit 7ef004d

Please sign in to comment.