diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 0dad11ae..b9e64961 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -54,6 +54,11 @@ jobs: cd ./my-awesome-avs/ devkit avs build + - name: Run devkit avs test + run: | + cd ./my-awesome-avs/ + devkit avs test + - name: Start devnet run: | cd ./my-awesome-avs/ @@ -87,6 +92,103 @@ jobs: cd ./my-awesome-avs/ devkit avs transport verify + - name: Start local Docker registry + run: | + docker run -d --name registry -p 5001:5000 registry:2 + echo "Waiting for registry to be ready..." + for i in {1..10}; do + if nc -z localhost 5001; then + echo "✅ Registry is ready" + break + fi + echo "Waiting for registry... ($i/10)" + sleep 2 + done + + - name: Build and push AVS image to local registry + run: | + cd ./my-awesome-avs/ + # Build the AVS image + docker build -t localhost:5001/my-awesome-avs:latest . + # Push to local registry + docker push localhost:5001/my-awesome-avs:latest + echo "✅ AVS image pushed to local registry" + + - name: Publish AVS release + run: | + cd ./my-awesome-avs/ + # Get current timestamp + 1 hour for upgrade-by-time + UPGRADE_BY_TIME=$(($(date +%s) + 3600)) + echo "Publishing release with upgrade-by-time: $UPGRADE_BY_TIME ($(date -d @$UPGRADE_BY_TIME))" + + # Run the release publish command + devkit avs release publish --upgrade-by-time $UPGRADE_BY_TIME --registry localhost:5001 + + # Check if the command succeeded + if [ $? -eq 0 ]; then + echo "✅ Release published successfully" + else + echo "❌ Release publish failed" + exit 1 + fi + + - name: Verify release on ReleaseManager contract + run: | + cd ./my-awesome-avs/ + + # Get AVS address from context + AVS_ADDRESS=$(yq eval '.context.avs.address' config/contexts/devnet.yaml) + echo "AVS Address: $AVS_ADDRESS" + + RELEASE_MANAGER_ADDRESS="0x323A9FcB2De80d04B5C4B0F72ee7799100D32F0F" + echo "ReleaseManager Address: $RELEASE_MANAGER_ADDRESS" + + # Query the ReleaseManager contract to verify releases for both operator sets + echo "Verifying releases for operator sets 0 and 1..." + + # The release publish command updates both operator sets 0 and 1 + for OPSET in 0 1; do + echo "Checking operator set $OPSET..." + + # Get the latest version + LATEST_VERSION=$(cast call $RELEASE_MANAGER_ADDRESS \ + "latestVersion(address,uint32)" \ + $AVS_ADDRESS $OPSET \ + --rpc-url http://localhost:8545) + + echo "Latest version for operator set $OPSET: $LATEST_VERSION" + + VERSION_DEC=$((LATEST_VERSION)) + echo "Latest version (decimal): $VERSION_DEC" + + if [ $VERSION_DEC -eq 0 ]; then + echo "❌ No release found for operator set $OPSET" + exit 1 + fi + + # Get release details + RELEASE_DATA=$(cast call $RELEASE_MANAGER_ADDRESS \ + "getRelease(address,uint32,uint256)" \ + $AVS_ADDRESS $OPSET $((VERSION_DEC - 1)) \ + --rpc-url http://localhost:8545) + + echo "Release data retrieved for operator set $OPSET: $RELEASE_DATA" + + if [ -z "$RELEASE_DATA" ] || [ "$RELEASE_DATA" = "0x" ]; then + echo "❌ Release data is empty for operator set $OPSET" + exit 1 + fi + + echo "✅ Release verified for operator set $OPSET" + done + + echo "✅ All releases verified on ReleaseManager contract" + + - name: Stop local Docker registry + run: | + docker stop registry || true + docker rm registry || true + - name: Stop devnet run: | cd ./my-awesome-avs/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ea362bd..62067da9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -383,6 +383,36 @@ jobs: cd ./my-awesome-avs/ devkit avs call -- signature="(uint256,string)" args='(5,"hello")' + - name: Test release publish + run: | + cd ./my-awesome-avs/ + + CURRENT_VERSION=$(grep -A 1 "artifact:" config/contexts/devnet.yaml | grep "version:" | awk '{print $2}' | tr -d '"') + echo "Current version: ${CURRENT_VERSION:-empty}" + + # Calculate upgrade time (10 minutes from now) + if [ "${{ matrix.os }}" = "macos-latest" ]; then + UPGRADE_TIME=$(date -v +10M +%s) + else + UPGRADE_TIME=$(date -d "+10 minutes" +%s) + fi + + # Run release publish with explicit registry + echo "Publishing release with upgrade time: $UPGRADE_TIME" + devkit avs release publish --upgrade-by-time $UPGRADE_TIME --registry localhost:5001 + + # Check that version was updated + NEW_VERSION=$(grep -A 1 "artifact:" config/contexts/devnet.yaml | grep "version:" | awk '{print $2}' | tr -d '"') + echo "New version: $NEW_VERSION" + + # Verify version was incremented + if [ "$NEW_VERSION" = "1" ] || [ "$NEW_VERSION" -gt 0 ]; then + echo "✅ Release published successfully, version updated to: $NEW_VERSION" + else + echo "❌ Release publish failed - version not updated" + exit 1 + fi + - name: Stop devnet run: | cd ./my-awesome-avs/ diff --git a/config/templates.yaml b/config/templates.yaml index ca7cd7ff..8aafde2d 100644 --- a/config/templates.yaml +++ b/config/templates.yaml @@ -3,7 +3,7 @@ architectures: languages: go: baseUrl: "https://github.com/Layr-Labs/hourglass-avs-template" - version: "95f9067bd35b770e989d7d6442003e405d7639ae" + version: "a39911dd514ae2ca8248b871037f93b35685129a" ts: baseUrl: "" version: ""