-
Notifications
You must be signed in to change notification settings - Fork 705
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
P2P AppError handling #2248
P2P AppError handling #2248
Conversation
af944e5
to
de8c863
Compare
41fa30c
to
c05a5be
Compare
Pending feedback on avalanche-foundation/ACPs#25 |
7c1734d
to
087cf9e
Compare
require.NoError(ctx.Err()) | ||
|
||
failedLock.Lock() | ||
defer failedLock.Unlock() | ||
|
||
failedVDRs.Add(nodeID) | ||
wg.Done() | ||
return nil |
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.
is it a cleanup that was needed before common.AppErr or is it related to these changes?
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.
This is because previously the other function signatures could use the common failed
function since they all had the same signatures, since this changes the signature of AppRequestFailed
we have to explicitly create one.
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.
We also can't just call failed
inside of here because the linter flags failed
for always returning nil
(not sure why it doesn't notice it if we copy-paste)....
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.
so weird
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.
nits and a proposal for a slightly different error handling
3ee1414
to
370ed78
Compare
Signed-off-by: Joshua Kim <[email protected]>
370ed78
to
aed63eb
Compare
Signed-off-by: Joshua Kim <[email protected]>
Signed-off-by: Joshua Kim <[email protected]>
Signed-off-by: Joshua Kim <[email protected]>
Signed-off-by: Joshua Kim <[email protected]>
Signed-off-by: Joshua Kim <[email protected]>
Signed-off-by: Joshua Kim <[email protected]>
Signed-off-by: Joshua Kim <[email protected]>
{ | ||
name: "AppResponse", | ||
responseOp: message.AppResponseOp, | ||
responseMsg: message.InboundAppResponse(ids.Empty, requestID, []byte("responseMsg"), ids.EmptyNodeID), | ||
timeoutMsg: message.InboundAppError(ids.EmptyNodeID, ids.Empty, requestID, 123, "error"), | ||
}, | ||
{ | ||
name: "CrossChainAppResponse", | ||
responseOp: message.CrossChainAppResponseOp, | ||
responseMsg: message.InternalCrossChainAppResponse(ids.EmptyNodeID, ids.Empty, ids.Empty, requestID, []byte("responseMsg")), | ||
timeoutMsg: message.InternalCrossChainAppError(ids.EmptyNodeID, ids.Empty, ids.Empty, requestID, 123, "error"), |
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.
small nit: Could we add *AppError
as the responseMsg
to these test vectors? I didn't actually think this would work - but because of how we currently trigger timeouts it does work as expected.
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.
After these 3 nits this LGTM. Thanks for leading this!
Signed-off-by: Joshua Kim <[email protected]>
commit 82fbc97 Author: Stephen Buttolph <[email protected]> Date: Tue Dec 12 18:30:09 2023 -0500 Add ACP signaling (#2476) commit ac5a00e Author: Joshua Kim <[email protected]> Date: Tue Dec 12 17:42:32 2023 -0500 Refactor p2p unit tests (#2475) Signed-off-by: Joshua Kim <[email protected]> Co-authored-by: Dan Laine <[email protected]> commit 0b2b109 Author: Dhruba Basu <[email protected]> Date: Tue Dec 12 16:48:28 2023 -0500 `vms/platformvm`: Verify txs before building a block (#2359) Co-authored-by: Stephen Buttolph <[email protected]> commit 4be744e Author: Joshua Kim <[email protected]> Date: Tue Dec 12 15:08:48 2023 -0500 P2P AppError handling (#2248) Signed-off-by: Joshua Kim <[email protected]> Co-authored-by: Stephen Buttolph <[email protected]> commit 7963115 Author: Dhruba Basu <[email protected]> Date: Tue Dec 12 14:37:59 2023 -0500 `vms/platformvm`: Add `TestBuildBlockForceAdvanceTime` test (#2472) Co-authored-by: Stephen Buttolph <[email protected]> commit dc472ec Author: Dhruba Basu <[email protected]> Date: Tue Dec 12 14:37:43 2023 -0500 `vms/platformvm`: Permit usage of the `Transactions` field in `BanffProposalBlock` (#2451) Co-authored-by: Stephen Buttolph <[email protected]> Signed-off-by: Joshua Kim <[email protected]>
Why this should be merged
Adds support to handle the new
AppRequestFailed
p2p message type. This allows VMs to define errors where previously they would just dropAppRequest
messages and the requester would determine a request failed if it timed out.How this works
Modifies the VM
*AppRequestFailed
interface functions to take in anerror
as a parameter which indicates the application-defined reason for failure.Previously, this was only called when the network timed out. Now, timeouts are a subset of errors that may occur.
How this was tested
UT