Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Use module/method integer indexes #61

Open
jordy25519 opened this issue Jan 13, 2021 · 0 comments
Open

[RFC] Use module/method integer indexes #61

jordy25519 opened this issue Jan 13, 2021 · 0 comments

Comments

@jordy25519
Copy link
Contributor

jordy25519 commented Jan 13, 2021

Simplify the encoding and retrieval of permission information within CENNZnuts.

Motivation

CENNZnuts encode module and methods names as strings. This gives ease and flexibility to encoders but pushes a significant cost and complexity to the CENNZnet runtime. e.g. current lookups require for loops, arbitrary length limits, string matching etc. which creates many possible exploits and edge cases. Storage is also costly.

Proposal

CENNZnuts should use the integer indexes for the modules/methods as used by the Call enum.
The chain already has helper functions to convert these indices to modules/methods.
The runtime version should be included to tie the certificate to the CENNZnet protocol version.

The key suggestion is to replace the current 32 byte vector keys for modules and methods with one byte u8 each.
The wildcard index '*' could be set to some reserved key such as 254

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant