Description: When using the zkWallet.deposit method in the deployment script and then executing the deploy command, an unexpected error is thrown indicating a transaction revert without a reason string.
Navigate to the project directory using cd hello-world.
Replace the default deploy script (e.g. deploy-greeter.ts) with the provided script (adds back depositing funds to L2).
Deployment script
```
import { Wallet, utils } from "zksync-web3";
import * as ethers from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { Deployer } from "@matterlabs/hardhat-zksync-deploy";
// load env file
import dotenv from "dotenv";
dotenv.config();
// load wallet private key from env file
const PRIVATE_KEY = process.env.WALLET_PRIVATE_KEY || "";
if (!PRIVATE_KEY)
throw "⛔️ Private key not detected! Add it to the .env file!";
// An example of a deploy script that will deploy and call a simple contract.
export default async function (hre: HardhatRuntimeEnvironment) {
console.log(`Running deploy script for the Greeter contract`);
// Initialize the wallet.
const wallet = new Wallet(PRIVATE_KEY);
// Create deployer object and load the artifact of the contract you want to deploy.
const deployer = new Deployer(hre, wallet);
const artifact = await deployer.loadArtifact("Greeter");
// Estimate contract deployment fee
const greeting = "Hi there!";
const deploymentFee = await deployer.estimateDeployFee(artifact, [greeting]);
console.log("before");
// ⚠️ OPTIONAL: You can skip this block if your account already has funds in L2
// Deposit funds to L2
const depositHandle = await deployer.zkWallet.deposit({
token: utils.ETH_ADDRESS,
amount: deploymentFee.mul(2),
});
// Wait until the deposit is processed on zkSync
await depositHandle.wait();
// Deploy this contract. The returned object will be of a `Contract` type, similarly to ones in `ethers`.
// `greeting` is an argument for contract constructor.
const parsedFee = ethers.utils.formatEther(deploymentFee.toString());
console.log(`The deployment is estimated to cost ${parsedFee} ETH`);
const greeterContract = await deployer.deploy(artifact, [greeting]);
//obtain the Constructor Arguments
console.log(
"Constructor args:" + greeterContract.interface.encodeDeploy([greeting])
);
// Show the contract info.
const contractAddress = greeterContract.address;
console.log(`${artifact.contractName} was deployed to ${contractAddress}`);
// verify contract for tesnet & mainnet
if (process.env.NODE_ENV != "test") {
// Contract MUST be fully qualified name (e.g. path/sourceName:contractName)
const contractFullyQualifedName = "contracts/Greeter.sol:Greeter";
// Verify contract programmatically
const verificationId = await hre.run("verify:verify", {
address: contractAddress,
contract: contractFullyQualifedName,
constructorArguments: [greeting],
bytecode: artifact.bytecode,
});
} else {
console.log(`Contract not verified, deployed locally.`);
}
}
```
Run yarn hardhat compile.
Run yarn deploy.
Expected Result: Deposit should be processed successfully and move on to the subsequent steps in the deploy script.
Actual Result: An error is thrown stating "missing revert data in call exception; Transaction reverted without a reason string".
Error:
An unexpected error occurred:
Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (transaction={"from":"0x42baB21bB7c1E236D67B264685E28fbbeF49C19F","to":"0x1908e2BF4a88F91E4eF0DC72f02b8Ea36BEa2319","data":"0xb473318e0000000000000000000000000000000000000000000000000000000059682f1500000000000000000000000000000000000000000000000000000000001136600000000000000000000000000000000000000000000000000000000000000320","accessList":null}, code=CALL_EXCEPTION, version=providers/5.7.2)
at Logger.makeError (/Users/dustinbrickwood/Documents/dev/zk/temp/hello-world/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
at Logger.throwError (/Users/dustinbrickwood/Documents/dev/zk/temp/hello-world/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
at /Users/dustinbrickwood/Documents/dev/zk/temp/hello-world/node_modules/@ethersproject/providers/src.ts/fallback-provider.ts:632:24
at Array.forEach (<anonymous>)
at /Users/dustinbrickwood/Documents/dev/zk/temp/hello-world/node_modules/@ethersproject/providers/src.ts/fallback-provider.ts:614:33
at step (/Users/dustinbrickwood/Documents/dev/zk/temp/hello-world/node_modules/@ethersproject/providers/lib/fallback-provider.js:48:23)
at Object.next (/Users/dustinbrickwood/Documents/dev/zk/temp/hello-world/node_modules/@ethersproject/providers/lib/fallback-provider.js:29:53)
at step (/Users/dustinbrickwood/Documents/dev/zk/temp/hello-world/node_modules/@ethersproject/providers/lib/fallback-provider.js:33:139)
at Object.next (/Users/dustinbrickwood/Documents/dev/zk/temp/hello-world/node_modules/@ethersproject/providers/lib/fallback-provider.js:29:53)
at fulfilled (/Users/dustinbrickwood/Documents/dev/zk/temp/hello-world/node_modules/@ethersproject/providers/lib/fallback-provider.js:20:58) {
reason: 'missing revert data in call exception; Transaction reverted without a reason string',
code: 'CALL_EXCEPTION',
transaction: {
from: '0x42baB21bB7c1E236D67B264685E28fbbeF49C19F',
to: '0x1908e2BF4a88F91E4eF0DC72f02b8Ea36BEa2319',
data: '0xb473318e0000000000000000000000000000000000000000000000000000000059682f1500000000000000000000000000000000000000000000000000000000001136600000000000000000000000000000000000000000000000000000000000000320',
accessList: null
}
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
Bug Report
Description: When using the
zkWallet.deposit
method in the deployment script and then executing the deploy command, an unexpected error is thrown indicating a transaction revert without a reason string.Steps to Reproduce:
npx zksync-cli create-project hello-world
.cd hello-world
.deploy-greeter.ts
) with the provided script (adds back depositing funds to L2).Deployment script
``` import { Wallet, utils } from "zksync-web3"; import * as ethers from "ethers"; import { HardhatRuntimeEnvironment } from "hardhat/types"; import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; // load env file import dotenv from "dotenv"; dotenv.config(); // load wallet private key from env file const PRIVATE_KEY = process.env.WALLET_PRIVATE_KEY || ""; if (!PRIVATE_KEY) throw "⛔️ Private key not detected! Add it to the .env file!"; // An example of a deploy script that will deploy and call a simple contract. export default async function (hre: HardhatRuntimeEnvironment) { console.log(`Running deploy script for the Greeter contract`); // Initialize the wallet. const wallet = new Wallet(PRIVATE_KEY); // Create deployer object and load the artifact of the contract you want to deploy. const deployer = new Deployer(hre, wallet); const artifact = await deployer.loadArtifact("Greeter"); // Estimate contract deployment fee const greeting = "Hi there!"; const deploymentFee = await deployer.estimateDeployFee(artifact, [greeting]); console.log("before"); // ⚠️ OPTIONAL: You can skip this block if your account already has funds in L2 // Deposit funds to L2 const depositHandle = await deployer.zkWallet.deposit({ token: utils.ETH_ADDRESS, amount: deploymentFee.mul(2), }); // Wait until the deposit is processed on zkSync await depositHandle.wait(); // Deploy this contract. The returned object will be of a `Contract` type, similarly to ones in `ethers`. // `greeting` is an argument for contract constructor. const parsedFee = ethers.utils.formatEther(deploymentFee.toString()); console.log(`The deployment is estimated to cost ${parsedFee} ETH`); const greeterContract = await deployer.deploy(artifact, [greeting]); //obtain the Constructor Arguments console.log( "Constructor args:" + greeterContract.interface.encodeDeploy([greeting]) ); // Show the contract info. const contractAddress = greeterContract.address; console.log(`${artifact.contractName} was deployed to ${contractAddress}`); // verify contract for tesnet & mainnet if (process.env.NODE_ENV != "test") { // Contract MUST be fully qualified name (e.g. path/sourceName:contractName) const contractFullyQualifedName = "contracts/Greeter.sol:Greeter"; // Verify contract programmatically const verificationId = await hre.run("verify:verify", { address: contractAddress, contract: contractFullyQualifedName, constructorArguments: [greeting], bytecode: artifact.bytecode, }); } else { console.log(`Contract not verified, deployed locally.`); } } ```yarn hardhat compile
.yarn deploy
.Expected Result: Deposit should be processed successfully and move on to the subsequent steps in the deploy script.
Actual Result: An error is thrown stating "missing revert data in call exception; Transaction reverted without a reason string".
Error: