-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Colossus 3.6.0 #4796
Merged
Merged
Colossus 3.6.0 #4796
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d31c0e5
colossus: support multiple transactor accounts and verify correct key…
mnaamani 6a8c989
colossus: bucketIds can be specified when running server
mnaamani f6a182b
colossus: if keypair cannot be unlocked, exit instead of just warning.
mnaamani 2f124aa
integration-tests: fix renamed command arg for storage-node
mnaamani 9d23bf2
colossus: better handling of failure to unlock key files
mnaamani 006ba24
Merge branch 'master' into colossus-3.5.0
mnaamani a89e379
Merge branch 'master' into colossus-3.5.0
mnaamani 7d80430
colossus: update changelog
mnaamani b87ee64
colossus: allow server to run even if no transactor key provided for …
mnaamani e1d2834
colossus: allow startup with any worker id
mnaamani 0a5fb35
Merge branch 'master' into colossus-3.5.0
mnaamani fd67725
colossus: code cleanup and revert allowing invalid workerId on startup
mnaamani 91a6224
Merge branch 'master' into colossus-3.5.0
mnaamani 17eeb79
Merge branch 'master' into colossus-3.5.0
mnaamani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { flags } from '@oclif/command' | ||
import ExitCodes from './ExitCodes' | ||
import { CLIError } from '@oclif/errors' | ||
import { parseBagId } from '../services/helpers/bagTypes' | ||
|
||
export const customFlags = { | ||
// 'integer array' oclif flag. | ||
integerArr: flags.build({ | ||
parse: (value: string) => { | ||
const arr: number[] = value.split(',').map((v) => { | ||
if (!/^-?\d+$/.test(v)) { | ||
throw new CLIError(`Expected comma-separated integers, but received: ${value}`, { | ||
exit: ExitCodes.InvalidIntegerArray, | ||
}) | ||
} | ||
return parseInt(v) | ||
}) | ||
return arr | ||
}, | ||
}), | ||
// BagId | ||
bagId: flags.build({ | ||
parse: (value: string) => { | ||
return parseBagId(value) | ||
}, | ||
description: `Bag ID. Format: {bag_type}:{sub_type}:{id}. | ||
- Bag types: 'static', 'dynamic' | ||
- Sub types: 'static:council', 'static:wg', 'dynamic:member', 'dynamic:channel' | ||
- Id: | ||
- absent for 'static:council' | ||
- working group name for 'static:wg' | ||
- integer for 'dynamic:member' and 'dynamic:channel' | ||
Examples: | ||
- static:council | ||
- static:wg:storage | ||
- dynamic:member:4`, | ||
}), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { KeyringPair } from '@polkadot/keyring/types' | ||
import ExitCodes from './ExitCodes' | ||
import { CLIError } from '@oclif/errors' | ||
import { getLeadRoleAccount } from '../services/runtime/queries' | ||
|
||
import ApiCommandBase from './ApiCommandBase' | ||
|
||
/** | ||
* Parent class for all leader commands. Ensure lead role key is in the keystore. | ||
*/ | ||
export default abstract class LeaderCommandBase extends ApiCommandBase { | ||
private roleAccount: string | undefined | ||
|
||
/** | ||
* Initilizes the runtime API using the URL from the command line or the | ||
* default value (ws://localhost:9944) | ||
*/ | ||
async init(): Promise<void> { | ||
await super.init() | ||
|
||
const api = await this.getApi() | ||
const leadRoleAccount = await getLeadRoleAccount(api) | ||
if (leadRoleAccount) { | ||
this.roleAccount = leadRoleAccount | ||
} else { | ||
this.error('Lead is not set') | ||
} | ||
|
||
if (!this.hasKeyringPair(leadRoleAccount)) { | ||
this.error(`Keyring does not contain leader role key ${leadRoleAccount}`) | ||
} | ||
} | ||
|
||
/** | ||
* Returns the intialized account KeyringPair instance of the lead's role key. | ||
* | ||
* @returns KeyringPair instance. | ||
*/ | ||
getAccount(): KeyringPair { | ||
// should not be called if roleAccount was not initialized | ||
if (!this.roleAccount) { | ||
throw new CLIError('getAccount called before command init', { | ||
exit: ExitCodes.KeyringNotReady, | ||
}) | ||
} | ||
return this.getKeyringPair(this.roleAccount) | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to comfirm, what is the desired behavior here? Should these flags (
keyFile
,accountUri
,keyStore
) be allowed to be simultaneously used or they should be exclusive? Currently, they can be simultaneously used, if desired otherwise, these should be marked as exclusiveThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No they are not exclusive, all can be used at the same time.