Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/update deployment logic using factory #52

Merged

Conversation

wshino
Copy link
Contributor

@wshino wshino commented Aug 28, 2024

  • Update zkey and wasm
  • Integration testing using foundry
  • Integration testing using foundry zksync
  • Update docs for integration testing using foundry zksync
  • Implement EmailAccountRecoveryZkSync
  • Implement RecoveryControllerZkSync
  • Divide test cases

// console.log("emailAuthProxy.controller() %s", emailAuthProxy.controller());
// vm.stopBroadcast();
// }
// }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is fully commented out, please remove this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why I commented out is it needs for via-ir option when we compile contracts directory.
This is the script that checks deployed address and computeAddress are the same address. And it checks deployedAddress has been initialized correctly.
I think we should keep this script for future use.

Copy link
Contributor

@SoraSuegami SoraSuegami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think EmailAccountRecovery should have a new argument/storage factory and introduce a struct ZKSyncCreate2Factory only for zksync.
How about the following approach?

  1. The EmailAccountRecovery abstract contract has two virtual functions deployProxy and computeProxyAddress. Their default implementations simply call new ERC1967Proxy and Create2.computeAddress, respectively.
  2. We additionally define an abstract contract EmailAccountRecoveryZksync, which inherits EmailAccountRecovery and overwrites deployProxy and computeProxyAddress.

@wshino
Copy link
Contributor Author

wshino commented Sep 9, 2024

@SoraSuegami I agree with your opinion. In that case do we add test cases and deployment scripts for EmailAccountRecoveryZksync? (and RecoveryControllerZksync too)

@SoraSuegami
Copy link
Contributor

Yes, we need tests and scripts for both.

@@ -124,45 +110,49 @@ abstract contract EmailAccountRecovery {
/// @param recoveredAccount The address of the account to be recovered.
/// @param accountSalt A bytes32 salt value defined as a hash of the guardian's email address and an account code. This is assumed to be unique to a pair of the guardian's email address and the wallet address to be recovered.
/// @return address The computed address.
function computeEmailAuthAddress(
function computeProxyAddress(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you replace computeEmailAuthAddress with computeProxyAddress , could you name this function computeEmailAuthAddress?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SoraSuegami Does that mean we leave the function name as computeEmailAuthAddress ?

/// @param recoveredAccount The address of the account to be recovered.
/// @param accountSalt A bytes32 salt value used to ensure the uniqueness of the deployed proxy address.
/// @return address The address of the newly deployed proxy contract.
function deployProxy(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, could you rename it to deployEmailAuthProxy?
This function should be private/internal function.

@@ -251,15 +251,22 @@ Next, you should uncomment the following lines in `foundry.toml`.
# via-ir = true
```

And then you should uncomment the commented imports and functions in `src/utils/ZKSyncCreate2Factory.sol`
Uncomment the following commented-out files.
These are commented out in the files for ZkSync to avoid problems when testing in foundry.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to avoid commenting out those zksync files by adding an option to the command of yarn build that excludes zksync files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SoraSuegami Maybe we can use --skip flag, let me try it.

@SoraSuegami SoraSuegami merged commit 7fee48a into feat/audit-fix-2024-08 Sep 10, 2024
4 checks passed
SoraSuegami added a commit that referenced this pull request Sep 10, 2024
* Audit fixes for circuits

* Update verifier for the new circuit

* Fix maskedSubject attack vector and timestamp bug

* Allow lower/uppercases address in the subject

* Fix typo.

* Add test case to check "invalid masked subject length" and "invalid size of the skipped subject prefix".

* Add range check to Digit2Int

* Add comments about an email address in the subject.

* Update snarkjs version

* Add idx validations to the circuit

* Change range of LessThan

* Update zk-email circuit version

* Optimize regex_out in the circuit

* Fix lastTimestamp update logic

* Fix commented out codes

* feat: update api

* Fix inactive_guardian api

* Fix inactive_guardian

* fix: patch db query

* Add python logger

* Revert "Add python logger"

This reverts commit 92be537.

* Logger in the prover worked (#54)

* Update prover version

* Logger in the prover worked

* Update dependencies

* Fix the versions of circuit dependencies

* Fix relayer-utils version

* Update verifier

* Update proving key

* Fix integration test on base sepolia

* feat: update api

* Update prover address.

* Fix requirements

* feat: update api

* Feature/update deployment logic using factory (#52)

* Add ZKSyncCreate2Factory, EmailAccountRecovery test casees split by function.

* Failed: update integration testing with foundry-zksync.

* Update integration testing command with foundry-zksync.

* Failed: update integration testing with foundry.

* Add DeployEmailAuthWithCreate2.s.sol.

* Disable DeployEmailAuthWIthCreate2.s.sol.

* Fix integration test for foundry

* Fail: integration testing for foundry zksync.

* Fix integration testing for foundry zksync

* Tweak README.md

* Add EmailAccountRecoveryZkSync

* Uncomment some contracts which are used for foundry zksync

* make deployEmailAuthProxy as internal function

* Update yarn build, yarn test

* Remove specific foundry version

* Update foundry version

* chore: git rm --cached

* chore: Update after git rm --cached

* chore: git rm --cached

* chore: Update after git rm --cached

* Fix build-test-fmt on github action

* Rename DeployEmailAuthWIthCreate2

* Update deployment files in docs

---------

Co-authored-by: wshino <[email protected]>
Co-authored-by: Aditya Bisht <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants