Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/vmarkushin/refactor-tendermint+z…
Browse files Browse the repository at this point in the history
…k' into vmarkushin/refactor-tendermint+zk
  • Loading branch information
vmarkushin committed Mar 18, 2024
2 parents 8b71414 + 42fec44 commit b288a8c
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 21 deletions.
29 changes: 24 additions & 5 deletions .github/workflows/docker-image-hyperspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}-
Expand All @@ -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 }}
32 changes: 30 additions & 2 deletions .github/workflows/docker-image-indexer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}-
Expand All @@ -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 }}
33 changes: 19 additions & 14 deletions light-clients/ics07-tendermint/src/client_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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))
}
}
Expand Down

0 comments on commit b288a8c

Please sign in to comment.