Repository navigation
feat: publisher plugin hardening #123
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
007c82a
improve publisher
georgi-l95 4f830e9
add more e2e tests
georgi-l95 7f2dcda
fix unit test
georgi-l95 45d300e
subscriber hardening
georgi-l95 21d25b0
minor improvements
georgi-l95 ba6f5dd
apply coderabbit review comments
georgi-l95 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,150 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
| IMAGE_NAME: ${{ github.repository }} | ||
|
|
||
| jobs: | ||
| build-and-publish: | ||
| name: Build and Publish Release | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| packages: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.release.tag_name }} | ||
|
|
||
| - name: Set up QEMU for multi-arch builds | ||
| uses: docker/setup-qemu-action@v3 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Extract metadata for Docker | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
| tags: | | ||
| type=semver,pattern={{version}},value=${{ github.event.release.tag_name }} | ||
| type=semver,pattern={{major}}.{{minor}},value=${{ github.event.release.tag_name }} | ||
| type=semver,pattern={{major}},value=${{ github.event.release.tag_name }} | ||
| type=raw,value=latest,enable=${{ !github.event.release.prerelease }} | ||
|
|
||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| platforms: linux/amd64,linux/arm64 | ||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Install Rust toolchain | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Install cross-compilation tools | ||
| run: | | ||
| cargo install cross --git https://github.com/cross-rs/cross | ||
|
|
||
| - name: Install dependencies (protoc) | ||
| run: | | ||
| sudo apt-get update -y | ||
| sudo apt-get install -y protobuf-compiler | ||
|
|
||
| - name: Build Linux x86_64 binary | ||
| run: cross build --release --target x86_64-unknown-linux-gnu --locked | ||
| working-directory: app/rock-node | ||
|
|
||
| - name: Build Linux ARM64 binary | ||
| run: cross build --release --target aarch64-unknown-linux-gnu --locked | ||
| working-directory: app/rock-node | ||
|
|
||
| - name: Package binaries | ||
| run: | | ||
| mkdir -p release-artifacts | ||
|
|
||
| # Package x86_64 | ||
| cd target/x86_64-unknown-linux-gnu/release | ||
| tar -czf ../../../release-artifacts/rock-node-${{ github.event.release.tag_name }}-linux-x86_64.tar.gz rock-node | ||
| cd - | ||
|
|
||
| # Package ARM64 | ||
| cd target/aarch64-unknown-linux-gnu/release | ||
| tar -czf ../../../release-artifacts/rock-node-${{ github.event.release.tag_name }}-linux-arm64.tar.gz rock-node | ||
| cd - | ||
|
|
||
| # Generate checksums | ||
| cd release-artifacts | ||
| sha256sum * > checksums.txt | ||
| cd - | ||
|
|
||
| - name: Upload Release Assets | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ github.event.release.tag_name }} | ||
| files: | | ||
| release-artifacts/rock-node-${{ github.event.release.tag_name }}-linux-x86_64.tar.gz | ||
| release-artifacts/rock-node-${{ github.event.release.tag_name }}-linux-arm64.tar.gz | ||
| release-artifacts/checksums.txt | ||
| append_body: true | ||
| body: | | ||
|
|
||
| --- | ||
|
|
||
| ## 🐳 Docker Images | ||
|
|
||
| Multi-architecture images published to GitHub Container Registry: | ||
|
|
||
| ```bash | ||
| # Pull specific version | ||
| docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }} | ||
|
|
||
| # Pull latest | ||
| docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
| ``` | ||
|
|
||
| **Platforms**: `linux/amd64`, `linux/arm64` | ||
|
|
||
| ## 📦 Standalone Binaries | ||
|
|
||
| Download and verify checksums: | ||
|
|
||
| ```bash | ||
| # Set version | ||
| VERSION=${{ github.event.release.tag_name }} | ||
|
|
||
| # Download for your platform | ||
| wget https://github.com/${{ github.repository }}/releases/download/${VERSION}/rock-node-${VERSION}-linux-x86_64.tar.gz | ||
|
|
||
| # Download checksums | ||
| wget https://github.com/${{ github.repository }}/releases/download/${VERSION}/checksums.txt | ||
|
|
||
| # Verify integrity | ||
| sha256sum -c checksums.txt --ignore-missing | ||
|
|
||
| # Extract and run | ||
| tar -xzf rock-node-${VERSION}-linux-x86_64.tar.gz | ||
| ./rock-node --config-path config/config.toml | ||
| ``` | ||
|
|
||
| **Available Binaries**: | ||
| - `rock-node-${{ github.event.release.tag_name }}-linux-x86_64.tar.gz` (Intel/AMD 64-bit) | ||
| - `rock-node-${{ github.event.release.tag_name }}-linux-arm64.tar.gz` (ARM 64-bit) | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| use thiserror::Error; | ||
|
|
||
| /// Errors that can occur during publish operations | ||
| #[derive(Error, Debug)] | ||
| pub enum PublishError { | ||
| #[error("Block item set is empty")] | ||
| EmptyBlockItems, | ||
|
|
||
| #[error("Missing block header for new block {block_number}")] | ||
| MissingBlockHeader { block_number: i64 }, | ||
|
|
||
| #[error("Too many items in set: {count} (max: {max})")] | ||
| TooManyItems { count: usize, max: usize }, | ||
|
|
||
| #[allow(dead_code)] | ||
| #[error("Block number mismatch: expected {expected}, got {received}")] | ||
| BlockNumberMismatch { expected: i64, received: i64 }, | ||
|
|
||
| #[allow(dead_code)] | ||
| #[error("Invalid block number: {block_number}")] | ||
| InvalidBlockNumber { block_number: i64 }, | ||
|
|
||
| #[allow(dead_code)] | ||
| #[error("Session {session_id} received items without active block")] | ||
| NoActiveBlock { session_id: uuid::Uuid }, | ||
|
|
||
| #[error("Failed to encode block: {0}")] | ||
| Encoding(#[from] prost::EncodeError), | ||
|
|
||
| #[allow(dead_code)] | ||
| #[error("Channel send error")] | ||
| ChannelSend, | ||
|
|
||
| #[allow(dead_code)] | ||
| #[error("Verification timeout for block {block_number}")] | ||
| VerificationTimeout { block_number: u64 }, | ||
|
|
||
| #[allow(dead_code)] | ||
| #[error("Verification failed for block {block_number}: {reason}")] | ||
| VerificationFailed { block_number: u64, reason: String }, | ||
| } | ||
|
|
||
| pub type Result<T> = std::result::Result<T, PublishError>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.