freenet-core icon indicating copy to clipboard operation
freenet-core copied to clipboard

Ensure validate_state() is called after update_state() to enforce state validity and reduce redundant validation

Open sanity opened this issue 1 year ago • 2 comments

To prevent buggy or malicious contract behavior from propagating invalid states across the network, we should enforce a design where validate_state() is always called after update_state(). This will ensure that the state remains valid after a delta is applied, without relying on redundant validation inside the update_state() function itself. We should remove the validate_delta() function (if present) and explicitly discourage performing state validation within update_state(), as validate_state() will handle this post-update validation.

sanity avatar Sep 26 '24 20:09 sanity

OH nice can I be assigned to this please?

gogo2464 avatar Oct 10 '24 17:10 gogo2464

@gogo2464 You're welcome to try it and submit a pull request, assuming @iduartgomez hasn't started work on it.

sanity avatar Oct 12 '24 16:10 sanity

seems I could do it.

gogo2464 avatar Oct 29 '24 20:10 gogo2464

Hasn't this been merged already? If so please close.

sanity avatar Nov 03 '24 20:11 sanity

not yet

gogo2464 avatar Nov 04 '24 02:11 gogo2464

is this issue still active please? I can do it.

gogo2464 avatar Dec 21 '24 17:12 gogo2464

@iduartgomez Is this still relevant?

sanity avatar Dec 23 '24 01:12 sanity

validate_state has been removed. We just need to ensure the code is still present in update_state.

I think it is not anymore actually. You could close this issue.

gogo2464 avatar Dec 23 '24 09:12 gogo2464

Done

iduartgomez avatar Jan 04 '25 22:01 iduartgomez