import { getAddress, isAddress, ZeroAddress } from "ethers"; const normalizedAddress = (value: string, label: string): string => { const candidate = value.trim(); if (!isAddress(candidate) || getAddress(candidate) === ZeroAddress) { throw new Error(`${label} must be a valid non-zero EVM address`); } return getAddress(candidate); }; export const assertExecutionSignerAddress = ( actualAddress: string, expectedTaskAddress?: string, ): string => { const actual = normalizedAddress(actualAddress, "execution signer"); if (expectedTaskAddress === undefined) return actual; const expected = normalizedAddress(expectedTaskAddress, "deployment signer address"); if (actual.toLowerCase() !== expected.toLowerCase()) { throw new Error("execution signer does not match deployment signer address"); } return actual; };