Skip to content

Commit c79d855

Browse files
authored
Restructure - move plugin to separate repo (#70)
* restructured to seprate plugins folder * removed via-ir based plugins, todo: remove all plugins to kernel-plugins
1 parent b4e8996 commit c79d855

28 files changed

Lines changed: 80 additions & 1350 deletions

.gitmodules

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,3 @@
77
[submodule "lib/I4337"]
88
path = lib/I4337
99
url = https://github.com/leekt/I4337
10-
[submodule "lib/p256-verifier"]
11-
path = lib/p256-verifier
12-
url = https://github.com/daimo-eth/p256-verifier
13-
[submodule "lib/FreshCryptoLib"]
14-
path = lib/FreshCryptoLib
15-
url = https://github.com/rdubois-crypto/FreshCryptoLib

foundry.toml

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,11 @@ evm_version = 'paris'
77
bytecode_hash = "none"
88
cbor_metadata = false
99
optimize = true
10-
via-ir = true
10+
via-ir = false
1111
runs = 1000000
12-
[fuzz]
13-
runs = 1024
14-
15-
[etherscan]
16-
mainnet = { key = "${ETHERSCAN_API_KEY}" }
17-
goerli = { key = "${ETHERSCAN_API_KEY}" }
18-
sepolia = { key = "${ETHERSCAN_API_KEY}" }
19-
20-
polygon = { key = "${POLYGONSCAN_API_KEY}" }
21-
mumbai = { key = "${POLYGONSCAN_API_KEY}" }
22-
23-
base = { key = "${BASESCAN_API_KEY}" }
24-
base-goerli = { key = "${BASESCAN_API_KEY}" }
25-
base-sepolia = { key = "${BASESCAN_API_KEY}" }
26-
27-
arbitrum = { key = "${ARBISCAN_API_KEY}" }
28-
arbitrum-goerli = { key = "${ARBISCAN_API_KEY}" }
29-
arbitrum-sepolia = { key = "${ARBISCAN_API_KEY}" }
3012

31-
optimism = { key = "${OPTIMISMSCAN_API_KEY}" }
32-
optimism-goerli = { key = "${OPTIMISMSCAN_API_KEY}" }
33-
optimism-sepolia = { key = "${OPTIMISMSCAN_API_KEY}" }
34-
35-
avalanche = { key = "${AVALANCHE_API_KEY}" }
36-
fuji = { key = "${AVALANCHE_API_KEY}" }
37-
38-
linea = { key = "${LINEASCAN_API_KEY}" }
39-
linea-testnet = { key = "${LINEASCAN_API_KEY}" }
40-
41-
bsc = { key = "${BSCSCAN_API_KEY}" }
42-
opbnb = { key = "${BSCSCAN_API_KEY}" }
13+
[profile.deploy]
14+
via-ir = true
4315

44-
# astar-testnet = { key = "${BSCSCAN_API_KEY}" }
16+
[fuzz]
17+
runs = 1024

lib/FreshCryptoLib

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/p256-verifier

Lines changed: 0 additions & 1 deletion
This file was deleted.

script/DeployDeterministic.s.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import "./deterministic/Kernel2_3.s.sol";
1111

1212
contract DeployDeterministic is Script {
1313
address constant DEPLOYER = 0x9775137314fE595c943712B0b336327dfa80aE8A;
14+
1415
function run() external {
1516
vm.startBroadcast(DEPLOYER);
1617
KernelFactory factory = KernelFactory(payable(FactoryDeploy.deploy()));
@@ -28,10 +29,10 @@ contract DeployDeterministic is Script {
2829
//}
2930

3031
(address k23, address k23lite) = Kernel_2_3_Deploy.deploy();
31-
if(!factory.isAllowedImplementation(k23)) {
32+
if (!factory.isAllowedImplementation(k23)) {
3233
factory.setImplementation(k23, true);
3334
}
34-
if(!factory.isAllowedImplementation(k23lite)) {
35+
if (!factory.isAllowedImplementation(k23lite)) {
3536
factory.setImplementation(k23lite, true);
3637
}
3738
vm.stopBroadcast();

script/DeployECDSAValidator.s.sol

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@ import "src/factory/KernelFactory.sol";
44
import "src/validator/ECDSAValidator.sol";
55
import "forge-std/Script.sol";
66
import "forge-std/console.sol";
7+
78
contract DeployKernel is Script {
89
address constant DEPLOYER = 0x9775137314fE595c943712B0b336327dfa80aE8A;
910
address constant ENTRYPOINT_0_6 = 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789;
1011
address constant EXPECTED_VALIDATOR_ADDRESS = 0xd9AB5096a832b9ce79914329DAEE236f8Eea0390;
12+
1113
function run() public {
1214
uint256 key = vm.envUint("DEPLOYER_PRIVATE_KEY");
1315
vm.startBroadcast(key);
14-
if(EXPECTED_VALIDATOR_ADDRESS.code.length == 0) {
15-
ECDSAValidator validator = new ECDSAValidator{salt:0}();
16+
if (EXPECTED_VALIDATOR_ADDRESS.code.length == 0) {
17+
ECDSAValidator validator = new ECDSAValidator{salt: 0}();
1618
console.log("validator address: %s", address(validator));
1719
} else {
1820
console.log("validator address: %s", EXPECTED_VALIDATOR_ADDRESS);
1921
}
2022
vm.stopBroadcast();
2123
}
2224
}
23-

script/DeployKernel.s.sol

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,51 +7,52 @@ import "src/lite/KernelLiteECDSA.sol";
77
import "forge-std/Script.sol";
88
import "forge-std/console.sol";
99
import "src/validator/ECDSAValidator.sol";
10+
1011
contract DeployKernel is Script {
1112
address constant DEPLOYER = 0x9775137314fE595c943712B0b336327dfa80aE8A;
1213
address constant ENTRYPOINT_0_6 = 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789;
1314
address constant ECDSAVALIDATOR = 0xd9AB5096a832b9ce79914329DAEE236f8Eea0390;
1415
address constant EXPECTED_KERNEL_ADDRESS = 0x0DA6a956B9488eD4dd761E59f52FDc6c8068E6B5;
1516
address constant EXPECTED_KERNEL_LITE_ADDRESS = 0xbEdb61Be086F3f15eE911Cc9AB3EEa945DEbFa96;
1617
address payable constant EXPECTED_KERNEL_FACTORY_ADDRESS = payable(0x5de4839a76cf55d0c90e2061ef4386d962E15ae3);
18+
1719
function run() public {
1820
uint256 key = vm.envUint("DEPLOYER_PRIVATE_KEY");
1921
vm.startBroadcast(key);
2022
KernelFactory factory;
21-
if(EXPECTED_KERNEL_FACTORY_ADDRESS.code.length == 0){
22-
factory = new KernelFactory{salt:0}(DEPLOYER, IEntryPoint(ENTRYPOINT_0_6));
23+
if (EXPECTED_KERNEL_FACTORY_ADDRESS.code.length == 0) {
24+
factory = new KernelFactory{salt: 0}(DEPLOYER, IEntryPoint(ENTRYPOINT_0_6));
2325
console.log("KernelFactory address: %s", address(factory));
2426
} else {
2527
factory = KernelFactory(EXPECTED_KERNEL_FACTORY_ADDRESS);
2628
}
27-
if(EXPECTED_KERNEL_LITE_ADDRESS.code.length == 0) {
28-
if(address(ECDSAVALIDATOR).code.length == 0) {
29+
if (EXPECTED_KERNEL_LITE_ADDRESS.code.length == 0) {
30+
if (address(ECDSAVALIDATOR).code.length == 0) {
2931
console.log("ECDSAVALIDATOR NOT DEPLOYED");
3032
} else {
3133
KernelLiteECDSA kernellite;
32-
kernellite = new KernelLiteECDSA{salt:0}(IEntryPoint(ENTRYPOINT_0_6), IKernelValidator(ECDSAVALIDATOR));
34+
kernellite = new KernelLiteECDSA{salt: 0}(IEntryPoint(ENTRYPOINT_0_6), IKernelValidator(ECDSAVALIDATOR));
3335
console.log("Kernel Lite address: %s", address(kernellite));
3436
}
3537
}
36-
if(factory.isAllowedImplementation(EXPECTED_KERNEL_LITE_ADDRESS) == false) {
38+
if (factory.isAllowedImplementation(EXPECTED_KERNEL_LITE_ADDRESS) == false) {
3739
console.log("Registering kernellite implementation");
3840
factory.setImplementation(EXPECTED_KERNEL_LITE_ADDRESS, true);
3941
}
40-
if(EXPECTED_KERNEL_ADDRESS.code.length == 0) {
42+
if (EXPECTED_KERNEL_ADDRESS.code.length == 0) {
4143
Kernel kernel;
42-
kernel = new Kernel{salt:0}(IEntryPoint(ENTRYPOINT_0_6));
44+
kernel = new Kernel{salt: 0}(IEntryPoint(ENTRYPOINT_0_6));
4345
console.log("Kernel address: %s", address(kernel));
4446
}
45-
if(factory.isAllowedImplementation(EXPECTED_KERNEL_ADDRESS) == false) {
47+
if (factory.isAllowedImplementation(EXPECTED_KERNEL_ADDRESS) == false) {
4648
console.log("Registering kernel implementation");
4749
factory.setImplementation(EXPECTED_KERNEL_ADDRESS, true);
4850
}
4951
IEntryPoint entryPoint = IEntryPoint(ENTRYPOINT_0_6);
5052
IStakeManager.DepositInfo memory info = entryPoint.getDepositInfo(address(factory));
51-
if(info.stake == 0) {
53+
if (info.stake == 0) {
5254
console.log("Need to stake to factory");
5355
}
5456
vm.stopBroadcast();
5557
}
5658
}
57-

script/DeployKernelInitial.s.sol

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ import "src/lite/KernelLiteECDSA.sol";
77
import "forge-std/Script.sol";
88
import "forge-std/console.sol";
99
import "src/validator/ECDSAValidator.sol";
10+
1011
contract DeployKernelInitial is Script {
1112
address constant DEPLOYER = 0x9775137314fE595c943712B0b336327dfa80aE8A;
1213
address constant ENTRYPOINT_0_6 = 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789;
1314
address constant ECDSAVALIDATOR = 0xd9AB5096a832b9ce79914329DAEE236f8Eea0390;
1415
address payable constant EXPECTED_KERNEL_FACTORY_ADDRESS = payable(0x5de4839a76cf55d0c90e2061ef4386d962E15ae3);
16+
1517
function run() public {
1618
uint256 key = vm.envUint("DEPLOYER_PRIVATE_KEY");
1719
vm.startBroadcast(key);
1820
KernelFactory factory;
19-
if(EXPECTED_KERNEL_FACTORY_ADDRESS.code.length == 0){
20-
factory = new KernelFactory{salt:0}(DEPLOYER, IEntryPoint(ENTRYPOINT_0_6));
21+
if (EXPECTED_KERNEL_FACTORY_ADDRESS.code.length == 0) {
22+
factory = new KernelFactory{salt: 0}(DEPLOYER, IEntryPoint(ENTRYPOINT_0_6));
2123
console.log("KernelFactory address: %s", address(factory));
2224
} else {
2325
factory = KernelFactory(EXPECTED_KERNEL_FACTORY_ADDRESS);
@@ -34,18 +36,17 @@ contract DeployKernelInitial is Script {
3436
// }
3537
//}
3638
Kernel kernel;
37-
kernel = new Kernel{salt:0}(IEntryPoint(ENTRYPOINT_0_6));
39+
kernel = new Kernel{salt: 0}(IEntryPoint(ENTRYPOINT_0_6));
3840
console.log("Kernel address: %s", address(kernel));
39-
if(factory.isAllowedImplementation(address(kernel)) == false) {
41+
if (factory.isAllowedImplementation(address(kernel)) == false) {
4042
console.log("Registering kernel implementation");
4143
factory.setImplementation(address(kernel), true);
4244
}
4345
IEntryPoint entryPoint = IEntryPoint(ENTRYPOINT_0_6);
4446
IStakeManager.DepositInfo memory info = entryPoint.getDepositInfo(address(factory));
45-
if(info.stake == 0) {
47+
if (info.stake == 0) {
4648
console.log("Need to stake to factory");
4749
}
4850
vm.stopBroadcast();
4951
}
5052
}
51-

script/DeployKillSwitch.s.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ contract DeployKillSwitch is Script {
1515
KillSwitchValidator validator;
1616
if (EXPECTED_ADDRESS_KILL_SWITCH_VALIDATOR.code.length == 0) {
1717
console.log("deploying KillSwitchValidator");
18-
validator = new KillSwitchValidator{salt:0}();
18+
validator = new KillSwitchValidator{salt: 0}();
1919
console.log("validator address: %s", address(validator));
2020
} else {
2121
validator = KillSwitchValidator(EXPECTED_ADDRESS_KILL_SWITCH_VALIDATOR);
2222
console.log("validator address: %s", address(EXPECTED_ADDRESS_KILL_SWITCH_VALIDATOR));
2323
}
2424
if (EXPECTED_ADDRESS_KILL_SWITCH_ACTION.code.length == 0) {
2525
console.log("deploying KillSwitchAction");
26-
KillSwitchAction action = new KillSwitchAction{salt:0}(validator);
26+
KillSwitchAction action = new KillSwitchAction{salt: 0}(validator);
2727
console.log("KillSwitchAction address: %s", address(action));
2828
} else {
2929
console.log("KillSwitchAction address: %s", address(EXPECTED_ADDRESS_KILL_SWITCH_ACTION));

script/DeployMulticall.s.sol

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ contract DeployMultiCall is Script {
66
address constant DEPLOYER = 0x9775137314fE595c943712B0b336327dfa80aE8A;
77
address constant EXPECTED_MULTICALL_ADDRESS = 0x8ae01fCF7c655655fF2c6Ef907b8B4718Ab4e17c;
88
address constant DETERMINISTIC_DEPLOYER = 0x4e59b44847b379578588920cA78FbF26c0B4956C;
9+
910
function run() public {
1011
uint256 key = vm.envUint("DEPLOYER_PRIVATE_KEY");
1112
vm.startBroadcast(key);
12-
if(EXPECTED_MULTICALL_ADDRESS.code.length == 0) {
13-
(bool success, bytes memory ret) = DETERMINISTIC_DEPLOYER.call(hex"000000000000000000000000000000000000000000000000000000000000000060a060405234801561001057600080fd5b50306080526080516102bd61002f6000396000604f01526102bd6000f3fe60806040526004361061001e5760003560e01c80638d80ff0a14610023575b600080fd5b6100366100313660046101b8565b610038565b005b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163003610101576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f4d756c746953656e642073686f756c64206f6e6c792062652063616c6c65642060448201527f7669612064656c656761746563616c6c00000000000000000000000000000000606482015260840160405180910390fd5b805160205b81811015610184578083015160f81c6001820184015160601c60158301850151603584018601516055850187016000856000811461014b576001811461015b57610166565b6000808585888a5af19150610166565b6000808585895af491505b508061017157600080fd5b5050806055018501945050505050610106565b505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602082840312156101ca57600080fd5b813567ffffffffffffffff808211156101e257600080fd5b818401915084601f8301126101f657600080fd5b81358181111561020857610208610189565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561024e5761024e610189565b8160405282815287602084870101111561026757600080fd5b82602086016020830137600092810160200192909252509594505050505056fea2646970667358221220aee0f2dd047c52784b9c7806e4078197141e146ec66587d8610576db5f8ad20e64736f6c634300080f0033");
13+
if (EXPECTED_MULTICALL_ADDRESS.code.length == 0) {
14+
(bool success, bytes memory ret) = DETERMINISTIC_DEPLOYER.call(
15+
hex"000000000000000000000000000000000000000000000000000000000000000060a060405234801561001057600080fd5b50306080526080516102bd61002f6000396000604f01526102bd6000f3fe60806040526004361061001e5760003560e01c80638d80ff0a14610023575b600080fd5b6100366100313660046101b8565b610038565b005b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163003610101576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f4d756c746953656e642073686f756c64206f6e6c792062652063616c6c65642060448201527f7669612064656c656761746563616c6c00000000000000000000000000000000606482015260840160405180910390fd5b805160205b81811015610184578083015160f81c6001820184015160601c60158301850151603584018601516055850187016000856000811461014b576001811461015b57610166565b6000808585888a5af19150610166565b6000808585895af491505b508061017157600080fd5b5050806055018501945050505050610106565b505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602082840312156101ca57600080fd5b813567ffffffffffffffff808211156101e257600080fd5b818401915084601f8301126101f657600080fd5b81358181111561020857610208610189565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561024e5761024e610189565b8160405282815287602084870101111561026757600080fd5b82602086016020830137600092810160200192909252509594505050505056fea2646970667358221220aee0f2dd047c52784b9c7806e4078197141e146ec66587d8610576db5f8ad20e64736f6c634300080f0033"
16+
);
1417
} else {
1518
console.log("validator address: %s", EXPECTED_MULTICALL_ADDRESS);
1619
}
1720
vm.stopBroadcast();
1821
}
1922
}
20-

0 commit comments

Comments
 (0)