Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
07d7c5f
Changing SignatureScheme into Curve
SimonRastikian Mar 11, 2026
756501e
infer-purpose-from-curve
SimonRastikian Mar 11, 2026
09204d8
Compatibility with serde
SimonRastikian Mar 11, 2026
27ebb75
rename instead of alias for backwards compat
SimonRastikian Mar 11, 2026
3f1fabe
Verifying alias still works
SimonRastikian Mar 11, 2026
665dd0d
No changes on the contract interface after speaking to Kevin
SimonRastikian Mar 11, 2026
a1784ae
More revert
SimonRastikian Mar 11, 2026
5ee59c6
Reverting all the SignatureScheme types in dto and interface
SimonRastikian Mar 11, 2026
cdfd46e
verify_foreign_tx__should_reject_non_foreign_tx_domain
SimonRastikian Mar 11, 2026
e255ece
No abi_has_not_changed file
SimonRastikian Mar 11, 2026
5469dfb
Snap file changing
SimonRastikian Mar 11, 2026
f35b439
Merge branch 'main' into simon/SignatureScheme-Curve
SimonRastikian Mar 11, 2026
f324654
missing one curve
SimonRastikian Mar 11, 2026
dfb5674
Snap changes
SimonRastikian Mar 11, 2026
a99a445
Renaming ed25519 to Curve25519
SimonRastikian Mar 11, 2026
0ac4bd6
Edwards25519
SimonRastikian Mar 11, 2026
b346820
Snap changed
SimonRastikian Mar 11, 2026
20e149c
alias to rename
SimonRastikian Mar 12, 2026
0d865c7
No more conflicts
SimonRastikian Mar 24, 2026
e52f8df
Missing one conflicted file
SimonRastikian Mar 24, 2026
e3e2430
Merge branch 'main' into simon/changing-ed25519-to-Curve25519
SimonRastikian Mar 24, 2026
d31df0c
Fixed: missing one Ed25519
SimonRastikian Mar 24, 2026
a452cea
Merge branch 'simon/changing-ed25519-to-Curve25519' of github.com:nea…
SimonRastikian Mar 24, 2026
e25ce47
update borsh
SimonRastikian Mar 24, 2026
b926872
borsh test
SimonRastikian Mar 24, 2026
eceb110
Merge branch 'main' into simon/changing-ed25519-to-Curve25519
SimonRastikian Mar 24, 2026
e2dacec
Merge branch 'main' into simon/changing-ed25519-to-Curve25519
SimonRastikian Mar 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/contract/src/dto_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ impl IntoInterfaceType<dtos::SignatureScheme> for Curve {
fn into_dto_type(self) -> dtos::SignatureScheme {
match self {
Curve::Secp256k1 => dtos::SignatureScheme::Secp256k1,
Curve::Ed25519 => dtos::SignatureScheme::Ed25519,
Curve::Edwards25519 => dtos::SignatureScheme::Ed25519,
Curve::Bls12381 => dtos::SignatureScheme::Bls12381,
Curve::V2Secp256k1 => dtos::SignatureScheme::V2Secp256k1,
}
Expand Down
4 changes: 2 additions & 2 deletions crates/contract/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ impl MpcContract {
.into_option()
.expect("Ecdsa payload cannot be converted to Scalar");
}
Curve::Ed25519 => {
Curve::Edwards25519 => {
request.payload.as_eddsa().expect("Payload is not EdDSA");
}
Curve::Bls12381 => {
Expand Down Expand Up @@ -2365,7 +2365,7 @@ mod tests {
let (pk, sk) = new_secp256k1(rng);
(pk.into(), SharedSecretKey::Secp256k1(sk))
}
Curve::Ed25519 => {
Curve::Edwards25519 => {
let (pk, sk) = new_ed25519(rng);
(pk.into(), SharedSecretKey::Ed25519(sk))
}
Expand Down
21 changes: 11 additions & 10 deletions crates/contract/src/primitives/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ impl Display for DomainId {
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Curve {
Secp256k1,
Ed25519,
#[serde(rename = "Ed25519")]
Edwards25519,
Bls12381,
V2Secp256k1, // Robust ECDSA
}
Expand All @@ -69,7 +70,7 @@ pub fn is_valid_curve_for_purpose(purpose: DomainPurpose, curve: Curve) -> bool
(purpose, curve),
(DomainPurpose::Sign, Curve::Secp256k1)
| (DomainPurpose::Sign, Curve::V2Secp256k1)
| (DomainPurpose::Sign, Curve::Ed25519)
| (DomainPurpose::Sign, Curve::Edwards25519)
| (DomainPurpose::ForeignTx, Curve::Secp256k1)
| (DomainPurpose::CKD, Curve::Bls12381)
)
Expand Down Expand Up @@ -304,7 +305,7 @@ pub mod tests {
},
DomainConfig {
id: DomainId(1),
curve: Curve::Ed25519,
curve: Curve::Edwards25519,
purpose: DomainPurpose::Sign,
},
];
Expand Down Expand Up @@ -361,7 +362,7 @@ pub mod tests {
},
DomainConfig {
id: DomainId(2),
curve: Curve::Ed25519,
curve: Curve::Edwards25519,
purpose: DomainPurpose::Sign,
},
DomainConfig {
Expand Down Expand Up @@ -400,7 +401,7 @@ pub mod tests {
},
DomainConfig {
id: DomainId(2),
curve: Curve::Ed25519,
curve: Curve::Edwards25519,
purpose: DomainPurpose::Sign,
},
DomainConfig {
Expand All @@ -417,7 +418,7 @@ pub mod tests {
Some(DomainId(3))
);
assert_eq!(
registry.most_recent_domain_for_curve(Curve::Ed25519),
registry.most_recent_domain_for_curve(Curve::Edwards25519),
Some(DomainId(2))
);
}
Expand Down Expand Up @@ -467,7 +468,7 @@ pub mod tests {

#[rstest]
#[case(Curve::Secp256k1, DomainPurpose::Sign)]
#[case(Curve::Ed25519, DomainPurpose::Sign)]
#[case(Curve::Edwards25519, DomainPurpose::Sign)]
#[case(Curve::V2Secp256k1, DomainPurpose::Sign)]
#[case(Curve::Bls12381, DomainPurpose::CKD)]
fn test_infer_purpose_from_curve(#[case] curve: Curve, #[case] expected: DomainPurpose) {
Expand All @@ -478,12 +479,12 @@ pub mod tests {
// Valid combinations
#[case(DomainPurpose::Sign, Curve::Secp256k1, true)]
#[case(DomainPurpose::Sign, Curve::V2Secp256k1, true)]
#[case(DomainPurpose::Sign, Curve::Ed25519, true)]
#[case(DomainPurpose::Sign, Curve::Edwards25519, true)]
#[case(DomainPurpose::ForeignTx, Curve::Secp256k1, true)]
#[case(DomainPurpose::CKD, Curve::Bls12381, true)]
// Invalid combinations
#[case(DomainPurpose::Sign, Curve::Bls12381, false)]
#[case(DomainPurpose::ForeignTx, Curve::Ed25519, false)]
#[case(DomainPurpose::ForeignTx, Curve::Edwards25519, false)]
#[case(DomainPurpose::ForeignTx, Curve::Bls12381, false)]
#[case(DomainPurpose::ForeignTx, Curve::V2Secp256k1, false)]
#[case(DomainPurpose::CKD, Curve::Secp256k1, false)]
Expand Down Expand Up @@ -599,7 +600,7 @@ pub mod tests {
}];
let proposal_b = vec![DomainConfig {
id: DomainId(0),
curve: Curve::Ed25519,
curve: Curve::Edwards25519,
purpose: DomainPurpose::Sign,
}];
let mut votes = AddDomainsVotes::default();
Expand Down
2 changes: 1 addition & 1 deletion crates/contract/src/primitives/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::collections::BTreeMap;

const ALL_CURVES: [Curve; 4] = [
Curve::Secp256k1,
Curve::Ed25519,
Curve::Edwards25519,
Curve::Bls12381,
Curve::V2Secp256k1,
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ BorshSchemaContainer {
),
(
1,
"Ed25519",
"Curve__Ed25519",
"Edwards25519",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this an external interface change?
what is the impact of it?

"Curve__Edwards25519",
),
(
2,
Expand All @@ -319,7 +319,7 @@ BorshSchemaContainer {
"Curve__Bls12381": Struct {
fields: Empty,
},
"Curve__Ed25519": Struct {
"Curve__Edwards25519": Struct {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question as above

fields: Empty,
},
"Curve__Secp256k1": Struct {
Expand Down
2 changes: 1 addition & 1 deletion crates/contract/src/state/running.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ pub mod running_tests {

#[rstest]
#[case(Curve::Bls12381, DomainPurpose::Sign)]
#[case(Curve::Ed25519, DomainPurpose::ForeignTx)]
#[case(Curve::Edwards25519, DomainPurpose::ForeignTx)]
#[case(Curve::Secp256k1, DomainPurpose::CKD)]
fn vote_add_domains__should_reject_invalid_curve_purpose(
#[case] curve: Curve,
Expand Down
2 changes: 1 addition & 1 deletion crates/contract/tests/inprocess/attestation_submission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl TestSetupBuilder {
.contract
.vote_add_domains(vec![DomainConfig {
id: DomainId(1),
curve: Curve::Ed25519,
curve: Curve::Edwards25519,
purpose: DomainPurpose::Sign,
}])
.unwrap();
Expand Down
6 changes: 3 additions & 3 deletions crates/contract/tests/sandbox/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pub async fn init_with_candidates(
.map(|(i, pk)| {
let domain_id = DomainId((i as u64) * 2);
let curve = match pk {
dtos::PublicKey::Ed25519(_) => Curve::Ed25519,
dtos::PublicKey::Ed25519(_) => Curve::Edwards25519,
dtos::PublicKey::Secp256k1(_) => Curve::Secp256k1,
dtos::PublicKey::Bls12381(_) => Curve::Bls12381,
};
Expand Down Expand Up @@ -529,7 +529,7 @@ pub async fn execute_key_generation_and_add_random_state(
let domains_to_add = [
DomainConfig {
id: 0.into(),
curve: Curve::Ed25519,
curve: Curve::Edwards25519,
purpose: DomainPurpose::Sign,
},
DomainConfig {
Expand All @@ -539,7 +539,7 @@ pub async fn execute_key_generation_and_add_random_state(
},
DomainConfig {
id: 2.into(),
curve: Curve::Ed25519,
curve: Curve::Edwards25519,
purpose: DomainPurpose::Sign,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ async fn upgrade_allows_new_request_types(
},
DomainConfig {
id: (first_available_domain_id + 1).into(),
curve: Curve::Ed25519,
curve: Curve::Edwards25519,
purpose: DomainPurpose::Sign,
},
];
Expand Down
2 changes: 1 addition & 1 deletion crates/contract/tests/sandbox/utils/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use near_sdk::{Gas, NearToken};
pub const PARTICIPANT_LEN: usize = 10;
pub const ALL_CURVES: &[Curve; 4] = &[
Curve::Secp256k1,
Curve::Ed25519,
Curve::Edwards25519,
Curve::Bls12381,
Curve::V2Secp256k1,
];
Expand Down
2 changes: 1 addition & 1 deletion crates/contract/tests/sandbox/utils/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl IntoInterfaceType<dtos::SignatureScheme> for Curve {
fn into_interface_type(self) -> dtos::SignatureScheme {
match self {
Curve::Secp256k1 => dtos::SignatureScheme::Secp256k1,
Curve::Ed25519 => dtos::SignatureScheme::Ed25519,
Curve::Edwards25519 => dtos::SignatureScheme::Ed25519,
Curve::Bls12381 => dtos::SignatureScheme::Bls12381,
Curve::V2Secp256k1 => dtos::SignatureScheme::V2Secp256k1,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/contract/tests/sandbox/utils/shared_key_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn make_key_for_domain(domain_curve: Curve) -> (dtos::PublicKey, SharedSecre
let (pk, sk) = new_secp256k1();
(pk, SharedSecretKey::Secp256k1(sk))
}
Curve::Ed25519 => {
Curve::Edwards25519 => {
let (pk, sk) = new_ed25519();
(pk, SharedSecretKey::Ed25519(sk))
}
Expand Down
2 changes: 1 addition & 1 deletion crates/contract/tests/sandbox/vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async fn test_keygen() -> anyhow::Result<()> {
};
let epoch_id = init_running.keyset.epoch_id;
let domain_id = init_running.domains.next_domain_id;
let curve = Curve::Ed25519;
let curve = Curve::Edwards25519;

// vote to add the domain and verify we enter initializing state
vote_add_domains(
Expand Down
4 changes: 2 additions & 2 deletions crates/devnet/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub fn make_actions(call: ContractActionCall) -> ActionCall {
Curve::Secp256k1 | Curve::V2Secp256k1 => {
ecdsa_calls_by_domain.insert(domain.id.0, prot_calls);
}
Curve::Ed25519 => {
Curve::Edwards25519 => {
eddsa_calls_by_domain.insert(domain.id.0, prot_calls);
}
Curve::Bls12381 => {
Expand Down Expand Up @@ -174,7 +174,7 @@ fn make_payload(curve: Curve) -> Payload {
Curve::Secp256k1 | Curve::V2Secp256k1 => {
Payload::Ecdsa(Bytes::new(rand::random::<[u8; 32]>().to_vec()).unwrap())
}
Curve::Ed25519 => {
Curve::Edwards25519 => {
let len = rand::random_range(
EDDSA_PAYLOAD_SIZE_LOWER_BOUND_BYTES..=EDDSA_PAYLOAD_SIZE_UPPER_BOUND_BYTES,
);
Expand Down
2 changes: 1 addition & 1 deletion crates/devnet/src/loadtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl RunLoadtestCmd {
domain_config,
})
}
Curve::Ed25519 | Curve::Secp256k1 | Curve::V2Secp256k1 => {
Curve::Edwards25519 | Curve::Secp256k1 | Curve::V2Secp256k1 => {
ContractActionCall::Sign(crate::contracts::RequestActionCallArgs {
mpc_contract: mpc_account,
domain_config,
Expand Down
2 changes: 1 addition & 1 deletion crates/node/src/coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ where
}
KeyshareData::Ed25519(data) => {
eddsa_keyshares.insert(keyshare.key_id.domain_id, data);
domain_to_curve.insert(domain_id, Curve::Ed25519);
domain_to_curve.insert(domain_id, Curve::Edwards25519);
}
KeyshareData::Bls12381(data) => {
ckd_keyshares.insert(keyshare.key_id.domain_id, data);
Expand Down
4 changes: 2 additions & 2 deletions crates/node/src/key_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub async fn keygen_computation_inner(
)?);
(KeyshareData::V2Secp256k1(keyshare), public_key)
}
Curve::Ed25519 => {
Curve::Edwards25519 => {
let keyshare =
EddsaSignatureProvider::run_key_generation_client(threshold, channel).await?;
let public_key = dtos::PublicKey::Ed25519(dtos::Ed25519PublicKey::from(
Expand Down Expand Up @@ -257,7 +257,7 @@ async fn resharing_computation_inner(
}
(
near_mpc_contract_interface::types::PublicKey::Ed25519(inner_public_key),
Curve::Ed25519,
Curve::Edwards25519,
) => {
let public_key = frost_ed25519::VerifyingKey::deserialize(inner_public_key.as_ref())?;
let my_share = existing_keyshare
Expand Down
6 changes: 3 additions & 3 deletions crates/node/src/mpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ where

Ok(response)
}
Some(Curve::Ed25519) => {
Some(Curve::Edwards25519) => {
let (signature, _) = timeout(
Duration::from_secs(this.config.signature.timeout_sec),
this.eddsa_signature_provider
Expand Down Expand Up @@ -525,7 +525,7 @@ where
}
Some(Curve::Secp256k1)
| Some(Curve::V2Secp256k1)
| Some(Curve::Ed25519) => Err(anyhow::anyhow!(
| Some(Curve::Edwards25519) => Err(anyhow::anyhow!(
"Signature scheme is not allowed for domain: {:?}",
ckd_attempt.request.domain_id.clone()
)),
Expand Down Expand Up @@ -617,7 +617,7 @@ where
}
Some(Curve::Bls12381)
| Some(Curve::V2Secp256k1)
| Some(Curve::Ed25519) => Err(anyhow::anyhow!(
| Some(Curve::Edwards25519) => Err(anyhow::anyhow!(
"Signature scheme is not allowed for domain: {:?}",
verify_foreign_tx_attempt.request.domain_id.clone()
)),
Expand Down
2 changes: 1 addition & 1 deletion crates/node/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ pub async fn request_signature_and_await_response(
rand::thread_rng().fill_bytes(payload.as_mut());
Payload::Ecdsa(Bytes::new(payload.to_vec()).unwrap())
}
Curve::Ed25519 => {
Curve::Edwards25519 => {
let len = rand::thread_rng().gen_range(
EDDSA_PAYLOAD_SIZE_LOWER_BOUND_BYTES..EDDSA_PAYLOAD_SIZE_UPPER_BOUND_BYTES,
);
Expand Down
2 changes: 1 addition & 1 deletion crates/node/src/tests/basic_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async fn test_basic_cluster() {

let signature_domain_eddsa = DomainConfig {
id: DomainId(1),
curve: Curve::Ed25519,
curve: Curve::Edwards25519,
purpose: DomainPurpose::Sign,
};

Expand Down
10 changes: 5 additions & 5 deletions crates/node/src/tests/multidomain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async fn test_basic_multidomain() {
},
DomainConfig {
id: DomainId(1),
curve: Curve::Ed25519,
curve: Curve::Edwards25519,
purpose: DomainPurpose::Sign,
},
DomainConfig {
Expand Down Expand Up @@ -74,7 +74,7 @@ async fn test_basic_multidomain() {
tracing::info!("requesting signature");
for domain in &domains {
match domain.curve {
Curve::Secp256k1 | Curve::Ed25519 | Curve::V2Secp256k1 => {
Curve::Secp256k1 | Curve::Edwards25519 | Curve::V2Secp256k1 => {
assert!(request_signature_and_await_response(
&mut setup.indexer,
&format!("user{}", domain.id.0),
Expand All @@ -99,7 +99,7 @@ async fn test_basic_multidomain() {
let new_domains = vec![
DomainConfig {
id: DomainId(3),
curve: Curve::Ed25519,
curve: Curve::Edwards25519,
purpose: DomainPurpose::Sign,
},
DomainConfig {
Expand Down Expand Up @@ -139,7 +139,7 @@ async fn test_basic_multidomain() {

for domain in &domains {
match domain.curve {
Curve::Secp256k1 | Curve::Ed25519 | Curve::V2Secp256k1 => {
Curve::Secp256k1 | Curve::Edwards25519 | Curve::V2Secp256k1 => {
assert!(request_signature_and_await_response(
&mut setup.indexer,
&format!("user{}", domain.id.0),
Expand Down Expand Up @@ -186,7 +186,7 @@ async fn test_basic_multidomain() {

for domain in &domains {
match domain.curve {
Curve::Secp256k1 | Curve::Ed25519 | Curve::V2Secp256k1 => {
Curve::Secp256k1 | Curve::Edwards25519 | Curve::V2Secp256k1 => {
assert!(request_signature_and_await_response(
&mut setup.indexer,
&format!("user{}", domain.id.0),
Expand Down
Loading
Loading