diff --git a/.github/workflows/docker-image-hyperspace.yml b/.github/workflows/docker-image-hyperspace.yml index acb0f247f..d2bc791a0 100644 --- a/.github/workflows/docker-image-hyperspace.yml +++ b/.github/workflows/docker-image-hyperspace.yml @@ -48,14 +48,23 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Extract metadata (tags, labels) for Docker - id: meta + - name: Extract metadata (tags, labels) for Docker (tag) + id: meta-tag + if: github.ref_type == 'tag' uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} + + - name: Extract metadata (tags, labels) for Docker (branch) + id: meta-branch + if: github.ref_type == 'branch' + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | type=ref,event=branch type=sha,prefix={{branch}}- @@ -66,10 +75,20 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push Docker image + - name: Build and push Docker image (tag) + if: github.ref_type == 'tag' + uses: docker/build-push-action@v5 + with: + file: scripts/hyperspace.Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta-tag.outputs.tags }} + labels: ${{ steps.meta-tag.outputs.labels }} + + - name: Build and push Docker image (branch) + if: github.ref_type == 'branch' uses: docker/build-push-action@v5 with: file: scripts/hyperspace.Dockerfile push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.meta-branch.outputs.tags }} + labels: ${{ steps.meta-branch.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/docker-image-indexer.yml b/.github/workflows/docker-image-indexer.yml index c7b860687..2491183b6 100644 --- a/.github/workflows/docker-image-indexer.yml +++ b/.github/workflows/docker-image-indexer.yml @@ -48,14 +48,23 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Extract metadata (tags, labels) for Docker - id: meta + - name: Extract metadata (tags, labels) for Docker (tag) + id: meta-tag + if: github.ref_type == 'tag' uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} + + - name: Extract metadata (tags, labels) for Docker (branch) + id: meta-branch + if: github.ref_type == 'branch' + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | type=ref,event=branch type=sha,prefix={{branch}}- @@ -73,3 +82,22 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + + - name: Build and push Docker image (tag) + if: github.ref_type == 'tag' + uses: docker/build-push-action@v5 + with: + file: scripts/indexer.Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta-tag.outputs.tags }} + labels: ${{ steps.meta-tag.outputs.labels }} + + - name: Build and push Docker image (branch) + if: github.ref_type == 'branch' + uses: docker/build-push-action@v5 + with: + file: scripts/indexer.Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta-branch.outputs.tags }} + labels: ${{ steps.meta-branch.outputs.labels }} \ No newline at end of file diff --git a/light-clients/ics07-tendermint/src/client_message.rs b/light-clients/ics07-tendermint/src/client_message.rs index 28fae3d30..46b4fc965 100644 --- a/light-clients/ics07-tendermint/src/client_message.rs +++ b/light-clients/ics07-tendermint/src/client_message.rs @@ -332,14 +332,22 @@ impl Header { let mut bitmask: u64 = 0; - for (index, (_, vote)) in non_absent_votes.enumerate() { - let pub_key = &self - .validator_set - .validators() - .iter() - .find(|x| x.address == vote.validator_address) - .unwrap() - .pub_key; + for (index, s) in signed_header.commit.signatures.iter().enumerate() { + + let validator_address = match s { + CommitSig::BlockIdFlagAbsent { .. } => None, + CommitSig::BlockIdFlagCommit { validator_address, .. } => + Some(*validator_address), + CommitSig::BlockIdFlagNil { validator_address, .. } => + Some(*validator_address), + }; + + let vote = match validator_address { + Some(vote) => vote, + None => continue, + }; + + let pub_key = &self.validator_set.validators().iter().find(|x| x.address == vote).unwrap().pub_key; let p = pub_key; let mut f_pub_key = None; match p { @@ -352,16 +360,13 @@ impl Header { if ret.iter().any(|x| x.0 == f_pub_key.clone().unwrap_or(vec![])) { 1 } else { 0 }; if validator == 1 { - let str_pub_key = hex::encode(vote.validator_address); - log::info!( - target: "hyperspace", "Validator when bitmask index: {} : address {:?} Voting Power: {:?}", - index,str_pub_key, - self.validator_set.validators()[index].power() - ); + let str_pub_key = hex::encode(vote); + log::info!(target: "hyperspace", "Validator when bitmask index: {} : address {:?} Voting Power: {:?}", index, str_pub_key, self.validator_set.validators()[index].power()); bitmask |= 1 << index; } } + log::info!(target: "hyperspace", "Header Height: {:?} Bitmask : {} Validators : {:?}", self.height(), bitmask, ret); Ok((ret, bitmask)) } }