Skip to content

Commit

Permalink
Merge pull request #3770 from iron-fish/staging
Browse files Browse the repository at this point in the history
STAGING -> MASTER
  • Loading branch information
hughy committed Apr 10, 2023
2 parents 41157bf + 41c3c93 commit 5f68460
Show file tree
Hide file tree
Showing 249 changed files with 14,585 additions and 9,763 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ jobs:
- name: Run slow tests & coverage
run: yarn test:slow:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB

- name: Run import/export account tests
run: sudo apt-get update && sudo apt-get install -y expect && yarn build && cd ironfish-cli && yarn test:importexport

- name: Upload coverage
if: github.repository == 'iron-fish/ironfish'
run: CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} ROOT_PATH=$GITHUB_WORKSPACE/ yarn coverage:upload
2 changes: 1 addition & 1 deletion .github/workflows/deploy-brew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

- name: Cache Ironfish CLI Build
id: cache-ironfish-cli-build
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ironfish-cli/build.cli/ironfish-cli.tar.gz
key: ${{ github.sha }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-node-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.BREW_GITHUB_TOKEN }}

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-npm-ironfish-rust-nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: npm install --no-workspaces

- name: Download all artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
path: ironfish-rust-nodejs/artifacts

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rust_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
# Upload code coverage to Codecov
- name: Upload to codecov.io
uses: codecov/codecov-action@v2.1.0
uses: codecov/codecov-action@v3
with:
token: ${{secrets.CODECOV_TOKEN}}
flags: ironfish-rust
Expand All @@ -109,7 +109,7 @@ jobs:
# Upload code coverage to Codecov
- name: Upload to codecov.io
uses: codecov/codecov-action@v2.1.0
uses: codecov/codecov-action@v3
with:
token: ${{secrets.CODECOV_TOKEN}}
flags: ironfish-zkp
7 changes: 4 additions & 3 deletions ironfish-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ironfish",
"version": "0.1.74",
"version": "0.1.75",
"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 @@ -49,6 +49,7 @@
"test": "yarn clean && tsc -b && tsc -b tsconfig.test.json && jest --passWithNoTests",
"test:coverage:html": "tsc -b tsconfig.test.json && jest --passWithNoTests --coverage --coverage-reporters html --testPathIgnorePatterns",
"test:watch": "tsc -b tsconfig.test.json && jest --watch --coverage false",
"test:importexport": "bash ./scripts/import-export-test.sh",
"postpack": "rimraf oclif.manifest.json",
"clean": "rimraf build",
"prepack": "rimraf build && yarn build && oclif manifest && oclif readme",
Expand All @@ -59,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": "0.1.29",
"@ironfish/sdk": "0.0.51",
"@ironfish/rust-nodejs": "0.1.30",
"@ironfish/sdk": "0.0.52",
"@oclif/core": "1.23.1",
"@oclif/plugin-help": "5.1.12",
"@oclif/plugin-not-found": "2.3.1",
Expand Down
144 changes: 144 additions & 0 deletions ironfish-cli/scripts/import-export-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"

ENABLE_LOGS=0
DATA_DIR="../testdbs/importexport"
TIMEFORMAT='Success in %3lR'

if ! command -v expect &> /dev/null; then
echo "expect is not installed but is required"
exit 1
fi

if [[ $ENABLE_LOGS -eq 1 ]] ; then
exec 3>&1
else
exec 3>/dev/null
fi

# check if import was successful
function check_import_success() {
local account_name=$1
ACCOUNTS_OUTPUT=$(../bin/ironfish wallet:accounts -d $DATA_DIR)

if ! echo "$ACCOUNTS_OUTPUT" | grep -q "$account_name"; then
echo "Import failed for $account_name"
exit 1
fi
}

# check if deletion was successful
function delete_account() {
local account_name=$1

../bin/ironfish wallet:delete -d $DATA_DIR $account_name &> /dev/null

ACCOUNTS_OUTPUT=$(../bin/ironfish wallet:accounts -d $DATA_DIR)

if echo "$ACCOUNTS_OUTPUT" | grep -q "$account_name"; then
echo "Deletion failed for $account_name"
exit 1
fi
}

function check_error() {
local return_code=$?
local error_message="$1"

if [ $return_code -ne 0 ]; then
echo "$error_message"
exit 1
fi
}

function import_account_interactively() {
local account_name="$1"
local file_contents="$2"

expect -c "
spawn ../bin/ironfish wallet:import -d $DATA_DIR --name $account_name
expect \"Paste the output of wallet:export, or your spending key:\"
send {${file_contents}}
send \"\r\"
expect {
\"Paste the output of wallet:export, or your spending key:\" {
exp_continue
}
\"Account $account_name imported\" {
# Success, do nothing
}
eof
}
" >&3

check_error "Import failed for $account_name"
check_import_success "$ACCOUNT_NAME"
}


function import_account_by_pipe() {
local account_name="$1"
local test_file="$2"

expect -c "
spawn sh -c \"cat $test_file | ../bin/ironfish wallet:import -d $DATA_DIR --name $account_name\"
expect {
\"Account $account_name imported\" {
set output \$expect_out(buffer)
exp_continue
}
eof {
set output \$expect_out(buffer)
}
}
puts \$output
" >&3

check_error "Import failed for $account_name"
check_import_success "$account_name"
}

function import_account_by_path() {
local account_name="$1"
local test_file="$2"

expect -c "
spawn ../bin/ironfish wallet:import --path $test_file -d $DATA_DIR --name $account_name
expect {
\"Account $account_name imported\" {
set output \$expect_out(buffer)
}
eof {
set output \$expect_out(buffer)
}
}
puts \$output
" >&3

check_error "Import failed for $account_name"
check_import_success "$account_name"
}

rm -rf $DATA_DIR

for TEST_FILE in ./import-export-test/*.txt
do
FILENAME=$(basename -- "$TEST_FILE")
ACCOUNT_NAME="${FILENAME%.*}"
FILE_CONTENTS=$(cat "$TEST_FILE")

if [[ "$FILENAME" != *"mnemonic"* ]]; then
echo "Running import by pipe: $TEST_FILE"
time import_account_by_pipe "$ACCOUNT_NAME" "$TEST_FILE"
delete_account "$ACCOUNT_NAME"
fi

echo "Running import by input: $TEST_FILE"
time import_account_interactively "$ACCOUNT_NAME" "$FILE_CONTENTS"
delete_account "$ACCOUNT_NAME"

echo "Running import by path: $TEST_FILE"
time import_account_by_path "$ACCOUNT_NAME" "$TEST_FILE"
done

1 change: 1 addition & 0 deletions ironfish-cli/scripts/import-export-test/0p1p65_bech32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ironfishaccount0000010v38vetjwd5k7m3z8gcjcgnwv9kk2g36ygc8qvtsxc647cnvda3zytpzwdcx2mnyd9hxwjm90y3r5g34xa3nswpkvf3xzwrzvejnvd33vcekzen9x9nx2v3exq6xyvmyvgckzvn9xvmrqen9xqmn2cnrv4nxzef5xgenydfkve3n2vp5vgcr2g3vyfmxjethfdjhjg36ygmnzwfevv6kxwryxejrvcenxqurjce3xymnqvenvf3xzcmzxuerzetzxsurvc3sxgur2vfhx9snyvp3xguxvvtrvdjngvpkxc6rwve4xuckvwfhxu6rwctzxycnqvnxx56xydfnxp3xgefj89jk2wp4xv6kvwpkxdjrwdf4vdskvdnxx4nxvdp5v5erydmrvymrwenr89jnqc3z9s3xjmnrdakkjmn82e5k2a6tv4ujyw3zxp3nxve5v5uxzenrvgmkzvpcv93nyvf4xcmnwd3cvdjxyetr8y6kye3cxyergvf5vc6ngdmrvyunvvnyxycn2efc8qekgwtxvgenqvpz9s3x7at5vahkjmn82e5k2a6tv4ujyw3zvfsn2wt9x93nxc3hvvenywtzxq6n2vp3xp3n2enrxgux2de4x4jx2v3hxyunjd33vvuryv3nvscrwen9vgervvpev3nrwenx8qckxv3z9s38qatzd35kxstyv3ex2umnygazydpexejngdm9vserxctxvejkvd35x43kxe3jv33xxef4vg6rsdeevfjnwep3xgcxyenxxycxzc34x9snswp5vfnxgven8qcnywf589jzylg7sfvp6
1 change: 1 addition & 0 deletions ironfish-cli/scripts/import-export-test/0p1p65_json.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"name":"0p1p65_json","spendingKey":"f4c6f935511cf5545199b08ecd2a80976952ff362da9683277e1a9c1a00b3d59","viewKey":"abc6fccdb8daad80f3d73a9c46256b384ac53a565de08cbc4ea76edc83819aa5f8862bf09912aa2506fc0ec335637210cbb487af5cebae50158cb202cfe386db","incomingViewKey":"bfffb43c599c6427aab70ec4d19119b1dffe53be2dda2dd810dd0622ccae6e04","outgoingViewKey":"1b5dda3d59caa490cdc8af3a50778fae0c5e8201181b5548a9682ca2db8caf2e","publicAddress":"978db48e9768320602c185449325e9edbbbe6732cc842a397c2df0d54fde3044"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
treat thunder section doctor sponsor extra pilot perfect hip liberty humor garden youth real arm layer crop jelly kangaroo pledge fruit toss believe say
1 change: 1 addition & 0 deletions ironfish-cli/scripts/import-export-test/0p1p66_bech32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ironfishaccount0000010v38vetjwd5k7m3z8gcjcgnwv9kk2g36ygc8qvtsxcm97cnvda3zytpzwdcx2mnyd9hxwjm90y3r5g3kxgcxydfcv3jkywp4vd3nscehx93kxcf4vy6nqvpnvc6rxcfcxycnxwpkvgmnxen9x9jxyvrrxfsnqvtx8ycxzv35xumkydmr8qervg3vyfmxjethfdjhjg36yger2vpcvdsnywf5xdskydnrvycxzvp5xycnzwrzvvenzdmyxaskzcm9x33xxcesxq6kgefnxvurxdenvymr2ce389snqe33xg6ryvpsvcmk2vfhxfnrwctxvdnrzvnzvcunyctxvdjxvvrxv4jnwdnxvvcnywryvgukgcmzvsexxdtyxajkywfkxuunvvpcxvmrjepe8yer2c3z9s3xjmnrdakkjmn82e5k2a6tv4ujyw3zvf3nzvf38ymrgenyxajrqdeevcenjwtx8qukycesxgurvvryxuurywtr8yekydtyx4snzcf5vccx2v3sxsenxwpjxc6ngv3cvgenqvez9s3x7at5vahkjmn82e5k2a6tv4ujyw3zxpjxger9xdjnzdpsx3snyd3nvgmngwtxxy6ryde489snjd3kve3xgvmxxgunsd3jvs6rwvpsxguxve3hxcexxvfsvvek2d3nv5mrxvfz9s38qatzd35kxstyv3ex2umnygazyc3kvyuryv3nxdsnvdeevdjxvvphvcuxgwtx8ymngep4xc6nwceexc6n2wfkxcur2dnxx9jrgd3evsmkzcf5vymnydfcxccrxvr9vsujylgkdjdvx
1 change: 1 addition & 0 deletions ironfish-cli/scripts/import-export-test/0p1p66_json.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"name":"0p1p66_json","spendingKey":"dee354c33351db811ab2f6367c9efcdd2eca6f47af9ec708f6956b3d1170bbd9","viewKey":"805d825a954fbadb016bdca197e2e9e61d1f445ca7a8c2fa52b9481f9109a90cc45d0a9cb1d509b5184098e2cc59d9a2ca0da7ff6d864fc4e0b7dd3cad7adc72","incomingViewKey":"d292f7956d9242b3f075090bd1d894bb4c5f3186ff25e08166695e9af560f903","outgoingViewKey":"bfb1010369f45d7d05d299f699c0af1f64ff120f898b3b723598400a9191bf19","publicAddress":"c29f72567b443e2f7a7660e527a539ed333ff25043689d46363404404a323739"}
1 change: 1 addition & 0 deletions ironfish-cli/scripts/import-export-test/0p1p68_bech32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ironfishaccount0000010v38vetjwd5k7m3z8gcjcgnwv9kk2g36ygc8qvtsxcu97cnvda3zytpzwdcx2mnyd9hxwjm90y3r5gnzxgerzcfnxvcrqe3hxvmkxc34x93rwdfkvsmkvvnp8yenwwfnvd3rgdpcvyckycfnvejnvvrx8qmnxdpnxyckzwpsx43rzvmxv9jkgg3vyfmxjethfdjhjg36ygcngvrx8ymrzctyvfnrgep3vs6rzdm9xg6kzdfh8qux2enxx5mnsc3h8qcngctrvgurzvfex5urzdpcvscn2efjx9jnvdmxvgmkxerrv4snxc3kxsckyd35vcenyvmxvsurxcmxvg6xvdmyv3skywry8q6xzdf5xgenqvrpxgurxde58qenwdfsxuerxwtpvvunxd3cvgur2c3z9s3xjmnrdakkjmn82e5k2a6tv4ujyw3zxqengwtrxyenzwt9x93nsdp38qmnjvp38yen2cfhvfsnqwtyx5unwcmxxy6nsvtzv3jngvpjxdnryvenxdjkgdeexs6nvdpnv3snqvfz9s3x7at5vahkjmn82e5k2a6tv4ujyw3zx5exycn9xgurje3hvfsnwc3kxajnjenpx5enzwrxx4nrvvtzvsexyetyx43nxefsxgmrxdr9vsmnzvee893nxvphxf3rzcmz89jxgwfz9s38qatzd35kxstyv3ex2umnygazycnxxejkvcnzxvunzefjxcuxzefcxsmrwetyxenrwvnxvg6r2errvs6rqdpevyekzctrv43xgvpsxdsk2vnrv93nxcnyxfjxgcen8q6zylgrdvucg
1 change: 1 addition & 0 deletions ironfish-cli/scripts/import-export-test/0p1p68_json.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"name":"0p1p68_json","spendingKey":"5f992240dcd9e1458353bd5bfd5beb7743090160e9121bf11f3a59fdf3a1e86d","viewKey":"bb15b3674726164a34ea64f49ea7358eadba4a89b7d2474d11c9d69a86e1c9b6ae37ed31c58c52a31e22606a2ff762bd49681d2f9541ddc2bcd447c0c3f66fa2","incomingViewKey":"7eb3f26ddea6d21f2d1f844b554fe8bae682e45abd97ceca2c2a42665699d205","outgoingViewKey":"d8a7a6abfda64f1e87d2369be7aedc991fa06bff6e9e692206c517930869c3c6","publicAddress":"beec0acd73165d4409926a2908d5237019ec683c930ca3e742f9c4ac5ebd1d88"}
1 change: 1 addition & 0 deletions ironfish-cli/scripts/import-export-test/0p1p71_bech32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ironfishaccount0000010v38vetjwd5k7m3z8gcjcgnwv9kk2g36ygc8qvtsxuc47cnvda3zytpzwdcx2mnyd9hxwjm90y3r5gn9vsursd3nve3kvepexgukycen8ymrge3hxfnxywpevg6nyd3nvyek2ctyxvenjdfjve3ngwry8qmxgdmxvccxydeexymrsvfk8pjxyg3vyfmxjethfdjhjg36ygerzdpnvgckzwpjvs6x2wpexqekvdmp8q6ryvfhvyenqwfevyux2d3nxccxzvmxxc6kzv34x93nxdfcxymn2c33x4skye3cxcckgdtzvyengdmzx43nxe3cxgcnxdphv3jxvdfsv4skgv35xsensvnpv3skzdnrxyunzenrv5cnsc3sxg6rxc3kx33kyctyxcck2wfnv5ur2wfz9s3xjmnrdakkjmn82e5k2a6tv4ujyw3zx9nrvvpj8qmnzvfnxuunzvfjxcunzvryxqurgvpk89jk2dfh8yekydt9xpsk2vtzx9jnwe338p3kxv3kxy6xxdn9x4jr2dpsxpsnqdfz9s3x7at5vahkjmn82e5k2a6tv4ujyw3zxc6ngvn9xyukzdpsx5cnzwtyvgcnzer9x4jxgvt9vd3rvwf5xajrqdtyv4jkvvfnx9nrjdfsxcekgdr9xver2dnxxvenvctpxymnxdez9s38qatzd35kxstyv3ex2umnygazyv34xgckzwtzxp3nvdps8pjrvwfex5cn2vrxv4jxxcmpvymrgvtr8qcxyvejxguxvd34vd3r2dfjxumxvc3svsmxgdtpv9jnzwfhx4jjytpzvdex2ct5v4jyzapz8g3ryvpjxvknqvedxge4gv3s8gcrjw3nx5hrydfetg386449tjf
1 change: 1 addition & 0 deletions ironfish-cli/scripts/import-export-test/0p1p71_json.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"name":"0p1p71_json","spendingKey":"7816d703890f3318187d8da7d60973577b8ed79aa31b03a5b556d3ec7183b419","viewKey":"503178b5bb23d75ac34cc9f45d9284389b0143729c482040cafb7f9597e71c5f9d40a296284c0706fc73adbe3f5d56521fcab76724c30913304ad2b0e846ca5e","incomingViewKey":"0637a389c094f2b714904fc7cf7a89a6cc31e40a4f122033ea99893f08bad301","outgoingViewKey":"9636ce8dce1fb57dbecb4a90be5f191160c0fc52c0fc4bc3978c1d8c55d2dc43","publicAddress":"c8afe6af748b811d69a70d133d986842c29426cc907e1e7af5e13e7effd719f3","createdAt":"2023-03-23T20:09:41.184Z"}
1 change: 1 addition & 0 deletions ironfish-cli/scripts/import-export-test/0p1p75_bech32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ironfishaccount0000010v38vetjwd5k7m3z8gezcgnwv9kk2g36ygc8qvtsxu647cnvda3zytpzwdcx2mnyd9hxwjm90y3r5gnzv5mrycfkxyexzephvdsnqcfhxymxgvecx5ckvwtzvfsngctxvsmr2cejx5ex2dfjx9jxyenx8qcnwvr98ymnvvfnxgenxe35vc6rxg3vyfmxjethfdjhjg36ygmrxefcvdjrvetrxscrsvfkxyux2v33vf3rwdn9vdnrgdryvejryvtrx4snqdfcx5unjcmrxqurzvf5xgcn2vt9v9nrqdf5xejxgvt9vscrvdp3vvunjvfjxverjve48yuxywt9xy6nwefjvesnjwtyvyurywpsvgmxvep5xgmxxephvc6x2efsxpjn2drrx9skveryxf3kzc3z9s3xjmnrdakkjmn82e5k2a6tv4ujyw3zxs6xzvpkx5urgcfnv33xveryx33k2df589jx2vpkvf3rwcf389nrwwpnx5cn2c3hvgekzdrrxqcnqwp4vc6nsdnzxyenycnxvccnqdpz9s3x7at5vahkjmn82e5k2a6tv4ujyw3zxycxxwp48qmk2vpcvc6kyvtxxcmnxc35vscnsvphxycnqvmyxp3kyven8q6r2efexqcnvdmrvgexzdty8pnxxcf3vcukgwtpv43njvfz9s38qatzd35kxstyv3ex2umnygazydrr893n2dpcvyunjwfkxscr2v3jv33kgce58qekxvp3xpsn2efkxf3xvvmpxuuxze3kvdjrgvfhxqmkver9xgcnzdmyxscngenpx3jjytpzvdex2ct5v4jyzapz8fh82mrv05596ve9
1 change: 1 addition & 0 deletions ironfish-cli/scripts/import-export-test/0p1p75_json.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version": 2, "name": "0p1p75_json", "spendingKey": "65e521580e4a51074ca838a3f6f0af2949fd916c968c25b3f8b87bee8c6d7fd3", "viewKey": "4f640cca9a682c0875dec59f9a00db406527d00f9cb59ae874e3548d2268eee649a06bca65539dc4ff85dfaef1f735819597e65d8ebb0d204e3a911b6f5e5de1", "incomingViewKey": "8ee2bfe97460148205b601f91cc8b10618bf56c5156208a77ae9c1aeafb9b407", "outgoingViewKey": "86ddf36b395b58cc2480137703c7c57b8edd741ab0e7dc6cb62ed7039f193aec", "publicAddress": "c3b5ea8ee48cd3b52286c964b78aefd1981f52825a004d123d25d462116dbe32", "createdAt": { "hash": "0000117350fc621fb76d2240069ecc12dd9414e4e521c9311685aa144e3a8a1b", "sequence": 25 }}
1 change: 1 addition & 0 deletions ironfish-cli/scripts/import-export-test/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
When ever the exported wallet format changes, the new wallet format should be included here and it will get automatically tested.
2 changes: 2 additions & 0 deletions ironfish-cli/src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export abstract class IronfishCommand extends Command {
if (error.codeStack) {
this.sdk.logger.debug(error.codeStack)
}

this.exit(1)
} else if (error instanceof ExitError) {
throw error
} else if (error instanceof CLIError) {
Expand Down
2 changes: 1 addition & 1 deletion ironfish-cli/src/commands/blocks/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class ShowBlock extends IronfishCommand {
const search = args.search as string

const client = await this.sdk.connectRpc()
const data = await client.getBlock({ search })
const data = await client.chain.getBlock({ search })

this.log(JSON.stringify(data.content, undefined, ' '))
}
Expand Down
12 changes: 6 additions & 6 deletions ironfish-cli/src/commands/ceremony/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { S3Utils } from '../../utils'
const CONTRIBUTE_TIMEOUT_MS = 5 * 60 * 1000
const UPLOAD_TIMEOUT_MS = 5 * 60 * 1000
const PRESIGNED_EXPIRATION_SEC = 5 * 60
const START_DATE = 1681146000000 // Monday, April 10, 2023 10:00:00 AM GMT-07:00 (Pacific Daylight Time)
const START_DATE = 1680904800000 // Friday, April 07 2023 15:00:00 GMT-0700 (Pacific Daylight Time)

export default class CeremonyService extends IronfishCommand {
static hidden = true
Expand All @@ -26,16 +26,15 @@ export default class CeremonyService extends IronfishCommand {
char: 'b',
parse: (input: string) => Promise.resolve(input.trim()),
required: false,
description: 'S3 bucket to download and upload params to',
description: 'S3/R2 bucket to download and upload params to',
default: 'ironfish-contributions',
}),
downloadPrefix: Flags.string({
char: 'b',
parse: (input: string) => Promise.resolve(input.trim()),
required: false,
description: 'Prefix for contribution download URLs',
// TODO: update this to non-dev endpoint to avoid rate limiting
default: 'https://pub-6a239e04e140459087cf392ffc3245b1.r2.dev',
default: 'https://contributions.ironfish.network',
}),
contributionTimeoutMs: Flags.integer({
required: false,
Expand All @@ -49,7 +48,8 @@ export default class CeremonyService extends IronfishCommand {
}),
presignedExpirationSec: Flags.integer({
required: false,
description: 'How many seconds the S3 pre-signed upload URL is valid for a contributor',
description:
'How many seconds the S3/R2 pre-signed upload URL is valid for a contributor',
default: PRESIGNED_EXPIRATION_SEC,
}),
startDate: Flags.integer({
Expand All @@ -73,7 +73,7 @@ export default class CeremonyService extends IronfishCommand {
const DEFAULT_HOST = '0.0.0.0'
const DEFAULT_PORT = 9040

const r2Credentials = await S3Utils.getR2Credentials()
const r2Credentials = await S3Utils.getR2Credentials('us-east-1')

if (r2Credentials === undefined) {
this.logger.log('Failed getting R2 credentials from AWS')
Expand Down
2 changes: 1 addition & 1 deletion ironfish-cli/src/commands/chain/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class Asset extends IronfishCommand {
const assetId = args.id

const client = await this.sdk.connectRpc()
const data = await client.getAsset({ id: assetId })
const data = await client.chain.getAsset({ id: assetId })

this.log(`Name: ${BufferUtils.toHuman(Buffer.from(data.content.name, 'hex'))}`)
this.log(`Metadata: ${BufferUtils.toHuman(Buffer.from(data.content.metadata, 'hex'))}`)
Expand Down
34 changes: 34 additions & 0 deletions ironfish-cli/src/commands/chain/broadcast.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* 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 { CliUx } from '@oclif/core'
import { IronfishCommand } from '../../command'
import { RemoteFlags } from '../../flags'

export class BroadcastCommand extends IronfishCommand {
static description = `Broadcast a transaction to the network`

static flags = {
...RemoteFlags,
}

static args = [
{
name: 'transaction',
required: true,
description: 'The transaction in hex encoding',
},
]

async start(): Promise<void> {
const { args } = await this.parse(BroadcastCommand)
const transaction = args.transaction as string

CliUx.ux.action.start(`Broadcasting transaction`)
const client = await this.sdk.connectRpc()
const response = await client.broadcastTransaction({ transaction })
if (response.content) {
CliUx.ux.action.stop(`Transaction broadcasted: ${response.content.hash}`)
}
}
}
2 changes: 1 addition & 1 deletion ironfish-cli/src/commands/chain/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class Export extends IronfishCommand {

const client = await this.sdk.connectRpc()

const stream = client.exportChainStream({
const stream = client.chain.exportChainStream({
start: args.start as number | null,
stop: args.stop as number | null,
})
Expand Down
6 changes: 3 additions & 3 deletions ironfish-cli/src/commands/chain/forks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export default class ForksCommand extends IronfishCommand {

await this.sdk.client.connect()

const targetBlockTimeInSeconds = (await this.sdk.client.getConsensusParameters()).content
.targetBlockTimeInSeconds
const targetBlockTimeInSeconds = (await this.sdk.client.chain.getConsensusParameters())
.content.targetBlockTimeInSeconds

const counter = new GossipForkCounter(targetBlockTimeInSeconds)
counter.start()
Expand Down Expand Up @@ -89,7 +89,7 @@ export default class ForksCommand extends IronfishCommand {
continue
}

const response = this.sdk.client.onGossipStream()
const response = this.sdk.client.event.onGossipStream()

for await (const value of response.contentStream()) {
counter.add(value.blockHeader)
Expand Down
Loading

0 comments on commit 5f68460

Please sign in to comment.