Skip to content

Commit

Permalink
Remove ckb-auth-rs log dependencies
Browse files Browse the repository at this point in the history
Fixed a bug by this commit (ckb-auth-rs build on c-tests)
  • Loading branch information
joii2020 committed Nov 23, 2023
1 parent 5d891a4 commit 9de11f0
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 21 deletions.
1 change: 0 additions & 1 deletion ckb-auth-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ ckb2023 = ["ckb-std/ckb2023"]
ckb-std = "0.14.3"

[target.'cfg(target_arch = "riscv64")'.dependencies]
log = { version = "0.4.17", default-features = false}
hex = { version = "0.4.3", default-features = false, features = ["alloc"]}
blake2b-rs = "0.2.0"
7 changes: 1 addition & 6 deletions ckb-auth-rs/src/ckb_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use ckb_std::{
use ckb_std::high_level::spawn_cell;
use core::mem::size_of_val;
use hex::encode;
use log::info;

pub fn ckb_auth(
entry: &CkbEntryType,
Expand Down Expand Up @@ -108,7 +107,6 @@ impl CKBDLLoader {
};

if !has_lib {
info!("loading library");
let size = size_of_val(&self.context);
let lib = self
.context
Expand Down Expand Up @@ -163,9 +161,6 @@ fn ckb_auth_dl(

match rc_code {
0 => Ok(()),
_ => {
info!("run auth error({}) in dynamic linking", rc_code);
Err(CkbAuthError::RunDLError)
}
_ => Err(CkbAuthError::RunDLError),
}
}
8 changes: 3 additions & 5 deletions ckb-auth-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ pub use crate::generate_sighash_all::generate_sighash_all;
#[cfg(target_arch = "riscv64")]
use alloc::ffi::NulError;
#[cfg(target_arch = "riscv64")]
use log::info;

#[cfg(target_arch = "riscv64")]
use ckb_std::{ckb_types::core::ScriptHashType, error::SysError};
#[cfg(not(target_arch = "riscv64"))]
type SysError = u64;
#[cfg(not(target_arch = "riscv64"))]
type ScriptHashType = u8;

#[derive(Clone)]
pub enum AuthAlgorithmIdType {
Expand Down Expand Up @@ -81,15 +81,13 @@ pub enum CkbAuthError {
#[cfg(target_arch = "riscv64")]
impl From<SysError> for CkbAuthError {
fn from(err: SysError) -> Self {
info!("Exec error: {:?}", err);
Self::ExecError(err)
}
}

#[cfg(target_arch = "riscv64")]
impl From<NulError> for CkbAuthError {
fn from(err: NulError) -> Self {
info!("Exec encode args failed: {:?}", err);
fn from(_err: NulError) -> Self {
Self::EncodeArgs
}
}
Expand Down
1 change: 0 additions & 1 deletion examples/auth-rust-demo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions examples/auth-rust-demo/contracts/auth-rust-demo/src/entry.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate alloc;
use log::info;
// Import from `core` instead of from `std` since we are in no-std mode
use core::result::Result;

Expand All @@ -25,7 +23,6 @@ use ckb_std::{
// use ckb_std::debug;

pub fn main() -> Result<(), Error> {
info!("auth-script-test entry");
let mut pubkey_hash = [0u8; 20];
let auth_id: u8;
let entry_type: u8;
Expand All @@ -35,8 +32,6 @@ pub fn main() -> Result<(), Error> {
// get message
let message = generate_sighash_all().map_err(|_| Error::GeneratedMsgError)?;
let signature = {
info!("run as standalone script");

let script = load_script()?;
let args: Bytes = script.args().unpack();
if args.len() != 55 {
Expand Down
2 changes: 1 addition & 1 deletion tests/auth-c-tests/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/auth-spawn-tests/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/ckb-auth-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9de11f0

Please sign in to comment.