-
Notifications
You must be signed in to change notification settings - Fork 0
Stox price pusher #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2cf0f9e
209e4bc
ed06d26
6cd57d4
3d5e6f2
d8eac9c
bcfdfee
92d5dfc
d38300a
e0d83cf
cf982fd
10cb706
bac6da8
6f8616e
248cb0d
2aebc93
c345fbf
5da6870
68c9cac
6df13f2
dd98829
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,51 @@ | ||||||||||||||||||||||||||||||||
| name: Docker image CI | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||
| inputs: | ||||||||||||||||||||||||||||||||
| tag: | ||||||||||||||||||||||||||||||||
| description: 'Tag to give the build. Try to make it unique.' | ||||||||||||||||||||||||||||||||
| required: true | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||
| CHANNEL: ${{ inputs.tag || github.head_ref || github.ref_name }} | ||||||||||||||||||||||||||||||||
| DOCKER_BUILDKIT: 1 | ||||||||||||||||||||||||||||||||
| COMPOSE_DOCKER_CLI_BUILD: 1 | ||||||||||||||||||||||||||||||||
| TAG_BASE: rainprotocol/pyth-crosschain | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||
| build: | ||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||
| id-token: write | ||||||||||||||||||||||||||||||||
| contents: write | ||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||
| submodules: recursive | ||||||||||||||||||||||||||||||||
| fetch-depth: 0 | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Install Nix 1/2 | ||||||||||||||||||||||||||||||||
| uses: DeterminateSystems/nix-installer-action@main | ||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||
| determinate: true | ||||||||||||||||||||||||||||||||
| - name: Install Nix 2/2 | ||||||||||||||||||||||||||||||||
| uses: DeterminateSystems/flakehub-cache-action@main | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Install deps | ||||||||||||||||||||||||||||||||
| run: nix develop -c pnpm install --frozen-lockfile | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Build Price Pusher | ||||||||||||||||||||||||||||||||
| run: nix develop -c pnpm turbo build --filter @pythnetwork/price-pusher | ||||||||||||||||||||||||||||||||
|
Comment on lines
+36
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Build step alignment with Dockerfile concerns. The workflow builds the price-pusher package using Ensure the Dockerfile includes the necessary build steps (as flagged in the Dockerfile review), or structure the workflow to produce build artifacts that are then copied into a minimal runtime image using a multi-stage build pattern. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - uses: docker/setup-buildx-action@v2 | ||||||||||||||||||||||||||||||||
| - uses: docker/login-action@v2 | ||||||||||||||||||||||||||||||||
|
Comment on lines
+42
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update Docker actions to latest versions. The workflow uses Apply this diff to update to v3: - - uses: docker/setup-buildx-action@v2
- - uses: docker/login-action@v2
+ - uses: docker/setup-buildx-action@v3
+ - uses: docker/login-action@v3🧰 Tools🪛 actionlint (1.7.7)42-42: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue (action) 43-43: the runner of "docker/login-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue (action) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||||||||||||||||||||||||||||||||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||||||||||||||||||||||||||||||||
| - run: | | ||||||||||||||||||||||||||||||||
| rm .dockerignore | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 🧩 Analysis chainVerify that removing .dockerignore is intentional. The workflow explicitly removes the Verify whether removing If the removal is necessary, document why in a comment: - run: |
+ # Remove .dockerignore to include build artifacts in the image
rm .dockerignore
docker build -t "$TAG_BASE:$CHANNEL" --build-arg GIT_SHA=${{ github.sha }} --build-arg DOCKER_CHANNEL=$CHANNEL .🏁 Script executed: #!/bin/bash
# Check if .dockerignore exists and what it contains
if [ -f .dockerignore ]; then
echo "=== Contents of .dockerignore ==="
cat .dockerignore
echo ""
echo "=== Checking for large directories that might be ignored ==="
fd -t d 'node_modules|dist|build|.git' --max-depth 3 -x du -sh
else
echo ".dockerignore does not exist in the repository"
fiLength of output: 448 Document rationale for removing .dockerignore - run: |
+ # Remove .dockerignore so compiled artifacts (lib, build outputs, node_modules, etc.) are included in Docker context
rm .dockerignore
docker build -t "$TAG_BASE:$CHANNEL" --build-arg GIT_SHA=${{ github.sha }} --build-arg DOCKER_CHANNEL=$CHANNEL .
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| docker build -t "$TAG_BASE:$CHANNEL" --build-arg GIT_SHA=${{ github.sha }} --build-arg DOCKER_CHANNEL=$CHANNEL . | ||||||||||||||||||||||||||||||||
| - run: | | ||||||||||||||||||||||||||||||||
| docker push "$TAG_BASE:$CHANNEL" | ||||||||||||||||||||||||||||||||
|
Comment on lines
+47
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider using docker/build-push-action for better caching and features. The workflow manually runs Replace the manual docker commands: - - run: |
- rm .dockerignore
- docker build -t "$TAG_BASE:$CHANNEL" --build-arg GIT_SHA=${{ github.sha }} --build-arg DOCKER_CHANNEL=$CHANNEL .
- - run: |
- docker push "$TAG_BASE:$CHANNEL"
+ - uses: docker/build-push-action@v5
+ with:
+ context: .
+ push: true
+ tags: ${{ env.TAG_BASE }}:${{ env.CHANNEL }}
+ build-args: |
+ GIT_SHA=${{ github.sha }}
+ DOCKER_CHANNEL=${{ env.CHANNEL }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,21 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| FROM node:22.14 | ||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify that the Node.js base image version is current and secure. The Dockerfile uses 🌐 Web query: 💡 Result: The current LTS major is Node.js v22 ("Jod"); the latest release in that line is v22.20.0 (released Sep 24, 2025). [1][2] Sources: Update Node.js base image to v22.20.0 🧰 Tools🪛 Checkov (3.2.334)[low] 1-21: Ensure that HEALTHCHECK instructions have been added to container images (CKV_DOCKER_2) [low] 1-21: Ensure that a user for the container has been created (CKV_DOCKER_3) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # set git sha and docker tag form build time arg to run time env in container | ||||||||||||||||||||||||||||||||||||||||||||
| ARG GIT_SHA | ||||||||||||||||||||||||||||||||||||||||||||
| ARG DOCKER_CHANNEL | ||||||||||||||||||||||||||||||||||||||||||||
| ENV GIT_COMMIT=$GIT_SHA | ||||||||||||||||||||||||||||||||||||||||||||
| ENV DOCKER_TAG=$DOCKER_CHANNEL | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| WORKDIR /price-pusher | ||||||||||||||||||||||||||||||||||||||||||||
| ADD . . | ||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Use COPY instead of ADD for regular files. Docker best practices recommend using Apply this diff: -ADD . .
+COPY . .📝 Committable suggestion
Suggested change
🧰 Tools🪛 Checkov (3.2.334)[low] 10-10: Ensure that COPY is used instead of ADD in Dockerfiles (CKV_DOCKER_4) 🪛 Hadolint (2.14.0)[error] 10-10: Use COPY instead of ADD for files and folders (DL3020) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| WORKDIR apps/price_pusher | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+9
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Missing dependency installation and build steps. The Dockerfile copies all files and switches to the Add dependency installation and build steps after copying files: WORKDIR /price-pusher
COPY . .
+RUN npm install --frozen-lockfile
+RUN npm run build
WORKDIR apps/price_pusherAlternatively, if using a monorepo tool like turbo (as indicated in the workflow), adjust accordingly: WORKDIR /price-pusher
COPY . .
+RUN npm install -g pnpm
+RUN pnpm install --frozen-lockfile
+RUN pnpm turbo build --filter @pythnetwork/price-pusher
WORKDIR apps/price_pusher📝 Committable suggestion
Suggested change
Suggested change
🧰 Tools🪛 Checkov (3.2.334)[low] 10-10: Ensure that COPY is used instead of ADD in Dockerfiles (CKV_DOCKER_4) [low] 12-12: Ensure that WORKDIR values are absolute paths (CKV_DOCKER_10) 🪛 Hadolint (2.14.0)[error] 10-10: Use COPY instead of ADD for files and folders (DL3020) [error] 12-12: Use absolute WORKDIR (DL3000) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Use absolute WORKDIR path. The second Apply this diff: -WORKDIR apps/price_pusher
+WORKDIR /price-pusher/apps/price_pusher🧰 Tools🪛 Checkov (3.2.334)[low] 12-12: Ensure that WORKDIR values are absolute paths (CKV_DOCKER_10) 🪛 Hadolint (2.14.0)[error] 12-12: Use absolute WORKDIR (DL3000) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| CMD ["bash", "-c", "npm run start evm -- \ | ||||||||||||||||||||||||||||||||||||||||||||
| --price-config-file ./price-config.stable.sample.yaml \ | ||||||||||||||||||||||||||||||||||||||||||||
| --endpoint \"${ENDPOINT}\" \ | ||||||||||||||||||||||||||||||||||||||||||||
| --pyth-contract-address \"${PYTH_CONTRACT_ADDRESS}\" \ | ||||||||||||||||||||||||||||||||||||||||||||
| --price-service-endpoint \"${PRICE_SERVICE_ENDPOINT}\" \ | ||||||||||||||||||||||||||||||||||||||||||||
| --mnemonic-file <(echo \"${MNEMONIC}\") \ | ||||||||||||||||||||||||||||||||||||||||||||
| --pushing-frequency \"${PUSHING_FREQUENCY:-300}\" \ | ||||||||||||||||||||||||||||||||||||||||||||
| --polling-frequency \"${POLLING_FREQUENCY:-5}\" \ | ||||||||||||||||||||||||||||||||||||||||||||
| --override-gas-price-multiplier \"${GAS_PRICE_MULTIPLIER:-1.1}\""] | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Add HEALTHCHECK instruction for container monitoring. A HEALTHCHECK instruction allows Docker and orchestration platforms to monitor the health of the running container and restart it if necessary. Consider adding a health check appropriate for your application: HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node healthcheck.js || exit 1Alternatively, if the price pusher exposes an HTTP endpoint, use a curl-based health check: HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:PORT/health || exit 1🧰 Tools🪛 Checkov (3.2.334)[low] 10-10: Ensure that COPY is used instead of ADD in Dockerfiles (CKV_DOCKER_4) [low] 12-12: Ensure that WORKDIR values are absolute paths (CKV_DOCKER_10) [low] 1-21: Ensure that HEALTHCHECK instructions have been added to container images (CKV_DOCKER_2) [low] 1-21: Ensure that a user for the container has been created (CKV_DOCKER_3) 🪛 Hadolint (2.14.0)[error] 10-10: Use COPY instead of ADD for files and folders (DL3020) [error] 12-12: Use absolute WORKDIR (DL3000) 🤖 Prompt for AI AgentsSecurity: Add a non-root USER directive. The container runs as root by default, which poses a security risk. Create and switch to a non-privileged user before running the application. Add a non-root user: WORKDIR /price-pusher
COPY . .
+RUN groupadd -r appuser && useradd -r -g appuser appuser
+RUN chown -R appuser:appuser /price-pusher
+USER appuser
WORKDIR /price-pusher/apps/price_pusher
🧰 Tools🪛 Checkov (3.2.334)[low] 10-10: Ensure that COPY is used instead of ADD in Dockerfiles (CKV_DOCKER_4) [low] 12-12: Ensure that WORKDIR values are absolute paths (CKV_DOCKER_10) [low] 1-21: Ensure that HEALTHCHECK instructions have been added to container images (CKV_DOCKER_2) [low] 1-21: Ensure that a user for the container has been created (CKV_DOCKER_3) 🪛 Hadolint (2.14.0)[error] 10-10: Use COPY instead of ADD for files and folders (DL3020) [error] 12-12: Use absolute WORKDIR (DL3000) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,224 @@ | ||
| - alias: BTC/USD | ||
| id: e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43 | ||
| time_difference: 60 | ||
| price_deviation: 0.5 | ||
| confidence_ratio: 100 | ||
| - alias: BNB/USD | ||
| id: 2f95862b045670cd22bee3114c39763a4a08beeb663b145d283c31d7d1101c4f | ||
| time_difference: 60 | ||
| price_deviation: 1 | ||
| confidence_ratio: 100 | ||
| early_update: | ||
| time_difference: 30 | ||
| price_deviation: 0.5 | ||
| confidence_ratio: 10 | ||
| - alias: PYTH/USD | ||
| id: 0bbf28e9a841a1cc788f6a361b17ca072d0ea3098a1e5df1c3922d06719579ff | ||
| time_difference: 60 | ||
| price_deviation: 0.5 | ||
| confidence_ratio: 100 | ||
| - alias: GOOG/USD | ||
| id: e65ff435be42630439c96396653a342829e877e2aafaeaf1a10d0ee5fd2cf3f2 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incorrect comment persists despite prior fix claim. The comment "0.05% deviation" appears on all Apply this diff to fix all occurrences: - price_deviation: 0.05 # 0.05% deviation trips a push
+ price_deviation: 0.05 # 5% deviation trips a pushRepeat for all 26 entries in the file. Also applies to: 12-12, 20-20, 28-28, 36-36, 44-44, 52-52, 60-60, 68-68, 76-76, 84-84, 92-92, 100-100, 108-108, 116-116, 124-124, 132-132, 140-140, 148-148, 156-156, 164-164, 172-172, 180-180, 188-188, 196-196, 204-204 🤖 Prompt for AI Agents |
||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: AMZN/USD | ||
| id: b5d0e0fa58a1f8b81498ae670ce93c872d14434b72c364885d4fa1b257cbb07a | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: AMZN/USD.PRE | ||
| id: 82c59e36a8e0247e15283748d6cd51f5fa1019d73fbf3ab6d927e17d9e357a7f | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: AMZN/USD.POST | ||
| id: 62731dfcc8b8542e52753f208248c3e73fab2ec15422d6f65c2decda71ccea0d | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: AAPL/USD | ||
| id: 49f6b65cb1de6b10eaf75e7c03ca029c306d0357e91b5311b175084a5ad55688 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: MSFT/USD | ||
| id: d0ca23c1cc005e004ccf1db5bf76aeb6a49218f43dac3d4b275e92de12ded4d1 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: TSLA/USD | ||
| id: 16dad506d7db8da01c87581c87ca897a012a153557d4d578c3b9c9e1bc0632f1 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: TSLA/USD.PRE | ||
| id: 42676a595d0099c381687124805c8bb22c75424dffcaa55e3dc6549854ebe20a | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: TSLA/USD.POST | ||
| id: 2a797e196973b72447e0ab8e841d9f5706c37dc581fe66a0bd21bcd256cdb9b9 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: NVDA/USD | ||
| id: b1073854ed24cbc755dc527418f52b7d271f6cc967bbf8d8129112b18860a593 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: NVDA/USD.PRE | ||
| id: 61c4ca5b9731a79e285a01e24432d57d89f0ecdd4cd7828196ca8992d5eafef6 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: NVDA/USD.POST | ||
| id: 25719379353a508b1531945f3c466759d6efd866f52fbaeb3631decb70ba381f | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: META/USD | ||
| id: 78a3e3b8e676a8f73c439f5d749737034b139bbbe899ba5775216fba596607fe | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: GME/USD | ||
| id: 6f9cd89ef1b7fd39f667101a91ad578b6c6ace4579d5f7f285a4b06aa4504be6 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: MSTR/USD | ||
| id: e1e80251e5f5184f2195008382538e847fafc36f751896889dd3d1b1f6111f09 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: MSTR/USD.PRE | ||
| id: 1a11eb21c271f3127e4c9ec8a0e9b1042dc088ccba7a94a1a7d1aa37599a00f6 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: MSTR/USD.POST | ||
| id: d8b856d7e17c467877d2d947f27b832db0d65b362ddb6f728797d46b0a8b54c0 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: BRKB/USD | ||
| id: e21c688b7fc65b4606a50f3635f466f6986db129bf16979875d160f9c508e8c7 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: SPLG/USD | ||
| id: 4dfbf28d72ab41a878afcd4c6d5e9593dca7cf65a0da739cbad9b7414004f82d | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: IAU/USD | ||
| id: f703fbded84f7da4bd9ff4661b5d1ffefa8a9c90b7fa12f247edc8251efac914 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: COIN/USD | ||
| id: fee33f2a978bf32dd6b662b65ba8083c6773b494f8401194ec1870c640860245 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: COIN/USD.PRE | ||
| id: 8bdee6bc9dc5a61b971e31dcfae96fc0c7eae37b2604aa6002ad22980bd3517c | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: COIN/USD.POST | ||
| id: 5c3bd92f2eed33779040caea9f82fac705f5121d26251f8f5e17ec35b9559cd4 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: SIVR/USD | ||
| id: 0a5ee42b0f7287a777926d08bc185a6a60f42f40a9b63d78d85d4a03ee2e3737 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: CRCL/USD | ||
| id: 92b8527aabe59ea2b12230f7b532769b133ffb118dfbd48ff676f14b273f1365 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: CRCL/USD.PRE | ||
| id: b6ce1644a22bb348f89a81696141c1caaca5e7ea83de289a44fba1a9897ca2d6 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: CRCL/USD.POST | ||
| id: 9bdba52fbb3d588d573928b1e781c6441e446a83c011fed92d8362c5b309ce02 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| - alias: PPLT/USD | ||
| id: 782410278b6c8aa2d437812281526012808404aa14c243f73fb9939eeb88d430 | ||
| time_difference: 300 # pushes if on-chain is >5min behind | ||
| price_deviation: 0.05 # 0.05% deviation trips a push | ||
| confidence_ratio: 200 # effectively ignore this trigger | ||
| early_update: | ||
| time_difference: 150 | ||
| price_deviation: 0.03 | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -150,6 +150,16 @@ export default { | |||||||||||||||||||||||||||||||||||||||
| logger.child({ module: "PythPriceListener" }), | ||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| // Start the price listener and wait for first update | ||||||||||||||||||||||||||||||||||||||||
| await pythListener.start(); | ||||||||||||||||||||||||||||||||||||||||
| const receivedUpdate = await pythListener.waitForFirstPriceUpdate(15000); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| if (receivedUpdate) { | ||||||||||||||||||||||||||||||||||||||||
| console.log('Price update received!'); | ||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||
| console.log('Timeout waiting for price update'); | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+153
to
+162
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use structured logging and decide behavior on timeout. Replace console.log with the existing pino logger for consistency, and make the timeout case explicit (warn or exit) to avoid silent degraded startup. - if (receivedUpdate) {
- console.log('Price update received!');
- } else {
- console.log('Timeout waiting for price update');
- }
+ if (receivedUpdate) {
+ logger.info('First Pyth price update received.');
+ } else {
+ logger.warn('Timeout waiting for first Pyth price update after 15s; continuing startup.');
+ // Optionally: return process.exit(1) if startup must fail without data
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||
| const client = await createClient(endpoint, mnemonic); | ||||||||||||||||||||||||||||||||||||||||
| const pythContract = createPythContract(client, pythContractAddress); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -193,6 +193,8 @@ export class EvmPricePusher implements IPricePusher { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await (this.customGasStation?.getCustomGasPrice() ?? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.client.getGasPrice()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.logger.debug(`Initial gas price: ${gasPrice} gwei`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+196
to
198
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gas price unit mismatch in logs. getGasPrice returns wei; logs label it as gwei. Either log in wei or convert for readability. - this.logger.debug(`Initial gas price: ${gasPrice} gwei`);
+ const gasPriceGwei = gasPrice / 1e9;
+ this.logger.debug(`Initial gas price: ${gasPriceGwei} gwei (${gasPrice} wei)`);
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Try to re-use the same nonce and increase the gas if the last tx is not landed yet. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (this.pusherAddress === undefined) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -227,7 +229,7 @@ export class EvmPricePusher implements IPricePusher { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const txNonce = lastExecutedNonce + 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.logger.debug(`Using gas price: ${gasPrice} and nonce: ${txNonce}`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.logger.debug(`Final gas price: ${gasPrice} gwei, nonce: ${txNonce}, update fee: ${updateFee} wei`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const pubTimesToPushParam = pubTimesToPush.map((pubTime) => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BigInt(pubTime), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -242,17 +244,20 @@ export class EvmPricePusher implements IPricePusher { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const gasLimitToUse = this.gasLimit !== undefined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? BigInt(Math.ceil(this.gasLimit)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : BigInt(1000000); // Default gas limit of 1M gas units | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.logger.debug(`Using gas limit: ${gasLimitToUse}, gas price: ${gasPrice}, update fee: ${updateFee}`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+247
to
+252
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid forcing gas in simulation; apply gas limit on submission. Providing a fixed gas in simulate can cause false reverts if it’s too low/high. Let simulate estimate gas; set the cap when sending. - const gasLimitToUse = this.gasLimit !== undefined
- ? BigInt(Math.ceil(this.gasLimit))
- : BigInt(1000000); // Default gas limit of 1M gas units
-
- this.logger.debug(`Using gas limit: ${gasLimitToUse}, gas price: ${gasPrice}, update fee: ${updateFee}`);
+ const gasLimitToUse = this.gasLimit !== undefined
+ ? BigInt(Math.ceil(this.gasLimit))
+ : undefined; // Let simulate/chain estimate if not provided
+
+ this.logger.debug(
+ `Using gas limit: ${gasLimitToUse ?? 'estimate'}, gas price: ${gasPrice}, update fee: ${updateFee}`
+ );And below: - {
- value: updateFee,
- gasPrice: BigInt(Math.ceil(gasPrice)),
- nonce: txNonce,
- gas: gasLimitToUse,
- },
+ {
+ value: updateFee,
+ gasPrice: BigInt(Math.ceil(gasPrice)),
+ nonce: txNonce,
+ },
);
- this.logger.debug({ request }, "Simulated request successfully");
-
- const hash = await this.client.writeContract(request);
+ const requestWithGas =
+ gasLimitToUse !== undefined ? { ...request, gas: gasLimitToUse } : request;
+ this.logger.debug({ request: requestWithGas }, "Simulated request successfully");
+
+ const hash = await this.client.writeContract(requestWithGas);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { request } = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await this.pythContract.simulate.updatePriceFeedsIfNecessary( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [priceFeedUpdateDataWith0x, priceIdsWith0x, pubTimesToPushParam], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| value: updateFee, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gasPrice: BigInt(Math.ceil(gasPrice)), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nonce: txNonce, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gas: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.gasLimit !== undefined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? BigInt(Math.ceil(this.gasLimit)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : undefined, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gas: gasLimitToUse, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential tag collision risk with dynamic CHANNEL naming.
The
CHANNELenvironment variable derives frominputs.tag,github.head_ref, orgithub.ref_name. For concurrent pushes to different branches, this could lead to race conditions or unintended tag overwrites.Consider adding a unique suffix or using a more structured tagging strategy:
Or use commit SHA for uniqueness:
🤖 Prompt for AI Agents