Skip to content

Commit

Permalink
chore: Add proof data access for notices + vouchers in GraphQL queries
Browse files Browse the repository at this point in the history
  • Loading branch information
masiedu4 committed Aug 16, 2024
1 parent a3318e6 commit e14911f
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ query {
}
```

## Proof Data

For notices and vouchers, the API provides access to proof data that can be used for validation on the base layer blockchain. This proof data is accessible through the [`Proof`](./objects/proof.md) field on notice and voucher objects.

## Response Format

API responses are in JSON format and typically have the following structure:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ enum CompletionStatus {
| ---- | ----------- |
| `Unprocessed` | The input has not been processed yet. |
| `Accepted` | The input was accepted and processed successfully. |
| `Rejected` | The input was rejected and not processed. |
| `Rejected` | The input was processed and the results were rejected. |
| `Exception` | An exception occurred during the processing of the input. |
| `MachineHalted` | The machine halted during the processing of the input. |
| `CycleLimitExceeded` | The cycle limit was exceeded during the processing of the input. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ hide_table_of_contents: false

Notices are informational statements that can be validated in the base layer blockchain.


## 1. Get Notice by Index

Retrieve a specific notice based on its index and associated input index.
Expand Down Expand Up @@ -39,14 +38,14 @@ query notice($noticeIndex: Int!, $inputIndex: Int!) {
}
```

### Arguments

| Name | Type | Description |
| ---- | ---- | ----------- |
| `noticeIndex` | [`Int!`](../../scalars/int) | Index of the notice to retrieve. |
| `inputIndex` | [`Int!`](../../scalars/int) | Index of the input associated with the notice. |
For notices, the API provides access to proof data that can be used for validation on the base layer blockchain. This proof data is accessible through the [`Proof`](../objects/proof.md) field on notice objects.

### Arguments

| Name | Type | Description |
| ------------- | --------------------------- | ---------------------------------------------- |
| `noticeIndex` | [`Int!`](../../scalars/int) | Index of the notice to retrieve. |
| `inputIndex` | [`Int!`](../../scalars/int) | Index of the input associated with the notice. |

### Response Type

Expand Down Expand Up @@ -110,8 +109,8 @@ query noticesByInput($inputIndex: Int!) {

### Arguments

| Name | Type | Description |
| ---- | ---- | ----------- |
| Name | Type | Description |
| ------------ | --------------------------- | ------------------------------------------- |
| `inputIndex` | [`Int!`](../../scalars/int) | Index of the input to retrieve notices for. |

### Response Type
Expand All @@ -123,34 +122,55 @@ query noticesByInput($inputIndex: Int!) {

1. Fetching a specific notice:

```graphql
query {
notice(noticeIndex: 3, inputIndex: 2) {
index
payload
proof {
validity {
inputIndexWithinEpoch
outputIndexWithinInput
}
context
```graphql
query {
notice(noticeIndex: 3, inputIndex: 2) {
index
payload
proof {
validity {
inputIndexWithinEpoch
outputIndexWithinInput
}
context
}
}
```
}
```

2. Listing earlier(first 5) notices:

```graphql
query {
notices(first: 5) {
```graphql
query {
notices(first: 5) {
edges {
node {
index
input {
index
timestamp
}
payload
}
cursor
}
pageInfo {
hasNextPage
endCursor
}
}
}
```

3. Retrieving notices for a specific input:

```graphql
query {
input(index: 10) {
notices(first: 3) {
edges {
node {
index
input {
index
timestamp
}
payload
}
cursor
Expand All @@ -161,26 +181,5 @@ query noticesByInput($inputIndex: Int!) {
}
}
}
```

3. Retrieving notices for a specific input:

```graphql
query {
input(index: 10) {
notices(first: 3) {
edges {
node {
index
payload
}
cursor
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
```
}
```
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
id: list_reports
id: reports
title: Reports
hide_table_of_contents: false
---

reports contain application logs or diagnostic information and cannot be validated on-chain.
Reports contain application logs or diagnostic information and cannot be validated on-chain.

## 1. Get Report by Index

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ query voucher($voucherIndex: Int!, $inputIndex: Int!) {
}
}
```
For vouchers, the API provides access to proof data that can be used for validation on the base layer blockchain. This proof data is accessible through the [`Proof`](../objects/proof.md) field on voucher objects.

### Arguments

Expand Down
8 changes: 4 additions & 4 deletions cartesi-rollups_versioned_sidebars/version-1.5-sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@
"label": "Queries",
"collapsed": true,
"items": [
{
"type": "autogenerated",
"dirName": "rollups-apis/graphql/queries"
}
"rollups-apis/graphql/queries/inputs",
"rollups-apis/graphql/queries/notices",
"rollups-apis/graphql/queries/vouchers",
"rollups-apis/graphql/queries/reports"
]
},
{
Expand Down

0 comments on commit e14911f

Please sign in to comment.