Skip to content

Commit

Permalink
chore: bumo verify-vyper dependencices for lint and fix test case wit…
Browse files Browse the repository at this point in the history
…h a new ethers version
  • Loading branch information
kiriyaga committed Mar 21, 2024
1 parent fb42a61 commit 655622d
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 316 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('deployer-helper', () => {
};

expect(() => createProviders(networks as any, unsupportedNetwork as any)).to.throw(
`unsupported default network (operation="getDefaultProvider", code=UNSUPPORTED_OPERATION, version=6.8.0)`,
`unsupported default network (operation="getDefaultProvider", code=UNSUPPORTED_OPERATION, version=6.11.1)`,
);
});

Expand Down
16 changes: 8 additions & 8 deletions packages/hardhat-zksync-verify-vyper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@
"@types/node": "^18.11.17",
"@types/semver": "^7.3.9",
"@types/sinon": "^10.0.13",
"@typescript-eslint/eslint-plugin": "5.61.0",
"@typescript-eslint/parser": "5.61.0",
"eslint": "^8.44.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-no-only-tests": "3.0.0",
"eslint-plugin-prettier": "3.4.0",
"@typescript-eslint/eslint-plugin": "6.13.1",
"@typescript-eslint/parser": "6.13.1",
"eslint": "^8.54.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-no-only-tests": "3.1.0",
"eslint-plugin-prettier": "5.0.1",
"hardhat": "^2.19.4",
"mocha": "^9.2.1",
"prettier": "2.5.1",
"prettier": "3.1.0",
"rimraf": "^3.0.2",
"sinon": "^17.0.1",
"ts-node": "^10.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-zksync-verify-vyper/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const ENCODED_ARAGUMENTS_NOT_FOUND_ERROR = (constructorArgsModulePath: st
`Please export a list of constructor arguments or a single string starting with "0x".`;

export const CONSTRUCTOR_MODULE_IMPORTING_ERROR = (
errorMessage: string
errorMessage: string,
) => `Importing the module for the constructor arguments list failed.
Reason: ${errorMessage}`;

Expand Down
8 changes: 4 additions & 4 deletions packages/hardhat-zksync-verify-vyper/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ task(TASK_VERIFY_VYPER, 'Verifies contract on Ethereum and zkSync networks')
.addOptionalVariadicPositionalParam(
'constructorArgsParams',
'Contract constructor arguments. Cannot be used if the --constructor-args option is provided',
[]
[],
)
.addOptionalParam(
'constructorArgs',
'Path to a Javascript module that exports the constructor arguments',
undefined,
types.inputFile
types.inputFile,
)
.addOptionalParam(
'contract',
'Fully qualified name of the contract to verify. Skips automatic detection of the contract. ' +
'Use if the deployed bytecode matches more than one contract in your project'
'Use if the deployed bytecode matches more than one contract in your project',
)
.setAction(verify);

Expand All @@ -54,7 +54,7 @@ subtask(TASK_VERIFY_GET_ARTIFACT)
.addOptionalParam(
'contract',
'Fully qualified name of the contract to verify. Skips automatic detection of the contract. ' +
'Use if the deployed bytecode matches more than one contract in your project'
'Use if the deployed bytecode matches more than one contract in your project',
)
.addParam('deployedBytecode', 'Bytecode of the deployed contract')
.setAction(getArtifact);
8 changes: 4 additions & 4 deletions packages/hardhat-zksync-verify-vyper/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export async function checkContractName(artifacts: Artifacts, contractFQN: strin
if (!isFullyQualifiedName(contractFQN)) {
throw new ZkSyncVerifyPluginError(
`A valid fully qualified name was expected. Fully qualified names look like this: "contracts/AContract.sol:TheContract"
Instead, this name was received: ${contractFQN}`
Instead, this name was received: ${contractFQN}`,
);
}

Expand Down Expand Up @@ -86,7 +86,7 @@ export async function getDeployArgumentEncoded(constructorArguments: any, artifa
export async function getCacheResolvedFileInformation(
contractFQN: string,
sourceName: string,
hre: HardhatRuntimeEnvironment
hre: HardhatRuntimeEnvironment,
): Promise<CacheResolveFileInfo> {
const vyperFilesCachePath = getVyperFilesCachePath(hre.config.paths);

Expand All @@ -101,7 +101,7 @@ export async function getCacheResolvedFileInformation(
const parser = new Parser(vyperFilesCache);

const resolver = new Resolver(hre.config.paths.root, parser, (absolutePath: string) =>
hre.run(TASK_COMPILE_VYPER_READ_FILE, { absolutePath })
hre.run(TASK_COMPILE_VYPER_READ_FILE, { absolutePath }),
);

const resolvedFile = await resolver.resolveSourceName(sourceName);
Expand All @@ -120,7 +120,7 @@ export async function executeVeificationWithRetry(
requestId: number,
verifyURL: string,
maxRetries = 5,
delayInMs = 1500
delayInMs = 1500,
): Promise<VerificationStatusResponse | undefined> {
let retries = 0;

Expand Down
8 changes: 4 additions & 4 deletions packages/hardhat-zksync-verify-vyper/src/task-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function verify(
contract: string;
constructorArgsParams: any[];
},
hre: HardhatRuntimeEnvironment
hre: HardhatRuntimeEnvironment,
) {
if (args.address === undefined) {
throw new ZkSyncVerifyPluginError(NO_VERIFIABLE_ADDRESS_ERROR);
Expand All @@ -60,7 +60,7 @@ export async function verify(

export async function verifyContract(
{ address, contract: contractFQN, constructorArguments }: TaskArguments,
hre: HardhatRuntimeEnvironment
hre: HardhatRuntimeEnvironment,
): Promise<number> {
await hre.run(TASK_COMPILE_VYPER, { quiet: true });

Expand Down Expand Up @@ -96,7 +96,7 @@ export async function verifyContract(

const resolvedFiles: ResolvedFile[] = await getResolvedFiles(hre);
const contractsSourceCodesMap = Object.fromEntries(
resolvedFiles.map((file) => [file.sourceName, file.content.rawContent])
resolvedFiles.map((file) => [file.sourceName, file.content.rawContent]),
);

const request = {
Expand Down Expand Up @@ -142,7 +142,7 @@ export async function getConstructorArguments(args: any): Promise<any> {

export async function getArtifact(
{ contractFQN, deployedBytecode }: TaskArguments,
{ artifacts }: HardhatRuntimeEnvironment
{ artifacts }: HardhatRuntimeEnvironment,
): Promise<Artifact> {
if (contractFQN !== undefined) {
const _ = checkContractName(artifacts, contractFQN);
Expand Down
4 changes: 2 additions & 2 deletions packages/hardhat-zksync-verify-vyper/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { WRONG_CONSTRUCTOR_ARGUMENTS } from './constants';
export function handleAxiosError(error: any): never {
if (axios.isAxiosError(error)) {
throw new Error(
`Axios error (code: ${error.code}) during the contract verification request\n Reason: ${error.response?.data}`
`Axios error (code: ${error.code}) during the contract verification request\n Reason: ${error.response?.data}`,
);
} else {
throw new ZkSyncVerifyPluginError(`Failed to send contract verification request\n Reason: ${error}`);
Expand Down Expand Up @@ -38,7 +38,7 @@ export async function retrieveContractBytecode(address: string, hre: HardhatRunt
if (bytecodeString.length === 0) {
throw new ZkSyncVerifyPluginError(
`The address ${address} has no bytecode. Is the contract deployed to this network?
The selected network is ${hre.network.name}.`
The selected network is ${hre.network.name}.`,
);
}
return bytecodeString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ZkSyncVyperBlockExplorerVerifyResponse {

export async function verifyContractRequest(
req: ZkSyncVyperBlockExplorerVerifyRequest,
verifyURL: string
verifyURL: string,
): Promise<ZkSyncVyperBlockExplorerVerifyResponse> {
let data;
try {
Expand All @@ -46,7 +46,7 @@ export enum CompilerType {

export async function getSupportedCompilerVersions(
verifyURL: string | undefined,
compilerType: CompilerType
compilerType: CompilerType,
): Promise<string[]> {
try {
const compilerTypePath = compilerType === CompilerType.VYPER ? '/vyper_versions' : '/zkvyper_versions';
Expand All @@ -59,7 +59,7 @@ export async function getSupportedCompilerVersions(

export async function checkVerificationStatusService(
requestId: number,
verifyURL: string
verifyURL: string,
): Promise<VerificationStatusResponse> {
let verificationStatusResponse;

Expand Down
26 changes: 13 additions & 13 deletions packages/hardhat-zksync-verify-vyper/test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('verify plugin', async function () {
const { resolvedFile, contractCache } = await getCacheResolvedFileInformation(
sourceName,
artifact.sourceName,
this.env
this.env,
);

assert.equal(resolvedFile.sourceName, sourceName);
Expand Down Expand Up @@ -91,9 +91,9 @@ describe('verify plugin', async function () {
} catch (e: any) {
assert(
e.message.includes(
'A valid fully qualified name was expected. Fully qualified names look like this: '
'A valid fully qualified name was expected. Fully qualified names look like this: ',
),
'Error message does not include the expected text'
'Error message does not include the expected text',
);
}
});
Expand All @@ -104,7 +104,7 @@ describe('verify plugin', async function () {
} catch (e: any) {
assert(
e.message.includes('is not present in your project'),
'Error message does not include the expected text'
'Error message does not include the expected text',
);
}
});
Expand All @@ -125,7 +125,7 @@ describe('verify plugin', async function () {
} catch (e: any) {
assert(
e.message.includes('You did not provide any contract name.'),
'Error message does not include the expected text'
'Error message does not include the expected text',
);
}
});
Expand All @@ -139,7 +139,7 @@ describe('verify plugin', async function () {
const resolvedFiles = await getResolvedFiles(this.env);
assert(
resolvedFiles[0].sourceName === 'contracts/Greeter.vy',
'Greeter.vy not found at position 0 of resolved files.'
'Greeter.vy not found at position 0 of resolved files.',
);
} catch (e: any) {
isErr = 1;
Expand All @@ -161,7 +161,7 @@ describe('verify plugin', async function () {
} catch (e: any) {
assert(
e.message.includes('Wrong constructor arguments format:'),
'Error message does not include the expected text'
'Error message does not include the expected text',
);
}
});
Expand All @@ -173,9 +173,9 @@ describe('verify plugin', async function () {
} catch (e: any) {
assert(
e.message.includes(
'The number of constructor arguments you provided (0) does not match the number of constructor arguments the contract has been deployed with (1).'
'The number of constructor arguments you provided (0) does not match the number of constructor arguments the contract has been deployed with (1).',
),
'Error message does not include the expected text'
'Error message does not include the expected text',
);
}
});
Expand All @@ -188,7 +188,7 @@ describe('verify plugin', async function () {
assert(
result ===
'0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000',
'Invalid encoding!'
'Invalid encoding!',
);
} catch (e: any) {
isErr = 1;
Expand All @@ -205,7 +205,7 @@ describe('verify plugin', async function () {
assert(
result ===
'0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000',
'"Invalid encoding!"'
'"Invalid encoding!"',
);
} catch (e: any) {
isErr = 1;
Expand All @@ -230,9 +230,9 @@ describe('verify plugin', async function () {
} catch (e: any) {
assert(
e.message.includes(
"The address provided as argument contains a contract, but its bytecode doesn't match any of your local contracts."
"The address provided as argument contains a contract, but its bytecode doesn't match any of your local contracts.",
),
'Error message does not include the expected text'
'Error message does not include the expected text',
);
}
});
Expand Down
Loading

0 comments on commit 655622d

Please sign in to comment.