-
Notifications
You must be signed in to change notification settings - Fork 648
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
Use a contract address in every call to wasmVM.Instantiate
#4928
Comments
Some initial thoughts after some research but before experimenting:
|
You're right! Should be used in the other calls as well. Do you mind to add that as well in your PR? |
Already in my PR @crodriguezvega. The only issue I faced is having to use |
In order to be able to migrate contract instances we need to instantiate contracts with contract addresses.
Context
In
x/wasm
contract migration requires the contract to have an address, which is passed in theenv
parameter. In 08-wasm we currently do not have addresses for the light client contracts. Inx/wasm
the contract address is generated during contract instantiation, each contract instance gets its own contract address.In
x/wasm
there isMsgMigrateContract
with a fieldcontract
that is the address of the contract that should be migrated. Thecode_id
field references the new contract that migrates to.Proposal
Investigate if we can use the client identifier as contract address (thanks @srdtrk for this suggestion). The 08-wasm module does not have knowledge of the client identifiers, so we need to investigate if we can retrieve it from the client-prefixed store that is passed to
Initialize
.If we cannot use the client identifier as contract address, then we could generate a contract address using the code hash and a similar trick as we do when we generate the interchain account address. In the
Initialize
function we also have access to the client store, so we could store the contract address under acontracAddress
key. We need this for #4925 so that we can retrieve the contract address inMigrateContract
.Regardless of the contract address that we use, it needs to be passed to
wasmVM.Instantiate
in theenv
parameter.The text was updated successfully, but these errors were encountered: