Repository navigation
Commit 3769eca
authored
Fix engine, module, storage and scaffolder defects found in the code review (#31)
* Fix engine, module, storage and scaffolder defects found in the code review
Engine (@eclesia/indexer-engine)
- Match CometBFT 0.38 finalize_block events on mode=BeginBlock/EndBlock so
begin_block and end_block handlers receive events on SDK 0.50+ chains.
- Fill gaps between announced heights in WebSocket mode; live blocks flow
through the catch-up fetcher, which applies backpressure via the circular
buffer instead of restarting.
- Run event handlers sequentially in registration order; drop the uuid
acknowledgement protocol; expose EclesiaEmitter.handlersFor().
- Recover when the block subscription errors or closes; enforce the
configured chainId; honour ABCI response codes; paginate validator-set
fetches; bound every RPC call with a shared withTimeout helper.
- Treat an idle chain as WAITING instead of a failure; unlimited capped
exponential backoff (5 s to 5 min, or maxRetries); a block that fails
maxFailuresPerBlock times emits fatal-error with the height.
- Add stale-run guards, exact endHeight, whenStopped(), and an async stop()
that tears down timers, subscriptions, clients and HTTP servers.
- Fix a leak in the wait for block data: racing against a never-settling
recovery promise retained every delivered block (about 10 KB per block).
- Genesis import on stream-json 3 / stream-chain 4 with error listeners on
the stream chains and onGenesisStart / onGenesisComplete hooks.
- Structured stdout-only logging with error formatting and URL redaction,
logFormat json|text, and level-guarded per-message log calls.
- Configurable bind hosts for the health and metrics servers; a gauge that
reports when the indexer is waiting for blocks.
- CircularBuffer refuses to overwrite when full and throws on an empty
dequeue; PromiseQueue is deprecated.
- Export EclesiaIndexer and EclesiaIndexerConfig, keeping the misspelt
names as deprecated aliases; ship the global EventMap declaration.
- Mock RPC client: CometBFT 0.37 and 0.38 shapes, paginated validators,
module accounts, balances, deterministic block hashes, transfer events.
- Remove dayjs, uuid and unused type packages; make @cosmjs/encoding a
runtime dependency; publish dist/ only.
Core modules (@eclesia/core-modules-pg)
- Staking: record undelegations and cancelled unbondings, handle
MsgUpdateParams, read the latest validator rows (ORDER BY height DESC
NULLS LAST), scale LegacyDec values, derive consensus addresses for
ed25519 and secp256k1 keys, keep unchanged fields on validator edits,
store a NULL avatar_url, paginate delegator delegations, fall back to
chain params, and require the blocks-full module.
- Bank: import genesis balances for accounts holding several denoms, apply
negative deltas correctly, and fix the COIN literal (no leading space).
- Auth: import module accounts from the chain with a well-known fallback and
snapshot balances at height 1.
- Blocks: TIMESTAMPTZ timestamps, bigint-safe JSON serialisation, corrected
prepared-statement names.
- Versioned SQL migrations per module (schema_migrations), NUMERIC amounts,
removal of redundant height indexes.
PostgreSQL indexer (@eclesia/basic-pg-indexer)
- Reconnect after the connection drops instead of crashing; stop() and
run() resolve only once the indexer has stopped; exit on fatal-error
unless exitOnFatal is false.
- Apply versioned migrations with a baseline for pre-existing schemas;
track genesis imports and refuse to resume a partial one.
- SET synchronous_commit once per connection (configurable); the silly-mode
client is a Proxy; recycling no longer masks errors; addModules rejects
duplicates and late additions.
- Declare @eclesia/indexer-engine as a runtime dependency and drop unused
dependencies.
Scaffolder (create-eclesia-indexer)
- Fix the published bin, which could not start.
- Multi-stage Node 22 Dockerfiles for pnpm, npm and yarn; .dockerignore,
gitignore and license in the template; compose stack with generated
Postgres and Hasura secrets in .env, depends_on, and Hasura dev mode off.
- Validate project input, escape template substitution, allow the bank
module without a genesis file, conditional genesisPath, dotenv loading.
- Remove the stray package-lock.json.
Repository
- Changesets release workflow with npm trusted publishing; the four packages
form a lockstep fixed group; packageManager pinned.
- CI on Node 22 with a Postgres service, unit, build and end-to-end steps,
and a production audit that fails on high advisories.
- Type-check test files with the sources; new unit tests for the engine
lifecycle, mock client, timeouts, storage and modules (184 in total).
- End-to-end suite running PgIndexer with the core modules against
PostgreSQL for both CometBFT shapes.
- Benchmarks updated for the async lifecycle plus a genesis-import
benchmark; README, PERFORMANCE, TROUBLESHOOTING, tutorials, Grafana docs
and dashboard, and generated API docs refreshed.
- Husky runs lint-staged per package; test scripts run vitest once.
- Remove the tracked profiler output and the old e2e placeholder.
* ci: build the workspace before running unit tests
The PostgreSQL indexer and core module tests import @eclesia/indexer-engine
through its package entry points, which resolve to dist/. The test job ran
pnpm test before pnpm build, so on a clean runner every suite in
basic-indexer-pg failed to resolve the engine. Build first, then run the unit
and end-to-end suites.1 parent ccdc870 commit 3769eca
206 files changed
Lines changed: 14361 additions & 4167 deletions
File tree
- .changeset
- .github/workflows
- docs
- api
- assets
- classes
- functions
- interfaces
- media
- modules
- types
- variables
- monitoring/grafana
- packages
- basic-indexer-pg
- src
- __tests__
- core-modules
- src
- blocks
- sql
- full
- minimal
- cosmos.auth.v1beta1
- __tests__
- sql
- cosmos.bank.v1beta1
- __tests__
- sql
- cosmos.staking.v1beta1
- __tests__
- sql
- create-eclesia-indexer
- bin
- src
- templates/basic
- src
- indexer-engine
- benchmarks
- src
- emitter
- indexer
- metrics
- mocks
- promise-queue
- types
- utils
- test-runner-profile
- tests
- e2e
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
4 | 9 | | |
5 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
6 | 18 | | |
7 | | - | |
| 19 | + | |
8 | 20 | | |
9 | 21 | | |
10 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments