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

feat: add proxy and deployment scripts #70

Merged
merged 22 commits into from
Dec 9, 2024
Merged

feat: add proxy and deployment scripts #70

merged 22 commits into from
Dec 9, 2024

Conversation

mariocao
Copy link
Member

@mariocao mariocao commented Dec 6, 2024

Motivation

This PR introduces UUPS (Universal Upgradeable Proxy Standard) proxy pattern support to improve the upgradeability of our smart contracts. This change also led us to consider storage slots (in detriment of gaps) and update many things such as the deployment scripts.

Explanation of Changes

The main changes include:

  1. Implementation of UUPS proxy pattern:

    • Added ISedaCore interface for better contract interaction
    • Implemented storage slots in RequestHandlerBase for consistent storage management
    • Added support for UUPS proxy in core contracts
    • Disabled initializers in constructors for security
  2. Chores:

    • Added Prettier as Solidity formatter
    • Remove Ignition deployment modules because it lacks "native" support for UUPS
    • Restructured deployment tasks with reset functionality
    • Improved parameter file validation
  3. Storage and Request Handling:

    • Refactored storage internal functions
    • Updated request handling to use getRequest from RequestHandlerBase
    • Implemented proper storage slot management

Testing

Tests covered:

  • New UUPS deployment approach
  • Proxy upgrades with mocked V2 implementations

Related PRs and Issues

Also make the deployProxyContract task typed, so it's more explicit
about the contracts we're supporting and what constructor arguments they
need.
@mariocao mariocao requested review from jasperdg and a team December 6, 2024 22:46
@mariocao mariocao marked this pull request as ready for review December 6, 2024 22:46
@mariocao mariocao changed the title feat: add proxy and other stuff feat: add proxy and deployment scripts Dec 6, 2024
Copy link

@gluax gluax left a comment

Choose a reason for hiding this comment

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

LGTM, a question and typescript nit.

SedaDataTypes.RequestInputs calldata inputs
) public override(RequestHandlerBase) whenNotPaused returns (bytes32) {
// Check max replication factor first
if (inputs.replicationFactor > maxReplicationFactor) {
Copy link

Choose a reason for hiding this comment

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

Do we need this check here/is there a reason to have an additional limit here? I understand the need for a lot of duplicate data on the contract, but this one seems weird to me?

The chain core contract already checks RF cannot be greater than number of executors. Just seems like extra unneeded/maintenance, but ig could be good to show you can do it as a reference implementation that you can limit the RF here as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right. However we are deprecating the SedaCorePermissioned, sot his contract will become most likely like a contract to test deployments.

Comment on lines +1 to +3
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
import * as readline from 'node:readline';
Copy link

Choose a reason for hiding this comment

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

Maybe a nit, if we are using Bun I think it would be preferable to use the Bun API over the node one's where possible. Bun doesn't have replacements for everything yet, but for some it does. Bun.file for example.

Copy link

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

What's nice about using the node APIs is that if people check out this repo and use node instead of bun like we recommend it will still work. Given how flexible the core prover contracts are there's a fair chance that people will fork this to tweak it and using the node APIs doesn't hurt us :)

@mariocao mariocao merged commit f816df5 into main Dec 9, 2024
1 check passed
@mariocao mariocao deleted the feat/proxy branch December 9, 2024 19:58
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.

✨ Use a Proxy for SedaCoreV1
4 participants