-
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 #3638 from iron-fish/staging
STAGING -> MASTER
- Loading branch information
Showing
44 changed files
with
1,056 additions
and
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "ironfish", | ||
"version": "0.1.71", | ||
"version": "0.1.72", | ||
"description": "CLI for running and interacting with an Iron Fish node", | ||
"author": "Iron Fish <[email protected]> (https://ironfish.network)", | ||
"main": "build/src/index.js", | ||
|
@@ -59,8 +59,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": "0.1.28", | ||
"@ironfish/sdk": "0.0.48", | ||
"@ironfish/rust-nodejs": "0.1.29", | ||
"@ironfish/sdk": "0.0.49", | ||
"@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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@ironfish/rust-nodejs-darwin-arm64", | ||
"version": "0.1.28", | ||
"version": "0.1.29", | ||
"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": "0.1.28", | ||
"version": "0.1.29", | ||
"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": "0.1.28", | ||
"version": "0.1.29", | ||
"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
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": "0.1.28", | ||
"version": "0.1.29", | ||
"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": "0.1.28", | ||
"version": "0.1.29", | ||
"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": "0.1.28", | ||
"version": "0.1.29", | ||
"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
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../config/tsconfig.base.json" | ||
} | ||
|
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/sdk", | ||
"version": "0.0.48", | ||
"version": "0.0.49", | ||
"description": "SDK for running and interacting with an Iron Fish node", | ||
"author": "Iron Fish <[email protected]> (https://ironfish.network)", | ||
"main": "build/src/index.js", | ||
|
@@ -18,7 +18,7 @@ | |
], | ||
"dependencies": { | ||
"@ethersproject/bignumber": "5.7.0", | ||
"@ironfish/rust-nodejs": "0.1.28", | ||
"@ironfish/rust-nodejs": "0.1.29", | ||
"@napi-rs/blake-hash": "1.3.3", | ||
"axios": "0.21.4", | ||
"bech32": "2.0.0", | ||
|
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
98 changes: 98 additions & 0 deletions
98
ironfish/src/migrations/data/026-timestamp-to-transactions.ts
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 |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* 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/. */ | ||
import { Logger } from '../../logger' | ||
import { IronfishNode } from '../../node' | ||
import { IDatabase, IDatabaseTransaction } from '../../storage' | ||
import { createDB } from '../../storage/utils' | ||
import { Account } from '../../wallet' | ||
import { Migration } from '../migration' | ||
import { GetStores } from './026-timestamp-to-transactions/stores' | ||
|
||
export class Migration026 extends Migration { | ||
path = __filename | ||
|
||
prepare(node: IronfishNode): IDatabase { | ||
return createDB({ location: node.config.walletDatabasePath }) | ||
} | ||
|
||
async forward( | ||
node: IronfishNode, | ||
db: IDatabase, | ||
_tx: IDatabaseTransaction | undefined, | ||
logger: Logger, | ||
): Promise<void> { | ||
const accounts = [] | ||
const stores = GetStores(db) | ||
|
||
for await (const account of stores.old.accounts.getAllValuesIter()) { | ||
accounts.push( | ||
new Account({ | ||
...account, | ||
createdAt: null, | ||
walletDb: node.wallet.walletDb, | ||
}), | ||
) | ||
} | ||
|
||
const accountsString = | ||
accounts.length === 1 ? `${accounts.length} account` : `${accounts.length} accounts` | ||
logger.info(`Indexing transaction timestamps for ${accountsString}`) | ||
|
||
for (const account of accounts) { | ||
logger.info('') | ||
logger.info(` Indexing transaction timestamps for account ${account.name}`) | ||
|
||
let transactionCount = 0 | ||
for await (const { timestamp, transaction } of stores.old.transactions.getAllValuesIter( | ||
undefined, | ||
account.prefixRange, | ||
)) { | ||
await stores.new.timestampToTransactionHash.put( | ||
[account.prefix, [timestamp.getTime(), transaction.hash()]], | ||
null, | ||
) | ||
|
||
transactionCount++ | ||
} | ||
|
||
const transactionsString = | ||
transactionCount === 1 | ||
? `${transactionCount} transaction` | ||
: `${transactionCount} transactions` | ||
logger.info(` Completed indexing ${transactionsString} for account ${account.name}`) | ||
} | ||
|
||
await stores.old.timestampToTransactionHash.clear() | ||
logger.info('') | ||
} | ||
|
||
async backward(node: IronfishNode, db: IDatabase): Promise<void> { | ||
const accounts = [] | ||
const stores = GetStores(db) | ||
|
||
for await (const account of stores.old.accounts.getAllValuesIter()) { | ||
accounts.push( | ||
new Account({ | ||
...account, | ||
createdAt: null, | ||
walletDb: node.wallet.walletDb, | ||
}), | ||
) | ||
} | ||
|
||
for (const account of accounts) { | ||
for await (const { timestamp, transaction } of stores.old.transactions.getAllValuesIter( | ||
undefined, | ||
account.prefixRange, | ||
)) { | ||
await stores.old.timestampToTransactionHash.put( | ||
[account.prefix, timestamp.getTime()], | ||
transaction.hash(), | ||
) | ||
} | ||
|
||
await stores.new.timestampToTransactionHash.clear() | ||
} | ||
} | ||
} |
Oops, something went wrong.