Skip to content
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

Feat & Fix: Bitcoin Cosmos SDK Prototype is now onboarded and able to broadcast with cosmos-sdk-broadcast.sh and build, go, and run upgrades! #23171

Closed
wants to merge 16 commits into from
Closed
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
196 changes: 196 additions & 0 deletions .github/workflows/Cosmo.Mac.Ubuntu.Window.go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
name: Go Workflow with Cosmos SDK Integration

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

permissions:
contents: read
pull-requests: write

jobs:
build-and-test:
strategy:
matrix:
os: [ubuntu-24.04, macos-latest, windows-latest]
bearycool11 marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/[email protected]
with:
go-version: '1.20'
cache: true
cache-dependency-path: go.sum

- name: Fetch Latest Cosmos SDK Version
run: |
# Fetch the latest release tag from GitHub
LATEST_VERSION=$(curl -s "https://api.github.com/repos/cosmos/cosmos-sdk/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
bearycool11 marked this conversation as resolved.
Show resolved Hide resolved
echo "Latest Cosmos SDK version: $LATEST_VERSION"
echo "COSMOS_VERSION=$LATEST_VERSION" >> $GITHUB_ENV

- name: Update Go Modules
run: |
# Update go.mod with the latest Cosmos SDK version
go get github.com/cosmos/cosmos-sdk@${{ env.COSMOS_VERSION }}
go mod tidy
bearycool11 marked this conversation as resolved.
Show resolved Hide resolved

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

- name: Check PR Title for Semantic Compliance
uses: amannn/[email protected]
with:
githubBaseUrl: https://api.github.com

- name: Add Sticky Pull Request Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
message: |
Hey there and thank you for opening this pull request! 👋🏼

We require PR titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/).
It looks like your title needs adjustment. Please see below:

```
No release type found in pull request title "{{ github.event.pull_request.title }}".
Add a prefix to indicate the type of release (e.g., `feat:` for new features). Refer to the guide above for available types.
```

windows-image-setup:
runs-on: ubuntu-22.04
steps:
- name: Define Windows Image Matrix
run: |
echo "Defining Windows image names for testing..."
WINDOWS_IMAGE_NAME="runner-images-windows-2022"
WINDOWS_IMAGE_NAME="runner-images-windows-2023"
WINDOWS_IMAGE_NAME="runner-images-windows-2024"
bearycool11 marked this conversation as resolved.
Show resolved Hide resolved
echo "Matrix setup complete."

- name: Setup BlockCypher Token Securely
env:
BLOCKCYPHER_TOKEN: ${{ secrets.BLOCKCYPHER_TOKEN }}
run: |
if [[ -z "$BLOCKCYPHER_TOKEN" ]]; then
echo "Error: BLOCKCYPHER_TOKEN not set."
exit 1
fi
echo "BLOCKCYPHER_TOKEN is set and secure."

- name: Sync Blockchain Cypher
run: |
echo "Synchronizing Blockchain Cypher with token..."
curl -X POST -H "Authorization: Bearer $BLOCKCYPHER_TOKEN" \
-d '{"action":"sync","target":"CosmosSDK"}' \
https://api.blockcypher.com/v1/blockchains/pulse
bearycool11 marked this conversation as resolved.
Show resolved Hide resolved
name: Go and .NET Workflow

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

permissions:
contents: read
pull-requests: write

jobs:
build-and-test:
strategy:
matrix:
os: [ubuntu-24.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

# Set up Go
- name: Set up Go
uses: actions/[email protected]
with:
go-version: '1.20'
cache: true
cache-dependency-path: go.sum

- name: Fetch Latest Cosmos SDK Version
run: |
LATEST_VERSION=$(curl -s "https://api.github.com/repos/cosmos/cosmos-sdk/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
echo "Latest Cosmos SDK version: $LATEST_VERSION"
echo "COSMOS_VERSION=$LATEST_VERSION" >> $GITHUB_ENV

- name: Update Go Modules
run: |
go get github.com/cosmos/cosmos-sdk@${{ env.COSMOS_VERSION }}
go mod tidy

- name: Build Go Project
run: go build -v ./...

- name: Test Go Project
run: go test -v ./...

# Set up .NET
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
cache: true

- name: Restore .NET Dependencies
run: dotnet restore --locked-mode

- name: Build .NET Project
run: dotnet build <my-project-path>

- name: Test .NET Project
run: dotnet test <my-project-path>

# PR Title Check
- name: Check PR Title for Semantic Compliance
uses: amannn/[email protected]
with:
githubBaseUrl: https://api.github.com

- name: Add Sticky Pull Request Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
message: |
Hey there and thank you for opening this pull request! 👋🏼

Please ensure your PR title follows the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/).
Adjust the title as needed to include a release type.

dotnet-matrix-testing:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet: [ '3.1.x', '5.0.x', '6.0.x' ]
steps:
- uses: actions/checkout@v4

- name: Set up .NET for Matrix
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet }}

- name: Create Temporary global.json
run: echo '{"sdk":{"version":"${{ matrix.dotnet }}"}}' > global.json

- name: Restore .NET Dependencies
run: dotnet restore --locked-mode

- name: Build Matrix .NET Project
run: dotnet build <my-project-path>

- name: Test Matrix .NET Project
run: dotnet test <my-project-path>
bearycool11 marked this conversation as resolved.
Show resolved Hide resolved
23 changes: 23 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: C/C++ CI

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

jobs:
build:

runs-on: ubuntu-latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider multi-platform testing requirements

Running only on Ubuntu might not be sufficient for a Bitcoin integration that needs to work across different platforms.

Consider adding more platforms:

-    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        os: [ubuntu-latest, macos-latest]
+    runs-on: ${{ matrix.os }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}


steps:
- uses: actions/checkout@v4
- name: configure
run: ./configure
Comment on lines +16 to +17
Copy link
Contributor

@coderabbitai coderabbitai bot Jan 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

The configure script is missing and the workflow needs to be updated

This is primarily a Go-based Cosmos SDK project. While it contains some C/C++ code (mainly in the secp256k1 library), the configure script doesn't exist in the root directory. The C/C++ files are part of a vendored dependency in crypto/keys/secp256k1/ which has its own build system.

  • The GitHub Actions workflow at .github/workflows/c-cpp.yml needs to be updated as it incorrectly assumes the presence of a ./configure script in the root directory
  • If C/C++ builds are needed, the workflow should be modified to target the specific subdirectory containing the C/C++ code and use the appropriate build commands for that component
🔗 Analysis chain

Verify the existence of configure script

The workflow assumes the presence of a ./configure script, which is typical for C/C++ projects but may not exist in a Cosmos SDK project.

Let's verify the configure script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if configure script exists and is executable
if [ -f "./configure" ]; then
    echo "Configure script exists"
    if [ -x "./configure" ]; then
        echo "Configure script is executable"
    else
        echo "Configure script is not executable"
    fi
else
    echo "Configure script does not exist"
fi

Length of output: 97


Script:

#!/bin/bash
# Let's check if this is actually a C/C++ project by looking for common C/C++ files
echo "Searching for C/C++ source files:"
fd -e c -e cpp -e h -e hpp

# Also check for common build system files
echo -e "\nSearching for common C/C++ build system files:"
fd -g "CMakeLists.txt"
fd -g "Makefile*"
fd -g "configure.ac"
fd -g "configure.in"
fd -g "autogen.sh"

Length of output: 5908

This comment was marked as spam.

This comment was marked as spam.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bearycool11 I see that the C/C++ workflow file hasn't been updated yet. It still contains the ./configure and make commands that aren't suitable for this project. Since this is primarily a Go-based Cosmos SDK project, would you like me to suggest an updated version of the workflow that's better aligned with the project's structure? The workflow could either:

  1. Be removed if C/C++ specific CI isn't needed, or
  2. Be updated to specifically target the C/C++ code in the crypto/keys/secp256k1/ directory

Which approach would you prefer?

🔗 Analysis chain

@bearycool11 Welcome back! 👋 I noticed you asked earlier if new commit files helped. Let me check the current state of the C/C++ workflow file to see if the issues we discussed have been addressed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the c-cpp.yml file has been modified recently
git log -1 --pretty=format:"%H" -- .github/workflows/c-cpp.yml

# Check the current content of the file to see if it's been updated
if [ -f ".github/workflows/c-cpp.yml" ]; then
    cat .github/workflows/c-cpp.yml
fi

Length of output: 432

- name: make
run: make
- name: make check
run: make check
- name: make distcheck
run: make distcheck
Comment on lines +14 to +23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance workflow with proper dependency management and artifacts

The current workflow lacks several critical components needed for a robust CI pipeline:

  1. No dependency caching
  2. No artifact preservation
  3. No timeout configurations
  4. No error handling for build steps

Apply these enhancements:

     steps:
     - uses: actions/checkout@v4
+    - uses: actions/cache@v3
+      with:
+        path: |
+          ~/.cache/go-build
+          ~/go/pkg/mod
+        key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
+        restore-keys: |
+          ${{ runner.os }}-go-
     - name: configure
+      timeout-minutes: 10
       run: ./configure
     - name: make
+      timeout-minutes: 15
       run: make
     - name: make check
+      timeout-minutes: 10
       run: make check
     - name: make distcheck
+      timeout-minutes: 10
       run: make distcheck
+    - name: Upload build artifacts
+      if: success()
+      uses: actions/upload-artifact@v3
+      with:
+        name: build-artifacts
+        path: |
+          build/
+          dist/
+        retention-days: 7

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +18 to +23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Standard make targets are not present in this repository

The repository contains multiple Makefiles, but none of them implement the standard targets (make, make check, make distcheck) used in the workflow. Instead, the Makefiles are Go-oriented and contain targets like:

  • test for running Go tests
  • build for building Go binaries
  • codegen for generating protobuf files
  • format for code formatting

The workflow needs to be updated to use the appropriate make targets for this Go-based project.

🔗 Analysis chain

Verify make targets and build system

The workflow assumes standard make targets (make, make check, make distcheck) which may not be appropriate for a Cosmos SDK project.

Let's verify the make targets:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if Makefile exists and contains the required targets
if [ -f "Makefile" ]; then
    echo "Makefile exists"
    echo "Available targets:"
    grep "^[a-zA-Z0-9-]*:" Makefile
else
    echo "Makefile does not exist"
fi

Length of output: 143


Script:

#!/bin/bash
# Let's check for any Makefile in the repository and its content
fd Makefile --type f --exec cat {}

Length of output: 9679

Loading
Loading