Skip to content

Commit

Permalink
fix zksync estimateL1ToL2Execute (#101)
Browse files Browse the repository at this point in the history
* fix zksync estimateL1ToL2Execute

* modify governance name
  • Loading branch information
zkJoaquin authored Apr 16, 2024
1 parent f29e3bd commit 2ef6f77
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions examples/zksync/scripts/changeFeeParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ task('changeFeeParams', 'Change fee params for zkLink').setAction(async (taskArg
/**
* The estimateL1ToL2Execute method gives us the gasLimit for sending an L1->L2 message
*/
const l2Addr = utils.applyL1ToL2Alias(l2GatewayAddr);
const l1GatewayAliasAddr = utils.applyL1ToL2Alias(l1GatewayAddr);
const l2GasLimit = await l2Provider.estimateL1ToL2Execute({
contractAddress: l2Addr,
caller: l1GatewayAliasAddr,
contractAddress: l2GatewayAddr,
calldata: l2GatewayCallData,
overrides: {
value: zkLinkCallValue,
},
l2Value: zkLinkCallValue,
gasPerPubdataByte: utils.REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT,
});
console.log(`Estimate gasLimit on L1 is ${l2GasLimit.valueOf()}`);

Expand Down
12 changes: 6 additions & 6 deletions examples/zksync/scripts/governance.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,19 @@ async function encodeL1ToL2Calldata(taskArgs, hre, networkInfo) {
console.log(`The l2 call value to target address: ${l2CallValue}`);
console.log(`The refund address: ${refundAddress}`);

const l2GovernanceAddr = utils.applyL1ToL2Alias(l1GovernanceAddr);
console.log(`The l2 governance address: ${l2GovernanceAddr}`);
const l1GovernanceAliasAddr = utils.applyL1ToL2Alias(l1GovernanceAddr);
console.log(`The l2 governance address: ${l1GovernanceAliasAddr}`);

/**
* The estimateL1ToL2Execute method gives us the gasLimit for sending an L1->L2 message
*/

const l2GasLimit = await l2Provider.estimateL1ToL2Execute({
contractAddress: l2GovernanceAddr,
caller: l1GovernanceAliasAddr,
contractAddress: l2ToContractAddress,
calldata: l2CallData,
overrides: {
value: l2CallValue,
},
l2Value: l2CallValue,
gasPerPubdataByte: utils.REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT,
});
console.log(`Estimate gasLimit on L1 is ${l2GasLimit.valueOf()}`);

Expand Down
10 changes: 5 additions & 5 deletions examples/zksync/scripts/setValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ task('setValidator', 'Set validator for zkLink')
/**
* The estimateL1ToL2Execute method gives us the gasLimit for sending an L1->L2 message
*/
const l2Addr = utils.applyL1ToL2Alias(l2GatewayAddr);
const l1GatewayAliasAddr = utils.applyL1ToL2Alias(l1GatewayAddr);
const l2GasLimit = await l2Provider.estimateL1ToL2Execute({
contractAddress: l2Addr,
caller: l1GatewayAliasAddr,
contractAddress: l2GatewayAddr,
calldata: l2GatewayCallData,
overrides: {
value: zkLinkCallValue,
},
l2Value: zkLinkCallValue,
gasPerPubdataByte: utils.REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT,
});
console.log(`Estimate gasLimit on L1 is ${l2GasLimit.valueOf()}`);

Expand Down
10 changes: 5 additions & 5 deletions examples/zksync/scripts/syncBatchRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ task('syncBatchRoot', 'Send batch root from arbitrator to zkLink')
/**
* The estimateL1ToL2Execute method gives us the gasLimit for sending an L1->L2 message
*/
const l2Addr = utils.applyL1ToL2Alias(l2GatewayAddr);
const l1GatewayAliasAddr = utils.applyL1ToL2Alias(l1GatewayAddr);
const l2GasLimit = await l2Provider.estimateL1ToL2Execute({
contractAddress: l2Addr,
caller: l1GatewayAliasAddr,
contractAddress: l2GatewayAddr,
calldata: l2GatewayCallData,
overrides: {
value: zkLinkCallValue,
},
l2Value: zkLinkCallValue,
gasPerPubdataByte: utils.REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT,
});
console.log(`Estimate gasLimit on L1 is ${l2GasLimit.valueOf()}`);

Expand Down

0 comments on commit 2ef6f77

Please sign in to comment.