Skip to content

Stg - #68

Closed
shev-titan wants to merge 245 commits into
mainfrom
stg
Closed

Stg#68
shev-titan wants to merge 245 commits into
mainfrom
stg

Conversation

@shev-titan

Copy link
Copy Markdown
Contributor

No description provided.

shev-titan and others added 30 commits May 1, 2026 12:34
Adds an ERC-2612 permit entry point to CollateralVault so callers can
deposit on behalf of any recipient in a single tx without a prior
approve, mirroring the pattern previously living on HashPowerPerpsDEX.
Also opens up depositFor to the public so non-authorized callers can
fund recipients.

Covered by 5 new tests: happy path, distinct recipient, expired
deadline, signature/sender mismatch, and replay protection.
Adds a standalone subgraph that indexes the CollateralVault contract:
deposits, withdrawals, the insurance fund, and internal transfers
(bucketed into PERPS / OPTIONS / OTHER via dataSource.context()).

CI: indexer-tests.yml runs codegen/build/matchstick on every PR;
deploy-subgraph.yml builds, pushes to Goldsky, rolls a per-env tag
(dev-latest / stg-latest / lmn-latest), verifies the deployment, and
notifies Slack — modeled on hashprice-oracle's deploy-subgraph workflow
and reusing its gen-tag / slack-notify composite actions.
… API key

- Replaced `ETH_NODE_ADDRESS` with `ALCHEMY_API_KEY` in various configuration files for futures and perps environments.
- Updated README and schema files to reflect changes in required environment variables.
- Adjusted pricing and risk parameters across multiple configuration files for consistency and clarity.
- Enhanced event handling in the futures and perps adapters to improve code readability and maintainability.
…et maker

Provisions perps and futures market-maker ECS services per env
(dev/stg/lmn) sharing the derivatives marketplace ECS cluster via
Terraform data lookup. Each venue gets its own ALB, target group,
Route53 record (perpsmm.{env}.hashpower.exchange and
futuresmm.{env}.hashpower.exchange), CloudWatch log group, monitoring
stack, and OIDC GitHub Actions IAM scope.

Terraform is scaffolding-only: task definitions ship a stub busybox
container with desired_count=0 and lifecycle.ignore_changes on
task_definition + container_definitions. The new deploy-col-mar-mm.yml
workflow builds the image from market-maker/, pushes to GHCR, and
registers a new task-def revision per venue with image + env vars from
GitHub Variables and secrets from GitHub Secrets. No AWS Secrets
Manager dependency.

Secrets flow into the deploy step's env block via inline ternaries
(matrix.app == 'perps' && SECRET_A || SECRET_B); they are never written
to step outputs or to disk on the runner.

DEV environment activated for both venues. STG and LMN scaffolding is
in place but services have create=false pending operator readiness.

Co-authored-by: Cursor <cursoragent@cursor.com>
feat(infra): bedrock terraform + GHA deploy for col-mar market maker
- Updated Dockerfile to use Node 24-alpine for dependencies and runtime.
- Modified docker-entrypoint.sh to include TypeScript conditions in the Node execution.
- Enhanced package.json scripts to utilize pnpm and added watch functionality for local development.
fix: update dockerfile, fix type stripping
- Updated Dockerfile to use Node 24-alpine for dependencies and runtime.
- Modified docker-entrypoint.sh to include TypeScript conditions in the Node execution.
- Enhanced package.json scripts to utilize pnpm and added watch functionality for local development.
fix: update dockerfile, fix type stripping
- Changed the dependency for `collateral-margin-contracts` to point to the GitHub repository.
- Added `@sinclair/typebox` to dependencies in `package.json`.
- Updated `pnpm-lock.yaml` to reflect the new dependency structure and versions.
- Included additional configurations for `pnpm` to manage built dependencies.
- Updated the HealthCheck implementation in both futures and perps applications to use the new sanitiseConfig function, ensuring sensitive information is redacted in the health output.
- Removed the summariseConfig function as it is no longer needed.
- Enhanced the sanitiseConfig function to redact private keys and mask RPC URLs for security.
refactor: replace config summary with sanitised version in health checks
- Introduced perps_health_url and futures_health_url outputs in the deployment workflow for enhanced health check visibility.
- Updated additional_info to include health check links in the deployment summary for better monitoring.
feat: add health URLs to deployment workflow
- Changed the formatting of additional_info in the deployment workflow to improve readability and structure.
- Ensured health check URLs are displayed more clearly in the deployment summary.
refactor: update additional_info formatting in deployment workflow
feat: hashprice subgraph integration for historical price query for v…
fix: add missing HASHPRICE_ORACLE_SUBGRAPH_URL var
shev-titan and others added 26 commits August 17, 2026 14:13
pnpm 11.1.1 dropped the `path:` field from git subpath resolutions, which
made installs depend on store state (pnpm/pnpm#12304, fixed in 11.7.0).
Move every package to a release carrying that fix instead of holding keeper
back on pnpm 10, and restore the CI store cache now that a warm store can no
longer mask a lossy lockfile. pnpm 11 migrates the contracts build allowance
out of package.json into pnpm-workspace.yaml.
pnpm 11 stopped reading `pnpm.onlyBuiltDependencies` from package.json and
turned ignored build scripts into a hard install error, so market-maker and
points-indexer both failed to install. Move the allowances to allowBuilds and
name the packages that must stay unbuilt. Git dependencies are keyed by exact
resolution, so matchstick-ts is listed at both pinned commits.
Follow the v0.4.2 tag instead of a raw commit and repoint the allowBuilds
entries at the resolution it pins.
…-order-sweeper

refactor: converge portfolio risk and venue integrations
pnpm 11 stopped reading build allowances from package.json and turned ignored
build scripts into a hard install error. The allowances were moved to
market-maker/pnpm-workspace.yaml, but the deps stage only copies package.json
and pnpm-lock.yaml, so `pnpm install --frozen-lockfile --prod` still aborted
with ERR_PNPM_IGNORED_BUILDS and no image was published.

That left the dev market-maker pinned to a 10-day-old image whose futures
own-order bootstrap still calls the removed `getUserOrders`, quarantining every
futures expiry.
…pace

fix(mm): ship pnpm-workspace.yaml into the Docker deps stage
chore: adopt pnpm 11.22 at the repo root
Pass the optional startup anchor into ECS so keeper restarts can rediscover existing participants without treating an unset value as block zero.
Rebuild bounded per-expiry caches on startup so liquidation and settlement discover pre-existing Futures users without deployment-wide history scans.
feat(keeper): add expiry-scoped futures discovery
Keep ECS health checks responsive while historical indexing runs, and gate readiness until the initial sweep completes.
fix(keeper): expose liveness during startup
Load per-environment config from config/<name>.env with machine-local
override files, and wire npm scripts to --env.
Document the secret keys expected in override env files for local and CI use.
Opens the same abi-published event the site already consumes, on the matching branch (dev or main).

Co-authored-by: Cursor <cursoragent@cursor.com>
Pre-wire the npm publish workflow so a later dev→main promotion does not need a branch-filter edit.

Co-authored-by: Cursor <cursoragent@cursor.com>
ci: dispatch ABI publishes to MCP and publish from main
NETWORK meant three different things: the keeper required base-mainnet,
the subgraph manifests and market-maker YAML used base, and the Hardhat
config declared a network literally named base-mainnet. The GitHub
environment that deploys mainnet already sets NETWORK=base, so the
keeper and Hardhat were the outliers.

Settle on base / base-sepolia / hardhat everywhere. The keeper still
accepts base-mainnet as a deprecated alias, since task definitions
registered before this change carry it, and keeps Alchemy's own
base-mainnet spelling for the RPC subdomain.
Contract addresses, start blocks and runtime knobs were duplicated
across GitHub environment variables, the deploy workflows and ad-hoc
loaders, so the same value could disagree between local runs, the
subgraphs and ECS.

Make config/dev.env and config/prd.env the single source for public
values, and have every consumer read them: the keeper and market-maker
via node --env-file, the subgraph renderers via ENV_FILE, and the
deploy workflows by sourcing the file. Secrets stay in the repo-root
.env locally and in GitHub Secrets in CI; both still win, because the
real environment takes precedence over --env-file.

The two ECS workflows built their environment block by naming each
variable four times: once in the step env, once as a jq --arg, once in
the jq object, and once more as a :- default. They now derive the block
from the keys declared in the config file and name only secrets and
computed values, so a public setting is written exactly once. Empty
values are dropped so apps apply their own defaults, which were checked
to match the defaults the workflows used to hardcode.

Also drop the market-maker's custom dotenv loader in favour of
--env-file, disable the stg deploy path, and remove a dead compose
script in points-indexer.

config/prd.env is still missing the mainnet addresses and start blocks;
they exist nowhere in GitHub either, and are marked with TODOs.
pnpm runs scripts with sh, which is dash on the CI runners. POSIX `.`
searches PATH when its operand contains no slash, so `ENV_FILE=.env.example`
failed with ".env.example: not found" while passing locally, where
/bin/sh is bash and falls back to the current directory.

Prefix a bare filename with ./ before sourcing, leaving paths that
already contain a slash untouched.
feat: single source of truth for public config in config/<env>.env
An empty VAULT_START_BLOCK rendered as null in the manifest, which Goldsky rejects as an invalid i32.
fix(config): set subgraph start blocks so Goldsky can deploy
@shev-titan
shev-titan requested a review from abs2023 September 20, 2026 15:02
@abs2023 abs2023 mentioned this pull request Sep 21, 2026
4 tasks
@LumerinIO

Copy link
Copy Markdown
Collaborator

superseded

@LumerinIO LumerinIO closed this Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants