-
Notifications
You must be signed in to change notification settings - Fork 481
Update Contract Address Derivation #410
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
Comments
Maybe the new standard uses 32 byte addresses that are not fully supported until cosmos sdk 0.42. We could do this in v0.17? |
This was actually implemented in cosmos/cosmos-sdk#9088 We are unlikely to import the upstream code in wasmd 1.0 (which will most likely be v0.42.x based), but we can ensure our derivation is the same as the upstream definition, so we can just swap out implementations later. Basically, we could copy this code into And use something like |
Check this PR: I backported that feature to Regen (which was released with 0.42 as well), and the usage: |
Thank you for the link (and the tip it was live) |
If anyone is interested, please review PR #565 |
In cosmos/cosmjs#857 you find an independent implementation of the ADR-028 spec and how it can be used for our purpose here. |
Back in 2019, I devised a custom scheme to provide a unique address to each contract.
Basically:
sha256('c' | code_id | contract_counter)[:20]
With cosmos/cosmos-sdk#8415 they have now defined a standard way to derive module accounts. It looks something like:
Since the 0.16 release will be breaking with many CosmWasm changes, let's take advantage of that to future-proof our derivation to be more consistent with the sdk.
I would propose something like:
addr := Hash("cosmwasm", code_id | countract_counter)
, which is pretty similar to the old code, but the standard derivation.We can also revisit how we create these unique key (code | contract) for each contract, although it does seem to work and our genesis import/export support this well.
The text was updated successfully, but these errors were encountered: