Explorar el Código

deployooor: fix instruction deserialization

zero hace 2 años
padre
commit
e0932c5c50
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      src/contract/deployooor/src/entrypoint.rs

+ 4 - 2
src/contract/deployooor/src/entrypoint.rs

@@ -68,7 +68,8 @@ fn init_contract(cid: ContractId, _ix: &[u8]) -> ContractResult {
 /// for verifying signatures and zk proofs. The payload given here are all the
 /// for verifying signatures and zk proofs. The payload given here are all the
 /// contract calls in the transaction.
 /// contract calls in the transaction.
 fn get_metadata(cid: ContractId, ix: &[u8]) -> ContractResult {
 fn get_metadata(cid: ContractId, ix: &[u8]) -> ContractResult {
-    let (call_idx, calls): (u32, Vec<DarkLeaf<ContractCall>>) = deserialize(ix)?;
+    let call_idx = wasm::util::get_call_index();
+    let calls: Vec<DarkLeaf<ContractCall>> = deserialize(ix)?;
     let self_ = &calls[call_idx as usize].data;
     let self_ = &calls[call_idx as usize].data;
     let func = DeployFunction::try_from(self_.data[0])?;
     let func = DeployFunction::try_from(self_.data[0])?;
 
 
@@ -83,7 +84,8 @@ fn get_metadata(cid: ContractId, ix: &[u8]) -> ContractResult {
 /// This function verifies a state transition and produces a state update
 /// This function verifies a state transition and produces a state update
 /// if everything is successful.
 /// if everything is successful.
 fn process_instruction(cid: ContractId, ix: &[u8]) -> ContractResult {
 fn process_instruction(cid: ContractId, ix: &[u8]) -> ContractResult {
-    let (call_idx, calls): (u32, Vec<DarkLeaf<ContractCall>>) = deserialize(ix)?;
+    let call_idx = wasm::util::get_call_index();
+    let calls: Vec<DarkLeaf<ContractCall>> = deserialize(ix)?;
     let self_ = &calls[call_idx as usize].data;
     let self_ = &calls[call_idx as usize].data;
     let func = DeployFunction::try_from(self_.data[0])?;
     let func = DeployFunction::try_from(self_.data[0])?;