Skip to content
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

Off-chain API: ping command #160

Open
xli opened this issue Apr 7, 2021 · 3 comments
Open

Off-chain API: ping command #160

xli opened this issue Apr 7, 2021 · 3 comments

Comments

@xli
Copy link

xli commented Apr 7, 2021

Author: Xiao Li (@xli)
Status: Idea (for discussion)

To improve the ability of off-chain service handling network problems and protocol errors, we’d like to introduce a ping command for client to:

  1. detect dead connections to a remote off-chain service.
  2. measure the latency to a remote off-chain service.
  3. detect off-chain protocol errors to a remote off-chain service, for example: when a remote off-chain service rotates their compliance key, and client used old compliance public key to verify the response message, the ping command can be used to debug the error and verify the fix.

Specification

The PingCommand object definition:

Field Type Required? Description
_ObjectType str Y The fixed string PingCommand

An example CommandRequestObject JSON message with PingCommand:

{
    "_ObjectType": "CommandRequestObject",
    "command_type": "PingCommand",
    "command": {
        "_ObjectType": "PingCommand",
    },
    "cid": "12ce83f6-6d18-0d6e-08b6-c00fdbbf085a",
}

And the response of the PingCommand:

{
    "_ObjectType": "CommandResponseObject",
    “status”: “success”,
    "cid": "12ce83f6-6d18-0d6e-08b6-c00fdbbf085a"
}

Note we don’t need a random message body in PingCommand for the server to response, because the off-chain API protocol already have a cid field defined in the CommandRequestObject and CommandResponseObject to serve the purpose of distinguish different command instance.

There is no command_error for this command. Server may respond with protocol_error (with CommandResponseObject.status==“failure”) defined in DIP-1 when processing an invalid HTTP headers, JWS message or CommandRequestObject payload.

@davidiw
Copy link
Contributor

davidiw commented Apr 7, 2021

You are totally the first author, aren't you?

Submit a PR for DIP-160?

@xli
Copy link
Author

xli commented Apr 19, 2021

#163

@xli
Copy link
Author

xli commented Apr 19, 2021

example implementation in Diem Python SDK mini-wallet application: diem/client-sdk-python#267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants