Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/HyperIndex/Guides/schema-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Scalar types represent basic data types and map directly to JavaScript, TypeScri
| `BigInt` | Signed integer (`int256` in Solidity) | `bigint` | `bigint` |
| `BigDecimal` | Arbitrary-size floating-point | `BigDecimal` (imported) | `BigDecimal.t` |
| `Timestamp` | Timestamp with timezone | `Date` | `Js.Date.t` |
| `Json` | JSON object (from envio@2.20) | `Json` | `Js.Json.t` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Power!!


Learn more about GraphQL scalars [here](https://graphql.org/learn/).

Expand Down
127 changes: 38 additions & 89 deletions docs/HyperIndex/Troubleshoot/logging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,83 +29,57 @@ When implementing handlers for your indexer, use the logging functions provided
- `<context>.log.info` - For general information about application flow
- `<context>.log.warn` - For potentially problematic situations
- `<context>.log.error` - For error events that might still allow the application to continue
- `<context>.log.errorWithExn` - Same as `error`, but takes an exception as the first argument to include stacktraces and error messages in the log

### Examples by Language

<Tabs>
<TabItem value="javascript" label="JavaScript">
<TabItem value="typescript" label="TypeScript">

```javascript
```typescript
// Inside your handler
context.log.debug(
`Processing event with block hash: ${event.blockHash} (debug)`
);
context.log.info(`Processing event with block hash: ${event.blockHash} (info)`);
context.log.warn(`Potential issue with event: ${event.blockHash} (warn)`);
context.log.error(`Failed to process event: ${event.blockHash} (error)`);
context.log.errorWithExn(
new Error("Error processing event"),
`Failed to process event: ${event.blockHash}`

// With exception:
context.log.error(
`Failed to process event: ${event.blockHash}`,
new Error("Error processing event")
);

// You can also pass objects to logs for structured logging:
context.log.info({
msg: "Processing blockchain event",
// You can also provide an object as the second argument for structured logging:
context.log.info("Processing blockchain event", {
type: "info",
extra: "Additional debugging context",
data: { blockHash: event.blockHash },
});
```

</TabItem>
<TabItem value="typescript" label="TypeScript">
<TabItem value="javascript" label="JavaScript">

```typescript
```javascript
// Inside your handler
context.log.debug(
`Processing event with block hash: ${event.blockHash} (debug)`
);
context.log.info(`Processing event with block hash: ${event.blockHash} (info)`);
context.log.warn(`Potential issue with event: ${event.blockHash} (warn)`);
context.log.error(`Failed to process event: ${event.blockHash} (error)`);
context.log.errorWithExn(
new Error("Error processing event"),
`Failed to process event: ${event.blockHash}`
);
```

{/* Note: Our TypeScript bindings currently only accept strings as arguments to logs. We have an open issue to allow the 'any' type for more flexibility */}

For structured logging with TypeScript, use the following pattern:

```typescript
import Logs from "generated/src/Logs.bs.js";
// With exception:
context.log.error(
`Failed to process event: ${event.blockHash}`,
new Error("Error processing event")
);

// Inside your handler
Logs.debug(context.log, {
msg: "Processing blockchain event",
type: "debug",
data: { blockHash: event.blockHash },
});
Logs.info(context.log, {
msg: "Processing blockchain event",
// You can also provide an object as the second argument for structured logging:
context.log.info("Processing blockchain event", {
type: "info",
data: { blockHash: event.blockHash },
});
Logs.warn(context.log, {
msg: "Potential issue with event",
type: "warn",
data: { blockHash: event.blockHash },
});
Logs.error(context.log, {
msg: "Failed to process event",
type: "error",
data: { blockHash: event.blockHash },
});
Logs.errorWithExn(context.log, new Error("Error in processing"), {
msg: "Failed to process event",
type: "error",
extra: "Additional debugging context",
data: { blockHash: event.blockHash },
});
```
Expand All @@ -114,52 +88,27 @@ Logs.errorWithExn(context.log, new Error("Error in processing"), {
<TabItem value="rescript" label="ReScript">

```rescript
// Inside your handler
exception ExampleException(string) // Example of an exception

// Basic string logging
context.log.debug(`Processing event with block hash: ${event.blockHash} (debug)`)
context.log.info(`Processing event with block hash: ${event.blockHash} (info)`)
context.log.warn(`Potential issue with event: ${event.blockHash} (warn)`)
context.log.error(`Failed to process event: ${event.blockHash} (error)`)
context.log.errorWithExn(
ExampleException("Error processing event"),
`Failed to process event: ${event.blockHash}`,
)
```
// Inside your handler
exception ExampleException(string) // Example of an exception

For structured logging in ReScript (since records are strictly typed and not polymorphic):
// Basic string logging
context.log.debug(`Processing event with block hash: ${event.blockHash} (debug)`)
context.log.info(`Processing event with block hash: ${event.blockHash} (info)`)
context.log.warn(`Potential issue with event: ${event.blockHash} (warn)`)
context.log.error(`Failed to process event: ${event.blockHash} (error)`)

```rescript
// Structured logging with objects
context.log->Logs.debug({
"msg": "Processing blockchain event",
"type": "debug",
"data": {"blockHash": event.blockHash},
})
context.log->Logs.info({
"msg": "Processing blockchain event",
"type": "info",
"data": {"blockHash": event.blockHash},
})
context.log->Logs.warn({
"msg": "Potential issue with event",
"type": "warn",
"data": {"blockHash": event.blockHash},
})
context.log->Logs.error({
"msg": "Failed to process event",
"type": "error",
"data": {"blockHash": event.blockHash},
})
context.log->Logs.errorWithExn(
ExampleException("Error processing event"),
{
"msg": "Failed to process event",
"type": "error",
"data": {"blockHash": event.blockHash},
},
)
// With exception:
context.log.errorWithExn(
`Failed to process event: ${event.blockHash}`,
ExampleException("Error processing event")
)

// You can also provide an object as the second argument for structured logging:
context.log.info("Processing blockchain event", ~params={
"type": "info",
"extra": "Additional debugging context",
"data": { "blockHash": event.blockHash },
});
```

</TabItem>
Expand Down
8 changes: 4 additions & 4 deletions docs/HyperIndex/benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ HyperIndex delivers industry-leading performance for blockchain data indexing. I

## Recent Independent Benchmarks

The most comprehensive and up-to-date benchmarks were conducted by Sentio in April 2025 and are available in the [sentioxyz/indexer-benchmark repository](https://github.com/sentioxyz/indexer-benchmark). These benchmarks compare Envio's HyperIndex against other popular indexers across multiple real-world scenarios:
The most comprehensive and up-to-date benchmarks were conducted by Sentio in April 2025 and are available in the [sentio-benchmark repository](https://github.com/enviodev/sentio-benchmark). These benchmarks compare Envio's HyperIndex against other popular indexers across multiple real-world scenarios:

### Key Performance Highlights

| Case | Description | Envio | Nearest Competitor | TheGraph | Ponder | Advantage vs. Nearest |
| ------------------------------ | ------------------------------------------- | ------ | ------------------ | -------- | ------ | --------------------- |
| LBTC Token Transfers | Event handling, No RPC calls, Write-only | 2m | 8m (Sentio) | 3h9m | 1h40m | 4x faster |
| LBTC Token with RPC calls | Event handling, RPC calls, Read-after-write | 1m | 32m (Subsquid) | 18h38m | 4h38m | 32x faster |
| LBTC Token with RPC calls | Event handling, RPC calls, Read-after-write | 15s | 32m (Subsquid) | 18h38m | 4h38m | 128x faster |
| Ethereum Block Processing | 100K blocks with Metadata extraction | 7.9s | 1m (Subsquid) | 10m | 33m | 7.5x faster |
| Ethereum Transaction Gas Usage | Transaction handling, Gas calculations | 1m 26s | 5m (Subsquid) | N/A | 33m | 3.5x faster |
| Uniswap V2 Swap Trace Analysis | Transaction trace handling, Swap decoding | 41s | 2m (Subsquid) | 8m | N/A | 3x faster |
| Uniswap V2 Factory | Event handling, Pair and swap analysis | 20s | 2m (Subsquid) | 34m | 2h24m | 6x faster |
| Uniswap V2 Factory | Event handling, Pair and swap analysis | 10s | 2m (Subsquid) | 19m | 2h24m | 12x faster |

The independent benchmark results demonstrate that HyperIndex consistently outperforms all competitors across every tested scenario. The most significant performance advantage was seen in real-world indexing scenarios with external RPC calls, where HyperIndex was up to 32x faster than the nearest competitor and over 1000x faster than TheGraph.
The independent benchmark results demonstrate that HyperIndex consistently outperforms all competitors across every tested scenario. The most significant performance advantage was seen in real-world indexing scenarios with external RPC calls, where HyperIndex was up to 128x faster than the nearest competitor and over 4000x faster than TheGraph.
Comment on lines 21 to +29
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!! Seems these are still being very actively developed on so will probably need to revisit and update every now and then


## Historical Benchmarking Results

Expand Down