diff --git a/c/ckb_identity.h b/c/ckb_identity.h index dbdb1c1..aa46838 100644 --- a/c/ckb_identity.h +++ b/c/ckb_identity.h @@ -63,7 +63,7 @@ enum IdentityFlagsType { IdentityFlagsCkb = 0, // values 1~5 are used by pw-lock IdentityFlagsEthereum = 1, - IdentityFlagsEos = 2, + // EOS = 2, disabled IdentityFlagsTron = 3, IdentityFlagsBitcoin = 4, IdentityFlagsDogecoin = 5, @@ -351,29 +351,6 @@ int validate_signature_btc(void *prefilled_data, const uint8_t *sig, return 0; } -int validate_signature_eos(void *prefilled_data, const uint8_t *sig, - size_t sig_len, const uint8_t *msg, size_t msg_len, - uint8_t *output, size_t *output_len) { - int err = 0; - if (*output_len < AUTH160_SIZE) { - return ERROR_INVALID_ARG; - } - uint8_t out_pubkey[UNCOMPRESSED_SECP256K1_PUBKEY_SIZE]; - size_t out_pubkey_size = UNCOMPRESSED_SECP256K1_PUBKEY_SIZE; - err = _recover_secp256k1_pubkey_btc(sig, sig_len, msg, msg_len, out_pubkey, - &out_pubkey_size); - if (err) return err; - - blake2b_state ctx; - blake2b_init(&ctx, BLAKE2B_BLOCK_SIZE); - blake2b_update(&ctx, out_pubkey, out_pubkey_size); - blake2b_final(&ctx, out_pubkey, BLAKE2B_BLOCK_SIZE); - - memcpy(output, out_pubkey, AUTH160_SIZE); - *output_len = AUTH160_SIZE; - return err; -} - int generate_sighash_all(uint8_t *msg, size_t msg_len) { int ret; uint64_t len = 0; @@ -931,12 +908,6 @@ int ckb_verify_identity(CkbIdentityType *id, uint8_t *sig, uint32_t sig_size, } return verify_sighash_all(id->id, sig, sig_size, validate_signature_eth, convert_eth_message_displaying); - } else if (id->flags == IdentityFlagsEos) { - if (sig == NULL || sig_size != SECP256K1_SIGNATURE_SIZE) { - return ERROR_IDENTITY_WRONG_ARGS; - } - return verify_sighash_all(id->id, sig, sig_size, validate_signature_eos, - convert_copy); } else if (id->flags == IdentityFlagsTron) { if (sig == NULL || sig_size != SECP256K1_SIGNATURE_SIZE) { return ERROR_IDENTITY_WRONG_ARGS; diff --git a/tests/omni_lock_rust/build.rs b/tests/omni_lock_rust/build.rs index b0b2821..1dc2de7 100644 --- a/tests/omni_lock_rust/build.rs +++ b/tests/omni_lock_rust/build.rs @@ -12,12 +12,10 @@ const PATH_PREFIX: &str = "../../build/"; const BUF_SIZE: usize = 8 * 1024; const CKB_HASH_PERSONALIZATION: &[u8] = b"ckb-default-hash"; -const BINARIES: &[(&str, &str)] = &[ - ( - "omni_lock", - "768f306681da232ceb0b94f436c5f813377179762a831c5ad8797bd4fd2d118d", - ), -]; +const BINARIES: &[(&str, &str)] = &[( + "omni_lock", + "eb2ab5fd9a1dab4354a76ee2765e6a9ac2d94d927da39fb72b1691ea523e4613", +)]; fn main() { let mut bundled = includedir_codegen::start("BUNDLED_CELL"); diff --git a/tests/omni_lock_rust/tests/test_omni_lock.rs b/tests/omni_lock_rust/tests/test_omni_lock.rs index 69649d5..b5a457b 100644 --- a/tests/omni_lock_rust/tests/test_omni_lock.rs +++ b/tests/omni_lock_rust/tests/test_omni_lock.rs @@ -608,7 +608,7 @@ fn test_dogecoin_err_pubkey() { assert!(verify_result.is_err()) } -fn test_eos_success(vtype: u8) { +fn test_eos_fail(vtype: u8) { let mut data_loader = DummyDataLoader::new(); let mut config = TestConfig::new(IDENTITY_FLAGS_EOS, false); @@ -627,7 +627,8 @@ fn test_eos_success(vtype: u8) { verifier.set_debug_printer(debug_printer); let verify_result = verifier.verify(MAX_CYCLES); - verify_result.expect("pass verification"); + assert!(verify_result.is_err()); + assert_script_error(verify_result.unwrap_err(), CKB_INVALID_DATA); } fn test_eos_err_pubkey(vtype: u8) { @@ -651,11 +652,11 @@ fn test_eos_err_pubkey(vtype: u8) { verifier.set_debug_printer(debug_printer); let verify_result = verifier.verify(MAX_CYCLES); assert!(verify_result.is_err()); - assert_script_error(verify_result.unwrap_err(), ERROR_PUBKEY_BLAKE160_HASH); + assert_script_error(verify_result.unwrap_err(), CKB_INVALID_DATA); } fn test_eos(vtype: u8) { - test_eos_success(vtype); + test_eos_fail(vtype); test_eos_err_pubkey(vtype) }