You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When CosmWasm migrations were designed, we had 1 instance – 1 dev team in mind. The whole system assumes a small number of instances to handle. Recently we learned that more and more use cases are poping up in which many instances of a contract are created, dozens of pools, hundreds or DAOs, thousands of accounts. Having to send a MsgMigrateContract cand calling the contract for each message is gas intense and hard to manage.
While this ticket does no solve the full problem at once, it is a first step and actionable. The idea is this: not every migration needs a state change. Often times state changes can be done lazily or are not required at all. In those cases we can avoid calling the migrate entry point of the contract. Just swap out the code and call it a day.
In such cases the msg field of MsgMigrateContract becomes optional.
If a call to the migrate entry point is needed or not should be decided by the new code. There the contract author can decide if the state needs to change or not. Luckily we have Entrypoints in AnalysisReport and can implement the following logic:
if new code contains the migrate entry point, require msg to be non-empty JSON (current logic)
otherwise require msg to be empty
This avoids situations in which an expected msg is missing or a provided msg is ignored.
The text was updated successfully, but these errors were encountered:
When CosmWasm migrations were designed, we had 1 instance – 1 dev team in mind. The whole system assumes a small number of instances to handle. Recently we learned that more and more use cases are poping up in which many instances of a contract are created, dozens of pools, hundreds or DAOs, thousands of accounts. Having to send a
MsgMigrateContract
cand calling the contract for each message is gas intense and hard to manage.While this ticket does no solve the full problem at once, it is a first step and actionable. The idea is this: not every migration needs a state change. Often times state changes can be done lazily or are not required at all. In those cases we can avoid calling the
migrate
entry point of the contract. Just swap out the code and call it a day.This means not executing those lines:
wasmd/x/wasm/keeper/keeper.go
Lines 475 to 479 in 7ea00e2
In such cases the
msg
field ofMsgMigrateContract
becomes optional.If a call to the
migrate
entry point is needed or not should be decided by the new code. There the contract author can decide if the state needs to change or not. Luckily we haveEntrypoints
inAnalysisReport
and can implement the following logic:migrate
entry point, requiremsg
to be non-empty JSON (current logic)msg
to be emptyThis avoids situations in which an expected msg is missing or a provided msg is ignored.
The text was updated successfully, but these errors were encountered: