-
Notifications
You must be signed in to change notification settings - Fork 409
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
During migration from legacy 20 byte address a 'no history for address' error occurs #758
Comments
One potential solution here is to use:
Length assertions could be inserted to require 20 or 32 byte address forms (which are the only two allowed) however if this is done additional refactoring will be required as the methods do not currently return errors and a panic isn't really desirable. As the purpose of this key is to lookup existing cached data ... if the address were invalid here then there would be no data matched so additional validity checks are likely not needed. |
Can you give more context why you need 20 byte contract addresses in your scenario? The contract address is deterministic and based on codeID and contractID. Unfortunately the contractID is not persisted but can be found with some smarter than brute force algorithm for a migration. |
By migration you mean at the contract level right? We will run into this issue on Juno. as well (as I think we have 3-4 length 20 contracts instantiated when the chain first launched. My concern is that if migrations to contracts are required, possibly either the original instantiators won't be contactable, or they won't have set an admin, so the contracts won't be migrate-able. If it's at binary level then that's less of a concern. |
Sorry, |
Right, I did wonder. So in summary if we have 20 byte contract addresses then before moving to mainline wasmd or wasmd 0.23 we would need a migration that ensures every existing contract with a 20 byte address is changed to 32? |
To summarize, I can see these 3 options: A) "upgrade" all contracts to 32 byte addresses and go with vanilla wasmd As mentioned before, C) is not my preferred option as it adds complexity. |
btw @iramiller thanks for bringing this topic up. Happy to see this discussion. |
The contract address is well known and used in several frontend applications... so while we could programmatically shift the state to a new 32 byte address that would break the application dependencies above the blockchain if we modify it. In this case there is a consortium of banks that all agreed on it. Certainly do able but the ask is to avoid that because these kinds of changes take more time than they should. My fears about not supporting the 32 byte form are not well defined but are based on suspicions that future applications over IBC/interchain may see difficulties. By removing the constraint that the address will be 32 in length then existing ones continue to work and all future ones can be the proper 32 byte form. |
Addresses are stored in many places and we cannot change them. Wasmd upgrades must work with immutable contracts.
They don't want 20 bytes. They want 32, but want backwards support for 20 bytes. Note that various components in the sdk (notably ibc) choked on 32 bytes addresses when Provenance and Juno made these choices.
It is more complex for wasmd, but it is needed complexity and part of the follow up from our decision to move to 32 byte contract addresses (which I think everyone on this thread commented on and supported). I agree with @iramiller that we need to support this on the sdk side. I also know that Alex is very busy with Tgrade work right now, but I would ask if there is interest in an external PR to add this as this is a critical fix needed for both your chains. |
👍 to everything in that summary. I'd love to pitch in, but I think my knowledge of the wasmd/SDK internals is likely not up to the task 😞 |
We have a fork with this change which we are running now on our testnet for evaluation... it would be straight forward to contribute this solution... in addition if this solution needs to develop further we are interested in helping out cosmwasm with testing these changes and we would want to see those included in our network before we cut our next release. |
Here is a compare link for what we did to solve this issue. This is the change @iramiller was referring to. |
What is the downside for a fork to just change the Why was this change made to begin with? Can't seem to find an explanation for this |
Originally the sdk assigned 20 byte addresses but a switch to 32 was made for new addresses based on new key types. Existing addresses were maintained. The cosmwasm system is taking this differently with the current implementation breaking all existing contracts when it blocks support for existing addresses. More details here: https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-028-public-key-addresses.md |
@albertchon when preparing the PR to update to 0.45 we had number of discussions of the two teams we knew using forks with 0.45 - Juno and Provenance. You can see the discussion here on a PR proposal from the Juno team. This was also heavily promoted by the Cosmos SDK team. Well before 0.43 came out, Robert was asking me to migrate to the new module account hash algorithm. |
I agree with @iramiller that we should support both and new addresses are 32 bytes |
Note: the first 2 commits of this PR #763 seem to address a few items required for this issue |
@channa-figure / @iramiller would you put in a PR to wasmd with your solution? On the current Juno testnet we've moved off our fork and onto mainline wasmd, so we can test a point release/pre-release as well if it's in this repo. Otherwise a bit of faff to change to your fork, test, then change back to mainline 🙂 |
Closed by #772 |
bring back support to 20bytes long contract address (see: CosmWasm/wasmd#758)
* feat: upgrade fetchd to dorado version Dependencies: - bump cosmos-sdk to v0.45.1 - bump tendermint to v0.34.16 - bump wasmd to v0.23.0 - integrate ibc-go v2.0.3 Modules: - update app and commands to integrate new feegrant and authz modules - remove airdrop module Commands: - removed capricorn migration commands (stake-reconciliation-migrate and capricorn-migrate) Remaining changes are only compatibility fixes with the new cosmos-sdk version * fix: missing ptr dereference in initAppConfig * Update networks.md with dorado -rc1 * docs: add gas prices for testnet networks * chores: bump ibc-go version (#205) * fix: add back reconciliation command * fix: bump wasmd to v0.24 bring back support to 20bytes long contract address (see: CosmWasm/wasmd#758) * chores: wakeup CI * fix: bump go requirements to 1.17 to allow wasmvm to build (#208) * Dorado migration (#204) * fix: bump go requirements to 1.17 to allow wasmvm to build * feat: add dorado-migrate command * chores: fmt * feat: add initial nanonomx supply to dorado-migrate command * docs: remove redundant info * chores: switch cosmos-sdk to proper tagged version * docs: update software versions Co-authored-by: Ian Harris <[email protected]>
In testing 0.23 on a testnet with existing contract instance an error is thrown due to the way kvstore addresses are generated. Addresses are based on the current 32 byte length form, unfortunately some contracts were established with the prior 20 byte address form which is incompatible with this approach.
wasmd/x/wasm/types/keys.go
Line 90 in de38ea0
The above line always presumes the length will be 32 and it fails because it can't delete the history here:
wasmd/x/wasm/keeper/keeper.go
Line 578 in de38ea0
This occurred during testing on Provenance (using wasmd 0.23) with the following:
The text was updated successfully, but these errors were encountered: