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're using Binary types as part of state / storage in smart contracts. This is not a good idea for a number of reasons:
Binary is base64 encoded, which is wasteful / non-efficient.
Base64 encoding changes depending on the data, and breaks lexicographical order of the underlying data, which is not convenient for tests, etc.
Also, since we'll be creating ancillary structs for state (which is a burden but good for flexibility / control), we should consider not using hex data in state as well. Let's just store the raw bytes, and convert to the required hex encoded data when / if needed.
Finally, let's not store unnecessary data in the state. Let's use the ancillary structs to trim the data to store to the minimum necessary for functionality.
The text was updated successfully, but these errors were encountered:
Unless, smart contract data is being stored encoded as JSON, that is. Shouldn't be the case, but let's confirm this, just to err on the safe side.
I mean, I would want an ASCII / human readable format for transferring data, and for interacting with it from the CLI.
But, I wouldn't want that to save / persist data. I would want a compact, byte efficient format for storage. Let's check this, and introduce one if there isn't there.
Unnecessary data that can be trimmed down / outright removed:
staking_tx and slashing_tx. Let's compute and store their hashes instead.
covenant_sigs.
unbonding_tx and slashing_tx. Let's store their hashes directly.
The delegator_unbonding_sig field is being used to mark the delegation as undelegated. The same can be done through a boolean though, and remove the sigs altogether (done in F/btc delegations #39).
Unless, smart contract data is being stored encoded as JSON, that is.
This is irrelevant here. Let's just make our state structs as compact / minimal as possible at the struct / fields level. And remove Binary from the storage for lexicographical sorting stability / data transparency.
We're using
Binary
types as part of state / storage in smart contracts. This is not a good idea for a number of reasons:Binary
is base64 encoded, which is wasteful / non-efficient.Also, since we'll be creating ancillary structs for state (which is a burden but good for flexibility / control), we should consider not using hex data in state as well. Let's just store the raw bytes, and convert to the required hex encoded data when / if needed.
Finally, let's not store unnecessary data in the state. Let's use the ancillary structs to trim the data to store to the minimum necessary for functionality.
The text was updated successfully, but these errors were encountered: