Skip to content
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

Merged
merged 5 commits into from
Aug 17, 2023

Conversation

daniel-savu
Copy link
Contributor

Description

In addition to the context, also configure the chains that an agent is deployable to.

Drive-by changes

Related issues

Backward compatibility

Testing

Dry-ran the script for the three agents. Output for the validator looks wrong though:

% npx ts-node typescript/infra/scripts/agents/deploy-agents.ts -e mainnet2 -r validator --dry-run
undefined

Comment on lines +57 to +61
export const agentChainNames: AgentChainNames = {
[Role.Validator]: validatorChainNames,
[Role.Relayer]: relayerChainNames,
[Role.Scraper]: supportedChainNames,
};
Copy link
Contributor Author

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), [])),
Copy link
Contributor Author

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

@tkporter
Copy link
Collaborator

Btw looks like yarn build fails in typescript/infra/scripts/funding-fund-keys-from-deployer.ts

Copy link
Collaborator

@tkporter tkporter left a 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',
Copy link
Collaborator

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'];
Copy link
Collaborator

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',
Copy link
Collaborator

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

Role.Relayer,
Role.Scraper,
] as const;
export type ALL_AGENT_ROLES = typeof ALL_AGENT_ROLES[number];
Copy link
Collaborator

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?

@@ -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> {
Copy link
Collaborator

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

@@ -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))
Copy link
Collaborator

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

@daniel-savu daniel-savu merged commit 4a59af3 into trevor/deploy-proteus Aug 17, 2023
@daniel-savu daniel-savu deleted the dan/deploy-agents-chains-config branch August 17, 2023 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants