-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Improve MaxNestingDepth of WitnessCondition #3761
Improve MaxNestingDepth of WitnessCondition #3761
Conversation
I thought it used to be |
This just works as the code works. Signed-off-by: Roman Khimov <[email protected]>
1. We have some duplication around "maxNestDepth <= 0" checks. 2. If we're to fix them by moving to DeserializeFrom() and thereby affecting all types of conditions we can discover a simple truth about conditions that was hidden previously: our real supported MaxNestingDepth is 3, not 2. 3. Test_WitnessCondition_Nesting works as before, check it there, we have And->And->Boolean and other nesting cases, 3-4 elements in the chain, not 2. Signed-off-by: Roman Khimov <[email protected]>
Signed-off-by: Roman Khimov <[email protected]>
Fix typo. Signed-off-by: Roman Khimov <[email protected]>
2547616
to
4a71e2c
Compare
@roman-khimov please run |
Actually that's exactly the formatting I got after Thanks for fixing this, @shargon. |
Is it compatible with the previous implementation ? |
⬆️
|
Rework 75d1208 to follow neo-project/neo#3761, let's have a real depth value in this constant. Signed-off-by: Roman Khimov <[email protected]>
Description
While digging into nspcc-dev/neo-go#3809 we've checked C# code as well and I think the main problem that got us to that issue is that we have an incorrect
MaxNestingDepth
. The first patch here adds a UT for nesting, notice that it already has three levels for the "correct" set. But it's completely hidden in the code because the check is not performed at all for items that can not have any children. I think it'd be nice to change it, simplifying the check itself (currently it's duplicated between different types of conditions) and making theMaxNestingDepth
have a real number of levels allowed.Count curly braces in
if in doubt.
Type of change
No behavior changes here.