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
We should create helper functions to ensure that we never write values of the wrong type to particular storage keys, and we should avoid mingling code which handles logic and code which handles serialisation.
For example (from shared/src/ledger/ibc/mod.rs)
// the client counterlet key = client_counter_key();let value = 0_u64.to_be_bytes().to_vec();
storage
.write_bytes(&key, value).expect("Unable to write the initial client counter");
This should be refactored into (in some appropriate file):
pubfnwrite_client_counter(value:u64){let key = client_counter_key();let value = value.to_be_bytes().to_vec();
storage
.write_bytes(&key, value.to_be_bytes()).expect("Unable to write the client counter");}
such that the original code needs to be only
ibc_storage::write_client_counter(0_u64);
Does this make sense? We should apply this pattern generally, starting with the IBC code.
The text was updated successfully, but these errors were encountered:
We should create helper functions to ensure that we never write values of the wrong type to particular storage keys, and we should avoid mingling code which handles logic and code which handles serialisation.
For example (from
shared/src/ledger/ibc/mod.rs
)This should be refactored into (in some appropriate file):
such that the original code needs to be only
Does this make sense? We should apply this pattern generally, starting with the IBC code.
The text was updated successfully, but these errors were encountered: