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 ToposCore upgrade script #123

Merged
merged 1 commit into from
Feb 6, 2024
Merged

feat: add ToposCore upgrade script #123

merged 1 commit into from
Feb 6, 2024

Conversation

JDawg287
Copy link
Member

@JDawg287 JDawg287 commented Jan 31, 2024

Description

This Pull Request introduces a TypeScript script that allows us to upgrade the logic contract of ToposCore.sol. This is necessary because when there is a newer version of ToposCore.sol, we need a method to switch to this updated version.

This upgrade process maintains the integrity of the ToposCore's proxy contract, ensuring that all storage slots are preserved.

Fixes TP-850

Additions and Changes

  • Adds the upgrade-topos-core.ts script

Usage

Prerequisites

On a running network, have the following:

  • ToposCoreProxy contract deployed
  • ToposCore implementation contract deployed
  • ToposCoreProxy initialized with the implementation contract's address
  • ConstAddressDeployer contract deployed
  • The PRIVATE_KEY env variable set (private key of the deployer account)

Run the script

To run the script run the following command:

npx ts-node ./scripts/upgrade-topos-core <providerEndpoint> <sequencerPrivateKey> <toposCoreProxyAddress> <gasLimit>

# Example:
npx ts-node ./scripts/upgrade-topos-core http://127.0.0.1:20002 0xe5d53f73cc87a9f3a7230495d14f87cb913a4812ccd4935aff4c5bbccf625e97 0xA72935F69ff442a8FEC503e4bd6c4084372154C3 5000000

PR Checklist:

  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added or updated tests that comprehensively prove my change is effective or that my feature works

@JDawg287 JDawg287 self-assigned this Jan 31, 2024
@sebastiendan
Copy link
Member

Tested successfully this day with https://github.com/topos-protocol/subnet-ansible/pull/26 with the following plan:

  • Deployed topos 0.0.11-rc.9 and contracts 3.0.0 on devnet-1
  • Used ERC20Messaging to have a certificate imported on Topos's ToposCore contract
  • Deployed contracts pr-123 as a softfork on both subnets
  • Tested with a local script fetching the same certificate imported earlier => found

@sebastiendan sebastiendan merged commit 1646353 into main Feb 6, 2024
18 checks passed
@sebastiendan sebastiendan deleted the feat/tp-850 branch February 6, 2024 13:47
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