-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Multi EVM Chain Signers (#4922)
### Description This PR modifies the warp init command to read the multiProtocolSigner from the signer middleware instead of creating a new instance. ### Drive-by changes <!-- Are there any minor or drive-by changes also included? --> ### Related issues - #4910 - Fixes issue with duplicate signer initialization in warp route configuration - Improves consistency with other commands that use signer middleware ### Backward compatibility Yes - This change is backward compatible as it maintains the same functionality while making the multiProtocolSigner parameter optional. ### Testing Manual testing --------- Co-authored-by: Morteza Shojaei <31728528+mortezashojaei@users.noreply.github.com> Co-authored-by: ljankovic-txfusion <lazar@txfusion.io>
- Loading branch information
1 parent
a29a899
commit 79f8197
Showing
34 changed files
with
1,112 additions
and
75 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@hyperlane-xyz/utils': minor | ||
--- | ||
|
||
Added `isPrivateKeyEvm` function for validating EVM private keys |
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,5 @@ | ||
--- | ||
'@hyperlane-xyz/cli': minor | ||
--- | ||
|
||
Added strategy management CLI commands and MultiProtocolSigner implementation for flexible cross-chain signer configuration and management |
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
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 |
---|---|---|
@@ -1,11 +1,36 @@ | ||
// Commands that send tx and require a key to sign. | ||
// It's useful to have this listed here so the context | ||
// middleware can request keys up front when required. | ||
export const SIGN_COMMANDS = ['deploy', 'send', 'status', 'submit', 'relayer']; | ||
export const SIGN_COMMANDS = [ | ||
'apply', | ||
'deploy', | ||
'send', | ||
'status', | ||
'submit', | ||
'relayer', | ||
]; | ||
|
||
export function isSignCommand(argv: any): boolean { | ||
//TODO: fix reading and checking warp without signer, and remove this | ||
const temporarySignCommandsCheck = | ||
argv._[0] === 'warp' && (argv._[1] === 'read' || argv._[1] === 'check'); | ||
return ( | ||
SIGN_COMMANDS.includes(argv._[0]) || | ||
(argv._.length > 1 && SIGN_COMMANDS.includes(argv._[1])) | ||
(argv._.length > 1 && SIGN_COMMANDS.includes(argv._[1])) || | ||
temporarySignCommandsCheck | ||
); | ||
} | ||
|
||
export enum CommandType { | ||
WARP_DEPLOY = 'warp:deploy', | ||
WARP_SEND = 'warp:send', | ||
WARP_APPLY = 'warp:apply', | ||
WARP_READ = 'warp:read', | ||
WARP_CHECK = 'warp:check', | ||
SEND_MESSAGE = 'send:message', | ||
AGENT_KURTOSIS = 'deploy:kurtosis-agents', | ||
STATUS = 'status:', | ||
SUBMIT = 'submit:', | ||
RELAYER = 'relayer:', | ||
CORE_APPLY = 'core:apply', | ||
} |
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,70 @@ | ||
import { stringify as yamlStringify } from 'yaml'; | ||
import { CommandModule } from 'yargs'; | ||
|
||
import { | ||
createStrategyConfig, | ||
readChainSubmissionStrategyConfig, | ||
} from '../config/strategy.js'; | ||
import { CommandModuleWithWriteContext } from '../context/types.js'; | ||
import { log, logCommandHeader } from '../logger.js'; | ||
import { indentYamlOrJson } from '../utils/files.js'; | ||
import { maskSensitiveData } from '../utils/output.js'; | ||
|
||
import { | ||
DEFAULT_STRATEGY_CONFIG_PATH, | ||
outputFileCommandOption, | ||
strategyCommandOption, | ||
} from './options.js'; | ||
|
||
/** | ||
* Parent command | ||
*/ | ||
export const strategyCommand: CommandModule = { | ||
command: 'strategy', | ||
describe: 'Manage Hyperlane deployment strategies', | ||
builder: (yargs) => | ||
yargs.command(init).command(read).version(false).demandCommand(), | ||
handler: () => log('Command required'), | ||
}; | ||
|
||
export const init: CommandModuleWithWriteContext<{ | ||
out: string; | ||
}> = { | ||
command: 'init', | ||
describe: 'Creates strategy configuration', | ||
builder: { | ||
out: outputFileCommandOption(DEFAULT_STRATEGY_CONFIG_PATH), | ||
}, | ||
handler: async ({ context, out }) => { | ||
logCommandHeader(`Hyperlane Strategy Init`); | ||
|
||
await createStrategyConfig({ | ||
context, | ||
outPath: out, | ||
}); | ||
process.exit(0); | ||
}, | ||
}; | ||
|
||
export const read: CommandModuleWithWriteContext<{ | ||
strategy: string; | ||
}> = { | ||
command: 'read', | ||
describe: 'Reads strategy configuration', | ||
builder: { | ||
strategy: { | ||
...strategyCommandOption, | ||
demandOption: true, | ||
default: DEFAULT_STRATEGY_CONFIG_PATH, | ||
}, | ||
}, | ||
handler: async ({ strategy: strategyUrl }) => { | ||
logCommandHeader(`Hyperlane Strategy Read`); | ||
|
||
const strategy = await readChainSubmissionStrategyConfig(strategyUrl); | ||
const maskedConfig = maskSensitiveData(strategy); | ||
log(indentYamlOrJson(yamlStringify(maskedConfig, null, 2), 4)); | ||
|
||
process.exit(0); | ||
}, | ||
}; |
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
Oops, something went wrong.