Skip to content

Upgradable TEE contracts#41

Merged
Sneh1999 merged 3 commits intomainfrom
upgradable-espresso-tee-contracts
Jan 27, 2026
Merged

Upgradable TEE contracts#41
Sneh1999 merged 3 commits intomainfrom
upgradable-espresso-tee-contracts

Conversation

@Sneh1999
Copy link
Copy Markdown
Contributor

@Sneh1999 Sneh1999 commented Jan 23, 2026

Description

  • This PR adds support for upgradable Espresso TEE Verifier contracts, it uses TransparentProxy pattern from Openzeppelin
  • It also makes all owner only functions callable from the Espresso TEE Verifier contract directly and removes the need to add owners in the SGX and nitro contract directly

@Sneh1999 Sneh1999 requested a review from Copilot January 23, 2026 21:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR upgrades the TEE contracts to use the upgradeable proxy pattern. The main contracts (EspressoTEEVerifier, EspressoSGXTEEVerifier, EspressoNitroTEEVerifier, and TEEHelper) are converted to use OpenZeppelin's upgradeable contracts with TransparentUpgradeableProxy pattern. Authorization is now centralized through a TEE verifier address instead of individual contract owners.

Changes:

  • Contracts converted to use upgradeable initialization pattern with initialize() functions instead of constructors
  • Storage moved to namespaced storage slots to avoid storage collisions
  • Authorization changed from owner-based to TEE verifier-based for helper contracts
  • Tests updated to deploy contracts via proxy and test initialization behavior

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/TEEHelper.t.sol New test file for TEEHelper upgradeable initialization
test/MultiSigTransfer.t.sol Updated deployment to use proxies and removed individual helper ownership tests
test/EspressoTEEVerifier.t.sol Updated to deploy via proxy with placeholder addresses and test passthrough admin functions
test/EspressoSGXTEEVerifier.t.sol Updated to use proxy deployment and test TEE verifier authorization
test/EspressoNitroTEEVerifier.t.sol Updated to use proxy deployment and test TEE verifier authorization
src/interface/ITEEHelper.sol Added authorization errors and TEE verifier events/functions
src/interface/IEspressoTEEVerifier.sol Added admin passthrough functions and error for invalid verifier
src/TEEHelper.sol Converted to upgradeable with namespaced storage and TEE verifier authorization
src/EspressoTEEVerifier.sol Converted to upgradeable and added admin passthrough functions
src/EspressoSGXTEEVerifier.sol Converted to upgradeable with TEE verifier authorization
src/EspressoNitroTEEVerifier.sol Converted to upgradeable with TEE verifier authorization
scripts/MultiSigTransfer.s.sol Simplified to only handle TEE verifier ownership (helpers no longer independently owned)
remappings.txt Added mapping for upgradeable contracts
lib/openzeppelin-contracts-upgradeable Updated to v5.5.0
foundry.lock Updated lock file with new versions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/EspressoTEEVerifier.t.sol
Comment thread test/EspressoSGXTEEVerifier.t.sol
Comment thread test/EspressoNitroTEEVerifier.t.sol
Comment thread src/interface/ITEEHelper.sol
Copy link
Copy Markdown
Member

@jjeangal jjeangal left a comment

Choose a reason for hiding this comment

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

Overall looks good to me! My only general comment would be with regards to function and variables naming to have a better initial understanding.

@philippecamacho
Copy link
Copy Markdown
Contributor

Do we need to update the deployment scripts ?

@philippecamacho
Copy link
Copy Markdown
Contributor

philippecamacho commented Jan 27, 2026

TEEHelper.sol is using ERC-7201 for declaring the storage variables, while Espresso***TEEVerifier don't. It feels like this is going to create complications when upgrading if we had variables. Could we using ERC-7201 everywhere? cc @alysiahuggins who has experience with these issues.

@Sneh1999
Copy link
Copy Markdown
Contributor Author

Do we need to update the deployment scripts ?

I will work on it, in another PR!

@Sneh1999
Copy link
Copy Markdown
Contributor Author

TEEHelper.sol is using ERC-7201 for declaring the storage variables, while Espresso***TEEVerifier don't. It feels like this is going to create complications when upgrading if we had variables. Could we using ERC-7201 everywhere? cc @alysiahuggins who has experience with these issues.

I will just add it to all contracts shouldnt be an issue!

Copy link
Copy Markdown
Contributor

@philippecamacho philippecamacho left a comment

Choose a reason for hiding this comment

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

LGTM

@Sneh1999 Sneh1999 merged commit d6d91f0 into main Jan 27, 2026
3 checks passed
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.

4 participants