Skip to content
Draft
163 changes: 110 additions & 53 deletions .github/workflows/node_docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
DOCKER_PUBLIC_REPOSITORY: nethermind/catalyst-node
DOCKER_REGISTRY: nethermind.jfrog.io
DOCKER_REPOSITORY_STAGING: core-oci-local-staging/catalyst-node
MASTER_BRANCH: refs/heads/master

jobs:
build:
Expand Down Expand Up @@ -50,7 +51,8 @@
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
- name: Login to JFrog Artifactory
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.ARTIFACTORY_CORE_USERNAME }}
Expand All @@ -69,19 +71,15 @@
- name: Set digest output
id: digest
run: |
if [ "${{ matrix.short }}" = "amd64" ]; then
echo "amd64=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
fi
if [ "${{ matrix.short }}" = "arm64" ]; then
echo "arm64=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
fi
echo "${{ matrix.short }}=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT

merge:
name: Merge and push multi-arch manifest
runs-on: ubuntu-latest
needs: build
steps:
- uses: docker/login-action@v3
- name: Login to JFrog Artifactory
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.ARTIFACTORY_CORE_USERNAME }}
Expand All @@ -90,79 +88,138 @@
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Determine event type and set tags
id: event
- name: Calculate SHA tag
id: sha
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo "is_tag=true" >> $GITHUB_OUTPUT
echo "is_branch=false" >> $GITHUB_OUTPUT
VERSION=${GITHUB_REF#refs/tags/}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag_list=type=raw,value=$VERSION" >> $GITHUB_OUTPUT
else
echo "is_tag=false" >> $GITHUB_OUTPUT
echo "is_branch=true" >> $GITHUB_OUTPUT
SHORT_SHA="${{ github.sha }}"
SHORT_SHA=${SHORT_SHA:0:7}
echo "tag=sha-${SHORT_SHA}" >> $GITHUB_OUTPUT
echo "short=${SHORT_SHA}" >> $GITHUB_OUTPUT

- name: Determine tags and event type
id: tags
run: |
REF="${{ github.ref }}"
IS_MASTER=false
IS_TAG=false
VERSION_TAG=""
PROMOTE_TAGS=""

if [[ "$REF" == refs/tags/* ]]; then
IS_TAG=true
VERSION_TAG=${REF#refs/tags/}
PROMOTE_TAGS="$VERSION_TAG ${{ steps.sha.outputs.tag }}"
echo "tag_list=type=raw,value=$VERSION_TAG" >> $GITHUB_OUTPUT
elif [[ "$REF" == ${{ env.MASTER_BRANCH }} ]]; then
IS_MASTER=true
PROMOTE_TAGS="latest ${{ steps.sha.outputs.tag }}"
echo "tag_list=type=raw,value=latest" >> $GITHUB_OUTPUT
else
PROMOTE_TAGS="${{ steps.sha.outputs.tag }}"
echo "tag_list=type=sha,value=${{ github.sha }}" >> $GITHUB_OUTPUT
fi

- name: Docker meta
echo "is_master=$IS_MASTER" >> $GITHUB_OUTPUT
echo "is_tag=$IS_TAG" >> $GITHUB_OUTPUT
echo "version_tag=$VERSION_TAG" >> $GITHUB_OUTPUT
echo "promote_tags=$PROMOTE_TAGS" >> $GITHUB_OUTPUT
echo "promote_tags=$PROMOTE_TAGS" >> $GITHUB_ENV

- name: Generate Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REPOSITORY_STAGING }}
tags: ${{ steps.event.outputs.tag_list }}
tags: ${{ steps.tags.outputs.tag_list }}

- name: Create manifest list and push
- name: Create and push manifest list
run: |
# Filter out "latest" tag if not on master branch
if [[ "${{ steps.tags.outputs.is_master }}" != "true" ]]; then
FILTERED_TAGS=$(jq -cr '.tags | map(select(. | endswith(":latest") | not)) | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")
else
FILTERED_TAGS=$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")
fi

if [ -n "$FILTERED_TAGS" ]; then
docker buildx imagetools create \
$FILTERED_TAGS \
${{ needs.build.outputs.digest-amd64 }} \
${{ needs.build.outputs.digest-arm64 }}
fi

- name: Tag with commit SHA
run: |
docker buildx imagetools create \
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
-t ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REPOSITORY_STAGING }}:${{ steps.sha.outputs.tag }} \
${{ needs.build.outputs.digest-amd64 }} \
${{ needs.build.outputs.digest-arm64 }}

- name: Setup ORAS
uses: oras-project/setup-oras@v1

- name: Check ORAS version
run: oras version

- name: Determine tags to promote
id: promote-tags
- name: Login to JFrog Artifactory with ORAS
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
BASE_VERSION=${VERSION%}
echo "TAGS=latest $BASE_VERSION" >> $GITHUB_ENV
else
echo "TAGS=latest" >> $GITHUB_ENV
fi
oras login ${{ env.DOCKER_REGISTRY }} \
-u ${{ secrets.ARTIFACTORY_CORE_USERNAME }} \
-p ${{ secrets.ARTIFACTORY_CORE_TOKEN_DEVELOPER }}

- name: Login to Dockerhub registry with ORAS
- name: Login to Docker Hub
run: |
oras login ${{ env.DOCKER_PUBLIC_REGISTRY }} \
-u ${{ secrets.DOCKER_USERNAME }} \
-p ${{ secrets.DOCKER_PASSWORD }}

- name: Promote to Dockerhub Production
- name: Promote to Docker Hub Production
run: |
for tag in $TAGS; do
echo "Current tag: $tag"
source_image="${DOCKER_REGISTRY}/${DOCKER_REPOSITORY_STAGING}:${tag}"
prod_image="${DOCKER_PUBLIC_REGISTRY}/${DOCKER_PUBLIC_REPOSITORY}:${tag}"
echo "Promoting ${source_image} to ${prod_image}"
oras cp -r "${source_image}" "${prod_image}"
set -e
echo "Tags to promote: $PROMOTE_TAGS"
for tag in $PROMOTE_TAGS; do
source_image="${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REPOSITORY_STAGING }}:${tag}"
prod_image="${{ env.DOCKER_PUBLIC_REGISTRY }}/${{ env.DOCKER_PUBLIC_REPOSITORY }}:${tag}"
echo ""
echo "=== Promoting tag: ${tag} ==="
echo "Source: ${source_image}"
echo "Target: ${prod_image}"

if ! oras cp -r "${source_image}" "${prod_image}"; then
echo "ERROR: Failed to promote tag ${tag}" >&2
echo "Source: ${source_image}" >&2
echo "Target: ${prod_image}" >&2
exit 1
fi
echo "✓ Successfully promoted ${tag}"
done
echo ""
echo "All tags promoted successfully"

- name: Summary
run: |
echo "## Catalyst Node Docker build Completed" >> $GITHUB_STEP_SUMMARY
echo "### Tags" >> $GITHUB_STEP_SUMMARY
for tag in $TAGS; do
echo "- $tag" >> $GITHUB_STEP_SUMMARY
done
echo "### Notes" >> $GITHUB_STEP_SUMMARY
echo "- The images have been pushed to ${DOCKER_REPOSITORY_STAGING} repo" >> $GITHUB_STEP_SUMMARY
echo "- **STAGING Repository**: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REPOSITORY_STAGING }}" >> $GITHUB_STEP_SUMMARY
echo "- **PROD Repository**: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_PUBLIC_REGISTRY }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Tags Promoted" >> $GITHUB_STEP_SUMMARY

# Get tags from step output (more reliable than env var)
TAGS_STRING="${{ steps.tags.outputs.promote_tags }}"

# If step output is empty, try environment variable
if [ -z "$TAGS_STRING" ]; then
TAGS_STRING="$PROMOTE_TAGS"
fi

# Split tags by space and display each one
if [ -n "$TAGS_STRING" ]; then
# Convert space-separated string to array and iterate
for tag in $TAGS_STRING; do
echo "- \`${tag}\`" >> $GITHUB_STEP_SUMMARY
done
else
echo "- No tags available" >> $GITHUB_STEP_SUMMARY
fi

echo "" >> $GITHUB_STEP_SUMMARY
echo "### Repository Information" >> $GITHUB_STEP_SUMMARY
echo "- **Staging**: \`${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REPOSITORY_STAGING }}\`" >> $GITHUB_STEP_SUMMARY
echo "- **Production**: \`${{ env.DOCKER_PUBLIC_REGISTRY }}/${{ env.DOCKER_PUBLIC_REPOSITORY }}\`" >> $GITHUB_STEP_SUMMARY
echo "- **Platforms**: linux/amd64, linux/arm64" >> $GITHUB_STEP_SUMMARY
echo "- **Commit**: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY

echo "- **Commit**: \`${{ github.sha }}\` (\`${{ steps.sha.outputs.short }}\`)" >> $GITHUB_STEP_SUMMARY
2 changes: 2 additions & 0 deletions common/src/l2/taiko_driver/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub struct BuildPreconfBlockRequestBody {
pub struct BuildPreconfBlockResponse {
pub number: u64,
pub hash: B256,
pub state_root: B256,
pub parent_hash: B256,
}

Expand All @@ -28,6 +29,7 @@ impl BuildPreconfBlockResponse {
)
.ok()?,
hash: Self::to_b256(header.get("hash")?.as_str()?)?,
state_root: Self::to_b256(header.get("stateRoot")?.as_str()?)?,
parent_hash: Self::to_b256(header.get("parentHash")?.as_str()?)?,
})
}
Expand Down
44 changes: 44 additions & 0 deletions shasta/src/l1/abi/Multicall.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"abi": [
{
"type": "receive",
"stateMutability": "payable"
},
{
"type": "function",
"name": "multicall",
"inputs": [
{
"name": "calls",
"type": "tuple[]",
"internalType": "struct Multicall.Call[]",
"components": [
{
"name": "target",
"type": "address",
"internalType": "address"
},
{
"name": "value",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "data",
"type": "bytes",
"internalType": "bytes"
}
]
}
],
"outputs": [
{
"name": "results",
"type": "bytes[]",
"internalType": "bytes[]"
}
],
"stateMutability": "payable"
}
]
}
Loading
Loading