Sfoglia il codice sorgente

explorer/explorerd/service/transactions: duck taping until refactor

skoupidi 1 anno fa
parent
commit
a6fb5f8852
1 ha cambiato i file con 13 aggiunte e 1 eliminazioni
  1. 13 1
      bin/explorer/explorerd/src/service/transactions.rs

+ 13 - 1
bin/explorer/explorerd/src/service/transactions.rs

@@ -300,7 +300,19 @@ impl ExplorerService {
                 idx as u8,
                 idx as u8,
             )?;
             )?;
 
 
-            let metadata = runtime.metadata(&payload)?;
+            // TODO: This is duck taping so explorer doesn't error out and hang.
+            // This whole process needs to be refactored, as explorer doesn't keep
+            // state, therefore this can fail. Apart from that, exec and apply
+            // contract functions are not counted in the gas consumption.
+            let Ok(metadata) = runtime.metadata(&payload) else {
+                return Ok(GasData {
+                    paid: 0,
+                    wasm: 0,
+                    zk_circuits: 0,
+                    signatures: 0,
+                    deployments: 0,
+                })
+            };
 
 
             // Decode the metadata retrieved from the execution
             // Decode the metadata retrieved from the execution
             let mut decoder = Cursor::new(&metadata);
             let mut decoder = Cursor::new(&metadata);