Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 4499660

Browse files
authored
gas estimation & merge fix (#17)
* gas estimation & merge fix * fix * add version indicator to implementation
1 parent 85970fc commit 4499660

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

contracts/ClaveImplementation.sol

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ pragma solidity ^0.8.17;
44
import {IAccount, ACCOUNT_VALIDATION_SUCCESS_MAGIC} from '@matterlabs/zksync-contracts/l2/system-contracts/interfaces/IAccount.sol';
55
import {Transaction, TransactionHelper} from '@matterlabs/zksync-contracts/l2/system-contracts/libraries/TransactionHelper.sol';
66
import {EfficientCall} from '@matterlabs/zksync-contracts/l2/system-contracts/libraries/EfficientCall.sol';
7-
import {NONCE_HOLDER_SYSTEM_CONTRACT, DEPLOYER_SYSTEM_CONTRACT, INonceHolder} from '@matterlabs/zksync-contracts/l2/system-contracts/Constants.sol';
7+
import {BOOTLOADER_FORMAL_ADDRESS, NONCE_HOLDER_SYSTEM_CONTRACT, DEPLOYER_SYSTEM_CONTRACT, INonceHolder} from '@matterlabs/zksync-contracts/l2/system-contracts/Constants.sol';
88
import {SystemContractsCaller} from '@matterlabs/zksync-contracts/l2/system-contracts/libraries/SystemContractsCaller.sol';
9+
import {SystemContractHelper} from '@matterlabs/zksync-contracts/l2/system-contracts/libraries/SystemContractHelper.sol';
910
import {Utils} from '@matterlabs/zksync-contracts/l2/system-contracts/libraries/Utils.sol';
1011
import {Initializable} from '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
1112

@@ -43,6 +44,8 @@ contract ClaveImplementation is
4344
// Batch transaction helper contract
4445
address private immutable _BATCH_CALLER;
4546

47+
uint256 public constant VERSION = 1;
48+
4649
/**
4750
* @notice Constructor for the account implementation
4851
* @param batchCaller address - Batch transaction helper contract
@@ -248,6 +251,11 @@ contract ClaveImplementation is
248251
bytes32 signedHash,
249252
Transaction calldata transaction
250253
) internal returns (bytes4 magicValue) {
254+
if (transaction.signature.length == 65) {
255+
// This is a gas estimation
256+
return bytes4(0);
257+
}
258+
251259
// Extract the signature, validator address and hook data from the transaction.signature
252260
(bytes memory signature, address validator, bytes[] memory hookData) = SignatureDecoder
253261
.decodeSignature(transaction.signature);

0 commit comments

Comments
 (0)