diff --git a/common/client-libs/validator-client/src/nyxd/contract_traits/dkg_signing_client.rs b/common/client-libs/validator-client/src/nyxd/contract_traits/dkg_signing_client.rs index 8ba3eeed0d..a1252cdba1 100644 --- a/common/client-libs/validator-client/src/nyxd/contract_traits/dkg_signing_client.rs +++ b/common/client-libs/validator-client/src/nyxd/contract_traits/dkg_signing_client.rs @@ -12,6 +12,7 @@ use cosmwasm_std::Addr; use nym_coconut_dkg_common::msg::ExecuteMsg as DkgExecuteMsg; use nym_coconut_dkg_common::types::{EncodedBTEPublicKeyWithProof, PartialContractDealing}; use nym_coconut_dkg_common::verification_key::VerificationKeyShare; +use nym_contracts_common::IdentityKey; #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] #[cfg_attr(not(target_arch = "wasm32"), async_trait)] @@ -41,12 +42,14 @@ pub trait DkgSigningClient { async fn register_dealer( &self, bte_key: EncodedBTEPublicKeyWithProof, + identity_key: IdentityKey, announce_address: String, resharing: bool, fee: Option, ) -> Result { let req = DkgExecuteMsg::RegisterDealer { bte_key_with_proof: bte_key, + identity_key, announce_address, resharing, }; @@ -144,10 +147,17 @@ mod tests { match msg { DkgExecuteMsg::RegisterDealer { bte_key_with_proof, + identity_key, announce_address, resharing, } => client - .register_dealer(bte_key_with_proof, announce_address, resharing, None) + .register_dealer( + bte_key_with_proof, + identity_key, + announce_address, + resharing, + None, + ) .ignore(), DkgExecuteMsg::CommitDealing { dealing, resharing } => client .submit_dealing_bytes(dealing, resharing, None) diff --git a/common/cosmwasm-smart-contracts/coconut-dkg/src/dealer.rs b/common/cosmwasm-smart-contracts/coconut-dkg/src/dealer.rs index da00b9bf41..83f848e0d7 100644 --- a/common/cosmwasm-smart-contracts/coconut-dkg/src/dealer.rs +++ b/common/cosmwasm-smart-contracts/coconut-dkg/src/dealer.rs @@ -12,6 +12,7 @@ use cosmwasm_std::Addr; pub struct DealerDetails { pub address: Addr, pub bte_public_key_with_proof: EncodedBTEPublicKeyWithProof, + pub ed25519_identity: String, pub announce_address: String, pub assigned_index: NodeIndex, } diff --git a/common/cosmwasm-smart-contracts/coconut-dkg/src/msg.rs b/common/cosmwasm-smart-contracts/coconut-dkg/src/msg.rs index 55884fd87f..594875e369 100644 --- a/common/cosmwasm-smart-contracts/coconut-dkg/src/msg.rs +++ b/common/cosmwasm-smart-contracts/coconut-dkg/src/msg.rs @@ -17,6 +17,7 @@ use crate::{ types::{Epoch, InitialReplacementData, State}, verification_key::PagedVKSharesResponse, }; +use contracts_common::IdentityKey; #[cfg(feature = "schema")] use cosmwasm_schema::QueryResponses; @@ -35,6 +36,7 @@ pub struct InstantiateMsg { pub enum ExecuteMsg { RegisterDealer { bte_key_with_proof: EncodedBTEPublicKeyWithProof, + identity_key: IdentityKey, announce_address: String, resharing: bool, }, diff --git a/contracts/coconut-dkg/schema/nym-coconut-dkg.json b/contracts/coconut-dkg/schema/nym-coconut-dkg.json index 3f18d5239c..712b61c502 100644 --- a/contracts/coconut-dkg/schema/nym-coconut-dkg.json +++ b/contracts/coconut-dkg/schema/nym-coconut-dkg.json @@ -102,6 +102,7 @@ "required": [ "announce_address", "bte_key_with_proof", + "identity_key", "resharing" ], "properties": { @@ -111,6 +112,9 @@ "bte_key_with_proof": { "type": "string" }, + "identity_key": { + "type": "string" + }, "resharing": { "type": "boolean" } @@ -590,7 +594,8 @@ "address", "announce_address", "assigned_index", - "bte_public_key_with_proof" + "bte_public_key_with_proof", + "ed25519_identity" ], "properties": { "address": { @@ -606,6 +611,9 @@ }, "bte_public_key_with_proof": { "type": "string" + }, + "ed25519_identity": { + "type": "string" } }, "additionalProperties": false @@ -854,7 +862,8 @@ "address", "announce_address", "assigned_index", - "bte_public_key_with_proof" + "bte_public_key_with_proof", + "ed25519_identity" ], "properties": { "address": { @@ -870,6 +879,9 @@ }, "bte_public_key_with_proof": { "type": "string" + }, + "ed25519_identity": { + "type": "string" } }, "additionalProperties": false @@ -1121,7 +1133,8 @@ "address", "announce_address", "assigned_index", - "bte_public_key_with_proof" + "bte_public_key_with_proof", + "ed25519_identity" ], "properties": { "address": { @@ -1137,6 +1150,9 @@ }, "bte_public_key_with_proof": { "type": "string" + }, + "ed25519_identity": { + "type": "string" } }, "additionalProperties": false diff --git a/contracts/coconut-dkg/schema/raw/execute.json b/contracts/coconut-dkg/schema/raw/execute.json index 0fad909fa5..9b22dcba2c 100644 --- a/contracts/coconut-dkg/schema/raw/execute.json +++ b/contracts/coconut-dkg/schema/raw/execute.json @@ -13,6 +13,7 @@ "required": [ "announce_address", "bte_key_with_proof", + "identity_key", "resharing" ], "properties": { @@ -22,6 +23,9 @@ "bte_key_with_proof": { "type": "string" }, + "identity_key": { + "type": "string" + }, "resharing": { "type": "boolean" } diff --git a/contracts/coconut-dkg/schema/raw/response_to_get_current_dealers.json b/contracts/coconut-dkg/schema/raw/response_to_get_current_dealers.json index e08ceedf09..12648de260 100644 --- a/contracts/coconut-dkg/schema/raw/response_to_get_current_dealers.json +++ b/contracts/coconut-dkg/schema/raw/response_to_get_current_dealers.json @@ -42,7 +42,8 @@ "address", "announce_address", "assigned_index", - "bte_public_key_with_proof" + "bte_public_key_with_proof", + "ed25519_identity" ], "properties": { "address": { @@ -58,6 +59,9 @@ }, "bte_public_key_with_proof": { "type": "string" + }, + "ed25519_identity": { + "type": "string" } }, "additionalProperties": false diff --git a/contracts/coconut-dkg/schema/raw/response_to_get_dealer_details.json b/contracts/coconut-dkg/schema/raw/response_to_get_dealer_details.json index 474a247a99..776cfefbc1 100644 --- a/contracts/coconut-dkg/schema/raw/response_to_get_dealer_details.json +++ b/contracts/coconut-dkg/schema/raw/response_to_get_dealer_details.json @@ -32,7 +32,8 @@ "address", "announce_address", "assigned_index", - "bte_public_key_with_proof" + "bte_public_key_with_proof", + "ed25519_identity" ], "properties": { "address": { @@ -48,6 +49,9 @@ }, "bte_public_key_with_proof": { "type": "string" + }, + "ed25519_identity": { + "type": "string" } }, "additionalProperties": false diff --git a/contracts/coconut-dkg/schema/raw/response_to_get_past_dealers.json b/contracts/coconut-dkg/schema/raw/response_to_get_past_dealers.json index e08ceedf09..12648de260 100644 --- a/contracts/coconut-dkg/schema/raw/response_to_get_past_dealers.json +++ b/contracts/coconut-dkg/schema/raw/response_to_get_past_dealers.json @@ -42,7 +42,8 @@ "address", "announce_address", "assigned_index", - "bte_public_key_with_proof" + "bte_public_key_with_proof", + "ed25519_identity" ], "properties": { "address": { @@ -58,6 +59,9 @@ }, "bte_public_key_with_proof": { "type": "string" + }, + "ed25519_identity": { + "type": "string" } }, "additionalProperties": false diff --git a/contracts/coconut-dkg/src/contract.rs b/contracts/coconut-dkg/src/contract.rs index 67ae62f303..aa6b700486 100644 --- a/contracts/coconut-dkg/src/contract.rs +++ b/contracts/coconut-dkg/src/contract.rs @@ -78,9 +78,17 @@ pub fn execute( match msg { ExecuteMsg::RegisterDealer { bte_key_with_proof, + identity_key, announce_address, resharing, - } => try_add_dealer(deps, info, bte_key_with_proof, announce_address, resharing), + } => try_add_dealer( + deps, + info, + bte_key_with_proof, + identity_key, + announce_address, + resharing, + ), ExecuteMsg::CommitDealing { dealing, resharing } => { try_commit_dealings(deps, info, dealing, resharing) } @@ -268,6 +276,7 @@ mod tests { coconut_dkg_contract_addr.clone(), &RegisterDealer { bte_key_with_proof: "bte_key_with_proof".to_string(), + identity_key: "identity".to_string(), announce_address: "127.0.0.1:8000".to_string(), resharing: false, }, @@ -282,6 +291,7 @@ mod tests { coconut_dkg_contract_addr.clone(), &RegisterDealer { bte_key_with_proof: "bte_key_with_proof".to_string(), + identity_key: "identity".to_string(), announce_address: "127.0.0.1:8000".to_string(), resharing: false, }, @@ -298,6 +308,7 @@ mod tests { coconut_dkg_contract_addr, &RegisterDealer { bte_key_with_proof: "bte_key_with_proof".to_string(), + identity_key: "identity".to_string(), announce_address: "127.0.0.1:8000".to_string(), resharing: false, }, diff --git a/contracts/coconut-dkg/src/dealers/transactions.rs b/contracts/coconut-dkg/src/dealers/transactions.rs index 58c64b9cf5..c127f40cb7 100644 --- a/contracts/coconut-dkg/src/dealers/transactions.rs +++ b/contracts/coconut-dkg/src/dealers/transactions.rs @@ -38,6 +38,7 @@ pub fn try_add_dealer( mut deps: DepsMut<'_>, info: MessageInfo, bte_key_with_proof: EncodedBTEPublicKeyWithProof, + identity_key: String, announce_address: String, resharing: bool, ) -> Result { @@ -65,6 +66,7 @@ pub fn try_add_dealer( let dealer_details = DealerDetails { address: info.sender.clone(), bte_public_key_with_proof: bte_key_with_proof, + ed25519_identity: identity_key, announce_address, assigned_index: node_index, }; @@ -141,6 +143,7 @@ pub(crate) mod tests { let mut env = mock_env(); let info = mock_info(owner.as_str(), &[]); let bte_key_with_proof = String::from("bte_key_with_proof"); + let identity = String::from("identity"); let announce_address = String::from("localhost:8000"); env.block.time = env @@ -155,6 +158,7 @@ pub(crate) mod tests { deps.as_mut(), info, bte_key_with_proof, + identity, announce_address, false, ) diff --git a/contracts/coconut-dkg/src/dealings/transactions.rs b/contracts/coconut-dkg/src/dealings/transactions.rs index 5c9e5c5d85..f6ce3eab60 100644 --- a/contracts/coconut-dkg/src/dealings/transactions.rs +++ b/contracts/coconut-dkg/src/dealings/transactions.rs @@ -108,6 +108,7 @@ pub(crate) mod tests { let dealer_details = DealerDetails { address: owner.clone(), bte_public_key_with_proof: String::new(), + ed25519_identity: String::new(), announce_address: String::new(), assigned_index: 1, }; diff --git a/contracts/coconut-dkg/src/epoch_state/transactions.rs b/contracts/coconut-dkg/src/epoch_state/transactions.rs index dfdf8a2965..c0340df9e4 100644 --- a/contracts/coconut-dkg/src/epoch_state/transactions.rs +++ b/contracts/coconut-dkg/src/epoch_state/transactions.rs @@ -813,6 +813,7 @@ pub(crate) mod tests { &DealerDetails { address: address.clone(), bte_public_key_with_proof: "bte_public_key_with_proof".to_string(), + ed25519_identity: "identity".to_string(), announce_address: "127.0.0.1".to_string(), assigned_index: i, }, diff --git a/contracts/coconut-dkg/src/support/tests/fixtures.rs b/contracts/coconut-dkg/src/support/tests/fixtures.rs index 2b587eddee..7a7f520bcc 100644 --- a/contracts/coconut-dkg/src/support/tests/fixtures.rs +++ b/contracts/coconut-dkg/src/support/tests/fixtures.rs @@ -34,6 +34,7 @@ pub fn dealer_details_fixture(assigned_index: u64) -> DealerDetails { DealerDetails { address: Addr::unchecked(format!("owner{}", assigned_index)), bte_public_key_with_proof: "".to_string(), + ed25519_identity: "".to_string(), announce_address: "".to_string(), assigned_index, } diff --git a/contracts/coconut-dkg/src/support/tests/helpers.rs b/contracts/coconut-dkg/src/support/tests/helpers.rs index a5a2f3fa72..31c8d272fb 100644 --- a/contracts/coconut-dkg/src/support/tests/helpers.rs +++ b/contracts/coconut-dkg/src/support/tests/helpers.rs @@ -30,6 +30,7 @@ pub fn add_fixture_dealer(deps: DepsMut<'_>) { &DealerDetails { address: owner.clone(), bte_public_key_with_proof: String::new(), + ed25519_identity: String::new(), announce_address: String::new(), assigned_index: 100, }, diff --git a/contracts/coconut-dkg/src/verification_key_shares/transactions.rs b/contracts/coconut-dkg/src/verification_key_shares/transactions.rs index ce5f9e908d..bc15e96b8f 100644 --- a/contracts/coconut-dkg/src/verification_key_shares/transactions.rs +++ b/contracts/coconut-dkg/src/verification_key_shares/transactions.rs @@ -122,6 +122,7 @@ mod tests { let dealer_details = DealerDetails { address: dealer.clone(), bte_public_key_with_proof: String::new(), + ed25519_identity: String::new(), announce_address: announce_address.clone(), assigned_index: 1, }; @@ -193,6 +194,7 @@ mod tests { let dealer_details = DealerDetails { address: dealer.clone(), bte_public_key_with_proof: String::new(), + ed25519_identity: String::new(), announce_address: String::new(), assigned_index: 1, }; @@ -300,6 +302,7 @@ mod tests { let dealer_details = DealerDetails { address: owner.clone(), bte_public_key_with_proof: String::new(), + ed25519_identity: String::new(), announce_address: String::new(), assigned_index: 1, };