Skip to content

Commit

Permalink
revert freeze logs
Browse files Browse the repository at this point in the history
  • Loading branch information
wighawag committed Nov 26, 2023
1 parent 1e935d2 commit 6b51fbf
Show file tree
Hide file tree
Showing 19 changed files with 70 additions and 50 deletions.
7 changes: 7 additions & 0 deletions examples/event-processor-bleeps/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# event-processor-bleeps

## 0.0.51

### Patch Changes

- Updated dependencies
- ethereum-indexer-js-processor@0.6.25

## 0.0.50

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/event-processor-bleeps/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "event-processor-bleeps",
"private": true,
"version": "0.0.50",
"version": "0.0.51",
"description": "",
"type": "module",
"main": "dist/index.cjs",
Expand Down
7 changes: 7 additions & 0 deletions examples/event-processor-conquest-eth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# event-processor-conquest-eth

## 0.0.51

### Patch Changes

- Updated dependencies
- ethereum-indexer-js-processor@0.6.25

## 0.0.50

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/event-processor-conquest-eth/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "event-processor-conquest-eth",
"private": true,
"version": "0.0.50",
"version": "0.0.51",
"description": "",
"type": "module",
"main": "dist/index.cjs",
Expand Down
7 changes: 7 additions & 0 deletions examples/event-processor-conquest-fplay/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# event-processor-conquest-fplay

## 0.0.51

### Patch Changes

- Updated dependencies
- ethereum-indexer-js-processor@0.6.25

## 0.0.50

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/event-processor-conquest-fplay/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "event-processor-conquest-fplay",
"private": true,
"version": "0.0.50",
"version": "0.0.51",
"description": "",
"type": "module",
"main": "dist/index.cjs",
Expand Down
7 changes: 7 additions & 0 deletions examples/event-processor-nfts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# event-processor-nfts

## 0.0.51

### Patch Changes

- Updated dependencies
- ethereum-indexer-js-processor@0.6.25

## 0.0.50

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/event-processor-nfts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "event-processor-nfts",
"private": true,
"version": "0.0.50",
"version": "0.0.51",
"description": "",
"type": "module",
"main": "dist/index.cjs",
Expand Down
11 changes: 11 additions & 0 deletions examples/mud/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# web-demo

## 0.1.57

### Patch Changes

- Updated dependencies
- ethereum-indexer-js-processor@0.6.25
- ethereum-indexer-browser@0.6.27
- event-processor-bleeps@0.0.51
- event-processor-conquest-eth@0.0.51
- event-processor-nfts@0.0.51

## 0.1.56

### 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.56",
"version": "0.1.57",
"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.57

### Patch Changes

- Updated dependencies
- ethereum-indexer-browser@0.6.27
- event-processor-bleeps@0.0.51
- event-processor-conquest-eth@0.0.51
- event-processor-nfts@0.0.51

## 0.1.56

### 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.56",
"version": "0.1.57",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
6 changes: 6 additions & 0 deletions packages/ethereum-indexer-browser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ethereum-indexer-browser

## 0.6.27

### Patch Changes

- revert freeze logs

## 0.6.26

### 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.6.26",
"version": "0.6.27",
"publishConfig": {
"access": "public"
},
Expand Down
19 changes: 1 addition & 18 deletions packages/ethereum-indexer-browser/src/IndexerState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,7 @@ export function createIndexerState<ABI extends Abi, ProcessResultType, Processor
const initialState = processor.createInitialState();

const {set: setStatus, readable: readableStatus} = createStore<StatusState>({state: 'Idle'});
const initialState_frozen = Object.isFrozen(initialState);
console.log({initialState_frozen});
const {set: setState, readable: readableState} = createRootStore<ProcessResultType>({...initialState});
const initialState_store_frozen = Object.isFrozen(initialState);
console.log({initialState_store_frozen});
const {set: setState, readable: readableState} = createRootStore<ProcessResultType>(initialState);

let indexer: EthereumIndexer<ABI, ProcessResultType> | undefined;
let indexingTimeout: number | undefined;
Expand Down Expand Up @@ -153,13 +149,9 @@ export function createIndexerState<ABI extends Abi, ProcessResultType, Processor
})
}

const before_configure_frozen = Object.isFrozen(initialState);
console.log({before_configure_frozen});
if (processor.configure && processorConfig) {
processor.configure(processorConfig);
}
const after_configure_frozen = Object.isFrozen(initialState);
console.log({after_configure_frozen});
indexer = new EthereumIndexer<ABI, ProcessResultType>(provider, processor, source, config);
setSyncing({waitingForProvider: false});
}
Expand Down Expand Up @@ -189,18 +181,13 @@ export function createIndexerState<ABI extends Abi, ProcessResultType, Processor
}

async function setupIndexing(): Promise<LastSync<ABI>> {
const setupIndexing_frozen = Object.isFrozen(initialState);
console.log({setupIndexing_frozen});
if ($syncing.lastSync) {
return $syncing.lastSync;
}
if (!indexer) {
throw new Error(`no indexer`);
}
indexer.onLoad = async (loadingState) => {
const onload_frozen = Object.isFrozen(initialState);
console.log({onload_frozen});

setStatus({state: loadingState});
if (loadingState === 'Loading') {
} else if (loadingState === 'Fetching') {
Expand All @@ -213,14 +200,10 @@ export function createIndexerState<ABI extends Abi, ProcessResultType, Processor
await wait(0.001); // allow propagation if the whole proces is synchronous
};
indexer.onLastSyncUpdated = (lastSync) => {
const onLastSyncUpdated_frozen = Object.isFrozen(initialState);
console.log({onLastSyncUpdated_frozen});
// should we also wait ?
setLastSync(lastSync);
};
indexer.onStateUpdated = (state) => {
const onStateUpdated_frozen = Object.isFrozen(state);
console.log({onStateUpdated_frozen});
setState(state);
};

Expand Down
6 changes: 6 additions & 0 deletions packages/ethereum-indexer-js-processor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ethereum-indexer-js-processor

## 0.6.25

### Patch Changes

- revert freeze logs

## 0.6.24

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-js-processor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-js-processor",
"version": "0.6.24",
"version": "0.6.25",
"description": "",
"keywords": [],
"author": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ export class JSObjectEventProcessor<ABI extends Abi, ProcessResultType extends J
constructor(private singleEventProcessor: SingleEventJSONProcessor<ABI, ProcessResultType, ProcessorConfig>) {
this.version = singleEventProcessor.version;
const state = singleEventProcessor.createInitialState();
const initial_frozen = Object.isFrozen(state);
console.log({initial_frozen});
const history = {
blockHashes: {},
reversals: {},
Expand All @@ -57,9 +55,6 @@ export class JSObjectEventProcessor<ABI extends Abi, ProcessResultType extends J
history,
};
this.history = new History(history);

const constructor_frozen = Object.isFrozen(this._json.state);
console.log({constructor_frozen});
}

copyFrom(otherProcessor: JSObjectEventProcessor<ABI, ProcessResultType, ProcessorConfig>) {
Expand Down Expand Up @@ -94,8 +89,6 @@ export class JSObjectEventProcessor<ABI extends Abi, ProcessResultType extends J
async reset() {
namedLogger.info('JSObjectEventProcessor reseting...');
const state = this.singleEventProcessor.createInitialState();
const reset_frozen = Object.isFrozen(state);
console.log({reset_frozen});
this.version = this.singleEventProcessor.version;
const history = {
blockHashes: {},
Expand Down Expand Up @@ -149,16 +142,10 @@ export class JSObjectEventProcessor<ABI extends Abi, ProcessResultType extends J

this._json.state = state;
this._json.lastSync = lastSyncFromExistingState;

const fetched_frozen = Object.isFrozen(this._json.state);
console.log({fetched_frozen});
}
}
}

const loaded_frozen = Object.isFrozen(this._json.state);
console.log({loaded_frozen});

if (!this._json.lastSync) {
return undefined;
}
Expand Down Expand Up @@ -190,9 +177,6 @@ export class JSObjectEventProcessor<ABI extends Abi, ProcessResultType extends J
if (!lastBlockDeleted || event.blockHash != lastBlockDeleted) {
namedLogger.info(`JSObjectEventProcessor preparing block...`);
this._json.state = this.history.reverseBlock(event.blockNumber, event.blockHash, this._json.state);

const removed_frozen = Object.isFrozen(this._json.state);
console.log({removed_frozen});
lastBlockDeleted = event.blockHash;
}
} else {
Expand All @@ -205,8 +189,6 @@ export class JSObjectEventProcessor<ABI extends Abi, ProcessResultType extends J
this.history.setReversal(reversePatches);
}) as ProcessResultType;
this._json.state = finalizedDraft as unknown as ProcessResultType;
const finalized_frozen = Object.isFrozen(this._json.state);
console.log({finalized_frozen});
}

this.history.setBlock(event.blockNumber, event.blockHash);
Expand All @@ -226,9 +208,6 @@ export class JSObjectEventProcessor<ABI extends Abi, ProcessResultType extends J
this.history.setReversal(reversePatches);
}) as ProcessResultType;
this._json.state = finalizedDraft;

const final_finalized_frozen = Object.isFrozen(this._json.state);
console.log({final_finalized_frozen});
}

let lastLastSync;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ export class History {
}

setReversal(patches: Patch[]) {
if (patches === undefined || patches === null) {
throw new Error(`no patches provided`)
}
if (!this.blockHash) {
throw new Error(`no blockhash set`);
}
Expand Down

0 comments on commit 6b51fbf

Please sign in to comment.