Skip to content

getWhitelistFeeContracts asymmetry #4371

@roman-khimov

Description

@roman-khimov

Describe the bug
#4201 has added a set of policy contract methods:

setWhitelistFeeContract(hash, method, argCount, fee)
removeWhitelistFeeContract(hash, method, argCount)
getWhitelistFeeContracts()

and a WhitelistFeeChanged(contract, method, argCount, fee) event. Originally getWhitelistFeeContracts() returned an iterator over keys that are "hash + argCount + method". Then #4359 has changed the storage scheme to more effective one, but it made getWhitelistFeeContracts() return an iterator over keys that are "hash + offset".

Now we have an obvious asymmetry in the interface, we operate with method/argCount pairs for set/remove methods, but getWhitelistFeeContracts() returns something completely alien.

To Reproduce
Call setWhitelistFeeContract(hash, method, argCount, fee), then call getWhitelistFeeContracts(), then try to figure out what the result means.

Expected behavior
getWhitelistFeeContracts() returning an iterator over values that are (hash, method, argCount, fee). This can be easily done by storing a structure with this data by the same offset-based key and then using ValuesOnly | DeserializeValues for iterator. This also easily solves the problem mentioned in https://github.com/neo-project/neo/pull/4359/files#r2582191161.

(Optional) Additional context
#4201
#4359
nspcc-dev/neo-go#4052

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions