Trace store-code-proposal execution and update code_id
iboss-ptk opened this issue · 0 comments
iboss-ptk commented
After store code proposal success, the state does not get updated with it
- implement hook in instantiate/migrate to check prroposal result
- implement
beaker wasm proposal sync-state
Without this, contract instantiate/migrate will never use code stored via proposal unless manually update the state file
Investigation
According to this line of code, at EndBlocker
if proposal is passed and get executed, it should re-emit events (and hopefully contextualized with the proposal).
So potential execution plan to get code_id
from proposal_id
is:
- find proposal with
proposal_id
- if the proposal is passed, find the block height that it is passed, else end
- use vote end to check which block height it is in
- find the event emited at the block height
- tm rpc: https://docs.tendermint.com/master/tendermint-core/subscription.html#event-log-api
- query example: https://docs.cosmos.network/master/core/events.html#examples
- https://github.com/informalsystems/tendermint-rs.git (use abci query to query event at block height 1903 see whats in there first then go from there)
- find the one that is related to given proposal id
- check if there is any event contains
code_id
from store code
Todo
- move code to wasm.rs
- implement
cosmos.rs
in client function to perform the code extraction - add tests
- hook
- instantiate
- migrate
- implement prompt
- prompt only state update found
-
-y
,--yes
to skip the prompt, still log