Skip to content

Commit 41157bf

Browse files
authored
Merge pull request #3711 from iron-fish/staging
STAGING -> MASTER
2 parents dd7bcab + d73b867 commit 41157bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1656
-418
lines changed

.github/workflows/deploy-node-aws.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Deploy Node Docker Image
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
github_tag_mainnet:
6+
description: 'GitHub:mainnet'
7+
type: boolean
8+
default: false
9+
github_tag_testnet:
10+
description: 'GitHub:testnet'
11+
type: boolean
12+
default: false
13+
aws_tag_mainnet:
14+
description: 'AWS:mainnet'
15+
type: boolean
16+
default: false
17+
aws_tag_testnet:
18+
description: 'AWS:testnet'
19+
type: boolean
20+
default: false
21+
aws_tag_git_sha:
22+
description: 'AWS:{GIT_SHA}'
23+
type: boolean
24+
default: false
25+
26+
permissions:
27+
contents: read
28+
packages: write
29+
30+
jobs:
31+
Deploy:
32+
name: Deploy
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- name: Check out Git repository
37+
uses: actions/checkout@v3
38+
39+
- name: Login to GitHub Registry
40+
run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_USER} --password-stdin ghcr.io
41+
env:
42+
GITHUB_USER: ${{ secrets.BREW_GITHUB_USERNAME }}
43+
GITHUB_TOKEN: ${{ secrets.BREW_GITHUB_TOKEN }}
44+
45+
- name: Configure AWS Credentials
46+
uses: aws-actions/configure-aws-credentials@v1
47+
with:
48+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
49+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
50+
aws-region: us-east-1
51+
52+
- name: Login to AWS Registry
53+
run: aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $AWS_REGISTRY_URL
54+
env:
55+
AWS_REGISTRY_URL: ${{ secrets.AWS_NODE_REGISTRY_URL }}
56+
57+
- name: Build Node Image
58+
run: ./ironfish-cli/scripts/build-docker.sh
59+
60+
- name: Deploy Node Image to GitHub:mainnet
61+
if: ${{ inputs.github_tag_mainnet }}
62+
run: |
63+
docker tag ironfish ghcr.io/iron-fish/ironfish:mainnet
64+
docker push ghcr.io/iron-fish/ironfish:mainnet
65+
66+
# If we are deploying a new public release to mainnet
67+
# also update the docker registry :latest tag for hygiene
68+
- name: Deploy Node Image to GitHub:latest
69+
if: ${{ inputs.github_tag_mainnet }}
70+
run: |
71+
docker tag ironfish ghcr.io/iron-fish/ironfish:latest
72+
docker push ghcr.io/iron-fish/ironfish:latest
73+
74+
# Used if we are deploying a new version (e.g. v1.1)
75+
# This is only executed when deploying a new release to mainnet
76+
- name: Deploy Node Image to GitHub:${{ github.ref_name }}
77+
if: ${{ inputs.github_tag_mainnet && github.event.ref_type == 'tag'}}
78+
run: |
79+
docker tag ironfish ghcr.io/iron-fish/ironfish:${{ github.ref_name }}
80+
docker push ghcr.io/iron-fish/ironfish:${{ github.ref_name }}
81+
82+
- name: Deploy Node Image to GitHub:testnet
83+
if: ${{ inputs.github_tag_testnet }}
84+
run: |
85+
docker tag ironfish ghcr.io/iron-fish/ironfish:testnet
86+
docker push ghcr.io/iron-fish/ironfish:testnet
87+
88+
- name: Deploy Node Image to AWS:mainnet
89+
if: ${{ inputs.aws_tag_mainnet }}
90+
run: |
91+
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:mainnet
92+
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:mainnet
93+
94+
# If we are deploying a new public release to mainnet
95+
# also update the docker registry :latest tag for hygiene
96+
- name: Deploy Node Image to AWS:latest
97+
if: ${{ inputs.aws_tag_mainnet }}
98+
run: |
99+
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:latest
100+
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:latest
101+
102+
# Used if we are deploying a new version (e.g. v1.1)
103+
# This is only executed when deploying a new release to mainnet
104+
- name: Deploy Node Image to AWS:${{ github.ref_name }}
105+
if: ${{ inputs.aws_tag_mainnet && github.event.ref_type == 'tag'}}
106+
run: |
107+
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.ref_name }}
108+
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.ref_name }}
109+
110+
- name: Deploy Node Image to AWS:testnet
111+
if: ${{ inputs.aws_tag_testnet }}
112+
run: |
113+
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:testnet
114+
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:testnet
115+
116+
- name: Deploy Node Image to AWS:${{ github.sha }}
117+
if: ${{ inputs.aws_tag_git_sha }}
118+
run: |
119+
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.sha }}
120+
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.sha }}

.github/workflows/deploy-node-github-beta.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/deploy-node-github.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

ironfish-cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ironfish",
3-
"version": "0.1.73",
3+
"version": "0.1.74",
44
"description": "CLI for running and interacting with an Iron Fish node",
55
"author": "Iron Fish <[email protected]> (https://ironfish.network)",
66
"main": "build/src/index.js",
@@ -60,7 +60,7 @@
6060
"@aws-sdk/client-secrets-manager": "3.276.0",
6161
"@aws-sdk/s3-request-presigner": "3.127.0",
6262
"@ironfish/rust-nodejs": "0.1.29",
63-
"@ironfish/sdk": "0.0.50",
63+
"@ironfish/sdk": "0.0.51",
6464
"@oclif/core": "1.23.1",
6565
"@oclif/plugin-help": "5.1.12",
6666
"@oclif/plugin-not-found": "2.3.1",

ironfish-cli/scripts/deploy-docker.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4+
import { S3Client } from '@aws-sdk/client-s3'
5+
import { Flags } from '@oclif/core'
6+
import { IronfishCommand } from '../../command'
7+
import { S3Utils } from '../../utils'
8+
9+
export default class CeremonyContributions extends IronfishCommand {
10+
static description = 'List all the current contributions with names'
11+
12+
static flags = {
13+
start: Flags.integer({
14+
required: false,
15+
}),
16+
end: Flags.integer({
17+
required: false,
18+
}),
19+
}
20+
21+
async start(): Promise<void> {
22+
const { flags } = await this.parse(CeremonyContributions)
23+
24+
const r2Credentials = await S3Utils.getR2Credentials()
25+
26+
if (r2Credentials === undefined) {
27+
this.logger.log('Failed getting R2 credentials from AWS')
28+
this.exit(0)
29+
return
30+
}
31+
32+
const r2Client = S3Utils.getR2S3Client(r2Credentials)
33+
34+
const latestParamName = await this.getLatestParamName(r2Client, 'ironfish-contributions')
35+
const latestParamNumber = parseInt(latestParamName.split('_')[1])
36+
const keys: string[] = [...new Array<number>(latestParamNumber + 1)]
37+
.map((_, i) => i)
38+
.filter((i) => (!flags.start || i >= flags.start) && (!flags.end || i <= flags.end))
39+
.map((i) => {
40+
return 'params_' + i.toString().padStart(5, '0')
41+
})
42+
43+
for (const key of keys) {
44+
const { Metadata } = await S3Utils.getObjectMetadata(
45+
r2Client,
46+
'ironfish-contributions',
47+
key,
48+
)
49+
this.log(
50+
`Contribution: ${key.split('_')[1]}, Name: ${Metadata?.contributorName || '-'}, IP: ${
51+
Metadata?.remoteaddress || '-'
52+
}`,
53+
)
54+
}
55+
}
56+
57+
async getLatestParamName(client: S3Client, bucket: string): Promise<string> {
58+
const paramFileNames = await S3Utils.getBucketObjects(client, bucket)
59+
const validParams = paramFileNames
60+
.slice(0)
61+
.filter((fileName) => /^params_\d{5}$/.test(fileName))
62+
validParams.sort()
63+
return validParams[validParams.length - 1]
64+
}
65+
}

ironfish-cli/src/commands/ceremony.ts renamed to ironfish-cli/src/commands/ceremony/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import axios from 'axios'
88
import fsAsync from 'fs/promises'
99
import path from 'path'
1010
import { pipeline } from 'stream/promises'
11-
import { IronfishCommand } from '../command'
12-
import { DataDirFlag, DataDirFlagKey, VerboseFlag, VerboseFlagKey } from '../flags'
13-
import { CeremonyClient } from '../trusted-setup/client'
11+
import { IronfishCommand } from '../../command'
12+
import { DataDirFlag, DataDirFlagKey, VerboseFlag, VerboseFlagKey } from '../../flags'
13+
import { CeremonyClient } from '../../trusted-setup/client'
1414

1515
export default class Ceremony extends IronfishCommand {
1616
static description = 'Contribute randomness to the Iron Fish trusted setup'

ironfish-cli/src/commands/service/ceremony.ts renamed to ironfish-cli/src/commands/ceremony/service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const UPLOAD_TIMEOUT_MS = 5 * 60 * 1000
1313
const PRESIGNED_EXPIRATION_SEC = 5 * 60
1414
const START_DATE = 1681146000000 // Monday, April 10, 2023 10:00:00 AM GMT-07:00 (Pacific Daylight Time)
1515

16-
export default class Ceremony extends IronfishCommand {
16+
export default class CeremonyService extends IronfishCommand {
1717
static hidden = true
1818

1919
static description = `
@@ -68,7 +68,7 @@ export default class Ceremony extends IronfishCommand {
6868
}
6969

7070
async start(): Promise<void> {
71-
const { flags } = await this.parse(Ceremony)
71+
const { flags } = await this.parse(CeremonyService)
7272

7373
const DEFAULT_HOST = '0.0.0.0'
7474
const DEFAULT_PORT = 9040

0 commit comments

Comments
 (0)