Skip to content

Commit

Permalink
Replace DynamicLinking to DynamicLibrary in ckb-auth-rs
Browse files Browse the repository at this point in the history
  • Loading branch information
joii2020 committed Dec 13, 2023
1 parent f7391c1 commit d5aa298
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ckb-auth-rs/src/ckb_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn ckb_auth(
match entry.entry_category {
EntryCategoryType::Exec => ckb_auth_exec(entry, id, signature, message),
#[cfg(feature = "enable-dynamic-library")]
EntryCategoryType::DynamicLinking => ckb_auth_dl(entry, id, signature, message),
EntryCategoryType::DynamicLibrary => ckb_auth_dl(entry, id, signature, message),
#[cfg(feature = "ckb2023")]
EntryCategoryType::Spawn => ckb_auth_spawn(entry, id, signature, message),
}
Expand Down
4 changes: 2 additions & 2 deletions ckb-auth-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl From<NulError> for CkbAuthError {
pub enum EntryCategoryType {
Exec = 0,
#[cfg(feature = "enable-dynamic-library")]
DynamicLinking = 1,
DynamicLibrary = 1,
#[cfg(feature = "ckb2023")]
Spawn = 2,
}
Expand All @@ -110,7 +110,7 @@ impl TryFrom<u8> for EntryCategoryType {
match value {
0 => Ok(Self::Exec),
#[cfg(feature = "enable-dynamic-library")]
1 => Ok(Self::DynamicLinking),
1 => Ok(Self::DynamicLibrary),
#[cfg(feature = "ckb2023")]
2 => Ok(Self::Spawn),
_ => Err(CkbAuthError::EncodeArgs),
Expand Down
22 changes: 11 additions & 11 deletions tests/auth-c-tests/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ fn unit_test_common_with_runtype(

fn unit_test_common_all_runtype(auth: &Box<dyn Auth>) {
unit_test_common_with_auth(auth, EntryCategoryType::Exec);
unit_test_common_with_auth(auth, EntryCategoryType::DynamicLinking);
unit_test_common_with_auth(auth, EntryCategoryType::DynamicLibrary);
unit_test_common_with_auth(auth, EntryCategoryType::Spawn);
}

fn unit_test_common(algorithm_type: AuthAlgorithmIdType) {
for t in [
EntryCategoryType::Exec,
EntryCategoryType::DynamicLinking,
EntryCategoryType::DynamicLibrary,
EntryCategoryType::Spawn,
] {
unit_test_common_with_runtype(algorithm_type.clone(), t, false);
Expand All @@ -193,7 +193,7 @@ fn unit_test_common(algorithm_type: AuthAlgorithmIdType) {
fn unit_test_common_official(algorithm_type: AuthAlgorithmIdType) {
for t in [
EntryCategoryType::Exec,
EntryCategoryType::DynamicLinking,
EntryCategoryType::DynamicLibrary,
EntryCategoryType::Spawn,
] {
unit_test_common_with_runtype(algorithm_type.clone(), t, true);
Expand Down Expand Up @@ -284,7 +284,7 @@ fn bitcoin_pubkey_recid_verify() {
0: BitcoinAuth::default(),
});

let config = TestConfig::new(&auth, EntryCategoryType::DynamicLinking, 1);
let config = TestConfig::new(&auth, EntryCategoryType::DynamicLibrary, 1);
assert_result_error(
verify_unit(&config),
"failed conver btc",
Expand Down Expand Up @@ -375,7 +375,7 @@ fn convert_eth_error() {
},
});

let config = TestConfig::new(&auth, EntryCategoryType::DynamicLinking, 1);
let config = TestConfig::new(&auth, EntryCategoryType::DynamicLibrary, 1);
assert_result_error(
verify_unit(&config),
"failed conver eth",
Expand Down Expand Up @@ -413,7 +413,7 @@ fn convert_tron_error() {
let auth: Box<dyn Auth> = Box::new(TronConverFaileAuth {
0: TronAuth { privkey, pubkey },
});
let config = TestConfig::new(&auth, EntryCategoryType::DynamicLinking, 1);
let config = TestConfig::new(&auth, EntryCategoryType::DynamicLibrary, 1);
assert_result_error(
verify_unit(&config),
"failed conver tron",
Expand Down Expand Up @@ -455,7 +455,7 @@ fn convert_btc_error() {
0: BitcoinAuth::default(),
});

let config = TestConfig::new(&auth, EntryCategoryType::DynamicLinking, 1);
let config = TestConfig::new(&auth, EntryCategoryType::DynamicLibrary, 1);
assert_result_error(
verify_unit(&config),
"failed conver btc",
Expand Down Expand Up @@ -502,7 +502,7 @@ fn convert_doge_error() {
},
});

let config = TestConfig::new(&auth, EntryCategoryType::DynamicLinking, 1);
let config = TestConfig::new(&auth, EntryCategoryType::DynamicLibrary, 1);
assert_result_error(
verify_unit(&config),
"failed conver doge",
Expand Down Expand Up @@ -550,7 +550,7 @@ fn convert_lite_error() {
},
});

let config = TestConfig::new(&auth, EntryCategoryType::DynamicLinking, 1);
let config = TestConfig::new(&auth, EntryCategoryType::DynamicLibrary, 1);
assert_result_error(
verify_unit(&config),
"failed conver lite",
Expand Down Expand Up @@ -671,7 +671,7 @@ fn unit_test_ckbmultisig(auth: &Box<dyn Auth>, run_type: EntryCategoryType) {
fn ckbmultisig_verify() {
let auth: Box<dyn Auth> = CkbMultisigAuth::new(2, 2, 1);
unit_test_ckbmultisig(&auth, EntryCategoryType::Exec);
unit_test_ckbmultisig(&auth, EntryCategoryType::DynamicLinking);
unit_test_ckbmultisig(&auth, EntryCategoryType::DynamicLibrary);
unit_test_ckbmultisig(&auth, EntryCategoryType::Spawn);
}

Expand Down Expand Up @@ -709,7 +709,7 @@ fn abnormal_algorithm_type() {
);
}
{
let config = TestConfig::new(&auth, EntryCategoryType::DynamicLinking, 1);
let config = TestConfig::new(&auth, EntryCategoryType::DynamicLibrary, 1);
assert_result_error(
verify_unit(&config),
"sign size(smaller)",
Expand Down
2 changes: 1 addition & 1 deletion tests/auth-rust-lock/tests/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ fn test_dll() {
let tx = gen_tx(
&mut ctx,
vec![(
auth.get_auth_args(&EntryCategoryType::DynamicLinking),
auth.get_auth_args(&EntryCategoryType::DynamicLibrary),
CKB_SIGN_GROUP_SIZE,
)],
);
Expand Down

0 comments on commit d5aa298

Please sign in to comment.