Broken commit

This commit is contained in:
Blake Duncan
2023-08-24 11:00:54 -04:00
parent 92556c0a8e
commit 5549ec0d63
6 changed files with 45 additions and 15 deletions

View File

@@ -20,11 +20,16 @@ const config: HardhatUserConfig = {
settings: {
optimizer: {
enabled: true,
runs: 200,
runs: 1000,
},
},
},
networks: {
hardhat: {
allowUnlimitedContractSize: true,
blockGasLimit: 10000000000,
gas: 10000000000,
},
localhost: {
allowUnlimitedContractSize: true,
blockGasLimit: 100000000,

View File

@@ -29,5 +29,8 @@
"ts-node": ">=8.0.0",
"typechain": "^8.1.0",
"typescript": ">=4.5.0"
},
"dependencies": {
"@thehubbleproject/bls": "^0.5.1"
}
}

View File

@@ -9,6 +9,7 @@ import MultiSendCallOnly from "../artifacts/lib/safe-contracts/contracts/librari
import SignMessageLib from "../artifacts/lib/safe-contracts/contracts/libraries/SignMessageLib.sol/SignMessageLib.json";
import SafeL2 from "../artifacts/lib/safe-contracts/contracts/SafeL2.sol/SafeL2.json";
import Safe from "../artifacts/lib/safe-contracts/contracts/Safe.sol/Safe.json";
import EntryPoint from "../artifacts/lib/account-abstraction/contracts/core/EntryPoint.sol/EntryPoint.json";
const deploy = async function () {
const contracts = [
@@ -22,6 +23,7 @@ const deploy = async function () {
SignMessageLib,
SafeL2,
Safe,
EntryPoint,
];
const provider = new ethers.JsonRpcProvider(process.env.NODE_URL);

View File

@@ -4,8 +4,7 @@ pragma abicoder v2;
import {BaseAccount} from "account-abstraction/contracts/core/BaseAccount.sol";
import {IEntryPoint, UserOperation} from "account-abstraction/contracts/interfaces/IEntryPoint.sol";
import {UserOperation} from "account-abstraction/contracts/interfaces/IEntryPoint.sol";
import "account-abstraction/contracts/samples/bls/lib/hubble-contracts/contracts/libs/BLS.sol";
// import "account-abstraction/contracts/samples/bls/lib/hubble-contracts/contracts/libs/BLS.sol";
interface ISafe {
function enableModule(address module) external;
@@ -18,7 +17,7 @@ interface ISafe {
) external returns (bool success);
}
contract SafeBLSPlugin is BaseAccount {
contract BLSPlugin is BaseAccount {
bytes32 public constant BLS_DOMAIN = keccak256("eip4337.bls.domain");
address public immutable myAddress;
@@ -81,22 +80,22 @@ contract SafeBLSPlugin is BaseAccount {
function _validateSignature(
UserOperation calldata userOp,
bytes32 userOpHash
) internal override returns (uint256 validationData) {
) internal view override returns (uint256 validationData) {
require(userOp.signature.length == 64, "VG: Sig bytes length must be 64");
uint256[2] memory decodedSignature = abi.decode(userOp.signature, (uint256[2]));
bytes memory hashBytes = abi.encodePacked(userOpHash);
uint256[2] memory message = BLS.hashToPoint(
BLS_DOMAIN,
hashBytes
);
(bool verified, bool callSuccess) = BLS.verifySingle(decodedSignature, _blsPublicKey, message);
// uint256[2] memory message = BLS.hashToPoint(
// BLS_DOMAIN,
// hashBytes
// );
// (bool verified, bool callSuccess) = BLS.verifySingle(decodedSignature, _blsPublicKey, message);
if (verified && callSuccess) {
return 0;
}
// TODO: check if wallet recovered
// if (verified && callSuccess) {
// return 0;
// }
// // TODO: check if wallet recovered
return SIG_VALIDATION_FAILED;
}
}

View File

@@ -12,3 +12,4 @@ import {MultiSendCallOnly} from "safe-contracts/contracts/libraries/MultiSendCal
import {SignMessageLib} from "safe-contracts/contracts/libraries/SignMessageLib.sol";
import {SafeL2} from "safe-contracts/contracts/SafeL2.sol";
import {Safe} from "safe-contracts/contracts/Safe.sol";
import {EntryPoint} from "account-abstraction/contracts/core/EntryPoint.sol";

View File

@@ -828,6 +828,14 @@
dependencies:
antlr4ts "^0.5.0-alpha.4"
"@thehubbleproject/bls@^0.5.1":
version "0.5.1"
resolved "https://registry.yarnpkg.com/@thehubbleproject/bls/-/bls-0.5.1.tgz#6b0565f56fc9c8896dcf3c8f0e2214b69a06167f"
integrity sha512-g5zeMZ8js/yg6MjFoC+pt0eqfCL2jC46yLY1LbKNriyqftB1tE3jpG/FMMDIW3x9/yRg/AgUb8Nluqj15tQs+A==
dependencies:
ethers "^5.5.3"
mcl-wasm "^1.0.0"
"@tsconfig/node10@^1.0.7":
version "1.0.9"
resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2"
@@ -941,6 +949,11 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b"
integrity sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==
"@types/node@^20.2.5":
version "20.5.3"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.5.3.tgz#fa52c147f405d56b2f1dd8780d840aa87ddff629"
integrity sha512-ITI7rbWczR8a/S6qjAW7DMqxqFMjjTo61qZVWJ1ubPvbIQsL5D/TvwjYEalM8Kthpe3hTzOGrF2TGbAu2uyqeA==
"@types/node@^8.0.0":
version "8.10.66"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.66.tgz#dd035d409df322acc83dff62a602f12a5783bbb3"
@@ -2095,7 +2108,7 @@ ethereumjs-util@^7.1.0, ethereumjs-util@^7.1.4:
ethereum-cryptography "^0.1.3"
rlp "^2.2.4"
"ethers-v5@npm:ethers@5.7.2", ethers@^5.7.0, ethers@^5.7.1:
"ethers-v5@npm:ethers@5.7.2", ethers@^5.5.3, ethers@^5.7.0, ethers@^5.7.1:
version "5.7.2"
resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e"
integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==
@@ -3321,6 +3334,13 @@ mcl-wasm@^0.7.1:
resolved "https://registry.yarnpkg.com/mcl-wasm/-/mcl-wasm-0.7.9.tgz#c1588ce90042a8700c3b60e40efb339fc07ab87f"
integrity sha512-iJIUcQWA88IJB/5L15GnJVnSQJmf/YaxxV6zRavv83HILHaJQb6y0iFyDMdDO0gN8X37tdxmAOrH/P8B6RB8sQ==
mcl-wasm@^1.0.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/mcl-wasm/-/mcl-wasm-1.3.0.tgz#10cd569c8448366a636c312af9207b2ed3f83674"
integrity sha512-7nChbr2sBEk9tSp7h8LGJp+bm2UfRzSZCV9LUD00ZPQCynT2W5dPBQcX27Nd++f3zMEl1nrgsT9OdHgxRdu7jw==
dependencies:
"@types/node" "^20.2.5"
md5.js@^1.3.4:
version "1.3.5"
resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f"