Skip to content

Commit 17d8e48

Browse files
committed
rm dkg with ferveo
1 parent 9f4ebc7 commit 17d8e48

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+394
-2633
lines changed

Cargo.lock

+38-328
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ ethers = "2.0.0"
7777
expectrl = "0.7.0"
7878
eyre = "0.6.5"
7979
fd-lock = "3.0.12"
80-
ferveo = {git = "https://github.com/anoma/ferveo", rev = "e5abd0acc938da90140351a65a26472eb495ce4d"}
81-
ferveo-common = {git = "https://github.com/anoma/ferveo", rev = "e5abd0acc938da90140351a65a26472eb495ce4d"}
8280
flate2 = "1.0.22"
8381
fs_extra = "1.2.0"
8482
futures = "0.3"

apps/Cargo.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ integration = []
6262

6363

6464
[dependencies]
65-
namada = {path = "../shared", features = ["ferveo-tpke", "masp-tx-gen", "multicore", "http-client", "tendermint-rpc"]}
65+
namada = {path = "../shared", features = ["masp-tx-gen", "multicore", "http-client", "tendermint-rpc"]}
6666
namada_sdk = {path = "../sdk", default-features = false, features = ["wasm-runtime", "masp-tx-gen"]}
6767
namada_test_utils = {path = "../test_utils", optional = true}
6868
ark-serialize.workspace = true
@@ -90,8 +90,6 @@ ethbridge-bridge-events.workspace = true
9090
ethbridge-events.workspace = true
9191
eyre.workspace = true
9292
fd-lock.workspace = true
93-
ferveo-common.workspace = true
94-
ferveo.workspace = true
9593
flate2.workspace = true
9694
futures.workspace = true
9795
itertools.workspace = true

apps/src/lib/client/tx.rs

-6
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,6 @@ pub async fn submit_init_validator<'a>(
334334
)
335335
.unwrap();
336336
let protocol_key = validator_keys.get_protocol_keypair().ref_to();
337-
let dkg_key = validator_keys
338-
.dkg_keypair
339-
.as_ref()
340-
.expect("DKG sessions keys should have been created")
341-
.public();
342337

343338
let validator_vp_code_hash =
344339
query_wasm_code_hash(namada, validator_vp_code_path.to_str().unwrap())
@@ -387,7 +382,6 @@ pub async fn submit_init_validator<'a>(
387382
eth_hot_key: key::secp256k1::PublicKey::try_from_pk(&eth_hot_pk)
388383
.unwrap(),
389384
protocol_key,
390-
dkg_key,
391385
commission_rate,
392386
max_commission_rate_change,
393387
validator_vp_code_hash: extra_section_hash,

apps/src/lib/config/genesis.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use namada::ledger::parameters::EpochDuration;
1919
use namada::ledger::pos::{Dec, GenesisValidator, OwnedPosParams};
2020
use namada::types::address::Address;
2121
use namada::types::chain::ProposalBytes;
22-
use namada::types::key::dkg_session_keys::DkgPublicKey;
2322
use namada::types::key::*;
2423
use namada::types::time::{DateTimeUtc, DurationSecs};
2524
use namada::types::token::Denomination;
@@ -75,8 +74,6 @@ pub struct Validator {
7574
/// this key on a transaction signature.
7675
/// Note that this is distinct from consensus key used in the PoS system.
7776
pub account_key: common::PublicKey,
78-
/// The public DKG session key used during the DKG protocol
79-
pub dkg_public_key: DkgPublicKey,
8077
/// These tokens are not staked and hence do not contribute to the
8178
/// validator's voting power
8279
pub non_staked_balance: token::Amount,
@@ -374,8 +371,7 @@ pub fn make_dev_genesis(
374371
);
375372
let eth_cold_keypair =
376373
common::SecretKey::try_from_sk(&secp_eth_cold_keypair).unwrap();
377-
let (protocol_keypair, eth_bridge_keypair, dkg_keypair) =
378-
defaults::validator_keys();
374+
let (protocol_keypair, eth_bridge_keypair) = defaults::validator_keys();
379375
let alias = Alias::from_str(&format!("validator-{}", val + 1))
380376
.expect("infallible");
381377
// add the validator
@@ -384,9 +380,6 @@ pub fn make_dev_genesis(
384380
address,
385381
tx: transactions::ValidatorAccountTx {
386382
alias: alias.clone(),
387-
dkg_key: StringEncoded {
388-
raw: dkg_keypair.public(),
389-
},
390383
vp: "vp_validator".to_string(),
391384
commission_rate: Dec::new(5, 2).expect("This can't fail"),
392385
max_commission_rate_change: Dec::new(1, 2)
@@ -477,7 +470,7 @@ pub mod tests {
477470
let keypair: common::SecretKey =
478471
ed25519::SigScheme::generate(&mut rng).try_to_sk().unwrap();
479472
let kp_arr = keypair.serialize_to_vec();
480-
let (protocol_keypair, _eth_hot_bridge_keypair, dkg_keypair) =
473+
let (protocol_keypair, _eth_hot_bridge_keypair) =
481474
wallet::defaults::validator_keys();
482475

483476
// TODO: derive validator eth address from an eth keypair
@@ -493,7 +486,6 @@ pub mod tests {
493486
println!("address: {}", address);
494487
println!("keypair: {:?}", kp_arr);
495488
println!("protocol_keypair: {:?}", protocol_keypair);
496-
println!("dkg_keypair: {:?}", dkg_keypair.serialize_to_vec());
497489
println!(
498490
"eth_cold_gov_keypair: {:?}",
499491
eth_cold_gov_keypair.serialize_to_vec()

apps/src/lib/config/genesis/transactions.rs

-15
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use namada::proto::{
1313
standalone_signature, verify_standalone_sig, SerializeWithBorsh,
1414
};
1515
use namada::types::dec::Dec;
16-
use namada::types::key::dkg_session_keys::DkgPublicKey;
1716
use namada::types::key::{common, RefTo, VerifySigError};
1817
use namada::types::time::{DateTimeUtc, MIN_UTC};
1918
use namada::types::token;
@@ -137,15 +136,6 @@ pub fn init_validator(
137136
.protocol_keypair
138137
.ref_to(),
139138
),
140-
dkg_key: StringEncoded::new(
141-
validator_wallet
142-
.store
143-
.validator_keys
144-
.dkg_keypair
145-
.as_ref()
146-
.expect("Missing validator DKG key")
147-
.public(),
148-
),
149139
tendermint_node_key: StringEncoded::new(
150140
validator_wallet.tendermint_node_key.ref_to(),
151141
),
@@ -251,7 +241,6 @@ pub fn sign_validator_account_tx(
251241
account_key,
252242
consensus_key,
253243
protocol_key,
254-
dkg_key,
255244
tendermint_node_key,
256245
vp,
257246
commission_rate,
@@ -293,7 +282,6 @@ pub fn sign_validator_account_tx(
293282
account_key,
294283
consensus_key,
295284
protocol_key,
296-
dkg_key,
297285
tendermint_node_key,
298286
vp,
299287
commission_rate,
@@ -547,7 +535,6 @@ pub type SignedValidatorAccountTx = ValidatorAccountTx<SignedPk>;
547535
)]
548536
pub struct ValidatorAccountTx<PK> {
549537
pub alias: Alias,
550-
pub dkg_key: StringEncoded<DkgPublicKey>,
551538
pub vp: String,
552539
/// Commission rate charged on rewards for delegators (bounded inside
553540
/// 0-1)
@@ -1439,7 +1426,6 @@ impl From<&SignedValidatorAccountTx> for UnsignedValidatorAccountTx {
14391426
fn from(tx: &SignedValidatorAccountTx) -> Self {
14401427
let SignedValidatorAccountTx {
14411428
alias,
1442-
dkg_key,
14431429
vp,
14441430
commission_rate,
14451431
max_commission_rate_change,
@@ -1454,7 +1440,6 @@ impl From<&SignedValidatorAccountTx> for UnsignedValidatorAccountTx {
14541440

14551441
Self {
14561442
alias: alias.clone(),
1457-
dkg_key: dkg_key.clone(),
14581443
vp: vp.clone(),
14591444
commission_rate: *commission_rate,
14601445
max_commission_rate_change: *max_commission_rate_change,

apps/src/lib/node/ledger/mod.rs

-11
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,6 @@ impl Shell {
118118
Request::RevertProposal(_req) => {
119119
Ok(Response::RevertProposal(self.revert_proposal(_req)))
120120
}
121-
#[cfg(feature = "abcipp")]
122-
Request::ExtendVote(_req) => {
123-
Ok(Response::ExtendVote(self.extend_vote(_req)))
124-
}
125-
#[cfg(feature = "abcipp")]
126-
Request::VerifyVoteExtension(_req) => {
127-
tracing::debug!("Request VerifyVoteExtension");
128-
Ok(Response::VerifyVoteExtension(
129-
self.verify_vote_extension(_req),
130-
))
131-
}
132121
Request::FinalizeBlock(finalize) => {
133122
tracing::debug!("Request FinalizeBlock");
134123
self.load_proposals();

apps/src/lib/node/ledger/shell/finalize_block.rs

+1-14
Original file line numberDiff line numberDiff line change
@@ -349,16 +349,6 @@ where
349349
None,
350350
)
351351
}
352-
ref protocol_tx_type => {
353-
tracing::error!(
354-
?protocol_tx_type,
355-
"Internal logic error: FinalizeBlock received \
356-
an unsupported TxType::Protocol transaction: \
357-
{:?}",
358-
protocol_tx
359-
);
360-
continue;
361-
}
362352
},
363353
};
364354

@@ -1100,8 +1090,6 @@ mod test_finalize_block {
11001090
.unwrap();
11011091
shell.enqueue_tx(outer_tx.clone(), gas_limit);
11021092
outer_tx.update_header(TxType::Decrypted(DecryptedTx::Decrypted));
1103-
outer_tx.decrypt(<EllipticCurve as PairingEngine>::G2Affine::prime_subgroup_generator())
1104-
.expect("Test failed");
11051093
ProcessedTx {
11061094
tx: outer_tx.to_bytes().into(),
11071095
result: TxResult {
@@ -1686,8 +1674,7 @@ mod test_finalize_block {
16861674
transfers: vec![transfer],
16871675
relayer: bertha,
16881676
};
1689-
let (protocol_key, _, _) =
1690-
crate::wallet::defaults::validator_keys();
1677+
let (protocol_key, _) = crate::wallet::defaults::validator_keys();
16911678
let validator_addr = crate::wallet::defaults::validator_address();
16921679
let ext = {
16931680
let ext = ethereum_events::Vext {

apps/src/lib/node/ledger/shell/init_chain.rs

-7
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,6 @@ where
413413
ValidatorAccountTx {
414414
alias,
415415
vp,
416-
dkg_key,
417416
commission_rate,
418417
max_commission_rate_change,
419418
net_address: _,
@@ -448,12 +447,6 @@ where
448447
.write(&protocol_pk_key(address), &protocol_key.pk.raw)
449448
.expect("Unable to set genesis user protocol public key");
450449

451-
self.wl_storage
452-
.write(&dkg_session_keys::dkg_pk_key(address), &dkg_key.raw)
453-
.expect(
454-
"Unable to set genesis user public DKG session key",
455-
);
456-
457450
// TODO: replace pos::init_genesis validators arg with
458451
// init_genesis_validator from here
459452
if let Err(err) = pos::namada_proof_of_stake::become_validator(

apps/src/lib/node/ledger/shell/mod.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ use namada::types::key::*;
6060
use namada::types::storage::{BlockHeight, Key, TxIndex};
6161
use namada::types::time::DateTimeUtc;
6262
use namada::types::transaction::protocol::EthereumTxData;
63-
use namada::types::transaction::{
64-
hash_tx, verify_decrypted_correctly, AffineCurve, DecryptedTx,
65-
EllipticCurve, PairingEngine, TxType, WrapperTx,
66-
};
63+
use namada::types::transaction::{DecryptedTx, TxType, WrapperTx};
6764
use namada::types::{address, token};
6865
use namada::vm::wasm::{TxCache, VpCache};
6966
use namada::vm::{WasmCacheAccess, WasmCacheRwAccess};
@@ -501,7 +498,7 @@ where
501498
}
502499
#[cfg(test)]
503500
{
504-
let (protocol_keypair, eth_bridge_keypair, dkg_keypair) =
501+
let (protocol_keypair, eth_bridge_keypair) =
505502
crate::wallet::defaults::validator_keys();
506503
ShellMode::Validator {
507504
data: ValidatorData {
@@ -510,7 +507,6 @@ where
510507
keys: ValidatorKeys {
511508
protocol_keypair,
512509
eth_bridge_keypair,
513-
dkg_keypair: Some(dkg_keypair),
514510
},
515511
},
516512
broadcast_sender,
@@ -2341,7 +2337,7 @@ mod shell_tests {
23412337

23422338
let (shell, _recv, _, _) = test_utils::setup_at_height(LAST_HEIGHT);
23432339

2344-
let (protocol_key, _, _) = wallet::defaults::validator_keys();
2340+
let (protocol_key, _) = wallet::defaults::validator_keys();
23452341
let validator_addr = wallet::defaults::validator_address();
23462342

23472343
let ethereum_event = EthereumEvent::TransfersToNamada {
@@ -2374,7 +2370,7 @@ mod shell_tests {
23742370

23752371
let (shell, _recv, _, _) = test_utils::setup_at_height(LAST_HEIGHT);
23762372

2377-
let (protocol_key, _, _) = wallet::defaults::validator_keys();
2373+
let (protocol_key, _) = wallet::defaults::validator_keys();
23782374
let validator_addr = wallet::defaults::validator_address();
23792375

23802376
let ethereum_event = EthereumEvent::TransfersToNamada {

apps/src/lib/node/ledger/shell/prepare_proposal.rs

+6-25
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ use namada::types::address::Address;
1111
use namada::types::internal::TxInQueue;
1212
use namada::types::key::tm_raw_hash_to_string;
1313
use namada::types::time::DateTimeUtc;
14-
use namada::types::transaction::wrapper::wrapper_tx::PairingEngine;
15-
use namada::types::transaction::{
16-
AffineCurve, DecryptedTx, EllipticCurve, TxType,
17-
};
14+
use namada::types::transaction::{DecryptedTx, TxType};
1815
use namada::vm::wasm::{TxCache, VpCache};
1916
use namada::vm::WasmCacheAccess;
2017

@@ -265,9 +262,6 @@ where
265262
&self,
266263
mut alloc: BlockAllocator<BuildingDecryptedTxBatch>,
267264
) -> (Vec<TxBytes>, BlockAllocator<BuildingProtocolTxBatch>) {
268-
// TODO: This should not be hardcoded
269-
let privkey =
270-
<EllipticCurve as PairingEngine>::G2Affine::prime_subgroup_generator();
271265
let pos_queries = self.wl_storage.pos_queries();
272266
let txs = self
273267
.wl_storage
@@ -280,21 +274,8 @@ where
280274
gas: _,
281275
}| {
282276
let mut tx = tx.clone();
283-
match tx.decrypt(privkey).ok()
284-
{
285-
Some(_) => {
286-
tx.update_header(TxType::Decrypted(DecryptedTx::Decrypted));
287-
tx
288-
},
289-
// An absent or undecryptable inner_tx are both
290-
// treated as undecryptable
291-
None => {
292-
tx.update_header(TxType::Decrypted(
293-
DecryptedTx::Undecryptable
294-
));
295-
tx
296-
},
297-
}.to_bytes().into()
277+
tx.update_header(TxType::Decrypted(DecryptedTx::Decrypted));
278+
tx.to_bytes().into()
298279
},
299280
)
300281
// TODO: make sure all decrypted txs are accepted
@@ -499,7 +480,7 @@ mod test_prepare_proposal {
499480
let (shell, _recv, _, _) = test_utils::setup_at_height(LAST_HEIGHT);
500481

501482
let signed_vote_extension = {
502-
let (protocol_key, _, _) = wallet::defaults::validator_keys();
483+
let (protocol_key, _) = wallet::defaults::validator_keys();
503484
let validator_addr = wallet::defaults::validator_address();
504485

505486
// generate a valid signature
@@ -531,7 +512,7 @@ mod test_prepare_proposal {
531512
const LAST_HEIGHT: BlockHeight = BlockHeight(3);
532513

533514
fn check_invalid(shell: &TestShell, height: BlockHeight) {
534-
let (protocol_key, _, _) = wallet::defaults::validator_keys();
515+
let (protocol_key, _) = wallet::defaults::validator_keys();
535516
let validator_addr = wallet::defaults::validator_address();
536517

537518
let signed_vote_extension = {
@@ -704,7 +685,7 @@ mod test_prepare_proposal {
704685
);
705686

706687
// test prepare proposal
707-
let (protocol_key, _, _) = wallet::defaults::validator_keys();
688+
let (protocol_key, _) = wallet::defaults::validator_keys();
708689
let validator_addr = wallet::defaults::validator_address();
709690

710691
let ethereum_event = EthereumEvent::TransfersToNamada {

0 commit comments

Comments
 (0)