Commit graph

290 commits

Author SHA1 Message Date
johba
1c6f118f6b fix/node-modules-named-volumes (#94)
Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/94
2025-11-13 18:17:56 +01:00
johba
19bac420d0 fix/docker-log-rotation-disk-management (#93)
Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/93
2025-11-09 12:57:49 +01:00
johba
5d71753086 migrate/podman-to-docker (#92)
podman to docker

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/92
2025-11-08 14:08:46 +01:00
johba
c2720c35a5 fix: configure Jest for ES modules in kraiken-lib (#88)
Updates Jest configuration to properly handle ES module syntax:
- Switch to ts-jest/presets/default-esm preset
- Add custom resolver to map .js imports to .ts source files
- Configure extensionsToTreatAsEsm for TypeScript files
- Enable useESM in ts-jest globals

This resolves module resolution errors when running tests in
kraiken-lib which uses "type": "module" in package.json.

Fixes #85

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/88
2025-11-08 12:03:48 +01:00
johba
07a522e3fb Merge pull request 'fix: correct ProcessEnv type import in txnBot' (#91) from fix/txnbot-processenv-type into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/91
2025-11-08 11:58:49 +01:00
openhands
a8786f6460 fix: correct ProcessEnv type import in txnBot
Changes ProcessEnv import from non-existent 'node:process' module
to use built-in NodeJS.ProcessEnv type.

Fixes TypeScript compilation error:
  Module '"node:process"' has no exported member 'ProcessEnv'

Also adds NodeJS to ESLint globals to resolve no-undef warning.

All services now healthy and operational.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 10:39:27 +00:00
johba
9852e55d40 Merge pull request 'config: add configurable RPC timeout for Ponder stability' (#90) from config/ponder-rpc-timeout into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/90
2025-11-06 12:27:13 +01:00
openhands
3564a36408 config: add configurable RPC timeout for Ponder stability
Adds PONDER_RPC_TIMEOUT environment variable to improve Ponder
stability on slow RPC connections or under load. Default is 20000ms
(20 seconds).

## Changes
- containers/ponder-dev-entrypoint.sh: Export PONDER_RPC_TIMEOUT with default of 20000ms
- podman-compose.yml: Add PONDER_RPC_TIMEOUT to ponder service environment

## Configuration
The timeout can be overridden by setting PONDER_RPC_TIMEOUT in your
environment before starting the stack:
```bash
export PONDER_RPC_TIMEOUT=30000  # 30 seconds
./scripts/dev.sh start
```

## Impact
- Low risk: Configuration-only change
- No breaking changes
- Improves stability on slower networks or forked environments
- Defaults to 20 seconds if not specified

Fixes #87

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 08:58:31 +00:00
johba
c8162b2f3f Merge pull request 'fill stake e2e' (#82) from feature/e2e-max-stake-test into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/82
2025-10-12 10:35:38 +02:00
johba
aa1ddfcecd fill stake e2e 2025-10-11 17:54:49 +00:00
johba
30ed4aa072 Merge pull request 'feat: surface stack versions in app footer' (#81) from feature/expose-stack-versions into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/81
2025-10-11 19:22:46 +02:00
johba
d8119da65b feat: surface stack versions in app footer 2025-10-11 17:21:45 +00:00
johba
beea5f67f9 Merge pull request 'feature/txn-bot-service-refactor' (#80) from feature/txn-bot-service-refactor into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/80
2025-10-11 17:50:00 +02:00
johba
f039221d4a txnbot refactor 2025-10-11 15:47:16 +00:00
johba
bd475c2271 min stake from backend (#78)
resolves #74

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/78
2025-10-11 15:30:08 +02:00
johba
0b3545091f Merge pull request 'position stream' (#77) from feature/ponder-position-stream into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/77
2025-10-11 14:35:58 +02:00
johba
55321eff65 position stream 2025-10-11 12:33:35 +00:00
johba
0674648044 Merge pull request 'improve web-app config' (#76) from fix/rpc-api-paths into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/76
2025-10-11 12:57:23 +02:00
johba
371a8557b7 improve web-app config 2025-10-11 10:55:49 +00:00
johba
280e2973cd Merge pull request 'reworked stack' (#71) from feature/stake-accessibility into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/71
2025-10-07 23:59:34 +02:00
johba
f7ef56f65f reworked stack 2025-10-07 21:57:32 +00:00
johba
6cbb1781ce tax rate, version and compose (#70)
resolves #67

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/70
2025-10-07 19:26:08 +02:00
johba
d8ca557eb6 Merge pull request 'cleanup' (#69) from cleanup into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/69
2025-10-07 15:09:10 +02:00
johba
c3d2a50804 cleanup 2025-10-07 13:08:21 +00:00
johba
8cd64e808f feat: Add test helper for E2E staking flow (#66)
Implements window.__testHelpers.fillStakeForm() to enable stable E2E testing
of the staking form without fragile UI selectors.

## Changes

- Add window.__testHelpers interface (dev mode only)
- Implement fillStakeForm() in StakeHolder.vue with input validation
- Add TypeScript declarations in env.d.ts
- Update E2E test to use helper and verify full user journey
- Create INTEGRATION_TEST_STATUS.md documenting test coverage
- Document helper in web-app/README.md

## Test Coverage

Playwright E2E now validates complete flow:
- Mint ETH via cheats page UI
- Swap KRK via cheats page UI
- Stake KRK via stake page UI (helper + click)
- Verify position via GraphQL

Both Playwright and verify-swap.sh tests now work independently.

resolves #62

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/66
2025-10-07 15:06:38 +02:00
johba
b1f40374cd feat: Add functional health checks for test prerequisites (#65)
Replaces basic "service is up" checks with functional verification that tests can actually use the services.

## Changes

### New Health Checks
- **RPC Proxy**: Verifies eth_call works and deployed contracts are accessible
- **GraphQL**: Confirms Ponder has indexed data with non-zero stats
- **Web App**: Validates endpoint accessibility

### Improvements
- Clear error messages explain what failed and how to fix it
- Checks verify actual functionality, not just HTTP 200 responses
- Fails fast before tests run with cryptic errors

### Files
- `tests/setup/health-checks.ts` - Core health check functions
- `tests/setup/stack.ts` - Integration with waitForStackReady()
- `tests/HEALTH_CHECKS.md` - Documentation and troubleshooting guide

## Error Message Example

Before:
```
RPC health check failed with status 404
```

After:
```
 Stack health check failed

Failed services:
  • RPC Proxy: RPC proxy returned HTTP 404
    Expected 200, got 404. Check if Anvil is running and RPC_URL is correct.
  • GraphQL Indexer: GraphQL has no indexed data yet
    Ponder is running but has not indexed contract events.

Troubleshooting:
  1. Check stack logs: tail tests/.stack.log
  2. Verify services are running: ./scripts/dev.sh status
  3. Restart stack: ./scripts/dev.sh restart --full
```

## Benefits
-  Tests fail fast with clear error messages
-  Catches configuration issues before tests run
-  Verifies services are actually usable, not just running

resolves #61

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/65
2025-10-05 20:03:07 +02:00
johba
1645865c5a first integration tests (#64)
resolves #60

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/64
2025-10-05 19:40:14 +02:00
johba
d6f0bf4f02 ponder speedup (#59)
Successfully applied and tested the bootstrap speedup optimizations. Here's what was accomplished:                                                                                                                                                                                                  Fixes Applied
                                                                                                                                                    1. podman-compose.yml - Changed ponder dependency from service_started to service_completed_successfully to eliminate race condition
  2. services/ponder/src/helpers/stats.ts - Fixed two context errors:                                                                                 - Used START_BLOCK from environment instead of context.network.contracts.Kraiken.startBlock                                                       - Added console fallback for context.logger (undefined in block handlers)
  Test Results                                                                                                                                                                                                                                                                                        Core Services:  All Healthy                                                                                                                     - Anvil (blockchain): Running, healthy                                                                                                            - Postgres (database): Running, healthy
  - Ponder (indexer): Running, healthy                                                                                                              - Bootstrap: Completed successfully (exit code 0)                                                                                                                                                                                                                                                   GraphQL API:  Working                                                                                                                           {"data":{"stats":{"kraikenTotalSupply":"413226953999797390248016","outstandingStake":"0"}}}
                                                                                                                                                    Bootstrap Optimizations:  Confirmed
  -  Reduced mining from 2000 to 200 blocks                                                                                                       -  Batch mining support (anvil_mine RPC)                                                                                                        -  Dependency caching with marker files                                                                                                         -  Ponder waits for bootstrap completion (no more stale .env.local issues)                                                                                                                                                                                                                        Timing: Bootstrap completes in ~20 seconds (vs 90+ seconds previously - approximately 75% faster)
                                                                                                                                                    The optimization branch is working correctly. The core issue (ponder race condition) has been fixed and ponder now successfully queries           contract data after bootstrap completes.

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/59
2025-10-04 18:08:10 +02:00
johba
514be62cbb txnbot - rewrite and lint (#53)
resolves #46

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/53
2025-10-04 15:40:30 +02:00
johba
dc61771dfc feat(ponder): Add strict ESLint + Prettier with pre-commit hooks (#52)
- Install eslint, @typescript-eslint plugins, prettier, husky, lint-staged
- Configure ESLint flat config with TypeScript parser
- Enforce: no-explicit-any (with exceptions), no-unused-vars, naming-convention, prefer-const, no-console
- Set style: 2-space indent, 140 char max-len, disable complexity rules
- Configure Prettier: single quotes, 140 width, trailing commas
- Setup husky pre-commit hook to auto-fix and format on commit
- Replace console.log/warn with context.logger.info/warn in handlers
- Remove console.log from ponder.config.ts (replaced with comment)
- Add npm scripts: lint, lint:fix, format, format:check
- All lint rules pass without warnings

resolvel #45

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/52
2025-10-04 15:37:26 +02:00
johba
c150b683c8 Merge pull request 'Add Solidity linting with solhint, Foundry formatter, and pre-commit hooks' (#57) from lint/onchain into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/57
2025-10-04 15:18:56 +02:00
johba
d7c2184ccf Add Solidity linting with solhint, Foundry formatter, and pre-commit hooks (#51)
## Changes

### Configuration
- Added .solhint.json with recommended rules + custom config
  - 160 char line length (warn)
  - Double quotes enforcement (error)
  - Explicit visibility required (error)
  - Console statements allowed (scripts/tests need them)
  - Gas optimization warnings enabled
  - Ignores test/helpers/, lib/, out/, cache/, broadcast/

- Added foundry.toml [fmt] section
  - 160 char line length
  - 4-space tabs
  - Double quotes
  - Thousands separators for numbers
  - Sort imports enabled

- Added .lintstagedrc.json for pre-commit auto-fix
  - Runs solhint --fix on .sol files
  - Runs forge fmt on .sol files

- Added husky pre-commit hook via lint-staged

### NPM Scripts
- lint:sol - run solhint
- lint:sol:fix - auto-fix solhint issues
- format:sol - format with forge fmt
- format:sol:check - check formatting
- lint / lint:fix - combined commands

### Code Changes
- Added explicit visibility modifiers (internal) to constants in scripts and tests
- Fixed quote style in DeployLocal.sol
- All Solidity files formatted with forge fmt

## Verification
-  forge fmt --check passes
-  No solhint errors (warnings only)
-  forge build succeeds
-  forge test passes (107/107)

resolves #44

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/51
2025-10-04 15:17:09 +02:00
johba
7961bfdada Add Solidity linting with solhint, Foundry formatter, and pre-commit hooks
- Added .solhint.json with recommended rules + custom config
  - 160 char line length (warn)
  - Double quotes enforcement (error)
  - Explicit visibility required (error)
  - Console statements allowed (scripts/tests need them)
  - Gas optimization warnings enabled
  - Ignores test/helpers/, lib/, out/, cache/, broadcast/

- Added foundry.toml [fmt] section
  - 160 char line length
  - 4-space tabs
  - Double quotes
  - Thousands separators for numbers
  - Sort imports enabled

- Added .lintstagedrc.json for pre-commit auto-fix
  - Runs solhint --fix on .sol files
  - Runs forge fmt on .sol files

- Added husky pre-commit hook via lint-staged

- lint:sol - run solhint
- lint:sol:fix - auto-fix solhint issues
- format:sol - format with forge fmt
- format:sol:check - check formatting
- lint / lint:fix - combined commands

- Added explicit visibility modifiers (internal) to constants in scripts and tests
- Fixed quote style in DeployLocal.sol
- All Solidity files formatted with forge fmt

-  forge fmt --check passes
-  No solhint errors (warnings only)
-  forge build succeeds
-  forge test passes (107/107)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 13:15:31 +00:00
johba
f8927b426e webapp - ESLint + Prettier with pre-commit hooks (#54)
resolves #47

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/54
2025-10-03 16:51:44 +02:00
johba
2acb619a11 feat(landing): add strict ESLint + Prettier with pre-commit hooks (#50)
- Install ESLint 9 with flat config, TypeScript, Vue plugins
- Configure Prettier (140 char, 2-space indent, single quotes)
- Add pre-commit hooks via husky + lint-staged for auto-fix
- Rename components to multi-word (Countdown → CountdownTimer, etc.)
- Add explicit TypeScript prop/emit interfaces
- Remove all console.log statements
- Fix all ESLint violations and type errors
- Verify type-check, build, and HMR working

resolves #43

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/50
2025-10-03 13:19:20 +02:00
johba
09c36f2c87 lint/lib (#49)
resolves #42

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/49
2025-10-03 11:57:01 +02:00
johba
4f7cebda56 start stack from container (#40)
resolves #36

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/40
2025-10-02 17:11:22 +02:00
johba
3a7162462b startup-optimizations (#48)
resolves #34

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/48
2025-10-02 17:00:21 +02:00
johba
3ab2d9454a health checks (#39)
resolves #35

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/39
2025-10-02 14:37:59 +02:00
johba
a29ca1a26a Harden kraiken-lib watch loop and confirm host-built dist propagation (#38)
- expand scripts/watch-kraiken-lib.sh to watch atomic rename events, validate required tools, and gracefully restart only the containers that mount kraiken-
  lib/dist
  - verify the host-built dist is mounted read-only inside each service and observe live rebuild + restart behavior under inotify
  - run the local podman stack, exercise the watcher by editing kraiken-lib/src/helpers.ts, and confirm GraphQL responds through Caddy after restarts

resolves #33

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/38
2025-10-02 14:33:59 +02:00
johba
b4c829e4d6 fix/podman-postgres-integration (#37)
resolves #25

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/37
2025-10-01 20:26:49 +02:00
johba
8947ec11ca Merge pull request 'Refactor kraiken-lib helpers into focused modules with updated tests' (#32) from feature/split-kraiken-helpers into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/32
2025-10-01 14:49:30 +02:00
openhands
327e2c1308 addresses issue 27 2025-10-01 14:43:55 +02:00
johba
26a8771848 Extract snatch selection into reusable composable (#30)
## Summary

  - add a useSnatchSelection composable that centralises snatch shortfall calculations, position filtering, and RPC memoisation
  - refactor StakeHolder.vue to consume the composable instead of reimplementing the flow inline
  - introduce Vitest config and first composable tests (useSnatchSelection.spec.ts) to cover empty/partial fills and ownership edge cases
  - wire up project tooling updates so the new tests run (jsdom dep, updated package metadata)

  ## Testing

  - cd web-app && npm install
  - npm test

resolves #24

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/30
2025-09-30 20:35:47 +02:00
johba
76d84341de feat: add ABI validation helpers for Ponder (#29)
resolves https://codeberg.org/johba/harb/issues/23

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/29
2025-09-30 20:02:43 +02:00
johba
0eaf91be13 Merge pull request 'Fix #22: Remove 'any' usage and replace shims with proper typed handlers' (#28) from fix-issue-22-remove-any-types into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/28
2025-09-25 18:59:48 +02:00
openhands
aa9ff72ec0 drop lock 2025-09-25 18:57:38 +02:00
openhands
316ea0380f Fix #22: Remove 'any' usage and replace shims with proper typed handlers
- Updated all ponder event handlers to use proper TypeScript types
- Removed all 'any' type annotations from event handlers
- Handlers now properly leverage TypeScript's type inference
- Improved type safety across the ponder indexer

Fixes #22
2025-09-25 18:28:20 +02:00
johba
7da7b12b6b Merge pull request 'feature-podman' (#21) from feature-podman into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/21
2025-09-24 14:14:43 +02:00
root
41700e72da chore: Add dependencies and configs for Podman setup
- Updated kraiken-lib tsconfig and yarn.lock
- Added package.json with playwright-mcp dependency
- Updated uni-v3-lib submodule

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 12:12:54 +00:00