Skip to content

Commit e4ea5a0

Browse files
committed
Merge branch 'main' into pyth-stylus-update-and-initialize
2 parents b9cd402 + e130743 commit e4ea5a0

File tree

115 files changed

+4309
-1184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+4309
-1184
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "pyth-lazer-agent Rust Test Suite"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
paths:
8+
- .github/workflows/ci-pyth-lazer-agent.yml
9+
- apps/pyth-lazer-agent/**
10+
11+
jobs:
12+
pyth-lazer-agent-rust-test-suite:
13+
name: pyth-lazer-agent Rust Test Suite
14+
runs-on: ubuntu-22.04
15+
defaults:
16+
run:
17+
working-directory: apps/pyth-lazer-agent
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
submodules: recursive
22+
- uses: actions-rust-lang/setup-rust-toolchain@v1
23+
with:
24+
toolchain: 1.87.0
25+
components: clippy,rustfmt
26+
- uses: Swatinem/rust-cache@v2
27+
with:
28+
workspaces: "apps/pyth-lazer-agent -> target"
29+
- name: Format check
30+
run: cargo fmt --all -- --check
31+
if: success() || failure()
32+
- name: Clippy check
33+
run: cargo clippy --all-targets -- --deny warnings
34+
if: success() || failure()
35+
- name: test
36+
run: cargo test
37+
if: success() || failure()

.github/workflows/ci-starknet-contract.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ jobs:
2525
tool-versions: target_chains/starknet/contracts/.tool-versions
2626
- name: Install Starkli
2727
run: curl https://get.starkli.sh | sh && . ~/.config/.starkli/env && starkliup -v $(awk '/starkli/{print $2}' .tool-versions)
28+
- name: Install Rust
29+
uses: actions-rs/toolchain@v1
30+
with:
31+
toolchain: 1.85.0
2832
- name: Install Devnet
29-
run: cargo install starknet-devnet --version $(awk '/starknet-devnet/{print $2}' .tool-versions)
33+
run: cargo +1.85.0 install starknet-devnet --version $(awk '/starknet-devnet/{print $2}' .tool-versions)
3034
- name: Check formatting
3135
run: scarb fmt --check
3236
- name: Run tests
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build and Push pyth-lazer-agent Image
2+
on:
3+
push:
4+
tags:
5+
- pyth-lazer-agent-v*
6+
pull_request:
7+
paths:
8+
- "apps/pyth-lazer-agent/**"
9+
workflow_dispatch:
10+
inputs:
11+
dispatch_description:
12+
description: "Dispatch description"
13+
required: true
14+
type: string
15+
permissions:
16+
contents: read
17+
id-token: write
18+
packages: write
19+
env:
20+
REGISTRY: ghcr.io
21+
IMAGE_NAME: pyth-network/pyth-lazer-agent
22+
jobs:
23+
pyth-lazer-agent-image:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Set image tag to version of the git tag
28+
if: ${{ startsWith(github.ref, 'refs/tags/pyth-lazer-agent-v') }}
29+
run: |
30+
PREFIX="refs/tags/pyth-lazer-agent-"
31+
VERSION="${GITHUB_REF:${#PREFIX}}"
32+
echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}"
33+
- name: Set image tag to the git commit hash
34+
if: ${{ !startsWith(github.ref, 'refs/tags/pyth-lazer-agent-v') }}
35+
run: |
36+
echo "IMAGE_TAG=${{ github.sha }}" >> "${GITHUB_ENV}"
37+
- name: Log in to the Container registry
38+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
39+
with:
40+
registry: ${{ env.REGISTRY }}
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
- name: Extract metadata (tags, labels) for Docker
44+
id: metadata_pyth_lazer_agent
45+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
46+
with:
47+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48+
- name: Build and push server docker image
49+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
50+
with:
51+
context: .
52+
file: "./apps/pyth-lazer-agent/Dockerfile"
53+
push: ${{ github.event_name != 'pull_request' }}
54+
tags: ${{ steps.metadata_pyth_lazer_agent.outputs.tags }}
55+
labels: ${{ steps.metadata_pyth_lazer_agent.outputs.labels }}

.github/workflows/docker-quorum.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build and Push Quorum Image
2+
on:
3+
push:
4+
tags:
5+
- quorum-v*
6+
pull_request:
7+
paths:
8+
- "apps/quorum/**"
9+
workflow_dispatch:
10+
inputs:
11+
dispatch_description:
12+
description: "Dispatch description"
13+
required: true
14+
type: string
15+
permissions:
16+
contents: read
17+
id-token: write
18+
packages: write
19+
env:
20+
REGISTRY: ghcr.io
21+
IMAGE_NAME: pyth-network/quorum
22+
jobs:
23+
quorum-image:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Set image tag to version of the git tag
28+
if: ${{ startsWith(github.ref, 'refs/tags/quorum-v') }}
29+
run: |
30+
PREFIX="refs/tags/quorum-"
31+
VERSION="${GITHUB_REF:${#PREFIX}}"
32+
echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}"
33+
- name: Set image tag to the git commit hash
34+
if: ${{ !startsWith(github.ref, 'refs/tags/quorum-v') }}
35+
run: |
36+
SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7)
37+
echo "IMAGE_TAG=sha-${SHORT_SHA}" >> "${GITHUB_ENV}"
38+
- name: Log in to the Container registry
39+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
40+
with:
41+
registry: ${{ env.REGISTRY }}
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
- name: Extract metadata (tags, labels) for Docker
45+
id: metadata_quorum
46+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
47+
with:
48+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
49+
tags: |
50+
type=raw,value=${{ env.IMAGE_TAG }}
51+
- name: Build and push server docker image
52+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
53+
with:
54+
context: .
55+
file: "./apps/quorum/Dockerfile"
56+
push: ${{ github.event_name != 'pull_request' }}
57+
tags: ${{ steps.metadata_quorum.outputs.tags }}
58+
labels: ${{ steps.metadata_quorum.outputs.labels }}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Use the [Conventional Commits](https://www.conventionalcommits.org) format for y
5656
In the PR description, please include a summary of the changes and any relevant context. Also, please make sure
5757
to update the package versions following the [Semantic Versioning](https://semver.org/) rules.
5858

59+
See also: [Code guidelines](doc/code-guidelines.md)
60+
5961
### Releases
6062

6163
The repository has several CI workflows that automatically release new versions of the various components when a new Github release is published.
@@ -66,6 +68,7 @@ The general process for creating a new release is:
6668
2. Submit a PR with the changes and merge them in to main.
6769
3. Create a new release on github. Configure the release to create a new tag when published. Set the tag name and version for the component you wish to release -- see the [Releases](https://github.com/pyth-network/pyth-crosschain/releases) page to identify the relevant tag.
6870
4. Publish the release. This step will automatically trigger a Github Action to build the package and release it. This step will e.g., publish packages to NPM, or build and push docker images.
71+
- Note that when publishing a public package, you should prune the auto-generated Github release notes to only include changes relevant to the release. Otherwise, the changelog will include commits from unrelated projects in the monorepo since the previous release.
6972

7073
Note that all javascript packages are released together using a tag of the form `pyth-js-v<number>`. (The `number` is arbitrary.)
7174
If you have a javascript package that shouldn't be published, simply add `"private": "true"` to the `package.json` file

apps/entropy-tester/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "@pythnetwork/entropy-tester",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "Utility to test entropy provider callbacks",
5+
"private": true,
56
"type": "module",
67
"main": "dist/index.js",
78
"types": "dist/index.d.ts",

apps/entropy-tester/src/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,18 @@ export const main = function () {
181181
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
182182
while (true) {
183183
try {
184-
await testLatency(contract, privateKey, child);
184+
await Promise.race([
185+
testLatency(contract, privateKey, child),
186+
new Promise((_, reject) =>
187+
setTimeout(() => {
188+
reject(
189+
new Error(
190+
"Timeout: 120s passed but testLatency function was not resolved",
191+
),
192+
);
193+
}, 120_000),
194+
),
195+
]);
185196
} catch (error) {
186197
child.error(error, "Error testing latency");
187198
}

apps/fortuna/Cargo.lock

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/fortuna/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fortuna"
3-
version = "7.6.3"
3+
version = "7.6.5"
44
edition = "2021"
55

66
[lib]
@@ -32,7 +32,7 @@ sha3 = "0.10.8"
3232
tokio = { version = "1.33.0", features = ["full"] }
3333
tower-http = { version = "0.4.0", features = ["cors"] }
3434
tracing = { version = "0.1.37", features = ["log"] }
35-
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
35+
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "json"] }
3636
utoipa = { version = "3.4.0", features = ["axum_extras"] }
3737
utoipa-swagger-ui = { version = "3.1.4", features = ["axum"] }
3838
once_cell = "1.18.0"

apps/fortuna/src/chain/ethereum.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ use {
3333
// contract in the same repo.
3434
abigen!(
3535
PythRandom,
36-
"../../target_chains/ethereum/entropy_sdk/solidity/abis/IEntropy.json"
36+
"../../target_chains/ethereum/entropy_sdk/solidity/abis/IEntropy.json";
37+
PythRandomErrors,
38+
"../../target_chains/ethereum/entropy_sdk/solidity/abis/EntropyErrors.json"
3739
);
3840

3941
pub type MiddlewaresWrapper<T> = LegacyTxMiddleware<

0 commit comments

Comments
 (0)