Przeglądaj źródła

runtime: Change log target to wasm_runtime.

Luther Blissett 3 lat temu
rodzic
commit
ecbe5c35c8
3 zmienionych plików z 14 dodań i 14 usunięć
  1. 2 2
      src/runtime/chain_state.rs
  2. 2 2
      src/runtime/util.rs
  3. 10 10
      src/runtime/vm_runtime.rs

+ 2 - 2
src/runtime/chain_state.rs

@@ -10,7 +10,7 @@ use crate::{
 /// an existing nullifier in the blockchain state machine.
 pub fn nullifier_exists(env: &Env, ptr: u32, len: u32) -> i32 {
     if let Some(bytes) = env.memory.get_ref().unwrap().read(ptr, len as usize) {
-        debug!(target: "wasm-runtime", "[wasm::nullifier_exists] Read bytes: {:?}", bytes);
+        debug!(target: "wasm_runtime::nullifier_exists", "Read bytes: {:?}", bytes);
 
         let nullifier = match Nullifier::from_bytes(bytes.try_into().unwrap()) {
             Some(nf) => {
@@ -37,7 +37,7 @@ pub fn nullifier_exists(env: &Env, ptr: u32, len: u32) -> i32 {
 /// a valid Merkle root in the chain's Merkle tree.
 pub fn is_valid_merkle(env: &Env, ptr: u32, len: u32) -> i32 {
     if let Some(bytes) = env.memory.get_ref().unwrap().read(ptr, len as usize) {
-        debug!(target: "wasm_runtime::nullifier_exists", "Read bytes: {:?}", bytes);
+        debug!(target: "wasm_runtime::is_valid_merkle", "Read bytes: {:?}", bytes);
 
         let merkle_node = match MerkleNode::from_bytes(bytes.try_into().unwrap()) {
             Some(mn) => {

+ 2 - 2
src/runtime/util.rs

@@ -23,7 +23,7 @@ pub(crate) fn drk_log(env: &Env, ptr: u32, len: u32) {
         let msg = match String::from_utf8(bytes.to_vec()) {
             Ok(v) => v,
             Err(e) => {
-                warn!(target: "wasm-runtime", "Invalid UTF-8 string: {:?}", e);
+                warn!(target: "wasm_runtime", "Invalid UTF-8 string: {:?}", e);
                 return
             }
         };
@@ -34,5 +34,5 @@ pub(crate) fn drk_log(env: &Env, ptr: u32, len: u32) {
         return
     }
 
-    error!(target: "wasm-runtime", "Failed to read any bytes from VM memory");
+    error!(target: "wasm_runtime", "Failed to read any bytes from VM memory");
 }

+ 10 - 10
src/runtime/vm_runtime.rs

@@ -95,10 +95,10 @@ impl Runtime {
         compiler.push_middleware(metering);
         let store = Store::new(&Universal::new(compiler).engine());
 
-        debug!(target: "wasm-runtime", "Compiling module...");
+        debug!(target: "wasm_runtime", "Compiling module...");
         let module = Module::new(&store, wasm_bytes)?;
 
-        debug!(target: "wasm-runtime", "Importing functions...");
+        debug!(target: "wasm_runtime", "Importing functions...");
         let logs = Arc::new(Mutex::new(vec![]));
         let memory = LazyInit::new();
         let state_machine = Arc::new(state_machine);
@@ -127,7 +127,7 @@ impl Runtime {
             }
         };
 
-        debug!(target: "wasm-runtime", "Instantiating module...");
+        debug!(target: "wasm_runtime", "Instantiating module...");
         let instance = Instance::new(&module, &import_object)?;
 
         Ok(Self { instance, env })
@@ -142,25 +142,25 @@ impl Runtime {
         let mem_offset = self.guest_mem_alloc(payload.len())?;
         memory.write(mem_offset, payload)?;
 
-        debug!(target: "wasm-runtime", "Getting entrypoint function...");
+        debug!(target: "wasm_runtime", "Getting entrypoint function...");
         let entrypoint = self.instance.exports.get_function(ENTRYPOINT)?;
 
-        debug!(target: "wasm-runtime", "Executing wasm...");
+        debug!(target: "wasm_runtime", "Executing wasm...");
         let ret = match entrypoint.call(&[Value::I32(mem_offset as i32)]) {
             Ok(v) => {
                 self.print_logs();
-                debug!(target: "wasm-runtime", "{}", self.gas_info());
+                debug!(target: "wasm_runtime", "{}", self.gas_info());
                 v
             }
             Err(e) => {
                 self.print_logs();
-                debug!(target: "wasm-runtime", "{}", self.gas_info());
+                debug!(target: "wasm_runtime", "{}", self.gas_info());
                 return Err(e.into())
             }
         };
 
-        debug!(target: "wasm-runtime", "wasm executed successfully");
-        debug!(target: "wasm-runtime", "Contract returned: {:?}", ret[0]);
+        debug!(target: "wasm_runtime", "wasm executed successfully");
+        debug!(target: "wasm_runtime", "Contract returned: {:?}", ret[0]);
 
         let retval = match ret[0] {
             Value::I64(v) => v as u64,
@@ -177,7 +177,7 @@ impl Runtime {
     fn print_logs(&self) {
         let logs = self.env.logs.lock().unwrap();
         for msg in logs.iter() {
-            debug!(target: "wasm-runtime", "Contract log: {}", msg);
+            debug!(target: "wasm_runtime", "Contract log: {}", msg);
         }
     }