diff --git a/Cargo.lock b/Cargo.lock index 4918dac8a1c..553ef9c71bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1694,7 +1694,6 @@ dependencies = [ "diesel", "graph", "graph-runtime-derive", - "graph-runtime-test", "prost", "prost-types", "serde", diff --git a/chain/near/Cargo.toml b/chain/near/Cargo.toml index d131d8809e3..3fc29d750ea 100644 --- a/chain/near/Cargo.toml +++ b/chain/near/Cargo.toml @@ -15,7 +15,6 @@ serde = "1.0" anyhow = "1" graph-runtime-derive = { path = "../../runtime/derive" } -graph-runtime-test.path = "../../runtime/test" [dev-dependencies] diesel = { version = "1.4.7", features = ["postgres", "serde_json", "numeric", "r2d2"] } diff --git a/chain/near/src/trigger.rs b/chain/near/src/trigger.rs index f73dbae95c0..02033b6787a 100644 --- a/chain/near/src/trigger.rs +++ b/chain/near/src/trigger.rs @@ -159,391 +159,389 @@ pub struct ReceiptWithOutcome { pub block: Arc, } -#[cfg(test)] -mod tests { - use std::convert::TryFrom; - - use super::*; - - use graph::tokio; - use graph::{ - anyhow::anyhow, - components::metrics::gas::GasMetrics, - prelude::{hex, BigInt}, - runtime::{gas::GasCounter, DeterministicHostError, HostExportError}, - util::mem::init_slice, - wasmtime::StoreContext, - }; - use graph_runtime_test::test_module_latest; - - #[tokio::test] - async fn block_trigger_to_asc_ptr() { - let mut instance = test_module_latest("b", "boolean.wasm").await; - let trigger = NearTrigger::Block(Arc::new(block())); - let wasm_ctx = instance.store.data().clone(); - - let result: anyhow::Result<()> = Ok(()); - let result = trigger.to_asc_ptr( - &mut instance.store.as_context_mut(), - &mut wasm_ctx.as_mut().asc_heap_mut(), - &GasCounter::new(GasMetrics::mock()), - ); - assert!(result.is_ok()); - } - - #[tokio::test] - async fn receipt_trigger_to_asc_ptr() { - let mut instance = test_module_latest("b2", "boolean.wasm").await; - let wasm_ctx = instance.store.data().clone(); - let trigger = NearTrigger::Receipt(Arc::new(ReceiptWithOutcome { - block: Arc::new(block()), - outcome: execution_outcome_with_id().unwrap(), - receipt: receipt().unwrap(), - })); - - let result = trigger.to_asc_ptr( - &mut instance.store.as_context_mut(), - &mut wasm_ctx.as_mut().asc_heap_mut(), - &GasCounter::new(GasMetrics::mock()), - ); - let result: anyhow::Result<()> = Ok(()); - assert!(result.is_ok()); - } - - fn block() -> codec::Block { - codec::Block { - author: "test".to_string(), - header: Some(codec::BlockHeader { - height: 2, - prev_height: 1, - epoch_id: hash("01"), - next_epoch_id: hash("02"), - hash: hash("01"), - prev_hash: hash("00"), - prev_state_root: hash("bb00010203"), - chunk_receipts_root: hash("bb00010203"), - chunk_headers_root: hash("bb00010203"), - chunk_tx_root: hash("bb00010203"), - outcome_root: hash("cc00010203"), - chunks_included: 1, - challenges_root: hash("aa"), - timestamp: 100, - timestamp_nanosec: 0, - random_value: hash("010203"), - validator_proposals: vec![], - chunk_mask: vec![], - gas_price: big_int(10), - block_ordinal: 0, - total_supply: big_int(1_000), - challenges_result: vec![], - last_final_block: hash("00"), - last_final_block_height: 0, - last_ds_final_block: hash("00"), - last_ds_final_block_height: 0, - next_bp_hash: hash("bb"), - block_merkle_root: hash("aa"), - epoch_sync_data_hash: vec![0x00, 0x01], - approvals: vec![], - signature: signature("00"), - latest_protocol_version: 0, - }), - chunk_headers: vec![chunk_header().unwrap()], - shards: vec![codec::IndexerShard { - shard_id: 0, - chunk: Some(codec::IndexerChunk { - author: "near".to_string(), - header: chunk_header(), - transactions: vec![codec::IndexerTransactionWithOutcome { - transaction: Some(codec::SignedTransaction { - signer_id: "signer".to_string(), - public_key: public_key("aabb"), - nonce: 1, - receiver_id: "receiver".to_string(), - actions: vec![], - signature: signature("ff"), - hash: hash("bb"), - }), - outcome: Some(codec::IndexerExecutionOutcomeWithOptionalReceipt { - execution_outcome: execution_outcome_with_id(), - receipt: receipt(), - }), - }], - receipts: vec![receipt().unwrap()], - }), - receipt_execution_outcomes: vec![codec::IndexerExecutionOutcomeWithReceipt { - execution_outcome: execution_outcome_with_id(), - receipt: receipt(), - }], - }], - state_changes: vec![], - } - } - - fn receipt() -> Option { - Some(codec::Receipt { - predecessor_id: "genesis.near".to_string(), - receiver_id: "near".to_string(), - receipt_id: hash("dead"), - receipt: Some(codec::receipt::Receipt::Action(codec::ReceiptAction { - signer_id: "near".to_string(), - signer_public_key: public_key("aa"), - gas_price: big_int(2), - output_data_receivers: vec![], - input_data_ids: vec![], - actions: vec![ - codec::Action { - action: Some(codec::action::Action::CreateAccount( - codec::CreateAccountAction {}, - )), - }, - codec::Action { - action: Some(codec::action::Action::DeployContract( - codec::DeployContractAction { - code: vec![0x01, 0x02], - }, - )), - }, - codec::Action { - action: Some(codec::action::Action::FunctionCall( - codec::FunctionCallAction { - method_name: "func".to_string(), - args: vec![0x01, 0x02], - gas: 1000, - deposit: big_int(100), - }, - )), - }, - codec::Action { - action: Some(codec::action::Action::Transfer(codec::TransferAction { - deposit: big_int(100), - })), - }, - codec::Action { - action: Some(codec::action::Action::Stake(codec::StakeAction { - stake: big_int(100), - public_key: public_key("aa"), - })), - }, - codec::Action { - action: Some(codec::action::Action::AddKey(codec::AddKeyAction { - public_key: public_key("aa"), - access_key: Some(codec::AccessKey { - nonce: 1, - permission: Some(codec::AccessKeyPermission { - permission: Some( - codec::access_key_permission::Permission::FunctionCall( - codec::FunctionCallPermission { - // allowance can be None, so let's test this out here - allowance: None, - receiver_id: "receiver".to_string(), - method_names: vec!["sayGm".to_string()], - }, - ), - ), - }), - }), - })), - }, - codec::Action { - action: Some(codec::action::Action::AddKey(codec::AddKeyAction { - public_key: public_key("aa"), - access_key: Some(codec::AccessKey { - nonce: 1, - permission: Some(codec::AccessKeyPermission { - permission: Some( - codec::access_key_permission::Permission::FullAccess( - codec::FullAccessPermission {}, - ), - ), - }), - }), - })), - }, - codec::Action { - action: Some(codec::action::Action::DeleteKey(codec::DeleteKeyAction { - public_key: public_key("aa"), - })), - }, - codec::Action { - action: Some(codec::action::Action::DeleteAccount( - codec::DeleteAccountAction { - beneficiary_id: "suicided.near".to_string(), - }, - )), - }, - ], - })), - }) - } - - fn chunk_header() -> Option { - Some(codec::ChunkHeader { - chunk_hash: vec![0x00], - prev_block_hash: vec![0x01], - outcome_root: vec![0x02], - prev_state_root: vec![0x03], - encoded_merkle_root: vec![0x04], - encoded_length: 1, - height_created: 2, - height_included: 3, - shard_id: 4, - gas_used: 5, - gas_limit: 6, - validator_reward: big_int(7), - balance_burnt: big_int(7), - outgoing_receipts_root: vec![0x07], - tx_root: vec![0x08], - validator_proposals: vec![codec::ValidatorStake { - account_id: "account".to_string(), - public_key: public_key("aa"), - stake: big_int(10), - }], - signature: signature("ff"), - }) - } - - fn execution_outcome_with_id() -> Option { - Some(codec::ExecutionOutcomeWithId { - proof: Some(codec::MerklePath { path: vec![] }), - block_hash: hash("aa"), - id: hash("beef"), - outcome: execution_outcome(), - }) - } - - fn execution_outcome() -> Option { - Some(codec::ExecutionOutcome { - logs: vec!["string".to_string()], - receipt_ids: vec![], - gas_burnt: 1, - tokens_burnt: big_int(2), - executor_id: "near".to_string(), - metadata: 0, - status: Some(codec::execution_outcome::Status::SuccessValue( - codec::SuccessValueExecutionStatus { value: vec![0x00] }, - )), - }) - } - - fn big_int(input: u64) -> Option { - let value = - BigInt::try_from(input).unwrap_or_else(|_| panic!("Invalid BigInt value {}", input)); - let bytes = value.to_signed_bytes_le(); - - Some(codec::BigInt { bytes }) - } - - fn hash(input: &str) -> Option { - Some(codec::CryptoHash { - bytes: hex::decode(input).unwrap_or_else(|_| panic!("Invalid hash value {}", input)), - }) - } - - fn public_key(input: &str) -> Option { - Some(codec::PublicKey { - r#type: 0, - bytes: hex::decode(input) - .unwrap_or_else(|_| panic!("Invalid PublicKey value {}", input)), - }) - } - - fn signature(input: &str) -> Option { - Some(codec::Signature { - r#type: 0, - bytes: hex::decode(input) - .unwrap_or_else(|_| panic!("Invalid Signature value {}", input)), - }) - } - - struct BytesHeap { - api_version: graph::semver::Version, - memory: Vec, - } - - impl BytesHeap { - fn new(api_version: graph::semver::Version) -> Self { - Self { - api_version, - memory: vec![], - } - } - } - - impl AscHeap for BytesHeap { - fn raw_new( - &mut self, - - _store: &mut StoreContextMut, - bytes: &[u8], - _gas: &GasCounter, - ) -> Result { - self.memory.extend_from_slice(bytes); - Ok((self.memory.len() - bytes.len()) as u32) - } - - fn read_u32( - &self, - store: &StoreContext, - offset: u32, - gas: &GasCounter, - ) -> Result { - let mut data = [std::mem::MaybeUninit::::uninit(); 4]; - let init = self.read(store, offset, &mut data, gas)?; - Ok(u32::from_le_bytes(init.try_into().unwrap())) - } - - fn read<'a>( - &self, - _store: &StoreContext, - offset: u32, - buffer: &'a mut [std::mem::MaybeUninit], - _gas: &GasCounter, - ) -> Result<&'a mut [u8], DeterministicHostError> { - let memory_byte_count = self.memory.len(); - if memory_byte_count == 0 { - return Err(DeterministicHostError::from(anyhow!( - "No memory is allocated" - ))); - } - - let start_offset = offset as usize; - let end_offset_exclusive = start_offset + buffer.len(); - - if start_offset >= memory_byte_count { - return Err(DeterministicHostError::from(anyhow!( - "Start offset {} is outside of allocated memory, max offset is {}", - start_offset, - memory_byte_count - 1 - ))); - } - - if end_offset_exclusive > memory_byte_count { - return Err(DeterministicHostError::from(anyhow!( - "End of offset {} is outside of allocated memory, max offset is {}", - end_offset_exclusive, - memory_byte_count - 1 - ))); - } - - let src = &self.memory[start_offset..end_offset_exclusive]; - - Ok(init_slice(src, buffer)) - } - - fn api_version( - &self, - _store: &StoreContext, - ) -> graph::semver::Version { - self.api_version.clone() - } - - fn asc_type_id( - &self, - _store: &mut StoreContextMut, - type_id_index: graph::runtime::IndexForAscTypeId, - ) -> Result { - // Not totally clear what is the purpose of this method, why not a default implementation here? - Ok(type_id_index as u32) - } - } -} +// #[cfg(test)] +// mod tests { +// use std::convert::TryFrom; + +// use super::*; + +// use graph::{ +// anyhow::anyhow, +// prelude::{hex, BigInt}, +// runtime::{gas::GasCounter, DeterministicHostError, HostExportError}, +// util::mem::init_slice, +// wasmtime::StoreContext, +// }; +// // use graph_runtime_test::test_module_latest; + +// // #[tokio::test] +// // async fn block_trigger_to_asc_ptr() { +// // let mut instance = test_module_latest("b", "boolean.wasm").await; +// // let trigger = NearTrigger::Block(Arc::new(block())); +// // let wasm_ctx = instance.store.data().clone(); + +// // let result: anyhow::Result<()> = Ok(()); +// // let result = trigger.to_asc_ptr( +// // &mut instance.store.as_context_mut(), +// // &mut wasm_ctx.as_mut().asc_heap_mut(), +// // &GasCounter::new(GasMetrics::mock()), +// // ); +// // assert!(result.is_ok()); +// // } + +// // #[tokio::test] +// // async fn receipt_trigger_to_asc_ptr() { +// // let mut instance = test_module_latest("b2", "boolean.wasm").await; +// // let wasm_ctx = instance.store.data().clone(); +// // let trigger = NearTrigger::Receipt(Arc::new(ReceiptWithOutcome { +// // block: Arc::new(block()), +// // outcome: execution_outcome_with_id().unwrap(), +// // receipt: receipt().unwrap(), +// // })); + +// // let result = trigger.to_asc_ptr( +// // &mut instance.store.as_context_mut(), +// // &mut wasm_ctx.as_mut().asc_heap_mut(), +// // &GasCounter::new(GasMetrics::mock()), +// // ); +// // let result: anyhow::Result<()> = Ok(()); +// // assert!(result.is_ok()); +// // } + +// fn block() -> codec::Block { +// codec::Block { +// author: "test".to_string(), +// header: Some(codec::BlockHeader { +// height: 2, +// prev_height: 1, +// epoch_id: hash("01"), +// next_epoch_id: hash("02"), +// hash: hash("01"), +// prev_hash: hash("00"), +// prev_state_root: hash("bb00010203"), +// chunk_receipts_root: hash("bb00010203"), +// chunk_headers_root: hash("bb00010203"), +// chunk_tx_root: hash("bb00010203"), +// outcome_root: hash("cc00010203"), +// chunks_included: 1, +// challenges_root: hash("aa"), +// timestamp: 100, +// timestamp_nanosec: 0, +// random_value: hash("010203"), +// validator_proposals: vec![], +// chunk_mask: vec![], +// gas_price: big_int(10), +// block_ordinal: 0, +// total_supply: big_int(1_000), +// challenges_result: vec![], +// last_final_block: hash("00"), +// last_final_block_height: 0, +// last_ds_final_block: hash("00"), +// last_ds_final_block_height: 0, +// next_bp_hash: hash("bb"), +// block_merkle_root: hash("aa"), +// epoch_sync_data_hash: vec![0x00, 0x01], +// approvals: vec![], +// signature: signature("00"), +// latest_protocol_version: 0, +// }), +// chunk_headers: vec![chunk_header().unwrap()], +// shards: vec![codec::IndexerShard { +// shard_id: 0, +// chunk: Some(codec::IndexerChunk { +// author: "near".to_string(), +// header: chunk_header(), +// transactions: vec![codec::IndexerTransactionWithOutcome { +// transaction: Some(codec::SignedTransaction { +// signer_id: "signer".to_string(), +// public_key: public_key("aabb"), +// nonce: 1, +// receiver_id: "receiver".to_string(), +// actions: vec![], +// signature: signature("ff"), +// hash: hash("bb"), +// }), +// outcome: Some(codec::IndexerExecutionOutcomeWithOptionalReceipt { +// execution_outcome: execution_outcome_with_id(), +// receipt: receipt(), +// }), +// }], +// receipts: vec![receipt().unwrap()], +// }), +// receipt_execution_outcomes: vec![codec::IndexerExecutionOutcomeWithReceipt { +// execution_outcome: execution_outcome_with_id(), +// receipt: receipt(), +// }], +// }], +// state_changes: vec![], +// } +// } + +// fn receipt() -> Option { +// Some(codec::Receipt { +// predecessor_id: "genesis.near".to_string(), +// receiver_id: "near".to_string(), +// receipt_id: hash("dead"), +// receipt: Some(codec::receipt::Receipt::Action(codec::ReceiptAction { +// signer_id: "near".to_string(), +// signer_public_key: public_key("aa"), +// gas_price: big_int(2), +// output_data_receivers: vec![], +// input_data_ids: vec![], +// actions: vec![ +// codec::Action { +// action: Some(codec::action::Action::CreateAccount( +// codec::CreateAccountAction {}, +// )), +// }, +// codec::Action { +// action: Some(codec::action::Action::DeployContract( +// codec::DeployContractAction { +// code: vec![0x01, 0x02], +// }, +// )), +// }, +// codec::Action { +// action: Some(codec::action::Action::FunctionCall( +// codec::FunctionCallAction { +// method_name: "func".to_string(), +// args: vec![0x01, 0x02], +// gas: 1000, +// deposit: big_int(100), +// }, +// )), +// }, +// codec::Action { +// action: Some(codec::action::Action::Transfer(codec::TransferAction { +// deposit: big_int(100), +// })), +// }, +// codec::Action { +// action: Some(codec::action::Action::Stake(codec::StakeAction { +// stake: big_int(100), +// public_key: public_key("aa"), +// })), +// }, +// codec::Action { +// action: Some(codec::action::Action::AddKey(codec::AddKeyAction { +// public_key: public_key("aa"), +// access_key: Some(codec::AccessKey { +// nonce: 1, +// permission: Some(codec::AccessKeyPermission { +// permission: Some( +// codec::access_key_permission::Permission::FunctionCall( +// codec::FunctionCallPermission { +// // allowance can be None, so let's test this out here +// allowance: None, +// receiver_id: "receiver".to_string(), +// method_names: vec!["sayGm".to_string()], +// }, +// ), +// ), +// }), +// }), +// })), +// }, +// codec::Action { +// action: Some(codec::action::Action::AddKey(codec::AddKeyAction { +// public_key: public_key("aa"), +// access_key: Some(codec::AccessKey { +// nonce: 1, +// permission: Some(codec::AccessKeyPermission { +// permission: Some( +// codec::access_key_permission::Permission::FullAccess( +// codec::FullAccessPermission {}, +// ), +// ), +// }), +// }), +// })), +// }, +// codec::Action { +// action: Some(codec::action::Action::DeleteKey(codec::DeleteKeyAction { +// public_key: public_key("aa"), +// })), +// }, +// codec::Action { +// action: Some(codec::action::Action::DeleteAccount( +// codec::DeleteAccountAction { +// beneficiary_id: "suicided.near".to_string(), +// }, +// )), +// }, +// ], +// })), +// }) +// } + +// fn chunk_header() -> Option { +// Some(codec::ChunkHeader { +// chunk_hash: vec![0x00], +// prev_block_hash: vec![0x01], +// outcome_root: vec![0x02], +// prev_state_root: vec![0x03], +// encoded_merkle_root: vec![0x04], +// encoded_length: 1, +// height_created: 2, +// height_included: 3, +// shard_id: 4, +// gas_used: 5, +// gas_limit: 6, +// validator_reward: big_int(7), +// balance_burnt: big_int(7), +// outgoing_receipts_root: vec![0x07], +// tx_root: vec![0x08], +// validator_proposals: vec![codec::ValidatorStake { +// account_id: "account".to_string(), +// public_key: public_key("aa"), +// stake: big_int(10), +// }], +// signature: signature("ff"), +// }) +// } + +// fn execution_outcome_with_id() -> Option { +// Some(codec::ExecutionOutcomeWithId { +// proof: Some(codec::MerklePath { path: vec![] }), +// block_hash: hash("aa"), +// id: hash("beef"), +// outcome: execution_outcome(), +// }) +// } + +// fn execution_outcome() -> Option { +// Some(codec::ExecutionOutcome { +// logs: vec!["string".to_string()], +// receipt_ids: vec![], +// gas_burnt: 1, +// tokens_burnt: big_int(2), +// executor_id: "near".to_string(), +// metadata: 0, +// status: Some(codec::execution_outcome::Status::SuccessValue( +// codec::SuccessValueExecutionStatus { value: vec![0x00] }, +// )), +// }) +// } + +// fn big_int(input: u64) -> Option { +// let value = +// BigInt::try_from(input).unwrap_or_else(|_| panic!("Invalid BigInt value {}", input)); +// let bytes = value.to_signed_bytes_le(); + +// Some(codec::BigInt { bytes }) +// } + +// fn hash(input: &str) -> Option { +// Some(codec::CryptoHash { +// bytes: hex::decode(input).unwrap_or_else(|_| panic!("Invalid hash value {}", input)), +// }) +// } + +// fn public_key(input: &str) -> Option { +// Some(codec::PublicKey { +// r#type: 0, +// bytes: hex::decode(input) +// .unwrap_or_else(|_| panic!("Invalid PublicKey value {}", input)), +// }) +// } + +// fn signature(input: &str) -> Option { +// Some(codec::Signature { +// r#type: 0, +// bytes: hex::decode(input) +// .unwrap_or_else(|_| panic!("Invalid Signature value {}", input)), +// }) +// } + +// struct BytesHeap { +// api_version: graph::semver::Version, +// memory: Vec, +// } + +// impl BytesHeap { +// fn new(api_version: graph::semver::Version) -> Self { +// Self { +// api_version, +// memory: vec![], +// } +// } +// } + +// impl AscHeap for BytesHeap { +// fn raw_new( +// &mut self, + +// _store: &mut StoreContextMut, +// bytes: &[u8], +// _gas: &GasCounter, +// ) -> Result { +// self.memory.extend_from_slice(bytes); +// Ok((self.memory.len() - bytes.len()) as u32) +// } + +// fn read_u32( +// &self, +// store: &StoreContext, +// offset: u32, +// gas: &GasCounter, +// ) -> Result { +// let mut data = [std::mem::MaybeUninit::::uninit(); 4]; +// let init = self.read(store, offset, &mut data, gas)?; +// Ok(u32::from_le_bytes(init.try_into().unwrap())) +// } + +// fn read<'a>( +// &self, +// _store: &StoreContext, +// offset: u32, +// buffer: &'a mut [std::mem::MaybeUninit], +// _gas: &GasCounter, +// ) -> Result<&'a mut [u8], DeterministicHostError> { +// let memory_byte_count = self.memory.len(); +// if memory_byte_count == 0 { +// return Err(DeterministicHostError::from(anyhow!( +// "No memory is allocated" +// ))); +// } + +// let start_offset = offset as usize; +// let end_offset_exclusive = start_offset + buffer.len(); + +// if start_offset >= memory_byte_count { +// return Err(DeterministicHostError::from(anyhow!( +// "Start offset {} is outside of allocated memory, max offset is {}", +// start_offset, +// memory_byte_count - 1 +// ))); +// } + +// if end_offset_exclusive > memory_byte_count { +// return Err(DeterministicHostError::from(anyhow!( +// "End of offset {} is outside of allocated memory, max offset is {}", +// end_offset_exclusive, +// memory_byte_count - 1 +// ))); +// } + +// let src = &self.memory[start_offset..end_offset_exclusive]; + +// Ok(init_slice(src, buffer)) +// } + +// fn api_version( +// &self, +// _store: &StoreContext, +// ) -> graph::semver::Version { +// self.api_version.clone() +// } + +// fn asc_type_id( +// &self, +// _store: &mut StoreContextMut, +// type_id_index: graph::runtime::IndexForAscTypeId, +// ) -> Result { +// // Not totally clear what is the purpose of this method, why not a default implementation here? +// Ok(type_id_index as u32) +// } +// } +// } diff --git a/node/src/main.rs b/node/src/main.rs index 365c61da3a1..c468b264f55 100644 --- a/node/src/main.rs +++ b/node/src/main.rs @@ -28,8 +28,8 @@ use graph_chain_starknet::{self as starknet, Block as StarknetBlock}; use graph_chain_substreams as substreams; use graph_core::polling_monitor::{arweave_service, ipfs_service}; use graph_core::{ - LinkResolver, SubgraphAssignmentProvider as IpfsSubgraphAssignmentProvider, - SubgraphInstanceManager, SubgraphRegistrar as IpfsSubgraphRegistrar, + SubgraphAssignmentProvider as IpfsSubgraphAssignmentProvider, SubgraphInstanceManager, + SubgraphRegistrar as IpfsSubgraphRegistrar, }; use graph_graphql::prelude::GraphQlRunner; use graph_node::chain::{ @@ -260,7 +260,7 @@ async fn main() { // Convert the clients into a link resolver. Since we want to get past // possible temporary DNS failures, make the resolver retry - let link_resolver = Arc::new(LinkResolver::new(ipfs_clients, env_vars.cheap_clone())); + let link_resolver = Arc::new(IpfsResolver::new(ipfs_clients, env_vars.cheap_clone())); let mut metrics_server = PrometheusMetricsServer::new(&logger_factory, prometheus_registry.clone()); diff --git a/node/src/manager/commands/run.rs b/node/src/manager/commands/run.rs index 3a7bc435f77..80a13479adb 100644 --- a/node/src/manager/commands/run.rs +++ b/node/src/manager/commands/run.rs @@ -23,7 +23,7 @@ use graph::endpoint::EndpointMetrics; use graph::env::EnvVars; use graph::firehose::FirehoseEndpoints; use graph::prelude::{ - anyhow, tokio, BlockNumber, DeploymentHash, LinkResolver, LoggerFactory, NodeId, + anyhow, tokio, BlockNumber, DeploymentHash, IpfsResolver, LoggerFactory, NodeId, SubgraphAssignmentProvider, SubgraphCountMetric, SubgraphName, SubgraphRegistrar, SubgraphStore, SubgraphVersionSwitchingMode, ENV_VARS, }; @@ -96,7 +96,7 @@ pub async fn run( // Convert the clients into a link resolver. Since we want to get past // possible temporary DNS failures, make the resolver retry - let link_resolver = Arc::new(LinkResolver::new(ipfs_clients, env_vars.cheap_clone())); + let link_resolver = Arc::new(IpfsResolver::new(ipfs_clients, env_vars.cheap_clone())); let eth_rpc_metrics = Arc::new(ProviderEthRpcMetrics::new(metrics_registry.clone())); let eth_networks = create_ethereum_networks_for_chain( diff --git a/store/postgres/src/relational.rs b/store/postgres/src/relational.rs index 7346dd41b81..43ba7d32944 100644 --- a/store/postgres/src/relational.rs +++ b/store/postgres/src/relational.rs @@ -312,9 +312,9 @@ impl Layout { use_prefix_comparison: false, }, ], - /// The position of this table in all the tables for this layout; this - /// is really only needed for the tests to make the names of indexes - /// predictable + // The position of this table in all the tables for this layout; this + // is really only needed for the tests to make the names of indexes + // predictable position: position as u32, is_account_like: false, immutable: false, diff --git a/tests/src/fixture/mod.rs b/tests/src/fixture/mod.rs index 3ed0792ea20..870944cd82f 100644 --- a/tests/src/fixture/mod.rs +++ b/tests/src/fixture/mod.rs @@ -32,17 +32,17 @@ use graph::prelude::ethabi::ethereum_types::H256; use graph::prelude::serde_json::{self, json}; use graph::prelude::{ async_trait, lazy_static, r, ApiVersion, BigInt, BlockNumber, DeploymentHash, - GraphQlRunner as _, LoggerFactory, NodeId, QueryError, SubgraphAssignmentProvider, - SubgraphCountMetric, SubgraphName, SubgraphRegistrar, SubgraphStore as _, - SubgraphVersionSwitchingMode, TriggerProcessor, + GraphQlRunner as _, IpfsResolver, LoggerFactory, NodeId, QueryError, + SubgraphAssignmentProvider, SubgraphCountMetric, SubgraphName, SubgraphRegistrar, + SubgraphStore as _, SubgraphVersionSwitchingMode, TriggerProcessor, }; use graph::runtime::wasm::RuntimeHostBuilder; use graph::schema::InputSchema; use graph_chain_ethereum::Chain; use graph_core::polling_monitor::{arweave_service, ipfs_service}; use graph_core::{ - LinkResolver, SubgraphAssignmentProvider as IpfsSubgraphAssignmentProvider, - SubgraphInstanceManager, SubgraphRegistrar as IpfsSubgraphRegistrar, SubgraphTriggerProcessor, + SubgraphAssignmentProvider as IpfsSubgraphAssignmentProvider, SubgraphInstanceManager, + SubgraphRegistrar as IpfsSubgraphRegistrar, SubgraphTriggerProcessor, }; use graph_node::manager::PanicSubscriptionManager; use graph_node::{config::Config, store_builder::StoreBuilder}; @@ -445,7 +445,7 @@ pub async fn setup( let static_filters = env_vars.experimental_static_filters; let ipfs = IpfsClient::localhost(); - let link_resolver = Arc::new(LinkResolver::new( + let link_resolver = Arc::new(IpfsResolver::new( vec![ipfs.cheap_clone()], Default::default(), ));