Replies: 5 comments 6 replies
-
Hello! |
Beta Was this translation helpful? Give feedback.
-
About putting the bytecode in the datastore, are we sure of the benefit vs the added user complexity of having forbidden keys ? |
Beta Was this translation helpful? Give feedback.
-
@sebastien-forestier Thanks for the feedback ! Putting the bytecode in the datastore allows:
If we put bytecode in the datastore and we add a "key" parameter to the Another bit of this flag byte could be used to mark the entry as "protected", and datastore access functions would have a parameter "allow_protected" set to false by default to prevent reading/writing protected entries of the datastore, like for example the stored website. That way, no need for reserved keys, and no risk of overwriting any of the protected entries. Another bit of this flag byte can be used to mark specific datastore entries as immutable, which is useful for example for decentralized websites to have immutable JS but still be able to operate a database. |
Beta Was this translation helpful? Give feedback.
-
@gregLibert any opinions ? |
Beta Was this translation helpful? Give feedback.
-
Setting smart contracts as possibly mutable is a huge change in dev/user experience w.r.t Ethereum, cf the litterature on this topic in Ethereum community:
In the end it might be a user experience improvement, or it might not be, but for sure we have to thoroughly discuss the implications before implementing it. |
Beta Was this translation helpful? Give feedback.
-
Intro
Currently our ledger is a key value map where the key is an address and the value holds a balance (in fact, 2 balances)
, a bytecode and a datastore. The datastore is also a key value map where the key is a byte array (with a max size of 255 byte)
and the value is a byte array (with a max size of 10Mb).
This RFC suggests to move the bytecode field directly into the datastore and adding some flags to mark entries as
executable (or not). A non-exhaustive list of benefits could be:
Modifications
In Ledger Datastore
The datastore would still be a key value map but the value would change from a byte array to:
The flag will be used as a bitflag:
In ExecuteSC / CallSC operation type
In current code, ExecuteSC has a bytecode parameter (as a byte array) among others. A new field 'datastore' (operation
datastore) would be added, allowing to pass additional data accessible from the Smart Contract (in bytecode).
This new field is a regular key, value map (key: byte array, value: byte array).
Note that the datastore limits are the same as the ledger datastore.
Smart Contract ABI addon
The following new functions would be useful for smart contracts:
Related to operation datastore:
Related to ledger datastore:
Smart Contract ABI modifications
In several spots, 'String' are used, thus requiring to use base64 to pass bytes:
The following functions will be removed:
As this can be replaced by set_data and set_data_for functions.
Beta Was this translation helpful? Give feedback.
All reactions