Skip to content

Commit

Permalink
use source hash in generated file names for indexed state
Browse files Browse the repository at this point in the history
  • Loading branch information
wighawag committed Mar 29, 2024
1 parent dafea76 commit 7e6291c
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 9 deletions.
10 changes: 10 additions & 0 deletions examples/mud/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# web-demo

## 0.1.68

### Patch Changes

- Updated dependencies
- ethereum-indexer-browser@0.7.6
- event-processor-bleeps@0.0.56
- event-processor-conquest-eth@0.0.56
- event-processor-nfts@0.0.56

## 0.1.67

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/mud/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mud-demo",
"private": true,
"version": "0.1.67",
"version": "0.1.68",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
10 changes: 10 additions & 0 deletions examples/web-demo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# web-demo

## 0.1.68

### Patch Changes

- Updated dependencies
- ethereum-indexer-browser@0.7.6
- event-processor-bleeps@0.0.56
- event-processor-conquest-eth@0.0.56
- event-processor-nfts@0.0.56

## 0.1.67

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/web-demo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "web-demo",
"private": true,
"version": "0.1.67",
"version": "0.1.68",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
8 changes: 8 additions & 0 deletions packages/ethereum-indexer-browser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# ethereum-indexer-browser

## 0.7.6

### Patch Changes

- use source hash in generated file names for indexed state
- Updated dependencies
- ethereum-indexer-utils@0.6.13

## 0.7.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-browser",
"version": "0.7.5",
"version": "0.7.6",
"publishConfig": {
"access": "public"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export function keepStateOnIndexedDB<ABI extends Abi, ProcessResultType, Process
// console.log(`Using ${latest.index}`)
// }
const url = getURL(remote[latest.index], context);
// console.log(`fetching ${url}`);
try {
const response = await fetch(url);
const text = await response.text();
Expand All @@ -132,6 +133,7 @@ export function keepStateOnIndexedDB<ABI extends Abi, ProcessResultType, Process
}
} else {
const url = getURL(remote, context);
// console.log(`fetching single remote ${url}`);
try {
const response = await fetch(url);
const text = await response.text();
Expand Down
7 changes: 7 additions & 0 deletions packages/ethereum-indexer-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ethereum-indexer-cli

## 0.6.30

### Patch Changes

- Updated dependencies
- ethereum-indexer-utils@0.6.13

## 0.6.29

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-cli",
"version": "0.6.29",
"version": "0.6.30",
"description": "",
"keywords": [],
"author": "",
Expand Down
7 changes: 7 additions & 0 deletions packages/ethereum-indexer-fs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ethereum-indexer-browser

## 0.7.7

### Patch Changes

- Updated dependencies
- ethereum-indexer-utils@0.6.13

## 0.7.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-fs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-fs",
"version": "0.7.6",
"version": "0.7.7",
"publishConfig": {
"access": "public"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/ethereum-indexer-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ethereum-indexer-server

## 0.6.32

### Patch Changes

- Updated dependencies
- ethereum-indexer-utils@0.6.13

## 0.6.31

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-server",
"version": "0.6.31",
"version": "0.6.32",
"description": "",
"keywords": [],
"author": "",
Expand Down
7 changes: 7 additions & 0 deletions packages/ethereum-indexer-streams/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ethereum-indexer-server

## 0.6.28

### Patch Changes

- Updated dependencies
- ethereum-indexer-utils@0.6.13

## 0.6.27

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-streams/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-streams",
"version": "0.6.27",
"version": "0.6.28",
"description": "",
"keywords": [],
"author": "",
Expand Down
6 changes: 6 additions & 0 deletions packages/ethereum-indexer-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ethereum-indexer-utils

## 0.6.13

### Patch Changes

- use source hash in generated file names for indexed state

## 0.6.12

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-utils",
"version": "0.6.12",
"version": "0.6.13",
"description": "",
"publishConfig": {
"access": "public"
Expand Down
3 changes: 2 additions & 1 deletion packages/ethereum-indexer-utils/src/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ export function formatLastSync<ABI extends Abi>(lastSync: LastSync<ABI>): any {

export function contextFilenames(context: ProcessorContext<Abi, any>) {
const configHash = 'config' in context && context.config ? simple_hash(context.config) : undefined;
const sourceHash = simple_hash(context.source);
const networkString = `${context.source.chainId }${(context.source.chainId == '1337' || context.source.chainId == '31337') && context.source.genesisHash ? `-${context.source.genesisHash}`: ''}`
const prefix = `${networkString}${configHash ? `-${configHash}`: ``}${context.version ? `-${context.version}`: ``}`;
const prefix = `${networkString}-${sourceHash}${configHash ? `-${configHash}`: ``}${context.version ? `-${context.version}`: ``}`;
const stateFile = `${prefix}-state.json`;
const lastSyncFile = `${prefix}-lastSync.json`;
return {stateFile,lastSyncFile}
Expand Down

0 comments on commit 7e6291c

Please sign in to comment.