Skip to content

Commit

Permalink
Merge pull request #26 from matheusd/inalterable-blocks
Browse files Browse the repository at this point in the history
Add /block idempotency requirement
  • Loading branch information
patrick-ogrady authored Jul 23, 2020
2 parents f14aa75 + d909dc6 commit a3a6607
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"/block": {
"post": {
"summary":"Get a Block",
"description":"Get a block by its Block Identifier. If transactions are returned in the same call to the node as fetching the block, the response should include these transactions in the Block object. If not, an array of Transaction Identifiers should be returned so /block/transaction fetches can be done to get all transaction information.",
"description":"Get a block by its Block Identifier. If transactions are returned in the same call to the node as fetching the block, the response should include these transactions in the Block object. If not, an array of Transaction Identifiers should be returned so /block/transaction fetches can be done to get all transaction information. When requesting a block by the hash component of the BlockIdentifier, this request MUST be idempotent: repeated invocations for the same hash-identified block must return the exact same block contents. No such restriction is imposed when requesting a block by height, given that a chain reorg event might cause the specific block at height `n` to be set to a different one.",
"operationId":"block",
"tags": [
"Block"
Expand Down Expand Up @@ -838,7 +838,7 @@
}
},
"Block": {
"description":"Blocks contain an array of Transactions that occurred at a particular BlockIdentifier.",
"description":"Blocks contain an array of Transactions that occurred at a particular BlockIdentifier. A hard requirement for blocks returned by Rosetta implementations is that they MUST be _inalterable_: once a client has requested and received a block identified by a specific BlockIndentifier, all future calls for that same BlockIdentifier must return the same block contents.",
"type":"object",
"required": [
"block_identifier",
Expand Down
8 changes: 8 additions & 0 deletions api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ paths:
include these transactions in the Block object. If not, an array of
Transaction Identifiers should be returned so /block/transaction
fetches can be done to get all transaction information.
When requesting a block by the hash component of the BlockIdentifier,
this request MUST be idempotent: repeated invocations for the same
hash-identified block must return the exact same block contents.
No such restriction is imposed when requesting a block by height,
given that a chain reorg event might cause the specific block at
height `n` to be set to a different one.
operationId: block
tags:
- Block
Expand Down
7 changes: 7 additions & 0 deletions models/Block.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
description: |
Blocks contain an array of Transactions that
occurred at a particular BlockIdentifier.
A hard requirement for blocks returned by Rosetta
implementations is that they MUST be _inalterable_:
once a client has requested and received
a block identified by a specific BlockIndentifier,
all future calls for that same BlockIdentifier
must return the same block contents.
type: object
required:
- block_identifier
Expand Down

0 comments on commit a3a6607

Please sign in to comment.