@@ -47,7 +47,6 @@ const MINUTE: Duration = Duration::from_secs(60);
4747const SKIP_PTR_UPDATES_THRESHOLD : Duration = Duration :: from_secs ( 60 * 5 ) ;
4848const HANDLE_REVERT_SECTION_NAME : & str = "handle_revert" ;
4949const PROCESS_BLOCK_SECTION_NAME : & str = "process_block" ;
50- const PROCESS_WASM_BLOCK_SECTION_NAME : & str = "process_wasm_block" ;
5150const PROCESS_TRIGGERS_SECTION_NAME : & str = "process_triggers" ;
5251const HANDLE_CREATED_DS_SECTION_NAME : & str = "handle_new_data_sources" ;
5352
@@ -869,37 +868,6 @@ where
869868 Ok ( Arc :: new ( block) )
870869 }
871870
872- async fn process_wasm_block (
873- & mut self ,
874- proof_of_indexing : & SharedProofOfIndexing ,
875- block_ptr : BlockPtr ,
876- block_time : BlockTime ,
877- block_data : Box < [ u8 ] > ,
878- handler : String ,
879- causality_region : & str ,
880- ) -> Result < BlockState , MappingError > {
881- let block_state = BlockState :: new (
882- self . inputs . store . clone ( ) ,
883- std:: mem:: take ( & mut self . state . entity_lfu_cache ) ,
884- ) ;
885-
886- self . ctx
887- . process_block (
888- & self . logger ,
889- block_ptr,
890- block_time,
891- block_data,
892- handler,
893- block_state,
894- proof_of_indexing,
895- causality_region,
896- & self . inputs . debug_fork ,
897- & self . metrics . subgraph ,
898- self . inputs . instrument ,
899- )
900- . await
901- }
902-
903871 fn create_dynamic_data_sources (
904872 & mut self ,
905873 created_data_sources : Vec < InstanceDSTemplateInfo > ,
@@ -1171,20 +1139,6 @@ where
11711139 ) -> Result < Action , Error > {
11721140 let stopwatch = & self . metrics . stream . stopwatch ;
11731141 let action = match event {
1174- Some ( Ok ( BlockStreamEvent :: ProcessWasmBlock (
1175- block_ptr,
1176- block_time,
1177- data,
1178- handler,
1179- cursor,
1180- ) ) ) => {
1181- let _section = stopwatch. start_section ( PROCESS_WASM_BLOCK_SECTION_NAME ) ;
1182- let res = self
1183- . handle_process_wasm_block ( block_ptr. clone ( ) , block_time, data, handler, cursor)
1184- . await ;
1185- let start = Instant :: now ( ) ;
1186- self . handle_action ( start, block_ptr, res) . await ?
1187- }
11881142 Some ( Ok ( BlockStreamEvent :: ProcessBlock ( block, cursor) ) ) => {
11891143 let _section = stopwatch. start_section ( PROCESS_BLOCK_SECTION_NAME ) ;
11901144 self . handle_process_block ( block, cursor) . await ?
@@ -1335,82 +1289,6 @@ where
13351289 C : Blockchain ,
13361290 T : RuntimeHostBuilder < C > ,
13371291{
1338- async fn handle_process_wasm_block (
1339- & mut self ,
1340- block_ptr : BlockPtr ,
1341- block_time : BlockTime ,
1342- block_data : Box < [ u8 ] > ,
1343- handler : String ,
1344- cursor : FirehoseCursor ,
1345- ) -> Result < Action , ProcessingError > {
1346- let logger = self . logger . new ( o ! (
1347- "block_number" => format!( "{:?}" , block_ptr. number) ,
1348- "block_hash" => format!( "{}" , block_ptr. hash)
1349- ) ) ;
1350-
1351- debug ! ( logger, "Start processing wasm block" ; ) ;
1352-
1353- self . metrics
1354- . stream
1355- . deployment_head
1356- . set ( block_ptr. number as f64 ) ;
1357-
1358- let proof_of_indexing =
1359- SharedProofOfIndexing :: new ( block_ptr. number , self . inputs . poi_version ) ;
1360-
1361- // Causality region for onchain triggers.
1362- let causality_region = PoICausalityRegion :: from_network ( & self . inputs . network ) ;
1363-
1364- let block_state = {
1365- match self
1366- . process_wasm_block (
1367- & proof_of_indexing,
1368- block_ptr. clone ( ) ,
1369- block_time,
1370- block_data,
1371- handler,
1372- & causality_region,
1373- )
1374- . await
1375- {
1376- // Triggers processed with no errors or with only deterministic errors.
1377- Ok ( block_state) => block_state,
1378-
1379- // Some form of unknown or non-deterministic error ocurred.
1380- Err ( MappingError :: Unknown ( e) ) => return Err ( ProcessingError :: Unknown ( e) . into ( ) ) ,
1381- Err ( MappingError :: PossibleReorg ( e) ) => {
1382- info ! ( logger,
1383- "Possible reorg detected, retrying" ;
1384- "error" => format!( "{:#}" , e) ,
1385- ) ;
1386-
1387- // In case of a possible reorg, we want this function to do nothing and restart the
1388- // block stream so it has a chance to detect the reorg.
1389- //
1390- // The state is unchanged at this point, except for having cleared the entity cache.
1391- // Losing the cache is a bit annoying but not an issue for correctness.
1392- //
1393- // See also b21fa73b-6453-4340-99fb-1a78ec62efb1.
1394- return Ok ( Action :: Restart ) ;
1395- }
1396- }
1397- } ;
1398-
1399- self . transact_block_state (
1400- & logger,
1401- block_ptr. clone ( ) ,
1402- cursor. clone ( ) ,
1403- block_time,
1404- block_state,
1405- proof_of_indexing,
1406- vec ! [ ] ,
1407- vec ! [ ] ,
1408- )
1409- . await ?;
1410-
1411- Ok ( Action :: Continue )
1412- }
1413-
14141292 async fn handle_process_block (
14151293 & mut self ,
14161294 block : BlockWithTriggers < C > ,
0 commit comments