فهرست منبع

runtime: Add wasm bincode to WasmStore after successful deploy execution.

parazyd 3 سال پیش
والد
کامیت
84caaf2c3a
1فایلهای تغییر یافته به همراه6 افزوده شده و 0 حذف شده
  1. 6 0
      src/runtime/vm_runtime.rs

+ 6 - 0
src/runtime/vm_runtime.rs

@@ -79,6 +79,8 @@ pub struct Env {
     pub db_batches: RefCell<Vec<sled::Batch>>,
     /// The contract ID being executed
     pub contract_id: ContractId,
+    /// The compiled wasm bincode being executed,
+    pub contract_bincode: Vec<u8>,
     /// The contract section being executed
     pub contract_section: ContractSection,
     /// State update produced by a smart contract function call
@@ -159,6 +161,7 @@ impl Runtime {
                 db_handles,
                 db_batches,
                 contract_id,
+                contract_bincode: wasm_bytes.to_vec(),
                 contract_section: ContractSection::Null,
                 contract_return_data: Cell::new(None),
                 logs,
@@ -329,6 +332,9 @@ impl Runtime {
             db.flush()?;
         }
 
+        // Update the wasm bincode in the WasmStore
+        env_mut.blockchain.wasm_bincode.insert(env_mut.contract_id, &env_mut.contract_bincode)?;
+
         Ok(())
     }