Skip to content

Commit 7641439

Browse files
authored
Pass compressed public key in nextPublicKeySignatureSumbitted and publicKeySignatureChanged events (#704)
* Pass compressed public key * update checkout to v3
1 parent b8b8c6c commit 7641439

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

.github/workflows/checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
name: links
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
1919

2020
- name: Check markdown links
2121
uses: gaurav-nelson/github-action-markdown-link-check@v1
@@ -33,7 +33,7 @@ jobs:
3333
with:
3434
access_token: ${{ github.token }}
3535

36-
- uses: actions/checkout@v2
36+
- uses: actions/checkout@v3
3737
- name: Install latest nightly
3838
uses: dtolnay/rust-toolchain@stable
3939
with:

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
sudo rm -rf /var/lib/apt/lists/*
2929
3030
- name: Checkout
31-
uses: actions/checkout@v2
31+
uses: actions/checkout@v3
3232

3333
- name: Install Toolchain
3434
uses: dtolnay/rust-toolchain@stable

.github/workflows/publish-rust-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
name: docs
1616
runs-on: ubuntu-20.04
1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
1919

2020
- name: Install apt dependencies
2121
run: |

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
sudo apt-get clean
3333
3434
- name: Checkout Sources
35-
uses: actions/checkout@v2
35+
uses: actions/checkout@v3
3636

3737
- name: Restore Cache
3838
if: always()

pallets/dkg-metadata/src/lib.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,8 @@ pub mod pallet {
716716
pub_key: Vec<u8>,
717717
/// The Signature of the data above, concatenated.
718718
signature: Vec<u8>,
719+
/// The compressed pub key
720+
compressed_pub_key: Vec<u8>,
719721
},
720722
/// Current Public Key Changed.
721723
PublicKeyChanged { compressed_pub_key: Vec<u8> },
@@ -733,6 +735,8 @@ pub mod pallet {
733735
pub_key: Vec<u8>,
734736
/// The Signature of the data above, concatenated.
735737
signature: Vec<u8>,
738+
/// The compressed pub key
739+
compressed_pub_key: Vec<u8>,
736740
},
737741
/// Misbehaviour reports submitted
738742
MisbehaviourReportsSubmitted {
@@ -1871,9 +1875,9 @@ impl<T: Config> Pallet<T> {
18711875
RefreshNonce::<T>::put(next_nonce);
18721876

18731877
// Emit events so other front-end know that.
1874-
let compressed_pub_key = next_pub_key.1;
1878+
let compressed_pub_key = next_pub_key.1.clone();
18751879
Self::deposit_event(Event::PublicKeyChanged {
1876-
compressed_pub_key: compressed_pub_key.into(),
1880+
compressed_pub_key: compressed_pub_key.clone().into(),
18771881
});
18781882

18791883
// At this point the refresh proposal should ALWAYS exist
@@ -1885,6 +1889,7 @@ impl<T: Config> Pallet<T> {
18851889
nonce: curr.nonce,
18861890
pub_key: curr.pub_key,
18871891
signature: next_pub_key_signature.into(),
1892+
compressed_pub_key: compressed_pub_key.to_vec(),
18881893
});
18891894

18901895
CurrentRefreshProposal::<T>::kill();
@@ -2427,6 +2432,9 @@ impl<T: Config> OnSignedProposal<T::MaxProposalLength> for Pallet<T> {
24272432
ensure!(proposal.is_signed(), Error::<T>::ProposalNotSigned);
24282433

24292434
if proposal.kind() == ProposalKind::Refresh {
2435+
let (_, next_pub_key) =
2436+
Self::next_dkg_public_key().ok_or(Error::<T>::NoNextPublicKey)?;
2437+
24302438
// Check if a signature is already submitted. This should also prevent
24312439
// against manipulating the ECDSA signature to replay the submission.
24322440
ensure!(
@@ -2466,6 +2474,7 @@ impl<T: Config> OnSignedProposal<T::MaxProposalLength> for Pallet<T> {
24662474
voter_count: curr.voter_count,
24672475
nonce: curr.nonce,
24682476
pub_key: curr.pub_key,
2477+
compressed_pub_key: next_pub_key.into(),
24692478
});
24702479
};
24712480

0 commit comments

Comments
 (0)