Skip to content

Commit 048e973

Browse files
authored
feat(contract): TEE verifier contract-account voting (#3626)
1 parent 729c3a6 commit 048e973

19 files changed

Lines changed: 819 additions & 41 deletions

File tree

crates/attestation-cli/tests/test_verification.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::path::PathBuf;
22

33
use attestation_cli::cli::Cli;
44
use attestation_cli::verify;
5-
use mpc_attestation::attestation::Attestation;
5+
use mpc_attestation::attestation::{Attestation, DEFAULT_EXPIRATION_DURATION_SECONDS};
66
use near_mpc_crypto_types::Ed25519PublicKey;
77
use node_types::http_server::StaticWebData;
88
use test_utils::attestation::{
@@ -56,7 +56,7 @@ fn full_verification_succeeds_with_valid_attestation() {
5656
assert_eq!(result.mpc_image_hash.as_hex(), TEST_MPC_IMAGE_DIGEST_HEX);
5757
assert_eq!(
5858
result.expiry_timestamp_seconds,
59-
VALID_ATTESTATION_TIMESTAMP + 60 * 60 * 24 * 7
59+
VALID_ATTESTATION_TIMESTAMP + DEFAULT_EXPIRATION_DURATION_SECONDS
6060
);
6161
}
6262

crates/contract/src/config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const DEFAULT_CLEANUP_ORPHANED_NODE_MIGRATIONS_TERA_GAS: u64 = 4;
3232
const DEFAULT_REMOVE_NON_PARTICIPANT_UPDATE_VOTES_TERA_GAS: u64 = 5;
3333
/// Prepaid gas for a `clean_foreign_chain_data` call
3434
const DEFAULT_CLEAN_FOREIGN_CHAIN_DATA_TERA_GAS: u64 = 5;
35+
/// Prepaid gas for a `remove_non_participant_tee_verifier_votes` call
36+
const DEFAULT_REMOVE_NON_PARTICIPANT_TEE_VERIFIER_VOTES_TERA_GAS: u64 = 5;
3537

3638
/// Config for V2 of the contract.
3739
#[near(serializers=[borsh, json])]
@@ -64,6 +66,8 @@ pub(crate) struct Config {
6466
pub(crate) remove_non_participant_update_votes_tera_gas: u64,
6567
/// Prepaid gas for a `clean_foreign_chain_data` call.
6668
pub(crate) clean_foreign_chain_data_tera_gas: u64,
69+
/// Prepaid gas for a `remove_non_participant_tee_verifier_votes` call.
70+
pub(crate) remove_non_participant_tee_verifier_votes_tera_gas: u64,
6771
}
6872

6973
impl Default for Config {
@@ -88,6 +92,8 @@ impl Default for Config {
8892
remove_non_participant_update_votes_tera_gas:
8993
DEFAULT_REMOVE_NON_PARTICIPANT_UPDATE_VOTES_TERA_GAS,
9094
clean_foreign_chain_data_tera_gas: DEFAULT_CLEAN_FOREIGN_CHAIN_DATA_TERA_GAS,
95+
remove_non_participant_tee_verifier_votes_tera_gas:
96+
DEFAULT_REMOVE_NON_PARTICIPANT_TEE_VERIFIER_VOTES_TERA_GAS,
9197
}
9298
}
9399
}

crates/contract/src/dto_mapping.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,9 @@ impl From<near_mpc_contract_interface::types::InitConfig> for Config {
487487
if let Some(v) = config_ext.clean_foreign_chain_data_tera_gas {
488488
config.clean_foreign_chain_data_tera_gas = v;
489489
}
490+
if let Some(v) = config_ext.remove_non_participant_tee_verifier_votes_tera_gas {
491+
config.remove_non_participant_tee_verifier_votes_tera_gas = v;
492+
}
490493

491494
config
492495
}
@@ -514,6 +517,8 @@ impl From<&Config> for near_mpc_contract_interface::types::Config {
514517
remove_non_participant_update_votes_tera_gas: value
515518
.remove_non_participant_update_votes_tera_gas,
516519
clean_foreign_chain_data_tera_gas: value.clean_foreign_chain_data_tera_gas,
520+
remove_non_participant_tee_verifier_votes_tera_gas: value
521+
.remove_non_participant_tee_verifier_votes_tera_gas,
517522
}
518523
}
519524
}
@@ -540,6 +545,8 @@ impl From<near_mpc_contract_interface::types::Config> for Config {
540545
remove_non_participant_update_votes_tera_gas: value
541546
.remove_non_participant_update_votes_tera_gas,
542547
clean_foreign_chain_data_tera_gas: value.clean_foreign_chain_data_tera_gas,
548+
remove_non_participant_tee_verifier_votes_tera_gas: value
549+
.remove_non_participant_tee_verifier_votes_tera_gas,
543550
}
544551
}
545552
}

0 commit comments

Comments
 (0)