mirror of
https://github.com/nspcc-dev/neofs-contract.git
synced 2026-03-01 04:28:59 +00:00
Contract configuration constraints #128
Labels
No labels
I1
I2
I3
I4
S1
S2
S3
S4
U1
U2
U3
U4
alphabet
audit
balance
blocked
bug
config
container
discussion
documentation
enhancement
feature
go
good first issue
help wanted
neofs
neofsid
netmap
nns
nns
performance
proxy
question
reputation
security
task
test
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nspcc-dev/neofs-contract#128
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AnnaShaleva on GitHub (Jan 27, 2023).
The common pattern of storing the contract configuration is to use the set of key-value records. Given the neofs contract as an example, function
nspcc-dev/neofs-contract@dc89137484/neofs/neofs_contract.go (L511)restricts the maximum amount of config fields to ~682 (3 stackitems for a single record, 2047 records at max). Although currently we don't have a lot of configuration values, the problem is that this list is append-only (there's no code that allows to remove values from the contract config). If someday we're going to excessively extend our configs then this problem may be solved with returning an iterator from this method.Ref. #304.
@roman-khimov commented on GitHub (Jan 27, 2023):
Generic SetConfig/Config/ListConfig things are just a bad interface. Can easily be misused, impossible to track compatibility/migrations at the contract level. Of course you don't have a lot of options at
_deploytime, but other than that each value should have a separate get/set function pair and contracts should deal with the storage schemas/migrations/compatibility internally.@roman-khimov commented on GitHub (Feb 4, 2023):
Another side-effect of the current approach, BTW:
It's a number in fact.
@cthulhu-rider commented on GitHub (Apr 10, 2023):
Not a solution, but a practical relief: defining global defaults. In many cases, this will reduce the amount of data stored and the burden on the administrator.
@roman-khimov commented on GitHub (Dec 20, 2023):
#372 will solve it. Then
ListConfigcould be removed in some future versions.