Skip to content

Commit

Permalink
Change governors/tokens.json to support multi signers (mobilecoinfoun…
Browse files Browse the repository at this point in the history
…dation#2736)

* add helper object for making configuration a bit more human friendly

* tokens.json uses the new nested format

* deployment and local network fixes

* Apply suggestions from code review

Co-authored-by: Nick Santana <[email protected]>

* misc pr fixes

* cd?

* add SignerIdentity/SignerIdentityMap

* first step in converting governors to the new format

* mc-consensus-service-config tests passing

* cleanups

* update cd stuff

* port some signer set tests

* remove old signer_set config stuff

* lint

* trigger cd

* fix off by 1

* cd

Co-authored-by: Nick Santana <[email protected]>
  • Loading branch information
eranrund and nick-mobilecoin authored Nov 16, 2022
1 parent 723fc35 commit 3e26390
Show file tree
Hide file tree
Showing 19 changed files with 741 additions and 265 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/mobilecoin-dev-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ jobs:
- generate-metadata
with:
block_version: 2
tokens_json_version: 2
chart_repo: ${{ needs.generate-metadata.outputs.chart_repo }}
docker_image_org: ${{ needs.generate-metadata.outputs.docker_org }}
ingest_color: blue
Expand Down Expand Up @@ -501,6 +502,7 @@ jobs:
- generate-metadata
with:
block_version: 3
tokens_json_version: 2
chart_repo: ${{ needs.generate-metadata.outputs.chart_repo }}
namespace: ${{ needs.generate-metadata.outputs.namespace }}
version: ${{ needs.generate-metadata.outputs.tag }}
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/mobilecoin-dispatch-dev-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ on:
description: "Consensus block_version"
type: string
required: true
tokens_json_version:
description: "The version of the tokens.json file we will generate"
type: string
default: '1'
required: false
chart_repo:
description: "Chart Repo URL"
type: string
Expand Down Expand Up @@ -61,6 +66,7 @@ jobs:
uses: ./.github/workflows/mobilecoin-workflow-dev-deploy.yaml
with:
block_version: ${{ inputs.block_version }}
tokens_json_version: ${{ inputs.tokens_json_version }}
chart_repo: ${{ inputs.chart_repo }}
docker_image_org: ${{ inputs.docker_image_org }}
ingest_color: ${{ inputs.ingest_color }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
type: string
required: true
default: '2'
tokens_json_version:
description: "The version of the tokens.json file we will generate"
type: string
default: '1'
required: false
chart_repo:
description: "Chart Repo URL"
type: string
Expand All @@ -36,4 +41,5 @@ jobs:
version: ${{ inputs.version }}
chart_repo: ${{ inputs.chart_repo }}
block_version: "${{ inputs.block_version }}"
tokens_json_version: "${{ inputs.tokens_json_version }}"
secrets: inherit
6 changes: 6 additions & 0 deletions .github/workflows/mobilecoin-workflow-dev-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ on:
description: "block_version"
type: string
required: true
tokens_json_version:
description: "The version of the tokens.json file we will generate"
type: string
default: '1'
required: false
secrets:
RANCHER_CLUSTER:
description: "(from environment) Rancher cluster name"
Expand Down Expand Up @@ -114,6 +119,7 @@ jobs:
uses: ./.github/workflows/mobilecoin-workflow-dev-setup-environment.yaml
with:
block_version: ${{ inputs.block_version }}
tokens_json_version: ${{ inputs.tokens_json_version }}
chart_repo: ${{ inputs.chart_repo }}
namespace: ${{ inputs.namespace }}
version: ${{ inputs.version }}
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/mobilecoin-workflow-dev-setup-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ on:
description: "block_version"
type: string
required: true
tokens_json_version:
description: "The version of the tokens.json file we will generate"
type: string
default: '1'
required: false
chart_repo:
description: "Chart Repo URL"
type: string
Expand Down Expand Up @@ -100,6 +105,9 @@ on:
TOKENS_CONFIG_JSON:
description: "(from environment) signed tokens config json"
required: true
V2_TOKENS_CONFIG_JSON:
description: "(from environment) signed tokens config json"
required: true

jobs:
setup-environment:
Expand Down Expand Up @@ -183,8 +191,20 @@ jobs:

- name: Write tokens.signed.json
run: |
echo "Tokens json version: ${{ inputs.tokens_json_version }}"
mkdir -p "${BASE_PATH}"
echo '${{ secrets.TOKENS_CONFIG_JSON }}' > "${BASE_PATH}/tokens.signed.json"
case "${{ inputs.tokens_json_version }}" in
1)
echo '${{ secrets.TOKENS_CONFIG_JSON }}' > "${BASE_PATH}/tokens.signed.json"
;;
2)
echo '${{ secrets.V2_TOKENS_CONFIG_JSON }}' > "${BASE_PATH}/tokens.signed.json"
;;
*)
echo "Unknown tokens.json version ${{ inputs.tokens_json_version }}"
exit 1
;;
esac
- name: Generate environment values file
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ on:
description: "block_version"
type: string
required: true
tokens_json_version:
description: "The version of the tokens.json file we will generate"
type: string
default: '1'
required: false
chart_repo:
description: "Chart Repo URL"
type: string
Expand Down Expand Up @@ -104,6 +109,7 @@ jobs:
with:
namespace: ${{ inputs.namespace }}
block_version: ${{ inputs.block_version }}
tokens_json_version: ${{ inputs.tokens_json_version }}
chart_repo: ${{ inputs.chart_repo }}
version: ${{ inputs.version }}
secrets: inherit
Expand Down
3 changes: 2 additions & 1 deletion .internal-ci/test/minting-config-tx-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ is_set NAMESPACE

# check block height before config tx
block_count=$(get_block_count)
echo "Current block count: ${block_count}"
echo "Current block count: $block_count"

# These should be populated by volume in toolbox container.
governor_signer_key="/minting-keys/token_${token_id}_governor_1.private.pem"
Expand All @@ -70,6 +70,7 @@ echo "-- Waiting for mint config tx to commit to the block chain"

while [[ $block_count -ge $new_block_count ]]
do
echo "Sleeping"
sleep 15
new_block_count=$(get_block_count)
echo " Current block count: $new_block_count"
Expand Down
74 changes: 0 additions & 74 deletions .internal-ci/util/generate_tokens_config.sh

This file was deleted.

File renamed without changes.
19 changes: 19 additions & 0 deletions .internal-ci/util/tokens.v2.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"governors_signature": "",
"tokens": [
{
"token_id": 0,
"minimum_fee": 400000000
},
{
"token_id": 8192,
"minimum_fee": 1024,
"signer_identities": {},
"governors": {
"type": "MultiSig",
"threshold": 1,
"signers": []
}
}
]
}
40 changes: 21 additions & 19 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions consensus/service/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ hex = "0.4"
pem = "1.1"
serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] }
serde_json = "1.0"
serde_with = "2.0"
toml = "0.5"

Loading

0 comments on commit 3e26390

Please sign in to comment.