-
Notifications
You must be signed in to change notification settings - Fork 41
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
[v5.0.1] Add threshold for maxTreeDepth for serializers #798
Conversation
Codecov Report
@@ Coverage Diff @@
## v5.0.1-RC #798 +/- ##
=============================================
- Coverage 71.89% 71.79% -0.10%
=============================================
Files 248 248
Lines 18942 18829 -113
Branches 634 573 -61
=============================================
- Hits 13618 13519 -99
+ Misses 5324 5310 -14
Continue to review full report at Codecov.
|
@@ -255,6 +288,12 @@ class DeserializationResilience extends SerializationSpecification | |||
ValueSerializer.deserialize(reader(ValueSerializer.serialize(expr), maxTreeDepth = 3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure the thrown exception comes from TypeSerializer. I.e. that the test is actually testing anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in new version.
property("max recursive call depth is checked in writer.level for TypeSerializer") { | ||
val expr = Tuple(Tuple(IntConstant(1))) | ||
an[SerializeCallDepthExceeded] should be thrownBy | ||
ValueSerializer.serialize(expr, writer(maxTreeDepth = 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issues as with the previous test I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, the TypeSerializer was completely missing handling for maxTreeDepth for both de/serializing, added to both method and updated tests.
} | ||
w.level = depth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jozanek please reintroduce changes so that most of the code remain the same and number of red and green lines is minimal. Otherwise I cannot estimate what was actually changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github diff tool is quite puzzled, had to break formatting to show it properly. I can add it in additional commit after PR is reviewed.
tpe | ||
} | ||
|
||
private def getArgType(r: SigmaByteReader, primId: Int, depth: Int) = | ||
if (primId == 0) | ||
deserialize(r, depth + 1) | ||
deserialize(r) | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rollback changes in deserializer, it part of the consensus, where as serializer is not.
This PR don't need to touch consensus code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
129fdb0
to
91853dd
Compare
91853dd
to
595ef21
Compare
2668480
to
9705a29
Compare
@aslesarenko can you review again please and possibly merge? |
@jozanek, this is low prioriity and considering how much unmerged code is there in |
After giving more thought into this I think this feature will complicate maintenance. |
Partially closes #759, #781