Skip to content

Commit

Permalink
feat: install zksync-storage-proofs lib plus update/tidy-up all libs
Browse files Browse the repository at this point in the history
  • Loading branch information
aliXsed committed Nov 13, 2024
1 parent 0d761b9 commit f47744d
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 60 deletions.
9 changes: 6 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
[submodule "lib/zksync-contracts"]
path = lib/zksync-contracts
url = https://github.com/NodleCode/zksync-contracts
[submodule "lib/zksync-storage-proofs"]
path = lib/zksync-storage-proofs
url = https://github.com/getclave/zksync-storage-proofs
[submodule "lib/era-contracts"]
path = lib/era-contracts
url = https://github.com/matter-labs/era-contracts
1 change: 1 addition & 0 deletions lib/era-contracts
Submodule era-contracts added at 84d5e3
2 changes: 1 addition & 1 deletion lib/openzeppelin-contracts
1 change: 0 additions & 1 deletion lib/zksync-contracts
Submodule zksync-contracts deleted from c93321
1 change: 1 addition & 0 deletions lib/zksync-storage-proofs
Submodule zksync-storage-proofs added at 4b2040
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@
"@matterlabs/hardhat-zksync-solc": "^1.1.4",
"@matterlabs/hardhat-zksync-upgradable": "^1.4.1",
"@matterlabs/hardhat-zksync-verify": "^1.4.3",
"@matterlabs/zksync-contracts": "^0.6.1",
"@nomicfoundation/hardhat-foundry": "^1.1.2",
"@nomicfoundation/hardhat-verify": "^2.0.7",
"@openzeppelin/contracts": "^5.0.1",
"@openzeppelin/upgrades-core": "^1.33.1",
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@types/node": "^20.12.12",
Expand Down
34 changes: 19 additions & 15 deletions src/paymasters/BasePaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import {
IPaymaster,
ExecutionResult,
PAYMASTER_VALIDATION_SUCCESS_MAGIC
} from "zksync-contracts/l2/system-contracts/interfaces/IPaymaster.sol";
import {IPaymasterFlow} from "zksync-contracts/l2/system-contracts/interfaces/IPaymasterFlow.sol";
import {Transaction} from "zksync-contracts/l2/system-contracts/libraries/TransactionHelper.sol";
import {BOOTLOADER_FORMAL_ADDRESS} from "zksync-contracts/l2/system-contracts/Constants.sol";

} from "lib/era-contracts/l2-contracts/contracts/interfaces/IPaymaster.sol";
import {IPaymasterFlow} from "lib/era-contracts/l2-contracts/contracts/interfaces/IPaymasterFlow.sol";
import {Transaction} from "lib/era-contracts/l2-contracts/contracts/L2ContractHelper.sol";
import {AccessControl} from "openzeppelin-contracts/contracts/access/AccessControl.sol";

uint160 constant SYSTEM_CONTRACTS_OFFSET = 0x8000;
address payable constant BOOTLOADER_FORMAL_ADDRESS = payable(address(SYSTEM_CONTRACTS_OFFSET + 0x01));

/// @notice This smart contract serves as a base for any other paymaster contract.
abstract contract BasePaymaster is IPaymaster, AccessControl {
bytes32 public constant WITHDRAWER_ROLE = keccak256("WITHDRAWER_ROLE");
Expand All @@ -34,11 +35,11 @@ abstract contract BasePaymaster is IPaymaster, AccessControl {
_grantRole(WITHDRAWER_ROLE, withdrawer);
}

function validateAndPayForPaymasterTransaction(bytes32, bytes32, Transaction calldata transaction)
external
payable
returns (bytes4 magic, bytes memory /* context */ )
{
function validateAndPayForPaymasterTransaction(
bytes32, /*_txHash*/
bytes32, /*_suggestedSignedHash*/
Transaction calldata transaction
) external payable returns (bytes4 magic, bytes memory context) {
_mustBeBootloader();

// By default we consider the transaction as accepted.
Expand Down Expand Up @@ -76,11 +77,14 @@ abstract contract BasePaymaster is IPaymaster, AccessControl {
return (magic, "");
}

function postTransaction(bytes calldata, Transaction calldata, bytes32, bytes32, ExecutionResult, uint256)
external
payable
override
{
function postTransaction(
bytes calldata, /*_context*/
Transaction calldata, /*_transaction*/
bytes32, /*_txHash*/
bytes32, /*_suggestedSignedHash*/
ExecutionResult, /*_txResult*/
uint256 /*_maxRefundedGas*/
) external payable {
_mustBeBootloader();

// Refunds are not supported yet.
Expand Down
2 changes: 1 addition & 1 deletion test/contentsign/BaseContentSign.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ contract BaseContentSignTest is Test {
contentSign = new MockContentSign();
}

function test_setsMetadata() public {
function test_setsMetadata() public view {
assertEq(contentSign.name(), "Mock");
assertEq(contentSign.symbol(), "MOCK");
}
Expand Down
2 changes: 1 addition & 1 deletion test/contentsign/EnterpriseContentSign.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ contract EnterpriseContentSignTest is Test {
vm.stopPrank();
}

function sets_adminRole() public {
function sets_adminRole() public view {
assertEq(nft.hasRole(nft.DEFAULT_ADMIN_ROLE(), alice), true);
}

Expand Down
38 changes: 4 additions & 34 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -625,12 +625,7 @@
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.9.6.tgz#2a880a24eb19b4f8b25adc2a5095f2aa27f39677"
integrity sha512-xSmezSupL+y9VkHZJGDoCBpmnB2ogM13ccaYDWqJTfS3dbuHkgjuwDFUmaFauBCboQMGB/S5UqUl2y54X99BmA==

"@openzeppelin/contracts@^5.0.1":
version "5.0.2"
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-5.0.2.tgz#b1d03075e49290d06570b2fd42154d76c2a5d210"
integrity sha512-ytPc6eLGcHHnapAZ9S+5qsdomhjo6QBHTDRRBFfTxXIpsicMhVPouPgmUPebZZZGX7vt9USA+Z+0M0dSVtSUEA==

"@openzeppelin/upgrades-core@^1.31.3", "@openzeppelin/upgrades-core@^1.33.1":
"@openzeppelin/upgrades-core@^1.31.3":
version "1.33.1"
resolved "https://registry.yarnpkg.com/@openzeppelin/upgrades-core/-/upgrades-core-1.33.1.tgz#2e129ce1ab7bd07d07e98822ca8bb8de1d3b008e"
integrity sha512-YRxIRhTY1b+j7+NUUu8Uuem5ugxKexEMVd8dBRWNgWeoN1gS1OCrhgUg0ytL+54vzQ+SGWZDfNnzjVuI1Cj1Zw==
Expand Down Expand Up @@ -3838,16 +3833,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63"
integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -3912,14 +3898,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -4314,16 +4293,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand Down

0 comments on commit f47744d

Please sign in to comment.