Skip to content

Commit

Permalink
chore: Update deprecated items to use the correct version number
Browse files Browse the repository at this point in the history
  • Loading branch information
zwong91 committed May 27, 2024
1 parent 0e335ad commit b74cc5f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion unc-contract-standards/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub mod storage_management;
/// This upgrade standard is a use case where a staging area exists for a WASM
/// blob, allowing it to be stored for a period of time before deployed.
#[deprecated(
since = "4.1.0",
since = "1.1.0",
note = "This was removed because there is no standard (UIP) for upgradable contracts."
)]
pub mod upgrade;
Expand Down
2 changes: 1 addition & 1 deletion unc-sdk/src/collections/legacy_tree_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::IntoStorageKey;
/// - `above`/`below`: O(log(N))
/// - `range` of K elements: O(Klog(N))
///
#[deprecated(since = "4.1.0", note = "Use unc_sdk::collections::TreeMap")]
#[deprecated(since = "1.1.0", note = "Use unc_sdk::collections::TreeMap")]
#[derive(BorshSerialize, BorshDeserialize)]
pub struct LegacyTreeMap<K, V> {
root: u64,
Expand Down
14 changes: 14 additions & 0 deletions unc-sdk/src/types/public_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ use std::{convert::TryFrom, io};
pub enum CurveType {
ED25519 = 0,
SECP256K1 = 1,
RSA2048 = 2,
}

impl CurveType {
fn from_u8(val: u8) -> Result<Self, ParsePublicKeyError> {
match val {
0 => Ok(CurveType::ED25519),
1 => Ok(CurveType::SECP256K1),
2 => Ok(CurveType::RSA2048),
_ => Err(ParsePublicKeyError { kind: ParsePublicKeyErrorKind::UnknownCurve }),
}
}
Expand All @@ -25,6 +27,7 @@ impl CurveType {
match self {
CurveType::ED25519 => 32,
CurveType::SECP256K1 => 64,
CurveType::RSA2048 => 294,
}
}
}
Expand All @@ -37,6 +40,8 @@ impl std::str::FromStr for CurveType {
Ok(CurveType::ED25519)
} else if value.eq_ignore_ascii_case("secp256k1") {
Ok(CurveType::SECP256K1)
} else if value.eq_ignore_ascii_case("rsa2048") {
Ok(CurveType::RSA2048)
} else {
Err(ParsePublicKeyError { kind: ParsePublicKeyErrorKind::UnknownCurve })
}
Expand Down Expand Up @@ -73,6 +78,12 @@ impl TryFrom<PublicKey> for unc_crypto::PublicKey {
);
Ok(public_key)
}
CurveType::RSA2048 => {
let public_key = unc_crypto::PublicKey::RSA(Box::new(
unc_crypto::Rsa2048PublicKey::try_from(data).unwrap(),
));
Ok(public_key)
}
}
}
}
Expand Down Expand Up @@ -218,6 +229,9 @@ impl From<&PublicKey> for String {
CurveType::SECP256K1 => {
["secp256k1:", &bs58::encode(&str_public_key.data[1..]).into_string()].concat()
}
CurveType::RSA2048 => {
["rsa2048:", &bs58::encode(&str_public_key.data[1..]).into_string()].concat()
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions unc-sdk/src/types/vm_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ pub use unc_vm_runner::logic::types::{PromiseResult as VmPromiseResult, ReturnDa
pub struct PromiseIndex(pub(crate) u64);

/// An index of Receipt to append an action
#[deprecated(since = "4.1.0", note = "type not used within SDK, use u64 directly or another alias")]
#[deprecated(since = "1.1.0", note = "type not used within SDK, use u64 directly or another alias")]
pub type ReceiptIndex = u64;
#[deprecated(since = "4.1.0", note = "type not used within SDK, use u64 directly or another alias")]
#[deprecated(since = "1.1.0", note = "type not used within SDK, use u64 directly or another alias")]
pub type IteratorIndex = u64;

/// When there is a callback attached to one or more contract calls the execution results of these
Expand Down

0 comments on commit b74cc5f

Please sign in to comment.