Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
**/.DS_Store
**/.classpath
**/.dockerignore

**/.env
**/.git
**/.github
**/.gitignore
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Build and publish Docker images for Energy Tracker

on:
push:
branches: [ "staging", "main" ]
pull_request:
branches: [ "staging", "main" ]

env:
REGISTRY: ghcr.io
PROVER_IMAGE_NAME: ${{ github.repository }}
STREAMR_IMAGE_NAME: ${{ github.repository }}/streamr-client

jobs:
build-and-push-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Build and push Prover image (energy-tracker)
- name: Extract metadata for Prover image
id: meta-prover
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.PROVER_IMAGE_NAME }}

- name: Build and push Prover image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-prover.outputs.tags }}
labels: ${{ steps.meta-prover.outputs.labels }}

- name: Generate attestation for Prover image
if: github.event_name != 'pull_request'
uses: actions/attest-build-provenance@v3
with:
subject-name: ${{ env.REGISTRY }}/${{ env.PROVER_IMAGE_NAME }}
subject-digest: ${{ steps.build-and-push-prover.outputs.digest }}
push-to-registry: true

# Build and push Streamr client image
- name: Extract metadata for Streamr client image
id: meta-streamr
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.STREAMR_IMAGE_NAME }}

- name: Build and push Streamr client image
uses: docker/build-push-action@v6
with:
context: ./streamr-client
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-streamr.outputs.tags }}
labels: ${{ steps.meta-streamr.outputs.labels }}

- name: Generate attestation for Streamr client image
if: github.event_name != 'pull_request'
uses: actions/attest-build-provenance@v3
with:
subject-name: ${{ env.REGISTRY }}/${{ env.STREAMR_IMAGE_NAME }}
subject-digest: ${{ steps.build-and-push-streamr.outputs.digest }}
push-to-registry: true
51 changes: 0 additions & 51 deletions .github/workflows/docker-image-prover.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/docker-image-streamr-client.yml

This file was deleted.

1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,19 @@ fn get_rollup_abi() -> JsonAbi {
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs":[],
"name":"SP1_PROGRAM_VKEY",
"outputs":[
{
"internalType":"bytes32",
"name":"",
"type":"bytes32"
}
],
"stateMutability":"view",
"type":"function"
}
]"#;

Expand Down Expand Up @@ -253,3 +266,21 @@ pub async fn commit_state(
println!("Transaction confirmed in block: {:?}", receipt.block_number);
Ok(hash)
}

pub async fn check_program_vkey(provider: &impl Provider, vkey_hash: [u8; 32]) -> Result<bool> {
let rollup_address = get_rollup_address();
let abi: JsonAbi = get_rollup_abi();
let interface = Interface::new(abi);
let contract = interface.connect(rollup_address, provider);

let call_builder = contract.function(
"SP1_PROGRAM_VKEY",
&[],
)?;

let result = call_builder.call().await?;

let vkey = result[0].as_fixed_bytes().unwrap();
println!("on-chain vkey: {:?}, current vkey {:?}", vkey.0, vkey_hash);
Ok(vkey.0 == vkey_hash.as_slice())
}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
environment:
- DATABASE_URL=${DATABASE_URL:-postgres://postgres:m3tering@db:5432/m3tering-db}
- STREAM_ID=${STREAM_ID}
- PRIVATE_KEY=${STREAMR_PRIVATE_KEY}
- PRIVATE_KEY=${PRIVATE_KEY}
- STREAMR_ENV=${STREAMR_ENV:-live}
depends_on:
db:
Expand Down
1 change: 1 addition & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2024"
[dependencies]
sp1-sdk = { version = "5.2.1", default-features = false, features = ["network"] }
axum = "0.8.4"
eyre = "0.6.8"
diesel = { version = "2", features = ["postgres", "r2d2", "serde_json"] }
serde = { workspace = true }
alloy-sol-types = { workspace = true }
Expand Down
Loading
Loading