Skip to content

Commit

Permalink
Modular permission (#84)
Browse files Browse the repository at this point in the history
* restructured to seprate plugins folder

* added modular permission

* fmt

* synced dev

* fix: shadowed variable

* modular permission encoding checked

* intersect supports validation data with aggregator

* draft for modular permission

* forge fmt

* non-view for validCaller

* fix: test for helper

* changed validCaller to non-view

* removed rawMessage, move this to policy...?

* gas policy example for policy

* execute policy for interval based execution limits

* added natspec for modular permission validator

* added flag to skip validation data

* moved policy config to separate file

* remapping to includ I4337

* temp

* modular permission test without validCaller support

* support requestor feature

* now call it allowed requestor

* forge fmt

* example for eip712

* test fix to check if signature validation result is ok

* fix: nonce fixes in ModularPermissionValidator

* fix: use calldata for sig

* fix: proof fetching in MerklePolicy

* fix : use msg.sender instead of caller for signature verification on eip712 policy

* chore: deploy signaturePolicy

* fix: added validator in the storage mapping of SignaturePolicy to fix unauthenticated state change vuln

* fix: remove p256-verifier lib

* feat: added WebAuthnSigner for ModularPermissionValidator (#83)

* feat: added Sudo policy for ModularPermissionValidator

* fix: nonce for single tx dual enable and ECDSASigner sig

---------

Co-authored-by: Sahil Vasava <sahilvasava@gmail.com>
  • Loading branch information
leekt and SahilVasava authored Feb 22, 2024
1 parent 10cd5f0 commit 633e4ea
Show file tree
Hide file tree
Showing 65 changed files with 3,358 additions and 65 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ artifacts-selected
cache_hardhat

lcov.info
settings.json
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
url = https://github.com/rdubois-crypto/FreshCryptoLib
[submodule "lib/solady"]
path = lib/solady
url = https://github.com/vectorized/solady
url = https://github.com/vectorized/solady
31 changes: 31 additions & 0 deletions broadcast/DeployKernel.s.sol/80001/run-1708379656.json

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions broadcast/DeployKernel.s.sol/80001/run-1708379701.json

Large diffs are not rendered by default.

65 changes: 65 additions & 0 deletions broadcast/DeployKernel.s.sol/80001/run-1708379708.json

Large diffs are not rendered by default.

65 changes: 65 additions & 0 deletions broadcast/DeployKernel.s.sol/80001/run-latest.json

Large diffs are not rendered by default.

69 changes: 69 additions & 0 deletions broadcast/DeployModularPermission.s.sol/80001/run-1707331759.json

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions broadcast/DeployModularPermission.s.sol/80001/run-1707331808.json

Large diffs are not rendered by default.

169 changes: 169 additions & 0 deletions broadcast/DeployModularPermission.s.sol/80001/run-1707331815.json

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions broadcast/DeployModularPermission.s.sol/80001/run-1707430304.json

Large diffs are not rendered by default.

65 changes: 65 additions & 0 deletions broadcast/DeployModularPermission.s.sol/80001/run-1707430395.json

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions broadcast/DeployModularPermission.s.sol/80001/run-1707439892.json

Large diffs are not rendered by default.

65 changes: 65 additions & 0 deletions broadcast/DeployModularPermission.s.sol/80001/run-1707439906.json

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions broadcast/DeployModularPermission.s.sol/80001/run-1707741950.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"transactions": [
{
"hash": "0x7d2de72251685ec4f433d6479f844c3c688ae894be1a06def804adfb55afc9c6",
"transactionType": "CREATE2",
"contractName": "MerklePolicy",
"contractAddress": "0xb808D75B5ACf6B5513eb816d3980C733ae6Be468",
"function": null,
"arguments": null,
"transaction": {
"type": "0x00",
"from": "0xa02cddfa44b8c01b4257f54ac1c43f75801e8175",
"to": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
"gas": "0x146081",
"value": "0x0",
"data": "0x0000000000000000000000000000000000000000000000000000000000000000608060405234801561001057600080fd5b5061107f806100206000396000f3fe60806040526004361061003e5760003560e01c8062282ae014610043578063c92ce35114610058578063ecfcd9301461007d578063f2a108001461009d575b600080fd5b6100566100513660046109f7565b6100da565b005b61006b610066366004610a51565b61012a565b60405190815260200160405180910390f35b34801561008957600080fd5b5061006b610098366004610adf565b6102ad565b3480156100a957600080fd5b5061006b6100b8366004610b61565b6000602081815293815260408082208552928152828120909352825290205481565b60006100e96020828486610b9d565b6100f291610bc7565b336000908152602081815260408083209783529681528682206001600160a01b03989098168252969096529390942092909255505050565b6000368161013b6060870187610be6565b336000908152602081815260408083208c845282528083206001600160a01b038e1684529091528120549294509092506101786004828587610b9d565b61018191610c2d565b90506001600160e01b03198116635194544760e01b14806101b257506001600160e01b0319811663b68df16d60e01b145b1561021257863587016020808901358901908101903560006101d88689898787876102bb565b9050801561020157604051633b755d2d60e21b8152600160048201526024015b60405180910390fd5b6000985050505050505050506102a4565b636581952160e11b6001600160e01b031982160161028857863587016020818101913590898101358a0190810190356000610252878a8a888888886104ed565b9050801561027657604051633b755d2d60e21b8152600160048201526024016101f8565b600099505050505050505050506102a4565b604051633b755d2d60e21b8152600060048201526024016101f8565b95945050505050565b60005b979650505050505050565b600080635194544760e01b6102d3600483898b610b9d565b6102dc91610c2d565b6001600160e01b03191614905060006102f86020870187610c5d565b6001600160a01b0316148061033a57506103156020860186610c5d565b6001600160a01b031661032c60246010898b610b9d565b61033591610c78565b60601c145b6103565760405162461bcd60e51b81526004016101f890610cab565b801561039b57604085013561036f60446024898b610b9d565b61037891610bc7565b11156103965760405162461bcd60e51b81526004016101f890610cef565b61041b565b60016103ad60a0870160808801610d5d565b60018111156103be576103be610d38565b1461041b5760405162461bcd60e51b815260206004820152602760248201527f53657373696f6e4b657956616c696461746f723a206f7065726174696f6e206d6044820152660d2e6dac2e8c6d60cb1b60648201526084016101f8565b366000808361042b57602461042e565b60445b808b01358b01602481019450600401359250905061044d83838a6106c7565b6104695760405162461bcd60e51b81526004016101f890610d78565b6104cd878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040518f92506104b291508c90602001610e68565b60405160208183030381529060405280519060200120610950565b6104de5760019450505050506104e3565b505050505b9695505050505050565b6000600487810135880160248101910135825b818110156106b9573683838381811061051b5761051b610f28565b905060200281019061052d9190610f3e565b90503689898481811061054257610542610f28565b90506020028101906105549190610f5e565b905060006105656020830183610c5d565b6001600160a01b031614806105a357506105826020820182610c5d565b6001600160a01b03166105986020840184610c5d565b6001600160a01b0316145b6105bf5760405162461bcd60e51b81526004016101f890610cab565b6040810135602083013511156105e75760405162461bcd60e51b81526004016101f890610cef565b6105fd6105f76040840184610be6565b836106c7565b6106195760405162461bcd60e51b81526004016101f890610d78565b61069288888581811061062e5761062e610f28565b90506020028101906106409190610f74565b80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508e836040516020016104b29190610e68565b6106a4576001955050505050506102b0565b505080806106b190610fd4565b915050610500565b505050979650505050505050565b60006106d96040830160208401610fed565b6001600160e01b0319166106f1600460008688610b9d565b6106fa91610c2d565b6001600160e01b0319161461071157506000610949565b60005b6107216060840184611008565b905081101561094357366107386060850185611008565b8381811061074857610748610f28565b60600291909101915060009050868661076384356004611051565b9061077085356004611051565b61077b906020611051565b9261078893929190610b9d565b61079191610bc7565b905060006107a56040840160208501611064565b60058111156107b6576107b6610d38565b1480156107c7575081604001358114155b156107d85760009350505050610949565b60016107ea6040840160208501611064565b60058111156107fb576107fb610d38565b14801561080c575081604001358111155b1561081d5760009350505050610949565b600261082f6040840160208501611064565b600581111561084057610840610d38565b148015610851575081604001358110155b156108625760009350505050610949565b60036108746040840160208501611064565b600581111561088557610885610d38565b1480156108955750816040013581105b156108a65760009350505050610949565b60046108b86040840160208501611064565b60058111156108c9576108c9610d38565b1480156108d95750816040013581115b156108ea5760009350505050610949565b60056108fc6040840160208501611064565b600581111561090d5761090d610d38565b14801561091d5750816040013581145b1561092e5760009350505050610949565b5050808061093b90610fd4565b915050610714565b50600190505b9392505050565b600083511561098b5760208401845160051b81015b8151841160051b9384528151602094851852604060002093909101908082106109655750505b5014919050565b80356001600160a01b03811681146109a957600080fd5b919050565b60008083601f8401126109c057600080fd5b50813567ffffffffffffffff8111156109d857600080fd5b6020830191508360208285010111156109f057600080fd5b9250929050565b60008060008060608587031215610a0d57600080fd5b610a1685610992565b935060208501359250604085013567ffffffffffffffff811115610a3957600080fd5b610a45878288016109ae565b95989497509550505050565b600080600080600060808688031215610a6957600080fd5b610a7286610992565b945060208601359350604086013567ffffffffffffffff80821115610a9657600080fd5b90870190610160828a031215610aab57600080fd5b90935060608701359080821115610ac157600080fd5b50610ace888289016109ae565b969995985093965092949392505050565b600080600080600080600060c0888a031215610afa57600080fd5b610b0388610992565b9650610b1160208901610992565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff811115610b4257600080fd5b610b4e8a828b016109ae565b989b979a50959850939692959293505050565b600080600060608486031215610b7657600080fd5b610b7f84610992565b925060208401359150610b9460408501610992565b90509250925092565b60008085851115610bad57600080fd5b83861115610bba57600080fd5b5050820193919092039150565b80356020831015610be057600019602084900360031b1b165b92915050565b6000808335601e19843603018112610bfd57600080fd5b83018035915067ffffffffffffffff821115610c1857600080fd5b6020019150368190038213156109f057600080fd5b6001600160e01b03198135818116916004851015610c555780818660040360031b1b83161692505b505092915050565b600060208284031215610c6f57600080fd5b61094982610992565b6bffffffffffffffffffffffff198135818116916014851015610c555760149490940360031b84901b1690921692915050565b60208082526024908201527f53657373696f6e4b657956616c696461746f723a20746172676574206d69736d6040820152630c2e8c6d60e31b606082015260800190565b60208082526029908201527f53657373696f6e4b657956616c696461746f723a2076616c7565206c696d697460408201526808195e18d95959195960ba1b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b8035600281106109a957600080fd5b600060208284031215610d6f57600080fd5b61094982610d4e565b60208082526033908201527f53657373696f6e4b657956616c696461746f723a207065726d697373696f6e206040820152721d995c9a599a58d85d1a5bdb8819985a5b1959606a1b606082015260800190565b80356001600160e01b0319811681146109a957600080fd5b8035600681106109a957600080fd5b8183526000602080850194508260005b85811015610e495781358752610e19838301610de3565b60068110610e2957610e29610d38565b878401526040828101359088015260609687019690910190600101610e02565b509495945050505050565b60028110610e6457610e64610d38565b9052565b602081526001600160a01b03610e7d83610992565b16602082015263ffffffff60e01b610e9760208401610dcb565b1660408201526040820135606082015260006060830135601e19843603018112610ec057600080fd5b830160208101903567ffffffffffffffff811115610edd57600080fd5b606081023603821315610eef57600080fd5b60a06080850152610f0460c085018284610df2565b915050610f1360808501610d4e565b610f2060a0850182610e54565b509392505050565b634e487b7160e01b600052603260045260246000fd5b60008235605e19833603018112610f5457600080fd5b9190910192915050565b60008235609e19833603018112610f5457600080fd5b6000808335601e19843603018112610f8b57600080fd5b83018035915067ffffffffffffffff821115610fa657600080fd5b6020019150600581901b36038213156109f057600080fd5b634e487b7160e01b600052601160045260246000fd5b600060018201610fe657610fe6610fbe565b5060010190565b600060208284031215610fff57600080fd5b61094982610dcb565b6000808335601e1984360301811261101f57600080fd5b83018035915067ffffffffffffffff82111561103a57600080fd5b60200191506060810236038213156109f057600080fd5b80820180821115610be057610be0610fbe565b60006020828403121561107657600080fd5b61094982610de356",
"nonce": "0x1d4"
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [],
"libraries": [],
"pending": [
"0x7d2de72251685ec4f433d6479f844c3c688ae894be1a06def804adfb55afc9c6"
],
"returns": {},
"timestamp": 1707741950,
"chain": 80001,
"multi": false,
"commit": "1bc0841"
}
Loading

0 comments on commit 633e4ea

Please sign in to comment.