Skip to content

Commit

Permalink
Merge pull request #555 from EspressoSystems/feat/timestamp-endpoints
Browse files Browse the repository at this point in the history
Feat/timestamp endpoints
  • Loading branch information
jbearer authored Aug 22, 2023
2 parents 7d716ba + 564ea39 commit 20bfd1b
Show file tree
Hide file tree
Showing 5 changed files with 402 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:

- name: Audit
# See https://github.com/libp2p/rust-libp2p/issues/4327 for RUSTSEC-2022-0093
run: cargo audit --ignore RUSTSEC-2022-0093
run: cargo audit --ignore RUSTSEC-2022-0093 --ignore RUSTSEC-2023-0052 --ignore RUSTSEC-2023-0053
60 changes: 60 additions & 0 deletions sequencer/api/availability.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[route.getnamespaceproof]
PATH = ["block/:height/namespace/:namespace"]
":height" = "Integer"
":namespace" = "Integer"
DOC = "Get the namespace proof for a set of VM transations and the NMT root"

[route.gettimestampwindow]
PATH = [
"headers/window/:start/:end",
"headers/window/from/:height/:end",
"headers/window/from/hash/:hash/:end",
]
":start" = "Integer"
":end" = "Integer"
":height" = "Integer"
":hash" = "TaggedBase64"
DOC = """
Get block headers in a time window.
Returns all available headers, in order, whose timestamps fall between `:start` (inclusive) and
`:end` (exclusive), or between the block indicated by `:height` or `:hash` (inclusive) and `:end`
(exclusive). The response also includes one block before the desired window (unless the window
includes the genesis block) and one block after the window. This proves to the client that the
server has not omitted any blocks whose timestamps fall within the desired window.
It is possible that not all blocks in the desired window are available when this endpoint is called.
In that case, whichever blocks are available are included in the response, and `next` is `null` to
indicate that the response is not complete. The client can then use one of the `/from/` forms of
this endpoint to fetch the remaining blocks from where the first response left off, once they become
available. If no blocks are available, not even `prev`, this endpoint will return an error.
Returns
```json
{
"from": "integer", // block number of the first block in the window, unless the window is empty,
// then block number of `next`
"window": ["Header"],
"prev": "Header", // nullable
"next": "Header" // nullable
}
```
where a `Header` has the schema:
```json
{
"timestamp": "integer",
"l1_block": {
"timestamp": "integer",
"number": "integer",
},
"transactions_root": {
"root": ["integer"]
}
}
```
All timestamps are denominated in an integer number of seconds.
"""
File renamed without changes.
Loading

0 comments on commit 20bfd1b

Please sign in to comment.