-
Notifications
You must be signed in to change notification settings - Fork 490
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
Dryrun: Return EvalDeltas for failed executions in Dryrun #3929
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3929 +/- ##
=======================================
Coverage 49.79% 49.79%
=======================================
Files 409 409
Lines 69145 69147 +2
=======================================
+ Hits 34429 34430 +1
+ Misses 30997 30996 -1
- Partials 3719 3721 +2
Continue to review full report at Codecov.
|
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.
I don't know how strongly I feel about my objexction. The patch is so small, I really like that. I don't actually see the work being done - is that because it just naturally falls out that if the eval delta is built, it gets serialized out to caller?
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.
Looks like a good improvement to me, I only have minor comments about some test semantics.
Higher level question: have you considered comparing the msgpack or json encoded deltas instead of diving into the individual fields? That might be a way to get nearly the same equality confidence without as much 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.
Looks good to me
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.
The change looks good but please fix the exceed license header
In many cases it's to distinguish 0 from "empty" so the REST api can
marshall it properly.
…On Thu, May 5, 2022 at 11:08 AM algoidurovic ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In daemon/algod/api/server/v2/dryrun_test.go
<#3929 (comment)>:
> @@ -1634,3 +1656,148 @@ int 1`)
logResponse(t, &response)
}
}
+
+func checkStateDelta(t *testing.T,
+ response *generated.StateDelta,
+ expectedDelta *generated.StateDelta,
+) {
+ for i, vd := range *response {
+ assert.Equal(t, (*expectedDelta)[i].Key, vd.Key)
+
+ // Pointer checks: make sure we don't try to derefence a nil.
+ if (*expectedDelta)[i].Value.Bytes == nil {
+ assert.Nil(t, vd.Value.Bytes)
+ } else {
+ assert.NotNil(t, vd.Value.Bytes)
+ assert.Equal(t, *(*expectedDelta)[i].Value.Bytes, *vd.Value.Bytes)
This seems to be appear consistently in this file -- so I don't
necessarily have a problem with you following the same convention -- but I
don't understand why we're using pointers everywhere. Afaict, most uses
don't need to be pointers, especially with slice types like
generated.StateDelta.
—
Reply to this email directly, view it on GitHub
<#3929 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADL7T2TTMCVVBSSYOW6MQLVIPP6LANCNFSM5UQNQM6Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Makes sense. I think this doesn't apply to all the uses of pointers in this PR but the pattern is prevalent enough that I don't take issue with it. I just generally try to avoid syntax like |
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.
LGTM
assert.Equal(t, len(ld.Delta), len(expectedLocalDelta.Delta)) | ||
assert.Equal(t, ld.Delta, expectedLocalDelta.Delta) |
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.
I probably confused the issue by mentioning length, but now that you use assert.Equal, you don't need the length check.
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.
thanks for catching, should be deleted in the latest commit
Summary
This PR returns the
EvalDelta
for stateful evaluation, regardless of whether it succeeds or not. This allows users to check theEvalDelta
even for failed dryrun execution.Closes #2687 .
Test Plan
Added unit tests for dryrun: