-
Notifications
You must be signed in to change notification settings - Fork 429
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
Specify per-agent chains to deploy to in deploy-agents #2669
Specify per-agent chains to deploy to in deploy-agents #2669
Conversation
export const agentChainNames: AgentChainNames = { | ||
[Role.Validator]: validatorChainNames, | ||
[Role.Relayer]: relayerChainNames, | ||
[Role.Scraper]: supportedChainNames, | ||
}; |
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.
The contribution is essentially to use a Record
type here keyed by the agent type, instead of an array
@@ -187,3 +187,7 @@ export abstract class AgentConfigHelper<R = unknown> | |||
return this.docker; | |||
} | |||
} | |||
|
|||
export const allAgentChainNames = (agentChainNames: AgentChainNames) => [ | |||
...new Set(Object.values(agentChainNames).reduce((a, b) => a.concat(b), [])), |
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.
Basically the union of all items in the arrays of the agent chain names entries
Btw looks like |
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.
lgtm, small nits & seems build is failing
chainMetadata.nautilus.name, | ||
const validatorChainNames = [ | ||
...supportedChainNames, | ||
'solanadevnet', |
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.
This should stay as
...supportedChainNames,
chainMetadata.solana.name,
chainMetadata.nautilus.name,
because this is mainnet
@@ -8,3 +10,13 @@ export const testConfigs: ChainMap<ChainMetadata> = { | |||
|
|||
export type TestChains = keyof typeof testConfigs; | |||
export const chainNames = Object.keys(testConfigs) as TestChains[]; | |||
|
|||
const validatorChainNames = [...chainNames, 'solanadevnet', 'proteustestnet']; |
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.
as this is just the test
environment this should stay const validatorChainNames = chainNames;
export const agentChainNames = [ | ||
...chainNames, | ||
const validatorChainNames = [ | ||
...supportedChainNames, | ||
'solanadevnet', |
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.
nit: I should've done this before, but can you change this to chainMetadata.solanadevnet.name
and the same for proteustestnet
typescript/infra/src/roles.ts
Outdated
Role.Relayer, | ||
Role.Scraper, | ||
] as const; | ||
export type ALL_AGENT_ROLES = typeof ALL_AGENT_ROLES[number]; |
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.
A little surprised they let you use the same name for a type and a value, wdyt of renaming the type to AgentRole
or something like that to remove ambiguity?
typescript/infra/src/agents/index.ts
Outdated
@@ -106,7 +106,7 @@ export abstract class AgentHelmManager { | |||
await execCmd(cmd, {}, false, true); | |||
} | |||
|
|||
async helmValues(): Promise<HelmRootAgentValues> { | |||
async helmValues(role: ALL_AGENT_ROLES): Promise<HelmRootAgentValues> { |
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.
is this param necessary? or can this.role just be used in here
typescript/infra/src/agents/index.ts
Outdated
@@ -240,7 +240,7 @@ export class ValidatorHelmManager extends MultichainAgentHelmManager { | |||
constructor(config: RootAgentConfig, chainName: ChainName) { | |||
super(chainName); | |||
this.config = new ValidatorConfigHelper(config, chainName); | |||
if (!this.config.contextChainNames.includes(chainName)) | |||
if (!this.config.contextChainNames[Role.Validator].includes(chainName)) |
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.
ditto wondering if this.role can be used
Description
In addition to the context, also configure the chains that an agent is deployable to.
Drive-by changes
Related issues
deploy-agents
#2664Backward compatibility
Testing
Dry-ran the script for the three agents. Output for the validator looks wrong though: