Skip to content

Commit

Permalink
Merge pull request #3711 from iron-fish/staging
Browse files Browse the repository at this point in the history
STAGING -> MASTER
  • Loading branch information
rohanjadvani committed Mar 29, 2023
2 parents dd7bcab + d73b867 commit 41157bf
Show file tree
Hide file tree
Showing 43 changed files with 1,656 additions and 418 deletions.
32 changes: 0 additions & 32 deletions .github/workflows/deploy-node-aws.yml

This file was deleted.

120 changes: 120 additions & 0 deletions .github/workflows/deploy-node-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: Deploy Node Docker Image
on:
workflow_dispatch:
inputs:
github_tag_mainnet:
description: 'GitHub:mainnet'
type: boolean
default: false
github_tag_testnet:
description: 'GitHub:testnet'
type: boolean
default: false
aws_tag_mainnet:
description: 'AWS:mainnet'
type: boolean
default: false
aws_tag_testnet:
description: 'AWS:testnet'
type: boolean
default: false
aws_tag_git_sha:
description: 'AWS:{GIT_SHA}'
type: boolean
default: false

permissions:
contents: read
packages: write

jobs:
Deploy:
name: Deploy
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Login to GitHub Registry
run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_USER} --password-stdin ghcr.io
env:
GITHUB_USER: ${{ secrets.BREW_GITHUB_USERNAME }}
GITHUB_TOKEN: ${{ secrets.BREW_GITHUB_TOKEN }}

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Login to AWS Registry
run: aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $AWS_REGISTRY_URL
env:
AWS_REGISTRY_URL: ${{ secrets.AWS_NODE_REGISTRY_URL }}

- name: Build Node Image
run: ./ironfish-cli/scripts/build-docker.sh

- name: Deploy Node Image to GitHub:mainnet
if: ${{ inputs.github_tag_mainnet }}
run: |
docker tag ironfish ghcr.io/iron-fish/ironfish:mainnet
docker push ghcr.io/iron-fish/ironfish:mainnet
# If we are deploying a new public release to mainnet
# also update the docker registry :latest tag for hygiene
- name: Deploy Node Image to GitHub:latest
if: ${{ inputs.github_tag_mainnet }}
run: |
docker tag ironfish ghcr.io/iron-fish/ironfish:latest
docker push ghcr.io/iron-fish/ironfish:latest
# Used if we are deploying a new version (e.g. v1.1)
# This is only executed when deploying a new release to mainnet
- name: Deploy Node Image to GitHub:${{ github.ref_name }}
if: ${{ inputs.github_tag_mainnet && github.event.ref_type == 'tag'}}
run: |
docker tag ironfish ghcr.io/iron-fish/ironfish:${{ github.ref_name }}
docker push ghcr.io/iron-fish/ironfish:${{ github.ref_name }}
- name: Deploy Node Image to GitHub:testnet
if: ${{ inputs.github_tag_testnet }}
run: |
docker tag ironfish ghcr.io/iron-fish/ironfish:testnet
docker push ghcr.io/iron-fish/ironfish:testnet
- name: Deploy Node Image to AWS:mainnet
if: ${{ inputs.aws_tag_mainnet }}
run: |
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:mainnet
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:mainnet
# If we are deploying a new public release to mainnet
# also update the docker registry :latest tag for hygiene
- name: Deploy Node Image to AWS:latest
if: ${{ inputs.aws_tag_mainnet }}
run: |
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:latest
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:latest
# Used if we are deploying a new version (e.g. v1.1)
# This is only executed when deploying a new release to mainnet
- name: Deploy Node Image to AWS:${{ github.ref_name }}
if: ${{ inputs.aws_tag_mainnet && github.event.ref_type == 'tag'}}
run: |
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.ref_name }}
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.ref_name }}
- name: Deploy Node Image to AWS:testnet
if: ${{ inputs.aws_tag_testnet }}
run: |
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:testnet
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:testnet
- name: Deploy Node Image to AWS:${{ github.sha }}
if: ${{ inputs.aws_tag_git_sha }}
run: |
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.sha }}
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.sha }}
30 changes: 0 additions & 30 deletions .github/workflows/deploy-node-github-beta.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/deploy-node-github.yml

This file was deleted.

4 changes: 2 additions & 2 deletions ironfish-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ironfish",
"version": "0.1.73",
"version": "0.1.74",
"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 @@ -60,7 +60,7 @@
"@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.50",
"@ironfish/sdk": "0.0.51",
"@oclif/core": "1.23.1",
"@oclif/plugin-help": "5.1.12",
"@oclif/plugin-not-found": "2.3.1",
Expand Down
18 changes: 0 additions & 18 deletions ironfish-cli/scripts/deploy-docker.sh

This file was deleted.

65 changes: 65 additions & 0 deletions ironfish-cli/src/commands/ceremony/contributions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/* 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 { S3Client } from '@aws-sdk/client-s3'
import { Flags } from '@oclif/core'
import { IronfishCommand } from '../../command'
import { S3Utils } from '../../utils'

export default class CeremonyContributions extends IronfishCommand {
static description = 'List all the current contributions with names'

static flags = {
start: Flags.integer({
required: false,
}),
end: Flags.integer({
required: false,
}),
}

async start(): Promise<void> {
const { flags } = await this.parse(CeremonyContributions)

const r2Credentials = await S3Utils.getR2Credentials()

if (r2Credentials === undefined) {
this.logger.log('Failed getting R2 credentials from AWS')
this.exit(0)
return
}

const r2Client = S3Utils.getR2S3Client(r2Credentials)

const latestParamName = await this.getLatestParamName(r2Client, 'ironfish-contributions')
const latestParamNumber = parseInt(latestParamName.split('_')[1])
const keys: string[] = [...new Array<number>(latestParamNumber + 1)]
.map((_, i) => i)
.filter((i) => (!flags.start || i >= flags.start) && (!flags.end || i <= flags.end))
.map((i) => {
return 'params_' + i.toString().padStart(5, '0')
})

for (const key of keys) {
const { Metadata } = await S3Utils.getObjectMetadata(
r2Client,
'ironfish-contributions',
key,
)
this.log(
`Contribution: ${key.split('_')[1]}, Name: ${Metadata?.contributorName || '-'}, IP: ${
Metadata?.remoteaddress || '-'
}`,
)
}
}

async getLatestParamName(client: S3Client, bucket: string): Promise<string> {
const paramFileNames = await S3Utils.getBucketObjects(client, bucket)
const validParams = paramFileNames
.slice(0)
.filter((fileName) => /^params_\d{5}$/.test(fileName))
validParams.sort()
return validParams[validParams.length - 1]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import axios from 'axios'
import fsAsync from 'fs/promises'
import path from 'path'
import { pipeline } from 'stream/promises'
import { IronfishCommand } from '../command'
import { DataDirFlag, DataDirFlagKey, VerboseFlag, VerboseFlagKey } from '../flags'
import { CeremonyClient } from '../trusted-setup/client'
import { IronfishCommand } from '../../command'
import { DataDirFlag, DataDirFlagKey, VerboseFlag, VerboseFlagKey } from '../../flags'
import { CeremonyClient } from '../../trusted-setup/client'

export default class Ceremony extends IronfishCommand {
static description = 'Contribute randomness to the Iron Fish trusted setup'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ 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)

export default class Ceremony extends IronfishCommand {
export default class CeremonyService extends IronfishCommand {
static hidden = true

static description = `
Expand Down Expand Up @@ -68,7 +68,7 @@ export default class Ceremony extends IronfishCommand {
}

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

const DEFAULT_HOST = '0.0.0.0'
const DEFAULT_PORT = 9040
Expand Down
Loading

0 comments on commit 41157bf

Please sign in to comment.