-
Notifications
You must be signed in to change notification settings - Fork 2
Open
4 / 74 of 7 issues completedLabels
Description
Make storage programs behave like actual programs with granular read/write methods instead of full data blob operations.
Goal: Hybrid approach - Node does heavy lifting (efficient), SDK wraps with nice API.
Read Methods:
getAll()- retrocompat, returns full datagetFields()- list top-level field namesgetValue(field)- get specific field valuegetItem(field, index)- get array elementhasField(field)- check field existsgetFieldType(field)- get field type
Write Methods (with fee calculation based on size delta):
setValue(field, value)- set/create fieldsetItem(field, index, value)- set array elementappendItem(field, value)- push to arraydeleteField(field)- remove fielddeleteItem(field, index)- remove array element
Safeguards:
- ACL enforcement on ALL operations (read + write)
- Binary encoding → error for granular access
- Non-existent field → error
- Out-of-bounds array → error
- appendItem on non-array → error
- deleteField on missing → error
Fee Model (reuses existing GCRStorageProgramRoutines.ts logic):
- Granular writes calculate delta bytes
- delta > 0 → charge proportional storage fee
- delta ≤ 0 → base tx fee only
Beads Epic: node-9idc