forked from aptos-labs/aptos-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[json-rpc] Add get_event_by_version_with_proof
- Loading branch information
1 parent
ac39ce0
commit 825d773
Showing
12 changed files
with
296 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
## Method get_event_by_version_with_proof | ||
|
||
**Description** | ||
|
||
Fetch the latest event at or below the given `version` from the given event `key`. | ||
The response also includes cryptographic proofs needed to verify that the response | ||
is correct. | ||
|
||
|
||
### Parameters | ||
|
||
| Name | Type | Description | | ||
|---------|----------------|------------------------------------------------------------------------------------------------------| | ||
| key | string | Globally unique identifier of an event stream | | ||
| version | unsigned int64 | Return the latest event at or below this version. If unset, defaults to the server's current version | | ||
|
||
|
||
### Returns | ||
|
||
Returns an `EventByVersionWithProofView`, which contains two optional fields | ||
denoting the lower bound inclusive `EventWithProofView` and upper bound exclusive | ||
`EventWithProofView`. There are four possible cases for these two response fields: | ||
|
||
1. There are no events at all in this event stream. | ||
2. The given `version` is less than the first ever event's version for this event stream. | ||
3. The given `version` is bounded in the range: `[lower_bound_incl.version, upper_bound_excl.version)`. | ||
4. The given `version` is at or above the latest ever event's version to this event stream. | ||
|
||
|
||
Example JSON-RPC responses: | ||
|
||
Case (1.): | ||
```json | ||
{ | ||
"id": 1, | ||
"jsonrpc": "2.0", | ||
"diem_chain_id": 4, | ||
"diem_ledger_timestampusec": 1608143037098724, | ||
"diem_ledger_version": 100, | ||
"result": {} | ||
} | ||
``` | ||
|
||
Case (2.): | ||
```json | ||
{ | ||
"id": 1, | ||
"jsonrpc": "2.0", | ||
"diem_chain_id": 4, | ||
"diem_ledger_timestampusec": 1608143037098724, | ||
"diem_ledger_version": 100, | ||
"result": { | ||
"upper_bound_excl": { | ||
"event_with_proof": "00000000000000000000000000000000001800000000000000000000000000000000000000000a550c18000000000000000007000000000000000000000000000000010b4469656d4163636f756e74124372656174654163636f756e744576656e7400180000000000000000000000000a550c18000000000000000007205ea5bec9fcf7db9ca734b48ff2c30d333a47b265124e8f8d82c5933e99d38f4e20e2671b124cdd8bc5fdfdf9c3f385791c1e8e4b36cb9b7faa75a0aceffd2dc55420056518b61548197ec9cfdef5ccc9df06d7fbf9a65929ca6a001a6ba3e94e29f62057304aafb410c2e4903517fa60a60b644adac57a3531a647bffcf4f31370174c20cd295ff537e3415397ffcf822d89dd024be06c98c66ce1dd20c0452aab8e21bd201323a27e3b440505760f098720f643944b57516dff978701849ab53c6ccb6ab420cd150532557fe95d883e30dbd2723f41f85384de0993a24b81098a6d141fcd4020284bcdb5381519e4bd76634814026598babc7629d4f9ba827e4c6ae25557d25e209f181a5a463b39e5be659ebc0f5174936f3b8f34a443b98239ffeb43f5ec79a32063935d32737f16a01bf69f5a2df0fed9e1e659a1ac66a421cc7515884a24b61d00000000000000000004204d70a96fb83a2dcf437dd9e3dc9fb80d671a6ea84cd91aa047d7039d56383ad220b0068256b82f6f2cd8056967798b4c7a589ac1f8062a39d227b4ceb3530a8ff420d222a263f1142ed5089ddf8694b9fa98e981e891e63fd28f05d8d80f03a207de2000a98c24050c7371aa9ddde3f8b4263f83c41b94781b181a96db4b61e2ecdf19" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
Case (3.): | ||
```json | ||
{ | ||
"id": 1, | ||
"jsonrpc": "2.0", | ||
"diem_chain_id": 4, | ||
"diem_ledger_timestampusec": 1608143037098724, | ||
"diem_ledger_version": 100, | ||
"result": { | ||
"lower_bound_incl": { | ||
"event_with_proof": "00000000000000000100000000000000001800000000000000000000000000000000000000000a550c18010000000000000007000000000000000000000000000000010b4469656d4163636f756e74124372656174654163636f756e744576656e7400180000000000000000000000000b1e55ed010000000000000007205ea5bec9fcf7db9ca734b48ff2c30d333a47b265124e8f8d82c5933e99d38f4e20e2671b124cdd8bc5fdfdf9c3f385791c1e8e4b36cb9b7faa75a0aceffd2dc55420056518b61548197ec9cfdef5ccc9df06d7fbf9a65929ca6a001a6ba3e94e29f62057304aafb410c2e4903517fa60a60b644adac57a3531a647bffcf4f31370174c20cd295ff537e3415397ffcf822d89dd024be06c98c66ce1dd20c0452aab8e21bd201323a27e3b440505760f098720f643944b57516dff978701849ab53c6ccb6ab420cd150532557fe95d883e30dbd2723f41f85384de0993a24b81098a6d141fcd4020284bcdb5381519e4bd76634814026598babc7629d4f9ba827e4c6ae25557d25e209f181a5a463b39e5be659ebc0f5174936f3b8f34a443b98239ffeb43f5ec79a32063935d32737f16a01bf69f5a2df0fed9e1e659a1ac66a421cc7515884a24b61d00000000000000000004203296918711e9dfa27434d4bff7b9d489947392bad89d55eea0361c6d5884582f20b0068256b82f6f2cd8056967798b4c7a589ac1f8062a39d227b4ceb3530a8ff420d222a263f1142ed5089ddf8694b9fa98e981e891e63fd28f05d8d80f03a207de2000a98c24050c7371aa9ddde3f8b4263f83c41b94781b181a96db4b61e2ecdf19" | ||
}, | ||
"upper_bound_excl": { | ||
"event_with_proof": "00000000000000000200000000000000001800000000000000000000000000000000000000000a550c18020000000000000007000000000000000000000000000000010b4469656d4163636f756e74124372656174654163636f756e744576656e740018b5b333aabbf92e78524e2129b722eaca030000000000000007205ea5bec9fcf7db9ca734b48ff2c30d333a47b265124e8f8d82c5933e99d38f4e20e2671b124cdd8bc5fdfdf9c3f385791c1e8e4b36cb9b7faa75a0aceffd2dc55420056518b61548197ec9cfdef5ccc9df06d7fbf9a65929ca6a001a6ba3e94e29f62057304aafb410c2e4903517fa60a60b644adac57a3531a647bffcf4f31370174c20cd295ff537e3415397ffcf822d89dd024be06c98c66ce1dd20c0452aab8e21bd201323a27e3b440505760f098720f643944b57516dff978701849ab53c6ccb6ab420cd150532557fe95d883e30dbd2723f41f85384de0993a24b81098a6d141fcd4020284bcdb5381519e4bd76634814026598babc7629d4f9ba827e4c6ae25557d25e209f181a5a463b39e5be659ebc0f5174936f3b8f34a443b98239ffeb43f5ec79a32063935d32737f16a01bf69f5a2df0fed9e1e659a1ac66a421cc7515884a24b61d0000000000000000000420235cffb4a169efa7079e0f525485e1a15814dc7837c58b23cb957de765d3245720c3f7508f672153ca6689abb7b0a5c5e7249f492ba82aefeabd4bba44b56e35d020d222a263f1142ed5089ddf8694b9fa98e981e891e63fd28f05d8d80f03a207de2000a98c24050c7371aa9ddde3f8b4263f83c41b94781b181a96db4b61e2ecdf19" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
Case (4.): | ||
```json | ||
{ | ||
"id": 1, | ||
"jsonrpc": "2.0", | ||
"diem_chain_id": 4, | ||
"diem_ledger_timestampusec": 1608143037098724, | ||
"diem_ledger_version": 100, | ||
"result": { | ||
"lower_bound_incl": { | ||
"event_with_proof": "00000000000000000200000000000000001800000000000000000000000000000000000000000a550c18020000000000000007000000000000000000000000000000010b4469656d4163636f756e74124372656174654163636f756e744576656e740018b5b333aabbf92e78524e2129b722eaca030000000000000007205ea5bec9fcf7db9ca734b48ff2c30d333a47b265124e8f8d82c5933e99d38f4e20e2671b124cdd8bc5fdfdf9c3f385791c1e8e4b36cb9b7faa75a0aceffd2dc55420056518b61548197ec9cfdef5ccc9df06d7fbf9a65929ca6a001a6ba3e94e29f62057304aafb410c2e4903517fa60a60b644adac57a3531a647bffcf4f31370174c20cd295ff537e3415397ffcf822d89dd024be06c98c66ce1dd20c0452aab8e21bd201323a27e3b440505760f098720f643944b57516dff978701849ab53c6ccb6ab420cd150532557fe95d883e30dbd2723f41f85384de0993a24b81098a6d141fcd4020284bcdb5381519e4bd76634814026598babc7629d4f9ba827e4c6ae25557d25e209f181a5a463b39e5be659ebc0f5174936f3b8f34a443b98239ffeb43f5ec79a32063935d32737f16a01bf69f5a2df0fed9e1e659a1ac66a421cc7515884a24b61d0000000000000000000420235cffb4a169efa7079e0f525485e1a15814dc7837c58b23cb957de765d3245720c3f7508f672153ca6689abb7b0a5c5e7249f492ba82aefeabd4bba44b56e35d020d222a263f1142ed5089ddf8694b9fa98e981e891e63fd28f05d8d80f03a207de2000a98c24050c7371aa9ddde3f8b4263f83c41b94781b181a96db4b61e2ecdf19" | ||
}, | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.