Skip to content

Commit

Permalink
Adjust SUDO balance before runtime upgrade against a fork
Browse files Browse the repository at this point in the history
NOTES:
- Alice is still the sudo account for the fork, however balances aren't
  updated by creditcoin-fork
- on Creditcoin 3 Testnet Alice has a very low balance b/c it isn't
  the sudo account in prod
  • Loading branch information
atodorov committed Jan 22, 2025
1 parent 522e7dd commit d1f0aff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/runtime-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ jobs:
working-directory: cli
run: |
node dist/scripts/runtimeUpgrade.js ws://127.0.0.1:9944 ../creditcoin3_runtime.compact.compressed.wasm //Alice 0
env:
NEW_SUDO_BALANCE: 3000000000000000000

- name: Execute blockchain integration tests
working-directory: ./cli
Expand Down
6 changes: 6 additions & 0 deletions cli/src/scripts/runtimeUpgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ async function doRuntimeUpgrade(
// test/integration-tests/helpers.ts::initAlithKeyring() for the devel mnemonic
const keyring = initKeyringPair(sudoKeyUri);

if (process.env.NEW_SUDO_BALANCE !== undefined) {
await api.tx.sudo
.sudo(api.tx.balances.forceSetBalance(keyring.address, process.env.NEW_SUDO_BALANCE))
.signAndSend(keyring, { nonce: -1 });
}

const { specVersion } = api.runtimeVersion;

let needsUpgrade = true;
Expand Down

0 comments on commit d1f0aff

Please sign in to comment.