Skip to content

Commit

Permalink
Feat/body parsing (#45)
Browse files Browse the repository at this point in the history
* Use ether-email-auth for body parsing

* Replace "subject" with "command"

* Enable test on any branch

* chore: update .env.example

* Update ether-email-auth

* Update ether-email-auth

* Update ether-email-auth

* Update ether-email-auth

* Import ether-email-auth as npm package

* Add EmailRecoveryManagerZkSync

* Update version

* Fix EmailRecoveryManagerZkSync

* Fix renaming

* Fix remapping

* Fix EmailRecoveryManagerZkSync

* Fix README to replace "subject" with "command".

* fix compile warnings & format

* extract more logic to base test & rename variables

* remove unnecessary vm.prank

* Add more logic to base test & more linting

* Remove email-wallet-sdk

* Update package version

* Add how to debug errors to README

* Fix readme

* Add a CREATE2_SALT argument to DeploySafeRecovery script

* add guardian vote check & recovery hash to weight storage WIP

* Improve RecoveryRequest

* Fix all unit tests

* Feat/script tests (#49)

* Remove email-wallet-sdk

* Update package version

* Update README

* Update pnpm commands

* Add tests for scripts

* Add threads = 1 to foundry.toml

* Prevent malicious guardians threatening liveness via cooldown

* Uncomment all test assertions & use EnumerableSet

* Update processRecovery tests

* Add remaining tests from TODOs & add getter fn

* Update existing assertions with new state

* Add getAllGuardians getter function

* Make getter function view

* 10 Critical events are not observable

* Return false for canStartRecoveryRequest when threshold is zero

* Update ether-email-auth

* Update package version

* 10. EmailRecoveryContract is not compatible with zkSync

* clearRecoveryRequest properly in deinit

* Update ether-email-auth-contracts

* Update version to 0.0.10

* Update natpsec

* test-nexus-account

* Run tests with different command handlers

* Rename

* Add fuzz tests for hexToBytes32 unit tests

* Add tests for AccountHidingRecoveryCommandHandler

* Add safe module unit tests

* fuzz test getPreviousOwnerInLinkedList

* Add missing low risk functions

* Add script for account hiding

* Add the section which is how to solve errrors

* Use ForwardDKIMRegistry

* Remove ForwardDKIMRegistry

* Fix failing tests

* revert to all github workflows without nexus account

* 13 EmailRecoveryManager delay can be set to zero

* Fix failing test

* Fix lock file

* Recover lock file

* Change workflow

* Fix MockGroth16Verifier

* Update depndency

* Specify npm package of ether-email-auth

* Use salt value for deployment (#55)

* Use salt value for deployment

* Add minimumDelay

* Add CREATE2_SALT value into all deploy scripts

* Update depndencies

* Fix bug from updating modulekit

* Use StringUtils from ether-email-auth

* 0.0.12-preview

* 0.0.12

* Add kill switch functionality (#58)

* Add support section (#57)

* update @zk-email/ether-email-auth-contracts

* Update scripts

* Update scripts

* Fix script

* Fix script

* Add a new script

---------

Co-authored-by: Aditya Bisht <[email protected]>
Co-authored-by: JohnGuilding <[email protected]>
Co-authored-by: wshino <[email protected]>
Co-authored-by: John Guilding <[email protected]>
  • Loading branch information
5 people authored Nov 3, 2024
1 parent f7db679 commit dae2bf3
Show file tree
Hide file tree
Showing 166 changed files with 8,061 additions and 4,434 deletions.
14 changes: 11 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
BASE_SEPOLIA_RPC_URL=
PRIVATE_KEY=
BASE_SCAN_API_KEY=
LOCALHOST_RPC_URL=
SEPOLIA_RPC_URL=
MAINNET_RPC_URL=

PRIVATE_KEY=""
CHAIN_ID=
RPC_URL=""
DKIM_SIGNER=0x6293a80bf4bd3fff995a0cab74cbf281d922da02 # Signer for the dkim oracle on IC
ETHERSCAN_API_KEY=

CREATE2_SALT=1234
8 changes: 3 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,26 @@ name: test

on:
push:
branches:
- main
pull_request:

env:
FOUNDRY_PROFILE: ci

jobs:
build:
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-build.yaml@15f6d25eb382057ce7c513de7f38f4b6bca49f1d"
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-build.yaml@main"

test-multi-account:
needs: ["build"]
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-test-multi-account.yaml@15f6d25eb382057ce7c513de7f38f4b6bca49f1d"
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-test-multi-account.yaml@main"
with:
foundry-fuzz-runs: 5000
foundry-profile: "test"
match-path: "test/**/*.sol"

test-simulate:
needs: ["build"]
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-test-simulate.yaml@15f6d25eb382057ce7c513de7f38f4b6bca49f1d"
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-test-simulate.yaml@main"

with:
foundry-fuzz-runs: 5000
Expand Down
3 changes: 2 additions & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"not-rely-on-time": "off",
"one-contract-per-file": "off",
"var-name-mixedcase": "off",
"immutable-vars-naming": "off"
"immutable-vars-naming": "off",
"no-console": "warn"
}
}
4 changes: 1 addition & 3 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
node_modules/
test/
script/
node_modules/
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"solidity.compileUsingRemoteVersion": "v0.8.25+commit.b61c2a91",
"solidity.formatter": "forge"
"solidity.formatter": "forge",
"solidity.packageDefaultDependenciesDirectory": "node_modules"
}
182 changes: 127 additions & 55 deletions README.md

Large diffs are not rendered by default.

16 changes: 4 additions & 12 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,18 @@ emv_version = "paris"
src = "src"
out = "out"
script = "script"
libs = [
"node_modules",
"lib",
]
libs = ["node_modules", "lib"]
fs_permissions = [
{ access = "read", path = "out-optimized" },
{ access = "read-write", path = "gas_calculations" },
]
allow_paths = [
"*",
"/",
]
allow_paths = ["*", "/"]
ignored_warnings_from = [
"node_modules",
"node_modules/@rhinestone/modulekit/src/**/*.sol",
"lib",
]

threads = 1
[rpc_endpoints]
sepolia = "${BASE_SEPOLIA_RPC_URL}"

Expand All @@ -36,6 +30,4 @@ number_underscore = "thousands"
quote_style = "double"
tab_width = 4
wrap_comments = true
ignore = [
"./src/libraries/L2ContractHelper.sol",
]
ignore = ["./src/libraries/L2ContractHelper.sol"]
31 changes: 18 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zk-email/email-recovery",
"version": "0.0.1",
"version": "0.0.12",
"description": "Smart account module and related contracts to enable email recovery for validators",
"license": "MIT",
"author": {
Expand All @@ -10,29 +10,34 @@
"scripts": {
"build": "forge build",
"build:optimized": "FOUNDRY_PROFILE=optimized forge build",
"build:smt": "FOUNDRY_PROFILE=smt forge build",
"clean": "rm -rf artifacts broadcast cache docs out out-optimized out-svg",
"gas:report": "forge test --gas-report --mp \"./test/integration/**/*.sol\" --nmt \"test(Fuzz)?_RevertWhen_\\w{1,}?\"",
"gas:snapshot": "forge snapshot --mp \"./test/integration/**/*.sol\" --nmt \"test(Fuzz)?_RevertWhen_\\w{1,}?\"",
"gas:snapshot:optimized": "pnpm run build:optimized && FOUNDRY_PROFILE=test-optimized forge snapshot --mp \"./test/integration/**/*.sol\" --nmt \"test(Fork)?(Fuzz)?_RevertWhen_\\w{1,}?\"",
"lint": "pnpm run lint:sol && bun run prettier:check",
"lint:sol": "forge fmt --check && pnpm solhint \"{script,src,test}/**/*.sol\"",
"gas:report": "forge test --gas-report --mp \"./test/integration/**/*.sol\"",
"gas:snapshot": "forge snapshot --mp \"./test/integration/**/*.sol\"",
"gas:snapshot:optimized": "pnpm run build:optimized && FOUNDRY_PROFILE=test-optimized forge snapshot --mp \"./test/integration/**/*.sol\"",
"lint": "forge fmt --check && pnpm solhint \"{script,src,test}/**/*.sol\"",
"prepack": "pnpm install",
"prettier:check": "prettier --check \"**/*.{json,md,svg,yml}\"",
"prettier:write": "prettier --write \"**/*.{json,md,svg,yml}\"",
"test": "forge test",
"test": " COMMAND_HANDLER_TYPE=0 forge test --match-path \"test/**/*.sol\"",
"test:email-recovery-command-handler": "COMMAND_HANDLER_TYPE=0 forge test --match-path \"test/**/*.sol\" ",
"test:address-hiding-command-handler": "COMMAND_HANDLER_TYPE=1 forge test --match-path \"test/**/*.sol\"",
"test:safe-email-recovery-command-handler": "ACCOUNT_TYPE=SAFE COMMAND_HANDLER_TYPE=0 forge test --match-path \"test/**/*.sol\" ",
"test:safe-address-hiding-command-handler": "ACCOUNT_TYPE=SAFE COMMAND_HANDLER_TYPE=1 forge test --match-path \"test/**/*.sol\"",
"test:safe-recovery-command-handler": "ACCOUNT_TYPE=SAFE COMMAND_HANDLER_TYPE=2 forge test --match-path \"test/**/*.sol\"",
"test:all": "pnpm test:email-recovery-command-handler && pnpm test:address-hiding-command-handler && pnpm test:safe-recovery-command-handler",
"test:all-safe": "pnpm test:safe-email-recovery-command-handler && pnpm test:safe-address-hiding-command-handler && pnpm test:safe-recovery-command-handler",
"test:script": "forge test --match-path script/test/**/*.sol --threads 1",
"test:lite": "FOUNDRY_PROFILE=lite forge test",
"test:optimized": "pnpm run build:optimized && FOUNDRY_PROFILE=test-optimized forge test"
},
"dependencies": {
"@matterlabs/era-contracts": "github:matter-labs/era-contracts",
"@openzeppelin/contracts-upgradeable": "v5.0.1",
"@openzeppelin/contracts-upgradeable": "5.0.1",
"@rhinestone/modulekit": "github:rhinestonewtf/modulekit",
"@zk-email/contracts": "v6.0.3",
"email-wallet-sdk": "github:zkemail/email-wallet-sdk",
"@zk-email/contracts": "^6.3.1",
"@zk-email/ether-email-auth-contracts": "1.0.0",
"erc7579-implementation": "github:erc7579/erc7579-implementation",
"ether-email-auth": "github:zkemail/ether-email-auth#b5694a9e0e49d07a862232f665dc4d0886c5a15f",
"solidity-stringutils": "github:Arachnid/solidity-stringutils"
"solidity-stringutils": "github:LayerZero-Labs/solidity-stringutils"
},
"files": [
"src",
Expand Down
Loading

0 comments on commit dae2bf3

Please sign in to comment.