-
Notifications
You must be signed in to change notification settings - Fork 29
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
✨[API-2348] Make Contracts Upgradeable #81
Conversation
WalkthroughThe changes across the contracts involve introducing upgradeability to the CosmWasm contracts. This is achieved by adding a Changes
Assessment against linked issues
PoemIn the blockchain's burrow, deep and wide, Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 10
Configuration used: CodeRabbit UI
Files ignored due to filter (12)
- Cargo.lock
- Cargo.toml
- contracts/adapters/ibc/ibc-hooks/Cargo.toml
- contracts/adapters/ibc/neutron-transfer/Cargo.toml
- contracts/adapters/swap/astroport/Cargo.toml
- contracts/adapters/swap/lido-satellite/Cargo.toml
- contracts/adapters/swap/osmosis-poolmanager/Cargo.toml
- contracts/entry-point/Cargo.toml
- schema/skip-api-entry-point.json
- scripts/configs/neutron.toml
- scripts/configs/osmosis.toml
- scripts/configs/terra.toml
Files selected for processing (10)
- contracts/adapters/ibc/ibc-hooks/src/contract.rs (1 hunks)
- contracts/adapters/ibc/neutron-transfer/src/contract.rs (1 hunks)
- contracts/adapters/swap/astroport/src/contract.rs (1 hunks)
- contracts/adapters/swap/lido-satellite/src/contract.rs (1 hunks)
- contracts/adapters/swap/osmosis-poolmanager/src/contract.rs (2 hunks)
- contracts/entry-point/src/contract.rs (1 hunks)
- packages/skip/src/entry_point.rs (1 hunks)
- packages/skip/src/ibc.rs (1 hunks)
- packages/skip/src/swap.rs (1 hunks)
- scripts/deploy.py (14 hunks)
Additional comments: 15
contracts/entry-point/src/contract.rs (2)
31-32: Using environment variables to set
CONTRACT_NAME
andCONTRACT_VERSION
is a standard practice and is correctly implemented here.42-42: The invocation of
set_contract_version
within theinstantiate
function is correct and necessary for contract versioning.contracts/adapters/swap/lido-satellite/src/contract.rs (2)
37-38: Using environment variables to set
CONTRACT_NAME
andCONTRACT_VERSION
is a standard practice and is correctly implemented here.48-48: The invocation of
set_contract_version
within theinstantiate
function is correct and necessary for contract versioning.contracts/adapters/ibc/neutron-transfer/src/contract.rs (1)
- 34-47: Setting the contract version using
CONTRACT_NAME
andCONTRACT_VERSION
derived from environment variables is a good practice for maintaining contract versioning. This change is well-implemented.contracts/adapters/ibc/ibc-hooks/src/contract.rs (1)
- 38-51: Setting the contract version using
CONTRACT_NAME
andCONTRACT_VERSION
derived from environment variables is a good practice for maintaining contract versioning. This change is well-implemented.contracts/adapters/swap/osmosis-poolmanager/src/contract.rs (1)
- 39-52: Setting the contract version using
CONTRACT_NAME
andCONTRACT_VERSION
derived from environment variables is a good practice for maintaining contract versioning. This change is well-implemented.scripts/deploy.py (7)
4-18: The removal of imports such as
b64decode
,create_cosmwasm_execute_msg
, andCoin
suggests refactoring or removal of functionality that used these imports. Ensure that the removal of these imports does not affect any other parts of the script that may rely on them.40-42: Improved error message for missing configuration is a good practice for clarity and debugging.
68-70: The addition of an explicit exception for unspecified network configuration (
mainnet
ortestnet
) enhances the robustness of the script.86-87: The addition of
ADMIN_ADDRESS
in the script is crucial for managing contract migrations and aligns with the PR's objective to make contracts upgradeable.295-311: The
instantiate_contract
function correctly sets theadmin
field to theADMIN_ADDRESS
, aligning with the upgradability feature.323-350: The
instantiate2_contract
function has been introduced, which includes asalt
parameter for deterministic contract creation. Ensure that the use ofsalt
andfix_msg
parameters are well-documented and tested, as they are critical for the deterministic creation of contracts.382-388: The
broadcast_tx
function now includes a delay and a GET request to check the transaction status, which is a good practice to ensure the transaction was processed before proceeding.contracts/adapters/swap/astroport/src/contract.rs (1)
- 41-54: The contract's instantiation now includes setting the contract version using
set_contract_version
, which is a necessary step for enabling contract migrations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- scripts/deploy.py (14 hunks)
Files skipped from review as they are similar to previous changes (1)
- scripts/deploy.py
|
||
#[cfg_attr(not(feature = "library"), entry_point)] | ||
pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> ContractResult<Response> { | ||
unimplemented!() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this not block the upgrade by panicking? Don't you want to just return successfully here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migrations work using the migration code of the new contract you are migrating to, not of the deployed contract. So when we instantiate all the contracts currently in the repo, they will all deploy without ever calling their migrate functions. But then if we want to upgrade a contract in the future, we will do so by implementing that contract's migrate function, store that code on chain, and then submit the MigrateMsg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tldr: we only implement the migrate function when we are doing a migration/upgrade, but can keep them unimplemented on normal deploys.
This PR
Makes the contracts upgradable by:
Notes
Summary by CodeRabbit
New Features
Refactor
Documentation