-
Notifications
You must be signed in to change notification settings - Fork 184
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
Remove on-chain validation of schema from as many places as possible #1131
Comments
Agree, but we should keep in mind that in some cases (like updating an item in an array), no validation at all would allow someone to calculate a huge index to change someone else's data |
Let's list the considerations to make a decision on whether to keep or remove schema validation
I believe we could circumvent that by still requiring a schema to be passed in to the method - the schema still must be a valid schema, so array length is limited by the |
I think the indexer will need to be defensive about this anyway, because we can't guarantee someone will misuse the protocol outside of our tooling. Or maybe someone forks our protocol but uses the same event names and changes how it's encoded. So I kinda see this as not-really-a-con.
I agree on the dev ex side of things when using the World/Store direction, but I am curious if our codegen libraries could already automate around this by hardcoding the schema into the libraries and pass them into the necessary functions, avoiding the schema load step. Overall, this direction sounds like a win! |
On the contract side it's probably fine because the codegen libs would handle it, but it would make the devex slightly worse when interacting with tables directly from the client or scripts. Probably worth the tradeoff for smaller bytecode since it's not that big of a deal in terms of devex. |
We currently have some checks in
Store
to confirm that the input data has the correct length etc. To save gas and "not protect the user from themselves" we should remove these checks and expect users to use the codegen table libraries (which guarantee correct input data) or perform checks themselves. This might also involve passing schema from codegen libraries instead of loading from storage in StoreCore.The text was updated successfully, but these errors were encountered: