-
Notifications
You must be signed in to change notification settings - Fork 428
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
Add AccesType OnlyCodeIDs #1042
Comments
Thanks for this feature request! I can see your problem. Although It would not be very hard to implement in the |
I don't think I really follow your comment, don't think different code ids on different systems is an issue since this will be specified when you upload the contract. How this will work with predictable addresses ? |
I have read the issue. The problem is this may change a little with current design about checking permission feature. We can add more logic to retrieve the CodeID using contract address (which is the sender address) and use that data to check the permission when instantiate. But the main problem is what happend if gov instantiate this kind of contract? |
It is allowed. Gov bypasses the permission system |
The bigger issue with this task is that we share the same With predictable addresses you can have an alternative way that can be used to setup a A -> B-> C . Wasmvm integration is coming. See CosmWasm/cosmwasm#1500 Setup would be: # prepare addresses
contractA=$(wasmd q wasm build-address [code-hash-contract-1] [creator-address] [salt-A-hex-encoded]))
contractB=$(wasmd q wasm build-address [code-hash-contract-2] [contractB-address] [salt-B-hex-encoded]))
contractC=$(wasmd q wasm build-address [code-hash-contract-3] [contractC-address] [salt-C-hex-encoded]))
# upload contracts with instantiation permission set
wasmd tx wasm store contract-1 --from creator-address --instantiate-anyof-addresses=${contractA}
wasmd tx wasm store contract-2 --from creator-address --instantiate-anyof-addresses=${contractB}
wasmd tx wasm store contract-3 --from creator-address --instantiate-anyof-addresses=${contractC}
# create instance 1 with predicted address
wasmd tx wasm instantiate2 "$CODE_ID1" "$INIT" [salt-A-hex-encoded] --from creator-address This workflow would be environment independent. See a simple example https://github.com/CosmWasm/wasmd/blob/main/contrib/local/02-contracts.sh#L35 |
It's very common for factory patterns where there is A -> B-> C, where C should only be instantiated by B type contracts but due to the dynamic nature it's hard to enforce without hardcoding the value inside the C contract.
The text was updated successfully, but these errors were encountered: