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
This may be good for simplicity, but it's bad for ergonomics. If we want override a single default value, we need to provide the entire Config / Params struct fields (if not, serde will complain during deserialisation).
So, it's better to make those config / params fields explicit, flattening them in the InstantiationMsg directly. That way they are visible, settings are clear and well documented, there's no surprising / default behaviour, and less eventual head scratching.
We can still use default values through derivative or helpers, but let's restrict those to tests, and test helpers.
This will be breaking contract instantiation in a number of places (e2e tests, integration scripts, etc.).
But, that's better than implicitly setting undesired / unknown default values.
Regarding Config vs. Params, we could simplify that as well putting everything under the same struct. But I think the separation has some merit: config values are those immutable values gathered during instantiation, whereas we can use params for mutable / settable values (through governance, administrator accounts, etc.)
The text was updated successfully, but these errors were encountered:
We're using optional config / params fields for contract instantiation (
babylon-contract/contracts/btc-staking/src/msg.rs
Line 16 in 9fdc9a1
derivative
(in case the entire config / params field is not set) (babylon-contract/contracts/btc-staking/src/state/config.rs
Lines 23 to 52 in 9fdc9a1
This may be good for simplicity, but it's bad for ergonomics. If we want override a single default value, we need to provide the entire
Config
/Params
struct fields (if not,serde
will complain during deserialisation).So, it's better to make those config / params fields explicit, flattening them in the
InstantiationMsg
directly. That way they are visible, settings are clear and well documented, there's no surprising / default behaviour, and less eventual head scratching.We can still use default values through
derivative
or helpers, but let's restrict those to tests, and test helpers.This will be breaking contract instantiation in a number of places (e2e tests, integration scripts, etc.).
But, that's better than implicitly setting undesired / unknown default values.
Regarding
Config
vs.Params
, we could simplify that as well putting everything under the same struct. But I think the separation has some merit: config values are those immutable values gathered during instantiation, whereas we can use params for mutable / settable values (through governance, administrator accounts, etc.)The text was updated successfully, but these errors were encountered: